Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4d24d1e
Launcher and pause menu on emu-ui, the screens shared with esp-box-emu
finger563 Nov 19, 2026
936961e
esp_timer stack 8 KB (as the box): the launcher's settings panel over…
finger563 Nov 19, 2026
ac521c1
emu-ui: the dpad moves the selection, the list follows at the edges
finger563 Nov 19, 2026
edb8019
emu-ui: the pause menu's FPS shows on the box, a long title scrolls
finger563 Nov 19, 2026
53edf44
The launcher shows each game's save count
finger563 Nov 19, 2026
b7b00ba
menu: the screenshot buffers only while the menu is open
finger563 Nov 19, 2026
e8691a3
Plain malloc goes to PSRAM first at any size (ALWAYSINTERNAL 256 -> 0)
finger563 Nov 19, 2026
57b3698
snes: free the screenshot buffer at deinit
finger563 Nov 19, 2026
8112002
emu-ui: fixed pattern tile table; nofrendo: input_register bounds
finger563 Nov 19, 2026
6c3af76
darkforces: allocator fallback in PSRAM; emulink: the game's fps in t…
finger563 Nov 19, 2026
cdb09ee
MSX: start is F1, Y opens fMSX's menu; real-speed frames; keyboard F-…
finger563 Nov 20, 2026
d3b1874
Move the soak-test fixes into their own PR
finger563 Nov 20, 2026
18faae2
snes: free the screenshot buffer at deinit
finger563 Nov 19, 2026
7ca9fe7
nofrendo: input_register bounds
finger563 Nov 20, 2026
2564a1e
darkforces: allocator fallback in PSRAM; emulink: the game's fps in t…
finger563 Nov 19, 2026
774ea50
MSX: start is F1, Y opens fMSX's menu; real-speed frames; keyboard F-…
finger563 Nov 20, 2026
926a96d
emulink: the USB link's service task at priority 5 on core 1
finger563 Nov 20, 2026
4ed9df5
emulink: status fps is the frames shown per second
finger563 Nov 20, 2026
91b1772
fmsx: the start + select chord across polls; screenshots of a whole f…
finger563 Nov 20, 2026
fc01f79
Execute from flash; the game cores' code in a PSRAM overlay
finger563 Nov 20, 2026
4c42c1b
video: the per-frame path in IRAM, the LVGL rotation read once per game
finger563 Nov 20, 2026
80079ee
LVGL and the GUI from PSRAM; fixes from a review of the overlay
finger563 Nov 20, 2026
0792628
gui: box art through the P4's JPEG decoder, scaled once to the cover'…
finger563 Nov 20, 2026
83fdaf8
Merge main (#26 / #28 squash-merged) into feat/flash-xip
finger563 Nov 20, 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
34 changes: 34 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,40 @@ project(tab5-emu)

set(CMAKE_CXX_STANDARD 23)

# Executing from flash, .ext_ram.data (components/tab5-emu/ext_ram_data.ld)
# is PSRAM, which the image cannot hold: after linking, its bytes go into the
# flash array tab5_ext_ram_data_image and the section becomes NOBITS, before
# the .bin is made from the ELF
if(NOT CONFIG_SPIRAM_XIP_FROM_PSRAM)
idf_build_get_property(python PYTHON)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME}.elf POST_BUILD
COMMAND ${python} ${CMAKE_CURRENT_LIST_DIR}/tools/ext_ram_data_image.py $<TARGET_FILE:${CMAKE_PROJECT_NAME}.elf>
# likewise the game cores' code overlay (components/tab5-emu/overlay.ld),
# and check that only the carts reach into it
COMMAND ${python} ${CMAKE_CURRENT_LIST_DIR}/tools/overlay_image.py $<TARGET_FILE:${CMAKE_PROJECT_NAME}.elf>
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map
COMMENT "Storing .ext_ram.data and the core code overlay in flash"
VERBATIM)
endif()

# Executing from flash, LVGL and the GUI (they draw in software: from flash
# the launcher redraws visibly) run from PSRAM instead: their code and
# read-only data go to .tab5_res (tools/bss_to_psram.py --psram-code,
# components/tab5-emu/overlay.ld), filled from flash at boot. Done on the
# archives just before the link (a POST_BUILD step can only be added in the
# component's own directory, and LVGL is a managed component); renaming an
# archive whose sections are renamed already does nothing.
if(NOT CONFIG_SPIRAM_XIP_FROM_PSRAM)
foreach(component lvgl__lvgl emu-ui gui menu)
idf_component_get_property(lib ${component} COMPONENT_LIB)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME}.elf PRE_LINK
COMMAND ${python} ${CMAKE_CURRENT_LIST_DIR}/tools/bss_to_psram.py
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${lib}> --no-bss --psram-code
COMMENT "Moving ${component}'s code to PSRAM"
VERBATIM)
endforeach()
endif()

