Skip to content

Commit

Permalink
Change line endings to LF
Browse files Browse the repository at this point in the history
  • Loading branch information
phase committed Dec 28, 2015
1 parent c650f92 commit a80d0d1
Show file tree
Hide file tree
Showing 10 changed files with 2,150 additions and 2,150 deletions.
2,336 changes: 1,168 additions & 1,168 deletions DOCUMENTATION.md

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<h1 align="center">Sonic Battle Hacking</h1>
<p align="center">This is a repository for hacking Sonic Battle,
a game for the GameBoy Advanced released in 2004.</p>

##Documentation
All docs on Sonic Battle reverse engineering are in [**`DOCUMENTATION.md`**](DOCUMENTATION.md).

##Hack Suite
This hack suite is written in Java (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
<h1 align="center">Sonic Battle Hacking</h1>
<p align="center">This is a repository for hacking Sonic Battle,
a game for the GameBoy Advanced released in 2004.</p>

##Documentation
All docs on Sonic Battle reverse engineering are in [**`DOCUMENTATION.md`**](DOCUMENTATION.md).

##Hack Suite
This hack suite is written in Java (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.
36 changes: 18 additions & 18 deletions dark_sonic.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
; Dark Sonic Patch ;

$47AFB8 ; Sonic's Palette ;
E0 7F
FF 7F
D6 DA
CE 39
84 10
60 FE
C6 18
C0 18
00 00
C6 18
C0 18
00 00
39 7F
73 7E
8C 7D
; Dark Sonic Patch ;

$47AFB8 ; Sonic's Palette ;
E0 7F
FF 7F
D6 DA
CE 39
84 10
60 FE
C6 18
C0 18
00 00
C6 18
C0 18
00 00
39 7F
73 7E
8C 7D
60 82
94 changes: 47 additions & 47 deletions src/xyz/jadonfowler/sbhs/GBAColor.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
package xyz.jadonfowler.sbhs;

import java.awt.Color;

public class GBAColor {
public static Color fromGBA(String hex) {
assert hex.length() == 4 : "Woah! This string isn't 4 characters wide!";
int h = Integer.parseInt(hex, 16), r = 0, g = 0, b = 0;
while (h - (4 * 256) >= 0) {
b += 8;
h -= (4 * 256);
}
while (h - 32 >= 0) {
g += 8;
h -= 32;
}
r = h * 8;
int t = 255;
r = r > t ? t : r;
g = g > t ? t : g;
b = b > t ? t : b;
Color c = new Color(r, g, b);
return c;
}

public static String toGBA(int r, int g, int b) {
r = (int) r / 8;
g = ((int) g / 8) * 32;
b = ((int) b / 8) * 256 * 4;
int i = r + g + b;
return (i < Math.pow(16, 3) ? "0" : "") + (i < 256 ? "0" : "") + (i < 16 ? "0" : "")
+ Integer.toHexString(r + g + b);
}

public static String toGBA(Color c) {
return toGBA(c.getRed(), c.getGreen(), c.getBlue());
}

public static int[] toInts(String s) {
assert s.length() == 4 : "Woah! This string isn't 4 characters wide!";
char[] c = s.toCharArray();
int[] i = new int[2];
i[0] = Integer.parseInt(c[0] + "" + c[1], 16);
i[1] = Integer.parseInt(c[2] + "" + c[3], 16);
return i;
}

package xyz.jadonfowler.sbhs;

import java.awt.Color;

public class GBAColor {
public static Color fromGBA(String hex) {
assert hex.length() == 4 : "Woah! This string isn't 4 characters wide!";
int h = Integer.parseInt(hex, 16), r = 0, g = 0, b = 0;
while (h - (4 * 256) >= 0) {
b += 8;
h -= (4 * 256);
}
while (h - 32 >= 0) {
g += 8;
h -= 32;
}
r = h * 8;
int t = 255;
r = r > t ? t : r;
g = g > t ? t : g;
b = b > t ? t : b;
Color c = new Color(r, g, b);
return c;
}

public static String toGBA(int r, int g, int b) {
r = (int) r / 8;
g = ((int) g / 8) * 32;
b = ((int) b / 8) * 256 * 4;
int i = r + g + b;
return (i < Math.pow(16, 3) ? "0" : "") + (i < 256 ? "0" : "") + (i < 16 ? "0" : "")
+ Integer.toHexString(r + g + b);
}

public static String toGBA(Color c) {
return toGBA(c.getRed(), c.getGreen(), c.getBlue());
}

public static int[] toInts(String s) {
assert s.length() == 4 : "Woah! This string isn't 4 characters wide!";
char[] c = s.toCharArray();
int[] i = new int[2];
i[0] = Integer.parseInt(c[0] + "" + c[1], 16);
i[1] = Integer.parseInt(c[2] + "" + c[3], 16);
return i;
}

}
Loading

0 comments on commit a80d0d1

Please sign in to comment.