-
Notifications
You must be signed in to change notification settings - Fork 818
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
Generate the correct Stadium base data for every ROM #1010
Conversation
The base data stores a bit for each bank of the built ROM, indicating whether it matches the bank in the base file (crystal_base0.bin for US, crystal_base1.bin for EU). We don't want to store those whole files, so stadium.c just stores CRCs for each bank of the base .bin files, and compares them with CRCs of the built ROM banks. This runs the risk of CRC collisions, but works in practice for all the official ROMs. If we want to avoid storing any information derived from those two .bin files, we could do as @mid-kid suggested: store CRCs for the banks that have 1 bits (since those can be derived from the matching ROMs), and store flags for the rest indicating that they don't match. (So the I'd be okay with that change; it's a small update to the code: // Calculate the base data bits using bank CRCs
// Bits indicate if the bank CRC matches the base one
for (int i = 0; i < BASEDATASIZE - BASEHEADERSIZE; i++) {
uint8_t bits = 0;
for (int j = 0; j < 8; j++) {
int bank = i * 8 + j;
+ if (base_crcs[bank] != -1) {
uint16_t crc = calculate_crc(CRC_INIT, file, bank * BANKSIZE, BANKSIZE);
bits |= (crc == base_crcs[bank]) << j;
+ }
}
file[BASEDATAOFF + BASEHEADERSIZE + i] = bits;
} |
Let me see if I understand this correctly. What you are saying.. is instead of storing every CRC from the So what we can essentially do is perform a logical Finally If I am understanding correctly... Then I agree, I think that is also the better option then storing every CRC from |
@vulcandth The idea is to store a "dummy" CRC value for the banks we can't recover. If the value is a dummy, it's automatically a 1. No need for full ORing. |
We do already source data from the leaks, since we build Other changes to make (do them to pokegold as well when applicable):
|
@mid-kid I've made the changes you requested. Will do the same to pokegold after this merges. |
LGTM now, thanks for making the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this looks fine to me too. Good work.
Fixes #752.
The
-e
flag was tested and works for all the European ROMs mentioned in #626.