The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Code ASM Resource Thread (https://www.pokecommunity.com/showthread.php?t=339153)

Aligatueur November 13th, 2016 4:28 PM

Thank you so much for this solution too !
So I think I was far from the good answer haha, but this will help me a lot when I need to change the rate fastly, so it's awesome o/

mbcn10ww November 19th, 2016 7:00 PM

Someone can fix this routine?

Spoiler:
.text
.align 2
.thumb

main:
bl deleteball
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0

deleteball:
ldr r0, var_800E
ldrh r0, [r0]
mov r1, #1
ldr r2, =(0x809A1D9)
bx r2

.align 2
var_800E: .word 0x0203AD30


This routine deletes the last item used when catching Pokémon, it's used combined with the 0xA1E30 byte change, to prevent PokéBalls being consumed after fails catching, but when I fish into the Safari Zone and catch a Pokémon, the last item used is my rod, and it disappears. I will be grateful if someone fix this or even make flag activator/deactivator for this routine.

This routine was made by FamiliaWerneck

mbcn10ww November 19th, 2016 7:32 PM

Hello, I'm here to request somethings I think are hard to do, I've replaced the Premier Ball with Mewtwo Ball, then I want to make it catch without fail like Master Ball, and I want to make a Ball to make any Pokémon caught become Shiny. Next, an upgrade to FBI's Toggling Wild Pokémon Capturability to create a table to specify the species of Pokémon to be uncapturable permanently. Finally, an upgrade to jiangzhengwenjzw's Evolve via Callasm to select the specific Pokémon allowed to evolve on that NPC via "special 0x9F", and another detecting if the selected Pokémon is holding an specific item. (Example: The NPC allows only Kadabra to evolve into Alakazam, then the player selects one Kadabra in their party to evolve; the second will be the same, but with holding item check feature.)

robinjea November 19th, 2016 8:42 PM

Quote:

Originally Posted by mbcn10ww (Post 9492839)
Hello, I'm here to request somethings I think are hard to do, I've replaced the Premier Ball with Mewtwo Ball, then I want to make it catch without fail like Master Ball, and I want to make a Ball to make any Pokémon caught become Shiny. Next, an upgrade to FBI's Toggling Wild Pokémon Capturability to create a table to specify the species of Pokémon to be uncapturable permanently. Finally, an upgrade to jiangzhengwenjzw's Evolve via Callasm to select the specific Pokémon allowed to evolve on that NPC via "special 0x9F", and another detecting if the selected Pokémon is holding an specific item. (Example: The NPC allows only Kadabra to evolve into Alakazam, then the player selects one Kadabra in their party to evolve; the second will be the same, but with holding item check feature.)

I don't know about the Mewtwo Ball or the Make-Whatever-I-Catch-Shiny Ball but, I can give a guess for the other two.
1. For the uncapturable species, I think you can set the species' catch rate to 0.
2. Maybe there's a better way to do this but for me it can be use the check species hack somewhere here in Pokecommunity (I think it's here in the ASM Resource Thread or the Quick Research and Development Thread) and the use jiangzhengwenjzw's evolve via callasm. Or if you want to check the item, use the check species, then the check party item, and then jiangzhengwenjzw's evolve via callasm. Did that make sense? :(

mbcn10ww November 20th, 2016 2:59 AM

Quote:

Originally Posted by BlackWhiteRobin (Post 9492882)
I don't know about the Mewtwo Ball or the Make-Whatever-I-Catch-Shiny Ball but, I can give a guess for the other two.
1. For the uncapturable species, I think you can set the species' catch rate to 0.
2. Maybe there's a better way to do this but for me it can be use the check species hack somewhere here in Pokecommunity (I think it's here in the ASM Resource Thread or the Quick Research and Development Thread) and the use jiangzhengwenjzw's evolve via callasm. Or if you want to check the item, use the check species, then the check party item, and then jiangzhengwenjzw's evolve via callasm. Did that make sense? :(

1. If I make the catch rate 0 it still catchable with Master Ball.
2. I've tried to combine those routines, but I don't know if I'm doing something wrong, but it gives me a crash or simply don't works, I think I need a second one.

tkim November 20th, 2016 7:44 AM

Quote:

Originally Posted by FBI (Post 8512782)


Preventing TMs from being consumed on use



Make it Ungivable:
insert that at 0x1326B8: 00 00 17 E0

This works in not allowing the TMs to be given when using the 'give' command through the Bag, but it can still be given through the 'give' command when selecting a Pokemon in the player's party. Is there a way I can make it so that the TMs can't also be given through party?

Blah November 20th, 2016 8:23 AM

Quote:

Originally Posted by tkim (Post 9493192)
This works in not allowing the TMs to be given when using the 'give' command through the Bag, but it can still be given through the 'give' command when selecting a Pokemon in the player's party. Is there a way I can make it so that the TMs can't also be given through party?

http://i.imgur.com/ipyQM7A.png

It most certainly does.

mbcn10ww November 20th, 2016 8:27 AM

Quote:

Originally Posted by FBI (Post 9493216)
http://i.imgur.com/ipyQM7A.png

It most certainly does.

Go to your Party, select a Pokémon >> Item >> Give, then try again. You will see the issue.

Blah November 20th, 2016 8:46 AM

Quote:

Originally Posted by mbcn10ww (Post 9493220)
Go to your Party, select a Pokémon >> Item >> Give, then try again. You will see the issue.

Thank you. To fix this, write 0xE0 to 0x13288D.

mbcn10ww November 21st, 2016 2:36 PM

Quote:

Originally Posted by FBI (Post 8525480)
He says I can post it, so I will now :)


