The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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.


Advertise here

Reply
 
Thread Tools
  #1    
Old October 16th, 2010, 01:53 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
Community Supporter
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky

Advertise here
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:


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.
Then all that's left is a callasm to your free space offset +1.

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 FROM THREE YEARS AGO:
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.

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?
__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles

Last edited by diegoisawesome; May 2nd, 2014 at 09:18 PM.
Reply With Quote
  #2    
Old October 18th, 2010, 02:02 AM
TheDarkShark
Metal Headed Hacker
 
Join Date: May 2010
Location: Germany
Gender: Male
Nature: Calm
Tutti did this for Eissturm, i think...
But he doesn't seem active here, I'll ask him if you want
Reply With Quote
  #3    
Old October 18th, 2010, 06:17 AM
Shiny Quagsire's Avatar
Shiny Quagsire
どないやねん, ヤドン
 
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 16
Gender: Male
Nature: Jolly
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.
__________________



Reply With Quote
  #4    
Old October 18th, 2010, 01:31 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
Community Supporter
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
Quote:
Originally Posted by shiny quagsire View Post
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.
__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Reply With Quote
  #5    
Old October 18th, 2010, 10:33 PM
Darthatron's Avatar
Darthatron
巨大なトロール。
Community Supporter Tier 2
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 22
Gender: Male
Nature: Modest
Quote:
Originally Posted by diegoisawesome View Post
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.
__________________
あなた は しきしゃ です
わたし は ばか です
Reply With Quote
  #6    
Old October 19th, 2010, 02:38 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
Community Supporter
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
Quote:
Originally Posted by Darthatron View Post
It would definitely be the RAM areas, but it wouldn't be ASM incompatibilities, because that makes no logical sense.
Well, what I meant was that you might have had to branch to different ROM locations or push and pop some extra registers.
__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Reply With Quote
  #7    
Old January 30th, 2013, 10:08 PM
Shiny Quagsire's Avatar
Shiny Quagsire
どないやねん, ヤドン
 
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 16
Gender: Male
Nature: Jolly
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.
__________________



Reply With Quote
  #8    
Old January 31st, 2013, 02:29 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
Community Supporter
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
Quote:
Originally Posted by shiny quagsire View Post
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.
__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Reply With Quote
  #9    
Old February 9th, 2013, 02:01 AM
SBird
 
Join Date: Aug 2009
Gender: Male
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
Reply With Quote
  #10    
Old March 9th, 2013, 03:50 AM
Hound of Justice
Banned
 
Join Date: Aug 2012
Location: Stealing Ash's Pikachu with Meowth
Age: 21
Gender: Male
Nature: Naughty
I hope you find a way to make this puzzle for emerald to play it on crystaldust xD
Reply With Quote
  #11    
Old December 10th, 2013, 08:52 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
Community Supporter
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
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!
__________________


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Reply With Quote
  #12    
Old December 11th, 2013, 07:12 AM
daniilS's Avatar
daniilS
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 15
Gender: Male
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.
__________________

Thanks to JPAN, Jambo51, Shiny Quagsire and knizz for teaching me almost everything I know about hacking, through tutorials or in person.
Reply With Quote
  #13    
Old December 12th, 2013, 05:19 PM
Shiny Quagsire's Avatar
Shiny Quagsire
どないやねん, ヤドン
 
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 16
Gender: Male
Nature: Jolly
Just wanted to mention it but I got it working on Fire Red:


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:


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 by Shiny Quagsire; December 12th, 2013 at 10:41 PM.
Reply With Quote
  #14    
Old January 4th, 2014, 12:05 PM
SBird
 
Join Date: Aug 2009
Gender: Male
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):


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

~SBird
Reply With Quote
  #15    
Old January 4th, 2014, 01:32 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
Community Supporter
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
Quote:
Originally Posted by SBird View Post
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):


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


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
Reply With Quote
  #16    
Old January 4th, 2014, 02:55 PM
SBird
 
Join Date: Aug 2009
Gender: Male
Quote:
Originally Posted by diegoisawesome View Post
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
Reply With Quote
  #17    
Old January 5th, 2014, 09:49 AM
Le pug's Avatar
Le pug
Creator of Pokémon: Discovery
Community Supporter
 
Join Date: Aug 2013
Location: Le bed
Age: 21
Gender: Male
Nature: Bold
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
__________________
Need help inserting tiles into AdvanceMap to have customized tiles for your hack?
• Check out my tutorial, Inserting Tiles Into AdvanceMap For Dummies
Click here to find out how to remove clouds from the Emerald titlescreen
• Check out the most updated Emereld Decapitalization Patch around by clicking here
Reply With Quote
  #18    
Old January 5th, 2014, 11:46 AM
SBird
 
Join Date: Aug 2009
Gender: Male
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
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
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 12:36 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.