News: 11 March 2016 - Forum Rules

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - matthewn4444

Pages: [1]
1
Programming / Assembly help with Prepatch roms
« on: May 23, 2012, 07:00:30 am »
I am trying to translate 7th Dragon (again after the hiatus) and I quickly wanted to see if I can find a location to place my code for prepatched games. My supercard rumble requires the nds game to be patched in order to be played on. I do know assembly enough to apply my code and debug it in No$gba. So far I wrote something very quick to see if I can code in the game.

This is the code snippet I last tried and put it in the text drawing routine:

Code: [Select]
mov r0, #0x0
mov r1, #0x0
cmp r1,r0
bne continue
loop:
    b loop
continue:
    [more code]

Here I wanted the program to fail when it hits here. After applying my patch to the game and running on No$gba, it does fail when getting to the loading sign and stays in the loop as it should be. I get the same behaviour with Acekard but not Supercard Rumble. Supercard would just continue the game as if the comparison was ignored. I then tried this:

Code: [Select]
mov r0, #0x0
mov r1, #0x0
loop:
    b loop
continue:
    [more code]

And as expected, no$gba, Acekard and Supercard falls into the loop and hangs.

My speculation is that "cmp" is ignored or "bne" (same goes with "beq") is ignored (even if the game is filled with those). Also 7th dragon patched is fully playable on my Supercard Rumble. I doubt the patch does anything because this code is patched when the game starts (meaning that the game will override the code on execute) and it still falls into the infinite loop.

I am not sure what I should do about this but I am probably dropping all support of prepatched cards unless I can figure out a way to get this to work. For now Acekard seems like the best bet to code towards. If you need anymore information I can provide it.

2
Newcomer's Board / NDS text positioning help
« on: November 27, 2011, 02:43:25 pm »
Hello, I have been working on a translation hack for 7th Dragon for over about 2 months and I got the basis of variable width font almost complete. I am placing fixing up and inserting font bitmaps currently but I hit a problem.

The image above shows a screenshot of the skills menu. Because each font tile is 10px X 10px, my font would appear to be 2px higher than everything else (not that the end result would keep the Japanese text) but the English font (in this case "POW") seems way to high in the image. I was wondering if there was a way to move the text down. I do know basic assembly (as I did implement variable width font) but I do not know how text can be placed on the screen at an x and y position (that I am assuming is somewhere in memory). no$gba shows that the top screen is rendered through 3D (so I guess that is for translating and rotating the images/text easier).

3
Newcomer's Board / Implementing a hack
« on: August 13, 2011, 04:08:55 pm »
Hey, I am kind of new to assembly but i have enough knowledge to understand code and write my own code as well.

My question is how can implement a hack for NDS. Say i know the address of where I want my code to run (in thumb mode) and I want it to branch to my code, I think I need to store my code somewhere in memory but I am not sure where. I am kind of frustrated because I developed my hack in no$gba but everytime I put the game on my flashcard it crashes and I feel like it is a waste of time because I cannot get my hack running because the place I put it does not run on flash card but runs on emulator. My goal is translate a game but if I can't even get my hack to run, I don't even think I can do this.

4
ROM Hacking Discussion / NDS hooking help
« on: August 11, 2011, 11:30:19 am »
Hello, I am new to the forums and I am also new to arm asm. I have been reading and playing around with arm asm for a few weeks and I feel I have enough knowledge to hack something.

I have a general question when switching modes. I would like to place my hack in arm9 to run my code that is placed somewhere in memory (which is in arm mode). Then I would like to end it and jump back into thumb mode. I read that using "bx r#" allows you to switch between modes, but I have yet to see this work. I use emulator (no$gba) and the code would jump from the arm9 to my code and back and continue to process the game. When I load the nds game into the flash card, it does not and freezes. I believe that it is jumping to my code but in the wrong mode which causes it to crash.

I looked at cracker's hooking tutorial (http://crackerscrap.com/index.php?p=docs) but it doesnt work for me (tried something similar).
Here is the part where I followed:
Code: [Select]
@37FFB20 <---- thumb
    ldr r0,[r1]
    cmp r0,#0x0
    blt 0x37FFB3C
    mov r2,#0x5
    ldr r4,[r15,#-0x2]
    bx r4
    .long 0x23FE000
    mov r4,#0x8

Notice that r4 is being loaded with a new value right after our hook so we know it is safe to use it for our jump.

@23FE000 <--- arm
    stmdb r13!,{r0-r12,r14} ;@ Save registers to stack
    ;@ Start of your function
    ...
    ;@ End of your function
    ldmia r13!,{r0-r12,r14} ;@ Restore registers from stack
    sub r0,r2 ;@ Patch in overwritten opcodes
    str r0,[r1]
    add r1,#0xFC
    ldr r0,[r1]
    ldr r4,[r15]
    bx r4 ;@ jump to IRQ handler
    .long 0x37FFB31 ;@ return address ORed with 1 to switch back to Thumb mode

At the end I would like to return to thumb mode, so I tried to OR the address but it didnt work.

I am not sure how to do this correctly but if someone can provide an example that would help a lot.

Pages: [1]