Hi, this is a matter of tracking the routine that does the saving and calling it. While I don't know where it is, perhaps you can track it down if I tell you that the routine called when you hit save in the start menu is 0x6F4E8. Happy hacking!


That's the plan, if you have any routines which you would like to see, feel free to request them here.

Swapping between two possible start menus



Basically this routine will allow the player to have two different start menus. The start menu shown is dependent on a flag being set. The second one will not have a "Save" option.

How to insert:

Compile and insert into free space the following routine:
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func
main:
        mov r0, #0x94 @flag 0x250 divided by 4 (change if you want)
        lsl r0, #0x2
        ldr r1, =(0x806E6D0 +1)
        bl linker
        cmp r0, #0x0
        bne showMine

end:
        mov r0, #0x1
        ldr r1, =(0x806ED70 +1)
        bx r1

showMine:
        mov r0, #0x82
        lsl r0, r0, #0x4
        add r0, r0, #0x9
        ldr r1, =(0x806E6D0 +1)
        bl linker
        cmp r0, #0x0
        beq noDex
        mov r0, #0x0
        ldr r1, =(0x806ED94 +1)
        bl linker

noDex:
        mov r0, #0x82
        lsl r0, r0, #0x4
        add r0, r0, #0x8
        ldr r1, =(0x806E6D0 +1)
        bl linker
        cmp r0, #0x0
        beq noMon
        mov r0, #0x1
        ldr r1, =(0x806ED94 +1)
        bl linker

noMon:
        mov r0, #0x2
        ldr r1, =(0x806ED94 +1)
        bl linker
        mov r0, #0x3
        ldr r1, =(0x806ED94 +1)
        bl linker
        mov r0, #0x5
        ldr r1, =(0x806ED94 +1)
        bl linker
        mov r0, #0x6
        ldr r1, =(0x806ED94 +1)
        bl linker
        pop {r0}
        bx r0

linker2:
        bx r0

linker:
        bx r1

.align 2




Navigate to 0x6ED5C and insert the following byte changes:
Code:

00 48 00 47 XX XX XX 08


Where XX XX XX is the pointer (plus 1) in reverse hex to where you inserted the routine.
Navigate to 0x6EE42 and change 08 to 00.

Usage:
setflag 0x250 = show menu without save
clearflag 0x250 = show menu with save

That's it. It's toggled internally depending on the flag's state.

It's really good, but players will remain able to use savestates/snapshots. :/

Blah November 21st, 2016 3:14 PM

Quote:

Originally Posted by mbcn10ww (Post 9494613)
It's really good, but players will remain able to use savestates/snapshots. :/

