Code Monkey home page Code Monkey logo

sbhs's Introduction

Sonic Battle Hacking

Github All Releases Build Status codebeat badge Discord

This is a repository for hacking Sonic Battle, a game for the GameBoy Advanced released in 2004.

Check out the website for the latest downloads!

You can join our Discord for information on updates.

Documentation

All docs on Sonic Battle reverse engineering are in DOCUMENTATION.md.

Hack Suite

This hack suite is written in Kotlin (because GUIs and portability). It has tools to edit Palettes, Dialogue, Sprites, and more. Do note that it is a WIP, and not all the features are implemented yet.

Contributing

If you find any new research on SB, make an issue and we can discuss expanding upon it or including it into the Hack Suite. Stand-alone tools can also be placed in this repo, just submit a PR and make sure your code is documented and pretty.

sbhs's People

Contributors

phase avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sbhs's Issues

Add Splash Screen

A splash screen would be nice for showing users that the application has started. Right now it hangs in the background until the main window is up, and that isn't very user-friendly.

Palette writing and simplicity issues.

I love it so far, its by far one of the easiest tools I have used to date that does anything but edit a text document. However, the process is a bit different to how you describe and I end up with the palette failing to change.

To make a sheet for the game I had to:

  1. Make a 16 colour palette for my character (Blaze) consisting of the BG colour first.
  2. Import that in as a PNG to convert it to GBA colours.
  3. Export that as a PNG.
  4. Convert my sprites into the new colour palette.
  5. Put the new GBA palette in the corner of the character's sheet (I was using Sonic)
  6. Make the sheet as described.
  7. Import that onto Sonic, then write to ROM.

Then I end up with this:
Left: In game
Right: In editor
bug with sbhs

The sprite imports flawlessly but the palette doesn't. I suppose this could be remedied using an older version where the palette swapping works (The one where you demo-ed Tails Doll) or changing the palette with another program.

But I am glad to finally get my hands on this and use it.

Possible false alarm, I tested it with Visual Boy Advance and it worked flawlessly, its probably something wrong with Retroarch.

Battlefield Editing

The battlefields, as said on the SCHG, are done using two background layers - BG2 and BG3, with BG2 being the upper layer and BG3 being the lower layer. The walls are sprites drawn in after to create the '3D Battlefield' effect.

In the game's RAM, BG2 begins at 0600E000 and BG3 begins at 0600F000. The way the fields are set up is by numbering the tiles used on the ground. For instance, and using Green Hill Zone as an example, if we were to change the values 0600E600 from
image
to
image
then we could change this platform from
image
to
image
Which is all fine and dandy. The tile layouts of the maps are stored in the same exactly way they pop up in the RAM, too, so it's easy to find. For instance, the upper layer part of Green Hill Zone begins at 467478.
image

The issue with this, however, is how the game decides these platforms can be stood on. The walls aren't drawn in based on the position of the platforms or anything - I modified Green Hill Zone a bit to be sure - and the walls seem to be what make platforms able to be stood on. Without them, you just fall through any additions to the upper layer. I haven't the slightest idea how the game decides where to write in walls. As such, completely retooling maps is impossible right now.

You can totally fiddle with the tiles and make pretty elaborate texture hacks of already existing levels, though.

Music Hacking

@Glimmericious created a nice tutorial that I'm copying here to archive. (Copying all of these images was very annoying because Google Docs makes it a hassle.)


Alright, so, to transfer music from one game to another, you’ll want to do a few things:

Export the tracks from the game you want to borrow a track from.

a

This one’s self-explanatory - just hit ‘export tracks’ while the track you wanna use is selected.

b

Check everything on the list and name them in 2 however you would like. I would recommend naming it something simple. $T is replaced by the track number and $P is replaced by the track’s pointer, so do what you gotta. After that:

c

It’s important to make sure that $I is included, as it shows what instrument you’ll be replacing in your voice table. The format I usually use is $I $T, for simplicity’s sake.

Now, on the target game…

Go to the track you’re replacing and import the tracks.

d

The tracks you exported will be where your ROM file is, which is lovely.

Use

e

To navigate to the folder where your rom is, and hit ‘OK’. Then, check off of the tracks you want to import, and hit ‘Import.’ Viola! Now your tracks from the song are imported, but you still need to import samples to make sure that your song sounds right.

Importing Samples

This is a bit less simple.

You’ll want to browse to where your samples are stored. How you stored them doesn’t matter that much - .raw, .s, .wav, et cetera. Once it’s selected, you’ll need free space to import it to. In Sonic Battle, you’ll find that FB0000 and beyond are free, so if you haven’t messed with anything, use that instead.

f

And then, Import. It will tell you what space is being occupied by the samples, and I suggest you keep track of it and which instrument is stored where. You don’t want to import your samples in places overlapping, and you definitely want to know where you stored everything for later.

You can only insert samples at the beginnings of lines. What that means is that if your sample is stored from, say, FB0000 to FB1432, you would have to import the next sample at FB1440.

Checking Instrument Use/The Voice Table

Beside every track, there’s a handy-dandy arrow. Click it to show more detailed information about the track.

g

There’s a lot of stuff here, but what you’re really worried about are the red numbers on the far left. Play the song for a moment, and those will change to something else -

h

These numbers are what instrument is playing. On your imported track, these numbers will be important, so pull up the Voice Table.

i

This is where keeping track of where each track is stored is important - go to the instrument shown that isn’t playing correctly. Change the Output Device to DirectSound, and change Address1 to where you stored your track earlier. For example, if Instrument 48 isn’t right, you will Import sample 48 and change Address1 to where you imported Sample 48 to. You’ll want to repeat this process for every instrument that plays.

Other Instruments

