Registrarse

[ASM] E | Add All Deoxys Forms That Change w/ Variable

icyred21023

Usuario de plata
I am really excited that I got this working. There's a chance you may run into bugs but I think it's good to go. This routine uses the same code in the game that changes Deoxys form automatically to Speed in Emerald. I went through how the game code changes Deoxys stats and sprites, and realized if you just import a sprite with more forms, you can pick any sprite on the sheet. The same with the stats. So I got this working right now and im so happy its finally working good, so lets get into how to do it

Screenshot_20230921_105329_My Boy!.jpg
Screenshot_20230921_105414_My Boy!.jpg

First lets add the sprites. They will be attach below. Open UNLZ and goto 741 for the Front Sprite. Import the front sprite attached and hit Write to Rom (make sure youre on Deoxys already existing sprite). Make sure you select Import Image, Import Palette, Auto Abort, Automatically Fix Pointers. Use FSF to find about 1000 bytes ish, enter the offset for Image, and do same for palette. I used FB0000, and FB1200 I think. Make sure it says pointers were replaced. Now repeat the process for the Back Sprites, goto 1810 in UNLZ and do the same process. Now lets get to the routine
.
This routine uses Variable 0x40DC to determine which form's Sprites and Stats will be shown and used.

40DC = 0 = Normal Form
40DC = 1 = Speed Form
40DC = 2 = Defense Form
40DC = 3 = Attack Form

Only one routine is required to add into the game. It'll be easiest if you write the bytes at offset FE0000. You should have free space there. If you cant do that it shouldnt be a problem.
0EB40904090C374B8B422ED00EBC0FB4 2F48304A00F00FF80023006898420BD0 012398420DD00223984210D003239842 13D00FBC17E010470FBC00215818191C 11E00FBC802109015818191C0BE00FBC 802149015818191C05E00FBCC0214901 5818191CFFE7204A10470EBC1F4A0FB4 184B174800F02AF80068002188421CD0 0121884205D0022188420FD003218842 05D00FBC710089180988490014E00FBC 0E4A71008918098849000DE00FBC0A4A 710089180988490006E00FBC084A7100 891809884900FFE7094B18471847C046 DC40000049D60908A0FFFD08B0FFFD08 C0FFFD08578A0000454C0308489D3208 618A0608


.THUMB
.ALIGN 2

PUSH {R1-R3}
LSL R1, R1, #0x10
LSR R1, R1, #0x10
LDRH R3, = 0x8A57
CMP R3, R1
BEQ STAT_CHANGE

POP {R1-R3}

SPRITE_CHANGE:
PUSH {R0-R3}
LDR R0, var_deoxys
LDR R2, check_var
BL LINKER2
MOV R3, #0x0
LDR R0, [R0]
CMP R0, R3
NORMAL BEQ
MOV R3, #0x1
CMP R0, R3
BEQ SPEED
MOV R3, #0x2
CMP R0, R3
BEQ DEFENSE
MOV R3, #0x3
CMP R0, R3
BEQ ATTACK
POP {R0-R3}
B RETURN

LINKER2:
BX R2

NORMAL:
POP {R0-R3}
MOV R1, #0x0
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

SPEED:
POP {R0-R3}
MOV R1, #0x80
LSL R1, R1, #0x4
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

DEFENSE:
POP {R0-R3}
MOV R1, #0x80
LSL R1, R1, #0x5
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

ATTACK:
POP {R0-R3}
MOV R1, #0xC0
LSL R1, R1, #0x5
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

RETURN:
LDR R2, = 0x08034c44+1
BX R2

STAT_CHANGE:
POP {R1-R3}
LDR R2, = 0x08329D48
PUSH {R0-R3}
LDR R3, check_var
LDR R0, var_deoxys
BL LINKER
LDR R0, [R0]
MOV R1, #0x0
CMP R0, R1
BEQ NORMAL_STATS
MOV R1, #0x1
CMP R0, R1
BEQ SPEED_STATS
MOV R1, #0x2
CMP R0, R1
BEQ DEFENSE_STATS
MOV R1, #0x3
CMP R0, R1
BEQ ATTACK_STATS

SPEED_STATS:
POP {R0-R3}
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

ATTACK_STATS:
POP {R0-R3}
LDR R2, ASTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

DEFENSE_STATS:
POP {R0-R3}
LDR R2, DSTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

NORMAL_STATS:
POP {R0-R3}
LDR R2, NSTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

STAT_RETURN:
LDR R3, = 0x08068A60+1
BX R3

