+  RHDN Forum Archive
|-+  Romhacking
| |-+  General Romhacking
| | |-+  Moving Sprites - FFIV (though, it can be applied to others)
Pages: [1] 2
Author Topic: Moving Sprites - FFIV (though, it can be applied to others)  (Read 1 times)
DarknessSavior
Guest
« on: January 13, 2009, 05:33:39 am »

I recently messed with the shops in FFIV, to try and fix a bug involving the item prices. I expanded the shop windows as far left as they would go, and I moved the item text all the way over. However, now the hand icon shows up in the middle of the word, instead of at the far left like it's supposed to. I need to move it over. I messed with vSNES to see what it was, and it showed up in the sprite layer.

I then proceeded to mess around in Anomie's various docs, and found the section on sprites. But uh, even upon reading it multiple times, I still have NO clue as to what I need to do. I would think this would be a simple change of address or something. Can anyone simplify it a bit?

Here's what I've got to work with:



I might have to move the item list forward one space, but either way, I need to learn to move the hand. >.>

Any help is greatly appreciated,

~DS
creaothceann
Guest
« Reply #1 on: January 13, 2009, 05:46:41 am »

You need to modify the data that is loaded into OAM; see anomie's regs.txt for its register numbers.

The sprite indices you can get from vSNES. From there you can calculate their OAM offsets.
DarknessSavior
Guest
« Reply #2 on: January 13, 2009, 08:47:04 am »

Quote from: creaothceann on January 13, 2009, 05:46:41 am
You need to modify the data that is loaded into OAM; see anomie's regs.txt for its register numbers.

You see, that's the problem. I go into anomie's register doc, read about Sprites and OAM, and my brain just freakin' explodes. Is there a dummied down explanation of how one messes with this? Maybe I'm just fried from three hours of Japanese from earlier, but I don't think it made much more sense when I was back in the states. >.>

I understand that $2102 and $2103 are OAM registers, though I dunno what they do. I know writing to OAM is done via $2104, and reading from another register (*DS looks it up* $2138). So what would I want to change, the value that is loaded at $2104?

Indices is the plural for index, right? More terminology I'm not familiar with. >.<

I'm sorry if this seems stupid to you guys, but none of this makes much sense. I can write gobs of ASM, and have it work. But for some reason, this just doesn't click.

~DS
MathOnNapkins
Guest
« Reply #3 on: January 13, 2009, 09:20:29 am »

Assuming you did get this working, you're saying you'd just want the finger tip of the hand to show up on screen?
creaothceann
Guest
« Reply #4 on: January 13, 2009, 01:21:28 pm »

OAM is a separate RAM area that can't be accessed directly with a CPU address. Byte values written to $2104 end up somewhere in OAM; the location is determined by the lowest 9 bits at $2102/3 (a value of 0..511).

The first 512 bytes in OAM are organized as 4-byte groups, one for each sprite.
byte 0 = horz. position (bits 0..7)
byte 1 = vert. position

Bytes 2 and 3 (and the remaining 32 bytes of OAM) are not necessary for your purposes.

So you need to calculate the OAM address of the sprite you want to change (simply sprite index * 4) and set a breakpoint to $2104 with the condition that the OAM address in $2102/3 has that value.

When you have the source address of that data, changing that byte should change the horz. sprite position.
Disch
Guest
« Reply #5 on: January 13, 2009, 01:29:35 pm »

Corruption is a lost art.

Find the X coord of the cursor.  From looking at the screenshot it looks to me like it's 16.  Corrupt looking for the number 16 ($10) and change it to something else, and narrow down your search until you isolate where in the ROM the cursor position is.

Your real problem, to me, seems to be that there's no room for the cursor on the left side of the screen.  I mean your text is right on the left border -- where exactly do you plan on putting the cursor?  EDIT:  er, yeah, what MathOnNapkins said.   Tongue
Dragonsbrethren
Guest
« Reply #6 on: January 13, 2009, 01:54:15 pm »

Quote from: MathOnNapkins on January 13, 2009, 09:20:29 am
Assuming you did get this working, you're saying you'd just want the finger tip of the hand to show up on screen?

I was wondering this myself. DS, you really should draw half of it over the icon, the border is already in the overscan area, and it's very likely that the cursor would be entirely invisible on some TV's if you moved it that far over.
Ryusui
Guest
« Reply #7 on: January 13, 2009, 03:28:56 pm »

VSNES is your friend.

