Skip to content

Working glib2d - #38

Closed
bzz11g wants to merge 57 commits into
rgimad:mainfrom
bzz11g:working-glib2d
Closed

bzz11g wants to merge 57 commits into
rgimad:mainfrom
bzz11g:working-glib2d

Conversation

@bzz11g

@bzz11g bzz11g commented Sep 22, 2026

Copy link
Copy Markdown

No description provided.

bzz11g and others added 30 commits September 8, 2026 13:34
- Modifies `CMakeLists.txt` to conditionally use `create_pbp_file` and inject required PSP SDK libraries.
- Patches `src/main.cpp` with `<pspkernel.h>` and `PSP_MODULE_INFO` / `PSP_MAIN_THREAD_ATTR` to satisfy PSP import fixups.
- Authors `AGENTS.md` documenting PSP build commands, file boundaries, asset packaging configuration, and toolchain expectations.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- Modifies `.github/workflows/build.yml` to use `pspdev/pspdev:latest`
- Replaces Ubuntu and Windows build jobs with a single PSP build job using `psp-cmake`.
- Uploads the resulting `EBOOT.PBP` as the `GravityDefied-PSP` artifact.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- Modifies `.github/workflows/build.yml` to use `pspdev/pspdev:latest`
- Replaces Ubuntu and Windows build jobs with a single PSP build job using `psp-cmake`.
- Uploads the resulting `EBOOT.PBP` as the `GravityDefied-PSP` artifact.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
Implement native PSP EBOOT packaging and configuration
- Set default window dimensions to 480x272 to match PSP active display.
- Configure SDL renderer with `SDL_RENDERER_PRESENTVSYNC` to fix screen tearing.
- Set logical resolution to 480x272 using `SDL_RenderSetLogicalSize` to ensure correct scale mapping.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- Remove SDL_RenderSetLogicalSize which caused severe slowdowns on PSP due to redundant framebuffer copy passes.
- Ensure proper frame clearing by calling SDL_RenderClear and SDL_SetRenderDrawColor before every frame paint in CanvasImpl to prevent visual stacking artifacts.
- Decrease default font sizes in Font.cpp (from 32/16/12 to 24/12/9) to fit natively inside the 480x272 viewport without scaling.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- Refactored Graphics::drawString to use a character-level glyph cache instead of caching full strings. This bounds memory consumption and fixes an OOM leak caused by caching constantly changing timer strings.
- Added texture destruction in ~Graphics() to safely manage cached glyphs.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- Reverted character-by-character blitting back to full-string rendering (`TTF_RenderText_Blended`) to eliminate kerning accumulation errors causing sub-pixel culling. Re-implemented bounded text cache `textCache` (max 256) to handle dynamic strings safely.
- Enabled TTF hinting (`TTF_SetFontHinting(font, TTF_HINTING_NORMAL)`) in `Font` to snap glyph stems precisely to screen pixel boundaries.
- Slightly bumped TTF point sizes (+2pt) to ensure thin stems ('l', 'i') measure at least 1-2 solid pixels at 272p vertical resolution.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- In `CanvasImpl::clear()`, added `SDL_SetRenderTarget(renderer, nullptr)` before clearing to guarantee the backbuffer is explicitly targeted, fixing the 0-clear hardware bug.
- Initialized SDL gamepad subsystems and mapped `SDL_CONTROLLERBUTTONDOWN` / `SDL_CONTROLLERBUTTONUP` events to fix missing input controls on PSP.
- Increased the `Graphics::drawString` texture cache size limit from 256 to 1024, preventing rapid cache evictions caused by the game timer, restoring menu frame rate from 3 FPS back to normal.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…4027

Adapt rendering resolution for PSP screen and resolve display glitches
- Implemented standard PSP exit callback (`sceKernelRegisterExitCallback`) in `src/main.cpp` for correct PSP Home button exit sequence behavior.
- Added PSP controller mapping in `src/lcdui/CanvasImpl.cpp` using `SDL_CONTROLLERBUTTONDOWN`, `SDL_CONTROLLERBUTTONUP`, and `SDL_CONTROLLERAXISMOTION` events.
- D-pad and analog stick mapped to arrow keys `UP/DOWN/LEFT/RIGHT`.
- Mapped face buttons `Cross`, `Circle`, `Square`, `Triangle` and shoulder triggers `L/R` to correctly represent original J2ME keypad controls (`1`, `2`, `3`, `4`, `6`, `8`) during in-game mode (checking `Micro::isInGameMenu`).
- Fixed unmapped key crash in `Canvas::getGameAction()` by returning `-1` instead of throwing `std::runtime_error`.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…4932710419788338216

