Users browsing this thread: 1 Guest(s)
Solving the OAM limit

#1
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
So, this just needs to get done. I don't know enough about VRAM, and hopefully someone around here can help me with the parts im missing. At some point, the game puts together the OAM image from various parts of various sprites into a single space, then the save screens, shop menus, etc... call OAM data from that loaded image using coordinates and offsets. I need to figure out when/how that original OAM image is loaded and created, this is the real key to expansion. I have yet to find this. I've tried using breaks on when certain parts of the image data is read, but to no avail, it doesn't seem to pull in a way that causes a break.

Is there anyone who's REALLY good at finding things in the ROM? If i can figure out how the OAM image(s) are created, I can expand this piece with conditionals. The only real variable is if the standing + fanfare sprites take up all of the allotted space in the shop menus, or if i can fit enough extra sprites for a 15th and 16th character. Tho if the full OAM standing data is loaded in addition to the 14 fanfare characters, i can make it work be replacing a few unused standing sprites with expanded fanfare sprites.... anyway... I know HOW i want to do it, and how to get it working once the base image is created... I just need to FIND IT!

I tried dumping the RAM during the game load screen and looking it over in yychr, no good (but im also not great at that). I'm outside of my realm of expertise here.

Obviously, since im almost done expanding the magic system, I needed something stupidly hard to do. I'm a sadist in hacker form.
  Find
Quote  
[-] The following 1 user says Thank You to B-Run for this post:
  • Gi Nattak (09-07-2016)

#2
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
I suppose that we are talking about the shop menu where the party sprites are displayed. If it is the case, the routine that displays them are setup at C3/C09A. The procedure to draw the sprites is somehow complex and i will ask you a little of patience. I will split the procedure in first, second and third phases. 

The first phase must setup the address of the second phase. It is done with a call for C3/1173. The C3/1173 will queue a call for another address that will be executed to update the sprites. It follows this format:
Code:
C3/C0AA A9 02       LDA #$02
C3/C0AC A0 41 C1    LDY #$C141
C3/C0AF 20 73 11    JSR $1173       ;queue C3/C141: draw actor sprites

For this specific code, the register Y is the address to call LATER to update the sprite data. For now, in this routine, four main variables are setup for each sprite: the oam pointer data ($32C9,Y), the oam pointer bank ($35CA,Y), the x coordinate ($33CA,Y) and the y coordinate ($344A,Y). Please, notice that this routine changed the default data bank pointer with a PLB opcode to #$7E. In summary, STA $32C9,X and similar code actually is equivalent to STA $7E32C9,X.

The oam pointers are read from $D8E917,X. They are 2 bytes pointers for the first oam pointer (three bytes each) for the specific sprite. An sprite can actually have more that one oam pointer. The x and y positions are read from specific tables that can be relocated, expanded or altered.

The second phase, queued at the first phase, somehow update the oam pointers based on specific criteria. For the shops, it changes between the 'idle' sprite and the 'fanfare' sprite, based if the party members can equip or not equip the selected equipment.

The third phase is generally executed at C3/11B0. It executes everything in the oam queue. For the first and second phase, it only setup/update the sprites data and queue them to be displayed later.

I will be humble and say that i don't fully understand everything in all these phases. However, if you want to add two extra slots for guests in the shop menu, you surely will have to check around these routines.

By the way, at C3/C184 the oam pointer is updated by 9 bytes (3 oam pointers entries). It changes from the 'idle' sprite to the 'fanfare' sprites for the actors. You can null this code if you don't want to use the 'fanfare' sprites:
Code:
C3/C184 69 09 00    ADC #$0009      ;change to ADC #$0000 to null it

I also noticed, in shops, that the sprites identifier beyond the default ones don't display correctly. I can force an specific oam pointer for all party member in shops and it works fine for all default actors. However, if the oam pointer is for the no-default sprites, it gets the wrong oam data. It happens for all actors which don't have a full spritesheet and the full set of aom pointers. I don't know how to bypass it by now.
  Find
Quote  
[-] The following 1 user says Thank You to HatZen08 for this post:
  • Gi Nattak (09-07-2016)



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite