first_time entries would be longer, therefore the reference pointers inside the payload would shift.
To avoid that, we now reserve space for the longest entry, knowing that the texts will get stripped after
the payloads have been generated.
Doing so ensures that the text offsets remain constant, no matter if we're dealing with the first_time or othertimes payload.
This also means we need to take that reservation into account on the PTGB rom side of things of course.
To do so, I created a pair array indicating the first time entries and there non-first_time counterparts.
We'll determine which entry is the longest and ensure we use that length for the offset of the next entry.
This commit integrates the pregenerated payload into mystery_gift_injector.
It currently hardcodes the English Ruby v1.2 payload for testing purposes though.
The next test I'll have to do is to see if the transfer process works with this specific rom.
If it works, I can start integrating Pi's work in regards to delta patching using BPS.
Memory manufacturers and AAA game studios hate her!
With some clever rearranging, PTGB now uses only 36 KiB of the 64 KiB
BG VRAM. This means the remaining 28 KiB is free to use in the future.
Caveats: The flex tileset must not use more that 6 KiB. There is a check
for it added.
VRAM Map
06000000 - 06000800 ( 2K): Eternal backdrop and textbox tileset
06000800 - 06002000 ( 6K): Flex BG tileset
06002000 - 06002400 ( 2K): BG0: Backdrop tilemap
06002800 - 06003000 ( 2K): BG1: Flex BG tilemap
06003000 - 06003800 ( 2K): BG2: Textbox tilemap
06003800 - 06004000 ( 2K): BG3: Text tilemap
06004000 -~06009000 (20K): Text rendering bitmap
06009000 - 06010000 (28K): Free work RAM
06010000 - 06018000 (32K): Sprite tileset
Additionally:
- Explicitly clear VRAM on boot
- Dirty workaround to fix box drawing buffer overflow.
- Flex backgrounds use a table instead of a huge switch statement
- Textbox tile IDs are now const u16[] instead of int[]
Gameboy payload This update merges CMD_OpenSRAM and CMD_CloseSRAM into the single CMD_ModifySRAMAccess. It also fixes an issue caused by calling CMD_ReloadCurrentBox in gen 2 while the vblank interrupt was still disabled.update
For some reason, the merge broke the Write Cbl Data - CART functionality in the dbg menu.
The main problem is that writing a whole sector of data and erasing a sector is too slow to do in an IRQ handler.
Fix: Move the actual flash writing process to the main loop by creating a function called handleCartIO().
The IRQ handler writes to global_memory_buffer, and the handleCartIO() copies that
data to a local write buffer while the IRQ may still add more to global_memory_buffer.
Then it modifies the IRQ handlers' offset and moves the data that was appended in between to the start of the buffer all while
the IRQ handler is still appending new bytes.
If we end up at a sector boundary, we also do the erase_sector() call.
This was tested with and without the print link and print packets debug options.
Without the print options enabled, we end up occupying about 20KB on the cartridge save. (for 1st stage only!)
Man, this bug sucked. I rate it 1 star!
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.