The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Other questions on asm for emerald (https://www.pokecommunity.com/showthread.php?t=354763)

pokefreak890 August 28th, 2015 2:13 PM

questions on asm for emerald
 
so i was reading and i want to add the abilty no guard to my emerald rom but i am confused with two things

okay so here is the no guard code (i hope youre okay with me copying and pasting your code into this thread MR.DOLLSTEAK)

.text
.align 2
.thumb
.thumb_func
.global noguard

AbilityBufferUser:
push {r0}
ldr r0, .Bank
ldr r0, [r0]
mov r1, #0x58
ldr r2, .BattleData
mul r0, r1
add r0, r0, r2
ldrb r0, [r0]
NoGuardCheckUser:
cmp r0, #0x7E
beq AutoHit
AbilityBufferTarget:
ldr r0, .Bank
add r0, #0x1
ldrb r0, [r0]
mul r0, r1
add r0, r0, r2
ldrb r0, [r0]
NoGuardCheckTarget:
cmp r0, #0x7E
beq AutoHit
ToxicCheck:
ldr r0, .MoveLoc
ldrh r0, [r0]
cmp r0, #0x5C
bne InvulnerableCheck
PoisonCheck:
ldr r0, .Bank
ldr r0, [r0]
mov r1, #0x58
ldr r2, .BattleData
mul r0, r1
add r2, r0, r2
ldrb r0, [r0, #0x1]
ldrb r1, [r0, #0x1]
cmp r0, #0x3
beq AutoHit
cmp r1, #0x3
beq AutoHit
InvulnerableCheck:
pop {r0}
bl Method
lsl r0, r0, #0x18
cmp r0, #0x0
bne Miss
Return:
ldr r1, .Return
bx r1
AutoHit:
pop {r0}
ldr r1, .Return2
bx r1
Miss:
ldr r1, .Return3
bx r1
Method:
ldr r1, .MethodLoc
bx r1


.align 2

.Bank: .word 0x0202420B
.BattleData: .word 0x020240A4
.MoveLoc: .word 0x020241EA
.Return: .word 0x08046761
.Return2: .word 0x080469CB
.Return3: .word 0x080469D3
.MethodLoc: .word 0x080464AD

#insert 00 49 08 47 xx xx xx 08 00 00 at 046754

okay so the first thing is what do i do with the "xx" because i cant type x into hex editor
and second thing is where and how do i add callasm routineaddress+1 i understand that i have an offset +1 like 800001 but i dont know where to put it if anyone could help i would appreciate that and also sorry the thread is long

chrunch August 28th, 2015 7:23 PM

xx is a pointer to wherever you've inserted your routine. So say if you've inserted the routine at 800000, what you need to do is split it up into 3 parts:
80 00 00
Then swap the first and last parts:
00 00 80
And you have your pointer! Usually you'd put an 08 after it too but that's already been done here.

pokefreak890 August 28th, 2015 8:03 PM

Okay but my next question is how to make it so you can find the new ability in G3HS

pokefreak890 August 29th, 2015 5:48 AM

also where do i add "callasm routineaddress+1" do i add it in xse or do i add it in the code itself

kleenexfeu August 29th, 2015 6:52 AM

Quote:

Originally Posted by pokefreak890 (Post 8908871)
also where do i add "callasm routineaddress+1" do i add it in xse or do i add it in the code itself

In the ability resource thread, there's a tutorial to expand the ability name/description.

So the thirst thing you have to do is expand the said table.

Next, choose the number of your ability no guard, say you want to add it just after Air Lock. Air lock is the 0x4D ability, so no guard will be the 0x4E.

In the routine there's two lines like that : cmp r0, #0x7E

MrDS didn't precised, but 0x7E is actually the index number of No guard he choose, so you have to replace these number with whatever you choose.

Lastly : "00 49 08 47 xx xx xx 08 00 00" is actually the "callthis routine" while xx(+1) xx xx is the reverse location where you put your assembled routine. So you have to place this "call" at 0x46754


Clear ?

pokefreak890 August 29th, 2015 10:54 AM

Legend:
Green bolded text are for Emerald.
Red bolded text are for FireRed.

Step 1: Ability Names
Go to a new free space names (example: 0x720000). Select 3328 (0xD00 in HEX) bytes. Fill the bytes with AE AE AE AE AE AE AE FF 00 00 00 00 00.
Go to 31B6DB or 24FC40. Select and copy 1014 (0x3F6 in HEX) bytes.
Go to the offset of your names data (which the example is 0x720000) and paste the data there.
Replace all DB B6 31 08 or 40 FC 24 08 with the "reversed hex in little indian of your new names data offset with 08 at the end" (example: 00 00 72 08)

Step 2: Ability Descriptions
Go to a new free space descriptions (example: 0x720D00). Select 1024 (0x400 in HEX) bytes. Fill the bytes with 98 AF 31 08 or C4 F3 24 08.
Go to 31BAD4 or 24FB08. Select and copy 312 (0x138 in HEX) bytes.
Go to the offset of your description table (which the example is 0x720D00) and paste the data there.
Replace all D4 BA 31 08 or 08 FB 24 08 with the "reversed hex in little indian of your new description data offset with 08 at the end" (example: 00 0D 72 08)

Then, change your .ini-s. Replace the old offsets in the .ini with your new data (they should be at where the Ability Names and Ability Descriptions are). Luckily, these don't have limiter stuff at all.

With the expanded data, the new data should be working. I have made this tutorial to have maximized the slots to 256 abilities (255 usable abilities plus one for the none "-----" slot). Now you have 178 new slots for Generation IV+ abilities. Noted that the game can only support up to 256 abilities. The rest of the tutorial on how to insert ability routines are on the first post of this thread since inserting ability routines are now complicated. I hope this post is to be linked up in the Extra Information of this thread so everyone can expand stuff too.

so im clear on steps 1 and 2 and 3 for the first part but i dont know the abilty names table offset and can someone plz help me with step 4 Replace all DB B6 31 08 or 40 FC 24 08 with the "reversed hex in little indian of your new names data offset with 08 at the end" (example: 00 00 72 08) i know what to do but i cant find DB B6 31 08

and for part 2 i understand steps 1 and 2 but im having the same problem for steps 3 and 4 if someone can help me with this that would be great

i dont know the abilty names table offset and i also dont know the description table so if anyone can give it to me as well that would be great

and also sorry for the long post

pokefreak890 August 29th, 2015 5:48 PM

sorry to message again but for the tutorial on how to expand the abilty name table can some one give me a tutorial with pictures telling me how to do it because im confused from step one to the end that would be greatly appreciated

chrunch August 29th, 2015 6:15 PM

Quote:

Originally Posted by pokefreak890 (Post 8909143)
so im clear on steps 1 and 2 and 3 for the first part but i dont know the abilty names table offset and can someone plz help me with step 4 Replace all DB B6 31 08 or 40 FC 24 08 with the "reversed hex in little indian of your new names data offset with 08 at the end" (example: 00 00 72 08) i know what to do but i cant find DB B6 31 08

1) Your new table can be wherever you want, as long as there's free space for it.
2) Use your hex editor to search for all instances of DB B6 31 08 and replace them with pointers to your own table (I showed you how to do this in my post above)

pokefreak890 August 29th, 2015 6:38 PM

the first part for the AE AE AE AE AE AE AE FF 00 00 00 00 00 do i just type this line of code into the first line of FF or do i fill it because when i try to fill it i can only fill it with two bytes

chrunch August 29th, 2015 9:35 PM

Quote:

Originally Posted by pokefreak890 (Post 8909592)
the first part for the AE AE AE AE AE AE AE FF 00 00 00 00 00 do i just type this line of code into the first line of FF or do i fill it because when i try to fill it i can only fill it with two bytes

I think you have to fill it. If you're using HxD you should be able to highlight the bytes then go to Edit > Fill Selection to do it.

pokefreak890 August 30th, 2015 6:31 AM

i understand how to fill the table but i dont know what the offsets for the abilty name table or the description table is and when i tried to replace with the reverse hex of my offset it said coudnt find

Xencleamas September 4th, 2015 8:04 AM

Quote:

Originally Posted by pokefreak890 (Post 8910127)
i understand how to fill the table but i dont know what the offsets for the abilty name table or the description table is and when i tried to replace with the reverse hex of my offset it said coudnt find

Make sure if you are using FireRed or Emerald. The labels/legends are actually clear.
Tutorial: http://www.pokecommunity.com/showpost.php?p=8711466&postcount=27

pokefreak890 September 4th, 2015 9:38 AM

So I'm stuck at steps 3 and 4 for both parts of the abilty names and description tables does that mean I use my new offset I got from free space finder or the one that is used currently for emerald and when I try to do the replacing at the last step it says can't find


All times are GMT -8. The time now is 2:30 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.