Can't really hack the emulator too. This was originally for Pokemon LIFE, so yeah, it wouldn't fit most people's needs.

mbcn10ww November 21st, 2016 3:45 PM

Quote:

Originally Posted by FBI (Post 9494641)
Can't really hack the emulator too. This was originally for Pokemon LIFE, so yeah, it wouldn't fit most people's needs.

I understand, but it remains useful.
I will try to make my game an executable. xD

mbcn10ww November 23rd, 2016 6:43 AM

Quote:

Originally Posted by Spherical Ice (Post 9164857)
http://pastebin.com/bHmFB5SX This routine lets you disable the bag when a flag is set. I didn't write it, though, I think it was daniilS. You just assemble it and insert it at x143D4.

Inside the routine it says "/*place flag number at 08014410*/", it's only to put the half word of my desired flag?

BluRose November 23rd, 2016 7:10 AM

Quote:

Originally Posted by mbcn10ww (Post 9496191)
Inside the routine it says "/*place flag number at 08014410*/", it's only to put the half word of my desired flag?

betting it's actually like the full word (idb lists it as a long ahaha)
so like flag 120 would be input as 20 01 00 00

mbcn10ww November 23rd, 2016 7:24 AM

Quote:

Originally Posted by BluRose (Post 9496217)
betting it's actually like the full word (idb lists it as a long ahaha)
so like flag 120 would be input as 20 01 00 00

Doesn't work.

BluRose November 23rd, 2016 7:31 AM

Quote:

Originally Posted by mbcn10ww (Post 9496236)
Doesn't work.

then try as many different renditions of it as possible or something. for flag 200...
00 02 00 00
00 02 - betting half word this time if full word didn't work
02 00
00 00 02 00
just try all of them in succession lol, it really shouldn't be that hard to just brute-force this until it works

mbcn10ww November 23rd, 2016 7:35 AM

Quote:

Originally Posted by BluRose (Post 9496243)
then try as many different renditions of it as possible or something. for flag 200...
00 02 00 00
00 02 - betting half word this time if full word didn't work
02 00
00 00 02 00
just try all of them in succession lol, it really shouldn't be that hard to just brute-force this until it works

Worked with half word. Thanks. xD

3mpty November 24th, 2016 5:28 AM

I'm completely hopeless with assembly so if anyone could lend me a hand I'd be super greatful.

The main feature I'm looking for is turning trainer battles into flat battles, IE levelling up has no effect on stats. (EVs and IVs are fine though)

1) Make the players party level 100 the whole game, doesn't require ASM but it also means there's no progression, I'd still like levelling for purposes of evolution and new move acquisition.

2) Force the teams level to be a certain level (lets say 50) then reset it after the battle. This seems like a decent strategy but I feel like the player will lose the XP gained from beating trainer pokemon, or at the very least it will fuck with the levelling process to some degree. I've done some research on this and gone through some ancient posts but I haven't been able to cobble something together yet.

3) Disable stat scaling with level, pokemon are always treated as though they're level 50 for stat purposes. This seems best since I won't be screwing with any variables at all, just the calculations, which seems great but it also has the problem of I have literally no idea where to even start on messing with this stuff.

I'd really appreciate any input. This one has me stumped and it's pretty critical to what I'm working on.

EDIT: Oh yeah and I'm on Emerald.
Hope that's not a dealbreaker but I really don't want to jump to firered since I'm planning to keep the region.

3mpty November 24th, 2016 10:51 PM

Update: I managed to get FBI's script for forcing a party to a certain level working on Emerald:
Spoiler:
.text
.align 2
.thumb
.thumb_func

main:
push {r0-r7, lr}
mov r7, #0x0

loop:
ldr r6, =(0x020244E9)
ldrb r6, [r6]
cmp r7, r6
beq end
ldr r0, =(0x020244EC)
mov r1, #0x64
mul r1, r1, r7
push {r7}
add r0, r0, [email protected]
mov r4, r0

