View Single Post
Old December 23rd, 2011 (1:42 AM).
ArmoredGuns ArmoredGuns is offline
    Join Date: Jan 2010
    Posts: 12
    Originally Posted by agentgeo View Post

    Okay, here you go... However, I really recommend you learn to apply simple hacks like this.

    *Note: Routine inserted at 0x9C0D00*
    Thank you very much!!! I greatly appreciate it

    Originally Posted by Bond697 View Post
    just FYI, the code to seed emerald's prng actually does exist in the game. all you would need to do is branch to this(and maybe turn on timer1 if it's not already, but that's easy) at some point and you're set. it was going to work exactly like fire red and leaf green.

    it's just never used:

    ROM:08000560             @ =============== S U B R O U T I N E =======================================
    ROM:08000560             @ void __fastcall seedRNG__()
    ROM:08000560             seedRNG__:
    ROM:08000560 10 B5                       PUSH    {R4,LR}         @ this function never runs
    ROM:08000562 06 48                       LDR     R0, =0x4000104  @ Timer1Data
    ROM:08000564 04 88                       LDRH    R4, [R0]
    ROM:08000566 20 1C                       MOVS    R0, R4          @ Timer1Data to r0
    ROM:08000568 6F F0 46 F8                 BL      setRNG__        @ set rng state (0x3005D80) to result of timer1
    ROM:0800056C 04 49                       LDR     R1, =0x4000106  @ T1CNT
    ROM:0800056E 00 20                       MOVS    R0, #0
    ROM:08000570 08 80                       STRH    R0, [R1]        @ turn off timer1
    ROM:08000572 04 48                       LDR     R0, =0x2020000
    ROM:08000574 04 80                       STRH    R4, [R0]        @ store the result of timer1 to 0x2020000
    ROM:08000576 10 BC                       POP     {R4}
    ROM:08000578 01 BC                       POP     {R0}
    ROM:0800057A 00 47                       BX      R0
    ROM:0800057A             @ End of function seedRNG__
    ROM:0800057A             @ ---------------------------------------------------------------------------
    ROM:0800057C 04 01 00 04 dword_800057C:  .long 0x4000104         @ DATA XREF: seedRNG__+2r
    ROM:08000580 06 01 00 04 dword_8000580:  .long 0x4000106         @ DATA XREF: seedRNG__+Cr
    ROM:08000584 00 00 02 02 dword_8000584:  .long 0x2020000         @ DATA XREF: seedRNG__+12r
    ROM:0806F5F8             @ =============== S U B R O U T I N E =======================================
    ROM:0806F5F8             @ void __fastcall setRNG__(unsigned short T1Dat)
    ROM:0806F5F8             setRNG__:                               @ CODE XREF: seedRNG__+8p
    ROM:0806F5F8 00 04                       LSLS    R0, R0, #0x10   @ dumb typecasting
    ROM:0806F5FA 00 0C                       LSRS    R0, R0, #0x10
    ROM:0806F5FC 02 49                       LDR     R1, =0x3005D80  @ rng buffer
    ROM:0806F5FE 08 60                       STR     R0, [R1]        @ set rng to T1Dat
    ROM:0806F600 02 49                       LDR     R1, =0x20249BC  @ rng frame counter
    ROM:0806F602 00 20                       MOVS    R0, #0          @ set counter to 0 to signify starting seed
    ROM:0806F604 08 70                       STRB    R0, [R1]
    ROM:0806F606 70 47                       BX      LR
    ROM:0806F606             @ End of function setRNG__
    Hmm I wonder if FRLG's PRNG seeding routine is better than Ruby/sapphire's...
    Reply With Quote