Language…
13 users online:  AmperSam, dotCoockie, Golden Yoshi, Hayashi Neru, JezJitzu, jirok1, Mario's GameBase,  MarioFanGamer, PMH, Rykon-V73, Sparkz314, timothy726, toady - Guests: 243 - Bots: 281
Users: 64,795 (2,377 active)
Latest user: mathew

Preventing the game from reseting RAM values like lives when it loads a Saved game

Hey, I am using this SRAM Plus patch (https://www.smwcentral.net/?p=section&a=details&id=14762) in order to save more things like lives and powerup and score.
But the patch says I need to also add something to disable the game from reseting the values I am making save-ale when loading the save file. So I have this information about the save routine (and load) on this page according to the ROM Map section here : http://www.smwiki.net/wiki/Save_routine

But I'm not sure here how I can target the load routine of the game reseting any values. Am I supposed to check the load routine by hand with hex editor on my rom, translate it into ASM code, and then figure out where it is trying to reset smtg that I don't want to be reset? Oo
I made the hacks Tsunami Island and Super Mario Archipelago
Check them out !
Look for $00A1A6 (labeled Clear_1A_13D3:" on the all.log)
Give thanks to RPG hacker for working on Asar.


To clarify, there is already a disassembled version of SMW known as all.log, no need to translate hex yourself. Alternatively you can use smw-irq, which is an alternative disassembly with a more friendly format (that also actually reassembles). (I personally prefer it, but SMWDisc is easier for counting bytes if you haven't yet memorized the opcode lengths)

To find places to hijack, the easiest methods are to either search for related areas in the ROM map, or search the entire disassembly for a related RAM address. In this case, the code the SRAM Plus patch is specifically referring to are these lines at $009E21:

Code
	LDX.w $0DB2		;$009E21	|\ 
	LDA.b #$04		;$009E24	||| Number of lives to start both players with.
CODE_009E26:			;		||
	STA.w $0DB4,X		;$009E26	||
	DEX			;$009E29	||
	BPL CODE_009E26		;$009E2A	||
	STA.w $0DBE		;$009E2C	|/
	STZ.w $0DBF		;$009E2F	| Clear the current player's coin count.
	STZ.w $0DC1		;$009E32	| Clear Yoshi.
	STZ $19			;$009E35	| Clear powerups.
	STZ.w $0DC2		;$009E37	| Clear the item box.
	STZ.w $13C9		;$009E3A	| Prevent the "Continue/End" screen from appearing.
	REP #$20		;$009E3D	|
	STZ.w $0DB6		;$009E3F	| Clear Mario and Luigi's coins.
	STZ.w $0DB8		;$009E42	| Clear Mario and Luigi's powerups.
	STZ.w $0DBA		;$009E45	| Clear Mario and Luigi's Yoshis.
	STZ.w $0DC2		;$009E48	| Clear Mario and Luigi's item boxes.
	STZ.w $0F48		;$009E4B	| Clear Mario and Luigi's bonus stars.
	STZ.w $0F34		;$009E4E	|\ 
	STZ.w $0F37		;$009E51	||
	SEP #$20		;$009E54	|| Clear Mario and Luigi's scores.
	STZ.w $0F36		;$009E56	||
	STZ.w $0F39		;$009E59	|/


Basically, for any values you load from SRAM instead, you'll need to skip over the corresponding lines here. You can do that by either changing them to a NOP #x (where x is the number of bytes to skip) or by using a BRA + to skip over several lines at once.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
I respect the authors work, but it has always baffled me as to why this isn't included in the patch. Probably 80% of active users trying to use this patch, never do because they couldn't figure that out.
Because which ram address to not clear varies. What if I don't want to save the lives and randomly stop the value from being set? I'd start out with 1 live and have no idea why.
To begin with, SRAM plus is more of a developer tool anyway.
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
thanks for the info I'm gonna try to do it and if it's not overly complicated provide the functionality in the original patch?? I do need this to work for my hack
or maybe just this info or a link to it in the file or smtg?

it seems simple yeah I can just add the NOP lines in the asm seems simple
it can be included because in that other patch you can pick what you want to be saved and not and they show u the references of that, and you can ";" them out of there if you don't want them same can be done with this as far as I understand

edit: done it works if someone need I could upload with my modifications if that's any help its nice patch;; I'm actually not saving lives in my hack and it seemed slightly trickier to disable lives being reset but yeah that was intended for me anyway
I made the hacks Tsunami Island and Super Mario Archipelago
Check them out !
@Jack Yeah, I can see that now. I still believe the patch would get much more use from beginner to intermediate range if this was easier to enable.