set_level:
mov r1, #0xB
push {r4}
ldr r3, = (0x0806A518 +1) @get species
bl linker
pop {r4}
mov r2, r0
ldr r6, =(0x0831F72C)
ldr r1, =(0x083203CC)
lsl r0, r2, #0x3
sub r0, r0, r2
lsl r0, r0, #0x2
add r1, r1, r0
ldrb r0, [r1, #0x13]
mov r5, #0xCA
lsl r5, r5, #0x1
mul r0, r0, r5
add r0, r0, r6
ldr r1, .VAR
ldrb r1, [r1]
mov r3, #0x4
mul r1, r1, r3
add r1, r1, r0
ldr r1, [r1]
ldr r2, = (0x020375F0)
str r1, [r2]
mov r0, r4
push {r4}
mov r1, #0x19
ldr r3, =(0x0806ACAC +1)
bl linker
pop {r4}
mov r0, r4
ldr r3, =(0x08068D0C +1)
bl linker

next:
pop {r7}
add r7, r7, #0x1
b loop

end:
pop {r0-r7, pc}

linker:
bx r3


.align 2

.VAR:
.word 0x020275D8 + (0x8000 *2)


Here it is for anyone who needs it, but it's not really what I needed. As I suspected playing with level of the team messes up levelling beyond repair, so this approach isn't viable.

I'm not happy with this solution since it's basically my first solution with the downside of requiring asmcalls for every single trainer battle. Not ideal!

So that leaves me with option 3, disable level scaling. I think the solution I need is to edit the function that calculates pokemon stats, when they level up or are boxed etc. and simply change the part where it inserts the current level of the pokemon, simply force it to be 50.

In theory that's a really simple change, but it's beyond me currently, I'm looking into some breakpoint stuff and hooking into scripts? But I'm still very new to this so if someone can help me out, or at least point me down the path I'd be greatful.

At the very least I know where the stat calculation occurs in emerald, it starts around 0x08068D0C as far as I can tell.

EDIT: For the record if someone is interested in building this for FR I can figure out the port to EM myself (probably).

3mpty November 26th, 2016 3:04 AM

Update3: Well I did it!
I have disabled all level based stat scaling from my emerald cart, now only EVs and IVs affect your pokemon's stats. Super friggin cool!

To do so is relatively simple, we're just hijacking the point in the code where it pulls the pokemons level, then replacing it with the number 50 (or whatever you want, really) the code is riduclously simple:
Non HP stats (compiles to: 32 21)
Spoiler:
MOVS R1, #0x32

HP (compiles to: 32 24)
Spoiler:
MOVS R4, #0x32

Battle Calculations
Spoiler:
NOP
MOVS R0, #0x32


These are just overwriting the position where level is loaded with the number 50.
#0x32 is the level you want to simulate, I chose 50, but you could force it to be level 1, or 100, or whatever. Doesn't make a huge difference.

Once you've compiled those you're overwriting the following positions on your emerald rom
I set all the registers to 32, which is 50, if you want a different level just work out the hex value and calculate it. (100 for example is 64)
Spoiler:
0x068E16 change to: 32 24 - HEALTH
0x068e62 change to: 32 21 - ATTACK
0x068ea8 change to: 32 21 - DEFENCE
0x068eee change to: 32 21 - SPE ATT
0x068f34 change to: 32 21 - SPE DEF
0x068f7a change to: 32 21 - SPEED

positions to hack for damage calc

0x069AC6 change to: C0 46 32 20 (ATT calc)
0x069C22 change to: C0 46 32 20 (SPA calc)


I haven't checked these, so it might not actually be in that order, but I'm fairly certain it is (HP is definitely first though)

http://i.imgur.com/NMort0Y.png
In action, note mudkip is level 30.
He has shitty IVs though so the stats are a little off, but you can see they're close enough (tm)

EDIT: further testing has unveiled that something slipped through my net, the pesky damage formula.
Apparently it uses the users level as well (why? i don't know lol) so if you apply these tweaks it will result in your mons becoming stupidly bulky.
I'm working on a fix but I wouldn't use this until I do. It's now fixed!

EDIT2: I've located the appropriate locations and fixed them, but damage seems to be 20% higher than normal, I'm going to test more.

EDIT3: I've fixed it, the unusual damage numbers was me being shit and redirecting one position too early (we were using some unknown number for level scaling, I don't know what)

I've updated the instructions. This should work. Happy flat battles.

mbcn10ww November 29th, 2016 9:15 AM

Quote:

Originally Posted by FBI (Post 8532389)
Thanks for the requests, it keeps me having something to do. Though a few things I would like to mention. First of all the thread got a little rework, so I'm no longer really allowed to restrict the kinds of requests people ask in here anymore. However, I'm still not doing any battle script related, graphics related or non FireRed hacks because that's just my policy. You're welcome to ask anyways, maybe someone else will do them for you. :)


