Hey, is there a way to make an AR Code for the Nintendo DS that is only executed once? I'm asking this because I'm making a code for Phantom Hourglass which would require me to increment a specific value by 1. I managed to pull that off already but the code is executed in a loop of course which makes my value go up the entire time the code is activated. Would it be possible to change some kind of execution state so that the code is only executed once?
Announcement
Collapse
No announcement yet.
[NDS] Execute an AR Code only once?
Collapse
X
-
Uhm yeah...that's the code I've been using to increment my value. But I've already got that working, my question is how I can keep the code from looping.
An educated guess I've just come up with is to put a button activator at the last line of the code and give it a pretty much impossible button combo, like pressing every button there isLast edited by MichiS97; 07-23-2015, 07:52:52 AM.
Comment
-
-
That increments the offset value, not the data value, right? And unless you took control of setting the offset, all it would do is keep writing whatever is in Dx to the next address on subsequent passes.
Is there a section of memory that isn't used by the games, that is accessible to the AR, and is initialized on start up? That's the easiest way to handle something like this. Check an address there for not-equal <value> and then at the tail end of your code, set the address to that value.
Edit: Button activators may or may not work. The code engine usually executes several times in the duration of one button press, so checking that usually isn't sufficient to limit a code to one write.Last edited by Pyriel; 07-23-2015, 08:19:26 AM.
Comment
-
I tried to do that but the problem is that I don't know how to compare to offsets. Of course, there are code types which would let me check if the value of a given offset is bigger/smaller/equal/not equal to a value that is also given by me but AFAIK you can't just compare two offsets with anotherOriginally posted by Pyriel View PostIs there a section of memory that isn't used by the games, that is accessible to the AR, and is initialized on start up? That's the easiest way to handle something like this. Check an address there for not-equal <value> and then at the tail end of your code, set the address to that value.
Here's the code:
221BA598 00000002 //this gives my player a potion (that already works but the potion isn't usable since the icon for it is greyed out)
94000130 FCFF0000 // simple button activator
DB000000 021BA605 //loads the value at offset 0x021BA605, which determines which icons for the potions are greyed out
D4000000 00000001 //increments the value by 1
D8000000 021BA605 // stores the value back at its address
Okay, so the code works flawlessly, if it wouldn't be for the fact that the value at 0x021BA605 mustn't be incremented more than once.Last edited by MichiS97; 07-23-2015, 09:42:18 AM.
Comment
-
Try something like this:
That line highlighted in green slows down the execution time. If that's too fast or slow, try adjusting the value.Code:::Your Code 221BA598 00000002 [COLOR=#008000]74000100 FF00000C[/COLOR] 94000130 FCFF0000 DB000000 021BA605 D4000000 00000001 D8000000 021BA605 D2000000 00000000
Note: This will not perfect the code. To ensure the code increments by exactly 1 each button press/hold, ASM is your best option.I only bother with things that interest me.
Comment
-
Well, I'm just talking something like:
94000130 FCFF0000
6XXXXXXX 00000001
your code
0XXXXXXX 00000001
The only purpose for XXXXXXX is to ensure the code can be used just once. You could have another code tied to a different combination of buttons set the flag off. However, looking at what you're doing, it seems like the goal might be to run the increment only once each time the code is used (i.e. every time a new potion is added by it). That will probably require ASM.
Comment
-
Yeah I was thinking to complicatedlyOriginally posted by Pyriel View PostWell, I'm just talking something like:
94000130 FCFF0000
6XXXXXXX 00000001
your code
0XXXXXXX 00000001
The only purpose for XXXXXXX is to ensure the code can be used just once. You could have another code tied to a different combination of buttons set the flag off. However, looking at what you're doing, it seems like the goal might be to run the increment only once each time the code is used (i.e. every time a new potion is added by it). That will probably require ASM.
Thanks for your advice! I've got one last question though: Can you give me the link to a good tutorial about ASM hacking on the DS? I did some basic NES stuff in the past but nothing apart from that and I'd really like to look into it
Comment
-
static.patater.com/gbaguy/gbaasm.htm
Kenobi's GameBoy Advanced ASM Tutorial
www.coranac.com/tonc/text/asm.htm
Whirlwind Tour of ARM Assembly
http://www.codemasters-project.net/p...hp?content.202
Cursor Hacking and Advanced TracingThe Hackmaster
Comment
-
Okay...now I've got a very strange problem. The code I made works flawlessly on my PC using the Desmume emulator, however, it doesn't work on my DS at all. I use a DSTWO flashcard for the game and the very same code and save file from the emulator. I really don't know what's going on here, I never had this happening before. Are there code types that are not supported by the cheat engine the DS flashcards use?Last edited by MichiS97; 07-24-2015, 05:07:05 AM.
Comment
-
Yes I am, it's Legend of Zelda Phantom HourglassOriginally posted by Helder View PostAre you properly terminating the code with the D2000000 00000000 line? also what game is it?
I made some changes to the code, here's the updated oneCode:221BA598 00000002 94000130 FCFE0000 A2FFFFFE 00000001 DB000000 021BA605 D4000000 00000002 D8000000 021BA605 12FFFFFE 00000001 D2000000 00000000
Last edited by MichiS97; 07-25-2015, 09:58:44 AM.
Comment

Comment