Figure out which sprites correspond to the finger and look for that data in OAM. Then find the matching data in RAM (it's gotta be DMA'd from somewhere, right?), then set a breakpoint for that location.

Simple.
RedComet
Guest
« Reply #8 on: January 13, 2009, 05:06:48 pm »

Quote from: Ryusui on January 13, 2009, 03:28:56 pm
VSNES is your friend.

Figure out which sprites correspond to the finger and look for that data in OAM. Then find the matching data in RAM (it's gotta be DMA'd from somewhere, right?), then set a breakpoint for that location.

Simple.

I like to use Geiger's SNES9X's DMA logging to see where in RAM the OAM data is coming from. Then you can just go there in RAM, play with the X and Y values and see if you've found the right data. From there just find the code that writes the data to the OAM table.
DarknessSavior
Guest
« Reply #9 on: January 14, 2009, 07:49:13 am »

Quote from: Dragonsbrethren on January 13, 2009, 01:54:15 pm
Quote from: MathOnNapkins on January 13, 2009, 09:20:29 am
Assuming you did get this working, you're saying you'd just want the finger tip of the hand to show up on screen?

I was wondering this myself. DS, you really should draw half of it over the icon, the border is already in the overscan area, and it's very likely that the cursor would be entirely invisible on some TV's if you moved it that far over.

I was thinking I may end up moving the item text over one space to the right, so as to make room for the hand icon. But would there be a way to keep it the way it is, and draw half of the hand icon on the left side of the screen? Would it be something you guys would miss (having the whole hand icon)?

Basically, this is me trying to fix a bug,  where because of my expanded item names (11 characters each), it's loading extra spaces where the price of the items should be. So I moved the price and item lists farther apart, and got more room for it. Also, it gives me more room to work with for the "quantity" and item shop name area.

Quote from: Ryusui on January 13, 2009, 03:28:56 pm
VSNES is your friend.

Figure out which sprites correspond to the finger and look for that data in OAM. Then find the matching data in RAM (it's gotta be DMA'd from somewhere, right?), then set a breakpoint for that location.

Simple.

Wait, I can do all of that in vSNES? O.O

~DS
creaothceann
Guest
« Reply #10 on: January 15, 2009, 02:12:02 pm »

Quote from: DarknessSavior on January 14, 2009, 07:49:13 am
Quote from: Ryusui on January 13, 2009, 03:28:56 pm
VSNES is your friend.

Figure out which sprites correspond to the finger and look for that data in OAM. Then find the matching data in RAM (it's gotta be DMA'd from somewhere, right?), then set a breakpoint for that location.

Simple.

Wait, I can do all of that in vSNES? O.O

In case you haven't found it out yet:

- move the mouse over the sprites in the "sprites" section of the Scene Viewer to get the indices
- multiply the index with 4 to get the offset in the first part of OAM (see previous posts)
- find out where these 4 bytes came from with a debugger / tracer
InVerse
Guest
« Reply #11 on: January 15, 2009, 07:06:17 pm »

Quote from: Disch on January 13, 2009, 01:29:35 pm
Corruption is a lost art.

I blame the asshole who wrote "The Definitive Guide to ROM Hacking for Complete Beginners" and recommended that people who wanted to learn about corruption should read "Basic ROM Corruption" which doesn't actually exist because the author of the first document thought he would finish the second document very soon after the release of the aforementioned first document. Nearly six years later, said "Basic ROM Corruption" doesn't exist. Well, it does, technically. There is a file named romcorruption.txt that contains a short introduction and the beginning of a step-by-step process description. In fact, said document has actually be edited within the last 3 months. Unfortunately, it is far from usable at this point. However, whenever the subject comes up, said author talks shit about himself in the third person, thus motivating himself a bit more and possibly eventually leading to an actual completed document.
Neil
Guest
« Reply #12 on: January 15, 2009, 07:11:10 pm »

didn't said author also have a few other documents he had written years ago and found on a backup cd that he was looking for people to proof a year or so ago that he still has yet to release?
creaothceann
Guest
« Reply #13 on: January 15, 2009, 07:26:08 pm »

Ah, unfinished planned stuff... so much... Embarrassed
BRPXQZME
Guest
« Reply #14 on: January 15, 2009, 07:57:58 pm »

If all of us announced things we started but would never come across the means to finish, we’d all be laughingstocks. Naturally an unfinished endeavor here and there isn’t so bad.

Or some of us would then find we could actually finish quite a few of them, and match the voluminous output of such great auteurs as Gide*cough*ahem* err Charles Dickens.
Pages: [1] 2  


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