Golden Sun Hacking Community
29, November, 2020, 01:53:52 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: The last working version of the classic TLA Editor is Teawater's unofficial "mapeditor" draft.
 
  Home   Forum   DC Wiki Help Search Calendar Downloads Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: [Tutorial] Fox's Icon Compresor  (Read 3453 times)
0 Members and 1 Guest are viewing this topic.

Excellent Member
****

Coins: 20
Offline Offline

Gender: Male
Posts: 917

« on: 29, October, 2015, 01:04:31 PM »

Hi guys. This small tutorial will show how to make new icons using Fox's Icon Compressor (download from here, in the attachment)

What you'll need:
- Visual Boy Advance-M
- Golden Sun Rom
- BACKUP of your Golden Sun Rom
- Hex Editor
- Atrius' Golden Sun: The Lost Age Editor
- Fox's GS Icon Compressor

Preparation
I'll start by making Boon by editing Ply so i'll use Mia in her base class for this tutorial.
Download GS Icon Compressor, open it to view its content and look for gsiconcompressor.exe here: "gsiconcompressor\gsiconcompressor\bin\Release" (there is no need to extract the whole folder cause that file in the only one we need). Extract it somewhere (Desktop?).

Open your Golden Sun Rom in VBA-M. Enter the status screen, select a character by pressing A twice, in order to make the psynergy screen show.  Once you're in the right screen, from the tools menu open the Palette Viewer, the Tile Viewer and the Memory Viewer. From the Tile Viewer, select 0x6010000 under "char base": you should see the psynergy icons split up horizontally somewhere in the small screen in the upper right corner. Click on the first one from Ply and it will show up in the bottom-left screen. Copy the address shown in the Tile Viewer and paste it into the Memory Viewer.

Your screen should look something like this now.

From Ply to Boon
If you understood everything until now, you're more than halfway done, cause now comes the easy part.
HERE you can see that the only difference between Ply and Lord Squirtle's Boon is that the 3 small light blue particles become purple (download the gif and zoom it a lot to check). From the Tile Viewer, we know that light blue corresponds to the digit "7", while purple is "9" (see pic linked above). This means that if you change the three "7"s to "9"s inside the memory viewer, the blue particles will become purple (since those 3 particles are the only light blue pixels of the icon, we don't even have to worry that we change something else by mistake)! Do it and click on the VBA screen to see the change! (here's how it should look). The icon editing is done, but now we need to put the new icon back into the ROM.

Saving the icon
Saving the icon means dump the bytes from the Memory Viewer. Click on "Save". The "Address" is the address from where the dump starts: it has to match the start of the icon, so it's the address of the top-left corner of the icon in the Tile Viewer (the same one we pasted into the memory viewer). "Size" is always 80. Save it in the same folder of gsiconcompressor.exe.

Compressing the icon and putting it back into the ROM
First, make a backup of your dump. The compressor overwrites the input file so, in case something goes wrong, you won't have to start from scratch. Drag the dump into the compressor, and after ~1 second you'll have your compressed icon, ready to be put back into the game.

Now, open both your Golden Sun ROM and the compressed dump with an Hex Editor (I use Hex Workshop). We need some free space where we can put the icon into. Usually there's a lot of it near the end of the ROM. I'll use the space from "00FA0000" onwards. Within the Hex Editor, copy the whole hex part of the icon and paste it at 00FA0000 into the ROM. BE CAREFUL: Do not add nor remove bytes from the ROM. You have to overwrite the bytes! If you make the ROM bigger or smaller here, it won't work anymore! Check its size before and after you've pasted the dump into it! Result

Okay, so now we have our new icon into the ROM, so the only things left is to tell the game to use it. Open your edited ROM with Atrius' Editor. From the abilities screen, click on a random ability and then on its icon. Sadly, there's no free space to add new icons but we can replace an unused one (Magnet, Reflect or Arrow). Let's replace Reflect: count the icons, and you'll see that reflect is the 94th icon of the list (start counting from 0). Remember that number.

Open your Edited Rom with the Hex Editor again and go to the address 00054A14. This is the where the Ability Icon Pointer Table starts. Each sequence of 4 bytes is an address that tells the game where in the rom should look for the icon, stored in little endian (single bytes, each made of 2 digits, are in reverse order), with a 08 in the beginning (you see it at the end of it due to little endian) of the address. But how do we know which address is the one for Reflect? It's simple! Remember that Reflect was the 94th icon? Each address is made of 4 bytes so 94*4=376, which in hex is 178 (Windows' calculator can easily do these conversions). Now, since the table starts at 00054A14 (it's the address of the first ability icon, the red X), if we add 178 to it we'll have the address of the Reflect Icon. Our address is 00054A14+178 = 00054B8C.

We have to overwrite the 4 bytes at 00054B8C with the address of our new icon (remember? 00FA0000), but first we must add a 08 at the beginning, and convert it to little endian. So 00FA0000 -> 08FA0000 -> 0000FA08. Write 0000FA08 at 00054B8C (again, do NOT add nor remove bytes: overwrite them).

Before --- After

Congrats! Now you can open your ROM with the editor and use your new icon for any ability as normal!

For item icons
The process is IDENTICAL, but the item icon pointer table starts at 0004EB58 instead.

PS Tell me if something is wrong, not clear, etc... it's the first tutorial I've ever made :P. As for grammar or syntax blunders, tell me about those with a PM instead of replying here and i'll fix them, so we can keep the thread clean.
« Last Edit: 30, October, 2015, 10:00:44 PM by Caledor » Logged
View Profile
Daddy Poi's Oily Gorillas
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 1002
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2491

« Reply #1 on: 29, October, 2015, 01:27:48 PM »

Looks good....

The only one piece of info I can imagine noting is that if you have VBA, I'd say you already have the only hex editor you would need. (The memory viewer.)  While changes in memory viewer are only temporary, you can still save a dump of the entire ROM to your hard drive from it, and rename .dmp to .gba.  Maybe it is the lazy method, but it works wonderfully!

Basically, ROM data in the memory viewer is:
GS1=0x08000000-0x087FFFFF (8 MB)
GS2=0x08000000-0x08FFFFFF (16 MB)
(...with mirrors at 0x0A000000 and 0x0C000000... Never seen those used before... most likely unused in most games..., but I think those are for different wait states...?)

GBA ROMs can be a max filesize of 32 MB (0x08000000- 0x09FFFFFF), I think, and easily expandable by just adding data to the end of it....
« Last Edit: 29, October, 2015, 01:36:52 PM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)
View Profile
Regular Member
**

Coins: 20
Offline Offline

Posts: 89

« Reply #2 on: 29, October, 2015, 01:53:15 PM »

Now... If only I could edit those (http://forum.goldensunhacking.net/index.php?topic=2367.msg40605#msg40605)...
Logged
View Profile

Excellent Member
****

Coins: 20
Offline Offline

Gender: Male
Posts: 917

« Reply #3 on: 29, October, 2015, 01:59:11 PM »

Sadly, there's nothing i can do about those, Kyle...

@Fox: Of course that's an option, but i'd never use the memory viewer as an hex editor. It's too unrefined and lacks a lot of functions proper hex editors have.
« Last Edit: 29, October, 2015, 04:35:38 PM by Caledor » Logged
View Profile
Daddy Poi's Oily Gorillas
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 1002
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2491

« Reply #4 on: 30, October, 2015, 06:29:31 PM »

I agree with that, but I just thought it'd be quicker to access when you need it for something basic as this.

An actual hex editor program for searching for specific hex values would be needed, in some cases, I'm sure. Some of them don't even allow you to display the data the way you want to... Like Windhex and HxD... You see it in byte format... and I don't think you can switch to 16-bit/32-bit little endian. (While HxD does do 16-bit and 32-bit,  I think it's only limited to big-endian?)

Anyway: Here is the next version of my program that should convert actual image files of the icons, not just dumps. (Make sure you are using the valid 15 colors, or else you will get transparent color.)

New file no longer replaces the one you used... it is now named iconout.dmp.

I only tested this with some of Role's .png icons... like the FlameEdge.png icon... However, it should support .bmp, .gif, .jpg, and .tif, as well.

Unused bits at end of compressed data are now turned on like original format.


Edit: At first I had a problem getting FlameEdge.png to work, but then I found out it wouldn't load in Paint.NET either... so then I had to go and download the media directly on photobucket, unfortunately.

* gsiconcompressor2.7z (27.34 KB - downloaded 197 times.)
« Last Edit: 30, October, 2015, 07:49:38 PM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)
View Profile
Pages: [1]   Go Up
  Print  
 
Jump to:  

Chatbox
15, November, 2020, 03:45:26 PM
Salanewt: We're more alive than the board implies; most discussion takes place over on the Discord server.
15, November, 2020, 03:45:06 PM
Salanewt: Haha, heya!
15, November, 2020, 02:07:50 PM
Frog: Nice to see this place is still alive...ish anyway xD
30, October, 2020, 11:10:23 PM
Salanewt: ... Actually, it's almost time for me to post an update on the forum. It's been coming along really nicely overall, and it was only a couple months or so ago that I added some new status effects to the game.
30, October, 2020, 11:08:41 PM
Salanewt: I need to get it done to start making progress on the parts of the AI Overhaul I want to start working on.
30, October, 2020, 11:08:14 PM
Salanewt: It's going well! I wanted to get more of my djinn reform done this week but I've been busy with other things sadly.
30, October, 2020, 09:58:14 PM
KyleRunner: Hi guys! How are you doing?
13, October, 2020, 11:19:21 AM
MaxiPower: first chapter of my golden sun inspired webtoon is now live. be cool if yas could check it out. https://www.webtoons.com/en/challenge/legacy-of-the-lost-dragoon/the-northern-reaches/viewer?title_no=508487&episode_no=6
31, August, 2020, 08:40:32 AM
Daddy Poi's Oily Gorillas: Being able to convert IPS files to text files to also supporting commenting, and convert back to IPS after changes.... sounds like a fun strategy? 
27, August, 2020, 10:37:30 PM
Salanewt: Hey, thanks! 
25, August, 2020, 12:59:22 AM
Foreclosure: Yo! Looking forward for this AI OVerhaul patch when it's finished :) :) 
19, August, 2020, 07:00:17 PM
Salanewt: That's awesome! I'm pretty good; been working on an AI Overhaul project and have made some nice progress in the past couple weeks; the goal for tonight is to add Deadbeard to GS2 and then I can move onto something new.
19, August, 2020, 01:14:56 PM
Awec: Ye not bad, just checked back in for updates on GS Reloaded really. Although now I'm looking back through some of my old forum posts, which is fun :D how are you?
19, August, 2020, 01:43:07 AM
Salanewt: It sure is! How have you been?
16, August, 2020, 09:40:57 AM
Awec: Yo nice to see this forum is still going
14, August, 2020, 09:06:44 PM
Salanewt: Hey! How goes it?
01, August, 2020, 01:31:53 PM
KyleRunner: Hello, people!
08, July, 2020, 08:57:11 PM
Salanewt: That awkward feeling when almost a quarter of a year goes by without anyone posting a message in this chatbox.
27, April, 2020, 07:54:10 PM
Daddy Poi's Oily Gorillas: I'm having a thought. So I know Atrius's editor is slow at saving sprites.... So I've been thinking.   I am considering another console program.  This time, for importing and exporting sprites/animations. Image files (for sprites), binary files (for animation data), and maybe binary or text files for Settings. Would certainly be cool if it works out. - Console programs are fun, when you can (at least temporarily) cheat out making a full interface editor for them. =P
25, April, 2020, 10:42:07 PM
Daddy Poi's Oily Gorillas: Tried to list those in order of importance, but anyway....
25, April, 2020, 10:37:59 PM
Daddy Poi's Oily Gorillas: GSHC, GS Speedrunning, /r/Golden Sun, GS United Nations, ToK.  Sixth one is border-line I'm not sure.
25, April, 2020, 08:00:21 PM
Daddy Poi's Oily Gorillas: (low as in <100)
25, April, 2020, 08:00:04 PM
Daddy Poi's Oily Gorillas: So while there are quite a few GS Communities out there. There are only up to maybe ~6 Discords worth even the consideration of joining, I think. Most of the rest of them have a fairly low member count. (Of which I can tell?)
14, April, 2020, 10:49:35 AM
Daddy Poi's Oily Gorillas: The Essential Age could be what it stands for?
13, April, 2020, 05:23:32 PM
Misery: Tea editor... that's a cute name for it
01, April, 2020, 02:42:48 AM
JupiterDjinn: Also my browser is sending two o f my messages srry.
01, April, 2020, 02:42:06 AM
JupiterDjinn: Just got the reply. Ok my question is: how can I get the tea editor on Android, because I already have an emulator. But no computer.
31, March, 2020, 07:18:29 PM
Salanewt: Sure thing!
31, March, 2020, 03:38:27 PM
JupiterDjinn: Can I have a question answered?
28, March, 2020, 12:50:13 AM
Salanewt: I want to shrink it down in size later, but yup!

Affiliates
Temple of Kraden Golden Sunrise
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.08 seconds with 22 queries.