• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best places on the 'net to talk Pokémon and more! Community members will not see the bottom screen advertisements.
  • Want to share your adventures playing Pokémon?
    Check out our new Travel Journals forum for sharing playthroughs of ROM Hacks, Fan Games, and other Pokémon content!
  • IMPORTANT: Following a takedown request, the following hacks have been delisted from PokéCommunity:

    • Pokémon Glazed
    • Pokémon: Giratina Strikes Back
    • Pokémon Flora Sky
    • Pokémon Stranded
    The downloads and discussion threads for these hacks will no longer be accessible, and staff will be unable to return questions regarding accessing this content.

Quick Research & Development Thread

xGal

Mhm
241
Posts
12
Years
The songtable format goes like this:
Code:
XX XX XX 08 YY 00 YY 00
XX XX XX = Pointer to the song
YY = 01 or 02. 01 results regular songs, but if you put 02, the song ingame will stop play if there is another sound (like PC sound, menu open sound, etc.).

Gamefreak used 01 for regular songs (like city/battle themes) and 02 for fanfares.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
The songtable format goes like this:
Code:
XX XX XX 08 YY 00 YY 00
XX XX XX = Pointer to the song
YY = 01 or 02. 01 results regular songs, but if you put 02, the song ingame will stop play if there is another sound (like PC sound, menu open sound, etc.).

Gamefreak used 01 for regular songs (like city/battle themes) and 02 for fanfares.

This has been known since 2007 :D
03 is for other things too you know
 

Deokishisu

Mr. Magius
990
Posts
18
Years
During my analysis of cmda6, I discovered that Game Freak implemented their own script-controlled walking ASM into the Advance-generation games. There can be up to eight subroutines to run on every frame of animation, only one of which may be active at any given time. You can select a subroutine to activate using cmda6.

At 0x03005090, there is a list of ASM functions to be executed on every frame of animation. Each entry in the list is a pointer to the routine, some metadata about the list item itself, and thirty-or-so bytes for the routine to work with (so that it may maintain its state).

When on the overworld, one of the items on this list is 0x0806E811, a walking routine manager. This routine manager will check one of the bytes in its execution-list-item (set by cmda6) and based on that byte, it will call one of eight walking subroutines.

Those subroutines in turn check the player's coordinates against stored values to see if the player has moved. If so, the subroutine processes player movement accordingly (check the tile they're standing on, change it if necessary, what have you).

There are eight slots for walking subroutines, and the defined subroutines (pointed to by pointers at 0x083A7310) are:
#0 at 0x0806E955: Nop
#1 at 0x0806EB55: Broken (R/S/E leftover: Route 113 ash-covered grass)
#2 at 0x0806E955: Nop
#3 at 0x0806E955: Nop
#4 at 0x0806E9E1: Icefall Cave ice tiles
#5 at 0x0806E955: Nop
#6 at 0x0806E955: Nop
#7 at 0x0806EC41: Broken (R/S/E leftover: Granite Cave/Sky Pillar broken floor tiles)

(The three defined subroutines basically change certain tiles out from under the player's feet. Theoretically, though, a subroutine can do anything it wants on every frame of animation that the overworld is being processed.)

What this means is that we now have an official way -- something that was designed for this use -- to set up our own custom-made ASM functions to run the very instant the player takes a step. If we keep the broken functions in the table, we can define up to four custom ASM subroutines; if we ditch those, we can define six.

(We could also repoint and extend the subroutine pointer table, and modify the related ASM code, thereby allowing up to 255 custom subroutines to be predefined and activated with cmda6.)

One possible use case for all of this would be an alternate (and more script-friendly) implementation of JPAN-style walking scripts, which would work without breaking other game functions (i.e. wild encounters in tall grass).

For more information, see the description for cmda6 in my FireRed script command reference.

Oh, something else: the R/S/E leftovers prove that this discovery applies to all Advance-generation games. The offsets will differ, and the walking subroutines will have some differences in R/S/E, but the system itself exists in all Pokemon GBA games.

I just had a thought while skimming through the older posts in this topic. Could this information be used to create phenomena? You know, the shaking grass and sky shadows and dark blue water featured in B2/W2?
 

Kawaii Shoujo Duskull

The Cutest Duskull
276
Posts
10
Years
  • Age 27
  • Seen Sep 10, 2023
I just had a thought while skimming through the older posts in this topic. Could this information be used to create phenomena? You know, the shaking grass and sky shadows and dark blue water featured in B2/W2?



Hmm...
I think if enough was put into it, it could be possible. If I understand correctly, a routine could be created to use the RNG each step to give a chance of shaking grass, dark water, or the clouds. The routine would need to check if one such event is already active though. It would also need to reset after the player enters a battle or leaves the map, or other similar instances. Finally, it would need to check if the player is on the set tile and--if yes--generate a wild encounter or give an item.
Resetting after leaving a map wouldn't be a problem since I think it would most likely do that on its own. I don't know how a routine would check if an event is already going though, and I really don't have a clue how the RNG or whatnot work in the GBA pokemon games.


I know my input isn't much of a help, sorry. :P
 
5,256
Posts
16
Years
playsong2 is supposed to be used in 0x3-type level scripts to automatically play the song specified instead of the song that map usually plays.

For example:

Code:
#dynamic 0x800000

'---------------
#org @start
compare 0x40C6 0x0
if 0x1 call @snippet1
end

'---------------
#org @snippet1
playsong2 0x15A
return

Would play the song 0x15A as soon as the map is loaded so long as 0x40C6 is set to 0x0, and, if it isn't, the song that is set to be the map's music on AMap will play as usual. playsong, on the other hand, would not work in this situation as there would be a couple of seconds of delay.

I dunno if I'm just really slow, but if others didn't know this then there's no harm in posting it. (Now that I think about it, this is probably obvious as movesprite2 is another command that's specifically for level scripts)
 

