-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
685d0e0
commit 6c6e727
Showing
33 changed files
with
3,322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/rgbds/* | ||
!/rgbds/place rgbds here.txt | ||
/roms/* | ||
!/roms/place original rom here.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Super Game Boy Border Injector | ||
============================== | ||
|
||
This project contains code designed to inject a custom Super Game Boy Border into any Game Boy ROM in the most possible user-friendly way. | ||
|
||
It comes in two different implementations: | ||
- Web implementation | ||
- ASM implementation | ||
|
||
|
||
|
||
## Web implementation | ||
This is probably what everyone is looking for: a simple [web app](https://www.marcrobledo.com/super-game-boy-border-converter/) that does the magic for you! | ||
|
||
Just select your desired ROM and Super Game Boy border data and the app will build the SGB compatible ROM with your border and even custom palette. | ||
|
||
You might probably need [Super Game Boy Border Converter](https://github.com/marcrobledo/super-game-boy-border-converter/), which will convert any image to the needed data the injector asks for. | ||
|
||
This web injector just automatizes the process of injecting the assembled code from the ASM implementation below. | ||
|
||
|
||
|
||
## ASM implementation | ||
This [RGBDS](https://github.com/gbdev/rgbds) skeleton project allows you to inject a custom Super Game Boy Border to any Game Boy ROM. | ||
|
||
Thanks to [xenophile](https://github.com/xenophile127), [Imanol Barriuso](https://github.com/imanolea) and [nitro2k01](https://github.com/nitro2k01) for their help! | ||
|
||
### How to compile | ||
1. Get [RGBDS](https://rgbds.gbdev.io/install) and unzip it at `rgbds` folder. | ||
2. Place the game you are going to patch as `roms/input.gb` file. | ||
3. Read `src/settings.asm` carefully and edit it, filling all needed offsets and constants for your game. | ||
4. Compile with `assemble.bat` (Windows) or `assemble.sh` (Unix). | ||
5. If there were no errors, a ROM `roms/output.gb` will be created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@echo off | ||
|
||
SET SOURCE_FILENAME=input.gb | ||
SET TARGET_FILENAME=output.gb | ||
|
||
|
||
|
||
REM delete current assembled rom | ||
IF EXIST .\roms\%TARGET_FILENAME% del .\roms\%TARGET_FILENAME% | ||
|
||
SET OBJ_FILENAME=%TARGET_FILENAME:.gb=.obj% | ||
SET SYM_FILENAME=%TARGET_FILENAME:.gb=.sym% | ||
|
||
cd src | ||
:begin | ||
set assemble=1 | ||
echo assembling... | ||
..\rgbds\rgbasm -o%OBJ_FILENAME% main.asm | ||
if errorlevel 1 goto error | ||
echo linking... | ||
REM -n generates a sym file with subroutines name and offsets for debugger | ||
..\rgbds\rgblink -o../roms/%TARGET_FILENAME% -O./../roms/%SOURCE_FILENAME% -n../roms/%SYM_FILENAME% %OBJ_FILENAME% | ||
if errorlevel 1 goto error | ||
echo fixing... | ||
..\rgbds\rgbfix -p0 -v ../roms/%TARGET_FILENAME% | ||
del %OBJ_FILENAME% | ||
goto end | ||
:error | ||
pause | ||
:end | ||
cd.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
|
||
source_filename='input.gb' | ||
target_filename='output.gb' | ||
|
||
if [ -f $target_filename ]; then | ||
rm $target_filename | ||
fi | ||
|
||
cd src | ||
export assemble=1 | ||
|
||
echo "assembling..." | ||
../rgbds/rgbasm -ooutput.obj main.asm | ||
if [ $? -eq 1 ] | ||
then | ||
echo "Failed assembling" | ||
exit 1 | ||
fi | ||
|
||
echo "linking..." | ||
../rgbds/rgblink -o../roms/$target_filename -O./../roms/$source_filename -n../roms/output.sym output.obj | ||
if [ $? -eq 1 ] | ||
then | ||
echo "Failed linking" | ||
exit 1 | ||
fi | ||
|
||
echo "fixing..." | ||
../rgbds/rgbfix -p0 -v ../roms/$target_filename | ||
rm output.obj | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@echo off | ||
|
||
SET TARGET_FILENAME=output.gb | ||
|
||
del roms\%TARGET_FILENAME% | ||
del roms\*.sym | ||
del src\*.obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
; ------------------------------------------------------------------------------ | ||
; Super Game Boy border injector for Kid Dracula | ||
; by Marc Robledo 2024 | ||
; | ||
; More info at https://github.com/marcrobledo/super-game-boy-border-injector | ||
; ------------------------------------------------------------------------------ | ||
|
||
|
||
|
||
; GAME BOOT OFFSET | ||
; ---------------- | ||
; Put here the game's boot jp offset found in in $0101. | ||
; Usually $0150, but could be different depending on game. | ||
DEF GAME_BOOT_OFFSET EQU $0150 | ||
|
||
|
||
|
||
; BANK 0 ROM FREE SPACE | ||
; --------------------- | ||
; 16 bytes in bank 0 are needed for the game's boot hook subroutine. | ||
; Hopefully, there should be enough space at the end of bank 0 or in the | ||
; interruption or rst vector ($0000-$00ff). | ||
; In the worst scenario, you will need to carefully move some code/data to | ||
; other banks. | ||
DEF BANK0_FREE_SPACE EQU $3fd0 | ||
|
||
|
||
|
||
; NEW CODE LOCATION | ||
; ----------------- | ||
; We need an empty bank to store all new code plus border data, which will be | ||
; quite big. | ||
; If the game has no empty bank, just use a bank higher than the original | ||
; game's bank number, RGBDS will expand the ROM and fix the header. | ||
; Safe bank numbers, depending on original game's ROM size: | ||
; - 32kb --> impossible to do it without changing MBC | ||
; - 64kb --> bank $04 | ||
; - 128kb --> bank $08 | ||
; - 256kb --> bank $10 | ||
; - 512kb --> bank $20 | ||
; - 1024kb --> bank $40 | ||
DEF SGB_CODE_BANK EQU $10 | ||
|
||
|
||
|
||
; CUSTOM GB PALETTE | ||
; ----------------- | ||
; set CUSTOM_GB_PALETTE_ENABLED to 1 if you want a custom GB palette for the | ||
; entire game screen | ||
; colors are RGB15 which means RGB components can go from 0 up to 31 | ||
; warning: even if set to 0, do not delete BUILD_CUSTOM_GB_PALETTE macro! | ||
DEF CUSTOM_GB_PALETTE_ENABLED EQU 1 | ||
MACRO BUILD_CUSTOM_GB_PALETTE | ||
RGB 29, 30, 26 ;color 0 (light) | ||
RGB 30, 18, 4 ;color 1 | ||
RGB 9, 7, 18 ;color 2 | ||
RGB 3, 0, 5 ;color 3 (dark) | ||
ENDM |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
download at https://github.com/gbdev/rgbds/releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
place original ROM as "input.gb" |
Oops, something went wrong.