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!
1- setvar 0x8003 0x[Map table index (to be explained in a later section)] (How I determine the index? The first one is 0x0 or 0x1?)
2- setvar 0x8000 0x[Which roaming Pokemon you want to delete (slot #)] (How I determine the slot? It's the same index of Map Table? It is the order of roamers are enabled?)
3- Routine Table/MinuteRun Table (Routine Table and MinuteRun Table are the same? What I have to place there? Pointers for all routines? Pointers to only specific routines?)
4- mov r0, #0xBF @flag to check divided by 4 (The flag "0x2FC" is needed to work?)
Yes. If you analyze the original code, you will see that it does something like this:
Code:
for bagslot in bag:
for item in bagslot:
logic
You just remove the outer loop and set bagslot to the pokeballs bag.
Quote:
Originally Posted by mbcn10ww
Somethings to be clarified.
I don't remember anymore. But these are all questions that would be answered if you tried it? For example if index one didn't work, then it probably uses index 0 instead. Also, that same routine series, I posted a video detailing how all the routines work. You'd be able to deduce this information from those videos.
Tried all possible ways, here the issues:
1- MinuteRun freezes the game after 2 wild battles;
2- I see the roamer data in memory, but it don't appear.
If you can take a look at this I'll be grateful, if not thank you too. This is a patch including all Roaming Pokémon Routines and Random Number Generator & Shiny Pokémon routines, here is the offsets:
I don't know what I'm doing wrong, but I think it should be a issue with tables.
So I don't have a patcher and won't be downloading one for this. I suggest you do one of the following:
1) Make a thread in the Q/A section detailing all of this
2) Hop on the PC discord, navigate to the #romhacking section and ask there.
I have it inserted to free space, although I'm having a difficult time figuring out how to properly set up a script that utilizes it. In this case, could someone quick write up a basic script skeleton to help me understand what I'm doing wrong. Something basic, but with all the main bits, perhaps a berry bush that gives 1-3 cheri berries every 20 in game minutes.
Has anyone made a routine for removing fainted pokemon from the party at the end of a battle? (IE Nuzlocke challenge). If so I'd love to know :)
The other question I had is if there is a routine for removing pokeballs from the bag at the end of the battle?
My plan is to make a nuzlocke challenge mod of FireRed with some fakemon in it as well. I've pretty much figured out how to hack the fakemon but any pointers in the right direction for the above two routines would help me out significantly. In the mod, I want to lock people into the new routes they visit, and give them a single pokeball, which is discarded at the end of the next battle. Effectively forcing people to use the 'catch only the first pokemon per route' rule
#org @start
lock
faceplayer
setvar 0x8004 0x4 //the species number of pokemon you want it to evolve(here's chamander)
setvar 0x8005 0x2 //the species number of pokemon after evolution(here's ivysaur)
callasm 0x8ZZZZZZ+1 //check the slot number of the pokemon
compare 0x800D 0xFF //check if the pokemon exists in the player's party
if1 1 @no_that_pokemon
callasm 0x8YYYYYY+1 //evolution
waitstate
//setweather 3 //you can define other events after waitstate
//doweather
release
end
//---------------
#org @no_that_pokemon
msgbox @message_string 6 //"You don't have that pokemon. "
release
end
//---------
// Strings
//---------
#org @message_string
= You don't have that pokemon.
Note: Only the first pokemon in your party with the species number in 0x8004 will evolve. I think that's better.
A EV-IV Display Screen
Spoiler:
Quick Preview:
Download: https://github.com/jiangzhengwenjz/EV-IV-Screen
Usage:
1. Make sure that you have Devkitarm and GNU make/cygwin installed.
2. Download this repo and create a new folder called "build".
3. Assign the free space you want to use in linker.lsc.
4. Open your cmd prompt and type in make. Then press enter.
5. Now main.bin should be generated. Paste it to the offset specified in step3.
6. Write a script to test (You should callasm to the offset of insertion + 0x79).
Code:
Example:
lock
faceplayer
callasm 0x8800079 //I inserted the code at 0x8800000
msgbox 0x8FD0013 0x2 //"It's nice, huh?"
releaseall
end
80x80 mugshots
Spoiler:
Intro:
In Ruby, many hackers uses the BG0 to make mugshots. However, the same way that simply writing tileset, tilemap and palette to the RAM won't work for FR & EM as it will be cleared by the MSGBOX.
However, there's still a way to do it, which requires the knowledge of "rboxes". I've figured out some simple usage of the related functions, so I will show you my work:
The most ****ing thing should be that only 1 BG palette for FR can be used, which is the palette for the money box (the box with thinner border). Therefore, it will only be able to launch 1 mugshot at a time and you can't use it with the money box!
How to use: The routines are provided at the bottom.
1. Change 0x8900000 in mugshot_make.asm to free space, which is ended in 0,4,8,c. It will be the location of our custom table.
2. Compile the 2 routines and insert them to some free space (Not the table location in step 1)
3. Get/draw some 80x80 mugshots, here's 2 examples:
They should be indexed to 16 colors.
4. Open your UNLZ-GBA and insert your images and palettes.
Note: the image and the palette should all be LZ77 compressed, which means that you should insert them by using "export image" and "export palette" in UNLZ-GBA. Aparrently they should all be inserted at some free space.
5. Build the table at the offset in step 1, whose format should be [image0 pointer][image0 pal pointer][image1 pointer][image1 pal pointer][image2 pointer][image2 pal pointer]...................
It can load up to 65536 images in algorithm, which means that it's enough.
6. Test time! use
setvar 0x8004 [image index in the table]
setvar 0x8005 [0 or 1] // 0 = left, 1 = right
callasm 0x8[mugshot_make.asm+1]
to launch the mugshot and
callasm 0x8[mugshot_del.asm+1] to delete it.
An example:
I insert the 2 images at 0xFA0000, 0xFA09CC and the 2 palettes at 0xFA09A4, 0xFA1484. Then the table should be:
I haven't tested much on this hack, so it may have some bugs but you can modify it on your own as I've released the source code at the bottom.
The new bytes are:
Code:
0xAA - move up backwards (very slow)
0xAB - move down backwards (very slow)
0xAC - move right backwards (very slow)
0xAD - move left backwards (very slow)
0xAE - move up backwards (slow)
0xAF - move down backwards (slow)
0xB0 - move right backwards (slow)
0xB1 - move left backwards (slow)
0xB2 - move up backwards (normal)
0xB3 - move down backwards (normal)
0xB4 - move right backwards (normal)
0xB5 - move left backwards (normal)
0xB6 - move up backwards (fast)
0xB7 - move down backwards (fast)
0xB8 - move right backwards (fast)
0xB9 - move left backwards (fast)
0xBA - jump up backwards (2 squares)
0xBB - jump down backwards (2 squares)
0xBC - jump right backwards (2 squares)
0xBD - jump left backwards (2 squares)
0xBE - jump up backwards (1 square)
0xBF - jump down backwards (1 square)
0xC0 - jump right backwards (1 square)
0xC1 - jump left backwards (1 square)
0xC2 - face down and move left-down (normal)
0xC3 - face up and move left-up (normal)
0xC4 - face left and move left-down (normal)
0xC5 - face right and move right-down (normal)
0xC6 - face down and move right-down (normal)
0xC7 - face up and move right-up (normal)
0xC8 - face left and move left-up (normal)
0xC9 - face right and move right-up (normal)
Here's a picture including all the bytes above in a script:
The diagonal ones (0xc2~0xc9) can be used in some kind of stairs, as [MENTION=26643]Invert[/MENTION] asked of me about that kind of stairs.
Some people may be interested in the source code, so I will put it here:
How to insert if you don't like the offset 0xF80000 and don't want to use the patch:
1. Repoint the table at 0x3A65BC (3 pointers totally)
2. Change the 0x8F802A8 at the first line to the insert offset of the table + 0x2a8.
3. Compile it and insert it at the insert offset of the table + 0x2a8.
4. Write a script to test.
Credits:
Back~, Invert, Knizz
Help. What does it mean in "type in make"? What exactly should I type on cmd?
*I'm talking about the 'A EV-IV Display Screen' instructions*
Either use:
cd C:/User/"computername"/Desktop/Build
Then hit enter...
Now use the "make" command and as long as you have everything else installed like DevkitArm and Cygwin then it will work like a charm.
Either use:
cd C:/User/"computername"/Desktop/Build
Then hit enter...
Now use the "make" command and as long as you have everything else installed like DevkitArm and Cygwin then it will work like a charm.
Hope this helps
Thanks for the reply. I actually tried what you said but, unfortunately I'm still getting errors :(
This is the problem that I'm getting:
Judging by this message, I think the problem was on.... ...DevKitArm?
I have those on my pc. As well as GNU Win and Cygwin. So, I dunno what's exactly the problem. ;-;
Thanks for the reply. I actually tried what you said but, unfortunately I'm still getting errors :(
This is the problem that I'm getting:
Judging by this message, I think the problem was on.... ...DevKitArm?
I have those on my pc. As well as GNU Win and Cygwin. So, I dunno what's exactly the problem. ;-;
From what it looks like you need to add C:/Devkitarm/bin to the environment variables.
In Windows 7 go to "Control Panel\All Control Panel Items\System" then click on
Advance system settings then go to "Environment Variables" and click on it.
Now go down to "System Variables" and find "Path" then in the path add ";C:/Devkitarm/bin" to the path, also if check to see if Cygwin is also in the path....
Adding that to your environment variable will make it so you can call Devkitarm from the cmd.
You should also check if Cygwin is also in the path...
Without them in the environment variable path you wont be able to call them from the cmd.
If this don't help look on youtube on adding environment variable... That's how I figured it out awhile back
If this don't help look on youtube on adding environment variable... That's how I figured it out awhile back
Hope this helps
Yassss!
I did some 'googling' (w/c I should've done from the start ) and end up on the mega evolution hack. I follow the instructions there on how to redirect(?) the environment variable and finally able to make it work. Although it's quiet troubling because I use Windows 10 and all the tuts (including YouTube) are for 7.
Hey FBI, I know that maybe I shouldn't ask this being this directly and there's Visitor Profiles or MPs, but since it could benefit everyone I'll just go ahead: Do you think we'll ever see a freely usable Wonder Trade system or it'll stay exclusive to the community's ROM Hack forever?
Hey FBI, I know that maybe I shouldn't ask this being this directly and there's Visitor Profiles or MPs, but since it could benefit everyone I'll just go ahead: Do you think we'll ever see a freely usable Wonder Trade system or it'll stay exclusive to the community's ROM Hack forever?
First of all, it's not 'real' Wonder Trade but rather Random Pokemon Generator Trade.
Secondly, the pokecommunity rom hack is open-sourced and all the code can be seen on github, including the trade system.
This is not a request thread. You can do all of those changes yourself with DizzyEgg's Emerald Engine Upgrade.
I know I can, I just don't know how, and I saw ppl making request in this thread already, I'm not demanding anything, just asking.
Maybe for you it's easy, but I don't know how to create a string for those moves on the engine. I'm in fact making a hack rom using his tool, but I don't know how to make those 2 things.
Would you mind making it or teaching me how to do it?
If you can't figure it out, the Move Resource Thread probably has an answer, as that thread is specifically focused towards the development and maintenance of moves. This thread is more for small, general ASM routines and not specifically geared towards solving move issues.
So, the mechanic for that is already implemented, we just have to repoint some tables. So let's get down to work.
First, there's a table at 0x085B2CF0. Each entry is a pointer to text to be displayed in the box. One set consist of 16 options. This is important. Anyway, repoint to free space and change pointers to this table. It ends at 0x085B3030.
Now, there's a jumptable at 0x813A156. It ends at 0x0813A19C. It has 12 entries, repoint it to free space. Now for every new set of options you want to add, you have to add a routine like this:
Spoiler:
Code:
.text
.thumb
.thumb_func
.align 2
main:
mov r0, #5
strh r0, [r3, #8] @how many are displayed
mov r0, #8
strh r0, [r3, #0xA] @how many are in total
mov r0, #1
strh r0, [r3, #0xC] @X coordinate
mov r0, #1
strh r0, [r3, #0xE] @Y coordinate
mov r0, #9
strh r0, [r3, #0x10] @unkown
mov r0, #0xA
strh r0, [r3, #0x12] @box height, should be displayed * 2
mov r0, #0
strh r0, [r3, #0x14] @unkown
strh r4, [r3, #0x26] @task id, don't change it
pop {r4}
pop {r0}
bx r0
Note that you can change parameters in those routines. Play with them and see which ones look the best for you. Now, every routine like that above, goes at the end of the repointed jumptable. There are 12-in game sets, so you'll start with 13. Change the byte at 0x813A148 to the amount of all sets.
One more thing, even though the table of pointers to text can only hold 16 pointers, it doesn't mean you're limited to only that many options. You can go to 126 max, because 127 is treated as hitting B. How? Well, in the routine above set how many in total to the amount you want and ignore occupied slots. For example if you want your set to have 50 options, divide it by 16, so you get 3 and some remainder. That means this set occupies 4 places in the jumptable, like this:
XX XX XX 08 00 00 00 00 00 00 00 00 00 00 00 00 NEW SET GOES HERE
Using it in a script is easy, just do this:
setvar 0x8004 slot in the jumptable (starts at 13, since 12 are already occupied in-game)
special 0x1BE
waitstate
Result is stored in the 0x800D. First option chosen is 0, second is 1, and so on. Hitting B be is 0x7F.
compare 0x800D 0x0
if 0x1 goto @first_option
....
compare 0x800D 0x7F
if 0x1 goto @chose_cancel
I hope everything's understandable. :)
Sorry to ask like I'm too dumb, but I would like to understand more on how things are gotten. I think replacing stuff in the ASM code needs a further explanation... especially on the bold parts I want to clarify because when I change it into something (trying out 32 choices... or maybe less), none seem to be appearing right.
Code:
.text
.thumb
.thumb_func
.align 2
main:
mov r0, #5
strh r0, [r3, #8] @how many are displayed(Inserted the vanilla code and it actually showed 8 choices)
mov r0, #8
strh r0, [r3, #0xA] @how many are in total(Are there total 10? I'm wonder how to find out this one. If it's ten, it only scrolled 8 choices.)
mov r0, #1
strh r0, [r3, #0xC] @X coordinate
mov r0, #1
strh r0, [r3, #0xE] @Y coordinate
mov r0, #9
strh r0, [r3, #0x10] @unkown
mov r0, #0xA
strh r0, [r3, #0x12] @box height, should be displayed * 2(If multiplied by 2, then it was 0x9. Where 0x9 came from?)
mov r0, #0
strh r0, [r3, #0x14] @unkown
strh r4, [r3, #0x26] @task id, don't change it
pop {r4}
pop {r0}
bx r0
Platinum-style Rotom form switching that I did ages ago that is disgustingly poorly factored but 100% accurate and functional (maybe): http://pastebin.com/JJa0B4S1
if someone wants to go ahead and. clean it up for me. that'd be dope.
Capturing a Trainer's Pokémon
With a Specific Poké Ball
Hello, when I insert the routine and follow the steps, this happens to me when I catch a pkm from a caster it becomes an egg and when I catch pkm the battle ends I hope they have the solution
Well, this is what I did, while learning how to do stuff like debugging and doing new mechanics changes in the game.
Thanks to Touched-sensei, who helped me through the entire process. Thanks to daniilS and kleenexfeu, who also helped in the very end. This is for Fire Red:
REUSABLE POKÉBALLS
- First, go to 0xA1E30. Change 01 21 to 00 21 (with this, Pokéballs won't be deleted when you select them in your bag);
- Now, find some free space and insert this routine there:
This is the code that deletes the Pokéball;
- Finally, go to 0x2D924 and paste write this "00 48 00 47 XX XX XX 08" there. It's a hook to the routine you just inserted. Change the XX XX XX for the pointer to the offset you placed the above routine. Remember to +1 the offset before changing it to a pointer.
With this hack, you won't spend Pokéballs if you don't capture a wild Pokémon. I wanted to do it inspired in the anime.
Again, simple, some people will think it's a broken functionality, but it will do well for that time when you encounter a shiny Pokémon with that one single Pokéball in your bag. =P
Thanks again, everybody. Hope it's helpful.
I wanted this feature to be ported to emerald as well..
I think it would be only a short task of finding the proper pointers,
so if anyone would do it..
then not only me but other emerald hackers would also enjoy it :)
so it my request :)