+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  GBA sprite position question
Pages: [1]
Author Topic: GBA sprite position question  (Read 2 times)
jb
Guest
« on: September 23, 2008, 05:45:57 am »

Hello,

I am working on a translation of a Japanese GBA game and have come across something I need some assistance with (but since this really isn't a translation problem, I figured this should go in this section.)

There is a screen where the graphics read:

"(No.)__#__(Battle)"

The words in parentheses are each single kanji, the underscores represent "blank" space and where the number sign is will be a number (1-5).  In translating to English, I feel the number would work better at the end (i.e. "Battle 1").  I can easily change and replace the graphics, make tile maps, etc., but when checking the map out in VBA, I found that the numbers aren't actually part of the background, so that part of the map is:

"(No.)_____(Battle)"

The number is instead an object which is placed at the proper point on top of that BG and I have no idea how to (permanently) change the placement of those.

I located the sprite in the OAM and changed it's x-offset value via the memory viewer to see it move to the proper position for an instant, but of course that's very temporary.

So, how exactly would one find where/how a game sets the attributes for a particular OBJ and then go about changing them in the ROM?

Using the logging feature in GBA (dev version), I know where the gfx are read from and loaded to, and I can see where in the "IRAM" the OAM gets its updated values from, but nothing that would lead me directly to where it would initially be getting the OBJ attributes from, so I'm guessing this something done via ASM?

I know it'd be beneficial to actually learn ASM, but the ONLY thing I really need to know for the foreseeable future is changing the x-offset of a static sprite, and at least this would be a decent starting point...

Any help would be appreciated.
KaioShin
Guest
« Reply #1 on: September 23, 2008, 06:21:00 am »

Yeah this is done in the code somewhere. While it might seem like overkill to learn ASM just for this one sprite, you'll see that it isn't so hard as it looks. Especially since you have a very specific starting point. Most newbies who have problems don't have an idea where to start. You have a specific problem you need to solve, in my experience that makes your chances of success much better.

About your problem:

You know were in RAM the data is stored? Set a write breakpoint on that address before the sprite is getting loaded into OAM. That will lead you directly to the code that loads the values. You only need to investigate that routine then. As I said, it's a good starting point. You only need to understand some very basic commands for this, and it will lead to you to greater insights quickly. Gather some courage and get your feet wet, you'll see it's not half as bad you thought it would be.
jb
Guest
« Reply #2 on: September 23, 2008, 03:28:57 pm »

Well, using the tracing feature in VBA-SDL-H, I managed to find what I was looking for, and I did it without learning very much about ASM.  :laugh:

I simply searched the log for the X value I wanted to change (0x70) and the first match came here:

Code:
08021C50 9000 str r0, [sp, #0x0]
[b]08021C52 2070 mov r0, #0x70[/b]
08021C54 2105 mov r1, #0x5

Seeing as the next line contained a value of 5, which just happens to be the Y-offset of the object, I figured this had a decent chance of being the data in question.  An edit of the ROM that was loaded into memory in the standard VBA quickly verified that it was.

Of course, this was after I had spent a good amount of time experimenting with different breakpoints and stepping through instructions to see what was going on manually, so I didn't just luck into the answer right away.

My foray into ASM wasn't that painful after all.

Thanks for the response.
KaioShin
Guest
« Reply #3 on: September 23, 2008, 03:38:37 pm »

Glad it worked. Even if you don't understand all details, you see that it's already easy to do a lot with common sense and a bit of trail and error. It's a bit sad that ASM has the reputation of being an unapproachable beast that only utter computer nerds will ever have a chance to understand  Undecided\
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC