mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-07-15 07:44:11 -05:00
This commit allows you to use the Write Cbl Data debug option and new Load Cbl Data debug option to dump a link's data to SRAM or load it from SRAM and pretend like you got it over the link cable. This is useful for capturing the link process on gameboy and replay + debug it later in an emulator.
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
#include <tonc.h>
|
|
#include <string.h>
|
|
|
|
// This file is autogenerated from the file in the graphics folder
|
|
//#include "ptgb_logo_l.h"
|
|
//#include "ptgb_logo_r.h"
|
|
#include "multiboot_rom_bin.h"
|
|
|
|
#define SPRITE_CHAR_BLOCK 4
|
|
#define DST_EWRAM (void*)0x02000000
|
|
#define MULTIBOOT_ENTRY_POINT (void*)0x020000C0
|
|
|
|
static const char saveType[] __attribute__((used)) = "SRAM_V113";
|
|
|
|
/**
|
|
* Loads the PokeTransporter multiboot rom into EWRAM
|
|
*/
|
|
static void load_multiboot_rom(const void *src, size_t size)
|
|
{
|
|
REG_IME = 0; // Disable all interrupts
|
|
memcpy(DST_EWRAM, src, size);
|
|
REG_IME = 1;
|
|
}
|
|
/**
|
|
* Now jump to the multiboot rom address and start execution
|
|
*/
|
|
static void execute_multiboot()
|
|
{
|
|
// Function pointer to EWRAM execution entry
|
|
void (*entry)(void) = MULTIBOOT_ENTRY_POINT;
|
|
entry(); // Jump to loaded ROM
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
irq_init(NULL);
|
|
irq_enable(II_VBLANK);
|
|
|
|
tte_init_chr4c_default(0, BG_CBB(0) | BG_SBB(31));
|
|
tte_set_pos(92, 68);
|
|
|
|
REG_DISPCNT = DCNT_MODE0 | DCNT_BG0 | DCNT_OBJ | DCNT_OBJ_1D;
|
|
|
|
VBlankIntrWait();
|
|
|
|
load_multiboot_rom(multiboot_rom_bin, multiboot_rom_bin_size);
|
|
|
|
execute_multiboot();
|
|
}
|