+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Changing Cursor Coordinates?
Pages: [1]
Author Topic: Changing Cursor Coordinates?  (Read 2 times)
The Drunken Hacker
Guest
« on: December 27, 2009, 03:32:12 pm »

I've been toying with Square's Tom Sawyer and have made good progress on the basics, text has been dumped, pointers have been located, etc. Before going full blown into the grunt work, I'd like to take care of a few of the more advanced problems.

The primary menu consists of a textbox with options on the top, bottom, left & right. The original Japanese menu options on the sides were only 2 characters each. The English equivalents are both 3 characters. Fitting the text in is no problem, as evidenced in the screen shots below. The problem is also evident, however. The cursor needs to be moved one square closer to the center of the box to avoid overlapping the newly translated options.

---

What is the best way to go about locating the coordinates of the cursor? I've played with a debugger in the past (I'm using FCEUX v2.1.1) but I'm by no means an expert, so any suggestions/guidance would be appreciated.

(For some reason, the images aren't showing up for me, although the code appears to be fine. If you can't see them, look here and here.)
« Last Edit: December 27, 2009, 03:38:12 pm by The Drunken Hacker »
Kagemusha
Guest
« Reply #1 on: December 27, 2009, 03:56:13 pm »

Usually in RAM you can see the effects of moving the cursor. Meaning that there's a consistent change when moving back/down etc. You could set a write breakpoint to that address to see how those values get there. Although sometimes cursor positions can get real complicated and can't just be changed with a simple hack.
The Drunken Hacker
Guest
« Reply #2 on: December 27, 2009, 05:36:09 pm »

Well, I found two different addresses (0x01EA & 0x01F1) in memory that change in relation to the cursor position, both holding the same value (04, 08, 0C, 10, clockwise from the left.)

I tried setting write breakpoints to both of those addresses but nothing seemed to happen, as far as I could tell. I'm not sure if I'm doing something wrong or if I just don't know what I'm supposed to look for, so any further suggestions would be welcome.

EDIT:

After further investigation, I discovered a 4 byte range in memory that changed depending on the direction of the cursor. I searched for one of those 4 byte values in the ROM and found all 4 of them sequentially. After a bit of experimentation, I figured it out. The first byte determines the Y coordinate of the cursor, the second byte determines which of the 2 cursor graphics is used (vertical or horizontal), the third byte designates whether the graphic is mirrored or not and the fourth byte determines the X coordinate of the cursor (which was what I needed to hack.)

I've now managed to reposition the cursor so it no longer overlaps the text.

(Funny how I can pull that off but I can't manage to find an image host that will let me hotlink images, unless I'm screwing up the code without realizing it.)

Images here and here
« Last Edit: December 27, 2009, 07:18:36 pm by The Drunken Hacker »
Gideon Zhi
Guest
« Reply #3 on: December 27, 2009, 07:23:16 pm »

Grats! Just, you know, make sure the menu items still work. Most games use a cursor index (cursor at slot 1 when a button is pressed means it executes function 1, slot 2 executes function 2, etc) but at least one game I've worked on ran through a list of card compares based on the X and Y coordinates on-screen for the cursor, which then needed to be changed so the menu options would function correctly again.
creaothceann
Guest
« Reply #4 on: December 27, 2009, 08:30:36 pm »

Quote from: The Drunken Hacker on December 27, 2009, 05:36:09 pm
image host that will let me hotlink images
imageshack, imgur, tinypic, photobucket
The Drunken Hacker
Guest
« Reply #5 on: December 28, 2009, 01:45:29 pm »

Quote from: Gideon Zhi on December 27, 2009, 07:23:16 pm
Grats! Just, you know, make sure the menu items still work. Most games use a cursor index (cursor at slot 1 when a button is pressed means it executes function 1, slot 2 executes function 2, etc) but at least one game I've worked on ran through a list of card compares based on the X and Y coordinates on-screen for the cursor, which then needed to be changed so the menu options would function correctly again.

Good point. They do still work fine. At least, 3 of the 4 do and the fourth didn't do anything before my changes. I think the dig command requires you to find a shovel or something, which makes sense.

Now I need to decide if it's worth the trouble to try and expand the battle menus to allow for full length commands or if I should just go with squishy text. The latter option doesn't look to bad at the moment, so I'll likely just stick with it for now and look into expanding when more crucial work is complete.
Pages: [1]  


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