Replies: 9 comments 32 replies
-
@galibert or @rb6502 do you have an opinion on this? Personally, I’m happy the proposed convention of |
Beta Was this translation helpful? Give feedback.
-
I concur with Vas. It would clean things up nicely. And not having _w/_r on _cb allows not to have to think about which one to use :-) |
Beta Was this translation helpful? Give feedback.
-
I feel this is unnecessary overreach in its entirety, but I wouldn't object strongly to some kind of consistency on binders. Binders at least conceptually belong to the core. But renaming the actual callbacks people attach to the binders in their drivers is a fork-the-project level offense. Those names belong to the authors of those drivers. Can we start with getting rid of the READ_LINE/WRITE_LINE macros though? That's unambiguously an improvement as long as you don't rename everyone's functions. |
Beta Was this translation helpful? Give feedback.
-
Regarding what binders should look like, the convention I find most natural is From inside the device you use the very natural |
Beta Was this translation helpful? Give feedback.
-
I think conflating "making the codebase more consistently approachable to new contributors" and "overreach" is itself a bit of a reach. I'm not bringing this up because I want to castigate anyone, nor because I want to make anyone's life harder. When I was poring over the codebase, quite a number of my own drivers and devices came onto my radar as not being consistent with what I perceive to be the overall style of the codebase. I think having All I really want is some agreed-upon bulleted list of guidelines that I can run through across the codebase. In discussing it with @galibert, it seems like there's an acknowledgement that the codebase needs some higher level of consistency than it currently has, but those hopes were written off due to tedium. I actually like doing those sorts of broad cleanups, so I'm volunteering to do it. I just need a spec to operate against. |
Beta Was this translation helpful? Give feedback.
-
MAME's historically been attractive to contributors in part because we don't force things on people that are personal preference, like GNU vs K&R vs Allman bracing. (Or OG's insistence that the So my spec:
At some future point I'd be interested in getting rid of the ROM loading macros in favor of explicitly written out code, too. Similar to how address maps evolved. But that's a really big job, probably on the scale of "don't even think it until we decide to do another 2 month release". |
Beta Was this translation helpful? Give feedback.
-
The first two points are solid and sound good to me. The third is one of those hopeless things and is part of my justification for ditching As for the point of "why MAME has been attractive to contributors", I'd pretty much just direct your attention to that classic image of a plane with a bunch of bullet-holes in it. The contributors that currently contribute to MAME have, for some, been drawn in by that freedom to forge their own path stylistically, that much is true. But all the same, there have been people who are explicitly put off by virtue of wanting to learn the codebase, but have their hands full juggling the various conflicting paradigms that exist within the codebase. And I'm not going to pull a Haze, either, in terms of unnamed "them": I've spent quite a lot of time hand-holding this one particular "agg23" guy through the codebase as he's tried to glean enough info to make a MiSTer core for some Sharp SM5x-based LCD handhelds. I get the distinct impression that if I hadn't popped into a particular Discord server at the right time, he wouldn't have cottoned onto MAME at all. And, not to put too fine a point on it, I seem to recall that you were one of the detractors of the I'm not arguing for complete homogeneity in the codebase, because that absolutely would be a buzzkill for contributors. All I'm asking for is avoiding the completely insane situation we have now, where I can literally list off 12 different ways of naming a fricking callback for |
Beta Was this translation helpful? Give feedback.
-
To add to the fun sync and blank are different things and iirc saturn can interrupt on either. |
Beta Was this translation helpful? Give feedback.
-
Well, _r_cb and _w_cb are ugly as shit. |
Beta Was this translation helpful? Give feedback.
-
Currently, MAME is very inconsistent in the naming scheme for read/write handlers, devcb read/write binders, and other things. I'd like to clean all of it up, and have the bandwidth to do so over the next week and a half, but I need some agreement on where to go with it.
I'd like to quickly settle on a consistent naming scheme here, as I've noticed the following things:
write_*
, some use*_out
, some use*_out_cb
, some use*_cb
, some use just*
, some use*_write
, and the vast majority of cases use*_w
.There have been some valid concerns brought up about having prefixes/suffixes at all, given that the intent should be obvious based on a combination of usage and function signature, but the existing inconsistency is still harmful for potential new contributors.
I would like to propose the following:
NAME_r_cb
andNAME_w_cb
.write_*_cb
,write_*
,*_write
, and so on will be replaced with*_w
.A question that immediately springs to mind is, how should binders in devices be named? Should it be from the perspective of the caller, or from the perspective of the device itself? If I'm providing a handler for a
devcb_write_line foo
, should I call the binderfoo_r_cb
orfoo_w_cb
?In addition, I've noticed that VBL handlers for
screen_device
contain a myriad of creatively inconsistent names, including:*_vblank_irq
*_vsync_changed
*_vsync_irq*
I would like to settle on a consistent naming scheme for these callbacks, but I'm open to suggestions.
Beta Was this translation helpful? Give feedback.
All reactions