The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.


Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #101    
Old January 27th, 2014, 10:37 PM
Tlachtli's Avatar
Tlachtli
Crit happens.
 
Join Date: Jan 2012
Location: Faraway place
Age: 23
Gender: Male
Nature: Modest
Quote:
Originally Posted by bcrobert View Post
Does this help? My additions are in bold. I haven't tested these myself but I believe they're correct. Thought I'd chime in since you saved me the trouble of tracking down the limiter.
Check my post from earlier if you aren't sure. It has the table locations and lengths for BPEE, and they all work.
__________________
Pokemon Sigma Σmerald in progress:

A Gen 3 remake de-make, featuring many Gen VI mechanics
Reply With Quote
  #102    
Old 1 Week Ago, 07:55 PM
Phenom2122's Avatar
Phenom2122
 
Join Date: Jun 2014
Gender: Male
Nature: Quiet
Quote:
Originally Posted by BugMania View Post
The second routine is almost the same of the routine of the Jambo 51, ​​so this does not do the calculations, only handle the movements directly in 0x02FF7d24.
Sorry to quote you from so long ago, I am busy porting all this ASM to Emerald and your ASM is the last one I need to do.
May I ask why that offset in particular? Does that just point to unused space in Fire Red?

Well in any case, here are the ASM scripts with the correct Emerald offsets. My hack progress is nowhere near the point I can actually test this but maybe someone can make use of it in the mean time, the offsets are sound.
@Jambo51's first ASM:
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle
main:
 mov r1, r9
 lsl r1, r1, #0x2
 ldr r0, table
 add r0, r0, r1
 ldr r0, [r0, #0x0]
 ldr r6, there
 add r6, #0x6
 ldrb r7, [r6, #0x0]
loop: lsl r1, r7, #0x1
 add r1, r1, r7
 add r3, r0, r1
 ldrb r1, [r3, #0x2]
 mov r4, r10
 cmp r4, r1
 beq learn
 cmp r1, #0xFF
 beq exit
 add r7, #0x1
 b loop
learn: ldr r2, there
 add r7, #0x1
 strb r7, [r6, #0x0]
 ldrb r1, [r3, #0x1]
 lsl r1, r1, #0x8
 ldrb r0, [r3, #0x0]
 orr r0, r1
 strh r0, [r2, #0x0]
 ldr r1, return
 bx r1
exit: ldr r0, return2
 bx r0
.align
return:  .word 0x080693F5
return2: .word 0x08069403
table:  .word 0x8FFFFFF
there:  .word 0x020244E2
Change 0x693B0 to 18 49 08 47
Then navigate to 0x69414 and change it to XX XX XX 08, where the XX XX XX stands for the pointer to your new routine plus 1.

Then, from what I've read, instead of Jambo's second ASM routine we first need this one by @BugMania (there are ram offsets in this script that I assume point to free space in Fire Red, for now I am assuming the same for Emerald):
Spoiler:
Code:
.text
.align 2
.thumb

Matriz:
mov r3, #0x0
ldr r1, Contador2
str r3, [r1]
ldr r1, moves
str r3, [r1]
add r1, #0x4
str r3, [r1]
add r1, #0x4
str r3, [r1]
add r1, #0x4
str r3, [r1]
LDR R1, movesettable
ADD R1, R6, R1
LDR r2, [R1]
LDR r3, var
STR r2, [r3]
Start:
mov r2, r10
LDR r3, var
LDR r3, [r3]
LDRB r3, [r3, #0x2]
CMP r3, r2
BLS Frente
ldr r1, var
ldr r2, [r1]
sub r2, #0x3
str r2, [r1]
B Compare
Frente:
LDR r2, var
LDR r2, [r2]
ADD r2, #0x3
LDR r3, var
STR r2, [r3]
B Start
Compare:
LDR r2, Contador
LDRB r2, [r2]
CMP r2, #0x4
BEQ end
LDR r2, var
LDR r2, [r2]
LDRH r2, [r2]
LDR r3, moves
LDRH r3, [r3]
LDR R7, Contador2
LDRB R7, [R7]
ADD r3, R7, r3
CMP r2, r3
BEQ Traz
LDR R7, Contador2
LDRB R7, [R7]
ADD R7, #0x3
LDR r2, Contador2
STRH R7, [r2]
LDR R7, Contador2
LDRB R7, [R7]
CMP R7, #0xC
Blo Compare
LDR R7, Contador2
MOV r2, #0x0
STRB r2, [R7]
B Insert
end:
MOV r3, #0x0
LDR r2, Contador
STR r3, [r2]
ldr r1, var
ldr r2, [r1]
add r2, #0x3
str r2, [r1]
LDR R1, movesettable
ADD R1, R6, R1
LDR r2, [R1]
ldr r1, var
ldr r3, [r1]
cmp r3, r2
bhs end1
str r2, [r1]
end1:
mov r2, #0x0
mov r3, #0x0
mov r4, #0x0
mov r7, #0x0
LDR R1, Go
bx r1
Traz:
LDR r1, var
LDR r2, [r1]
sub r2, #0x3
str r2, [r1]
B Compare


Insert:
LDR R7, Contador
LDRB R7, [R7]
MOV r2, #0x3
MUL R7, r2, R7
LDR r3, moves
ADD r3, R7, r3
LDR r2, var
LDR r2, [r2]
LDRB r2, [r2]
STRB r2, [r3]
LDR r2, var
LDR r2, [r2]
LDRB r2, [r2, #0x1]
STRB r2, [r3, #0x1]
LDR r2, var
LDR r2, [r2]
LDRB R2, [R2, #0x2]
STRB R2, [R3, #0x2]
LDR R7, Contador
LDRH R7, [R7]
ADD R7, #0x1
LDR r2, Contador
STRB R7, [r2]
b Traz

.align 2
var: .word 0x02FF7d24
Contador2: .word 0x02FF7D2C
moves: .word 0x02FF7D50
movesettable: .word 0x08FFFFFF
Contador: .word 0x02FF7D28
Go: .word 0xJAMBO51ROUTINEOFFSET
Change 0x692A0 to 00 49 08 47 XX XX XX 08 where the XX XX XX stands for the pointer to your new routine plus 1.

Then Jambo's second routine slightly modified by BugMania:
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle2
main:
ldrb r1, [r0, #0x2]
mov r2, #0xFF
cmp r1, r2
beq exit2
mov r9, r2
mov r3, #0x0
loop: lsl r0, r3, #0x1
add r0, r0, r3
ldr r1, =0x02FF7D24
ldr r1, [r1, #0x0]
add r7, r0, r1
ldrb r0, [r7, #0x2]
mov r4, r10
cmp r0, r4
bgt exit2
ldrb r1, [r7, #0x1]
ldrb r0, [r7, #0x0]
lsl r1, r1, #0x8
orr r1, r0
mov r0, r8
str r3, [sp, #0x0]
bl branchone
mov r5, r9
ldr r3, [sp, #0x0]
cmp r0, r9
bne exit
mov r0, r8
add r1, r4, #0x0
bl branchtwo
ldr r3, [sp, #0x0]
exit: add r3, #0x1
lsl r1, r3, #0x1
add r1, r1, r3
add r0, r7, r1
ldrb r0, [r0, #0x2]
cmp r0, r5
bne loop
exit2: add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
branchone: push {r4-r7,lr}
add sp, #-0x4
ldr r7, gothere
bx r7
branchtwo: push {r4-r7}
ldr r7, gothere2
bx r7
.align
gothere: .word 0x08069145
gothere2: .word 0x080694D3
movesettable: .word 0x08FFFFFF
This will fix the moveset loading to it can now support up to 0xFFFF moves (instead of 0x1FF).

Then Jambo's final routine:
Spoiler:
Code:
 .text
.align 2
.thumb
.thumb_func
.global newmovesetstyle
main:
 lsl r2, r5, #0x1
 add r2, r2, r5
 ldr r1, [sp, #0x10]
 add r0, r2, r1
 ldrb r0, [r0, #0x2]
 ldr r1, [sp, #0xC]
 add r7, r2, #0x0
 add r5, #0x1
 mov r12, r5
 cmp r0, r1
 bgt later
 mov r4, #0x0
 cmp r1, r0
 beq later2
 mov r4, #0x1
 neg r4, r4
 ldr r0, [sp, #0x14]
 ldr r1, table
 add r6, r0, r1
 mov r3, sp
 sub r3, #0x2
 add r5, r7, #0x0
there: add r3, #0x2
 add r4, #0x1
 cmp r4, #0x3
 bgt later2
 ldr r0, [r6, #0x0]
 add r0, r5, r0
 ldrb r2, [r0, #0x0]
 ldrb r0, [r0, #0x1]
 lsl r0, r0, #0x8
 orr r0, r2
 ldrh r2, [r3, #0x0]
 cmp r0, r2
 bne there
later2: cmp r4, #0x4
 bne later
 mov r4, #0x0
 cmp r4, r10
 bge later3
 mov r1, r9
 ldr r0, [r1, #0x0]
 add r0, r7, r0
 ldrb r2, [r0, #0x0]
 ldrb r1, [r0, #0x1]
 lsl r1, r1, #0x8
 orr r1, r2
 ldr r0, [sp, #0x8]
 ldrh r2, [r0, #0x0]
 cmp r1, r2
 beq later3
 ldr r1, [sp, #0x14]
 ldr r2, table
 add r6, r1, r2
 ldr r3, [sp, #0x8]
 add r5, r7, #0x0
there2: add r3, #0x2
 add r4, #0x1
 cmp r4, r10
 bge later3
 ldr r0, [r6, #0x0]
 add r0, r5, r0
 ldrb r2, [r0, #0x0]
 ldrb r0, [r0, #0x1]
 lsl r0, r0, #0x8
 orr r0, r2
 ldrh r2, [r3, #0x0]
 cmp r0, r2
 bne there2
later3: cmp r4, r10
 bne later
 mov r0, r10
 add r0, #0x1
 mov r10, r0
 lsl r2, r4, #0x1
 ldr r1, [sp, #0x8]
 add r2, r2, r1
 mov r4, r9
 ldr r0, [r4, #0x0]
 add r0, r7, r0
 ldrb r1, [r0, #0x0]
 ldrb r0, [r0, #0x1]
 lsl r0, r0, #0x8
 orr r0, r1
 strh r0, [r2, #0x0]
later: mov r5, r12
 mov r1, r9
 ldr r0, [r1, #0x0]
 lsl r1, r5, #0x1
 add r1, r1, r5
 add r1, r1, r0
 ldrb r0, [r1, #0x2]
 cmp r0, #0xFF
 bne main
 mov r0, r10
 add sp, #0x18
 pop {r3-r5}
 mov r8, r3
 mov r9, r4
 mov r10, r5
 pop {r4-r7}
 pop {r1}
 bx r1
.align
table: .word 0x08FFFFFF
Change 0x06E118 to 00 4A 10 47 XX XX XX 08 where the XX XX XX stands for the pointer to your new routine plus 1.

Hopefully this can be useful to someone. I will test it myself soon.

Last edited by Phenom2122; 1 Week Ago at 05:40 AM.
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 06:31 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.