+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Editing GBA 240 x 160 Backgrounds
Pages: [1]
Author Topic: Editing GBA 240 x 160 Backgrounds  (Read 877 times)
RadioShadow
Guest
« on: July 19, 2007, 06:46:54 pm »

I've been working on an Advance Wars 1 hack which uses the CO Japanese sprites from Gameboy Wars 1.

However, there is one change I would like to make before I release the patch.

I want to change the background image (which appears at the title screen) and have the following image:


From: 1802 - Gameboy Wars Advance 1+2 (J)(Caravan).gba

replace:


From: 0263 - Advance Wars (E).gba


The problem is, I've never edited background images before and I've tried looking for the image in unzl.gba but I had no luck and couldn't find it in 'Tile layer pro'.  Is there a better software to edit background images or to even find the location of where the image is being stored?
labmaster
Guest
« Reply #1 on: July 19, 2007, 07:31:51 pm »

In vanilla VBA you can use Tools->Loggings to uncover all sorts of useful stuff:

Code:
LZ77UnCompWram: 0x0819f8fc,0x02000000 (VCOUNT=77)
DMA3: s=02000000 d=06000000 c=8000 count=00004b00

The title is Mode4, 1 byte per pixel (referring to a 256 colour palette)

The fade in effect is achieved by varying the palette - the log also tells us where this is stored in RAM:

Code:
CpuFastSet: 0x03001ef0,0x05000000,0x00000100 (VCOUNT=163)
Kajitani-Eizan
Guest
« Reply #2 on: July 19, 2007, 09:09:30 pm »

what's the difference between the two, anyway? the only difference i see is the guy riding the parachute's hair color.
Celice
Guest
« Reply #3 on: July 19, 2007, 11:36:03 pm »

I think that is the only difference between the two (in that shot) :/
KingMike
Guest
« Reply #4 on: July 19, 2007, 11:39:38 pm »

