Skip to content

Commit

Permalink
Merged launcher into retro-core
Browse files Browse the repository at this point in the history
Benefits:
- retro-core can now be built and flashed with `idf.py` (assuming the user doesn't care about DOOM and fMSX)
- retro-core being standalone means it can be built for platforms with no concept of partitions/multiple exes
- Reduced firmware size
- All retro-core apps can now access wifi if they want
- Faster builds because it means one less app

Drawbacks:
- It breaks git history for launcher files (but `--follow` mostly works around that)
- The presence of the wifi stack, even when not enabled, reserves some amount of internal memory
  • Loading branch information
ducalex committed Nov 29, 2024
1 parent ed162cf commit b59b8d6
Show file tree
Hide file tree
Showing 75 changed files with 33 additions and 43 deletions.
8 changes: 4 additions & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Run `python rg_tool.py --help` to see all available flags and commands.
- Generate a .img to be flashed with esptool.py (Serial):\
`python rg_tool.py build-img` or `python rg_tool.py release` (clean build)

For a smaller build you can also specify which apps you want, for example the launcher + DOOM only:
1. `python rg_tool.py build-fw launcher prboom-go`
For a smaller build you can also specify which apps you want, for example DOOM only:
1. `python rg_tool.py build-fw prboom-go`

Note that the app named `retro-core` contains the following emulators: NES, PCE, G&W, Lynx, and SMS/GG/COL. As such, these emulators cannot be selected individually. The reason for the bundling is simply size, together they account for a mere 700KB instead of almost 3MB when they were built separately.
Note that the app named `retro-core` contains the launcher as well as the following emulators: NES, PCE, G&W, Lynx, and SMS/GG/COL. As such, these applications cannot be selected individually and if you want the launcher, you need retro-core. The reason for the bundling is mainly greatly reduced firmware size.


## Flashing an image for the first time
Expand Down Expand Up @@ -80,7 +80,7 @@ or even do nothing at all. In such cases you should use `python rg_tool.py ...`


## Changing the launcher's images
All images used by the launcher (headers, logos) are located in `launcher/main/images`. If you edit them you must run the `launcher/main/gen_images.py` script to regenerate `images.c`. Magenta (rgb(255, 0, 255) / 0xF81F) is used as the transparency color.
All images used by the launcher (headers, logos) are located in `retro-core/components/launcher/images`. If you edit them you must run the `retro-core/components/launcher/gen_images.py` script to regenerate `images.c`. Magenta (rgb(255, 0, 255) / 0xF81F) is used as the transparency color.


## Updating translations
Expand Down
2 changes: 1 addition & 1 deletion components/retro-go/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
// #endif

#ifndef RG_APP_LAUNCHER
#define RG_APP_LAUNCHER "launcher"
#define RG_APP_LAUNCHER "retro-core"
#endif

#ifndef RG_APP_FACTORY
Expand Down
5 changes: 5 additions & 0 deletions components/retro-go/targets/odroid-go/sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_OCCUPY_HSPI_HOST=n
CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y
CONFIG_SPIRAM_OCCUPY_NO_HOST=n
# This places Wifi/LWIP buffers on the external memory (saves 13KB)
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y

#
# FAT Filesystem support
Expand Down Expand Up @@ -189,3 +191,6 @@ CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="../partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="../partitions.csv"


CONFIG_LWIP_IPV6=n
4 changes: 0 additions & 4 deletions launcher/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions launcher/main/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions retro-core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.5)
set(COMPONENTS "main retro-go nofrendo gnuboy pce-go gw-emulator handy smsplus snes9x")
set(RG_ENABLE_NETWORKING 0)
set(COMPONENTS "main retro-go nofrendo gnuboy pce-go gw-emulator handy smsplus snes9x launcher wifi esp_http_server")
include(../base.cmake)
project(retro-core)
13 changes: 10 additions & 3 deletions retro-core/components/launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
set(COMPONENT_SRCDIRS ". libs")
set(COMPONENT_ADD_INCLUDEDIRS ". libs")
set(COMPONENT_SRCDIRS ".")
set(COMPONENT_ADD_INCLUDEDIRS ".")
set(COMPONENT_REQUIRES "retro-go esp_http_server")
register_component()
rg_setup_compile_options(-O2)
rg_setup_compile_options(-O2 -Wno-error=format -Wno-error=char-subscripts -mfix-esp32-psram-cache-issue)

# add_custom_command(OUTPUT images.c
# COMMAND python ${COMPONENT_DIR}/gen_images.py
# VERBATIM)
# add_custom_target(images DEPENDS images.c)
# add_dependencies(${COMPONENT_LIB} images)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void event_handler(int event, void *arg)
gui_redraw();
}

void app_main(void)
void launcher_main(void)
{
const rg_handlers_t handlers = {
.event = &event_handler,
Expand All @@ -450,7 +450,7 @@ void app_main(void)
RG_DIALOG_END,
};

app = rg_system_init(32000, &handlers, options);
app = rg_system_reinit(32000, &handlers, options);
app->configNs = "launcher";
app->isLauncher = true;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 8 additions & 7 deletions retro-core/main/main_launcher.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "shared.h"

void launcher_main(void)
{
// app->configNs = "launcher";
// app->isLauncher = true;
// Currently a separate app, see launcher in project's root
rg_system_exit();
}
// launcher_main() is in ../components/launcher/main.c

// void launcher_main(void)
// {
// app->configNs = "launcher";
// app->isLauncher = true;
// rg_system_exit();
// }
3 changes: 0 additions & 3 deletions retro-go.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
{
"path": "gwenesis"
},
{
"path": "launcher"
},
{
"path": "prboom-go"
},
Expand Down
5 changes: 2 additions & 3 deletions rg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
PROJECT_ICON = "assets/icon.raw"
PROJECT_APPS = {
# Project name Type, SubType, Size
'launcher': [0, 0, 917504],
'retro-core': [0, 0, 917504],
'prboom-go': [0, 0, 786432],
'retro-core': [0, 0, 1638400],
'prboom-go': [0, 0, 851968],
'gwenesis': [0, 0, 983040],
'fmsx': [0, 0, 589824],
}
4 changes: 0 additions & 4 deletions rg_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ def monitor_app(app, port, baudrate=115200):
exec(f.read())

try:
if command in ["build-fw", "build-img", "release", "install"] and "launcher" not in apps:
print("\nWARNING: The launcher is mandatory for those apps and will be included!\n")
apps.insert(0, "launcher")

if command in ["clean", "release"]:
print("=== Step: Cleaning ===\n")
for app in apps:
Expand Down

0 comments on commit b59b8d6

Please sign in to comment.