Kawaii Shoujo Duskull

The Cutest Duskull
276
Posts
10
Years
  • Age 27
  • Seen Sep 10, 2023
Info on the scripting command "cry" here, about the effect.

Cry
0x0: normal.
0x1: normal but cut short.
0x2: higher pitch than normal.
0x3: higher pitch than normal, with a bit of echo, like pokemon on the overworld is roaring.
0x4: short reversed cry.
0x5: low cry
0x6: hard normal pitch cry, sort of like a roar.
0x7: short lower cry.
0x8: normal pitch but just a tiny bit short I think?
0x9: slightly lower than normal but not by much.
0xA: lower than the last one.
0xB: short lower.
0xC: short lower.
0xD:normal?
0xE:normal?
0xF: normal?


I just remembered I had this saved in a text file on my laptop. I'll have to re-test this though, I might have had a few of those wrong(the ones marked with ? at the end). Also gonna have to test and see if it could go past 0xF. I have a feeling that this may have something to do with certain bits being set, though I'm not too sure since I don't know about any routine behind this.
If anybody else has any info to add to this, then please do. Or if this has been covered already, let me know. ^^
 

Kawaii Shoujo Duskull

The Cutest Duskull
276
Posts
10
Years
  • Age 27
  • Seen Sep 10, 2023




Hmm...
I think if enough was put into it, it could be possible. If I understand correctly, a routine could be created to use the RNG each step to give a chance of shaking grass, dark water, or the clouds. The routine would need to check if one such event is already active though. It would also need to reset after the player enters a battle or leaves the map, or other similar instances. Finally, it would need to check if the player is on the set tile and--if yes--generate a wild encounter or give an item.
Resetting after leaving a map wouldn't be a problem since I think it would most likely do that on its own. I don't know how a routine would check if an event is already going though, and I really don't have a clue how the RNG or whatnot work in the GBA pokemon games.


I know my input isn't much of a help, sorry. :P

Just had another thought. Using the same command and using ASM and all that, I think it could be possible to make it so that when the player walks, it plays a sound dependant on the type of tile they step onto, like in HG/SS. I don't know if its been done yet or if its been done another way or not, but I just thought it could be possible to do it using this info.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years


Just had another thought. Using the same command and using ASM and all that, I think it could be possible to make it so that when the player walks, it plays a sound dependant on the type of tile they step onto, like in HG/SS. I don't know if its been done yet or if its been done another way or not, but I just thought it could be possible to do it using this info.

It has been done by tile behaviors and asm, (a mix of both) but I think it'd be easy
 
5,256
Posts
16
Years
Ok, I found this over at the pokahacking forum and it seems to be useful for legendary events! So I did not discovered this credits to Steven and Casta for some Info about this.

So ever wanted to make your game like a movie or something like that. xD Well you can you can now make something look like this.

scaled.php


So how to do it huh? Pretty easy just put this in your script.

Ruby:


Fire red:


Emerald:


Just include them in every script that you want it only goes away after a warp to another place. That's all. :D

Credits:
Steven
Casta
Warping is not necessary to reset this; for FireRed, just use

Code:
writebytetooffset 0xff 0x4000044 
writebytetooffset 0x0 0x4000045