# The updater app (updater/) belongs in ota_1 (see partitions.csv): build it
# first (idf.py -C updater build) and `idf.py flash`, flash_args and
# flasher_args.json (the release package) put it there with the emulator.
Expand Down
9 changes: 8 additions & 1 deletion components/darkforces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,15 @@ target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=free" "-Wl,--wrap=r
# 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)
# executing from flash, the core's code is part of the PSRAM code overlay
# (components/tab5-emu/overlay.ld)
include(${CMAKE_CURRENT_LIST_DIR}/../../tools/overlay.cmake)
tab5_overlay_args(darkforces overlay_args "^(__wrap_|df_|espbox_pool_|_ZN10TFE_Memory)" "^_ZN12_GLOBAL__N_1L[0-9]+(inBlock|liveHeader|poolAllocLocked|poolFreeLocked|noteOverflow|censusVisit|dfAlloc|dfFree|dfRealloc)E")
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
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> ${overlay_args}
# .data to PSRAM: via .rodata where XIP copies it into PSRAM (writable),
# else into .ext_ram.data (filled at boot from flash; see the script)
--data --data-into=$<IF:$<BOOL:${CONFIG_SPIRAM_XIP_FROM_PSRAM}>,rodata,ext_ram>
COMMENT "Moving the darkforces core's .bss and .data to PSRAM"
VERBATIM)
9 changes: 8 additions & 1 deletion components/doom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ target_compile_options(${COMPONENT_LIB} PRIVATE
# 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)
# executing from flash, the core's code is part of the PSRAM code overlay
# (components/tab5-emu/overlay.ld)
include(${CMAKE_CURRENT_LIST_DIR}/../../tools/overlay.cmake)
tab5_overlay_args(doom overlay_args)
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
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> ${overlay_args}
# .data to PSRAM: via .rodata where XIP copies it into PSRAM (writable),
# else into .ext_ram.data (filled at boot from flash; see the script)
--data --data-into=$<IF:$<BOOL:${CONFIG_SPIRAM_XIP_FROM_PSRAM}>,rodata,ext_ram>
COMMENT "Moving the doom core's .bss and .data to PSRAM"
VERBATIM)
6 changes: 5 additions & 1 deletion components/gba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ target_compile_definitions(${COMPONENT_LIB} PRIVATE __LIBRETRO__ ROM_BUFFER_SIZE
target_compile_options(${COMPONENT_LIB} PRIVATE -O3 -fno-strict-aliasing -fjump-tables -ftree-switch-conversion -msmall-data-limit=0 -include ${CMAKE_CURRENT_LIST_DIR}/gpsp/retro_inline.h
-Wno-error -w -Wno-error=incompatible-pointer-types -Wno-error=int-conversion
-Wno-error=implicit-function-declaration -Wno-error=discarded-qualifiers)
# executing from flash, the core's code is part of the PSRAM code overlay
# (components/tab5-emu/overlay.ld)
include(${CMAKE_CURRENT_LIST_DIR}/../../tools/overlay.cmake)
tab5_overlay_args(gba overlay_args)
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}>
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> ${overlay_args}
--keep reg,reg_mode,spsr,cpu_ticks,io_registers,oam_ram,palette_ram,palette_ram_converted,oam_update_count
COMMENT "Moving the GBA core's .bss to PSRAM"
VERBATIM)
Expand Down
9 changes: 8 additions & 1 deletion components/gbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ target_compile_definitions(${COMPONENT_LIB} PRIVATE GNUBOY_NO_MINIZIP GNUBOY_NO_
# 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)
# executing from flash, the core's code is part of the PSRAM code overlay
# (components/tab5-emu/overlay.ld)
include(${CMAKE_CURRENT_LIST_DIR}/../../tools/overlay.cmake)
tab5_overlay_args(gbc overlay_args)
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
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> ${overlay_args}
# .data to PSRAM: via .rodata where XIP copies it into PSRAM (writable),
# else into .ext_ram.data (filled at boot from flash; see the script)
--data --data-into=$<IF:$<BOOL:${CONFIG_SPIRAM_XIP_FROM_PSRAM}>,rodata,ext_ram>
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
Expand Down
6 changes: 5 additions & 1 deletion components/genesis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-const-variable -Wno-
-Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=address -Wno-error=misleading-indentation)
# target_compile_definitions(${COMPONENT_LIB} PRIVATE GWENESIS_AUDIO_ACCURATE=0 BUILD_TABLES=0 TABLES_FULL=0)
target_compile_definitions(${COMPONENT_LIB} PRIVATE GWENESIS_AUDIO_ACCURATE=0)
# executing from flash, the core's code is part of the PSRAM code overlay
# (components/tab5-emu/overlay.ld)
include(${CMAKE_CURRENT_LIST_DIR}/../../tools/overlay.cmake)
tab5_overlay_args(genesis overlay_args)
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}>
${CMAKE_OBJDUMP} ${CMAKE_OBJCOPY} $<TARGET_FILE:${COMPONENT_LIB}> ${overlay_args}
COMMENT "Moving the Genesis core's .bss to PSRAM"
VERBATIM)
2 changes: 1 addition & 1 deletion components/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
idf_component_register(
INCLUDE_DIRS "include"
SRC_DIRS "src"
REQUIRES lvgl emu-ui timer logger rom_info settings tab5-emu app_update esp_app_format)
REQUIRES lvgl emu-ui timer logger rom_info settings tab5-emu app_update esp_app_format esp_driver_jpeg)
7 changes: 5 additions & 2 deletions components/gui/include/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ class Gui {
void on_volume(const std::vector<uint8_t> &data);
void on_battery(const std::vector<uint8_t> &data);

/// Decode a JPEG on the SD card into a new RGB565 draw buffer (nullptr if it cannot)
lv_draw_buf_t *decode_image(const std::string &path);
/// Decode a JPEG on the SD card into a new RGB565 draw buffer (nullptr if
/// it cannot), scaled to fit a box x box square (box > 0)
lv_draw_buf_t *decode_image(const std::string &path, int box = 0);
lv_draw_buf_t *decode_jpeg_hw(const std::string &path, int box);
static lv_draw_buf_t *fit_image(const uint8_t *src, int w, int h, int stride, int box);
const void *cover(size_t index);
const void *console_art(const std::string &key);

Expand Down
Loading
Loading