Kodewerx

Our culture has advanced beyond all that you could possibly comprehend with one hundred percent of your brain.
It is currently Sat Jul 12, 2025 8:43 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Very noob question
PostPosted: Thu Dec 04, 2008 11:29 am 
Offline
Kommunist
Kommunist
User avatar

Joined: Wed Mar 05, 2008 6:32 am
Posts: 30
Location: Italy
Title: The one who tried to speak to NDS AR... and fails!
Hi to everyone !!!

I would like to create an Action Replay code for Nintendo DS that does the following things:

1) x = value at address XXXXXXXX
2) y = value at address YYYYYYYY
3) if x < y
4) XXXXXXXX = yyyyyyyy
5) else do nothing

Please, can anyone help me to do this in ASM and then in AR code?

Thank you very much !!! :)

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Thu Dec 04, 2008 8:26 pm 
Offline
Komrade
Komrade
User avatar

Joined: Tue Mar 27, 2007 6:23 pm
Posts: 1354
Location: Mario Raceway, 1509.831, 217.198, -564.429
Title: Mario Kart 64 Hacker
So in step 4, copy from YYYYYYYY to XXXXXXXX, or write some other value?

_________________
Image 143
HyperNova Software is now live (but may take a few tries to load) currently down; check out my PSP/DS/Game Boy/Windows/Linux homebrew, ROM hacks, and Gameshark codes!


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Fri Dec 05, 2008 3:34 am 
Offline
Kommunist
Kommunist
User avatar

Joined: Wed Mar 05, 2008 6:32 am
Posts: 30
Location: Italy
Title: The one who tried to speak to NDS AR... and fails!
Ok... I'll be more precise !!!

Castlevania Order of Ecclesia (EUR). I found these address:

0210792c -> 32 bit -> gold
021078d0 -> 16 bit -> current hp
021078d2 -> 16 bit -> hp max
021078d4 -> 16 bit -> current mp
021078d6 -> 16 bit -> mp max
021078d8 -> 16 bit -> current hearts
021078da -> 16 bit -> hearts max

Handle the gold is simple. i.e. AR CODE -> 0210792C 0098967F -> 9,999,999 gold ever (constant WORD memory writing)

I would like to make this simple piece of code:
- load max
- load current
- if current < max
- current = max
- end
one code for hp, one for mp and one for hearts amount but I'm not able to do it !!!

Can you help me understand how AR Code works? I also saw the wiki of kodewerx but I was not able to do what I would.

THANK YOU VERY MUCH !!!

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Fri Dec 05, 2008 8:02 pm 
Offline
Kommunist
Kommunist

Joined: Sat Nov 18, 2006 10:11 am
Posts: 108
.....

6210792C 0098967F //if 0x210792C is not equal to 0x98967F
0210792C 0098967F //then write 0x98967F to 0x210792C
D2000000 00000000 //end code...

just as an example..

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Sat Dec 06, 2008 12:27 pm 
Offline
Kommunist
Kommunist
User avatar

Joined: Wed Mar 05, 2008 6:32 am
Posts: 30
Location: Italy
Title: The one who tried to speak to NDS AR... and fails!
A_Random_Person wrote:
6210792C 0098967F //if 0x210792C is not equal to 0x98967F
0210792C 0098967F //then write 0x98967F to 0x210792C
D2000000 00000000 //end code...


Yes... that's simple !!!
But how about to check if 2 values stored in 2 different memory locations are different?
I mean:
Code:
821078d0 121078d2 // if half-word 0x21078d0 < halfword 0x021078d2

will work or not?
It's correct to write this kind of instruction?

I know that in ASM if you want to check 2 memories value you have to do something like this:
Code:
   load 0x21078d0, r0    // load memory value in register 0
   load 0x021078d2, r1  // load memory value in register 1
   if r0 < r1   // check them
      store r1, 0x21078d0  // store r1 value in memory location

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Sat Dec 06, 2008 2:32 pm 
Offline
Kommunist
Kommunist

Joined: Sat Nov 18, 2006 10:11 am
Posts: 108
You mean...something like...
Code:
   ldr r0, =0x021078d0    // load memory value in register 0
   ldr r1, =0x021078d2  // load memory value in register 1
   ldrh r2, [r0] //load half-word at r0 into r2
   ldrh r3, [r1] //load half-word at r1 into r3
   cmp r2, r3   // compare r2 to r3
         strlth r3, [r0]  // if less than store r3 into r0...

?

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Dec 06, 2008 3:18 pm 
Offline
Komrade
Komrade

Joined: Tue Mar 27, 2007 10:18 am
Posts: 1328
Those codes already exist.

Datel made them, I believe.

At least, they did for (U). For (E), I'm not sure, but seeing as where they are based is European, they probably hacked (E) first.

Just look at (U) and port the codes if (E) doesn't have them.

As for porting the checksum bypass code, you'll have to look at the general area I overwrote in (U) and look for a similar routine signature nearby in (E). Problem solved.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Sat Dec 06, 2008 5:40 pm 
Offline
Kommunist
Kommunist
User avatar

Joined: Wed Mar 05, 2008 6:32 am
Posts: 30
Location: Italy
Title: The one who tried to speak to NDS AR... and fails!
---------------------
For A_Random_Person
---------------------
Ok, ok... I think I mean:
Code:
   /* START --> dunno if yours are correct and not these... I mean if I need also the passages in the r2 and r3 */
      ldrh r0, =0x021078d0    // load half-word memory value in register 0
      ldrh r1, =0x021078d2  // load half-word memory value in register 1
   /*<-- END */
   cmp r0, r1   // compare r0 to r1
         strlth r1, [0x021078d0]  // if less than store only half-word r1 into half-word memory location (not all 32 bit)

Hope I was clear... sorry to make you bother guys !! :(


--------
For Zeld
--------
Maybe the U version codes could work... but I would like to understand how AR and ARM ASM work so I could try to make my personal code for my favourites games !!! :)

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Tue Dec 09, 2008 2:30 pm 
Offline
Kommunist
Kommunist

Joined: Tue Oct 10, 2006 9:32 am
Posts: 445
Personaly I wouldn't care about checking if current < max, just copy the max value over the current one all the time.
(unless it causes a known problem ?)
Exemple for HP :
D3000000 021078D2
F21078D0 00000002

Now if you really want to compare two "unknown" values, you'll indeed have to use asm.


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Wed Dec 10, 2008 4:55 am 
Offline
Kommunist
Kommunist
User avatar

Joined: Wed Mar 05, 2008 6:32 am
Posts: 30
Location: Italy
Title: The one who tried to speak to NDS AR... and fails!
:shock:
Ok, ok... I see !!!
So you're suggesting me to do like this:
Code:
D3000000 021078D2
F21078D0 00000002  // copy 00000002 bytes (16 bit) to 0x021078D0 into the offset
D2000000 00000000  // exit code... needed?


But what D3000000 021078D2 exactly do? In http://doc.kodewerx.net/hacking_nds.html it doesn't seems to appear as an instruction... I can only think that this will set the offset to a specified memory location (0x021078D2).

I've to say that this is just a very good solution !!!
THANK YOU VERY MUCH !!!

However I would like to ask you if you could be so kindly to tech me also how to write the ASM and the AR with the value check... just to let me understand how it works !!!
THANKS AGAIN !!! :)

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Wed Dec 10, 2008 11:37 am 
Offline
Kommunist
Kommunist

Joined: Tue Oct 10, 2006 9:32 am
Posts: 445
Check the Type 0x0F (Memory Copy Code). It explains why the D3 code type is needed.
The code will copy 2 bytes from 0x021078D2 to 0x021078D0.
A D2 (or D3000000 00000000) code type will indeed be needed to finally clear the offset. (But if you're doing to use 3 memory copy code all together (hp, mp, hearts), you can put it just once after the last memory copy code.)


Top
 Profile  
Reply with quote  
 Post subject: Re: Very noob question
PostPosted: Wed Dec 10, 2008 11:59 am 
Offline
Kommunist
Kommunist
User avatar

Joined: Wed Mar 05, 2008 6:32 am
Posts: 30
Location: Italy
Title: The one who tried to speak to NDS AR... and fails!
Thank you very very much !!! :D

_________________
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Majestic-12 [Bot] and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group