Jump to content

ASM Battle Prep help


jjl2357
 Share

Recommended Posts

So what I want to do is make it so that you can only select character X to be deployed in the battle prep screen if character Y is being deployed with him/her.

Ex. What if Kent will only fight if he gets to fight alongside Lyn?

I found Nintenlord's source ASM for a "character banner" patch for FE7, and I'm trying to modify it to fit my purposes. I'm a little bit stuck on a couple places though:

.thumb
@0x46 bytes
@called by 0808e260
@ where the instructions are written
.org 0x08dea8 @r0 = pointer to character
loadPointerFromTable:
ldr r2, =pointerTable+0x8000000 @pointerTable
cmp r2, #0
beq false @ go to "false" label if r2 is equal to 0
@r2 is the pointer to character conditional data
loadCharNumber: @loads the 4th byte of the 0th word of r0
ldr r0, [r0, #0]
ldrb r0, [r0, #4]
@ Here, I need something like:
@ compare:
@ ldrb r4, [r2, #0]
@ cmp r4, #0
@ beq false
@
@ ldrb r5, [r2, #1]
@ cmp r5, r0
@ beq check
@
@ add r2, #2
@ b compare
@ check:
@ @CHECK TO SEE IF CHAR4 IS NOT DEPLOYED???
@ beq true
@ b return
true: @turns r0's value into 1 @WHAT DOES THIS DOOO???
mov r0, #1
b return
false: @ turns r0's value into 0
mov r0, #0
return:
bx lr
.pool
.org 0xdf0000 @ tells computer that "pointerTable" refers to 0xdf0000
pointerTable:
.fill 44, 4, 0

I can't figure out how to check whether you have a character selected, and I also don't see what "true" and "false" actually do, since they seem to be setting the character number to 1 or 0, respectively.

Also, I'm wondering if anyone happens to know the equivalent offset for FE8...

If anyone could help me I'd really appreciate it :)

Link to comment
Share on other sites

the true/false labels just set the return value of the routine to 0 (false) and 1 (true); everything else is just setup to determine that

if you can determine whether any given character X is deployed (based on random experimentation it appears that a value of 0x1 at index 0xC of character data means deployed, whereas 0xB means the opposite) it should be a fairly trivial modification

Edited by CT075
Link to comment
Share on other sites

Okay, this still isn't working. I've managed to get it to a point where it doesn't break the ROM, but the problem is that replacing the code at the offset with this doesn't actually do anything. I tested conditionals with Sain and Kent but both of them were still selectable.

.thumb

@0x46 bytes
@called by 0808e260
@ where the instructions are written
.org 0x08dea8 @r0 = pointer to character
loadPointerFromTable:
ldr r2, =pointerTable+0x8000000 @pointerTable
cmp r2, #0
beq false @ go to "false" label if r2 is equal to 0
@r2 is the pointer to character conditional data
loadCharNumber: @loads the 4th byte of the 0th word of r0
ldr r0, [r0, #0]
ldrb r0, [r0, #4]
compare:
ldrb r4, [r2, #0]
cmp r4, #0
beq false
ldrb r5, [r2, #1]
cmp r5, r0
beq check
add r2, #2
b compare
check:
ldr r6, =0x202bbf8
ldrb r7, [r0, #0xc]
cmp r7, #0x1
bne true
b return
true: @turns r0's value into 1
mov r0, #1
b return
false: @ turns r0's value into 0
mov r0, #0
return:
bx lr
.pool
.org 0xdf0000 @ tells computer that "pointerTable" refers to 0xdf0000
pointerTable:
.fill 44, 4, 0

...maybe I should do more hacking before trying to learn the technical stuff all at once

Edited by jjl2357
Link to comment
Share on other sites

i'm not convinced you know what you're doing

i don't even know what you're doing with the r6 and r7 (well, i know what you want to do but it's not even close to what you want it to be doing)

Link to comment
Share on other sites

you can try assembling this and patching with my assembly patcher (i didn't make a linker script because i only spent 15 minutes on this) but it should give you the general gist of what you want to do

i made it so it doesn't overwrite the regular character banner hack as well

Link to comment
Share on other sites

it's actually incomplete but most of the logic is there (the gaps are largely structural stuff like completing the FOR loop and popping out the preserved registers from the start)

keep that in mind if you write your own implementation

Edited by CT075
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...