News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] Save/Load patches caused bugs (+map issue from hex map skip)

Started by xisdense, June 23, 2024, 11:31:09 PM

Previous topic - Next topic

xisdense

Okay, I really hope there's some active members here that are able to help me out with this one, I'm really nervous I've messed up my hack... I'm constantly making backups, but I've made SOOOOO much progress since applying these patches, and I'm only now finding these bugs...

A while ago I applied Skyzer's Map Fix Save/Load patch. I have also applied Adamf's Save Refill V5 patch as well as his included Bugfix Ship Save patch...

Now there are two major issues.

#1: The ship doesn't save at all! It says it has saved, but if you reload or get a game over, it loads at whatever save you used before the ship.
#2: Starting a new game on a different file loads the game at whatever save was used in file 1 instead of at the ship. It appears all files share the same save station?

I'm not sure which patch or combination of these patches is causing the exact issues... I know it's a bit convoluted of a bug and I'm not sure how to reverse using these patches at this point... This is my first SM hack other than a series of like 50 test hacks I did first to get a feel for it lol. Anyways, my stomach is in knots over this one  :nowai:

Appreciate you if you're out there and can help me out!

Zhs2

Quote from: xisdense on June 23, 2024, 11:31:09 PMI know it's a bit convoluted of a bug and I'm not sure how to reverse using these patches at this point...

If you have .asm files you are applying, you should be able to open .asm in a text editor and find the org statement(s) in the file - that tells you the address(es) in the rom the .asm file will start writing code to when applied.

However, if they are .ips patches, you'll have to go the slightly more tedious route. HxD can compare two files. Apply one patch to a vanilla Super Metroid rom and then compare that to another vanilla Super Metroid rom. The difference in the two will show you where that patch writes to, which could be in multiple places...

Either route you have to go, copying the original code from a vanilla SM rom to your hack SHOULD reverse the effects. If I were you, I'd check out that "Bugfix Ship Save" patch first given the funniness you have described.

caauyjdp

#2 is probably caused by combination of Save/Load and a type of Ceres skip. Can be fixed by adding few lines to saveload.
Question is if you're using the asm patch of the ips. If asm add (see below) and reapply the patch
Quote
    after
    ClearSRAM: STA $700000,X : INX : INX : DEY : DEY : BPL ClearSRAM
    add
    LDA #$0000 : STA $7E078B : STA $7E079F ; zero area and save index like vanilla does, so it doesn't corrupt newly generated saves when certain type(s) of ceres skip is used
if ips, I don't think anyone made ips with these changes yet, but I can if needed.
(I'm guessing asm since refill patch only seems to have asm)

#1 it looks like bugfix-ship-save
forgot to LDA $0952 before JSL $818000 so add that and see if it fixes the issues

xisdense

Caauyjdp, thanks so much! I made both adjustments and both bugs are now fixed!!! So amazed at both of your response times too, it's great to see this community is alive and kicking. I used to use these forums when I was a teenager on a lost account (I'm 31 now lol) and dabbled at SM hacking for a minute back then. But I was worried I got back into it too late :lol: Thanks again!

Thank you Zhs2 for your tip too, I was about to do what you suggested with some confidence until I saw caauyjdp's response. I'm gonna give you both special thanks in my credits whenever I finish this thing  :nod:

xisdense

I hope it's okay to double post here; I'm adding to this topic because it's possible this bug is related to the above problems, although I could be wrong...

Saving in one area, entering another area (via elevator), and then getting a game over (without saving in this current area), causes a reload at the old area save station with the map reset. I noticed it actually looks like the pink areas are in the same shape as the pink areas of the area you got the game over in, so it seems it isn't switching back to the other map's uncovered data. (The actual map itself is correct to the area, but the discovered areas don't match and even if you used the map station for the area, it appears as if you haven't)

I'll add for clarity some other possibly related/responsible patches I've applied are DC's Map Patch and the No Hex Map Patch from MFreak's Map Overhaul Patch (but not using the Map Overhaul itself)

:O_o:

caauyjdp

Yet another source of bad hexmap skip

QuoteORG $82898B : DW $8000                  ;if game state is 5: go to "load game data" anyway
ends up calling 82:8000 twice in a row too if i'm not mistaken

in NoHexMap.asm replace that ^ line with

ORG $82898B : DW $89ea ;restore vanilla value
org $819E3E
jsl $80858C ;;; $858C: Load mirror of current area's map explored ;;;
inc $0998 ;inc game state
rtl

and remove lines
QuoteORG $819E3E : PADBYTE $FF : PAD $819E92      ;delete main file select map

and

ORG $8289EA : FILLBYTE $FF : FILL $5

i need to pay more attention. wonder what i messed up this edit

xisdense

I reversed the effects of the patch thanks to Zhs2's advice, applied your changes, and it appears the issue has been solved. I also learned a bit of ASM in the process. Thanks once again, caauyjdp!