-
Notifications
You must be signed in to change notification settings - Fork 820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use hardware.inc
from gbdev
#914
Comments
IIRC one of the issues was that it doesn't have all the defines that we need, but if we need them, then they're likely very useful to other projects as well, so we should be contributing them upstream as well. Until then it's fine to have a modified hardware.inc in this repository. Other than that it's just porting busywork. |
Would it be hard to use hardware.inc and then define new pret constants in a separate file? Although I agree, it could just be busy work. |
I've always been a strong advocate of just taking whatever you need from hardware.inc instead of polluting your namespace with lots of constants you have no intentions of using. After all, hardware.inc describes hardware that has been out of manufacturing for over 20 years; there's no chance for that hardware to change, so keeping "up to date" with changes upstream is irrelevant here. And yes, the focus on MBC5 is problematic. I have no idea of why hardware.inc makes this choice, as not even all homebrew uses MBC5. But it does, and it would collide with the MBC3+RTC cart that Pokémon Crystal uses. |
The advantages are not much, but still exist:
I'm not sure what focus hardware.inc might be having? Grepping |
Keeping up to date with RGBDS is part of what I'm worried about — pokecrystal occasionally lags behind, so it's better to update those definitions along with everything else. The effort is minimal and we ensure that we can always build the repo with a single version of the toolchain. (This is not much of a concern as long as pokecrystal is part of RGBDS's CI, but we're talking about minor differences here.) The MBC5 constants (the ones under that comment) are simply incorrect for other cart types. $3000 maps to the ROM bank, not to the "ROM bank upper byte", for instance. (And it makes no sense to speak of a "byte 0" when there's only one byte.) What differences in constants can you find? |
This is a non-issue. The file would be copied and checked into this repository. Even if the repository were to be a submodule (it won't), the version would be pinned. Most of the benefit is in following community standards and contributing to how the hardware definitions are specified, as well as making it easier for users to use additional hardware that we haven't even considered adding to hardware_constants.inc (for example, MBCs), or future clarifications of or additions to the constants. |
Don't we already follow standards in everything but MBC registers (where we can't, because hardware.inc doesn't implement MBC3)?
hardware.inc doesn't support anything but MBC5, and what other additional hardware are you referring to?
I don't see much changing when we're talking about a device that has been out of manufacturing for 20 years. If we're going to take a snapshot of the file and check it in, what's there to gain with respect to what we already have, which is essentially a snapshot with the constants we use? |
We don't
GB hardware and bit definitions that the game doesn't use.
Keeping things in sync. If we were already using all the same constants it'd be a drop-in. It isn't. |
I think a step we can agree on is to rename our constants to match hardware.inc's names, then? |
Yes. Although there's no reason not to use and contribute to hardware.inc at that point. Polluting the namespace with definitions relating to common gameboy hardware simply isn't a concern, and the MBC5-specific definitions can be ignored. |
And, as I've asked in my previous post, how does |
Draft PR exists that has a proof-of-concept working compile and matching builds using latest RGBDS master as well as RGBDS v0.5.2 (#943) |
Said hardware.inc PR will also need companions across the whole of pret, updating their builds to use the latest hardware.inc if they use it already and refactoring them to use hardware.inc if they don't |
@ISSOtm mentioned this on discord today, that we should be using
hardware.inc
from https://github.com/gbdev/hardware.inc/blob/master/hardware.inc. Looking at the discord history, It sems this was discussed in the past, but I didn't see a clear definitive reason why or why not use it. A couple points on why not seemed to do with extra "noise", that it might be based on MBC5, and how pokecrystal uses more constants related to individual bits.Anyways, I'm going to let you all who have more experience weigh in on this. I'm just opening this to start a discussion. If we decide to take action with this, i'll help out.
The text was updated successfully, but these errors were encountered: