ROM Hack How to store value for Action Replay codes? (NDS)

  • Thread starter Thread starter rodyt
  • Start date Start date
  • Views Views 2,570
  • Replies Replies 3

rodyt

New Member
Newbie
Joined
Aug 1, 2020
Messages
2
Reaction score
0
Trophies
0
Age
26
XP
77
Country
United States
I want to be able to store a boolean value (00 or 01) that persists across individual AR codes, and then be able to compare that value using the "9x" code operator.
How can I do this?
 
For the sake of others playing along a listing of the various code types.
https://gamehacking.org/wiki/Hacking_NDS#Action_Replay_DS

Short version you are going to need to find a portion of memory that is unused and stick your boolean value there. I don't believe there is a means to store a value in the AR setup outside of the offset used by various things and data register used by the D codes, and even with the hacks you can't fetch the data back out (to say nothing of robbing you of the functionality of those, or maybe messing things up in older codes unless you disable offset use).
https://gbatemp.net/threads/unofficial-desmume-build-unused-memory-finder-tool.349332/
There is a version of desmume that checks for memory writes, and an older version of DSATM (4.3.4 if memory serves) that will do DEADBEEF padding (sets the whole memory to DEADBEEF so anything that reads that later into the game should be free)
That said if it is a simple boolean value you can find any number of things -- if it is a wifi game I would probably just find one of the unused error code strings in memory (they are usually all there in ASCII) and overwrite that, there will probably be something unused in the little dump of firmware settings (language is often used but most of the rest are not).

All that said this does seem like the sort of thing a button activator is normally used for, or possibly a code on-off option in an emulator or flash cart.
 
Thanks for the reply.

I went ahead and used an AR code to set a flag using the last 2 bytes in main memory (0x2FFFFFE & 0x2FFFFFF). A value of 00 means "OFF" and 01 means "ON". It works perfectly fine on emulator (DeSmuMe).

Once I try it on my actual DS however, it seems that I am unable to write to the address using the AR code!

Have you encountered this issue before? If I need to use a different memory address, can you recommend any unused address ranges for the NDS?
 
Later addresses can sometimes be fun (overlays can be stashed there, settings as well) but it should have worked.

Unused stuff. Yeah if it is a wifi game then dump the memory -- all those nice long ASCII text error codes dealing with exotic wifi errors that nobody will ever likely encounter (and may never have encountered even when it was live) will be there from early boot and likely never touched, not that you probably care if someone does encounter the obscure message on one of the wifi replacements and the game displays slightly garbled text or maybe crashes. I use such things all the time when the binary decides to house some game text I want to expand or need something for a little routine I want to add in.

Otherwise you can try to see somewhere that might have a few bytes between sections, or use the DEADBEEF padding if you can find the relevant dsatm (archive.org will hopefully have something. https://web.archive.org/web/20181007060521/http://min.midco.net/cracker/DSATM.rar is a bit older than the one I would have wanted but should still have it), or the desmume build linked earlier. Settings from the firmware can also be useful -- find that cheat that forces language change (should be the same for most games) and the other settings will be around there. If you want to play it more cowboy style then whatever the lowest overlay address is go a byte/16 bits or two back from there -- 99% of the time games will start using data after the binary and not reach the parts where the overlays are kept.
DS games can sometimes be fairly hard on memory but if you are coming to us from the NES and whatnot where every byte counted then yeah not so much -- most care more about alignment than simple storage.
 

Site & Scene News

Popular threads in this forum