On that note, does anyone know if it is possible to reset the grayscale/sepia filters without warping?
 

knizz

192
Posts
16
Years
  • Seen Oct 28, 2020
On that note, does anyone know if it is possible to reset the grayscale/sepia filters without warping?
for a full reload of palettes and blocksets call 08055148 (mapdata_load_assets_to_gpu_and_full_redraw)

if you only want to reload the palettes you can call 08059AD8 with the pointer to the mapdata-header in r0.
Code:
push {lr}
ldr r0, current_mapheader
ldr r0, [r0, #0]
bl 08059AD8
pop {pc}
.align 4
current_mapheader: .word 0x02036DFC
Code:
02036E28 = 0: normal colors
02036E28 = 1: grayscale
02036E28 = 2: sepia

(none of this was tested, can anyone confirm this?)
 
5,256
Posts
16
Years
for a full reload of palettes and blocksets call 08055148 (mapdata_load_assets_to_gpu_and_full_redraw)

if you only want to reload the palettes you can call 08059AD8 with the pointer to the mapdata-header in r0.
Code:
push {lr}
ldr r0, current_mapheader
ldr r0, [r0, #0]
bl 08059AD8
pop {pc}
.align 4
current_mapheader: .word 0x02036DFC
Code:
02036E28 = 0: normal colors
02036E28 = 1: grayscale
02036E28 = 2: sepia

(none of this was tested, can anyone confirm this?)

Hm, this still necessitates warping unless I'm doing something wrong.
 

kearnseyboy6

Aussie's Toughest Mudder
300
Posts
15
Years
  • Seen Jun 22, 2019
in applymovement #raw 0x69 will play all the rocksmash, tree frames, its in their respective scripts so don't be fooled by the 'mov69' description.
 
2
Posts
10
Years
  • Seen Oct 11, 2015
Hey everybody,

Is it possible to implement a choice in the intro to pick a character? Like, instead of "Are you a boy or girl?" and you pick a gender, could it be "Are you a boy or a girl?" And then it asks you to pick one of three archetypes per say?
 
252
Posts
10
Years
  • Age 27
  • Seen Jul 6, 2019
Hey everybody,

Is it possible to implement a choice in the intro to pick a character? Like, instead of "Are you a boy or girl?" and you pick a gender, could it be "Are you a boy or a girl?" And then it asks you to pick one of three archetypes per say?
Definitely, it would require some modification to the intro ASM routine though.
 
2
Posts
10
Years
  • Seen Oct 11, 2015
Thanks for the reply!

Sounds like it's above my head. I'm relatively new to rom hacking. thanks though!
 

GOLDstandard

Eclectic
51
Posts
10
Years
Can anyone point me in the direction of research about breeding or the game's pokemon generation routine? I searched the forum and couldnt find anything
 

Kawaii Shoujo Duskull

The Cutest Duskull
276
Posts
10
Years
  • Age 27
  • Seen Sep 10, 2023
Update on my small bit of research into the "cry" command.


What is already known:
cry 0xXX 0xYY
XX = pokemon index number.
YY = effect on the cry.


The first parameter didn't need researching(obviously) so I researched the second(the cry effect).
Here's what I've found:
Cry
Code:
0x0: normal.
0x1: normal but cut short.
0x2: Higher pitch, like the pokemon is loud.
0x3: higher pitch than normal, with a bit of echo, like pokemon on the overworld is roaring.
0x4: reversed cry.
0x5: low cry like pokemon faints.
0x6: harsh normal cry, like the pokemon is roaring loudly.
0x7: short lower cry.
0x8: slightly higher than normal.
0x9: short reversed cry.
0xA: pretty much normal I think.
0xB: lower cry.
0xC: short lower cry cut slightly short.
0xD: Normal.
0xE:normal.
0xF: normal.
0x10-0xFF: assumed to all play the cry as a normal cry.
I haven't noticed anything relevant in terms of bits here, so it looks like that's all there is to it.


After doing that bit of research, I decided to take a look at the playsong command's second parameter. So far as I've found there, it does absolutely nothing. I only looked at 0x0-0xF though, so there's a lot of room for me to be proved wrong there.


That's about it for now. Hope this helps somebody. :)
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
After doing that bit of research, I decided to take a look at the playsong command's second parameter. So far as I've found there, it does absolutely nothing. I only looked at 0x0-0xF though, so there's a lot of room for me to be proved wrong there.

The playsong's second parameter does have a difference though, as far as I've noticed.
if we use 0x0, the song will no longer play after a battle.
if we use 0x1, the song will still be played after a battle.
 
Back
Top