• 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.

Development: The Ruins of Alph Puzzles

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
Summary:
Well, it's been done. Three years after making this thread, many advancements in the Ruins of Alph have been accomplished; shiny quagsire obtained the original source code from Mastermind_X and put it up on GitHub, mwksoul took that code and made it almost work in Emerald, and finally, I took that code and made it completely compatible with existing in-game systems, getting rid of any bugs and incompatibilities and adding in things like fading. More recently, shiny quagsire ported my code over to FireRed, allowing for much more hacks to use it than before.

Screenshot:
CrystalDust_ruinsofalph.png


Source:
https://github.com/shinyquagsire23/M_X-RuinsofAlph
Released under GPLv3, anyone is free to take this code and use it in their own hack as-is, or modify it and release the source code as well. Any forks from the code are free to be discussed in this thread.

Q/A:
Q: What engines does this work in?
A: Emerald and FireRed only.

Q: Will you be porting this to [Ruby, Sapphire, LeafGreen]?
A: Sorry, but no. Feel free to port the code over if you want to, though! shiny quagsire made this process extremely simple!

Q: How do you put this into a hack?
A: Get devkitARM from http://sourceforge.net/projects/devkitpro/. Drop your ROM of choice in the project folder. Compile the source into your ROM with
Code:
make (ROM code) fname="(ROM name.gba)" offset=(free space offset)
without parentheses.
The ROM code is either bpre for FireRed or bpee for Emerald.
Once it's been injected into your hack, use a script such as this to start it:
Code:
#org @start
lockall
setvar 0x8004 0x0
fadescreen 0x1
callasm 0x(free space offset + 1)
waitstate
compare LASTRESULT 0x1
if 0x1 goto @success
releaseall
end
Setting var 0x8004 to 0, 1, 2, or 3 will choose which one of the four puzzles to load (Kabuto, Aerodactyl, Omanyte, and Ho-Oh respectively), and you can check to see whether or not the player successfully solved the puzzle with the contents of LASTRESULT.

Q: Who did what in this?
A: Mastermind_X made the original standalone ROM (of course), shiny quagsire obtained the source and uploaded it to GitHub, mwksoul did the initial hard work (cleaning up the original, making it not a standalone), while I made it fully compatible with Emerald's callback system, sprite loading system, etc. shiny quagsire then ported that code over to FireRed, making it fully compatible with that engine.

Credits: (if you want to use this, then make sure to credit all of us)
Mastermind_X: The original
shiny quagsire: The obtaining of the source, the port to FireRed
mwksoul: The initial port and cleanup
diegoisawesome: The compatibility and customization



ORIGINAL POST:
We all know the Ruins of Alph puzzle made by Mastermind_X, right?
http://sfc.pokefans.net/lesson.php?id=21
Well, it was made for Fire Red, and when I wanted it in my Emerald hack, I tried to port it over. I changed the LASTRESULT address and tried it in-game.
crystaldustruinsofalph.png

As you can see, the result was less than satisfactory, and although it did work, it did have some glitches. As you can see here, the strange coloration is one part, and the other part is that after exiting it, pressing start would give you a weirdly formatted start menu, at the botom of the screen. Exiting it and trying again would bring up the normal Start menu, except exiting this one would remove all of the tiles on the top layer of the map.

So my question is this: How can Mastermind_X's brilliant puzzle be taken over to Emerald?
 
Last edited:

TheDarkShark

Metal Headed Hacker
56
Posts
13
Years
Tutti did this for Eissturm, i think...
But he doesn't seem active here, I'll ask him if you want ;)
 

Shiny Quagsire

I'm Still Alive, Elsewhere
697
Posts
14
Years
Could you post a picture of the pallet before you touch it and after for us? I'm not sure if it's just not changing the pallet or what the deal is.
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
Could you post a picture of the pallet before you touch it and after for us? I'm not sure if it's just not changing the pallet or what the deal is.
It's not just that, the start menu is glitched up afterwards too. I believe it's because the RAM areas it uses are used in Emerald already... and maybe some ASM incompatibilities too.
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
It's not just that, the start menu is glitched up afterwards too. I believe it's because the RAM areas it uses are used in Emerald already... and maybe some ASM incompatibilities too.

It would definitely be the RAM areas, but it wouldn't be ASM incompatibilities, because that makes no logical sense. :)
 

Shiny Quagsire

I'm Still Alive, Elsewhere
697
Posts
14
Years
I found your little problem with the palette. In Fire Red, the palette is copied via DMA to 0x05000000, which means that manually writing to that location will have it automagically rewritten over by the DMA (I personally discovered this with some of my own ASM). However, there is a palette buffer (two actually, one is for fading) in the Pokemon Games where the DMA copies from. In Fire Red, this buffer is at 0x020371f8. However, in Emerald, it's 0x02037B14. so a simple pointer search should fix that. M_X may or may not have used this buffer, so if searching the FR pointer comes up with nothing, find the main palette memory (0x05000000) and the obj pallet memory, which is 0x200 more than the background palette and replace those accordingly (adding 0x200 to the offset for the OBJ palette)

As for the menu, it may have something to do with how he preserves the palettes and tiles. What he does is he copies a big portion (or all) of the OBJ memory and the tile memory, and stores them using these #defines in his main.h file:
Code:
#define lzData2         ((u16*)0x203C000)
#define lzData          ((u16*)0x203D000)
#define save1           ((u16*)0x203E000)
#define save2           ((u16*)0x203F000)
So perhaps repoint those RAM locations to fix the menu.
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
I found your little problem with the palette. In Fire Red, the palette is copied via DMA to 0x05000000, which means that manually writing to that location will have it automagically rewritten over by the DMA (I personally discovered this with some of my own ASM). However, there is a palette buffer (two actually, one is for fading) in the Pokemon Games where the DMA copies from. In Fire Red, this buffer is at 0x020371f8. However, in Emerald, it's 0x02037B14. so a simple pointer search should fix that. M_X may or may not have used this buffer, so if searching the FR pointer comes up with nothing, find the main palette memory (0x05000000) and the obj pallet memory, which is 0x200 more than the background palette and replace those accordingly (adding 0x200 to the offset for the OBJ palette)

As for the menu, it may have something to do with how he preserves the palettes and tiles. What he does is he copies a big portion (or all) of the OBJ memory and the tile memory, and stores them using these #defines in his main.h file:
Code:
#define lzData2         ((u16*)0x203C000)
#define lzData          ((u16*)0x203D000)
#define save1           ((u16*)0x203E000)
#define save2           ((u16*)0x203F000)
So perhaps repoint those RAM locations to fix the menu.
Well, to start with, this isn't the only problem. Being designed for a standalone ROM, it doesn't fade in and out nor play a jingle. Besides this, the routine needs to be rewritten to use the in-game methods of storing data, such as the LZ data and palette data. Basically, the source is amazing to finally have so these issues can be fixed.
 
91
Posts
14
Years
  • Seen Feb 22, 2023
I had this problem too, together with some other problems, the thing is that Mastermind_X used the direct palette RAM at 0x05000000, but as you know maybe Pokémon backstores the Palettes in the WRAM. The data is copied in the DMA3 line and you want to turn that off. I can only give you the adresses for the german ROMs and what you want to change, it might be similar to the english ones:

Firered(BPRD):

Disable: 0x02037AC0 = 0x80
Able: 0x02037AC0 = 0x40

Emerald(BPED):

Disable: 0x02037FDC = 0x80
Able: 0x02037FDC = 0x40

The Firered ones were researched by driver and published in his research note files.

You want to find the offset in the routine and change it.
As I tried that I had some problems with the OAM stuff. The sprites were all bugged and I wasnt able to end the code correctly, I think some layers and also the OAM was bugged, I wasn't able to solve that though.
Hope I could help and maybe I also find an answer to my problems^^

~SBird
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
Well, it's been done. Three years after making this thread, many advancements in the Ruins of Alph have been accomplished; shiny quagsire obtained the original source code from Mastermind_X and put it up on GitHub, mwksoul took that code and made it almost work in Emerald, and finally, I took that code and made it completely compatible with existing in-game systems, getting rid of any bugs and incompatibilities and adding in things like fading.

Everything you need to know is in the first post, so check it out!
 

daniilS

busy trying to do stuff not done yet
409
Posts
10
Years
  • Age 24
  • Seen Jan 29, 2024
So, the code by mwksoul is the insertable version for firered? Can it be found somewhere? Because I want to change the images, but when doing it through nse or unlz.gba, they get messed up.
 

Shiny Quagsire

I'm Still Alive, Elsewhere
697
Posts
14
Years
Just wanted to mention it but I got it working on Fire Red:
ALP_zps2b32070c.png

ALP_zps8f1cd8be.png

It was remarkably simple to get the base code down. All it took was a few bytes from the beginning of each Emerald function to find the equivalent in Fire Red. After that it was just tweaking and asking diegoisawesome what the heck that line of code over there does (he was a big help with the port). But as of now the status of Fire Red is fully ported. I also right aligned the text to fit more with the Fire Red style.

