Binary Hack Research & DevelopmentGot a well-founded knack with your binary Pokémon hacks? Love reverse-engineering them? For the traditional Pokémon ROM hacker, 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!
Return2: .word 0x801F216+1 should be 0x801F294+1, though I doubt it would solve the problem
I don't think that's right, when I change it to that Sturdy doesn't work at all (moves that would inflict damage greater than the target's HP, which should trigger the endure BS, just faint it).
Posting to have this routine checked. It's a modified version of MrDS's Toxic Boost + Flare Boost routine for Emerald. Since only Toxic Boost is the ability in the routine planned to be added in SE, I've made attempts to change it so that Flare Boost and anything that relates to it in the code is gone. Index number(s) have been changed accordingly:
Posting to have this routine checked. It's a modified version of MrDS's Toxic Boost + Flare Boost routine for Emerald. Since only Toxic Boost is the ability in the routine planned to be added in SE, I've made attempts to change it so that Flare Boost and anything that relates to it in the code is gone. Index number(s) have been changed accordingly:
I can finally say it is completely done ! This is for Emerald : Implementation of Delta Stream/DesolateLand/Primordial Sea
Spoiler:
Read Me :
Spoiler:
In all of those routines and battlescripts I used 0x0203E331 as a free ram location to check whether a perma weather is set or not. You can use whatever you want while this is not used in-game.
#org 0xA21E80
pause 0x20
setword 0x0203E320 0x08XXXXXX // Assuming 0x0203E320 is the pointer of your setword and XX XX XX the address of the message you want to display
printstring 0x184
waitmessage DELAY_1SECOND
playanimation 0x0 0x1E 0x0 //The table below ends with the 0x0 0x1D 0x0 animation, replace it accordingly (0x1E in my case, I just added this one)
waitanimation
call 0x82DB48D
end3
At TT TT TT :
Code:
BB 00 E1 ED E7 E8 D9 E6 DD E3 E9 E7 00 D5 DD E6 00 D7 E9 E6 E6 D9 E2 E8 00 DD E7 FE E4 E6 E3 E8 D9 D7 E8 DD E2 DB 00 C0 E0 ED DD E2 DB AE E8 ED E4 D9 00 CA E3 DF D9 E1 E3 E2 AB
This is the string that says "A mysterious air..." You can change it in whatever you want.
Also, you'll have to repoint a little table to play a new custom animation. At 0x5DA3C there's a pointer. Change this pointer to your new table which will be :
Whith LL LL LL being the pointer to your new animation (you can use an existing one but you'll still have to repoint as I said).
I assumed here that FA is your setword command and 0x0203E320 your freelocation that point to your battlestring.
Weather attacks ineffective under Primal/Mega weathers :
Spoiler:
The battlescript :
Spoiler:
Code:
#org @YourOffset
jumpifhalfword 0x0 0x203E331 0xBE 0x82D9F1A ##Here I check if the FreeRam loc that as used is different from 0, to see whether the mega/prima weather are activated or not
jumpifhalfword 0x0 0x203E331 0xBF 0x82D9F1A ##Same thing
jumpifhalfword 0x0 0x203E331 0xC0 0x82D9F1A ##Same
jumpifhalfword 0x0 0x20241EA 0xC9 0x82D99B7 ##Check if the move index correspond to sandstorm
jumpifhalfword 0x0 0x20241EA 0xF0 0x82D9B3D ##or rain dance
jumpifhalfword 0x0 0x20241EA 0xF1 0x82D9B55 ##or sunny day
jumpifhalfword 0x0 0x20241EA 0x102 0x82D9FD2 ##or finally hail
Finally make hail/raindance/sandstorm having the same effect which point on @YourOffset.
Modulation damages :
Spoiler:
The routines :
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global damagemodulationmegaprima
CheckPermaWeather:
ldr r5, FreeRam
ldrb r5, [r5]
cmp r5, #0x0
bne PrimoWeather
ClassicRoutine:
ldr r5, TypeChart
add r0, r3, r5
ldrb r0, [r0]
ClassicReturn:
cmp r0, r8
ldr r2, Return
bx r2
PrimoWeather:
FireUseless:
cmp r5, #0xBE /*Index number of your ability Primordial Sea*/
bne WaterUseless
ldr r5, TypeChart
add r0, r3, r5
ldrb r0, [r0]
push {r1}
mov r1, #0xA
cmp r1, r8
beq Damped
pop {r1}
b ClassicReturn
WaterUseless:
cmp r5, #0xBF /*Index number of your ability Desolate Land*/
bne ClassicRoutine
ldr r5, TypeChart
add r0, r3, r5
ldrb r0, [r0]
push {r1}
mov r1, #0xB
cmp r1, r8
beq Evaporated
pop {r1}
b ClassicReturn
Evaporated:
ldr r0, BattleScript1
b EndFail
Damped:
ldr r0, BattleScript2
EndFail:
pop {r1}
ldr r1, ActiveBSPointer
str r0, [r1]
ldr r1, ReturnFail
bx r1
.align 2
Return: .word 0x08047144+1
ReturnFail: .word 0x08047266+1
FreeRam: .word 0x0203E331
TypeChart: .word 0x08E3D114 /*Take care to change this address accordingly to your type chart*/
BattleScript1: .word 0x08YourOffset /*Change accordingly to the location your battle script1*/
BattleScript2: .word 0x08YourOffset /*Change accordingly to the location your battle script2*/
ActiveBSPointer: .word 0x02024214
/*00 48 00 47 XX+1 XX XX 08 at 0x4713C*/
CE DC D9 00 D1 D5 E8 D9 E6 AE E8 ED E4 D9 00 D5 E8 E8 D5 D7 DF FE D9 EA D5 E4 E3 E6 D5 E8 D9 D8 00 DD E2 00 E8 DC D9 00 DC D5 E6 E7 DC 00 E7 E9 E2 E0 DD DB DC E8 AB
CE DC D9 00 C0 DD E6 D9 AE E8 ED E4 D9 00 D5 E8 E8 D5 D7 DF FE DA DD EE EE E0 D9 D8 00 E3 E9 E8 00 DD E2 00 E8 DC D9 00 DC D9 D5 EA ED 00 E6 D5 DD E2 AB
Associated BattleScripts : Note : I assumed you implemented Moxie in your rom (see page 1 of this thread). So if you don't want that ability you can remove the underlined part in the first battlescript.
Spoiler:
Target BattleScript (at PPPPPP:
Code:
For target :
56 00 39 40 00 1A 00 1B before the battlescript below. So you have to make it point on the "56".
#dynamic 0xSomeOffset
#freespace 0xFF
#org @start
attackcanceler
printstring 0x1D
printstring 0x130
pause 0x40
setword 0x203E320 0x8QQQQQQ
printstring 0x184
waitmessage 0x40
jumpifability 0x1 0x9A @Moxie
return
#org @Moxie
jumpiffainted 0x1 @Ornot
jumpifstat 0x1 0x0 0x1 0xC @Ornot
pause 0x20
setbyte 0x202448F 0x0
playstatchangeanimation 0x1 0x2 0x0
setbyte 0x202448E 0x11
statbuffchange 0x1 TRUE @Ornot
setword 0x203E320 0x8MoxieString
printstring 0x184
waitmessage 0x40
return
#org @Ornot
return
At QQQQQQ :
Code:
CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
User BattleScript :
Code:
Assuming FA is your Setword command and 0203E320 your location of battle string:
FAF0 E3 03 02 QQ QQ QQ 08 10 84 01 12 40 00 56 01 39 40 00 1A 01 1B 01 10 1C 00 3C
At QQQQQQ :
Code:
CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
Thank a lot to MrDollSteak to pointing me how to handle a good part of this, thanks to daniilS for help me to fix some bugs, and thanks to Touched for being really patient with me.
Hope this could be useful to someone, if there's any problem or bugs PM me
Can someone port it in FireRed?
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.
You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.
Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Originally Posted by kleenexfeu
I can finally say it is completely done ! This is for Emerald : Implementation of Delta Stream/DesolateLand/Primordial Sea.
Scrollbar appears
Please review and fix the issues by reading the signature rules.
You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.
Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Sorry for the long delay, but here are the Type Change Abilities! Credits to Kleenexfeu for the original routines, I've just optimised them and added Normalize.
#185Link to this post, but load the entire thread.
November 8th, 2015 (11:30 AM).
Trainer 781
Guest
Posts: n/a
Just updated Unaware here by merging the accuracy ones into a single, clear and concise routine as well as including the updated effect of Keen Eye and also accommodating the evasion drop due to the move Gravity.
Sorry for the long delay, but here are the Type Change Abilities! Credits to Kleenexfeu for the original routines, I've just optimised them and added Normalize.
-ate aren't supposed to change the type of move like Judgment etc. So you check correctly that for the type, though you still give them a boost.
You should first check changetype loc, anding it with 0x3F, because moves like weather ball still store a value, even if the type is note changed, like 0x80, once "anded" with 0x3F, it gives 0. If once anded it's equal to 0, you can change the type and then boost.
Good catch for normalize, I didn't even paid attention to r10 x)
You also have to check changetypeloc for normalize, because it doesn't affect judgment and such
-ate aren't supposed to change the type of move like Judgment etc. So you check correctly that for the type, though you still give them a boost.
You should first check changetype loc, anding it with 0x3F, because moves like weather ball still store a value, even if the type is note changed, like 0x80, once "anded" with 0x3F, it gives 0. If once anded it's equal to 0, you can change the type and then boost.
Good catch for normalize, I didn't even paid attention to r10 x)
You also have to check changetypeloc for normalize, because it doesn't affect judgment and such
Well actually Normalize doesn't need to check changetypeloc, because it only activates on not Normal moves, so if r10 is storing Normal for Judgment and Hidden Power it won't change.
Good catch on the boost though, I'll swap the order around a little bit.
#188Link to this post, but load the entire thread.
November 10th, 2015 (7:14 AM).
Trainer 781
Guest
Posts: n/a
Quote:
Originally Posted by Spherical Ice
Sturdy
Any ideas?
In the second sturdy routine, you erroneously set the value of Flag label to x2023FDC instead of x2023DFC. This should fix your problem.
Also, the endured string is 0x99 same as the case in Emerald.
This is a table that contains the indices (Half Words) of damaging moves not supported by Parental Bond like Multi-Hit, Charging Turn Moves etc. Terminated by FEFE. Add indices for new moves like Dual Chop, Double Hit etc.
.text
.align 2
.thumb
.thumb_func
.global restoreabilities
EndTurn:
ldr r0, .Outcome
mov r1, #0x0
strb r1, [r0]
ldr r0, .Index
strb r1, [r0]
ldr r0, .ParentalByte
strb r1, [r0]
RestoreAbilities:
push {r2-r6}
ldr r4, .Battlers
ldrb r4, [r4]
mov r3, #0x0
ldr r5, .DisabledAbilityLoc
ldr r6, .BattleData
Loop:
ldrb r2 [r5, #0x0]
cmp r2, #0x0
beq EndLoop
strb r2, [r6]
strb r1, [r5]
EndLoop:
add r3, r3, #0x1
cmp r3, r4
bge Exit
add r5, r5, #0x1
add r6, r6, #0x58
b Loop
Exit:
pop {r2-r6}
ldr r1, .EndLoc
mov r0, #0xB
strb r0, [r1]
bx lr
.align 2
.Outcome: .word 0x02023DCC
.Index: .word 0x02023BC4
.Battlers: .word 0x02023D6C
.DisabledAbilityLoc: .word 0x0203C034
.BattleData: .word 0x02023C04
.EndLoc: .word 0x02023BE3
.ParentalByte: .word 0x203C03C
@ Go to your Battle Script command table, search for CD 2C 02 08 and replace it by XX+1 XX XX 08 (We are replacing the 'End' Battle Script Command. Not the case in Emerald)
Basically the 4th Mold Breaker Routine with added logic to clear the Parental Byte.
Bugs
Spoiler:
Does not handle Knock Off, Smelling Salts and Color Change as done in Gen VI. This due to the differences in order between Gen VI and Gen III handling of events during a Move Execution.
This is a table that contains the indices (Half Words) of damaging moves not supported by Parental Bond like Multi-Hit, Charging Turn Moves etc. Terminated by FEFE. Add indices for new moves like Dual Chop, Double Hit etc.
.text
.align 2
.thumb
.thumb_func
.global restoreabilities
EndTurn:
ldr r0, .Outcome
mov r1, #0x0
strb r1, [r0]
ldr r0, .Index
strb r1, [r0]
ldr r0, .ParentalByte
strb r1, [r0]
RestoreAbilities:
push {r2-r6}
ldr r4, .Battlers
ldrb r4, [r4]
mov r3, #0x0
ldr r5, .DisabledAbilityLoc
ldr r6, .BattleData
Loop:
ldrb r2 [r5, #0x0]
cmp r2, #0x0
beq EndLoop
strb r2, [r6]
strb r1, [r5]
EndLoop:
add r3, r3, #0x1
cmp r3, r4
bge Exit
add r5, r5, #0x1
add r6, r6, #0x58
b Loop
Exit:
pop {r2-r6}
ldr r1, .EndLoc
mov r0, #0xB
strb r0, [r1]
bx lr
.align 2
.Outcome: .word 0x02023DCC
.Index: .word 0x02023BC4
.Battlers: .word 0x02023D6C
.DisabledAbilityLoc: .word 0x0203C034
.BattleData: .word 0x02023C04
.EndLoc: .word 0x02023BE3
.ParentalByte: .word 0x203C03C
@ Go to your Battle Script command table, search for CD 2C 02 08 and replace it by XX+1 XX XX 08 (We are replacing the 'End' Battle Script Command. Not the case in Emerald)
Basically the 4th Mold Breaker Routine with added logic to clear the Parental Byte.
Bugs
Spoiler:
Does not handle Knock Off, Smelling Salts and Color Change as done in Gen VI. This due to the differences in order between Gen VI and Gen III handling of events during a Move Execution.
This and the new items effect effect, + the good place for multitype, that's really awesome KDS, thanks for your work !
Could we check the move effect instead of the move number ? Perhaps it'd be more practical.
Is that where I supposedly put the hook because the pointer to be placed is not 4-byte aligned.
And there are few errors while compiling:
- Two instances of Return. One is a branch and one is a pointer. I believe that the branch Return should be ReturnType.
- Forgotten the . "dots" before the .align 2 of pointers (ChangeTypeLog and others)
- and r2, #0x3F... "and" seriously? Maybe a typo of add I suppose?
Is that where I supposedly put the hook because the pointer to be placed is not 4-byte aligned.
And there are few errors while compiling:
- Two instances of Return. One is a branch and one is a pointer. I believe that the branch Return should be ReturnType.
- Forgotten the . "dots" before the .align 2 of pointers (ChangeTypeLog and others)
The alignement could be a problem indeed.
I hooked at 08069614 because I used 0806960C for psystrike (and the same location can be used later for other move of that kind), could you slightly change your hook ?
The dot before ChangeTypeLoc should be removed in the routine rather than added in the literal pool, as they are used for directive, using them for label/literal pool can be confusing.
You could indeed rename the label "Return" to "ReturnType", and then change the instances of the label Return in the routine.
I don't think "and r2, #0x3F" is allowed, at least with my assembler.
Finally, you should check the change type loc before moving r0 into r10, as r10 is used several times later. Something like :
ldr r1, ChangeTypeLoc
ldr r1, [r1]
This is a really cool resource.
How do you link the battle scripts to the ASM?
Or is the ASM linked to the Battle script?
There's a post by Jambo in the Quick Research and Development that has a 'callasm' command for his battle script editor. We also use hooks in whatever routine the ability checks /should/ be in. So that's how we get battle scripts to use custom ASM in the middle of it.
Also, battle scripts are 'macro' ASM, so we can actually change what the commands do. So as you can see, literally everything in the game is ASM, a table, or a picture, but the battle scripts make things a lot shorter.
There's a post by Jambo in the Quick Research and Development that has a 'callasm' command for his battle script editor. We also use hooks in whatever routine the ability checks /should/ be in. So that's how we get battle scripts to use custom ASM in the middle of it.
Also, battle scripts are 'macro' ASM, so we can actually change what the commands do. So as you can see, literally everything in the game is ASM, a table, or a picture, but the battle scripts make things a lot shorter.