I believe abilities as BS related. What you would need for something like this, is probably a bitmap showing which species of Pokemon "passively" have levitate. Though, sadly, because it is battle script related, I'm not going to be fulfilling this. Hopefully someone else jumps on and lends you a hand :)


Hi, I'll look into this. If I end up needing to adjust the PID, it may end up a little much :x



Overworld abilities can be added by scripting. Try decompiling the script on a cut tree and you'll see what I mean :)


Here:
Spoiler:

To insert:
insert the following bytes at the following offsets:
0x2D496: E0 E0
0x40B36: 00 00 00 00 00



That sounds like a cool addition, though I don't know how to make the number appear onto the HP bar. Maybe someone with graphical knowledge will jump in and help you on this one.


Thanks.

The thing of bad egg have some problems:
1- The Old Man catching tutorial becomes bugged https://www.pokecommunity.com/showthread.php?t=384261;
2- Any type of Poké Ball becomes a 100% catch ball.

There is a way to fix it?

CrauS November 29th, 2016 7:54 PM

Hi, i just want to know, is there a ASM routine/Script that makes the Everstone work in Fire Red Breeding?

Blah November 29th, 2016 8:00 PM

Quote:

Originally Posted by mbcn10ww (Post 9502016)
The thing of bad egg have some problems:
1- The Old Man catching tutorial becomes bugged https://www.pokecommunity.com/showthread.php?t=384261;
2- Any type of Poké Ball becomes a 100% catch ball.

There is a way to fix it?

Doesn't look like those hex edits have anything to do with Catchrate of the Pokeball. First one removes a trainer's ability to block a ball, and the second one prevent the trainer ID from being written to a Pokemon, thus solving the bad egg issue.

How did you deduce these changes caused this bug?

mbcn10ww November 30th, 2016 4:37 AM

Quote:

Originally Posted by FBI (Post 9502556)
Doesn't look like those hex edits have anything to do with Catchrate of the Pokeball. First one removes a trainer's ability to block a ball, and the second one prevent the trainer ID from being written to a Pokemon, thus solving the bad egg issue.

How did you deduce these changes caused this bug?

Because I've reverted these offsets to original, and works correctly, then when I try to use again it causes that bugs. I will try only using the second of ID, I think it will solve that.

EDIT: I was right, I only need the second line.

DarkPsychic December 3rd, 2016 11:58 AM

Not sure if this will help anyone but I made a routine that takes the Players 8byte(8thbyte being FF padding) Name and store it on vars 0x8000-0x8003.
Code:

.text
.align 2
.thumb
.thumb_func
.global

main:
    push {r0-r3, lr}
    ldr r0, .PLAYER_DATA
    ldr r0, [r0]        //load the pointer stored at r0 into r0
    ldr r1, .VAR        //var 0x8000
    ldm r0!, {r2-r3}    //load 2 words from given pointer at r0 into r2-r3 = 8bytes
    stm r1!, {r2-r3}    //store 2 words from r2-r3 onto vars 0x8000-0x8003
    pop {r0-r3, pc}

.align 2

.PLAYER_DATA:
.word 0x0300500C

.VAR:
.word 0x020370B8


I made this so I could try making MissinNo's form changes but realize that it might take some more ASM to base its three other forms off the 3rd, 5th and 7th characters within the Players Name.

So I hope others can find a use for it.


All times are GMT -8. The time now is 8:46 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 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 - 2016 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.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.