Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development

Notices
For all updates, view the main page.

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. 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!
Research & Development programs in this forum are subject to moderator approval before they are displayed.



Closed Thread
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old November 11th, 2014 (02:37 PM). Edited November 22nd, 2014 by FBI agent.
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male

Surf and Special 0x12b Hack


(for Fire Red only)
Also see:
Changing Waterfall: http://www.pokecommunity.com/showpost.php?p=8496240&postcount=3
Changing Fly: http://www.pokecommunity.com/showpost.php?p=8505424&postcount=8
Changing Flash: http://www.pokecommunity.com/showpost.php?p=8505791&postcount=14

Goal and achievement:



My goal during the recent days was to mimic the anime in terms of how trainers commute in the water. I decided to try and make it so that if you have a water type Pokemon you can surf, regardless of move pool. As such, below is a semi-guide/resource to functionality of how you can implement such a feature yourself! You will also find my (and Touched's) implementation of a special that checks your party for a certain type of Pokemon.

Thought process and reasoning:



I've been trying to figure out how to remove the badge and HM requirement for surfing. I found
The script and removed the move requirement, but it seems I still can't bring up the surf script even with the badge. It seemed to keep checking if a Pokemon has learned surf before allowing me to activate the script. I wasn't quite sure where the second check is taking place, so I kinda backtracked..and landed on quite the peculiar structure.

Structure so far (forgive my formatting):
Code:
0806D548 - start
	- operations
0806D550 - tile behavior check (may be height check)
compare behavior 0x0 or 0x1 (waterfall vs surf ...I think)
B 0806D570 - if surf goes here, else keep going
BL to 0805C83C - nested for loop. Loops Pokemon and moves (using move decryption, this is for waterfall) 
compare move found (searches for waterfall I think)
	B 0806D570 - if move found goes here
	B 0806D5E2 - if not found goes here (a routine exit)
at 0806D570
	ldr r0, [0x806D59C]
	B 0806E6D0 (flag checker, the gym flag folks)
		Check to see if var is 0x1 (that is the gym flag is set)
		if not set B 0806D5A4
		else run function BL to 0805C83C - nested for loop. Loops Pokemon moves (this one is for SURF!)
			@ 0806d586 - checks for the surf (real check!)
			if surf found B 0805C8B0 - collision detection
			 check no collision, - Execute -
         And then a bunch of things we don't really care about.
So now you ask, how do we remove the HM requirement?! It's simple, you remove the else condition in the check. I.e pad it with 0s.

The solution to removing HM Surf from the picture:
At 0x6D588 - 0x6D589 change 0C D1 to 00 00.

Now what this exactly does is remove the check (outside of the script) for surf. However, surf is still checked for in the script itself.
You need to edit the script to whatever it is you wanted the surf condition to be, OR, you can use the edited version of special 0x12b I will talk about shortly.

Introduction to the special:


Thanks to Jpan's research on specials I found out that special 0x12b was a special which would tell you if your party had a grass Pokemon. Quite simple, and to be honest, very useless. However this special did do a few things internally that are actually worth using. It ran through your entire party and checked your Pokemon's type (and the check supported dual types, that is Pokemon like Venasaur would be flagged as grass too). So if we can modify the special to work for any type we specify would that be useful? What if we were also able to return the slot of the Pokemon who was of that type? Yes, please :P

The original (starts at 080CA804):
Spoiler:

Code:
push {r4-r6, lr}
mov r5, #0x0   @R5 unused, and served as loop counter! I.e can serve as our slot counter later on
ldr r6, [$080CA850] (=$08254784)
mov r0, #0x64
add r1, r5, #0x0
mul r1, r0
ldr r0, [$080CA854] (=$02024284) 
add r4, r1, r0
add r0, r4, #0x0
mov r1, #0x5
bl $0803FBE8
cmp r0, #0x0
beq $080CA858
add r0, r4, #0x0
mov r1, #0x2D
bl $0803FBE8
cmp r0, #0x0
bne $080CA858
add r0, r4, #0x0
mov r1, #0xB
BL $0803FBE8
lsl r0, r0, #0x10
lsr r0, r0, #0x10
lsl r1, r0, #0x03
sub r1, r1, r0
lsl r1, r1, #0x02
add r1, r1, r6
ldrb r0, [r1, #0x6]
cmp r0, #0xC         @CHECK TYPE 1 IS GRASS
beq $0x80CA84C     @sets r0 to 1
ldrb r0, [r1, #0x7]
cmp R0, #0xC        @CHECK TYPE 2 IS GRASS
bne $080CA858       @next Pokemon, this is the looping part
mov r0, #0x1         @set r0, return value, to 1
b $080CA864
...
some more things here to do with transversing the Pokemon table


I haven't explained some of the parts about getting Pokemon from part and looking it up in the table, but if you have questions I can answer.

The part of the code which we may be interested mostly by is the check part. It checks for 0xC (for grass) at the Pokemon's Type 1 and Type 2 slot. If you want you can change this statically to match a type of your choosing by simply modifying 0xC to a type you wanted to check.
Types are defined like this:
Spoiler:

Code:
Normal 0x0
Fighting 0x1
Flying 0x2
Poison 0x3
Ground 0x4
Rock 0x5
Bug 0x6
Ghost 0x7
Steel 0x8
??? (egg) 0x9
Fire 0xA
Water 0xB
Grass 0xC
Electric 0xD
Psychic 0xE
Ice 0xF
Dragon 0x10
Dark 0x11


However, Touched and I made this routine for the check part :
A)
Spoiler:

Code:
.text
.align 2
.thumb_func
 
main:
    ldr r2, .VAR
    ldrb r2, [r2]
 
    ldrb r0, [r1, #6] @ Type 1
    cmp r0, r2
    beq is_type
    ldrb r0, [r1, #7] @ Type 2
    cmp r0, r2
    bne not_type
   
is_type:
    mov r0, r5
    pop {r4-r6}
    pop {r1}
    bx r1
   
not_type:
    ldr r0, =(0x80CA858 + 1)
    bx r0

.align 2
.VAR:
	.word 0x020270B8 + (0x8000 * 2)


What it does is compares the type 1 and type 2 to a variable (in this case 0x8000). If a Pokemon of that type is found we return into 0x8000 the slot of that Pokemon from 0 to 5, returning a 6 if no Pokemon of that type was found. Note that the variable can be changed to another variable, though careful which you use (encrypted variables and 0x800D, 0x800E, 0x800F don't work since we'd never be able to check the last result without overwriting it and similar situations with the rest.


Inserting:



To insert this into your FR ROM, you need to assemble it into free space and call it.
We overwrite the line ldrb r0, [r1, #0x6] and whatever else we need with a bx.
That is:
Code:
	ldr r0, = Routine +1
	bx r0
To insert this, first assemble A). Put it into some free space (even ending). If you don't know how to assemble it's:
Code:
06 4A 12 78 88 79 90 42 02 D0 C8 79 90 42 03 D1 28 1C 70 BC 02 BC 08 47 01 48 00 47 B8 70 03 02 59 A8 0C 08
Keep track of the offset you inserted this in.

Now go to 0xCA840, and insert:
Code:
00 48 00 47
Finally, for the next for bytes, you must do some reverse hex. Take the offset you inserted A) in, and prefix it with 08. Then insert the reverse hex version of the whole thing plus 1.
So if I inserted at 7266B0, then
7266B0 = 087266B0
087266B + 1 = 087266B1
087266B1 = B1 66 72 08 (you insert this after 00 48 00 47).

Finally we want to return 6, if there isn't a Pokemon in the party of the type we specified. Go to 0xCA862 and change 00 to 06. That's it!

Sample Script:
PKSV
Spoiler:

Code:
#dyn 0x740000
#org @start
'-----------------------------------
lock
faceplayer
setvar 0x8000 0xB 'Look for water Pokemon
special2 0x4001 0x12B
compare 0x4001 0x6
if < jump @typeFound 
msgbox @noneFound ' You don't have one!
callstd MSG_LOCK 
release
end

#org @typeFound
'-----------------------------------
storevar 0x0 0x4001 'put 0x4001 into buffer 0
msgbox @location ' You have one at \v\h...
callstd MSG_LOCK ' Built-in lock command
release
end


#org @noneFound
= You don't have one!

#org @location
= You have one at \v\h02


XSE:
Spoiler:

Code:
'-----------------------
#org 0x740549
lock
faceplayer
setvar 0x8000 0xC
special2 0x4001 0x12B
compare 0x4001 0x6
if 0x0 goto 0x874056A
msgbox 0x8740451 '"You don't have one!"
callstd 0x6
release
end

'-----------------------
#org 0x74056A
buffernumber 0x0 0x4001
msgbox 0x8740578 '"You have one at [buffer1]"
callstd 0x6
release
end


'---------
' Strings
'---------
#org 0x740451
= You don't have one!

#org 0x740578
= You have one at [buffer1]


Note: The Pokemon's slot number is stored in whichever variable you give it. You can feed it 0x8000 if you wanted to use only 1 variable.


Extras (Surf hack + Special in conjunction):



PKSV script
Spoiler:

Code:
#org 0x81A6AC8
'-----------------------------------
jump 0x8750001

#org 0x8750001
'-----------------------------------
special INIT_STEPCOUNT
compare LASTRESULT 0x2
if == jump 0x81A7AE0 ' Equal To
lockall
msgbox 0x81A556E ' The water is dyed a ...
callstd MSG_YESNO ' Yes/No message
compare LASTRESULT NO
if == jump 0x81A6B0B ' Equal To
setvar 0x8000 0xB
special2 0x4001 0x12B
compare 0x4001 0x6
if >= jump 0x81A6B0C ' Larger Than or Equal To
storepartypokemon 0x0 0x4001
setanimation 0x0 0x4001
msgbox 0x81A55A5 ' \v\h02 used SURF!
callstd MSG_NOCLOSE ' Non-closing message
doanimation 0x9
releaseall
end

#org 0x81A7AE0
'-----------------------------------
release
end

#org 0x81A6B0B
'-----------------------------------
releaseall
end

#org 0x81A6B0C
'-----------------------------------
end


#org 0x81A556E
= The water is dyed a deep blue[.]\nWould you like to SURF?

#org 0x81A55A5
= \v\h02 used SURF!


XSE:
Spoiler:

Code:
'-----------------------
#org 0x1A6AC8
goto 0x8750001
bufferitem 0x2 0x600
nop1
jumpram
releaseall
copyvarifnotzero 0x0 0x39
compare LASTRESULT 0x6
if 0x1 goto 0x81A6B0C
bufferpokemon2 0x0 LASTRESULT
setanimation 0x0 LASTRESULT
lockall
msgbox 0x81A556E '"The water is dyed a deep blue[.]\nW..."
callstd 0x5
compare LASTRESULT 0x0
if 0x1 goto 0x81A6B0B
msgbox 0x81A55A5 '"[buffer1] used SURF!"
callstd 0x4
doanimation 0x9
releaseall
end

'-----------------------
#org 0x750001
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7AE0
lockall
msgbox 0x81A556E '"The water is dyed a deep blue[.]\nW..."
callstd 0x5
compare LASTRESULT 0x0
if 0x1 goto 0x81A6B0B
setvar 0x8000 0xB
special2 0x4001 0x12B
compare 0x4001 0x6
if 0x4 goto 0x81A6B0C
bufferpokemon2 0x0 0x4001
setanimation 0x0 0x4001
msgbox 0x81A55A5 '"[buffer1] used SURF!"
callstd 0x4
doanimation 0x9
releaseall
end

'-----------------------
#org 0x1A6B0C
end

'-----------------------
#org 0x1A6B0B
releaseall
end

'-----------------------
#org 0x1A7AE0
release
end


'---------
' Strings
'---------
#org 0x1A556E
= The water is dyed a deep blue[.]\nWould you like to SURF?

#org 0x1A55A5
= [buffer1] used SURF!


End:


I hope you found the hacks/research, or at least the special useful :)
If you use either, please give credit to Touched. I don't particularly require credit, but if you want, please do give :P



...
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #2    
Old November 12th, 2014 (09:31 AM).
AlexAhnon's Avatar
AlexAhnon
Do you believe in yourself?
Community Supporter
 
Join Date: Feb 2008
Location: You know where.
Send a message via Skype™ to AlexAhnon
This is a pretty cool function. I might even use this, actually. Great job on figuring it out! Maybe do something similar to Fly but add a check for species to prevent certain Pokémon from doing it?
__________________
  #3    
Old November 12th, 2014 (03:19 PM).
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by AlexAhnon:
This is a pretty cool function. I might even use this, actually. Great job on figuring it out! Maybe do something similar to Fly but add a check for species to prevent certain Pokémon from doing it?
Fly is a little more complicated than surf. Unlike surf, there isn't really a script for me to use to back track (at least not an obvious one). I checked out the fail message, and l ended up finding myself in a table full of Pokemon Menu messages (I even found the "FLY" blue highlight on Pokemon able to use it), sadly I haven't been able to find the part of the code that utilizes it yet. Anyways, if I'm gonna end up doing it, I'll be doing it through hacking the Pokemon menu. Look forward to it :P

Slight Update (Waterfall):
I didn't really talk about it in the main post, but this is to those who want to give waterfall the surf treatment. Structurally the code that checks waterfall & surf are exactly the same, so the edit is also very similar...very similar :P
At 0x6D566, replace 03 D1 with 00 00

Also, you need to edit the waterfall script as well at 0x1BE2B7 (decompile in script editor)
Speaking of script locations, surf is at 0x1A6AC8
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #4    
Old November 15th, 2014 (01:54 AM).
Lone Knight's Avatar
Lone Knight
The friendless
 
Join Date: May 2014
Location: Bangladesh
Gender: Male
Nature: Lonely
*facepalm* i didnt knew a special like that existed......breaking my head the other day to create something like that, and the next i find this lol great work!
__________________
  #5    
Old November 15th, 2014 (12:47 PM).
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
do you think it would be too hard to use this info to edit it to make an item work with surf... so as long as you have the item you can surf...
__________________
  #6    
Old November 15th, 2014 (01:34 PM). Edited November 21st, 2014 by FBI agent.
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by LocksmithArmy:
do you think it would be too hard to use this info to edit it to make an item work with surf... so as long as you have the item you can surf...
Yeah that would be very easy. There's already a tutorial on item creation + custom scripts on those items. Callasm to here, and remove the type check.
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #7    
Old November 21st, 2014 (08:55 PM).
AlexAhnon's Avatar
AlexAhnon
Do you believe in yourself?
Community Supporter
 
Join Date: Feb 2008
Location: You know where.
Send a message via Skype™ to AlexAhnon
How's the progress on making "Fly" work similarly? I heard you talk about it in the IRC and thought you might have an update on it.
__________________
  #8    
Old November 21st, 2014 (10:13 PM). Edited November 22nd, 2014 by FBI agent.
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by AlexAhnon:
How's the progress on making "Fly" work similarly? I heard you talk about it in the IRC and thought you might have an update on it.
Coincidental that you'd ask :P

Implementation of Fly HM02 using the Start menu and a modified special 0x12b!


(for Fire Red only)


Goal and achievements:



When I was changing HM Fly, the first idea was to change the bottom right Pokemon selection menu, however, that whole feature was a nested mess. I mean, it was impossible to locate functions that did anything specific, and the whole feature was just poorly coded with assumptions about things everywhere (I'm not gonna get into that anyways). It was then suggested by Alex that I just incorporate it into the start menu. So that's what I've done. Right now, what this hack achieves is it creates a menu option called "Map" and if you have a flying type it will allow you to fly to locations on the map, otherwise, it will just open the regular town map. By the way, if you don't care for the technical insertion/research process, there's a patch in the bottom of this post (uses space 71A430-71A4B4).


Manually inserting and Explanation of implementation


First step:

The main part of this hack is to utilize our edited special 0x12b to figure out if we have a flying type, then depending on the result, open the flying map or the regular town map. Thankfully that part, to code, wasn't hard. Finding the functions that opened each of them individually was the harder part. If you look at the normal Town map caller or HM Fly caller for example, it was a special kind of hell. Anyways, many credits to Knizz for spending hours of his time with me locating these functions (thanks buddy, would've taken ages without you!).

Now the code (which I didn't bother commenting too much because it is rather simple).
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {lr}
	ldr r0, .VAR @set paramaters for special
	mov r1, #0x2
	strb r0, [r1]
	ldr r1, =(0x80CA804 +1) @check flying type
	bl CALLER
	cmp r0, #0x6
	bge NORMALMAP @if no flying open normal map
	ldr r1, =(0x80C4EF8 +1)
	bl CALLER
	b END

NORMALMAP:
	ldr r1, =(0x80A1CC0 +1)
	bl CALLER
	b END

CALLER:
	bx r1

END:
	pop {pc}
	

.align 2
.VAR:
	.word 0x020270B4 + (0x8000 * 2)


You need to assemble this into free space somewhere in your ROM. Here is the assembled version:
Code:
00 B5 09 48 02 21 08 70 08 49 00 F0 0A F8 06 28 03 DA 07 49 00 F0 05 F8 04 E0 06 49 00 F0 01 F8 00 E0 08 47 00 BD C0 46 B4 70 03 02 05 A8 0C 08 F9 4E 0C 08 C1 1C 0A 08
Remember where you insert it (it becomes relevant soon).

You'll notice that I'm branching to (0x80C4EF8 +1) and (0x80CA804 +1) respectively. As you'd guess both of these functions are standalone for opening the townmap and "fly map" directly without the item/pokemon. Also note that this code assumes you've inserted my modified version of special 0x12b (the patch inserts this for you), to manually insert see the main post.


Hacking the Start Menu



The next step is calling this function through the start menu. I'm going to explain the process in case someone else is also planning to implement a similar feature into the start menu.

The first complication when inserting to the start menu comes when you realize that the start menu is limited to display 7 options at once. Trying to insert anymore will cause a crash (I haven't investigated the technicalities behind the crash, but it happens when we attempt to insert an eighth item). I should also mention that even if you insert an eight item, without changing box sizes, font size and the rest of that relevant material the menu will overlap and the description box and probably create a sad bug.
The second complication is that the "table" the start menu insertion code goes through is also not easily expandable. So on top of only showing 7 options, the table's items are accessed directly. For example you may see somewhere something that pulls the 4th item directly from the table by referencing the offset at the 4th index of the table (without a mathematical formula...just directly). To expand the table then, you'd need to re point all of these references too (which is really just a pain, and I wouldn't even bother).

Easy way out: Instead I decided to remove the "EXIT" option, which really achieved nothing special. It has the same functionality as pressing "b" in console.

So what I ended up doing is reorganizing the data table and the descriptions table (fixing minor pointer details). It currently looks like this:

In this order and descriptions updated to match the order of appearance. I've also taken the time to remove "exit" from the normal menu in general for consistency.
The hex changes below are rather numerous, but that is because I changed the order items appeared on the menu. If you wanted to just overwrite "Exit" then get the hex version of the string you are trying to replace it with, put it into free space and fix the pointers (I will explain that shortly)
For this just ctrl + C this:
Code:
7D 62 41 08 11 F4 06 08 66 5A 41 08 4D F4 06 08 85 62 41 08 81 F4 06 08 30 A4 71 08 51 A4 71 08 8E 62 41 08 B5 F4 06 08 96 62 41 08 FD F4 06 08 91 62 41 08 E9 F4 06 08 9D 62 41 08 41 F5 06 08 A2 62 41 08 55 F5 06 08 00 01 01 0A 04 0F 08 00 76 9F 41 08 BB 9F 41 08 01 A0 41 08 34 A4 71 08 49 A0 41 08 B7 A0 41 08 6F A0 41 08 11 A1 41 08 49 A0 41 08 F8 01 00 00 00 02 0F 1A 04 0F 98 01 FF 00 00 00 00 00 00 00 00 01 01 0E 09 0D 08 00 01 02 03 00 01 04 05 00 01 06 07 00 00 00 00 00 00 00 B0 BB 00 B0 BB AA 00 AB BA AA 00 AB 99 BB B0 BB 99 BA B0 AA AB BA B0 AA AB BB 00 00 00 00 00 00 00 00 0B 00 00 00 0B 00 00 00 BB B0 0B 00 AA AB BA 00 AA 99 AA 0B BB 99 BB 0B 00 BB B4 BB 00 44 44 4F 40 FD 4F F4 40 DF 4F 44 00 44 44 FD 00 FF D4 DF 00 00 F4 FD 00 00 40 44 AA BA AA 0B AB BA AA 0B B4 4B BB 00 F4 44 F4 0F 4F 44 44 FF 4F FF DF F4 F4 F4 FD 04 FF 4F 44 00 00 00 00 00 00 00 B0 0B 00 BB AB BA B0 AA AB BA B0 9A B9 BB BB 9B A9 BB AB BA AA AB AB BA BA AB 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B BB 00 00 BA AA 0B 00 9A A9 BA 00 B0 4B BB BB 00 44 44 AB 40 FD 4F BF 40 DF 4F 44 00 44 44 FD 00 FF D4 DF 00
and ctrl+b at 0x3A7344. (basically you want to overwrite the bytes at 0x3A7344 with this)


If you plan to change some pointers here is the format (credits to knizz for his database):
Spoiler:

starting at 0x3A7344:
[pointer to text][pointer to function][pointer to text2][pointer to function2]
Where the pointer to text is a pointer to things like "Pokedex", "Pokemon", "Bag" and pointer to function is a pointer to the function which is executed when that menu option is selected.
Further along, at 0x3A7394, there is just a bunch of string pointers which indicate the text descriptions for when you hover over a menu item. For example, hovering over the the MAP that I inserted will just simply say "A MAP of the region".


If you are manually inserting, then I hope you remember the offset you assembled the ASM script from before. You need to ctrl+f 30 A4 71 08 51 A4 71 08 from my hex paste above. The first half of that is a pointer to the string (my case was "Map" the second half is a pointer to the function i.e the one we assembled earlier. The function's pointer is in reverse hex +1 and the string pointer is just in reverse hex).


The Bug fix:



Alright, so far if you run the game, you'll get a program that pulls out a map menu somewhere along the lines, but you'll notice there are two occurrences of it, that and it's very buggy before and after you get a Pokemon in your party. Well, lets fix that.

Current code vs. my algorithm:
Spoiler:

The code which causes these "errors" basically goes like this:
checkflag Pokedex
if 0x1 add Pokedex to menu
checkflag Pokemon
if 0x1 add Pokemon to menu
add bag to menu
add options to menu
add save to menu
add exit to menu

This code works almost well, but we changed the order around, so we need to change how this code works to something like this:

checkflag Pokedex
if 0x1 add Pokedex to menu
call part 2
add bag to menu
add options to menu
add save to menu


part 2:
checkflag Pokemon
if 0x1 add Pokemon to menu and add MAP to menu
else return
add bag to menu
add options to menu
add save to menu
(yes this seems small it, but it matters).


The code to do this is simple, first compile this into free space:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r4-r5}
	mov r4, r1 @save r1 contents
	ldr r0, =  0x828
	ldr r1, = (0x806E6D0 +1) @checkflag
	bl linkerOne
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	bne end
	mov r0, #0x1 @load rest of menu manually
	ldr r1, = (0x806ED94 +1) 
	bl linkerOne
	mov r0, #0x2
	ldr r1, = (0x806ED94 +1)
	bl linkerOne
	mov r0, #0x3
	ldr r1, = (0x806ED94 +1)
	bl linkerOne
	mov r0, #0x4
	ldr r1, = (0x806ED94 +1)
	bl linkerOne
	mov r0, #0x5
	ldr r1, = (0x806ED94 +1)
	bl linkerOne
	mov r0, #0x6
	ldr r1, = (0x806ED94 +1)
	bl linkerOne
	pop {r4-r5}
	pop {r0} @put separately for readability 
	bx r0
	

end:
	pop {r4-r5}
	ldr r0, =(0x806EDDA +1) @if no party
	bx r0


linkerOne:
	bx r1
	

.align 2


Now go to 0x6EDC6 and overwrite the bytes there with:
01 48 00 47 00 00
The next 4 bytes after these 6 is the pointer to the above assembled code + 1 in reverse hex.
What the above does is creates a branch from the initial flagcheck into our routine.

Finally we need to modify the order that the other menus come up pre-map availablity.
Go to 0x6EDD0 and ctrl+b this:
Code:
01 28 02 D1 01 20 FF F7 DD FF 02 20 FF F7 DA FF 04 20 FF F7 D7 FF 05 20 FF F7 D4 FF 06 20 FF F7 D1 FF 06 20 00 00 00 00 01 BC 00 47 29 08 00 00

End:



I hope you find the above research/explanations useful. I tried to explain the start menu a little bit extra, even though it was slightly out of context, because I hope to see more hacks editing it.

Credits to knizz for helping me with the research and to Touched for helping with an alignment bug.
If you find any bugs please report them to me via this thread or PM :3

Uhh, oh right link to patch: http://www.mediafire.com/download/bzb2m5w6bzbdzyx/PFR.ips
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #9    
Old November 22nd, 2014 (12:05 AM).
KDS's Avatar
KDS
 
Join Date: Jul 2013
Age: 20
Gender: Male
This is a really wonderful feature. Now, people who like using Hydro Pump on water Pokemon (or like keeping a physical one) and Brave Bird or Hurricane on Flying Pokemon will not be forced to use a HM Slave for Surf or Fly (unless they don't have a water or flying type).
A ton of likes for this!!
  #10    
Old November 22nd, 2014 (07:29 AM).
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by KDS:
This is a really wonderful feature. Now, people who like using Hydro Pump on water Pokemon (or like keeping a physical one) and Brave Bird or Hurricane on Flying Pokemon will not be forced to use a HM Slave for Surf or Fly (unless they don't have a water or flying type).
A ton of likes for this!!
Yeah that was the intention. I should also mention that the existing HM mechanisms still work. So if you have a Pokemon that's not a water type but has the move surf, you can still surf :)

I'm off to tackle the next HM, which happens to be Flash. Sadly, I don't know what to do for this. I can't really add another Start Menu option :/
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #11    
Old November 22nd, 2014 (08:50 AM). Edited November 22nd, 2014 by LocksmithArmy.
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
I got flash to work as a script, no asm... but its the circle around you not a full screen flash. And it goes away every battle or warp...

Spoiler:
#org @start
'-----------------------------------
#raw 0x9A
#raw 0x01
msgbox @talk
callstd MSG_NOCLOSE ' Non-closing message
releaseall
end

#org @talk
'-----------------------------------
= \v\h01 turned on the\nFLASHLIGHT.

scripted in PKSV

I got ALL the HMs except the ones youve outlined in this thread(Surf, fly, and waterfall) to work as items with only scripting. of course my flash item isnt perfect (as outlined above)
__________________
  #12    
Old November 22nd, 2014 (09:07 AM).
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by LocksmithArmy:
I got flash to work as a script, no asm... but its the circle around you not a full screen flash. And it goes away every battle or warp...
How did you manage that without the move?
edit:
Quote:
#raw 0x9A
#raw 0x01
I have no idea what that does, mind explaining?
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #13    
Old November 22nd, 2014 (09:41 AM). Edited November 22nd, 2014 by LocksmithArmy.
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
Quote originally posted by FBI agent:
How did you manage that without the move?
edit:

I have no idea what that does, mind explaining?
#raw is just a hex digit... pksv does not recognize that command... but 9A is a command that makes the light circle around the player larger.

the second #raw is the size... but its not direct 01 was nearly the full screen, 02 was half that... anything else seemed to crash the game, or do nothing (i did not test every digit, just several others).

it resets after each battle or warp but it makes a fine flashlight item... not as good as the HM but good enough.

in my mind, its perfect cause it punishes the player for not using the HM... (in my game you get both, the HM and the item). the HM clearly sucks wasting a move slot, and the item sucks cause you have to reuse it and its not complete full screen flash... BUT they both work and I personally would rather deal with pushing select after each battle for a couple caves than wasting amove... just sayin.

I have a similar delima for cut... the HM can actually cut grass, my item (a sickle) cannot... it only cuts trees... but honestly who cuts grass anyway.
__________________
  #14    
Old November 22nd, 2014 (09:55 AM). Edited November 22nd, 2014 by FBI agent.
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by LocksmithArmy:
#raw is just a hex digit... pksv does not recognize that command... but 9A a command that makes the light circle around the player larger.

the second #raw is the size... but its not direct 01 was nearly the full screen, 02 was half that... anything else seemed to crash the game.

it resets after each battle or warp but it makes a fine flashlight item... not as good as the HM but good enough.
Thanks, but looks like this isn't even necessary.

I looked at the routine that handles flash and it seems to be very easy to replicate. Infact, you'll be relieved to hear you can do it in a script. Most of the routine handled checks, the size of the flash and other small complications. To flash the entire screen we just ignore these restrictions. The string of commands which PKSV recognizes as:
lightroom 0x0
darkenroom 0x0
and XSE recognizes as:
lighten 0x0
darken 0x0

darken 0x0, contrary to it's name, also seems to keep the room lit after wild battles. However, if you warp, the "flash" effect will wear off. So the game sets a special flag "0x806". It seems like if this flag is set then even if you warp, the cave will remain flashed :)

Insert this into a level script to have a functioning "FLASH" whenever you enter a flash-able cave. Right now it only does electric types, but with a little bit of editing it can be changed to include others (Fire perhaps?)
note: requires my edited special 0x12b

Spoiler:

Code:
#dyn 0x740000
#org @start
checkflag 0x806
if 0x1 jump :end
special INIT_STEPCOUNT
compare LASTRESULT 0x2
if == jump :end
lockall
setvar 0x8000 0x2
special2 0x4001 0x12B
compare 0x4001 0x6
if >= jump :end
storepartypokemon 0x0 0x4001
msgbox @useFlash
callstd MSG_YESNO
compare LASTRESULT NO
if == jump :end
setanimation 0x0 0x4001
doanimation 0x2
lightroom 0x0
darkenroom 0x0
setflag 0x806
msgbox @finished
callstd MSG_NORMAL
:end
release
end

#org @useFlash
= \v\h02 can light up the\ndarkness with FLASH. Use it?

#org @finished
= \v\h02 used FLASH!


EDIT: Oh so Locksmith for your flashlight you'd just have it do
Code:
lightenroom 0x0
darkenroom 0x0
setflag 0x806
msgbox @whatever
...
EDIT2: That concludes my HM crusade, I guess. I wasn't expecting Flash to be just done by a script :/
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #15    
Old November 22nd, 2014 (10:08 AM). Edited November 23rd, 2014 by LocksmithArmy.
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
thanks... thats y we have awesome ASM hackers, to find scripts us scripters cant find lol.

FYI: the above script is tested and works as an item.
Code:
lightroom 0x0
darkenroom 0x0
setflag 0x806
msgbox @whatever
...
except that its lightroom not lightenroom
__________________
  #16    
Old December 8th, 2014 (03:41 AM).
pokemontutorialTV's Avatar
pokemontutorialTV
 
Join Date: Feb 2014
Location: Germany, K-Town
Gender: Male
Nature: Calm
Send a message via Skype™ to pokemontutorialTV
Could you modify the asm, so it checks a specific teamslot (or starts at slot X)? That would be so cool I want to make a feature, that poisions your Pokémon, if you go over toxic bushes.
I just need to check for poision and steel-type in my team.
__________________
Making Youtube Videos about Pokémon.
_______________________________________________
Pokémon Zoisit:

_______________________________________________
My Youtube Channel with over 1000 videos to Pokémon: http://www.youtube.com/user/pokemontutorialTV
  #17    
Old December 8th, 2014 (10:44 AM).
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by pokemontutorialTV:
Could you modify the asm, so it checks a specific teamslot (or starts at slot X)? That would be so cool :) I want to make a feature, that poisions your Pokémon, if you go over toxic bushes.
I just need to check for poision and steel-type in my team.
Hi, this has nothing to do with HMs! For the feature that you're talking about, you would have to have a routine which runs on every step. Inside said routine, you would need to check the tile's behavior byte and dependently set an attribute to the Player's Pokemon. I see what you mean about making poison and steel types immune. I can tell you that all of the things I've mentioned can be done in a routing, though somewhat tediously.

Sadly, this isn't a request thread, and the ASM request thread doesn't take specific requests. Maybe if you ask kindly enough, the amazing person who runs the request thread will make an exception :P
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #18    
Old December 8th, 2014 (01:41 PM).
pokemontutorialTV's Avatar
pokemontutorialTV
 
Join Date: Feb 2014
Location: Germany, K-Town
Gender: Male
Nature: Calm
Send a message via Skype™ to pokemontutorialTV
It has nothing to do with the surf-modification, i need the special modifikation, but i dont know how to do this. The other asm-routines to poison the pokemon, are already inside my hack. But the problem is, also Pokémon of Poision an d Steel Types can be poisioned, and i dont want that.
__________________
Making Youtube Videos about Pokémon.
_______________________________________________
Pokémon Zoisit:

_______________________________________________
My Youtube Channel with over 1000 videos to Pokémon: http://www.youtube.com/user/pokemontutorialTV
  #19    
Old December 8th, 2014 (01:50 PM).
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by pokemontutorialTV:
It has nothing to do with the surf-modification, i need the special modifikation, but i dont know how to do this. The other asm-routines to poison the pokemon, are already inside my hack. But the problem is, also Pokémon of Poision an d Steel Types can be poisioned, and i dont want that.
I see, I would argue that it's easier to modify your Pokemon poisoning routine to not poison if the Pokemon is steel or poison type, rather than modifying this special.

Here's an ASM request thread where you can ask a kind soul to help you with your implementation:
http://www.pokecommunity.com/showthread.php?t=339153
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #20    
Old December 8th, 2014 (02:10 PM).
pokemontutorialTV's Avatar
pokemontutorialTV
 
Join Date: Feb 2014
Location: Germany, K-Town
Gender: Male
Nature: Calm
Send a message via Skype™ to pokemontutorialTV
This isnt as easy as it seems, because it en- and decrpts all 100 bytes of Pokémondata in one Routine. Sadly the type isnt part of this structure...
__________________
Making Youtube Videos about Pokémon.
_______________________________________________
Pokémon Zoisit:

_______________________________________________
My Youtube Channel with over 1000 videos to Pokémon: http://www.youtube.com/user/pokemontutorialTV
  #21    
Old December 8th, 2014 (02:31 PM).
FBI agent's Avatar
FBI agent
Ally to good, nightmare to you!
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Quote originally posted by pokemontutorialTV:
This isnt as easy as it seems, because it en- and decrpts all 100 bytes of Pokémondata in one Routine. Sadly the type isnt part of this structure...
I know how it works, lol. What I'm saying is that I'm unwilling to complete your request in this thread. Now be good and use the request thread for requests :P

Also if anyone else has questions regarding this/routines in this ask in my request thread or VM.

Request thread:http://www.pokecommunity.com/showthread.php?t=339153
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter. I ran an ASM request/resource thread feel free to check that out!
  #22    
Old December 8th, 2014 (02:40 PM).
Christos's Avatar
Christos
do you even gift?
 
Join Date: Feb 2006
Location: Went's room
Gender: Male
Nature: Serious
Send a message via Skype™ to Christos
Thread closed as per the owner's request.

__________________
Closed Thread
Quick Reply

Sponsored Links
Thread Tools

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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:31 AM.