EDIT:
Just to expand on the possibilities of the source code, I made up this graphical hack to demonstrate:
ALP_zps2e299010.png

ALP_zps172816e5.png

And in terms of editing that's actually pretty weak. With this code you can do pretty much anything. Add more puzzles, change the gameplay to add rotation, make it one of those weird sliding puzzles where there's only one space open, the list goes on and on.

If anyone wants the skinned version of this though, you can grab it on the grayruins branch on the main GitHub page in the main post. If you modify the graphics, make sure to reexport them with winGRIT and rename them appropriately inside the img_bins folder or the changes won't show up. Also, a few notes on that:
  • Export the background at 4bpp with lz77 compression for the graphics and the map with lz77 compression as well. Also make sure that you export the palette
  • Exporting palettes on the tiles is not required, but exporting the palette on the pointer is. If you edit the palette in one, mirror the edits in all the others.
  • The pointer and the tiles share the same palette. This can be changed by editing the code but we opted to change as few palettes as possible.

And finally, one last note on porting. Currently our system is designed to be easily portable between versions, meaning that if you edit the main code and test on Fire Red it should still be able to compile for Emerald without error. To port another game over, create a new useful-XXXX.h with your appropriate game code. So if I were to port this to Ruby, it would be useful-axve.h. Once you have that file set up you just need to find all the equivalent functions and pointers inside the file and then set up the makefile and main.c to recognize your game and useful-axve.h file. It's a long and trivial process, but once you have it done you are set to be able to compile code between all of the supported games.
 
Last edited:
91
Posts
14
Years
  • Seen Feb 22, 2023
I have a question concerning the "tutorial bar" thing, I have set up a version which is working with the german version of emerald(It was quite easy, thanks to the header file), now I wanted to translate the text into german as well, but as soon as I change something, everything seems to be messed up(Made a screenshot, to make you aware of what I mean):
69vml.png


As you can see it renders the things like twice, maybe someone has an idea of what's going on here :)

~SBird
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
I have a question concerning the "tutorial bar" thing, I have set up a version which is working with the german version of emerald(It was quite easy, thanks to the header file), now I wanted to translate the text into german as well, but as soon as I change something, everything seems to be messed up(Made a screenshot, to make you aware of what I mean):
69vml.png


As you can see it renders the things like twice, maybe someone has an idea of what's going on here :)

~SBird
If you modify the text, you'll also need to change the array length to be the length of your new text.
Code:
const u8 tutorialText[23]
That 23 will need to be changed to reflect your new text length.
 
91
Posts
14
Years
  • Seen Feb 22, 2023
If you modify the text, you'll also need to change the array length to be the length of your new text.
Code:
const u8 tutorialText[23]
That 23 will need to be changed to reflect your new text length.
Thank you very much for explaining such simple stuff to a C-Noob like me. :)
Everything works perfectly now!

~SBird
 

Le pug

Creator of Pokémon: Discovery / Fat Kid
870
Posts
10
Years
Do you think you could do a more in depth explanation on how to implement into the hack? I know it's probably super easy for you to do, but I have been stuck on inserting this for awhile. Downloaded....
"Drop your ROM of choice in the project folder"
er where is this project folder?
"Compile the source into your ROM with
Code:
make (ROM code) fname="(ROM name.gba)" offset=(free space offset)"
and how to do this?

thanks in advance and thanks for this resource
 
91
Posts
14
Years
  • Seen Feb 22, 2023
You want to have your romfile in the same directory as the ruins_of_alph project you downloaded(The folder in which the makefile is, that is)
Then you have to open your command terminal by eighter pressing Windows Key + R and typing "cmd", and then navigate to this particular folder(Command "cd" for change directory), or you may be able to open the command terminal at a specific place by shift right-clicking the folder and selecting "open command terminal here" or something like that. (I can't tell you exactly because my UI is in german)

After that you just type in the make command like provided above and the toolkit will automatically install it for you. Further it may be neccesary to download and install "DevkitPro" (Google it), and adding it to your environment variables/PATH. (I have this because of developement reasons, I don't know if it's required, if it does'nt work you might try to do that, you can find out how to edit your PATH variables via google)

~SBird
 
7
Posts
10
Years
Hi, I have a problem with this routine, When I try to continue the script after solve the puzzle, this don't work, I need change a value of var to activate a script when I completed this. How can I make it?
 

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
Hi, I have a problem with this routine, When I try to continue the script after solve the puzzle, this don't work, I need change a value of var to activate a script when I completed this. How can I make it?
Post the script you're using to call it; I didn't get a good look at it over the IRC.
 
Back
Top