View Single Post
  #250    
Old June 7th, 2012 (11:13 PM).
Haru~'s Avatar
Haru~ Haru~ is offline
Can't resist the chubbiness :3
     
    Join Date: Mar 2012
    Gender: Female
    Nature: Modest
    Posts: 16
    After a long battle with cancer trying to find the RAM location of the player's money, I had a feeling that it is encrypted somewhere in the RAM and that's why I can't find it. So after going to my local POKeMART, I found a little routine that seems to decrypt something. After doing further testing, I made this routine to get the player's current money using the game's own code.

    The routine:
    Spoiler:

    Code:
    .align 2
    .thumb
    
    /*This routine does all the hard work in retrieving your current
    money and stores it in vars 0x8000 and 0x8001.
    	0x8000 - Lower half
    	0x8001 - Upper half
    */
    
    main:	push {r4-r6, lr}
    	ldr r6, .DMA_MAP
    	ldr r0, [r6, #0x0]
    	mov r5, #0xA4
    	lsl r5, r5, #0x2
    	add r0, r0, r5
    	ldr r1, .OTHER_RAMLOC
    	ldr r1, [r1, #0x8]
    	bl get_amount		/*Does the actual decrypting*/
    	ldr r1, .VAR_8000
    	str r0, [r1]
    	pop {r4-r6, pc}
    
    get_amount:	ldr r4, .DO_CALC
    		bx r4
    
    .hword 0x0000
    .DMA_MAP:	.word 0x03005008
    .OTHER_RAMLOC:	.word 0x02039934
    .VAR_8000:	.word 0x020370B8 /*Var 0x8000-0x8001*/
    .DO_CALC:	.word 0x0809FD59


    I slept after that...
    Reply With Quote