Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
5227aa6
Add the NES, Game Boy / Color, Master System / Game Gear, MSX, Doom a…
finger563 Nov 14, 2026
c914e1b
NES: full speed (nofrendo audio frame size fix)
finger563 Nov 14, 2026
01d8b93
README: measured status of the new cores
finger563 Nov 14, 2026
23d0bdf
ScummVM (Star Trek: 25th Anniversary): the core, its cart and platform
finger563 Nov 14, 2026
0b5d46e
ScummVM: Star Trek runs (saves, loads, quits); allocations in PSRAM
finger563 Nov 14, 2026
d104a14
ScummVM: fix the PSRAM leaks (Star Trek), allocation tracker build op…
finger563 Nov 14, 2026
9bcf515
Fix the games that ran out of memory after Dark Forces / Star Trek; D…
finger563 Nov 15, 2026
5623987
JK: OpenJKDF2 fd47e34 (libsmacker double free when a 16-bit tree buil…
finger563 Nov 15, 2026
7e7f12f
JK, TPM: really free the per-session buffers (shrink_to_fit() is a no…
finger563 Nov 15, 2026
95342d4
scummvm: Star Trek speech, intro stall and planet fixes
finger563 Nov 15, 2026
5ad765d
scummvm: Star Trek intro draws the Enterprise, planet and credits
finger563 Nov 15, 2026
28154bb
scummvm: Star Trek's viewscreen, planets, orbit and mission fly-bys
finger563 Nov 15, 2026
a4ec9ec
ScummVM: star map and warp; the video setting once the screen's size …
finger563 Nov 15, 2026
e332245
ScummVM: Star Trek's space combat and missions
finger563 Nov 15, 2026
e529ae6
ScummVM: Star Trek speed bars as a touch control
finger563 Nov 15, 2026
1018339
scummvm: ST25 intro credits and planet, speed bars let go
finger563 Nov 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ jobs:
uses: actions/checkout@v4

- name: Checkout the game submodules (without their desktop-only nested submodules)
run: git submodule update --init components/jk/OpenJKDF2 components/mgs/mgs_reversing components/mgs/psyz components/tpm/tpm-decomp components/genesis/gwenesis components/pico8/femto8
run: |
git submodule update --init components/jk/OpenJKDF2 components/mgs/mgs_reversing components/mgs/psyz components/tpm/tpm-decomp components/genesis/gwenesis components/pico8/femto8 components/nes/nofrendo components/gbc/gnuboy components/msx/fmsx components/sms/smsplus components/doom/prboom components/darkforces/TheForceEngine
# ScummVM's history is large: only the pinned commit
git submodule update --init --depth 1 components/scummvm/scummvm

- name: Build
uses: espressif/esp-idf-ci-action@v1
Expand Down
28 changes: 28 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,31 @@
path = components/pico8/femto8
url = https://github.com/esp-cpp/femto8.git
branch = esp32
[submodule "components/nes/nofrendo"]
path = components/nes/nofrendo
url = https://github.com/esp-cpp/nofrendo.git
branch = main
[submodule "components/gbc/gnuboy"]
path = components/gbc/gnuboy
url = https://github.com/esp-cpp/gnuboy.git
branch = main
[submodule "components/msx/fmsx"]
path = components/msx/fmsx
url = https://github.com/esp-cpp/fmsx.git
branch = main
[submodule "components/sms/smsplus"]
path = components/sms/smsplus
url = https://github.com/esp-cpp/smsplus.git
branch = main
[submodule "components/doom/prboom"]
path = components/doom/prboom
url = https://github.com/esp-cpp/prboom.git
branch = main
[submodule "components/darkforces/TheForceEngine"]
path = components/darkforces/TheForceEngine
url = https://github.com/esp-cpp/TheForceEngine.git
branch = main
[submodule "components/scummvm/scummvm"]
path = components/scummvm/scummvm
url = https://github.com/esp-cpp/scummvm.git
branch = esp32p4
45 changes: 41 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,21 @@ set(TPM_COMPONENTS tpm)
### PICO-8 (femto8, shared with esp-box-emu) ###
set(PICO8_COMPONENTS pico8)

### Dark Forces (The Force Engine port, shared with esp-box-emu) ###
# set(DARK_FORCES_COMPONENTS "dark_forces")
### Cores shared with esp-box-emu (each core + its port/ glue a submodule) ###
### NES (nofrendo) ###
set(NES_COMPONENTS nes)
### Game Boy / Color (gnuboy) ###
set(GBC_COMPONENTS gbc)
### Master System / Game Gear (SMS Plus) ###
set(SMS_COMPONENTS sms)
### MSX (fMSX) ###
set(MSX_COMPONENTS msx)
### Doom (PrBoom) ###
set(DOOM_COMPONENTS doom)
### Dark Forces (The Force Engine) ###
set(DARK_FORCES_COMPONENTS darkforces)
### ScummVM (esp-cpp/scummvm: Star Trek: 25th Anniversary / Judgment Rites) ###
set(SCUMMVM_COMPONENTS scummvm)

if(JK_COMPONENTS)
add_compile_definitions(ENABLE_JK)
Expand All @@ -55,8 +68,26 @@ if(PICO8_COMPONENTS)
add_compile_definitions(ENABLE_PICO8)
endif()

if(NES_COMPONENTS)
add_compile_definitions(ENABLE_NES)
endif()
if(GBC_COMPONENTS)
add_compile_definitions(ENABLE_GBC)
endif()
if(SMS_COMPONENTS)
add_compile_definitions(ENABLE_SMS)
endif()
if(MSX_COMPONENTS)
add_compile_definitions(ENABLE_MSX)
endif()
if(DOOM_COMPONENTS)
add_compile_definitions(ENABLE_DOOM)
endif()
if(DARK_FORCES_COMPONENTS)
add_compile_definitions(ENABLE_DARK_FORCES)
add_compile_definitions(ENABLE_DARKFORCES)
endif()
if(SCUMMVM_COMPONENTS)
add_compile_definitions(ENABLE_SCUMMVM)
endif()

set(GAME_COMPONENTS
Expand All @@ -67,13 +98,19 @@ set(GAME_COMPONENTS
${MGS_COMPONENTS}
${TPM_COMPONENTS}
${PICO8_COMPONENTS}
${NES_COMPONENTS}
${GBC_COMPONENTS}
${SMS_COMPONENTS}
${MSX_COMPONENTS}
${DOOM_COMPONENTS}
${DARK_FORCES_COMPONENTS}
${SCUMMVM_COMPONENTS}
)

set(
COMPONENTS
main esptool_py esp_lcd esp_psram task format display display_drivers monitor timer
${GAME_COMPONENTS} tab5-emu gui menu rom_info statistics settings devlink
${GAME_COMPONENTS} tab5-emu pool_allocator gui menu rom_info statistics settings devlink
CACHE STRING
"List of components to include"
FORCE
Expand Down
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ plan and its history are in [docs/PLAN.md](docs/PLAN.md).
| Genesis / Mega Drive | gwenesis (shared with esp-box-emu) | full speed |
| SNES | snes9x2005 | full speed |
| Game Boy Advance | gpSP | close to full speed; heavy scenes drop a few frames |
| NES | nofrendo (shared with esp-box-emu) | full speed (~3 ms a frame) |
| Game Boy / Color | gnuboy (shared with esp-box-emu) | full speed |
| Master System / Game Gear | SMS Plus (shared with esp-box-emu) | full speed |
| MSX | fMSX (shared with esp-box-emu) | runs (Metal Gear) |
| Doom | PrBoom (shared with esp-box-emu) | ~35 fps (shareware demo) |
| Dark Forces | The Force Engine (shared with esp-box-emu) | ~50 fps in the first level |

The cores shared with esp-box-emu are submodules (the core plus its `port/`
glue, written against `BoxEmu`, which the Tab5 aliases to `Tab5Emu`), so a
fix in one firmware reaches the other.

https://github.com/user-attachments/assets/641a64b0-b3af-429b-8582-a38fc9a5cdad

Expand Down Expand Up @@ -175,6 +185,9 @@ components/
mgs/ Metal Gear Solid: mgs_reversing + psyz submodules + the Tab5 platform layer
tpm/ The Phantom Menace: tpm-decomp submodule (static recompiler + runtime) + glue
gba/ genesis/ snes/ the emulator cores and their glue
nes/ gbc/ sms/ msx/ doom/ darkforces/ pico8/
the cores shared with esp-box-emu (submodules: core + port/ glue)
pool_allocator/ the allocator MSX, Doom and Dark Forces run in their 4 MB block
docs/PLAN.md the Jedi Knight plan and history
```

Expand All @@ -197,6 +210,9 @@ docs/PLAN.md the Jedi Knight plan and history
mgs/ # Metal Gear Solid, extracted from your own US disc
STAGE.DIR RADIO.DAT FACE.DAT ZMOVIE.STR VOX.DAT DEMO.DAT BRF.DAT
# (components/mgs/mgs_reversing/port/extract_disc.py)
doom/ # doom1.wad, doom.wad, doom2.wad, ... (the IWADs)
darkforces/ # your Dark Forces install: DARK.GOB, SOUNDS.GOB, TEXTURES.GOB, SPRITES.GOB, LFDs
nes/ gbc/ sms/ gg/ msx/ ... # cartridge ROMs (any folder: metadata.csv has the paths)
tpm/ # The Phantom Menace, USA Rev 1: the .bin of a bin/cue rip
Star Wars - Episode I - The Phantom Menace (USA) (Rev 1).bin
saves/ # save states and their screenshots; the PlayStation
Expand All @@ -206,8 +222,10 @@ docs/PLAN.md the Jedi Knight plan and history

Example `metadata.csv` (one line per game: rom path, boxart, name; the
platform comes from the path: `.md`/`.gen` Genesis, `.sfc`/`.smc` SNES,
`.gba` Game Boy Advance, `jk.cd` Jedi Knight, `STAGE.DIR` Metal Gear Solid,
`SLUS_008.84` The Phantom Menace):
`.gba` Game Boy Advance, `.nes` NES, `.gb`/`.gbc` Game Boy / Color, `.sms`
Master System, `.gg` Game Gear, `.rom` MSX, `.wad` Doom, `DARK.GOB` Dark
Forces, `.p8`/`.p8.png` PICO-8, `jk.cd` Jedi Knight, `STAGE.DIR` Metal Gear
Solid, `SLUS_008.84` The Phantom Menace):

```
jk/jk.cd, boxart/jk.jpg, Star Wars: Jedi Knight - Dark Forces II
Expand Down Expand Up @@ -277,8 +295,8 @@ console's games. Tapping the console above the boxart (or X on a gamepad, F
on a keyboard) opens the console picker, which shows only one console's
games, or all of them again; an outline on the console means the list is
filtered, and left / right then move the filter to the next console.
`emulink filter <console>` (snes, gba, genesis, playstation, pc, pico8 or
all) does the same over USB.
`emulink filter <console>` (nes, snes, gb, gbc, gba, sms, gg, genesis, msx,
playstation, pc, pico8 or all) does the same over USB.

Jedi Knight gets the full keyboard and mouse look; on a gamepad the left
stick strafes, the right stick looks, R = fire, L = secondary fire, A =
Expand Down
111 changes: 111 additions & 0 deletions components/darkforces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Dark Forces for esp-box-emu, built on The Force Engine (TFE).
#
# From the esp-cpp/TheForceEngine submodule: TheForceEngine/tfe is a subset of
# BSzili's Amiga branch of TFE (based on TFE v1.09.410) with the __AMIGA__
# platform guards renamed to TFE_ESPBOX (see TheForceEngine/VENDOR.md);
# TheForceEngine/port/platform provides the ESP32 implementations of the
# platform interfaces (system timers, render backend, audio, threads, memory
# regions, stubs).
set(TFE_SRC_DIRS
"TheForceEngine/tfe/TFE_System"
"TheForceEngine/tfe/TFE_Memory"
"TheForceEngine/tfe/TFE_FileSystem"
"TheForceEngine/tfe/TFE_Archive"
"TheForceEngine/tfe/TFE_Asset"
"TheForceEngine/tfe/TFE_Audio"
"TheForceEngine/tfe/TFE_Audio/MidiSynth"
"TheForceEngine/tfe/TFE_Input"
"TheForceEngine/tfe/TFE_Settings"
"TheForceEngine/tfe/TFE_Game"
"TheForceEngine/tfe/TFE_Outlaws"
"TheForceEngine/tfe/TFE_Jedi/Collision"
"TheForceEngine/tfe/TFE_Jedi/IMuse"
"TheForceEngine/tfe/TFE_Jedi/InfSystem"
"TheForceEngine/tfe/TFE_Jedi/Level"
"TheForceEngine/tfe/TFE_Jedi/Math"
"TheForceEngine/tfe/TFE_Jedi/Memory"
"TheForceEngine/tfe/TFE_Jedi/Serialization"
"TheForceEngine/tfe/TFE_Jedi/Task"
"TheForceEngine/tfe/TFE_Jedi/Renderer"
"TheForceEngine/tfe/TFE_Jedi/Renderer/RClassic_Fixed"
"TheForceEngine/tfe/TFE_Jedi/Renderer/RClassic_Fixed/robj3d_fixed"
"TheForceEngine/tfe/TFE_DarkForces"
"TheForceEngine/tfe/TFE_DarkForces/Actor"
"TheForceEngine/tfe/TFE_DarkForces/GameUI"
"TheForceEngine/tfe/TFE_DarkForces/Landru"
)

idf_component_register(
INCLUDE_DIRS "TheForceEngine/port/include"
SRC_DIRS "TheForceEngine/port" "TheForceEngine/port/platform" ${TFE_SRC_DIRS}
PRIV_INCLUDE_DIRS "TheForceEngine/tfe" "TheForceEngine/port/platform"
REQUIRES tab5-emu statistics pool_allocator esp_timer pthread heap esp_system
)

target_compile_definitions(${COMPONENT_LIB} PRIVATE
TFE_ESPBOX=1
TFE_ESPBOX_BASE_DIR="/sdcard/darkforces/"
)

target_compile_options(${COMPONENT_LIB} PRIVATE
-Os
-Wno-error
-Wno-type-limits
-Wno-ignored-qualifiers
-Wno-unused-variable
-Wno-unused-but-set-variable
-Wno-unused-function
-Wno-switch
-Wno-sign-compare
-Wno-missing-field-initializers
-Wno-format
-Wno-format-truncation
-Wno-error=maybe-uninitialized
-Wno-error=array-bounds
-Wno-error=stringop-overflow
-Wno-error=stringop-truncation
-Wno-error=deprecated-declarations
-Wno-error=narrowing
-Wno-error=address
-Wno-error=class-memaccess
-Wno-error=reorder
-Wno-error=parentheses
-Wno-error=misleading-indentation
-Wno-error=int-in-bool-context
-Wno-error=sequence-point
-Wno-error=strict-aliasing
-Wno-error=char-subscripts
-Wno-error=unused-value
-Wno-error=implicit-fallthrough
$<$<COMPILE_LANGUAGE:C>:-Wno-error=incompatible-pointer-types>
$<$<COMPILE_LANGUAGE:C>:-Wno-error=discarded-qualifiers>
)

# The renderer and the OPL3 synthesizer are the hot paths: optimize those for speed.
file(GLOB_RECURSE DF_HOT_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/tfe/TFE_Jedi/Renderer/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/tfe/TFE_Jedi/Math/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/tfe/TFE_Audio/MidiSynth/*.c"
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/tfe/TFE_Audio/MidiSynth/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/tfe/TFE_Jedi/IMuse/imDigitalSound.cpp"
)
set_source_files_properties(${DF_HOT_SOURCES} PROPERTIES COMPILE_OPTIONS "-O2")

# Everything Dark Forces allocates lives in BoxEmu's 4MB ROM block while it runs
# (TheForceEngine/port/platform/esp_alloc.cpp): rename the allocation functions referenced by
# this library to the df_* replacements, and route free()/realloc() of block
# pointers made anywhere in the firmware back to the block.
add_custom_command(TARGET ${COMPONENT_LIB} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} --redefine-syms=${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/port/alloc_redirect.syms $<TARGET_FILE:${COMPONENT_LIB}>
COMMENT "Redirecting Dark Forces allocations to the ROM block"
VERBATIM)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=free" "-Wl,--wrap=realloc")
# the core's static state (.bss and .data) lives in PSRAM (see the post-build step; the P4
# linker script has no ldgen placeholder for external RAM); no gp-relative
# small data then
target_compile_options(${COMPONENT_LIB} PRIVATE -msmall-data-limit=0)
add_custom_command(TARGET ${COMPONENT_LIB} POST_BUILD
COMMAND ${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../../tools/bss_to_psram.py
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> --data
COMMENT "Moving the darkforces core's .bss and .data to PSRAM"
VERBATIM)
1 change: 1 addition & 0 deletions components/darkforces/TheForceEngine
Submodule TheForceEngine added at 03417f
31 changes: 31 additions & 0 deletions components/doom/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Doom: PrBoom, from the esp-cpp/prboom submodule (the engine in
# prboom/prboom, its glue in prboom/port)
idf_component_register(
INCLUDE_DIRS "prboom/port/include"
SRC_DIRS "prboom/port" "prboom/prboom"
PRIV_INCLUDE_DIRS "prboom" "prboom/prboom"
REQUIRES tab5-emu shared_memory
)
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-error=address
-Wno-error=sizeof-pointer-memaccess
-Wno-misleading-indentation
-Wno-format-overflow
-Wno-char-subscripts
$<$<COMPILE_LANGUAGE:C>:-std=gnu17>
$<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>
$<$<COMPILE_LANGUAGE:C>:-Wno-error=incompatible-pointer-types>
$<$<COMPILE_LANGUAGE:C>:-Wno-error=compare-distinct-pointer-types>
-Wno-missing-field-initializers
-DHAVE_CONFIG_H
-O2
)
# the core's static state (.bss and .data) lives in PSRAM (see the post-build step; the P4
# linker script has no ldgen placeholder for external RAM); no gp-relative
# small data then
target_compile_options(${COMPONENT_LIB} PRIVATE -msmall-data-limit=0)
add_custom_command(TARGET ${COMPONENT_LIB} POST_BUILD
COMMAND ${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../../tools/bss_to_psram.py
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> --data
COMMENT "Moving the doom core's .bss and .data to PSRAM"
VERBATIM)
1 change: 1 addition & 0 deletions components/doom/prboom
Submodule prboom added at b18131
26 changes: 26 additions & 0 deletions components/gbc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Game Boy / Color: gnuboy, from the esp-cpp/gnuboy submodule (the core in
# gnuboy/gnuboy, its glue in gnuboy/port)
idf_component_register(
INCLUDE_DIRS "gnuboy/port/include"
SRC_DIRS "gnuboy/port" "gnuboy/gnuboy/src"
PRIV_INCLUDE_DIRS "gnuboy/gnuboy/include"
REQUIRES "tab5-emu" "statistics" "shared_memory"
)

target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-misleading-indentation -Wno-implicit-fallthrough -Wno-unused-function -Wno-unused-variable $<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>)
target_compile_definitions(${COMPONENT_LIB} PRIVATE GNUBOY_NO_MINIZIP GNUBOY_NO_SCREENSHOT IS_LITTLE_ENDIAN)
# the core's static state (.bss and .data) lives in PSRAM (see the post-build step; the P4
# linker script has no ldgen placeholder for external RAM); no gp-relative
# small data then
target_compile_options(${COMPONENT_LIB} PRIVATE -msmall-data-limit=0)
add_custom_command(TARGET ${COMPONENT_LIB} POST_BUILD
COMMAND ${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../../tools/bss_to_psram.py
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> --data
COMMENT "Moving the gbc core's .bss and .data to PSRAM"
VERBATIM)
# globals other cores in this firmware define too (the box doesn't build
# those): renamed in this library, its glue included
add_custom_command(TARGET ${COMPONENT_LIB} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} --redefine-syms=${CMAKE_CURRENT_LIST_DIR}/symbol_renames.syms $<TARGET_FILE:${COMPONENT_LIB}>
COMMENT "Renaming the globals another core also defines"
VERBATIM)
1 change: 1 addition & 0 deletions components/gbc/gnuboy
Submodule gnuboy added at 4585d0
3 changes: 3 additions & 0 deletions components/gbc/symbol_renames.syms
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hw_reset gnuboy_hw_reset
rtc gnuboy_rtc
sound_off gnuboy_sound_off
2 changes: 1 addition & 1 deletion components/jk/OpenJKDF2
Loading
Loading