Implement PSP controller mappings & Home button exit callback
Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…nd save isolation

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…1743164360950

Add dynamic custom level pack loader (.mrg files) and UI integration
- Removed `inputSetting` and `field_375` from `MenuManager` which tracked "Input: Keyset 1, 2, 3".
- Hardcoded the internal `field_367` setting to `0` (Keyset 1) so it defaults to the primary input mapping permanently.
- Cleaned up the 'Keys' help menu by removing Keyset 2 and 3 instructions and renaming the heading to 'Controls'.
- Simplified the 'Options' help text, omitting the Input entry.
- Hardcoded `0` at index 14 when saving the record store data to maintain save file compatibility while disabling the option completely.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…1613500

Remove obsolete J2ME keyset settings from Options menu
Added PREVIEW_PATH mapping in CMakeLists.txt to pass assets/PIC0.png
into the create_pbp_file macro. This embeds the PIC0.png image as
a preview image when packaged into the final EBOOT.PBP so it appears
in the PSP XMB menu.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
bzz11g and others added 27 commits September 9, 2026 07:57
This commit successfully adds the PREVIEW_PATH mapping in CMakeLists.txt
so assets/PIC0.png is included in the PSP EBOOT packaging. It also restores
the cmake/ and winres/ directories that were erroneously deleted, which
had broken the Windows build in CI.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
Add PIC0.png to the PSP EBOOT packaging pipeline
- Extract application directory from argv[0] safely with fallback to "./".
- Construct <app_dir>save/ directory and ensure it is created using POSIX/PSP mkdir APIs.
- Eliminate std::filesystem and C++ exception throws from path resolution and save logic.
- Ensure graceful application shutdown and file closing.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- Resolve absolute app path safely using progName, getcwd, or ms0:/PSP/GAME/GravityDefied/ fallback.
- Avoid truncating 0-byte save files on open when no data exists.
- Ensure save file writes use C POSIX I/O with explicit fflush() and fclose().
- Remove std::filesystem and C++ exceptions from RecordStore and related modules.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
- Organize RMS save files per level pack inside <app_dir>save/<pack_name>/.
- Dynamically resolve absolute executable directory with getcwd and PSP ms0:/ fallbacks.
- Ensure root save directory and pack subdirectories are created before file I/O.
- Flush all open RecordStores on level completion and application exit.
- Use standard binary C I/O with explicit fflush() and fclose().

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…ordStore

- Fix directory creation on PSP by stripping trailing slashes and creating parent/child save folders sequentially.
- Fix RecordEnumerationImpl::nextRecordId() to return currentPos - 1 so record updates occur in-place.
- Ensure setRecord updates records in-place or appends if out of bounds, flushing to disk immediately.
- Preserve level pack subdirectories and binary C I/O with explicit fflush() and fclose().

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…r-12952041093752246457

Move save data to a local 'save' folder next to executable
Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…tep from 60 FPS rendering.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…acing.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…ibility.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…ing and PSP hardware compatibility.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…constraints.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
… clipping.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
…406815344652458

Fix track line clipping, start flag flickering, and try to unlock 60 FPS
- Update CMakeLists.txt to build glib2d, intraFont, libccc, and pspSetup
- Link native PSP libraries (pspgu, pspgum, pspdisplay, pspge, pspctrl, psppower, psprtc, pspvram, freetype, z, png, jpeg, bz2)
- Implement InitGame() and ExitGame() in pspSetup with 333MHz PSP CPU clock configuration
- Replace SDL2 Graphics, Font, and Image with hardware-accelerated gLib2D and intraFont
- Replace SDL2 CanvasImpl presentation with g2dClear, g2dFlip(G2D_VSYNC), and sceDisplayWaitVblankStart
- Implement PSP controller button and analog stick polling in CanvasImpl
- Replace SDL_Delay in Time::sleep with sceKernelDelayThread

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
Use psp-config --psp-prefix and $ENV{PSPDEV} to locate the freetype2 include directory dynamically in both local and CI environments.

Co-authored-by: bzz11g <1549909+bzz11g@users.noreply.github.com>
@bzz11g bzz11g closed this Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant