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!
I've been working on a FR hack for a few months recreating Pokémon Colosseum/Gale of Darkness. About 95% done with the trainer editing (The shadow pokemon concept wasn't really working out as I was having trouble catching a specific pokemon from a trainer's party, so I've just been using the givepokemon command after the battle and using the flags from various overworld item sprites).
I'd really like to add a function where an opponents party level matches the highest in your party, like in the Mt Battle area in those games. Is there a way to set that up in a specific area of the game? Like to pull a certain trainer hex ID into the trainerbattle command and temporarily adjust the levels from their original setting to the highest in your party? Or would entirely new trainers have to be made? I'm leaning toward that because I've tried to find the trainers in the Trainer Tower in FR but they don't seem to be available to edit in trainer editing programs.
I've been scouring threads looking for info on this, but haven't had much luck. If anyone is able to help, wants to take a crack at it, or point me in the right direction I'd greatly appreciate it.
EDIT
I've come across how to get the highest level in my party, but I'm unsure how to have the game temporarily overwrite the trainer's pokemon level with a script, so I was thinking an ASM routine might be the way to go.
This hack allows the player to directly select a pokemon from the pc boxes by modifying the tasks associated with the withdraw function. It doesn't actually do anything with the selection except store relevant data, but this data can then be used in subsequent functions to modify relevant data.
Fortunately, I added in some new/updated specials to allow the user to swap pokemon between box and party for things like trading, nicknaming, and checking/setting pokeball types. Adding new specials for other data manipulation is easy enough, and I would be happy to add more if more ideas come to me.
Current Special Fixes Include:
Spoiler:
special 0x7 - get EVs of party/boxed pokemon
special 0x8 - get IVs of party/boxed pokemon
special 0xB - get pokeball ID of party/boxed pokemon
special 0xD - get happiness of party/boxed pokemon
special 0x13 - set happiness of party/boxed pokemon
special 0x14 - ste pokeball ID of party/boxed pokemon
special 0x1A - save/restore party pokemon data to/from free ram (default is 6th opponent slot)
special 0x1B - save/restore pokemon data to/from pc
special 0x7b - check nicknamed pokemon from party/box
special 0x7c - buffer party/boxed pokemon nickname
special 0x7d - check traded pokemon from party/box
special 0x9e - nickname pokemon from party/box
im using emerald
Hello I wanted to know if there
Is a way to make a asm routine that I can call in a script Wich shows a trainer battle sprite anywhere on screen
Like a modified showpokepic or something
(P.s. i’m Not good at making asm myself so pls design the routine for me)
__________________
I’m working on a ROM hack called pokemon penny.
It is a hack of emerald.
Sry, im not very good at typing the english Language.
This will let you select a pokemon from the box, and store the relevant location information to var8000 and var8001. Then, using the updated specials you can manipulate that pokemon's data.
Welp, it didn't work.
I compiled the routine and dropped it in the offset 71A250, wrote this script and once I checked it In-Game, this was the result. Note: Just for the record, the savefile is right after defeating my Rival for the very first time, so there's no way for my Pokémon to have 76 points.
Dunno if you'll be able to fix it, but in any case thank you very much.
Would you be willing to reshare the script (the link is no longer working) in code tags? I am relatively new and trying to figure this stuff out.
Surprisingly, I just stumbled upon a thread that I made in the Spanish community "Whack a Hack!" where I reposted Ghoulslash's routine (giving all the credits to him, naturally.)
I also posted a script to get the routine working there, but instead of carelessly pasting it in Hastebin like I did here, I've put it in Pastebin.
So because I have a life, I spent way too long yesterday writing a routine to change the measurements for the height and weight in the PokeDex to be in metric (for those who eschew the imperial system).
EDIT: I neglected to have this change the units for SEEN entries as well as CAUGHT entries. I fixed that now.
Height (Feet to Metres - (Uncaught Pokemon)):
Spoiler:
/* Assemble this at 0x1059D0 */
.text
.align 2
.thumb
.thumb_func
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
This routine makes the game calculate and display the actual type of Hidden Power in battle and in status screens. If, for example, a Pok�mon's Hidden Power type is Water, it will display as a Water-type move, just like Surf or any other Water-type move.
Note that this only calculates and displays the type, not the base power.
Hello, I am looking to add battle items X Sp Def and X Evasion to the game (And perhaps, if it's workable, X HP)
I do not own IDA Pro, so it's going to be a real challenge trying to locate the correct offsets for the Battle Items. I don't know how it's done, but I guess I can request a tutorial here.
I will give credit when requested!
This is the location of the battle effect:
0FE4B9
__________________
If your interested in tutoring me on how to use the scripting and answering all my questions, send me a PM and we can discuss contacting each other in further details.
A little info about me and my goals:
I am burned out on Pokemon games, which, since emerald, have gradually grown worse to me. I am a fan of Generation 3 and earlier. I have some creature ideas I'd rather keep to myself and friends, due to personal reasons. Thus, I want to make my first game encompassing them. I do not know how to program, so I'll learn by using pokemon essentials. Once I complete the game, I'll enjoy it, and work on an entirely new project.
I have a great idea for fire red I was thinking of in game player name change like to set the player name to a predefined name.
For example if the player name is David by setflag or setvar it could be changed to Mike I.e.,name decided by the hacker.
Sorry if this is too complicated and thanks in advance.
I have a great idea for fire red I was thinking of in game player name change like to set the player name to a predefined name.
For example if the player name is David by setflag or setvar it could be changed to Mike I.e.,name decided by the hacker.
Sorry if this is too complicated and thanks in advance.
The player's name can be changed from the overworld via callasm 0x809FC91
I have a pretty old routine I wrote to change the OT name of your pokemon to the new name based on matching OTIDs, so traded pokemon will retain their OT names. Note that I wrote it a while ago so there may be bugs
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global ChangePokeNames
/*
Function to change all pokemon OT names to the players new name (unless IDs dont match aka traded pokemon)
Inputs:
-none
Outputs:
-none
Usage:
callasm 0x809FC91 //rename player
waitstate
callasm [this_routine]+1
*/
Start:
push {r0-r7, lr}
ChangePartyNames:
ldr r7, .PartyPoke
mov r6, #0x64
mov r5, #0x5
bl NameChanges
ChangeBoxNames:
ldr r7, .BoxDMA
ldr r7, [r7]
add r7, #0x4
mov r6, #0x50
mov r5, #0x69
lsl r5, r5, #0x2 @420 box pokemon total
bl NameChanges
Exit:
pop {r0-r7, pc}
/*
Name Change Call Function
r5 = num pokes to check
r6 = data size per poke
r7 = start address
*/
NameChanges:
push {lr}
mov r4, #0x0
OuterLoop:
mov r0, r4
mul r0, r6
GetPokeDataLoc:
add r0, r0, r7
ldrh r1, [r0, #0x4]
GetPlayerID:
ldr r2, .Saveblock
ldr r3, [r2]
ldrh r2, [r3, #0xA]
CompareIDs:
cmp r1, r2
bne OuterLoopRestart @OTIDs do not match -> no name change
PrepInnerLoop:
add r0, #0x14
mov r2, #0x0
charLoop:
ldrb r1, [r3]
strb r1, [r0]
cmp r2, #0x6 @7 bytes for OT name
beq OuterLoopRestart
add r3, #0x1
add r0, #0x1
add r2, #0x1
b charLoop
OuterLoopRestart:
cmp r4, r5
beq Return
add r4, #0x1
b OuterLoop
Return:
pop {r0}
bx r0
.align 2
.PartyPoke: .word 0x02024284
.Saveblock: .word 0x0300500C
.BoxDMA: .word 0x03005010
The routine now does not require any new Held Effect Item Byte. The new power items are tied to Macho Brace's Held Item Effect Byte. (Thanks to MrDollSteak for giving the idea.)
The type of EV gain is now differentiated by the Second Held Effect Byte (the byte just after the Primary Held Effect Byte in the Item Table).
There is no need to code the Speed Drop explicitly for Power Items.
Usage is now like this by using the following parameters in the Item Table: Primary Byte | Secondary Byte | Item Name
0x18 | 0x0 | Macho Brace
0x18 | 0x1 | Power Weight
0x18 | 0x2 | Power Bracer
0x18 | 0x3 | Power Belt
0x18 | 0x4 | Power Anklet
0x18 | 0x5 | Power Lens
0x18 | 0x6 | Power Band
Also, there are additional byte changes mentioned in the Spoiler to limit the EVs for each stat from 255 to 252 to avoid wastage of EVs by normal battling.
Fire Red:-
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
Main:
push {r2}
mov r0, r8 /*Load pokemon slot no*/
mov r1, #0xC
mov r2, #0x0
bl Decrypter /* Load pokemon's item */
lsl r0, r0, #0x10
lsr r0, r0, #0x10
pop {r2} /* Restore Pokerus Factor*/
cmp r0, #0xAF
beq EnigmaBerry
add r3, r0, #0x0
bl GetItemEffect /* Get Held Item's Effect Byte*/
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x18
bne NoPowerItem
add r0, r3, #0x0
bl GetSecondEffectByte
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x0
beq MachoBrace
add r1, r6, #0x1 /*Load a Power Item's Secondary Effect Byte*/
cmp r1, r0 /*Match items*/
bne NoPowerItem /*No Power Item or No Match for that particular stat*/
lsl r2, r2, #0x2
add r4, r4, r2 /* Add 4 EVs or 8 (due to Pokerus) */
NoPowerItem:
ldr r3, =0x080439D9
bx r3
EnigmaBerry:
ldr r3, =0x0804398F
bx r3
MachoBrace:
ldr r3, =0x080439D5
bx r3
Decrypter:
ldr r3, =0x0803FBE9
bx r3
GetItemEffect:
ldr r1, =0x0809A925
bx r1
GetSecondEffectByte:
ldr r1, =0x0809A949
bx r1
/*At 43978: 04 1C 54 43 00 49 08 47 XX+1 XX XX 08 00 00 00 00 00 00 00 00 00 00*/
/*At 439FC && 43A02: FC to limit EV growth for each stat to 252 */
Emerald:-
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
Main:
push {r2}
mov r0, r8 /*Load pokemon slot no*/
mov r1, #0xC
mov r2, #0x0
bl Decrypter /* Load pokemon's item */
lsl r0, r0, #0x10
lsr r0, r0, #0x10
pop {r2} /* Restore Pokerus Factor*/
cmp r0, #0xAF
beq EnigmaBerry
add r3, r0, #0x0
bl GetItemEffect /* Get Held Item's Effect Byte*/
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x18
bne NoPowerItem
add r0, r3, #0x0
bl GetSecondEffectByte
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x0
beq MachoBrace
add r1, r6, #0x1 /*Load a Power Item's Secondary Effect Byte*/
cmp r1, r0 /*Match items*/
bne NoPowerItem /*No Power Item or No Match for that particular stat*/
lsl r2, r2, #0x2
add r4, r4, r2 /* Add 4 EVs or 8 (due to Pokerus) */
NoPowerItem:
ldr r3, =0x0806DC25
bx r3
EnigmaBerry:
ldr r3, =0x0806DBDB
bx r3
MachoBrace:
ldr r3, =0x0806DC21
bx r3
Decrypter:
ldr r3, =0x0806A519
bx r3
GetItemEffect:
ldr r1, =0x080D74DD
bx r1
GetSecondEffectByte:
ldr r1, =0x080D7501
bx r1
/*At 6DBC4: 04 1C 54 43 00 49 08 47 XX+1 XX XX 08 00 00 00 00 00 00 00 00 00 00*/
/*At 6DC48 && 6DC4E: FC to limit EV growth for each stat to 252 */
The player's name can be changed from the overworld via callasm 0x809FC91
I have a pretty old routine I wrote to change the OT name of your pokemon to the new name based on matching OTIDs, so traded pokemon will retain their OT names. Note that I wrote it a while ago so there may be bugs
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global ChangePokeNames
/*
Function to change all pokemon OT names to the players new name (unless IDs dont match aka traded pokemon)
Inputs:
-none
Outputs:
-none
Usage:
callasm 0x809FC91 //rename player
waitstate
callasm [this_routine]+1
*/
Start:
push {r0-r7, lr}
ChangePartyNames:
ldr r7, .PartyPoke
mov r6, #0x64
mov r5, #0x5
bl NameChanges
ChangeBoxNames:
ldr r7, .BoxDMA
ldr r7, [r7]
add r7, #0x4
mov r6, #0x50
mov r5, #0x69
lsl r5, r5, #0x2 @420 box pokemon total
bl NameChanges
Exit:
pop {r0-r7, pc}
/*
Name Change Call Function
r5 = num pokes to check
r6 = data size per poke
r7 = start address
*/
NameChanges:
push {lr}
mov r4, #0x0
OuterLoop:
mov r0, r4
mul r0, r6
GetPokeDataLoc:
add r0, r0, r7
ldrh r1, [r0, #0x4]
GetPlayerID:
ldr r2, .Saveblock
ldr r3, [r2]
ldrh r2, [r3, #0xA]
CompareIDs:
cmp r1, r2
bne OuterLoopRestart @OTIDs do not match -> no name change
PrepInnerLoop:
add r0, #0x14
mov r2, #0x0
charLoop:
ldrb r1, [r3]
strb r1, [r0]
cmp r2, #0x6 @7 bytes for OT name
beq OuterLoopRestart
add r3, #0x1
add r0, #0x1
add r2, #0x1
b charLoop
OuterLoopRestart:
cmp r4, r5
beq Return
add r4, #0x1
b OuterLoop
Return:
pop {r0}
bx r0
.align 2
.PartyPoke: .word 0x02024284
.Saveblock: .word 0x0300500C
.BoxDMA: .word 0x03005010
No no I want to set player name to another one without any freedom to player, so I decide the name not the player.
But thanks anyways.
By the way can you help me I'm stuck with the random trainer id and secret id generator routine it won't compile for me please help.
I was testing this routine out just now, and I'm not entirely sure if it's working correctly.
It looks to me like the Eggs are inheriting 3 stats alone, when they should always inherit 5 stats :/
I've been doing tests using this routine and XXXX.
In my last attempt for example, the results of the Egg were:
-03 HP IVs. Charmander has 30 and Ditto 26.
-03 Atk IVs inherited from Charmander.
-22 Def IVs inherited from Charmander or Ditto (both have 22 Def IVs.)
-23 Spd IVs. Charmander has 31 and Ditto 25.
-19 SpAtk IVs. Charmander has 31 and Ditto 10.
-31 SpDef IVs inherited from Ditto.
If we assume that HP is the random stat in this spread, Spd and SpAtk are the issue here.
The Egg should have inherited Charmander's or Ditto's values in those stats after all, right?
Has anyone tested this yet?
I did, I checked IV with the IV display summary screen routines. I edited the save so both parents have 31 IV in all stats, yet the child only have 3 stats with 31 IV.
Also for some reasons, sometimes if I give the destiny knot to the other parent or to both it crash when I talk to get the eggs. Did you figure it out?
No no I want to set player name to another one without any freedom to player, so I decide the name not the player.
But thanks anyways.
By the way can you help me I'm stuck with the random trainer id and secret id generator routine it won't compile for me please help.
Actually, that's much easier. This will let you load a new player name into loadpointer 0x0 and then force the change. Make sure the player's name is 7 characters or less or else it will fail.
eg. if I insert the above at 0x990000, then in XSE I could do the following to force the player's name to be Fred.
Code:
#dynamic 0x800000
#org @start
lock
faceplayer
loadpointer 0x0 @name
callasm 0x8990001
msgbox @newName 0x6
release
end
#org @name
= Fred
#org @newName
= Your new name is [player]!
Quote:
By the way can you help me I'm stuck with the random trainer id and secret id generator routine it won't compile for me please help.
I'm not sure what routine you're talking about, sorry :/
Actually, that's much easier. This will let you load a new player name into loadpointer 0x0 and then force the change. Make sure the player's name is 7 characters or less or else it will fail.
eg. if I insert the above at 0x990000, then in XSE I could do the following to force the player's name to be Fred.
Code:
#dynamic 0x800000
#org @start
lock
faceplayer
loadpointer 0x0 @name
callasm 0x8990001
msgbox @newName 0x6
release
end
#org @name
= Fred
#org @newName
= Your new name is [player]!
I'm not sure what routine you're talking about, sorry :/
Actually, that's much easier. This will let you load a new player name into loadpointer 0x0 and then force the change. Make sure the player's name is 7 characters or less or else it will fail.
eg. if I insert the above at 0x990000, then in XSE I could do the following to force the player's name to be Fred.
Code:
#dynamic 0x800000
#org @start
lock
faceplayer
loadpointer 0x0 @name
callasm 0x8990001
msgbox @newName 0x6
release
end
#org @name
= Fred
#org @newName
= Your new name is [player]!
I'm not sure what routine you're talking about, sorry :/
I tried running this script with the same offsets in FireRed but when I go to speak to the NPC i assigned the script to the game freezes. Is there something I could've missed? I compiled the ASM, assigned the correct offsets in the hex editior. Thankyou:)
Someone help like all the asm routine I compile won't work for some god damn reason someone reply if you know how to fix this and if you post a compiler which works for you it would be more helpful.
This hack converts the PC item storage menu into a side quest menu, or task list, etc.
Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.