If the instrument is not a DirectSound, it doesn’t have a sample. So, instead, you’ll want to pull up the game you’re copying from again. Go the defective instrument in its Voice Table, and copy down the properties of the instrument.

j

This instrument has an Atk of 0, Dec of 0, Sus of 15 and Rel of 0. Copy everything down and head back to your other game. Copy the properties down, and you’re already done! Way fewer steps than with samples.

From a MIDI

This is a bit out of my territory, but I can try. You can use mid2agb to convert midis to tracks that Sappy can then use. You’ll want to Assemble the Song instead of something else, however.

k

That part’s simple. After that, you have to get the samples that the MIDI is using. I’m not sure how to do this, but Google does provide a few samples you could import and probably get something pretty similar. The process of importing the samples and changing the instruments to the new addresses should, theoretically, remain the same.

Character Voices

Character voices are also on instruments, so it’s pretty easy. Import the voice you want to use - although it has to be a .wav file - and repeat the process of finding the instrument and changing the Address1 of the instrument.

Text Editor Not Working

I used every version with the text editor feature, and each didn't work. I clicked the "Write to ROM" button after making edits, and nothing happens.

Sprite sheet writes as background colour.

Whenever I import a spritesheet (After I initially succeeded, it now breaks.) it only imports a background colour. Typically just the light blue.

I have tried saving as a 16 bit bitmap, converting the entire image to the indexed palette to no avail. It is then unusable as the character is invisible.

Forcing me to convert the character I want to insert into the base pallette (In this case, sonics) then change the palette in SBHS

Animation Reverse Engineering

Glimmer found the attack offsets and here's everything we've found.

00053370 - Sonic Attack One
000533E8 - Sonic Attack Two
00053460 - Sonic Attack Three
000534E4 - Sonic Heavy
000535D8 - Sonic Upper
00053860 - Sonic Eagle Kick Thing
000538D0 - Aerial Kick Thing
00053940 - Sonic Ground Special Ball Thing
00053A58 - Sonic Air Special Shockwave Ball Thing
00053CCC - Sonic Ball Special Part 1
00053DA0 - Sonic Ball Special Part 2
00053DE8 - Sonic Ball Special Part 3

Here's a reference image for the values we're modifying.

reference in HxD


Original: 05 00 27 00 01 00 25 00 02 00 26 00 42 00 00 10 04 00 F0 FF 43

5337x Default Value Description
00 05 Damage
01 00 doesn't affect anything
02 27
03 00
04 01 Attack Type
05 00
06 25 see table below
07 00 Nulls attack if it is anything other than 00
08 02 Hitstun
09 00
0A 26 If set to 02, it plays a landing animation
0B 00
0C 42 Frame index. 42 plays the second frame of the animation, 44 plays the fourth frame, etc.
0D 00
0E 00
0F 10 Position of animation? See table
10 04 Length of the animation
11 00 If set to anything other than 00, it freezes in the middle of the animation
12 F0
13 FF
14 43 Frame index. 42 plays the second frame of the animation, 44 plays the fourth frame, etc.
53376 value Description Gif
25 Normal?
anything else? Sets the attack type of the move to the attack type you last used. 53376 set to 26
5337F value Description Gif
10 Normal
01 Flickering? 0f_01
11 Shifted forward 0f_11
12 Shifted downward 0f_12

Attack Type

Value at 0x53374 Description Gif
01 Weak Hit gif
02 Heavy Hit gif
03 Heavy Hit Up gif
04 Weak Hit Up gif
05 Nothing (for projectile attacks?) gif
06 Weak Hit gif
07 Heavy Hit Down gif
08 Light Launch gif
09 Stun gif
0A Hit Up gif
0B Heavy Launch gif
0C Some glitchy thing gif
0D Hit Up gif
0E Launch gif
0F Hit Up gif

Support exporting to an IPS patch

People want IPS patches very badly, so allowing users to export a spritesheet along with the IPS patch should help (or both in a zip) should help users on mobile.

Milestones for the Hack Suite

alright, so I've made a special list of goals for the project we can look around. If you could, you set this issue as some sorta of milestone.

Major Goals:

  • Make every playable character sprite doable for customization
  • Eggman and Phis can be edited
  • Every character's stats can be changed
  • Hitboxes and Hurtboxes can be edited
  • Arena textures can be swapped
  • Story dialogue can be edited

Minor Goals:

  • Story Art can be altered
  • Skill Cards stats can be changed
  • Sprite canvas can be resized to it's possible max
  • Effects sprites can be edited
  • entire arenas can be changed
  • event areas can be placed anywhere in Story Mode
  • map graphics can be changed

Dream Goals:

  • every graphic can be altered, from title to final credits
  • option to add custom character/arena slots
  • option to add custom chapters in Story Mode
  • option to add custom Skill Cards
  • option to add more custom Enemies and Boss characters beyond Phis and Eggman
  • feats to push the game further than its former.

edited by Phase for formatting

Edit Compressed Images

Images in the ROM are (well, should be) LZ77 compressed. Being able to edit these images in the suite would awesome, as using more than one tool is always a hassle.

A good way to start this would be to figure out how UNLZ GBA finds the compressed images in the ROM (probably through a header or something).

Emerl Color Editing

Emerl has a billion colors that you can use to customize him with. This means there are a billion palettes that are modifiable, including character palettes, the original Emerl palette, multiplayer palettes, and copy palettes.

These are the character offsets.

0047AA18 - Sonic Color
0047AA38 - Tails Color
0047AA58 - Knuckles Color
0047AA78 - Shadow Color
0047AA98 - Rouge Color
0047AAB8 - Amy Color
0047AAD8 - Cream Color
0047ABF8 - Gamma Color
0047AB18 - Chaos Color
0047AB38 - Emerl Color

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.