The tank color looks like its a slightly different shade (or maybe it's just me).
Odin_Knight
Guest
« Reply #5 on: July 20, 2007, 03:18:48 am »

I replyed to a similar question a few time ago:

I'll give you a boost start in how you can get the compressed data and edit it:

You'll need 3 programs:
- visual boy advance DEV
- GBAmdc
- Tile Layer Pro

first you open the rom in vba. Before VBA loads the images you want to edit just go to the Tools-> logging menu and select SWI. Go back to vba and let it load the tiles. After that go to the logging and save the log it created. Then run gbamdc with: GBAmdc -a game.gba game.log.
The program will then create as much .dat as compressed data we found in the log. Next open TLP and open one of those .dat files. Choose view->format->gba and there it is the data you want to edit! to better understand it you can use Sprite Studio to create a good palette for the tiles.
You should read all the tutorials in this site about the programs I've mentioned and also there are very good tutorials here about gba hacking.
RadioShadow
Guest
« Reply #6 on: July 20, 2007, 07:03:08 am »

Quote from: KingMike on July 19, 2007, 11:39:38 pm
The tank color looks like its a slightly different shade (or maybe it's just me).

I think I just took the image a bit too soon while it was loading the image.  But both images use the same palette.


Quote from: Kajitani-Eizan on July 19, 2007, 09:09:30 pm
what's the difference between the two, anyway? the only difference i see is the guy riding the parachute's hair color.

That's Olaf.  In the Japanese version, he has a white beard and wears a woolly hat.  He looks like Santa Claus to us Americans/Europeans so you can guess why his sprite got changed in the USA version. Tongue


Quote from: labmaster on July 19, 2007, 07:31:51 pm
In vanilla VBA you can use Tools->Loggings to uncover all sorts of useful stuff:

Code:
LZ77UnCompWram: 0x0819f8fc,0x02000000 (VCOUNT=77)
DMA3: s=02000000 d=06000000 c=8000 count=00004b00

The title is Mode4, 1 byte per pixel (referring to a 256 colour palette)

The fade in effect is achieved by varying the palette - the log also tells us where this is stored in RAM:

Code:
CpuFastSet: 0x03001ef0,0x05000000,0x00000100 (VCOUNT=163)

So the image is compressed.  I was a bit unsure.  Cheesy

Thanks for the information labmaster.  I should have thought to use loggings. 


Quote from: Odin_Knight on July 20, 2007, 03:18:48 am
I replyed to a similar question a few time ago:

I'll give you a boost start in how you can get the compressed data and edit it:

You'll need 3 programs:
- visual boy advance DEV
- GBAmdc
- Tile Layer Pro

first you open the rom in vba. Before VBA loads the images you want to edit just go to the Tools-> logging menu and select SWI. Go back to vba and let it load the tiles. After that go to the logging and save the log it created. Then run gbamdc with: GBAmdc -a game.gba game.log.
The program will then create as much .dat as compressed data we found in the log. Next open TLP and open one of those .dat files. Choose view->format->gba and there it is the data you want to edit! to better understand it you can use Sprite Studio to create a good palette for the tiles.
You should read all the tutorials in this site about the programs I've mentioned and also there are very good tutorials here about gba hacking.

That helps a lot Odin_Knight.  I better go and download the tools.  The one thing I don't understand is when you are editing the .dat data, will it make the necessary changes to the rom?  Or would I have to import it back in myself?

Thanks for the help everyone.  I report back some when today or tomorrow about my progress.   
Odin_Knight
Guest
« Reply #7 on: July 20, 2007, 07:41:22 am »

Quote from: RadioShadow on July 20, 2007, 07:03:08 am
Quote from: Odin_Knight on July 20, 2007, 03:18:48 am
I replyed to a similar question a few time ago:

I'll give you a boost start in how you can get the compressed data and edit it:

You'll need 3 programs:
- visual boy advance DEV
- GBAmdc
- Tile Layer Pro

first you open the rom in vba. Before VBA loads the images you want to edit just go to the Tools-> logging menu and select SWI. Go back to vba and let it load the tiles. After that go to the logging and save the log it created. Then run gbamdc with: GBAmdc -a game.gba game.log.
The program will then create as much .dat as compressed data we found in the log. Next open TLP and open one of those .dat files. Choose view->format->gba and there it is the data you want to edit! to better understand it you can use Sprite Studio to create a good palette for the tiles.
You should read all the tutorials in this site about the programs I've mentioned and also there are very good tutorials here about gba hacking.

That helps a lot Odin_Knight.  I better go and download the tools.  The one thing I don't understand is when you are editing the .dat data, will it make the necessary changes to the rom?  Or would I have to import it back in myself?

Thanks for the help everyone.  I report back some when today or tomorrow about my progress.   

After that you need to reinsert he data. Just use GBACrusher, select Add files, select your file, then LZZ VRAM Safe and finally Crunch It. It will produce a file with your compressed data. Then open it in a hex editor, copy the data and reinsert that compressed data in some non used space of your ROM. Next you'll need to change the pointer of that data to the new location where you inserted the modified data
Solid One
Guest
« Reply #8 on: July 20, 2007, 08:18:14 am »

there's something interesting that can be done with unLZ.

always when a GBA rom is opened by unLZ, it firstly analyses the rom, searching for possible compressed LZ data, based in pointers. when it finds, it creates a file called romname.gba.spr or something like that, and besides it create too a file called romname.gba.pal, which refers to possible palettes found.

but the program isn't totally free of bugs yet. the game can find compressed data of games like Gunstar Super Heroes or Metroid Zero Mission easily, but can't find the same ones of games like Castlevania Aria of Sorrow or Megaman Zero. and for all those games i mentioned, the compressed graphics are in LZ, pointed by a 3-byte pointer, the same mechanism.

the same thing happen with the palette searching method. it can't find the palettes always. so, a useful hint is to activate "black and white palette". this way, atleast you'll be able to see something, and not only totally black stuff.

coming back to the file romname.gba.spr, the program only create this file and the other one if it don't exists. so, do the following: open that file in a hexadecimal editor and take a look into the hexadecimal part. if you're familiar with GBA pointer tables, you'll see that it's exactly pointer table data, in inversed order just like most gba games.

so, if you activate the logging just like Odin_Knight and go get the offsets, just like that way:

LZ77UnCompWram: 0x0819f8fc,0x02000000 (VCOUNT=77)

get the hexadecimal value 0x0819F8FC and remove the first 0x08. it'll become that way: 19F8FC. that's exactly the offset where the compressed graphic is.

in a form extremely similar, you'll find one or more pointers with this value somewhere in the rom:
FCF819.

if that's the case, if you hack the file romname.gba.spr and put inside the file the pointer value above, you'll see exactly the same graphic that you probably couldn't see normally in unLZ. and this way you can extract, edit, reinsert, etc.

maybe you'll have palette problems editing this way, but anyway good luck.
RadioShadow
Guest
« Reply #9 on: July 20, 2007, 10:08:28 am »

That is a useful trick Solid One.  It also means I could just tell which images Unlz has to load. 

Well I found the top half of the image.  The offset you guys found. Tongue



So it seems the image is separated into two.  Shouldn't be too hard to find the second image which is the one that needs changing as it should be the next image after the first compressed compressed data. 

Just got to use the logging tools to find the other compressed image in Gameboy Wars 1. 


Edit:

Quote from: labmaster on July 19, 2007, 07:31:51 pm
In vanilla VBA you can use Tools->Loggings to uncover all sorts of useful stuff:

Code:
LZ77UnCompWram: 0x0819f8fc,0x02000000 (VCOUNT=77)
DMA3: s=02000000 d=06000000 c=8000 count=00004b00

Labmaster, what do you mean by vanilla VBA? Is that a different version of VBA?  Its just the one I've download will not show 'LZ77UnCompWram:' results? 

Where can I download 'Vanilla VBA' from? If it exists. 
« Last Edit: July 20, 2007, 11:05:34 am by RadioShadow »
mit_mis
Guest
« Reply #10 on: July 20, 2007, 12:09:27 pm »

Correct me if I'm wrong but vanilla vba should just be an official version of the emulator.
labmaster
Guest
« Reply #11 on: July 20, 2007, 04:48:25 pm »

That was my bad - as Odin Knight said you specifically need the win32 'Dev' version of VBA. Select 'SWI' from the checkboxes (and DMA3, so you can see what ends up where in VRAM).
RadioShadow
Guest
« Reply #12 on: July 20, 2007, 06:20:39 pm »

I'm getting there.  As I've mentioned before, the image I want to edit is in two parts. 

After using the Logging tool, I found this:

Quote from: code
LZ77UnCompWram: 0x0819f8fc,0x02000000 (VCOUNT=77)
DMA3: s=02000000 d=06000000 c=8000 count=00004b00
LZ77UnCompWram: 0x081a27ac,0x02000000 (VCOUNT=77)
DMA3: s=02000000 d=06004b00 c=8000 count=00004b00

The two offsets that I need in order to get unlz.gba to load them are:

FCF81908 - Top Half of Image

AC271A08 - Bottom Half of Image

I'm only interested in the bottom half of the image where Olaf is located and too confirm the second offset is correct:




Now I got to find the compressed image offset in Gameboy Wars 1, extract the image and import it into AW1.  Then I can release the patch.  ^^
« Last Edit: July 20, 2007, 06:25:59 pm by RadioShadow »
RadioShadow
Guest
« Reply #13 on: July 20, 2007, 07:39:32 pm »

I've done it!



Thanks for all the help guys! 

I'm off to sleep now. Smiley
Solid One
Guest
« Reply #14 on: July 22, 2007, 04:04:47 pm »

good job.

now, based with this, you can edit most compressed LZ graphics in GBA roms. and you don't need to know programming and technical stuff about how to compress/decompress in LZ and make a program to make it for you (as is needed for most cases).

with unLZ, you still can recompress the data and put it in other place of the rom. this way, you can avoid problems of compressed data that became too big compared to the original. one thing i think people does is use the free non-used space that is available in most GBA roms. in some games where the rom size is 8mb and they uses alotta LZ compression, i already found almost 2mb of non-used space. summary, if that rom has 8mb, the total space used is less than 7mb, and all that space can be freely used as free space for texts, graphics, splashes, etc.

that explains the reason most roms that way have intros from groups who ripped the roms (splashes). and if you find a rom with more than 60k of free space gathered in one place, better get only roms without intros. else, maybe you'll have problems. the free space you probably is going to use, can be probably the same one groups used for intros. and it can make the rom crash in a way.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC