The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking > Binary Hack Research & Development
Reload this Page Code ASM Resource Thread

Notices
For all updates, view the main page.

Binary Hack Research & Development Got 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!

Ad Content
Reply
 
Thread Tools
  #626   Link to this post, but load the entire thread.  
Old July 14th, 2015 (7:32 PM).
DJTiki's Avatar
DJTiki DJTiki is offline
absolutely should have never given me the internet
 
Join Date: Mar 2014
Location: Florida, USA
Gender: Male
Nature: Adamant
Posts: 1,256
Quote:
Originally Posted by FBI agent View Post

Bag Deletion and Restoration



Bag Delete:



Here's a compiled version:
Code:
FF B5 00 24 05 2C 1F D8 12 48 21 1C C9 00 40 18 05 1D 2D 78 03 68 00 26 AE 42 12 D2 1A 88 00 2A 0C D0 98 1C 7C B4 0C 4B 00 F0 0D F8 7C BC 01 1C 10 1C 7C B4 09 4B 00 F0 06 F8 7C BC 04 33 01 36 EA E7 01 34 DE E7 18 47 FF BD C0 46 8C 98 03 02 80 C2 03 02 8C 98 03 02 A1 9D 09 08 D9 A1 09 08
That's funny because when I complied this twice to make sure I wasn't doing it wrong and I recieved this as the compiled version:

Code:
7F B5 00 24 05 2C 1F D8 12 48 21 1C C9 00 40 18 05 1D 2D 78 03 68 00 26 AE 42 12 D2 1A 88 00 2A 0C D0 98 1C 7C B4 0C 4B 00 F0 0D F8 7C BC 01 1C 10 1C 7C B4 09 4B 00 F0 06 F8 7C BC 04 33 01 36 EA E7 01 34 DE E7 18 47 FF BD C0 46 8C 98 03 02 80 C2 03 02 8C 98 03 02 A1 9D 09 08 D9 A1 09 08
It's only one bit difference, but if I am correct, then you should probably edit your post to fix this typo since most people who don't know how to compile will use your code with the typo. But I'm most likely wrong. :)

Thanks for the code!
Reply With Quote
  #627   Link to this post, but load the entire thread.  
Old July 14th, 2015 (8:09 PM).
Exodrake's Avatar
Exodrake Exodrake is offline
The Manliest Chick that Ever Manlied
 
Join Date: May 2013
Age: 29
Gender: Female
Nature: Quirky
Posts: 163
I would like to request a modified Flash Fire which can be activated by another type as well as Fire. I didn't know where else to put this request since the Ability Resource Thread is for porting official ability effects and vanilla Flash Fire doesn't do this. The reason being my hack has an Oil type (0x18) which I'd like to activate Flash Fire, since we know what happens when you squirt oils onto a fire, but alas my brain refuses to comprehend ASM. It's worth noting that by default Fire is immune to Oil, so the ability would have to override that.
__________________

I'M A WITCH THAT'S HOW
Reply With Quote
  #628   Link to this post, but load the entire thread.  
Old July 14th, 2015 (8:20 PM).
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Quote:
Originally Posted by Exodrake View Post
I would like to request a modified Flash Fire which can be activated by another type as well as Fire. I didn't know where else to put this request since the Ability Resource Thread is for porting official ability effects and vanilla Flash Fire doesn't do this. The reason being my hack has an Oil type (0x18) which I'd like to activate Flash Fire, since we know what happens when you squirt oils onto a fire, but alas my brain refuses to comprehend ASM. It's worth noting that by default Fire is immune to Oil, so the ability would have to override that.
If you look at the Ability Resource Thread, my most recent post deals with the Type Absorb abilities. Once I've posted the Fire Red ones you could either write a new routine that activates on both Fire and Oil and replace the pointer in the table.

Alternatively you can navigate to the offsets of the routine and add a branch at the beginning of the routine and check for Oil there. You are right though, the immunity may prevent it from happening.
__________________
Reply With Quote
  #629   Link to this post, but load the entire thread.  
Old July 14th, 2015 (8:34 PM).
Exodrake's Avatar
Exodrake Exodrake is offline
The Manliest Chick that Ever Manlied
 
Join Date: May 2013
Age: 29
Gender: Female
Nature: Quirky
Posts: 163
Quote:
Originally Posted by MrDollSteak View Post
If you look at the Ability Resource Thread, my most recent post deals with the Type Absorb abilities. Once I've posted the Fire Red ones you could either write a new routine that activates on both Fire and Oil and replace the pointer in the table.

Alternatively you can navigate to the offsets of the routine and add a branch at the beginning of the routine and check for Oil there. You are right though, the immunity may prevent it from happening.
Flash Fire behaves differently than the other absorb abilities in that it strengthens moves of a specific type rather than just boosting an offensive stat. I have next to no ASM capabilities to begin with and I don't think I'd have any idea how to do that. I figured it could be grouped with the other absorb abilities though.
__________________

I'M A WITCH THAT'S HOW
Reply With Quote
  #630   Link to this post, but load the entire thread.  
Old July 15th, 2015 (4:58 AM).
AkimotoBubble's Avatar
AkimotoBubble AkimotoBubble is offline
 
Join Date: Aug 2014
Gender: Male
Posts: 48
oh i need you are help.i am do the"Preventing TMs from being consumed on use "for EM rom.And i have a trouble.
I change 1B6EE0 to 90 make we "can use TM but can not to reduce number"
but I can not remove the quantities showing up in thebag so I need help.Thanks
Reply With Quote
  #631   Link to this post, but load the entire thread.  
Old July 16th, 2015 (6:00 AM).
FamiliaWerneck's Avatar
FamiliaWerneck FamiliaWerneck is offline
 
Join Date: May 2015
Location: São Paulo, Brasil
Gender: Male
Posts: 275
Quote:
Originally Posted by AkimotoBubble View Post
oh i need you are help.i am do the"Preventing TMs from being consumed on use "for EM rom.And i have a trouble.
I change 1B6EE0 to 90 make we "can use TM but can not to reduce number"
but I can not remove the quantities showing up in thebag so I need help.Thanks
- Open the ROM com o with HxD. Go to 0x124F78 and insert 00 00 00 00. Go to 0x125C80 and insert 00 00 00 00. This makes TMs not be consumed.
- Go to 0x1326B8 and insert 00 00 17 E0. This makes TMs ungivable.
- Go to some free space (I used 0x1BA540), select 36 FF e change them for (simply Ctrl + B in the first):
00 2D 01 D1 05 4B 18 47 38 1C 08 21 22 1C 04 4E 00 F0 02 F8 01 4B 18 47 30 47 C0 46 FF 1E 13 08 B1 35 13 08
- Go to 0x131EF4 and insert: 00 48 00 47 41 A5 1B 08
- Insert E0 at 0x131EA5.
__________________
My Main Team:


Reply With Quote
  #632   Link to this post, but load the entire thread.  
Old July 16th, 2015 (3:36 PM).
AkimotoBubble's Avatar
AkimotoBubble AkimotoBubble is offline
 
Join Date: Aug 2014
Gender: Male
Posts: 48
Quote:
Originally Posted by FamiliaWerneck View Post
- Open the ROM com o with HxD. Go to 0x124F78 and insert 00 00 00 00. Go to 0x125C80 and insert 00 00 00 00. This makes TMs not be consumed.
- Go to 0x1326B8 and insert 00 00 17 E0. This makes TMs ungivable.
- Go to some free space (I used 0x1BA540), select 36 FF e change them for (simply Ctrl + B in the first):
00 2D 01 D1 05 4B 18 47 38 1C 08 21 22 1C 04 4E 00 F0 02 F8 01 4B 18 47 30 47 C0 46 FF 1E 13 08 B1 35 13 08
- Go to 0x131EF4 and insert: 00 48 00 47 41 A5 1B 08
- Insert E0 at 0x131EA5.
It is from FR not EM :(
Reply With Quote
  #633   Link to this post, but load the entire thread.  
Old July 16th, 2015 (7:33 PM).
FamiliaWerneck's Avatar
FamiliaWerneck FamiliaWerneck is offline
 
Join Date: May 2015
Location: São Paulo, Brasil
Gender: Male
Posts: 275
Quote:
Originally Posted by AkimotoBubble View Post
It is from FR not EM :(
Didn't see the EM thing there, sorry.
__________________
My Main Team:


Reply With Quote
  #634   Link to this post, but load the entire thread.  
Old July 17th, 2015 (12:54 AM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Quote:
Originally Posted by KDS View Post
Life Orb Recoil
...
@Set YY+1 YY YY 08 as the 'End' Battle Script Command.
...
I don't get that part, could you explain what and how exactly I should go about it?
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
Reply With Quote
  #635   Link to this post, but load the entire thread.  
Old July 17th, 2015 (1:02 AM).
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by DizzyEgg View Post
I don't get that part, could you explain what and how exactly I should go about it?
There is a Battle Script command table at x25011c in FR. If you have repointed this to include Jambo's callasm and/or setword commands then you have to check it yourself.

It is a table of pointers. Goto entry no. x3D (table starts from x0) and overwrite the pointer there with pointer to routine at YYYYYY.
Reply With Quote
  #636   Link to this post, but load the entire thread.  
Old July 27th, 2015 (5:24 PM).
Spherical Ice's Avatar
Spherical Ice Spherical Ice is offline
 
Join Date: Nov 2007
Location: Leicester, UK
Age: 25
Posts: 5,251
Transferred ownership of this thread to Lost Heart, so hopefully it can be updated more regularly now!
__________________
Reply With Quote
  #637   Link to this post, but load the entire thread.  
Old July 27th, 2015 (8:16 PM). Edited July 27th, 2015 by esperance.
esperance's Avatar
esperance esperance is offline
 
Join Date: Mar 2010
Location: OH
Age: 26
Gender: Male
Nature: Relaxed
Posts: 3,830
Whew~! I've gone through the entire thread and compiled a list of every routine. Expect an updated first post soon! :)

EDIT: It is done.
__________________
What are you so afraid of?
Reply With Quote
  #638   Link to this post, but load the entire thread.  
Old July 28th, 2015 (2:13 AM). Edited July 28th, 2015 by DizzyEgg.
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Quote:
Originally Posted by KDS View Post
Life Orb Recoil

Spoiler:

This only includes the Life Orb Recoil not the Life Orb Boost.
Credits to MrDollsteak for the Sheer Force Routine which I ripped from his Rombase.
Life Orb recoil is disabled for Volt Switch and U-turn in order to prevent damage to switched ally. (Special callasm in Battle Scripts of these Moves should be made in order to process Life Orb Recoil for them. Preferably before switching happens).
If you don't have Sheer Force, Magic Guard, U-turn or Volt Switch remove the bolded lines.
Replace KK with Held Effect Item Byte of Life Orb.

Bug/Oddity: It can trigger multiple times for multi-hit moves like Life Orb and multiple target moves like Earthquake in doubles. Fixed

Fire Red:-

Spoiler:


Routine at XXXXXX:
Code:
.text
.align 2
.thumb
.thumb_func
.global lifeorbrecoil

SheerForceCheck:
      ldr r1, .UserBank
      ldr r2, .BattleStruct
      ldrb r1, [r1, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x7E /*Sheer Force*/
      bne EffectCheck 
      ldr r0, .CurrMove
      ldrh r3, [r0, #0x0]
      mov r0, #0x0
      ldr r1, .FEHalfWord
      ldr r2, .SheerForceTable

Loop:
      lsl r4, r0, #0x01
      add r4, r4, r2
      ldrh r4, [r4, #0x0]
      cmp r3, r4
      beq Exit
      cmp r4, r1
      beq EffectCheck
      add r0, #0x1
      b Loop

EffectCheck:
      mov r1, r8
      cmp r1, #0x3E
      beq ShellBell
      cmp r1, #0xKK
      bne Exit
    
CheckOutcome:
      ldr r0, .Outcome
      ldrb r0, [r0, #0x0]
      mov r5, #0x29
      and r5, r0
      cmp r5, #0x0
      bne Exit

CheckUturnVoltSwitch:
      ldr r0, .CurrMove
      ldrh r0, [r0]
      ldrh r1, .VoltSwitchID
      cmp r0, r1
      beq Exit
      ldrh r1, .UTurnID
      cmp r0, r1
      beq Exit 

CheckIfMoveDamagedSomeTarget:
      ldr r1, .DamageStruct
      ldr r4, .TargetBank
      ldrb r2, [r4, #0x0]
      lsl r0, r2, #0x02
      add r0, r0, r2
      lsl r0, r0, #0x02
      add r6, r1, #0x4
      add r0, r0, r6
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit
      ldr r0, .FFHalfWord
      cmp r1, r0
      beq Exit
      
CheckIfUserIsNotTheTarget:
      ldr r0, .UserBank
      ldrb r3, [r0, #0x0]
      cmp r3, r2
      beq Exit

CheckMagicGuard:
      ldr r2, .BattleStruct
      ldrb r1, [r0, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x63 /*Magic Guard*/
      beq Exit

HPCheck:
      ldrh r1, [r0, #0x28]
      cmp r1, #0x0
      beq Exit

SetLifeOrbRecoilBit:
      ldr r1, .LORBit
      mov r0, #0x1
      strb r0, [r1]

Exit:
      ldr r1, .Return2
      bx r1

ShellBell:
      ldr r1, .Return1
      bx r1

.align 2
.UserBank: .word 0x02023D6B
.TargetBank: .word 0x02023D6C
.BattleStruct: .word 0x02023BE4
.DamageStruct: .word 0x02023ECC
.CurrMove: .word 0x02023D4A
.SheerForceTable: .word 0x08XXXXXX
.Outcome: .word 0x02023DCC
.FEHalfWord: .word 0x0000FEFE
.FFHalfWord: .word 0x0000FFFF
.Return1: .word 0x0801CF11
.Return2: .word 0x0801CFA7
.LORBit: .word 0x0203C038
.UTurnID: .word 0x000001YY
.VoltSwitchID: .word 0x000001ZZ

/*At 1CE58: 00 48 00 47 XX+1 XX XX 08*/
Routine at YYYYYY:
Code:
.text
.align 2
.thumb
.thumb_func
.global endcommandwithlifeorbsupport

Main:   
      ldr r1, .LORBit
      ldrb r0, [r1]
      cmp r0, #0x1
      bne EndCommand

LifeOrb:
      push {lr}
      push {r2-r7}
      mov r0, #0x0
      strb r0, [r1]
      ldr r0, .UserBank
      ldrb r3, [r0]      
      mov r0, #0x58
      mul r0, r3
      ldr r2, .BattleStruct
      add r2, r2, r0
      ldrh r0, [r2, #0x28]
      cmp r0, #0x0
      beq Exit
      ldr r0, =0x02023D6F
      strb r3, [r0, #0x0]
      ldr r0, =0x02023DC4
      strb r3, [r0, #0x17]
      ldr r4, =0x02023D50
      ldrh r0, [r2, #0x2C]
      mov r1, #0xA
      bl Divider
      strh r0, [r4, #0x0]
      cmp r0, #0x0
      bne NotZero
      mov r0, #0x1

NotZero:
      strh r0, [r4, #0x0]
      bl ScriptPusher
      ldr r1, .ScriptPointer
      ldr r0, .LifeOrbDamageScript
      str r0, [r1, #0x0]
      pop {r2-r7}
      pop {r0}
      bx r0

Exit:
       pop {r2-r7}
       pop {r0}

EndCommand:
      ldr r0, =0x08022CCD @Replace this with the offset of the 4th Mold Breaker Routine if you are using Mold Breaker
      bx r0

Divider:
      ldr r2, =0x081E4019
      bx r2

ScriptPusher:
      ldr r0, =0x08017545
      bx r0

.align 2
.LifeOrbDamageScript: .word 0x08BBBBBB
.ScriptPointer: .word 0x02023D74
.UserBank: .word 0x02023D6B
.BattleStruct: .word 0x02023BE4
.LORBit: .word 0x0203C038

@Set YY+1 YY YY 08 as the 'End' Battle Script Command.
Battle Script at BBBBBB:
Code:
39 20 00 FA 20 C0 03 02 SS SS SS 08 10 84 01 12 40 00 35 D0 3D 02 02 00 01 00 00 0B 01 0C 01 19 01 00 00 00 00 00 3C
String at SSSSSS:
Code:
FD 0F 00 E0 E3 E7 E8 00 E7 E3 E1 D9 00 E3 DA 00 DD E8 E7 00 C2 CA AB FF


I'm having troubles implementing it. I replaced the end command, placed a hook, inserted all routines and a battle script but...nothing happens. No resets, no freezing, the game just continues without recoil damage. I'm sure my item effect byte is correct. Do you know why it would happen? Also, I'm using DollSteak's Patch.

Quote:
Originally Posted by KDS View Post
Damage Reduction Berries


2. Assemble this routine and make bytes changes mentioned in the code
Spoiler:


Code:
.text
.align 2
.thumb
.thumb_func
.global reductionberry

ValidMoveCheck:     
     ldr r0, .Outcome
     ldrb r1, [r0]
     mov r2, #0x29
     and r2, r1
     cmp r2, #0x0
     bne Exit

SubCheck:
     ldr r3, .Target
     ldr r4, .PokemonData
     mov r2, #0x58
     ldrb r0, [r3]
     mul r0, r2
     add r7, r0, r4
     ldr r2, [r7, #0x50]
     ldr r3, .subval  
     and r2, r3
     cmp r2, #0x0
     bne Exit

NormalMoveCheck:
     ldr r4, .MemoryLoc
     ldr r3, [r4]
     ldrb r6, [r3, #0x13]
     mov r2, #0x3f
     and r6, r2
     cmp r6, #0x0
     bne SuperEffectiveCheck
     ldr r4, .MoveTable
     ldr r3, .CurrMove
     mov r2, #0xC
     ldrh r1, [r3]
     mul r1, r2
     add r2, r1, r4
     ldrb r6, [r2, #0x2]
     cmp r6, #0x0
     bne SuperEffectiveCheck

ChilanBerryCheck:
     ldrh r5, [r7, #0x2E]
     ldrh r0, .ChilanIndex  
     cmp r5, r0
     beq DamageReducer

SuperEffectiveCheck:
     ldr r0, .Outcome
     ldrb r1, [r0]     
     mov r2, #0x2
     and r1, r2
     cmp r1, #0x0
     beq Exit

LoadItem:
     ldrh r5, [r7, #0x2E]  
     ldr r3, .BerryTable
     ldrh r4, .FFHW

Loop:
     ldrh r0, [r3]
     cmp r0, r5
     beq TypeCheck
     cmp r0, r4
     beq Exit
     add r3, #0x3
     b Loop

TypeCheck:
     ldrb r0, [r3, #0x2]
     cmp r6, r0
     bne Exit

DamageReducer:
     ldr r4, .Damage
     ldrh r2, [r4]
     lsr r2, #0x1
     cmp r2, #0x0
     bne NotZero
     mov r2, #0x1

NotZero:
    strh r2, [r4]
    ldr r4, .ScriptIndex
    ldr r3, [r4]
    add r3, #0x1
    str r3, [r4]
    bl ScriptCall
    ldr r3, .BattleScript
    sub r3, #0x1
    str r3, [r4]
    ldr r0, .ItemBuffer
    strh r5, [r0]

Exit:
    bl Random
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    mov r1, #0xF
    ldr r2, .Return
    bx r2

Random:
    ldr r2, .RNG
    bx r2

ScriptCall:
    ldr r2, =0x08017545
    bx r2 

.align 2
.subval: .word 0x01000000
.ItemBuffer: .word 0x2023D68
.CurrMove: .word 0x2023D4A
.Damage: .word 0x02023D50
.Outcome: .word 0x02023DCC
.Target: .word 0x02023D6C 
.PokemonData: .word 0x02023BE4
.MemoryLoc: .word 0x02023FE8
.MoveTable: .word 0x08XXXXXX
.BerryTable: .word 0x08TTTTTT
.Return: .word 0x0801F111
.RNG: .word 0x08044EC9
.ScriptIndex: .word 0x02023D74
.BattleScript: .word 0x08BBBBBB
.FFHW: .hword 0xFFFF
.ChilanIndex: .hword 0x0YYY

@1F106: 00 00 00 48 00 47 XX+1 XX XX 08
TTTTTT is the pointer to the table created above.
YYY is the index of Chilan Berry
I can't get this routine to compile. I get the following errors:
48: Error: invalid offset, target not word aligned <0x000000E2>
48: Error: invalid offset, value too big <0x0000009E>
My index number of Chilian Berry is 0x00A0 but it doesn't matter as I've tried changing the value many times and I still got the errors.
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
Reply With Quote
  #639   Link to this post, but load the entire thread.  
Old July 28th, 2015 (4:25 AM).
Trainer 781
Guest
 
Posts: n/a
For life orb, make sure that you have replaced the end command in the repointed command table.

I'll look into the Berry issue.
Reply With Quote
  #640   Link to this post, but load the entire thread.  
Old July 28th, 2015 (4:37 AM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Quote:
Originally Posted by KDS View Post
For life orb, make sure that you have replaced the end command in the repointed command table.

I'll look into the Berry issue.
I did replace the command. It was this pointer: CD 2C 02 08 and I changed it to YY+1 YY YY 08.
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
Reply With Quote
  #641   Link to this post, but load the entire thread.  
Old July 28th, 2015 (4:54 AM).
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by DizzyEgg View Post
I did replace the command. It was this pointer: CD 2C 02 08 and I changed it to YY+1 YY YY 08.
Okk, then VM/PM me the offsets. I'll then able to see thd problem.

To fix thd damage berry routine just, change the .hword in the second last line to .word. (The error was due to some issues in Hackmew's compiler)
Reply With Quote
  #642   Link to this post, but load the entire thread.  
Old July 28th, 2015 (8:08 AM).
daniilS's Avatar
daniilS daniilS is offline
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 23
Gender: Male
Posts: 409
Quote:
Originally Posted by KDS View Post
Okk, then VM/PM me the offsets. I'll then able to see thd problem.

To fix thd damage berry routine just, change the .hword in the second last line to .word. (The error was due to some issues in Hackmew's compiler)
Actually, you can never load a relative halfword.
__________________
Reply With Quote
  #643   Link to this post, but load the entire thread.  
Old July 28th, 2015 (4:32 PM). Edited July 29th, 2015 by mariomaniac432.
mariomaniac432's Avatar
mariomaniac432 mariomaniac432 is offline
Shuckle Master
 
Join Date: Nov 2010
Location: Shuckle Island
Gender: Male
Nature: Timid
Posts: 46
I've been having some trouble getting the Berry System to work. For some reason, the script crashes when it gets to the first instance of the Get Tree Data routine. I know this is where the problem is because if I remove it from the script, it doesn't crash until it gets to the Berry Bag Selection routine, which for some reason crashes the game if I have a berry in the bag, but that could be a result of removing the Get Tree Ddata routine. I thought that maybe the problem was I installed JPAN's Save Block hack wrong (instructions seemed a little confusing at first, but I'm pretty sure I did it right), so I found this patch with the hack, applied it a clean FireRed 1.0 ROM, and then put all the other routines in, and had the same problem.

My script was a simple copy/paste from this thread, which the offsets filled in properly of course. All the ASM rotuines were also unmodified, and copied directly from this thread, I also tried compiling them myself and inserting them that way, but nothing seems to work.
Reply With Quote
  #644   Link to this post, but load the entire thread.  
Old July 28th, 2015 (10:08 PM). Edited July 28th, 2015 by leyn09.
leyn09's Avatar
leyn09 leyn09 is offline
Truant Trainer
 
Join Date: May 2011
Location: Philippines
Gender: Male
Nature: Careful
Posts: 84
Edit : already solved. Sorry! I didnt check out first the thread.
Reply With Quote
  #645   Link to this post, but load the entire thread.  
Old July 30th, 2015 (5:38 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by mariomaniac432 View Post
I've been having some trouble getting the Berry System to work. For some reason, the script crashes when it gets to the first instance of the Get Tree Data routine. I know this is where the problem is because if I remove it from the script, it doesn't crash until it gets to the Berry Bag Selection routine, which for some reason crashes the game if I have a berry in the bag, but that could be a result of removing the Get Tree Ddata routine. I thought that maybe the problem was I installed JPAN's Save Block hack wrong (instructions seemed a little confusing at first, but I'm pretty sure I did it right), so I found this patch with the hack, applied it a clean FireRed 1.0 ROM, and then put all the other routines in, and had the same problem.

My script was a simple copy/paste from this thread, which the offsets filled in properly of course. All the ASM rotuines were also unmodified, and copied directly from this thread, I also tried compiling them myself and inserting them that way, but nothing seems to work.
The berry tree routine is bugged. I will go ahead and redo it sometime in the future. Sorry.
__________________
...
Reply With Quote
  #646   Link to this post, but load the entire thread.  
Old July 30th, 2015 (5:45 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by Telemetius View Post
Hi FBI, first of all thanks for your work! You've been really helpful.
My question regards your battle routine http://www.pokecommunity.com/showthread.php?p=8527650#8527650 .
I've been trying it without success in my Ruby rom hack hoping it would work just like in Fire Red.
Is there any way to remove the whiteout after losing a battle in a Ruby hack rom?
No clue. I have not even looked at a Ruby ROM since 2008.

Quote:
Originally Posted by Mr.Pkmn View Post
Can we have run-like speed for surf and mach bike speed in FR? Even better would be an arbitrary speed value!
That's actually very easy. There's a bit in RAM somewhere which controls this. I vaguely remember posting about it here, but I'll get back to you with more content.

Quote:
Originally Posted by BluRose View Post
I'd like to say that this thread has been really helpful for me as my ASM skills are far worse than sub-par and, also, the Chain-Fishing one in particular is really cool to me. (◕‿◕✿)

I'd also like to request something for Fire Red BPRE v1.0 (adding to the infinite list of requests...):
Stance Change.
Basically, where a Pokémon uses an offensive move and changes its form to a more offensive Pokémon (or, rather, just a different index-number Pokémon entirely). However, when it uses a certain move (or just a status move would be fine, too), it reverts back to the old form.
EDIT: Oh, and it would also have to revert to the other form outside of battle.
What I was thinking was two separate abilities in order to accomplish this, but if one is possible, then that's great too!
Thanks in advance!

God I sound so rude I am so sorry

EDIT: Also, should I go to DaniilS with this? I noticed that he had his own thread for form(e)s...

EDIT EDIT: Okay, I just noticed something while I was trying to get the Male-only and Female-only evolution methods working on Burmy.
But ALL of the Pokémon generated by your routine are Male unless if they have more of an 82 percent chance of being female, in which case they are, and the Pokémon already caught turn into females. This is also shown in you post showcasing it, as the Tyranitar are also all Male.
Just wanted to say this, haha...
Yes, go to daniilS with this. He should be done by now, 4 or so months ago he said he was working on forms and mega evolutions. He should have everything worked out now if he isn't slacking ;D

Quote:
Originally Posted by FamiliaWerneck View Post
Few simple questions on breeding, egg groups and all that. You said it's all doable via a Pokémon Editor. What I want, actually is that Charizard evolutionary line breeds only with its line and/or Ditto. No Dragon/Monster egg groups. Will I have to make an egg group for each evolutionary family?
Also, how can I make Ditto breeds with himself too, not only all other Pokémon? And genderless Pokémon, like Magnemite? How can I make them breed?
Finally, for Nidorans and Volbeat/Illumise, I wanna make the male breed with the female, but not breedable with Ditto. How can I do it?



Here, I just want to know if I can make all Pokémon to be Docile as default or if I can change all natures' data, so all natures behave like Docile. Is either of these possible?
Thanks in advance!
For something specific like this it's better to just add in the exceptions yourself. The game will at some point check species for Ditto :)

If you give up, I can give you hints. My policy about strictly specific routines still stand however.
__________________
...
Reply With Quote
  #647   Link to this post, but load the entire thread.  
Old August 3rd, 2015 (7:22 PM).
leyn09's Avatar
leyn09 leyn09 is offline
Truant Trainer
 
Join Date: May 2011
Location: Philippines
Gender: Male
Nature: Careful
Posts: 84
Quote:
Originally Posted by kleenexfeu View Post
Well done on that KDS !

Same routine with Emerald offset !

Here :
Spoiler:

Spoiler:

Routine at XXXXXX:
Code:
.text
.align 2
.thumb
.thumb_func
.global lifeorbrecoil

SheerForceCheck:
      ldr r1, .UserBank
      ldr r2, .BattleStruct
      ldrb r1, [r1, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x7E /*Sheer Force*/
      bne EffectCheck 
      ldr r0, .CurrMove
      ldrh r3, [r0, #0x0]
      mov r0, #0x0
      ldr r1, .FEHalfWord
      ldr r2, .SheerForceTable

Loop:
      lsl r4, r0, #0x01
      add r4, r4, r2
      ldrh r4, [r4, #0x0]
      cmp r3, r4
      beq Exit
      cmp r4, r1
      beq EffectCheck
      add r0, #0x1
      b Loop

EffectCheck:
      mov r1, r8
      cmp r1, #0x1E
      beq KingsRock
      cmp r1, #0x3E
      beq ShellBell
      cmp r1, #0xKK    /*Life orb held item effect*/
      bne Exit
    
CheckOutcome:
      ldr r0, .Outcome
      ldrb r0, [r0, #0x0]
      mov r5, #0x29
      and r5, r0
      cmp r5, #0x0
      bne Exit

CheckUturnVoltSwitch:
      ldr r0, .CurrMove
      ldrh r0, [r0]
      ldrh r1, .VoltSwitchID
      cmp r0, r1
      beq Exit
      ldrh r1, .UTurnID
      cmp r0, r1
      beq Exit 

CheckIfMoveDamagedSomeTarget:
      ldr r1, .DamageStruct
      ldr r4, .TargetBank
      ldrb r2, [r4, #0x0]
      lsl r0, r2, #0x02
      add r0, r0, r2
      lsl r0, r0, #0x02
      add r6, r1, #0x4
      add r0, r0, r6
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit
      ldr r0, .FFHalfWord
      cmp r1, r0
      beq Exit
      
CheckIfUserIsNotTheTarget:
      ldr r0, .UserBank
      ldrb r3, [r0, #0x0]
      cmp r3, r2
      beq Exit

CheckMagicGuard:
      ldr r2, .BattleStruct
      ldrb r1, [r0, #0x0]
      mov r0, #0x58
      mul r0, r1
      add r0, r0, r2
      mov r2, #0x20
      add r2, r0, r2
      ldrb r2, [r2]
      cmp r2, #0x63 /*Magic Guard*/
      beq Exit

HPCheck:
      ldrh r1, [r0, #0x28]
      cmp r1, #0x0
      beq Exit

SetLifeOrbRecoilBit:
      ldr r1, .LORBit
      mov r0, #0x1
      strb r0, [r1]

Exit:
      ldr r1, .Return2
      bx r1

KingsRock:
      ldr r0, .Return3
      bx r0

ShellBell:
      ldr r1, .Return1
      bx r1

Divider:
      ldr r2, =0x082E7540+1
      bx r2

ScriptPusher:
      ldr r0, =0x0803FAFC+1
      bx r0

.align 2
.UserBank: .word 0x0202420B
.TargetBank: .word 0x0202420C
.BattleStruct: .word 0x02024084
.DamageStruct: .word 0x0202437C
.CurrMove: .word 0x020241EA
.SheerForceTable: .word 0x08XXXXXX
.Outcome: .word 0x0202427C
.FEHalfWord: .word 0x0000FEFE
.FFHalfWord: .word 0x0000FFFF
.Return1: .word 0x08045794+1
.Return2: .word 0x0804582A+1
.Return3: .word 0x080456EC+1
.LORBit: .word 0x0203E338	/*It's actually a FreeRam loc*/
.UTurnID: .word 0x00000YYY	/*ID number of U-Turn*/
.VoltSwitchID: .word 0x00000ZZZ	/*ID number of Volt Switch*/

/*At 080456DC: 00 48 00 47 XX+1 XX XX 08*/

Spoiler:

Routine at YYYYYY:
Code:
.text
.align 2
.thumb
.thumb_func
.global endcommandwithlifeorbsupport

Main:   
      ldr r1, .LORBit
      ldrb r0, [r1]
      cmp r0, #0x1
      bne EndCommand

LifeOrb:
      push {lr}
      push {r2-r7}
      mov r0, #0x0
      strb r0, [r1]
      ldr r0, .UserBank
      ldrb r3, [r0]      
      mov r0, #0x58
      mul r0, r3
      ldr r2, .BattleStruct
      add r2, r2, r0
      ldrh r0, [r2, #0x28]
      cmp r0, #0x0
      beq Exit
      ldr r0, =0x0202420F
      strb r3, [r0, #0x0]
      ldr r0, =0x02024274
      strb r3, [r0, #0x17]
      ldr r4, =0x020241F0
      ldrh r0, [r2, #0x2C]
      mov r1, #0xA
      bl Divider
      strh r0, [r4, #0x0]
      cmp r0, #0x0
      bne NotZero
      mov r0, #0x1

NotZero:
      strh r0, [r4, #0x0]
      bl ScriptPusher
      ldr r1, .ScriptPointer
      ldr r0, .LifeOrbDamageScript
      str r0, [r1, #0x0]
      pop {r2-r7}
      pop {r0}
      bx r0

Exit:
       pop {r2-r7}
       pop {r0}

EndCommand:
      ldr r0, =0x0804B664+1
      bx r0

Divider:
      ldr r2, =0x082E7540+1
      bx r2

ScriptPusher:
      ldr r0, =0x0803FAFC+1
      bx r0

.align 2
.LifeOrbDamageScript: .word 0x08BBBBBB
.ScriptPointer: .word 0x02024214
.UserBank: .word 0x0202420B
.BattleStruct: .word 0x02024084
.LORBit: .word 0x0203E338	/*Same as in previous routine*/

/*YY+1 YY YY 08 must replaces the "end" command pointer */

Spoiler:

Battle Script at BBBBBB:
Code:
39 20 00 FA 20 E3 03 02 SS SS SS 08 10 84 01 12 40 00 35 80 42 02 02 00 01 00 

00 0B 01 0C 01 19 01 00 00 00 00 00 3C
String at SSSSSS:
Code:
FD 0F 00 E0 E3 E7 E8 00 E7 E3 E1 D9 00 E3 DA 00 DD E8 E7 00 C2 CA AB FF



Bonus, Life Orb boost (lightball updated included). UPDATE for Emerald : I added a routine to make a new item that boost a certain type of attack. If you have a fairy type in your hack rom, you can now have an item that boost that type. You can adjust the boost the same way than miracle seed and such in G3T. I also implemented the TimeSpace orb in the routine :

Spoiler:

Emerald:
Code:
CheckLifeOrb:
cmp r2, #0x43	/*Held item effect of life orb, I chose 0x43 (= 67 in decimal) because it's unused*/
beq Lifeorb

CheckNewItem:
cmp r2, #0x44	/*Held item effect of the boost item, I chose 0x44 (= 68 in decimal) because it's unused*/
beq NewItem

CheckAdamantOrb:
cmp r2, #0x45	/*Unused held item effect*/
bne CheckLustreous
ldrh r0, [r6]
mov r3, #0xFF	/*0xFF + 0xE4 = 0x1E3 = 483 = index number of Dialga*/
add r3, #0xE4
cmp r0, r3
beq AdamantOrb

CheckLustreous:
cmp r2, #0x46	/*Unused held item effect*/
bne CheckGriseous
ldrh r0, [r6]
mov r3, #0xFF	/*0xFF + 0xE5 = 0x1E4 = 484 = index number of Palkia*/
add r3, #0xE5
cmp r0, r3
beq LustreousOrb

CheckGriseous:
cmp r2, #0x47	/*Unused held item effect*/
bne CheckLightBall
ldrh r0, [r6]
mov r3, #0xFF	/*0xFF + 0xE8 = 0x1E7 = 487 = index number of Giratina*/
add r3, #0xE8
cmp r0, r3
beq GriseousOrb
b Back

AdamantOrb:
push {r0-r5}
mov r1, #8	/*Steel type*/
mov r2, #0x10	/*Dragon type*/
b CheckExceptionTypeAttack

LustreousOrb:
push {r0-r5}
mov r1, #0xB	/*Water type*/
mov r2, #0x10	/*Dragon type*/
b CheckExceptionTypeAttack

GriseousOrb:
push {r0-r5}
mov r1, #7	/*Ghost type*/
mov r2, #0x10	/*Dragon type*/
b CheckExceptionTypeAttack

NewItem:
push {r0-r5}
mov r1, #9	/*New type you want to boost*/
mov r2, #9	/*New type you want to boost, here I choose the same because I want it boost only one type*/

CheckExceptionTypeAttack:
ldr r4, CheckTypeLoc
ldr r4, [r4]
ldrb r4, [r4, #0x13]
cmp r4, #0
beq GetMoveType
mov r5, #0x3F
and r4, r5
cmp r4, r1
beq Boost
cmp r4, r2
beq Boost
b PopAndBack

Back:
ldr r0, Return
bx r0

PopAndBack:
pop {r0-r5}
b Back

CheckLightBall:
cmp r2, #0x2D
bne Back
ldrh r0, [r6]
cmp r0, #0x19
beq Lightball
b Back

GetMoveType:
ldr r3, CurMoveIndex
ldrh r3, [r3]
ldr r4, MoveData
mov r5, #0xC
mul r5, r3
add r4, r5
ldrb r4, [r4, #2]
cmp r4, r1
beq Boost
cmp r4, r2
bne PopAndBack

Boost:
pop {r0-r5}
ldrh r3, [r6, #0x2E]
lsl r0, r3, #4
push {r1}
mov r1, #6
mul r3, r1
pop {r1}
add r3, r0
lsl r3, #1
ldr r0, LocItems
add r3, r0
add r3, #0x13
ldrb r0, [r3]
mov r3, #0x52
mul r0, r3
lsr r0, #6
add r0, #0x7B
mul r7, r0
lsr r7, #7
mov r3, r8
mul r3, r0
lsr r3, #7
mov r8, r3
b Back

Lifeorb:
mov r0, r8
mov r3, #0xA7
mul r0, r3
lsr r0, #7
mov r8, r0
mul r7, r3
lsr r7, #7
b Back

Lightball:
mov r0, r8
lsl r0, r0, #0x1
mov r8, r0
lsl r7, r7, #0x1
b Back

.align 2
Return: .word 0x0806983E+1
LocItems: .word 0x085839A0           /*Location of your items Data*/
CurMoveIndex: .word 0x020241EA
MoveData: .word 0x0831C898           /*Location of your move data*/
CheckTypeLoc: .word 0x0202449C

/*00 48 00 47 XX XX XX 08 00 00 00 at 0x6982C*/
Fire Red:
Code:
cmp r2, #0x43   /*Held item effect, I chose 0x43 (=67 in dec) because it is unused in the game*/
beq Lifeorb
cmp r2, #0x2D
bne Back
ldrh r0, [r6]
cmp r0, #0x19
beq Lightball
b Back

Lifeorb:
mov r0, r8
mov r3, #0xA7
mul r0, r3
lsr r0, #7
mov r8, r0
mul r7, r3
lsr r7, #7
b Back

Lightball:
mov r0, r8
lsl r0, r0, #0x1
mov r8, r0
lsl r7, r7, #0x1

Back:
ldr r0, Return
bx r0

.align 2
Return: .word 0x0803F00A+1

/*00 48 00 47 XX XX XX 08 00 00 00 at 0803EFF8*/




Yep, it is now updated
How should I use both the recoil and boost effect? Should it be separately compiled and just put the same held item byte effect in each routines?
Reply With Quote
  #648   Link to this post, but load the entire thread.  
Old August 4th, 2015 (3:16 AM).
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by leyn09 View Post
How should I use both the recoil and boost effect? Should it be separately compiled and just put the same held item byte effect in each routines?
Recoil and boost work indeed seperatly, as you can see the branch aren't done at the same places. So yeah you have to give the same effect in both routine as well as assembling them to have both recoil/boost effects.
Reply With Quote
  #649   Link to this post, but load the entire thread.  
Old August 4th, 2015 (9:49 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

OAM routines



The first hackathon was probably the worst thing that could have happened for this thread. It completely killed my motivation for hacking and made me quit for a few months. There are some good things that came out of it, I was able to do a lot of research on things I hadn't before including field moves, OAM, trainer generation and such. I was looking around my older routines for OAM manipulation, and I had trouble understanding and ripping my own code! I had lost the source code, so I decided to rip as much as I can and redo the jibberish including some clean up.

Similar routines to these ones I'm presenting were used for the custom intro in team 4's hackoff ROM :)


Generating OAMs



This routine is only to generate OAMs which are trainer or Pokemon sprites. I've modified it to be usable with a script, but honestly, setting the values yourself via ASM would've been faster (not that this is noticeably slow, just comparatively). I will have to do more research on making it portray an arbitrary image, but with the expansion work on the Pokedex and such, I don't see it as very necessary anymore.

How to insert:
Compile and insert the following routine into a free word aligned offset.

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
 
main:
        push {r0-r4, lr}
        sub SP, SP, #0x14
       
        @load PID
        ldr r2, =(0x20370B8) @PokeSlot
        ldrb r2, [r2]
        cmp r2, #0x6
        beq shiny
        ldr r0, =(0x2024284)
        mov r4, #0x64
        mul r2, r2, r4
        add r2, r2, r0
        ldrh r2, [r2] @PID
       
        @load TID
        ldr r1, =(0x300500C)
        ldr r1, [r1]
        ldrh r1, [r1, #0xA] @TID
        b cont
               
shiny:
        mov r0, #0x0
        mov r1, r0
        mov r2, r0
 
cont:
        @X-pos
        ldr r0, =(0x20370BA)
        ldrh r0, [r0]
        str r0, [SP] @X-Pos
       
        @Y-pos
        ldr r0, =(0x20370BC)
        ldrh r0, [r0]
        str r0, [SP, #0x4] @Y-Pos
       
        @pal #
        ldr r0, =(0x20370BE)
        ldrh r0, [r0]
        str r0, [SP, #0x8] @pal #
       
        ldr r3, =(0x20370C0)
        ldrb r3, [r3]
        cmp r3, #0x1
        bne nonsil
        mov r3, #0x0
        str r3, [SP, #0xC] @occupacity
        b unkn
       
nonsil:
        ldr r3, =(0x0000FFFF)
        str r3, [SP, #0xC] @occupacity
       
unkn:  
        @??? - No idea, but leave as 0s
        @possibly priority?
	ldr r0, =(0x20370C6)
	ldrb r0, [r0]
        str r0, [SP, #0x10]
	mov r0, #0x0
        str r0, [SP, #0x14]
       
        @species/sprite ID
        ldr r0, =(0x20370C2)
        ldrh r0, [r0]
 
        @front VS back
        ldr r3, =(0x20370C4)
        ldrb r3, [r3]
 
        @display func
        ldr r4, =(0x810BDAC +1)
        bl linker
        add SP, SP, #0x14
        pop {r0-r4, pc}
       
 
 
linker:
        bx r4
 
.align 2
Compiled version:
Code:
1F B5 85 B0 18 4A 12 78 06 2A 08 D0 17 48 64 24 62 43 12 18 12 88 16 49 09 68 49 89 02 E0 00 20 01 1C 02 1C 13 48 00 88 00 90 13 48 00 88 01 90 12 48 00 88 02 90 12 4B 1B 78 01 2B 02 D1 00 23 03 93 01 E0 0F 4B 03 93 0F 48 00 78 04 90 00 20 05 90 0E 48 00 88 0E 4B 1B 78 0E 4C 00 F0 02 F8 05 B0 1F BD 20 47 C0 46 B8 70 03 02 84 42 02 02 0C 50 00 03 BA 70 03 02 BC 70 03 02 BE 70 03 02 C0 70 03 02 FF FF 00 00 C6 70 03 02 C2 70 03 02 C4 70 03 02 AD BD 10 08


Usage:
The usage is quite simple, but it takes up a lot of temporary variables :P

Code:
@var 0x8000 - Slot #. Set 0x6 for shiny.
@var 0x8001 - X-pos
@var 0x8002 - Y-pos
@var 0x8003 - Unoccupied Pal ID number. See OAM viewer.
@var 0x8004 - Occupacity silluette set 1
@var 0x8005 - species/trainer sprite ID
@var 0x8006 - Front (1) or Back (0)
@var 0x8007 - Toggle trainer or Pokemon
Some quick notes about these variables.

Variable 0x8000 is to determine the Pokemon's shinyness. If you're showing a Pokemon in your party just use that Pokemon's party slot. If you're showing a shiny Pokemon go ahead and use 0x6. Basically 0x6 = shiny, anything else (must be lower) depends on party slot.

Variable 0x8003 plays a key role. Make sure in the OAM viewer the sprite ID is free.

Here sprite number 0 is taken by Oak's OAM. Click the Arrow until you find something not occupied, and set this variable to that value!

Variable 0x8007 is a switch of sorts. It determines whether to show a trainer sprite or a Pokemon sprite.

I think the rest of the variables are self explanatory. Mess around with them a little :)


OAM tracking



So I'm sure you can imagine, that at some point in time you want your OAM to disappear. You can't have it on the screen forever, maybe even make it disappear temporarily and reshow it without having to do the painfully expensive creation call again. I made a routine which will take into account the last OAM ID which you created and stores it in var 0x8008. Note that this is an ID assigned by the game code, not the same ID as the one we assigned on creation. Therefore it's important to track this.

How to insert

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

.text
.align 2
.thumb
.thumb_func

@ID of last OAM created - 0x8008
@Hook at 0x80070B0 via r1

main:
ldr r1, =(0x20370C8)
strh r0, [r1]
lsl r6, r6, #0x10
lsr r6, r6, #0x10
lsl r4, r4, #0x18
lsr r4, r4, #0x18
lsl r0, r0, #0x4
ldr r1, =(0x80070BA +1)
bx r1

.align 2


Navigate to 080070B0 and insert the following byte changes:
Code:
00 49 08 47 XX XX XX 08
Where XX XX XX is the location your inserted your routine in reverse hex +1. The trailing "08" may change to 09 or something depending on where you inserted it. Remember to stay word aligned!

Usage:
This routine doesn't really do anything by itself. It's more of a routine which works in the background. It just writes to variable 0x8008 the last displayed OAM's ID. Basically, just insert it and do nothing :3


A quick explanation of how OAMs are shown/hidden in FireRed.



There's a neat RAM structure in FireRed which controls whether or not to show or unshow an OAM on the screen. This OAM's ID needs to be present in said structure. The structure, for some unknown reason, is 40 bytes in size. It looks like this:

[OAM ID (1 byte)] [OAM ID (1 byte)] [OAM ID (1 byte)] ... [Byte 0x3F] [Filler bytes] ...[40th filler byte]

In case you don't understand by now, it's basically a table of X entries where each entry is an OAM's ID to display. Every entry after the byte 0x3F is not read by game code, and is therefore nothing more than filler bytes!

The reason as to why I'm confused the structure is 40 bytes is because the routines which use this structure restrict themselves by using another structure. This second structure only holds 13 OAMs at a time, which is why we can only have 13 OAMs present in FR on screen at once WITHOUT fully customized code. For the most part you'll never go over 13 anyways. I used 9 in total for the custom intro and the screen was cluttered :X

My guess as to why it's 40 bytes is because it's used for animation frames as well. I'm not sure, I haven't researched that.
This structure is located at 0x2021800.

Hiding OAMs created



Now that you understood the data structure, you need to remove your OAM's byte ID from the table. But how do you know which byte is your OAM's byte? That was what the previous tracker routine was for. Right after you create your OAM the corresponding table ID will be in var 0x8008. Copy this value into somewhere you won't lose it (i,e a non-temporary variable), from there you can callasm this routine with the appropriate parameters :)

How to insert:

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

.text
.align 2
.thumb
.thumb_func

@OAM ID to hide - 0x8000

main:
push {r0-r2, lr}
ldr r0, =(0x2021800)
ldr r2, =(0x20370B8)
ldrb r2, [r2]

loop:
ldrb r1, [r0]
cmp r1, r2
beq set
add r0, r0, #0x1
b loop

set:
mov r1, #0x3F
strb r1, [r0]

done:
pop {r0-r2, pc}

.align 2



Usage:

In a script, set variable 0x8000 to the OAM ID you want to vanish, then simply callasm this routine. This data structure is updated every frame from what I was able to see, so the results should be immediate.


Show OAM



Sometimes you want to hide an OAM but only temporary. This routine will show an OAM which has already been loaded, but flagged as hidden or similar.

How to insert:

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

.text
.align 2
.thumb
.thumb_func

@OAM ID to set - 0x8000

main:
push {r0-r2, lr}
ldr r0, =(0x2021800)

loop:
ldrb r1, [r0]
cmp r1, #0x3F
beq set
add r0, r0, #0x1
b loop

set:
ldr r2, =(0x20370B8)
ldrb r2, [r2]
strb r2, [r0]
mov r1, #0x3F
add r0, r0, #0x1
strb r1, [r0]

done:
pop {r0-r2, pc}

.align 2


Usage:

In a script, set variable 0x8000 to the OAM ID you want to reappear, then simply callasm this routine. This data structure is updated every frame from what I was able to see, so the results should be immediate.

Closing notes:



I may or may not update these with animations as well. One I'm particularly interested in doing is a slow fade. The biggest thing I want to address is how to use these in a script. I think it's fairly intuitive, but a quick example may help :)

Spoiler:

Code:
#dyn 0x740000
#org @start
lock
faceplayer
fadescreen FADEOUT_BLACK

'setting up parameters for OAM creation routine
setvar 0x8007 0x0
setvar 0x8000 0x0
setvar 0x8001 0x74
setvar 0x8002 0x64
setvar 0x8003 0x1
setvar 0x8004 0x0
setvar 0x8005 0x85
setvar 0x8006 0x1
callasm 0x[location you inserted creation routine +1]

'recall our last created OAM is stored in 0x8008

copyvar 0x8009 0x8008

'simply vanishing the OAM
copyvar 0x8000 0x8008
callasm 0x[location you inserted hide routine +1]


'creating a second OAM!
setvar 0x8000 0x0
setvar 0x8001 0x74
setvar 0x8002 0x64
setvar 0x8003 0x2
setvar 0x8004 0x0
setvar 0x8005 0x86
setvar 0x8006 0x1
callasm 0x[location you inserted creation routine +1]


copyvar 0x800A 0x8008
copyvar 0x8000 0x8008
'remove visibility
callasm 0x[location you inserted hide routine +1]
jump @loop

#org @loop
'-----------------------------------
compare 0x8007 0x60
if == jump @done ' Equal To

'show OAM 1
copyvar 0x8000 0x8009
callasm 0x[location you inserted show routine +1]
pause 0x10

'hide OAM 1
copyvar 0x8000 0x8009
callasm 0x[location you inserted hide routine +1]

'show OAM 2
copyvar 0x8000 0x800A
callasm 0x[location you inserted hide routine +1]
pause 0x10

'hide OAM 2
copyvar 0x8000 0x800A
callasm 0x[location you inserted hide routine +1]

'increment loop
addvar 0x8007 0x1
jump @loop

#org @done
'-----------------------------------
fadescreen FADEIN_BLACK
msgbox @text ' Phew.
callstd MSG_LOCK ' Built-in lock command
release
end


#org @text
= Phew.


Play around with it. It can be fun, and hopefully this will open more doors for hackers. I've made it as friendly as possible even opening up the potential to use it in scripts, but if you have any questions you can direct them to me at the ASM help thread or something :D
__________________
...
Reply With Quote
  #650   Link to this post, but load the entire thread.  
Old August 5th, 2015 (4:29 AM).
FamiliaWerneck's Avatar
FamiliaWerneck FamiliaWerneck is offline
 
Join Date: May 2015
Location: São Paulo, Brasil
Gender: Male
Posts: 275
Quote:
Originally Posted by FBI agent View Post

Preventing TMs from being consumed on use



Quick research:
TMs are deleted in two places. The first place is in their own function. When called from the bag, after use the TM has it's own deletion mechanism. The second way is from the bag, after you use a TM the bag attempts to delete it as well. Well, the solution is quite simple. There's two ways to do this, either go to 0809A1D8 call your own function there which checks if the item is a TM, and if it is, just jump to the end. Or much more simply you just remove the parts from the bag and tm function that deletes the TM (Which is what I did). The former way is a way you can make another item you have unconsumable.

To insert:
Do the byte changes below
0x124F78: 00 00 00 00
0x125C80: 00 00 00 00

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

Make it consumable after animation:
Insert: 00 00 00 00 at 0x124F78

To remove the quantities showing up in the bag:

Compile and insert into free space:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	cmp r5, #0x0
	bne end
	ldr r3, =(0x8131EFE +1)
	bx r3

end:
	mov r0, r7
	mov r1, #0x8
	mov r2, r4
	ldr r6, =(0x81335B0 +1)
	bl link
	ldr r3, =(0x8131EFE +1)
	bx r3

link:
	bx r6

.align 2


Here's a compiled version:
Code:
00 2D 01 D1 05 4B 18 47 38 1C 08 21 22 1C 04 4E 00 F0 02 F8 01 4B 18 47 30 47 C0 46 FF 1E 13 08 B1 35 13 08
Now navigate to 0x131EF4 and insert:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is the pointer to where you assembled the routine +1

Now navigate to 0x131EA5 and change the byte to E0

Unsellable:
Basically for the TMs, you can still sell them to vendors. To change this, you need to modify each TM individually. It's unfortunate, but the game checks if an item can be sold my comparing it's market price to zero. If it's strictly greater than zero, then you can sell it to a vendor, seems to be the rule. So to make TMs unsellable you need to set their market prices individually to zero.
I can't use my own checks to disguise the TMs as unique because the sell routine in shops are used for ALL items including potions, berries, TMs, and other items like nuggets.


Present :3
I've got a HUGE problem with this!!!!
I was playing and normally using TMs for 20k Pokémon (not a number, I'm exaggerating). I'm after the league now, and I was giving Toxic to some Pokémon, to help me catch others, so I could get the 60 Pokémon to get National Dex and be able to go to Four Island.
Problem is, when I was going to give Toxic to my Chansey, it was gone! Then I looked for the Psychic TM (other move I give to her, I took it out briefly for Rock Smash), and it was gone too. What the hell happened?
Is there a limit for this?
I got my save back, from the GBA in-game save, and I had Toxic yet. I tested giving it to one Pokémon and it didn't disappear. Then I gave it to other and then it wasn't there anymore. Is there a limited amout of times I can use a TM? Or there's something incomplete about this hack?
__________________
My Main Team:


Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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