Commit Graph

247 Commits

Author SHA1 Message Date
Philippe Symons
07e522fd62 Add comments, optimize rom space slightly and fix issue in debug_menu_entries.cpp 2026-03-10 11:58:43 +01:00
Philippe Symons
1590a1f108 Make the debug menu functional!
This adds a lot of the debug_mode.h options as an option you can modify at runtime.

I also moved both the text debug screen and the regular debug info screen in there.

And I added an option to start song playback.
2026-03-10 00:38:44 +01:00
Philippe Symons
10350179db Move debug info screen and text debug screen to debug menu 2026-03-09 23:12:32 +01:00
Philippe Symons
c498d59572 Split off the debug menu entries from the debug menu module 2026-03-09 20:36:54 +01:00
Philippe Symons
b84939b49a Add debug menu UI when you press L+R in the main menu.
It's only the UI yet. It only shows a couple of dummy options right now.
2026-03-09 19:56:32 +01:00
GearsProgress
12f710dafc Reapply "Release candidate"
This reverts commit 67aa927108.
2026-03-09 12:09:57 -04:00
GearsProgress
bf5cbbb438 Merge branch 'release-candidate' into text-debug-screen 2026-03-03 14:04:12 -05:00
Philippe Symons
b0abeaf5f6 Create vertical_menu widget
This commit implements a vertical menu widget, which should be quite a bit more flexible than
what we currently have.

It defines interfaces in order to respond to selection changes, show and hide. And has a i_item_widget
interface class to allow you to use custom item widgets.

This is done in preparation for adding a debug menu, in which I kinda want to add toggle options
while using the same vertical_menu widget.

Right now, vertical_menu is only used in Select_Menu. Needless to say that Select_Menu was reworked quite a bit.
Still, in terms of visuals or functionality, the changes should be invisible for now. I mean, I didn't do anything *new* with it yet.
2026-03-03 00:15:18 +01:00
GearsProgress
0d9b10d12c Fixing multiline centering 2026-02-28 16:32:33 -05:00
The Gears of Progress
67aa927108
Revert "Release candidate" 2026-02-24 00:04:47 -05:00
The Gears of Progress
0f003f0120
Merge branch 'text-debug-screen' into release-candidate 2026-02-24 00:02:10 -05:00
GearsProgress
dc75638d99 Merge branch 'text-debug-screen' into latest-release 2026-02-23 23:23:53 -05:00
The Gears of Progress
01376f422c
Merge pull request #107 from GearsProgress/latest-release
Update RC to LR
2026-02-23 23:08:40 -05:00
Philippe Symons
a7d8beb973 MaxMod sound engine lib integration
This commit integrates the MaxMod sound engine into PTGB.

Some test code already existed, but now it's done for real.

I added a thin API wrapper in sound.c/sound.h to abstract the sound engine.

One of AquaticAlloy's test songs was added to the main menu as a proof of concept.
We may want to disable it before the actual merge though.
2026-02-23 13:08:35 +01:00
easyaspi314
4cbc128c16 Improve movement data storage
Instead of each macro being a ternary (which can't be constant folded),
the values are now stored sequentially.

Additionally, I use byte instead of int and made the tables static

-1300 bytes.
2026-02-18 16:28:18 -05:00
The Gears of Progress
e1c3d1a4c2 Updating make files to use debug mode 2026-02-05 23:37:20 -05:00
The Gears of Progress
5e7e9b4df7 Updating makefile 2026-02-05 11:15:09 -05:00
The Gears of Progress
8b846a223b Adjusting text box width 2026-02-01 19:44:05 -05:00
The Gears of Progress
5447b39569 Updating dex menu and selections 2026-01-29 22:42:06 -05:00
The Gears of Progress
84dfe45866 Adding Japanese comma and debug text options 2026-01-28 21:52:55 -05:00
The Gears of Progress
aff5709717 Fully adding scroll support 2026-01-28 17:34:30 -05:00
The Gears of Progress
a64bc8c6a0 Combining fonts into one file 2026-01-27 10:34:06 -05:00
The Gears of Progress
26b89d17fc Updating font generation 2026-01-27 09:29:28 -05:00
The Gears of Progress
48c1ae7b14 Adding font generator 2026-01-26 11:47:28 -05:00
The Gears of Progress
1acbe99f93 Updating debug ROM to first check if real ROM has been inserted 2026-01-19 15:32:53 -05:00
The Gears of Progress
f50d42f61f Updating accent characters 2026-01-13 20:24:03 -05:00
The Gears of Progress
2309f7c493 Adding text debug menu 2026-01-11 17:33:02 -05:00
The Gears of Progress
2b7aeebe6b Merging pull request 2026-01-08 17:17:05 -05:00
The Gears of Progress
9fd3ff8e0b Setting as release version 2026-01-03 17:45:30 -05:00
The Gears of Progress
fff4588d4a Updating packet debug features and restricting data offset to positive numbers 2026-01-03 17:29:36 -05:00
The Gears of Progress
a5ff585596
Merge pull request #76 from GearsProgress/latest-release
Refactoring to latest "latest release" branch
2025-12-06 15:50:56 -05:00
The Gears of Progress
9ca5c650d0 Working on debugging 2025-12-03 22:08:35 -05:00
Philippe Symons
a7b2703bf8 Replace the PCCS code with a git submodule
This eliminates duplicate code. - Only maintain the code in one place!

To make sure the submodule is getting cloned too after cloning Poke_Transporter_GB, execute:
git submodule update --init --recursive

To update the submodule to a newer commit/different branch:

cd PCCS
git pull
git checkout <commit_or_branchname>
cd ..
git add PCCS
git commit
git push

The way it works is that a specific commit is tied to your Poke_Transporter_GB repository's PCCS folder.
2025-11-27 23:14:29 +01:00
The Gears of Progress
940b7547c4 Disabling debug mode 2025-10-12 16:59:17 -04:00
The Gears of Progress
a98a58eb4e Final finishing touches 2025-10-12 16:41:48 -04:00
The Gears of Progress
ba1a075701 Adding PCCS 2025-10-12 15:08:33 -04:00
The Gears of Progress
a0793c72c0 Fixing issues before implementing the CPCS 2025-09-20 17:17:20 -04:00
The Gears of Progress
ba9e30e8d0 Fixing a few bugs before merge 2025-07-28 16:18:51 -04:00
Philippe Symons
47cd143de6 Replace ZX0 by the builtin LZ10 compression.
LZ10 decompression is builtin to the GBA's bios, so we don't need ZX0. It's also significantly faster
(618 usec instead of 2311 usec in my personal benchmark code for decompression of the same data)

And it seems like by doing so, we saved 1 KB as well!

So, seems like replacing ZX0 is the right move.

The reason I didn't initially is because I misunderstood the documentation. I assumed LZ77UnCompWram could only uncompress into EWRAM, not IWRAM.
But it turns out it can do both.

And using standardized tools is usually better than using a custom implementation.

The only downside of this right now, is that we can no longer stream text tables through a smaller buffer than the entire decompressed size.

Anyway, things seem to work fine, so bye bye ZX0. It's been fun.
2025-07-18 16:19:34 +02:00
Philippe Symons
31c72b5390 Add class comment to payload_file_reader 2025-07-18 13:38:38 +02:00
Philippe Symons
2689ffd3cf Optimize Gameboy payloads for size by generating the payloads at runtime and generate binary patches
This commit moves payload_builder and the z80_asm code to the data-generator subproject in order to generate the gameboy payloads
at compile time instead of at runtime.

In addition, we select a couple of base payloads (more than 1 for compressibility's sake) and generate binary patches to transform them into
other payloads. We then generate a binary file with both the base payload and binary patches and compress these files with zx0.

This reduces the rom size by about 8 KB.
2025-07-18 12:48:50 +02:00
Philippe Symons
5e7118c0c7 Compress the gb_rom_values and gba_rom_values tables with ZX0. 2025-06-27 16:04:04 +02:00
The Gears of Progress
9e488ae2af Fixing Windows Environment 2025-06-24 16:35:32 -04:00
Philippe Symons
32db0d690d Implement custom malloc -> rom space: -3 KB, IWRAM: -1 KB
I found another way to optimize the rom space by implementing a custom malloc, free, realloc and calloc
function.

This reduces rom size by 3 KB and IWRAM usage by 1 KB. (elimination of __malloc_av). The original
implementation is much more complex and larger than it needs to be.

The custom malloc is implemented as a bitmap allocator. It keeps a bitmap to track which pages of the
heap are allocated. Like the original allocator, it uses the free space in EWRAM after the multiboot gba
rom. But unlike the original allocator, we control the size with CUSTOM_MALLOC_POOL_SIZE.

The custom malloc can be disabled with USE_CUSTOM_MALLOC.
2025-06-20 22:39:42 +02:00
Philippe Symons
5750abba2c Merge remote-tracking branch 'upstream/text-and-box-rewrite' into optimizations/implement-zx0-compression
Conflicts:
	source/payload_builder.cpp
2025-06-18 21:07:11 +02:00
Philippe Symons
be58d28781 Merge remote-tracking branch 'upstream/text-and-box-rewrite' into optimizations/reduce-binarysize-remove-libstdc++ 2025-06-18 20:59:18 +02:00
The Gears of Progress
9ebfd1bf57 Adding to gitignore 2025-06-18 14:45:12 -04:00
Philippe Symons
eef173b0d2 Fix crash + unrelated buffer overflow + some optimizations
There was a crash happening with ptgb::vector when you'd press A on the CONFIRM button of the box screen. It only occurred on actual gba hardware and
was a real heisenbug: as soon as you'd add code to display logs on screen, the problem would disappear. So it was very difficult to figure this one
out. We're not even entirely sure why, but it looks like the malloc/realloc/free use in ptgb::vector would cause issues.

Maybe it was alignment, but after messing with the code we also saw a warning appear in the terminal telling us that realloc wouldn't properly
deal with non-POD types. It complained about this very thing while referring to the add_track() function, which stores ptgb::vectors inside another
ptgb::vector. We also didn't have a custom copy constructor yet to actually copy the buffer instead of its pointer.
All of these could potentially have led to the crash. But debugging during the link cable flow was difficult, so we were never able to confirm it in
a debugger, log or dump.

Because I suspected the high IWRAM consumption (especially now with ZX0 decompression) for a while, I also did an optimization in mystery_gift_builder
to pass global_memory_buffer as its section_30_data buffer instead. This reduces IWRAM consumption by 4 KB.

There was another problem I discovered during my crash hunt: the out_array (now payload_buffer) was allocated as a 672 byte array, but the payloads
were actually 707 bytes. Therefore writing this to the buffer caused a buffer overflow, thereby corrupting the global variables appearing after it in
IWRAM. It turned out eventually that none of these variables were really critical, but it could explain some minor bugs GearsProgress has seen.

I also did a few performance optimizations:

- At various stages in the code, for loops were used to copy data from one buffer into another byte-by-byte. This was far from optimal because the gba
cpu can load/copy 4 bytes at a time if you ask it to. So I replaced those with memcpy(), which is a hand-optimized assembly function to copy data
using this principle.

- generate_payload was being called twice: once at start_link and once at continue_link, giving the exact same result, even though it was already
being stored in a global buffer allocated in IWRAM. This was also a fairly heavy function. So I optimized the code to only initialize it once in
the script chain and then just retrieve the buffer.

- generate_payload was constructing the eventual payload twice even within the same call. That's because it first merged z80_rng_seed, z80_payload
and z80_patchlist into a full_data ptgb::vector, after which it then copied the data again to out_array (now called payload_buffer). I eliminated the
full_data vector now.
2025-06-18 10:23:03 +02:00
The Gears of Progress
48b55d9b9c Adding sprite locations for all English games 2025-06-06 15:30:26 -04:00
Philippe Symons
00261cd8d8 Merge branch 'optimizations/reduce-binarysize-remove-libstdc++' into optimizations/implement-zx0-compression 2025-05-28 21:07:36 +02:00