LINKER:
BX R3

.ALIGN 2
var_deoxys:
.word 0x000040DC @Variable for deoxys form
check_var:
.word 0x0809D648+1
DSTATS:
.word 0x08FDFFA0
ASTATS:
.word 0x08FDFFB0
NSTATS:
.word 0x08FDFFC0

Now that you have the routine in, you have to add the hooks. There are 2 hooks that feed this routine.
first one, @ offset 0x068A58 , overwrite with 00 4A 10 47 01 00 FE 08. If you didn't use FE0000 change the last 4 bytes to point correctly.

Next hook is at 0x034C3C. Overwrite with 00 4A 10 47 01 00 FE 08 02 4A. Again change pointer if needed.

last thing needed is to add the data for the Stats. The offsets I put them are referenced in my code so they need to be put in the same address that I put them. Unless you Asssemble yourself and change the address. So Copy these bytes and overwrite them at 0xFDFFA0. If you put Routine at FE0000 this is right before that. It should be free.

32 00 46 00 A0 00 5A 00 46 00 A0 00 FF FF FF FF
32 00 B4 00 14 00 96 00 B4 00 14 00 FF FF FF FF
32 00 96 00 32 00 96 00 96 00 32 00 FF FF FF FF

Now to change forms just use an xse script to set form!
 

Adjuntos

Última edición:

aptitud

Usuario mítico
If I understand well :
with this method, all captured deoxys have the same form at all time ?
(And the wild/trainer ones still use the normal form ?)

Other than that, the principle seems really good.
Thanks for the tutorial.
 

KiddKey

Fuck off!
If I understand well :
with this method, all captured deoxys have the same form at all time ?
(And the wild/trainer ones still use the normal form ?)

Other than that, the principle seems really good.
Thanks for the tutorial.
is for change forms from deoxys, normal to attack, to defense...
 

icyred21023

Usuario de plata
If I understand well :
with this method, all captured deoxys have the same form at all time ?
(And the wild/trainer ones still use the normal form ?)

Other than that, the principle seems really good.
Thanks for the tutorial.
Yeah thats the one downfall , all of your deoxys will be the same form. It would be possible to add onto this code a way of storing what type each deoxys yoy have is but it would be alot of work. wild Deoxys are still in normal form, atleast the event one is still no matter what form is selected
 

DonVonStriker

Pequeño saltamontes
This doesn't seem to work at all for Emerald German version

I've found the lang version offsets and they should be absolutely correct
But the game always crashes opening the pokemenu of Deoxys
Only its sprites work seeing it in storage boxes

Here's the routine with German offsets, hoping someone could help to make it work

.THUMB
.ALIGN 2

PUSH {R1-R3}
LSL R1, R1, #0x10
LSR R1, R1, #0x10
LDRH R3, = 0x8A57
CMP R3, R1
BEQ STAT_CHANGE

POP {R1-R3}

SPRITE_CHANGE:
PUSH {R0-R3}
LDR R0, var_deoxys
LDR R2, check_var
BL LINKER2
MOV R3, #0x0
LDR R0, [R0]
CMP R0, R3
BEQ NORMAL
MOV R3, #0x1
CMP R0, R3
BEQ SPEED
MOV R3, #0x2
CMP R0, R3
BEQ DEFENSE
MOV R3, #0x3
CMP R0, R3
BEQ ATTACK
POP {R0-R3}
B RETURN

LINKER2:
BX R2

NORMAL:
POP {R0-R3}
MOV R1, #0x0
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

SPEED:
POP {R0-R3}
MOV R1, #0x80
LSL R1, R1, #0x4
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

DEFENSE:
POP {R0-R3}
MOV R1, #0x80
LSL R1, R1, #0x5
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

ATTACK:
POP {R0-R3}
MOV R1, #0xC0
LSL R1, R1, #0x5
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

RETURN:
LDR R2, = 0x08034C48+1
BX R2

STAT_CHANGE:
POP {R1-R3}
LDR R2, = 0x0833E708
PUSH {R0-R3}
LDR R3, check_var
LDR R0, var_deoxys
BL LINKER
LDR R0, [R0]
MOV R1, #0x0
CMP R0, R1
BEQ NORMAL_STATS
MOV R1, #0x1
CMP R0, R1
BEQ SPEED_STATS
MOV R1, #0x2
CMP R0, R1
BEQ DEFENSE_STATS
MOV R1, #0x3
CMP R0, R1
BEQ ATTACK_STATS

SPEED_STATS:
POP {R0-R3}
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

ATTACK_STATS:
POP {R0-R3}
LDR R2, ASTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

DEFENSE_STATS:
POP {R0-R3}
LDR R2, DSTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

NORMAL_STATS:
POP {R0-R3}
LDR R2, NSTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

STAT_RETURN:
LDR R3, = 0x08068A64+1
BX R3

LINKER:
BX R3

.ALIGN 2
var_deoxys:
.word 0x000040DC
check_var:
.word 0x0809D664+1
DSTATS:
.word 0x08FDFFA0
ASTATS:
.word 0x08FDFFB0
NSTATS:
.word 0x08FDFFC0

At 68A5C:
00 4A 10 47 xx+1 xx xx 08

At 34C40:
00 4A 10 47 xx+1 xx xx 08 02 4A
 

Ryurs

Usuario de oro
This doesn't seem to work at all for Emerald German version

I've found the lang version offsets and they should be absolutely correct
But the game always crashes opening the pokemenu of Deoxys
Only its sprites work seeing it in storage boxes

Here's the routine with German offsets, hoping someone could help to make it work

.THUMB
.ALIGN 2

PUSH {R1-R3}
LSL R1, R1, #0x10
LSR R1, R1, #0x10
LDRH R3, = 0x8A57
CMP R3, R1
BEQ STAT_CHANGE

POP {R1-R3}

SPRITE_CHANGE:
PUSH {R0-R3}
LDR R0, var_deoxys
LDR R2, check_var
BL LINKER2
MOV R3, #0x0
LDR R0, [R0]
CMP R0, R3
BEQ NORMAL
MOV R3, #0x1
CMP R0, R3
BEQ SPEED
MOV R3, #0x2
CMP R0, R3
BEQ DEFENSE
MOV R3, #0x3
CMP R0, R3
BEQ ATTACK
POP {R0-R3}
B RETURN

LINKER2:
BX R2

NORMAL:
POP {R0-R3}
MOV R1, #0x0
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

SPEED:
POP {R0-R3}
MOV R1, #0x80
LSL R1, R1, #0x4
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

DEFENSE:
POP {R0-R3}
MOV R1, #0x80
LSL R1, R1, #0x5
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

ATTACK:
POP {R0-R3}
MOV R1, #0xC0
LSL R1, R1, #0x5
ADD R0, R3, R1
ADD R1, R3, #0x0
B RETURN

RETURN:
LDR R2, = 0x08034C48+1
BX R2

STAT_CHANGE:
POP {R1-R3}
LDR R2, = 0x0833E708
PUSH {R0-R3}
LDR R3, check_var
LDR R0, var_deoxys
BL LINKER
LDR R0, [R0]
MOV R1, #0x0
CMP R0, R1
BEQ NORMAL_STATS
MOV R1, #0x1
CMP R0, R1
BEQ SPEED_STATS
MOV R1, #0x2
CMP R0, R1
BEQ DEFENSE_STATS
MOV R1, #0x3
CMP R0, R1
BEQ ATTACK_STATS

SPEED_STATS:
POP {R0-R3}
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

ATTACK_STATS:
POP {R0-R3}
LDR R2, ASTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

DEFENSE_STATS:
POP {R0-R3}
LDR R2, DSTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

NORMAL_STATS:
POP {R0-R3}
LDR R2, NSTATS
LSL R1, R6, #0x1
ADD R1, R1, R2
LDRH R1, [R1]
LSL R1, R1, #0x1
B STAT_RETURN

STAT_RETURN:
LDR R3, = 0x08068A64+1
BX R3

LINKER:
BX R3

.ALIGN 2
var_deoxys:
.word 0x000040DC
check_var:
.word 0x0809D664+1
DSTATS:
.word 0x08FDFFA0
ASTATS:
.word 0x08FDFFB0
NSTATS:
.word 0x08FDFFC0

At 68A5C:
00 4A 10 47 xx+1 xx xx 08

At 34C40:
00 4A 10 47 xx+1 xx xx 08 02 4A
Buenas. Yo lo que haría sería probar las rutinas y los cambios de bytes del post principal en una ROM limpia inglesa, y ver si todo funciona como debería haciendo las pertinentes pruebas. Si en la ROM inglesa funciona y en la tuya alemana no, es que evidentemente has colocado alguna compensación mal.
 

DonVonStriker

Pequeño saltamontes
Already tried on english rom and works
Offsets found of german version seem correctly so I don't know what the problem is
Anyway it misses icon change at now so I consider it incomplete
Thank you anyway
 
Arriba