-
Notifications
You must be signed in to change notification settings - Fork 5
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
Reorganise the data for more flexilbility #9
Comments
For now I rolled a new patch for you which omits all the decoded data from my end and expects encoded data for the nametables and attribute tables, which you'll add starting in bank The code change expects you to write the nametable and attribute table addresses in the room data, at bytes Granted, I haven't been able to test this since I don't have your relocated data in the rom yet, so please provide instructions here on how to build it if you end up with problems (or a patch containing just the new data is also good in that case). |
If you want to try building snarfblasm: |
I'm looking into your patch. I updated the To generate the ROM, clone the repo, git checkout the Then run: node experiments/relocateNtAttrs.js -i path/to/Maniac\ Mansion\ \(USA\).nes You'll get a ROM called You mentioned:
Am I expected to duplicate the banks myself? This is not done at the moment. The ROM doesn't work, it freezes after the title screens. I can provide you with the patched ROM if you want. |
I'm traveling so won't be able to look at the resulting rom for a few days. A few comments in the meantime...
The patch duplicates banks 0 and 7 so you don't need to do that. |
I cloned the repo and can generate the rom. Found one issue here: That's pointing to the tiles table index followed by the palette. The nametable actually starts at That's not the only problem though, I'm still working through issues my end. |
I think you also want to add |
Ah I see the problem. I'll work on a fix for both issues. Another thing I forgot to mention, and in case it's no obvious, but the parser and the internal logic works on PRG (not ROM). Most of the code comes from SCUMMVM that does it that way. The iNES header is stripped before parsing and added back when a NES needs to be created. So most offsets will be off by 16 bytes. |
I pushed a new commit to the WIP |
Found another issue, these are both off by one so it causes all kinds of havoc during execution. E.g. the last byte of the new nametable gets clobbered by the new attribute table, which is missing a byte at the end as well. The original data also has the 2 bytes left over. https://github.com/gmarty/scumm-nes/blob/relocate-nametable-attrs/src/lib/parser/room/parseRoomNametable.js#L57 |
That was much more complicated than I had anticipated due to issues on both sides, but I finally got it all working together (including the off by one errors above). The patch can now be applied after your build. The previous patch was incomplete so I've updated the link in the original reply. #9 (comment) |
Thanks for spotting it! I published a fix for the off by 1 offsets. I'll land the branch with the relocation code and we can enquire the bug and land a fix in a subsequent commit. |
It looks like the freeze is related to the MMC1 bank register getting into an unknown state. MMC1 requires 5 writes to change banks and I suspect that nmi is triggering in the middle of a bank switch which then doesn't recover correctly. This causes an unexpected bank to be loaded later on, then RLE data is read from the wrong location and spills into other memory. A typical buffer overflow. The workaround is to reset the register by writing the high bit before changing banks. I've updated the patch. |
The ROM files of Maniac Mansion are pretty much full of data. It means any modification (e.g. changing the nametable, adding new tiles or new objects...) is unlikely to fit in the original size.
To get more flexibility with the editing process, the ROM needs to be expanded and the data reorganised. After a few discussions with @gzip, it looks like the easiest route to take is to do something similar to what Maniac Mansion Decoded does.
This requires:
The last point is the tricky one.
The runtime ASM patch needs to be compiled to an IPS patch. In an ideal world, the patch would be compiled on commit to avoid having 2 files out of sync (the original ASM code and the IPS patch).
Maniac Mansion Decoded uses snarfblasm and I don't know if it can compile on Mac.
Once the patch is checked in, it can be applied with RomPatcher.js.
The patch needs to be compatible with all the different versions of the original ROM. That means we may end up needing one patch per version.
In order to break this down as much as possible, the reorganising of the tiles and the title screen data can be done later.
The text was updated successfully, but these errors were encountered: