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
  #1076   Link to this post, but load the entire thread.  
Old January 23rd, 2017 (6:47 AM).
EddyHg80's Avatar
EddyHg80 EddyHg80 is offline
 
Join Date: Jan 2014
Age: 26
Gender: Male
Posts: 32
Quote:
Originally Posted by Starfall321 View Post
I found that how frustration when playing some Emerald hack with bad egg/event corruption caused by usage of unsafe flag/var.
IDK if anyone had already port Jambo's routine to Emerald because I can't find any relevant post ATM.

Emerald safe variables hack
Spoiler:

@Goto 0x9d650, change the code here to 00 48 00 47 [asm location +1 reverse pointer]
@Goto 0x9D664, change the bytes here to 00 00
@Usable range :0x4000-0x40FF,0x5000-0x51FF,0x8000 - 0x8016
@credit to Jambo51 for his awesome routine for Fire Red.
.align 2

VAR4000_40FF:
mov r0, #0x40
lsl r0, r0, #0x8
cmp r1, r0
blt exit

mov r0, #0x41
lsl r0, r0, #0x8
cmp r1, r0
blt normal

VAR5000_5200:
mov r0, #0x50
lsl r0, r0, #0x8
cmp r1, r0
blt exit

lsl r0, r1, #0x10
cmp r0, #0x0
blt alt

mov r0, #0x52
lsl r0, r0, #0x8
cmp r1, r0
bge exit

MEMORY_LOCATION:
mov r0, #0x50
lsl r0, r0, #0x8
sub r1, r1, r0
lsl r1, r1, #0x1
ldr r0, =0x0203db00 @save block location, 1 var cost 2 bytes so you will need 0x400 bytes here.
add r0, r0, r1


exit2: pop {r1}
bx r1

exit: mov r0, #0x0
b exit2

normal: ldr r0, =0x0809D67C+1
bx r0
alt: ldr r0, =0x0809D664+1
bx r0



Emerald safe flag hack
Spoiler:

@Goto 0x9d702, change the code here to, 0000 0048 0047 [asm location +1 reverse pointer]
@Credit to Jambo51 for original routine
@Not sure how flags >0x1900 working, technically it should not work but I never do massive test.
@In case you want to be safe, just never set a flag >0x1900.
@New safe flag range :0x900-0x18FF, you can still using 0x0-0x900 range.

.align 2
FLAG900_1900:
mov r0, #0x9
lsl r0, r0, #0x8
cmp r2, r0
blt normal
mov r0, #0x19
lsl r0, r0, #0x8
cmp r2, r0
bge noget

mov r0, #0x9
lsl r0, r0, #0x8
sub r2, r2, r0
lsr r1, r2, #3
ldr r0, =0x0203df00 @save block location, a total of 0x1000 flags cost 0x200 bytes here
exit: add r0, r0, r1
pop {r1}
bx r1

normal: ldr r0, =0x03005d8c
ldr r0, [r0, #0]

there: lsr r1, r1, #0x13
ldr r2, =0x1270
add r1, r1, r2
b exit

noget: add r0, r2, #0x0
b there


Pls tell me if any bug found.
Hi, I tried expanding the variables and I noticed several sprite problems like this: (the bag is gone)
Reply With Quote
  #1077   Link to this post, but load the entire thread.  
Old January 23rd, 2017 (1:25 PM). Edited January 23rd, 2017 by BluRose.
BluRose BluRose is offline
blu rass
 
Join Date: Apr 2014
Location: michigan tech
Age: 22
Gender: Male
Nature: Timid
Posts: 812
smh nathan closing tabs like what the hell

EXPANDING THE THING THAT MAKES NIDORAN'S/ILLUMISE'S MALE VARIANTS HATCH FROM EGGS
based on a table

first, the routine:
Spoiler:
Code:
.text
.align 2
.thumb

@ hook via r1 (00 49 08 47 XX+1 XX XX XX) at 46068 (BPRE) / 70858 (BPEE) / 415F6 (AXVE)

main:
	ldr r7, terminate
	mov r3, #0x0
loop:
	ldr r0, table
	lsl r2, r3, #0x1
	add r2, r0, r2
	ldrh r5, [r2, #0x0]
	cmp r5, r7
	beq return
	add r3, #0x1
	cmp r5, r4
	bne loop
	mov r0, #0x8C
	lsl r0, r0, #0x1
	add r0, r8
	ldrh r1, [r0]
	mov r0, #0x80
	lsl r0, r0, #0x8
	and r0, r1
	cmp r0, #0x0
	beq return
	ldrh r4, [r2, #0x2]
return:
	ldr r1, getparents
	bx r1

.align 2

getparents:
	.word 0x0804609B	@ 0x0804609B BPRE; 0x0807088D BPEE; 0x08041F88 AXVE
terminate:
	.word 0x0000FEFE @ end the table below with this
table:				@change as is necessary
	.word table1 + 0x[place where you plan on inserting this]
table1:
	.hword 0x001D		@ nidoran female
	.hword 0x0020		@ nidoran male
	.hword 0x0183		@ illumise
	.hword 0x0182		@ volbeat
				@ theoretical new entries
	.word 0x0000FEFE

usage:
- table at the end has a structure:
[hword] - species 1
[hword] - species 2
an egg that is supposed to be species 1 has a 50% chance of turning into species 2 (note at the bottom), and it NEEDS to end with FE FE 00 00 as it does in the example.
- i included addresses for emerald and ruby as well. replace as desired (the hook address and the getparents routine address)
- you need to know where you are going to insert the routine BEFORE compiling it; the table is placed right after the routine and is referenced as such.

proof of concept:
Spoiler:

first from female bulba x male venusaur, second from male bulba x ditto, third from illumise and volbeat, last from nidoran(f) x ditto


shoutouts to doesntknowhowtoplay for his research on the subject and to chaotix for initial testing and suggesting the idea of a table instead of some extremely inefficient shtuff that was originally going to happen.

notes:
- species 2 does not ever turn into species 1. so you're breeding your volbeat to get an illumise? you'll only ever get volbeat. just add an entry for volbeat to illumise.
- if you want species 1 to turn into multiple species: i have been testing for literally five hours with the game running consistently at about 300% and have yet to see a phanpy come from my illumise. moral of the story: this code, even with modifications telling it to continue looping after setting the id, doesn't support 1 pokémon to multiple.
i did however manage to get illumise and this after doing like a weird chain thing (illumise -> volbeat -> phanpy), but it negated volbeat, and no we'd not like that:

- not tested on bpee or axve but there is no reason it shouldn't work (axve is the same thing while bpee i think interchanges two different registers)
- OH ALSO you have 0x2A bytes of unused space at 46070 for you to use for whatever! knock yourself out with all of that free space
__________________
heyo check out my github:

BluRosie
highlights:
battle engine for heartgold
various feature branches in heart gold (fairy type, odd egg, mud slopes)

i'm a big part of the development team of pokemon firegold! all the code that i develop for that hack is also on my github

also on discord: BluRose#0412
Reply With Quote
  #1078   Link to this post, but load the entire thread.  
Old January 25th, 2017 (4:36 AM). Edited January 25th, 2017 by Phantom Phoenix.
Phantom Phoenix's Avatar
Phantom Phoenix Phantom Phoenix is offline
Lost on the road of life
 
Join Date: Oct 2015
Location: ???
Age: 26
Gender: Male
Nature: Calm
Posts: 167
I know jpan's engine has a pedometer. But I don't know vanilla FR has one or not. So, here it is.
Code:
.text
.align 2
.thumb
.thumb_func

main:
push { r0-r2,lr }
mov r0, #0x5
ldr r1, sav1_get_secure
bl linker
ldr r2 , var
strh r0, [ r2 , #0x0 ]
pop { r0-r2, pc }

linker:
bx r1


.align 2
sav1_get_secure:     .word 0x08054EC5
var:                            .word 0x020370c0
You can count players steps now! It will be stored in last result or var 800d after you callasm this routine.
First asm :)
Thanks to Touched for answering my noob asm questions.
__________________
Pokemon XYZ Version
Reply With Quote
  #1079   Link to this post, but load the entire thread.  
Old January 27th, 2017 (5:04 PM).
DarkPsychic's Avatar
DarkPsychic DarkPsychic is offline
 
Join Date: Jul 2012
Location: CO
Gender: Male
Nature: Timid
Posts: 146
So I had a problem with buffering a 4byte number in a message script for viewing the players bank balance in my hack.

I brought it up in a IRC and FBI had given me a basic routine but it wasn't complete or tailor made to my needs.
Now I have fixed it all up to my needs and would like to share what I have.

Spoiler:

-----------------------------------------------Custom4byteBuffer----------------------------------------------------------------------------------------------
@Thumb routine to be placed at an aligned location ('0, 4, 8, C') then called with xse command callasm + 1 ;also delete all comments before compiling
.text
.align 2
.thumb
.thumb_func



main:
push {r4, lr}
ldr r0, =(0x20370C8) @ var_8008-var_8009 = String to be displayed in bufferstring 0x0 (contents are stored in gen3 font code)
ldr r1, Free_Ram @ Value to be printed = min-0x0 -- max-0xFFFFFF7F (in decimal = 0 - 2,147,483,647) User must store their value here
ldr r1, [r1]
mov r2, #0x1 @ r2 seem to be the Display now byte ;for the routine at 0x8008E78
mov r3, #0xA @ r3 as the number of digits that will be printed ergo 0xA = 10 digits ;for the routine at 0x8008E78
ldr r4, =(0x8008E78 +1) @ A in game function to convert a number_to_string
bl linker
pop {r4, pc}

linker:
bx r4

.align 2

Free_Ram:
.word 0x203C010


------------------------------------------------ExtraInfo--------------------------------------------------------------------------------------------------
FR Font table code:
Here's a table of all the hex codes for the numbers 0-9:
Spoiler:
A1=0
A2=1
A3=2
A4=3
A5=4
A6=5
A7=6
A8=7
A9=8
AA=9



#Function
number_to_string: .word 0x08008E79 = converts number_to_string
/*receives
r0 as string location
r1 as number to print
r2 seem to be the Display now byte
r3 as the number of digits*/



#Free ram area
1byte = 0x203C010 = 1 - 255
2byte = 0x203C011 = 256 - 65535
3byte = 0x203C012 = 65536 - 16777215
4byte = 0x203C013 = 16777216 - 2147483647


------------------------------------------------XSEScript---------------------------------------------------------------------------------------------------

XSE Script for testing:

#dynamic 0xC00612

#org @start
lockall
faceplayer
setvar 0x40FE 0xFFFF '/Used in my bank var -first 4bytes
setvar 0x40FF 0xFF7F '/Used in my bank var -second 4bytes
copyvar 0x800A 0x40FE '/copys var_40FE to var_800A
copyvar 0x800B 0x40FF '/copys var_40FF to var_800B
copybyte 0x203C010 0x20370CC '/store-var800A-upperbyte to free ram
copybyte 0x203C011 0x20370CB '/store-var800A-lowerbyte to free ram
copybyte 0x203C012 0x20370CD '/store-var800B-upperbyte to free ram
copybyte 0x203C013 0x20370CE '/store-var800B-lowerbyte to free ram
msgbox @testAsm 0x6
callasm 0x750001 '/Where I put the ASM routine + 1
bufferstring 0x0 0x20370C8 '/2b Script variable 0x8008
msgbox @amount 0x6
releaseall
end

#org @testAsm
= Generating your account balance.\nOne momenent please...\l...\l...


#org @amount
= Ok!\nYour account balance is\l[$]: [buffer1]



As it is it works rather well and have had no bugs so far that I can see at least.
There might be a better way to do this but as it stands I haven't seen it.

Also I am now putting all I have together and will release a custom Bank Account system that will include:
Pokemart Inflation/Deflation, Battle Money to Var (can store up to 4bytes or 0xFFFF FFFF) depending on setflag 0x250, ATM, Buffer 4byte number (though it can only print max 0xFFFF FF7F), Account Interest, Withdraw/Deposit/Balance and Loans.

Anyway hope this is helpful!
Reply With Quote
  #1080   Link to this post, but load the entire thread.  
Old January 28th, 2017 (7:33 AM). Edited January 28th, 2017 by Phantom Phoenix.
Phantom Phoenix's Avatar
Phantom Phoenix Phantom Phoenix is offline
Lost on the road of life
 
Join Date: Oct 2015
Location: ???
Age: 26
Gender: Male
Nature: Calm
Posts: 167
Quote:
Originally Posted by linobigatti View Post
anyone can please create/find a routine to create a clock (for fire red) That when the time runs out you will restart the mission?

You want a routine which will end/restart a mission if your given time is over?
Not sure if this will help you but you can try this routine.
Timer in FR
Spoiler:

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

main:
push {r0-r5}
mov r0, #0x92
lsl r0, r0, #0x2
ldr r2, checkflag
bl linker
cmp r0, #0x0
beq over

ldr r0, playerData
ldr r0, [r0]
add r0, r0, #0xE
ldrh r1, [r0]
mov r3, #0x3c
mul r1, r1 , r3
add r0, r0, #0x2
ldrb r2, [r0]
add r1, r1, r2
mov r2, r1
mov r0, #0x93
lsl r0, r0, #0x2
ldr r1, checkflag
bl linker1
cmp r0, #0x1
beq checkTimer
ldr r0, =0x4011
mov r1, r2
ldr r3, setvar
bl linker3
mov r0, #0x93
lsl r0, r0, #0x2
ldr r1, setflag
bl linker1

checkTimer:
ldr r0, playerData
ldr r0, [r0]
add r0, r0, #0xE
ldrh r1, [r0]
mov r3, #0x3c
mul r1, r1 , r3
add r0, r0, #0x2
ldrb r2, [r0]
add r1, r1, r2
mov r5, r1
ldr r0, =0x4011
ldr r1, loadvar
bl linker1
sub r4, r5, r0
ldr r3, var_8002
ldrh r3, [r3]
cmp r4, r3
bne over
ldr r0, =0x4012
ldr r1, loadvar
bl linker1
ldr r2, setflag
bl linker
mov r0, #0x92
lsl r0, r0, #0x2
ldr r2, clearflag
bl linker
b over
.ltorg

over:
pop {r0-r5}
ldr     r1, [r2]
ldrb    r0, [r1,#0x11]
cmp   r0, #0x59
bls  end
ldr r0, =(0x0805489C + 1 )
bx r0

linker:
bx r2

linker1:
bx r1

linker3:
bx r3

end:
pop {r0}
bx r0

.align 2
loadvar:                 .word 0x0806E569
setvar:                   .word 0x0806E585
var_8002:              .word 0x020370BC
setflag:                  .word 0x0806E681
checkflag:             .word 0x0806e6d1
playerData:           .word 0x0300500C
clearflag:               .word 0x0806E6A1

info:
1.This routine uses safe var 4011, 4012,8002 and flag 248 and 24c
2. Flag 248 is used to start the timer
3. 8002 is used to know how many minutes mission will continue
How to use:
1.insert this hook at 0x054894
00480047 xx+1 yy zz (xx yy zz is where u inserted the routine)
2.In The script which will start the timer based event you have to write this three line
setvar 0x8002 0xXX (XX = the minutes you want event to run )
setvar 0x4012 0xYY {YY = flag you want to set be if event is not finished in time )
setflag 0x248 (start the timer)
-------------------------------------
Now that you have started the timer this routine will run every second and when your given time in var 8002 is over it will set a flag (which is also given in var 4012). Depending on that flag in var 4012 you can determine mission is over / restart the mission / time over can't redo the mission etc.
Note: If player finishes the task in the mission you will obviously wouldn't want the timer to continue.So, clearflag 248 and 24C in that script
.
__________________
Pokemon XYZ Version
Reply With Quote
  #1081   Link to this post, but load the entire thread.  
Old January 29th, 2017 (4:37 PM).
linobigatti linobigatti is offline
 
Join Date: Dec 2016
Posts: 10
Quote:
Originally Posted by Phantom Phoenix View Post
You want a routine which will end/restart a mission if your given time is over?
Not sure if this will help you but you can try this routine.
Timer in FR
Spoiler:

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

main:
push {r0-r5}
mov r0, #0x92
lsl r0, r0, #0x2
ldr r2, checkflag
bl linker
cmp r0, #0x0
beq over

ldr r0, playerData
ldr r0, [r0]
add r0, r0, #0xE
ldrh r1, [r0]
mov r3, #0x3c
mul r1, r1 , r3
add r0, r0, #0x2
ldrb r2, [r0]
add r1, r1, r2
mov r2, r1
mov r0, #0x93
lsl r0, r0, #0x2
ldr r1, checkflag
bl linker1
cmp r0, #0x1
beq checkTimer
ldr r0, =0x4011
mov r1, r2
ldr r3, setvar
bl linker3
mov r0, #0x93
lsl r0, r0, #0x2
ldr r1, setflag
bl linker1

checkTimer:
ldr r0, playerData
ldr r0, [r0]
add r0, r0, #0xE
ldrh r1, [r0]
mov r3, #0x3c
mul r1, r1 , r3
add r0, r0, #0x2
ldrb r2, [r0]
add r1, r1, r2
mov r5, r1
ldr r0, =0x4011
ldr r1, loadvar
bl linker1
sub r4, r5, r0
ldr r3, var_8002
ldrh r3, [r3]
cmp r4, r3
bne over
ldr r0, =0x4012
ldr r1, loadvar
bl linker1
ldr r2, setflag
bl linker
mov r0, #0x92
lsl r0, r0, #0x2
ldr r2, clearflag
bl linker
b over
.ltorg

over:
pop {r0-r5}
ldr     r1, [r2]
ldrb    r0, [r1,#0x11]
cmp   r0, #0x59
bls  end
ldr r0, =(0x0805489C + 1 )
bx r0

linker:
bx r2

linker1:
bx r1

linker3:
bx r3

end:
pop {r0}
bx r0

.align 2
loadvar:                 .word 0x0806E569
setvar:                   .word 0x0806E585
var_8002:              .word 0x020370BC
setflag:                  .word 0x0806E681
checkflag:             .word 0x0806e6d1
playerData:           .word 0x0300500C
clearflag:               .word 0x0806E6A1

info:
1.This routine uses safe var 4011, 4012,8002 and flag 248 and 24c
2. Flag 248 is used to start the timer
3. 8002 is used to know how many minutes mission will continue
How to use:
1.insert this hook at 0x054894
00480047 xx+1 yy zz (xx yy zz is where u inserted the routine)
2.In The script which will start the timer based event you have to write this three line
setvar 0x8002 0xXX (XX = the minutes you want event to run )
setvar 0x4012 0xYY {YY = flag you want to set be if event is not finished in time )
setflag 0x248 (start the timer)
-------------------------------------
Now that you have started the timer this routine will run every second and when your given time in var 8002 is over it will set a flag (which is also given in var 4012). Depending on that flag in var 4012 you can determine mission is over / restart the mission / time over can't redo the mission etc.
Note: If player finishes the task in the mission you will obviously wouldn't want the timer to continue.So, clearflag 248 and 24C in that script
.
incredible!thankyou so much!
Reply With Quote
  #1082   Link to this post, but load the entire thread.  
Old February 1st, 2017 (10:20 AM).
Wen's Avatar
Wen Wen is offline
 
Join Date: Apr 2015
Location: Italy
Gender: Male
Posts: 7
Wow, no one's ever ported Emerald's tag battle with Steven to Fire Red? Well this is a surprise... it would be pretty cool though. I think Andrea, the maker of Pokémon Giratina's Legend, has ported it to Ruby. If that's possible in Ruby, it has to be possible in Fire Red too, right?
Reply With Quote
  #1083   Link to this post, but load the entire thread.  
Old February 1st, 2017 (11:38 AM).
BluRose BluRose is offline
blu rass
 
Join Date: Apr 2014
Location: michigan tech
Age: 22
Gender: Male
Nature: Timid
Posts: 812
Quote:
Originally Posted by Wen View Post
Wow, no one's ever ported Emerald's tag battle with Steven to Fire Red? Well this is a surprise... it would be pretty cool though. I think Andrea, the maker of Pokémon Giratina's Legend, has ported it to Ruby. If that's possible in Ruby, it has to be possible in Fire Red too, right?
wow, people still ask questions passive-implicatively without actually asking anything?
i mean people have done it but it's not separate from the community hack atm and touched doesn't suggest using it
__________________
heyo check out my github:

BluRosie
highlights:
battle engine for heartgold
various feature branches in heart gold (fairy type, odd egg, mud slopes)

i'm a big part of the development team of pokemon firegold! all the code that i develop for that hack is also on my github

also on discord: BluRose#0412
Reply With Quote
  #1084   Link to this post, but load the entire thread.  
Old February 1st, 2017 (3:15 PM).
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 Wen View Post
Wow, no one's ever ported Emerald's tag battle with Steven to Fire Red? Well this is a surprise... it would be pretty cool though. I think Andrea, the maker of Pokémon Giratina's Legend, has ported it to Ruby. If that's possible in Ruby, it has to be possible in Fire Red too, right?
It's trickier than you think. And I honestly don't believe someone was able to port it to Ruby.
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
Reply With Quote
  #1085   Link to this post, but load the entire thread.  
Old February 2nd, 2017 (4:53 AM).
PufferJumps's Avatar
PufferJumps PufferJumps is offline
 
Join Date: Jul 2016
Location: Philippines
Gender: Male
Nature: Jolly
Posts: 39
Hello Sirs. I have a question regarding this code:
Spoiler:
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
I've noticed significant demand for working Dawn Stone evolutions, specifically ones that require the mon to be a specific gender. My bad if this is already posted somewhere but here y'all go:

Code:
.org 0x4318e
lsl r0, r0, #0x0
ldr r2, .MethodAddr
bx r2

.MethodAddr: .word 0x085B2521 #UPDATE THIS TO MAIN FUNCTION OFFSET+1


.org 0x5B2520 #UPDATE THIS TO MOST CONVENIENT FREE SPACE IN YOUR HACK
cmp r0, #0x7
beq StandardStone
cmp r0, #0x14 #UPDATE THIS
beq MaleStone
cmp r0, #0x15 #UPDATE THIS
beq FemaleStone
b NoEvo

MaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0x0
beq StandardStone
b NoEvo


FemaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0xFE
beq StandardStone
b NoEvo


StandardStone:
ldrh r0, [r1, #0x2]
cmp r0, r9
beq Finish

NoEvo:
ldr r2, .NoEvoReturn
bx r2

DetermineGender:
ldr r2, .DetermineGenderFunc
bx r2

Finish:
ldr r2, .EvoReturn
bx r2

.NoEvoReturn: .word 0x08043199
.EvoReturn: .word 0x0804317d
.DetermineGenderFunc: .word 0x0803f78d
Change the values in the lines marked UPDATE THIS to the indexes of male stone evos and female stone evos. Leave their entries blank in the general evolution table; stone evolutions function differently from level-up evolutions.


So my question is, where should I put the index of Dawn Stone? 'Cuz I'm new to asm and I think I have to (somewhat) point that out or something.

Also, please correct me if this is wrong.

cmp r0, #0x7
beq StandardStone
cmp r0, #0x14 #UPDATE THIS
<----This is Kirlia
beq MaleStone
cmp r0, #0x15 #UPDATE THIS
<----and this would be Snorunt, right?
beq FemaleStone
b NoEvo


Thanks in advance.
__________________

Yay! Yay! Yay! Yay! Yay! Yay! Yay! Yay! Yay! Yay! Yay!



Reply With Quote
  #1086   Link to this post, but load the entire thread.  
Old February 2nd, 2017 (6:34 AM).
Froosty's Avatar
Froosty Froosty is offline
The_Learner
 
Join Date: Sep 2014
Location: Somewhere in this world.
Age: 25
Gender: Male
Nature: Brave
Posts: 535
Quote:
Originally Posted by PufferJumps View Post
Hello Sirs. I have a question regarding this code:
Spoiler:




So my question is, where should I put the index of Dawn Stone? 'Cuz I'm new to asm and I think I have to (somewhat) point that out or something.

Also, please correct me if this is wrong.

cmp r0, #0x7
beq StandardStone
cmp r0, #0x14 #UPDATE THIS
<----This is Kirlia
beq MaleStone
cmp r0, #0x15 #UPDATE THIS
<----and this would be Snorunt, right?
beq FemaleStone
b NoEvo


Thanks in advance.
Nop those are not pokemon index...

Rather they are the evolution method index...
As evolution by level, trade, and so on.
Look at PGE ini file to know which index you can use for evolution type...
__________________
My works:
TOOL: TL's Quick Enhancer
TUTORIAL: Fire red habitat editing
TUTORIAL: Fire red Transparent text-box


| |
Reply With Quote
  #1087   Link to this post, but load the entire thread.  
Old February 3rd, 2017 (7:40 AM).
Wen's Avatar
Wen Wen is offline
 
Join Date: Apr 2015
Location: Italy
Gender: Male
Posts: 7
Quote:
Originally Posted by DizzyEgg View Post
It's trickier than you think. And I honestly don't believe someone was able to port it to Ruby.
Are you sure about it?
Reply With Quote
  #1088   Link to this post, but load the entire thread.  
Old February 6th, 2017 (9:08 AM).
NewDenverCity's Avatar
NewDenverCity NewDenverCity is offline
 
Join Date: Apr 2014
Location: Antarctica
Gender: Male
Nature: Calm
Posts: 326
So currently the blank slots between Celebi and Treeko always use the Unown's cry. I fixed that.
Code:
.thumb

.equ rom, 0x08000000
.equ offset, 0xXXXXXX @six digits
.equ table, 0x08XXXXXX

.org 0x0720C4
hook:
	ldr r1, hook_thing
	bx r1

.align 2
hook_thing: .word main + rom + 1

.org offset
main:
	cmp r0, #250
	bls continue_normal
	ldr r1, species_cap
	cmp r0, r1
	bls is_slot
continue_normal:
	ldr r2, species_id_thing
	bl jump_with_r2
	mov r7, r0
	mov r1, #0x7F
	ldr r2, return1
	
jump_with_r2:
	bx r2

is_slot:
	sub r0, #0xFB @the lowest slot
	mov r1, #0xC @the length of a cry entry
	mul r0, r1
	ldr r1, table_pointer
	ldr r2, return2
	bx r2

.align 2
species_cap: .word 275
return2: .word 0x0807217C + 1
table_pointer: .word table
species_id_thing: .word 0x08043304 + 1
return1: .word 0x080720CC + 1
The new table you use for those mons should be the same format as the current cry table. If you find any bugs, please tell me so I can patch it.
Reply With Quote
  #1089   Link to this post, but load the entire thread.  
Old February 7th, 2017 (1:37 AM). Edited February 7th, 2017 by SkyVortex.
SkyVortex's Avatar
SkyVortex SkyVortex is offline
 
Join Date: Jan 2017
Location: Ice Path
Gender: Male
Nature: Mild
Posts: 228
Quote:
Originally Posted by The_learner View Post
wanted to make a small request here.
Spoiler:



I wanted this feature to be ported to emerald as well..
I think it would be only a short task of finding the proper pointers,
so if anyone would do it..
then not only me but other emerald hackers would also enjoy it :)
so it my request :)
Since I want the Re-Useable PokéBall feature in Emerald too, I decided to give it a shot but it is still incomplete. Someone else can find the missing parts if they would like to, that would be great. Here is what I have figured out so far through testing:

Found:
Location of bytes "01 21" to change to "00 21": 0x0FE3AA
Var_800E location for Emerald: 0x0203CE7C (which I couldn't find anywhere on the internet for some reason)

Missing:
Emerald's equivalent to FireRed's 0x02D924
What to put instead of "0x809A1D9" in the ASM

Hopefully someone can post the missing parts to complete this.
Reply With Quote
  #1090   Link to this post, but load the entire thread.  
Old February 7th, 2017 (2:39 AM).
Froosty's Avatar
Froosty Froosty is offline
The_Learner
 
Join Date: Sep 2014
Location: Somewhere in this world.
Age: 25
Gender: Male
Nature: Brave
Posts: 535
Quote:
Originally Posted by Sky0fBlades View Post
Since I want the Re-Useable PokéBall feature in Emerald too, I decided to give it a shot but it is still incomplete. Someone else can find the missing parts if they would like to, that would be great. Here is what I have figured out so far through testing:

Found:
Location of bytes "01 21" to change to "00 21": 0x0FE3AA
Var_800E location for Emerald: 0x0203CE7C (which I couldn't find anywhere on the internet for some reason)

Missing:
Emerald's equivalent to FireRed's 0x02D924
What to put instead of "0x809A1D9" in the ASM

Hopefully someone can post the missing parts to complete this.
Well its great you are working on it,

BluRose is also working on it (Not working at the moment but he said he will when he completes his current work) and might be you can talk to him about the missing part ;)
__________________
My works:
TOOL: TL's Quick Enhancer
TUTORIAL: Fire red habitat editing
TUTORIAL: Fire red Transparent text-box


| |
Reply With Quote
  #1091   Link to this post, but load the entire thread.  
Old February 8th, 2017 (12:10 PM). Edited February 10th, 2017 by tkim.
tkim's Avatar
tkim tkim is offline
 
Join Date: May 2011
Posts: 232
Quote:
Originally Posted by FBI View Post
Use special 0x9F to select the Pokemon then callasm.


EV Reducing berries



Spoiler:
Speaking of special 0x9F, I finished EV reducing berries which was rather easy.
First of all, follow this tutorial: http://www.pokecommunity.com/showthread.php?t=258426
until you get to the part where you have to give the item an effect via script.

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

Code:
.text
.align 2
.thumb
.thumb_func

main:
    push {r0-r4, lr}
    ldr r0, = (0x20370C0)
    ldrb r1, [r0]
    ldr r0, =(0x2024284)
    mov r2, #0x64
    mul r1, r1, r2
    add r0, r0, r1
    mov r4, r0
    ldr r2, =(0x20370D0)
    ldrb r1, [r2]
    push {r4}
    ldr r3, =(0x803FBE8 +1)
    bl linker
    pop {r4}
    ldr r2, =(0x20370B8)
    ldrb r3, [r2]
    cmp r3, r0
    bhi NoEffect
    sub r0, r0, r3
    mov r3, r0

end:
    mov r0, r4
    ldr r2, =(0x20370D0)
    ldrb r1, [r2]
    strh r3, [r2]
    ldr r3, =(0x804037C +1)
    bl linker
    pop {r0-r3, pc}

noEffect:
    ldr r2,  =(0x20370d0)
    mov r1, #0xFF
    strb r1, [r2]
    pop {r0-r4, pc}
    

linker:
    bx r3

.align 2
Here's a compiled version:
Code:
1F B5 10 48 01 78 10 48 64 22 51 43 40 18 04 1C 0E 4A 11 78 10 B4 0E 4B 00 F0 13 F8 10 BC 0D 4A 13 78 83 42 FE D8 C0 1A 03 1C 20 1C 07 4A 11 78 13 80 09 4B 00 F0 05 F8 0F BD 04 4A FF 21 11 70 1F BD 18 47 C0 70 03 02 84 42 02 02 D0 70 03 02 E9 FB 03 08 D2 70 03 02 7D 03 04 08


For the part of inserting a script to give your item functionality, you need to insert this script.
Code:
#dyn 0x740000
#org @start
special 0x9f
waitspecial
storepartypokemon 0x0 0x8004 'bufferpokemon2 in xse
setvar LASTRESULT 0x[EV to modify]
setvar 0x8000 0x[amount to decrease EV by]
callasm 0x[routine +1]
compare LASTRESULT 0xFF
if == jump @failed
storevar 0x1 0x800F 'buffervar in xse
msgbox @gain
callstd MSG_NORMAL
removeitem 0x[ID] 0x1
release
end

#org @failed
msgbox @noEffect
callstd MSG_NORMAL
release
end

#org @noEffect
= It would have no effect!

#org @gain
= \v\h02 gained \v\h03\nInsert the EV your berry gives
In variable 0x8000 put the amount the EV is to decrease by.
In variable 0x800D put which EV you want to modify, in this format:
0x1A - HP EV
0x1B - Attack EV
0x1C - Defence EV
0x1D - Speed EV
0x1E - Sp. Attack EV
0x1F - Sp. Defence EV
I would like to request to update this routine to include increasing happiness by 10/5/2 depending on the user's happiness amount upon consumption. This link shows the happiness increase amount.

edit:
Quote:
Originally Posted by FBI View Post

Getting IVs and EVs



Spoiler:
The routines are very similar so I ended up just combining the two routines into one. Basically given a slot number of a Pokemon in 0x8004, the routines will return the EVs or IVs, respectively, into the vars 0x8005-0x800A with 0x8003 as the IV/EV switch.


How to insert:

Compile and insert the following routine into free space:

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
    push {r0-r5, lr}
    mov r4, #0x0
    
loop:
    cmp r4, #0x6
    bhi end
    ldr r0, =(0x20370C0) @var 0x8004 = slot number
    ldrh r0, [r0]
    mov r1, #0x64
    mul r1, r1, r0
    ldr r0, =(0x2024284)
    add r0, r0, r1
    ldr r3, =(0x20370BE)
    ldrh r3, [r3]
    cmp r3, #0x0
    beq EVs
    add r1, r1, #0x27 @IV
    b continue
    
EVs:
    add r1, r1, #0x1A
    
continue:
    ldr r2, =(0x803FBE8 +1)
    bl linker
    mov r1, r0
    @get var
    ldr r2, =(0x20370C2) @using vars 0x8005-0x800A
    lsl r0, r4, #0x1
    add r2, r2, r0
    strh r1, [r2] @store IV in var
    add r4, r4, #0x1
    b loop

linker:
    bx r2
    
end:
    pop {r0-r5, pc}

.align 2



Usage:
setvar 0x8003 0x[anything except 0 = IV, 0 = EV]
setvar 0x8004 0x[slot number 0 to 5]
callasm 0x[this routine +1]

The variables will be:
0x8005: HP IV/EV
0x8006: Atk IV/EV
0x8007: Def IV/EV
0x8008: Spd IV/EV
0x8009: S.atk IV/EV
0x800A: S.def IV/EV

Another request for the Get EV/IV routine to store highest value EV/IV var in 0x800B and sum of total EV/IV in var 0x800C, please!
Reply With Quote
  #1092   Link to this post, but load the entire thread.  
Old February 10th, 2017 (11:04 AM).
NewDenverCity's Avatar
NewDenverCity NewDenverCity is offline
 
Join Date: Apr 2014
Location: Antarctica
Gender: Male
Nature: Calm
Posts: 326
So I don't know where else to put this because it incorporates abilities, items, and other gen 6 stuff. Oh well. It's Safety Goggles, part of Magic Guard, part of Overcoat, part of Bulletproof, and the Gen 6+ Grass type immunity to spore moves. Knock yourselves out.
Code:
.thumb

.equ rom, 0x08000000
.equ offset, 0xXXXXXX @six digits
.equ powder_table_offset, 0xXXXXXXXX @8 digits
		@table is hwords of move ids repeating, ends with FFFF
.equ Grass_Type, 0xC
.equ Overcoat, 0xXX
.equ Bulletproof, 0xXX
.equ Magic_Guard, 0xXX
.equ Safety_Goggles, 0xXX @held item effect

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.org 0x01AB32
effect_spore_hook:
	ldr r0, pointer1
	bx r0
.align 2
pointer1: .word effect_spore_things + rom + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.org 0x01D7D8
powder_moves_hook:
	ldr r1, pointer2
	bx r1
.align 2
pointer2: .word grass_immune_start + rom + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.org 0x028D4A
jump:
	bx r0

.org 0x028DC4
pointer_to_things:
.word weather_checks + rom + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.org offset
.align 2
effect_spore_things:
	mov r0, #0x58
	mul r0, r2
	add r1, r0, r1
	ldrh r0, [r1, #0x28]
	cmp r0, #0x0
	beq NoEffectSpore
SafetyGogglesCheck:
	ldrh r0, [r1, #0x2E]
	mov r4, r1
	bl get_held_item_attr
	mov r1, r4
	cmp r0, #Safety_Goggles
	beq NoEffectSpore
OvercoatCheck:
	add r1, #0x20
	ldrb r0, [r1]
	cmp r0, #0x8F
	beq NoEffectSpore
CheckGrassType:
	mov r1, r4
	bl check_grass_type
	cmp r0, #1
	bne Return
NoEffectSpore:
	ldr r4, Return0
	bx r4
Return:
	ldr r0, Return1
	bx r0

bx_with_r1:
	bx r1

.align 2
Return0: .word 0x0801AB3E + 1
Return1: .word 0x0801AB42 + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.align 2
grass_immune_start:
	ldrb r4, [r0]
	mov r0, #0x58
	mul r0, r4
	ldr r1, battle_struct
	add r1, r0
	bl check_grass_type
	cmp r0, #1
	beq check_powder_set_up
	ldrh r0, [r1, #0x2E] @held item
	bl get_held_item_attr
	cmp r0, #Safety_Goggles
	bne return_to_attack_canceler
check_powder_set_up:
	ldr r1, powder_table
	ldr r2, cur_attack
	ldrh r2, [r2]
	ldr r3, ending_hword
check_powder:
	ldrh r0, [r1]
	cmp r0, r3
	beq return_to_attack_canceler
	add r1, #2
	cmp r0, r2
	bne check_powder
fail:
	mov r0, #8
	ldr r1, effectivity
	strb r0, [r1]
	ldr r3, immune_return
	b jump_with_r3
return_to_attack_canceler:
	mov r0, #2
	mov r1, r4
	mov r2, #0
	str r2, [sp]
	ldr r3, return_not_immune
jump_with_r3:
	bx r3

.align 2
powder_table: .word powder_table_offset
return_not_immune: .word 0x0801D7E0 + 1
battle_struct: .word 0x02023BE4
ending_hword: .word 0x0000FFFF
cur_attack: .word 0x02023D4A
effectivity: .word 0x02023DCC
immune_return: .word 0x0801DAF4 + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.align 2
weather_checks:
	ldr r0, attacker
	ldr r0, [r0]
	mov r1, #0x58
	mul r0, r1
	ldr r1, battle_struct0
	add r1, r0 @ correct battle struct
	add r1, #0x20 @ability
	ldrb r0, [r1]
	cmp r0, #Overcoat
	beq no_damage
	cmp r0, #Magic_Guard
	ldrh r0, [r1, #0xE] @held item
	bl get_held_item_attr
	cmp r0, #Safety_Goggles
	beq no_damage
	ldr r1, normal_return
	bx r1
no_damage:
	ldr r1, return_addr
jump_with_r1:
	bx r1

.align 2
attacker: .word 0x02023D6B
battle_struct0: .word 0x02023BE4
normal_return: .word 0x08028D4C
weather: .word 0x02023F1C
return_addr: .word 0x08028E3C + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.align 2
check_grass_type: @r1 is the pointer to the battle_struct
	mov r2, r1
	add r1, #0x20
	ldrb r0, [r1, #1]
	cmp r0, #Grass_Type
	beq yes_grass
	ldrb r0, [r1, #2]
	cmp r0, #Grass_Type
	bne no_grass
yes_grass:
	mov r0, #1
	b return_from_grass_check
no_grass:
	mov r0, #0
return_from_grass_check:
	mov r1, r2
	bx lr

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.align 2
get_held_item_attr:
	ldr r1, item_get_x12
	bx r1

.align 2
item_get_x12: .word 0x0809A924 + 1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Reply With Quote
  #1093   Link to this post, but load the entire thread.  
Old February 10th, 2017 (9:27 PM).
DarkPsychic's Avatar
DarkPsychic DarkPsychic is offline
 
Join Date: Jul 2012
Location: CO
Gender: Male
Nature: Timid
Posts: 146
Quote:
Originally Posted by Sky0fBlades View Post
Since I want the Re-Useable PokéBall feature in Emerald too, I decided to give it a shot but it is still incomplete. Someone else can find the missing parts if they would like to, that would be great. Here is what I have figured out so far through testing:

Found:
Location of bytes "01 21" to change to "00 21": 0x0FE3AA
Var_800E location for Emerald: 0x0203CE7C (which I couldn't find anywhere on the internet for some reason)

Missing:
Emerald's equivalent to FireRed's 0x02D924
What to put instead of "0x809A1D9" in the ASM

Hopefully someone can post the missing parts to complete this.

Not sure if this is any help but in FR at 0x02D924 I found:
Code:
ROM:0802D924                 MOV     R9, R4
which is right near the end of the function for catching Pokemon at 0x02D800.





The equivalent to FireReds 0x02D924 in Emerald is:
Code:
ROM:0805681A                 MOV     R10, R5
The equivalent function to FireReds 0x02D800 in Emerald is 0x0566A8 from what I can tell...

Not sure if that helps any but good luck
Reply With Quote
  #1094   Link to this post, but load the entire thread.  
Old February 11th, 2017 (8:34 AM). Edited February 12th, 2017 by Xencleamas.
Xencleamas's Avatar
Xencleamas Xencleamas is offline
Suddenly lurking in the shadows...
 
Join Date: Feb 2014
Gender: Male
Nature: Adamant
Posts: 456
Quote:
Originally Posted by azurile13 View Post
Code:
regional_dex_order:
.short 0x0000
.short CHIKORITA
.short BAYLEEF
.short MEGANIUM
What should I put here: the true index slot of a Pokemon? Or, the Pokedex Number (in hex) of a Pokemon?

And, can you also please enhance the routine into "Compiler/THUMB Editor and Assembler"-wise routine? Not all users use ASMAGIX.
__________________
Reply With Quote
  #1095   Link to this post, but load the entire thread.  
Old February 11th, 2017 (12:23 PM). Edited February 11th, 2017 by SkyVortex.
SkyVortex's Avatar
SkyVortex SkyVortex is offline
 
Join Date: Jan 2017
Location: Ice Path
Gender: Male
Nature: Mild
Posts: 228
Quote:
Originally Posted by DarkPsychic View Post
Not sure if this is any help but in FR at 0x02D924 I found:
[...]
The equivalent function to FireReds 0x02D800 in Emerald is 0x0566A8 from what I can tell...

Not sure if that helps any but good luck
Cool, it does help a bit, thank you. I tested 0x05681A (in place of 0x2D924) and realized that that routine is called right after giving a nickname to the caught Pokémon, or declining to. I did some more searching and found 0x04ACB6, which is similar (in bytes) but is called upon pressing 'A' once the game says "X has been caught!".

Unfortunately, editing either of these with the pointer code to the new ASM routine causes the game to reset as soon as it gets called, even though I +1'ed the pointer properly and did the procedure as it was described. It may have something to do with whatever "0x809A1D9" is supposed to be in Emerald, because I have no clue what to replace that with. I'm not sure if that is what is causing the resets though.

We may have to find out how the person who originally put together the FireRed routine found that offset exactly (unless you are able to find it), as I am not currently well-versed in ASM.

EDIT: Well, looks like we have the answers now. Thanks @BluRose. BTW, how did you originally find the right offsets? Was it through looking at the game's ASM as it ran in a debugger, or by searching through hex data (or something else)? Just curious as to how to do this on my own in the future.
Quote:
Originally Posted by BluRose View Post
REUSABLE BALLS IN EMERALD
[...]
Reply With Quote
  #1096   Link to this post, but load the entire thread.  
Old February 11th, 2017 (2:28 PM). Edited March 29th, 2017 by BluRose.
BluRose BluRose is offline
blu rass
 
Join Date: Apr 2014
Location: michigan tech
Age: 22
Gender: Male
Nature: Timid
Posts: 812
Quote:
Originally Posted by The_learner View Post
ping
Quote:
Originally Posted by Sky0fBlades View Post
ping
Quote:
Originally Posted by DarkPsychic View Post
ping
REUSABLE BALLS IN FIRE RED / EMERALD

gracias a familiawerneck (for routine) and mwisbest (for reminding me to update my muk with his perfectly fine method)
he also has one to make safari balls reusable

original: buggy, don't use pls
Spoiler:

routine with byte changes
Spoiler:
Code:
.text
.align 2
.thumb

@ FE3AA - 00 21
@ 56818 - 00 48 00 47 XX+1 XX XX XX

main:
	bl deleteball
	mov r9, r4
	mov r10, r5		@ added because emerald
	pop {r4-r7}
	pop {r0}
	bx r0

deleteball:
	ldr r0, var_800E	@ last_used_item_maybe
	ldrh r0, [r0]
	mov r1, #1
	ldr r2, =(0x80D6AA5)
	bx r2
	
.align 2
var_800E: .word 0x0203CE7C

if y'all want to see specific equivalent addresses:
Spoiler:
Code:
[bpre]
2D924		- atkF0 - near end
9A1D8		- bag_remove_item
A1E30		- pokeball + 0x24
0203AD30	- var 800E

[bpee]
56818		- atkF0 - near end
D6AA4		- bag_remove_item
FE3AA		- pokeball + 0x26
0203CE7C	- last_used_item_maybe
have a nice day~


BPRE:
Spoiler:
Code:
.text
.align 2
.thumb

@ A1E30 - 00 21
@ 2D924 - 00 48 00 47 XX+1 XX XX 08

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

deleteball:
	ldr r0, var_800E	@ item last used is stored here
	ldrh r0, [r0]
	mov r1, #0xC		@ premier ball index - last poké ball listed
	cmp r0, r1
	bgt end
	mov r1, #1
	ldr r2, =(0x809A1D9)
	bx r2
	
.align 2
var_800E: .word 0x0203AD30


BPEE:
Spoiler:
Code:
.text
.align 2
.thumb

@ FE3AA - 00 21
@ 56818 - 00 48 00 47 XX+1 XX XX 08

main:
	bl deleteball
end:
	mov r9, r4
	mov r10, r5		@ added because emerald
	pop {r4-r7}
	pop {r0}
	bx r0

deleteball:
	ldr r0, var_800E	@ last_used_item_maybe
	ldrh r0, [r0]
	mov r1, #0xC		@ premier ball index - last poké ball listed
	cmp r0, r1
	bgt end
	mov r1, #1
	ldr r2, =(0x80D6AA5)
	bx r2
	
.align 2
var_800E: .word 0x0203CE7C
__________________
heyo check out my github:

BluRosie
highlights:
battle engine for heartgold
various feature branches in heart gold (fairy type, odd egg, mud slopes)

i'm a big part of the development team of pokemon firegold! all the code that i develop for that hack is also on my github

also on discord: BluRose#0412
Reply With Quote
  #1097   Link to this post, but load the entire thread.  
Old February 11th, 2017 (8:51 PM).
BluRose BluRose is offline
blu rass
 
Join Date: Apr 2014
Location: michigan tech
Age: 22
Gender: Male
Nature: Timid
Posts: 812
Quote:
Originally Posted by Sky0fBlades View Post
Spoiler:
Cool, it does help a bit, thank you. I tested 0x05681A (in place of 0x2D924) and realized that that routine is called right after giving a nickname to the caught Pokémon, or declining to. I did some more searching and found 0x04ACB6, which is similar (in bytes) but is called upon pressing 'A' once the game says "X has been caught!".

Unfortunately, editing either of these with the pointer code to the new ASM routine causes the game to reset as soon as it gets called, even though I +1'ed the pointer properly and did the procedure as it was described. It may have something to do with whatever "0x809A1D9" is supposed to be in Emerald, because I have no clue what to replace that with. I'm not sure if that is what is causing the resets though.

We may have to find out how the person who originally put together the FireRed routine found that offset exactly (unless you are able to find it), as I am not currently well-versed in ASM.

EDIT: Well, looks like we have the answers now. Thanks @BluRose. BTW, how did you originally find the right offsets? Was it through looking at the game's ASM as it ran in a debugger, or by searching through hex data (or something else)? Just curious as to how to do this on my own in the future.
well i knew A1E30's rough equivalent because A1E1C is the pokeball's held item effect; that one was easy
also found the equivalent of 203AD30 (var_800E) from the pokeball routine; same routine with same function will access equivalent offsets
so, yes i did those two in vba's debugger
now, the other two were found using knizz's/touched's .idb files in ida; comparison of routines, basically :P
a large majority of circumstaces will show either a.) the exact same routine or b.) same values being loaded/adjusted/etc.
in a's case it is simply a matter of branching at the right place; b's requires a small rewrite to replace registers~
__________________
heyo check out my github:

BluRosie
highlights:
battle engine for heartgold
various feature branches in heart gold (fairy type, odd egg, mud slopes)

i'm a big part of the development team of pokemon firegold! all the code that i develop for that hack is also on my github

also on discord: BluRose#0412
Reply With Quote
  #1098   Link to this post, but load the entire thread.  
Old February 16th, 2017 (2:37 AM). Edited February 16th, 2017 by eMMe97.
eMMe97 eMMe97 is offline
 
Join Date: Jan 2015
Posts: 51
Berry System

Hello...it' me! xD
An user sayd me that this toturial https://www.pokecommunity.com/showpost.php?p=8515307&postcount=64 doesn't work...and than I created a new method via script.
It's not a perfect port of the r/s/e berry system, because the script is for only one tree (if you want more you compile other scripts with other vars).

We need to...

JPAN's hacked engine
ShinyQuagsire's berry bag hack: http://www.pokecommunity.com/showthread.php?t=295749
FBI's Minutes Played routine https://www.pokecommunity.com/showpost.php?p=8534141&postcount=283

The script:

Code:
#dynamic 0x900000
#org @start
lock
compare 0x4050 0x0
if 0x1 goto @nonePlanted
compare 0x4050 0x1
if 0x1 goto @fresh
compare 0x4050 0x2
if 0x1 goto @sprouted
compare 0x4050 0x3
if 0x1 goto @growing
compare 0x4050 0x4
if 0x1 goto @blooming
random 0x4
compare 0x800D 0x0
if 0x1 call @5
compare 0x800D 0x1
if 0x1 call @8
compare 0x800D 0x2
if 0x1 call @10
compare 0x800D 0x3
if 0x1 call @13
bufferitem 0x0 0x404f
buffernumber 0x1 0x5005
msgbox @recieved 0x2
msgbox @returned 0x2
setvar 0x4050 0x0
setvar 0x4051 0x0
release
end

#org @nonePlanted
msgbox @none 0x5
compare LASTRESULT 0x0
if 0x1 goto @end
fadescreen 0x1
setvar 0x8000 0x7E
setvar 0x800E 0x0
callasm 0x0A1881
waitmsg
setvar 0x8000 0x0
compare 0x800E 0x0
if 0x1 goto @end
bufferitem 0x0 0x800e
copyvar 0x404f 0x800e
msgbox @addedBerry 0x2
setvar 0x4050 0x1
removeitem 0x800e 0x1
callasm 0x 'offset+1 Minutes Played routine
copyvar 0x4052 0x800d
release
end

#org @fresh
bufferitem 0x0 0x404f
msgbox @newplant 0x2
callasm 0x 'offset+1 Minutes Played routine
copyvar 0x4053 0x800d
compare 0x4051 0x1
if 0x0 goto @water
msgbox @wateredAlready 0x2
writebytetooffset 0x53 0x0203f4d8
writebytetooffset 0x40 0x0203f4d9
writebytetooffset 0x52 0x0203f4da
writebytetooffset 0x40 0x0203f4db
special 0x3f
compare 0x4053 0x14
if 0x4 goto @germoglia
release
end

#org @germoglia
setvar 0x4051 0x0
setvar 0x4050 0x2
callasm 0x9600061
copyvar 0x4052 0x800d
bufferitem 0x0 0x404f
msgbox @sprouting 0x2
goto @sprouted
end

#org @sprouted
callasm 0x 'offset+1 Minutes Played routine
copyvar 0x4053 0x800d
compare 0x4051 0x1
if 0x0 goto @water
msgbox @wateredAlready 0x2
writebytetooffset 0x53 0x0203f4d8
writebytetooffset 0x40 0x0203f4d9
writebytetooffset 0x52 0x0203f4da
writebytetooffset 0x40 0x0203f4db
special 0x3f
compare 0x4053 0x14
if 0x4 goto @cresci
release
end

#org @cresci
setvar 0x4051 0x0
setvar 0x4050 0x3
callasm 0x 'offset+1 Minutes Played routine
copyvar 0x4052 0x800d
bufferitem 0x0 0x404f
msgbox @tall 0x2
goto @growing
end

#org @growing
callasm 0x 'offset+1 Minutes Played routine
copyvar 0x4053 0x800d
compare 0x4051 0x1
if 0x0 goto @water
msgbox @wateredAlready 0x2
writebytetooffset 0x53 0x0203f4d8
writebytetooffset 0x40 0x0203f4d9
writebytetooffset 0x52 0x0203f4da
writebytetooffset 0x40 0x0203f4db
special 0x3f
compare 0x4053 0x14
if 0x4 goto @fiorisci
release
end

#org @fiorisci
setvar 0x4051 0x0
setvar 0x4050 0x4
callasm 0x 'offset+1 Minutes Played routine
copyvar 0x4052 0x800d
msgbox @bloom 0x2
goto @blooming
end

#org @blooming
callasm 0x 'offset+1 Minutes Played routine
copyvar 0x4053 0x800d
compare 0x4051 0x1
if 0x0 goto @water
msgbox @wateredAlready 0x2
writebytetooffset 0x53 0x0203f4d8
writebytetooffset 0x40 0x0203f4d9
writebytetooffset 0x52 0x0203f4da
writebytetooffset 0x40 0x0203f4db
special 0x3f
compare 0x4053 0x14
if 0x4 goto @raccogli
release
end

#org @raccogli
setvar 0x4051 0x0
setvar 0x4050 0x5
msgbox @raccolta 0x2
goto @start
end

#org @water
checkitem 0xe2 0x1
compare LASTRESULT 0x1
if 0x0 goto @end
msgbox @wantWater 0x5
compare LASTRESULT 0x0
if 0x1 goto @end
msgbox @finishedWatering 0x2
setvar 0x4051 0x1
release
end

#org @5
setvar 0x5005 0x5
additem 0x404f 0x5
return

#org @8
setvar 0x5005 0x8
additem 0x404f 0x8
return

#org @10
setvar 0x5005 0xa
additem 0x404f 0xa
return

#org @13
setvar 0x5005 0xd
additem 0x404f 0xd
return

#org @end
release
end

#org @addedBerry
= Hai piantato una [buffer1] qui. \hF9\hF9

#org @returned
= Il terreno è tornato al suo\nstato originario.

#org @newplant
= Qui è coltivata una [buffer1].

#org @none
= Il terreno sembra fertile.\nVuoi piantare una bacca?

#org @bloom
= Tra poco potrò raccogliere \ni frutti. \hF9\hF9

#org @tall
= La [buffer1] sta\ncrescendo forte e rigogliosa. \hF9\hF9

#org @sprouting
= La [buffer1] ha germogliato! \hF9\hF9

#org @wantWater
= Il terreno ha bisogno di acqua.\nVuoi annaffiarlo?

#org @wateredAlready
= Bisogna aspettare ancora un po'...

#org @recieved
= [player] raccoglie [buffer2] [buffer1]!

#org @finishedWatering
= Il terreno adesso è umido.\nLa bacca sembra beneficiarne!

#org @raccolta
= Dopo tanta fatica sembra che\nla pianta sia pronta! \hF9\hF9
How it works?

1) vars used

var 404F - berry planted
var 4050 - current stage
var 4051 - was watered
var 4052 - time of before stage
var 4053 - time of current stage

2) time
I copy and modify the FBI berry script - 5 phases, each phase lasts 20 minutes playtime. You must always water the berry to acces to the next step.
To calculated the time I used the vars operation of JPAN's hacked engine (var 4053 - var 4052).

3) at the end the script give you a random number of berries (5, 8 ,10 ,13).

How I can create a new berry tree?

You must change the vars with new ones and MORE importante you must change

Code:
writebytetooffset 0x53 0x0203f4d8
writebytetooffset 0x40 0x0203f4d9
writebytetooffset 0x52 0x0203f4da
writebytetooffset 0x40 0x0203f4db
with the 2 new vars of time.



If you find a bug...call me! xD

[sorry for my bad english]
Reply With Quote
  #1099   Link to this post, but load the entire thread.  
Old February 22nd, 2017 (7:59 AM).
Enn's Avatar
Enn Enn is offline
 
Join Date: Jan 2017
Gender: Male
Posts: 185
Alright, I have a request.
Is it possible to run a Pokemon storage script via an item??
This is implemented in Pokemon NKP but doesn't seem to work...
Basically it can store upto 6 Pokemon and we can carry it in key items..
It would be such a nice feature.
Please look forward to it..
Just a request..
All other asm are great..
Reply With Quote
  #1100   Link to this post, but load the entire thread.  
Old February 22nd, 2017 (4:32 PM).
BluRose BluRose is offline
blu rass
 
Join Date: Apr 2014
Location: michigan tech
Age: 22
Gender: Male
Nature: Timid
Posts: 812
Quote:
Originally Posted by Nisarg View Post
Alright, I have a request.
Is it possible to run a Pokemon storage script via an item??
This is implemented in Pokemon NKP but doesn't seem to work...
Basically it can store upto 6 Pokemon and we can carry it in key items..
It would be such a nice feature.
Please look forward to it..
Just a request..
All other asm are great..
make it so that your item runs a script using the item runner from like jpan's hacked engine or something
and then make your script use special 0x9F to choose a pokémon to store with a callasm to like the pokémon storage system linked on the first page
naturally your script will have to do various things, i.e. count the number of pokémon and others, but it shouldn't be too difficult
__________________
heyo check out my github:

BluRosie
highlights:
battle engine for heartgold
various feature branches in heart gold (fairy type, odd egg, mud slopes)

i'm a big part of the development team of pokemon firegold! all the code that i develop for that hack is also on my github

also on discord: BluRose#0412
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.