From 2b7287452c11d1ac06b825ba5e94ba414b7ef3e6 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Sun, 29 Jun 2025 10:33:08 -0400 Subject: [PATCH] Create 3DS default config overrides --- CMakeLists.txt | 3 +++ ISLE/3ds/filesystem.cpp | 31 +++++++++++++++++++++++++++++++ ISLE/3ds/filesystem.h | 8 ++++++++ ISLE/isleapp.cpp | 7 +++++++ 4 files changed, 49 insertions(+) create mode 100644 ISLE/3ds/filesystem.cpp create mode 100644 ISLE/3ds/filesystem.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a61449f6..7fbdc80d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -646,6 +646,9 @@ endif() set(CPACK_PACKAGE_DIRECTORY "dist") set(CPACK_PACKAGE_FILE_NAME "isle-${PROJECT_VERSION}-${ISLE_PACKAGE_NAME}-${CMAKE_SYSTEM_PROCESSOR}") if(NINTENDO_3DS) + target_sources(isle PRIVATE + ISLE/3ds/filesystem.cpp + ) ctr_generate_smdh(isle.smdh NAME "LEGO Island" TITLE "LEGO Island" diff --git a/ISLE/3ds/filesystem.cpp b/ISLE/3ds/filesystem.cpp new file mode 100644 index 00000000..ff452d8a --- /dev/null +++ b/ISLE/3ds/filesystem.cpp @@ -0,0 +1,31 @@ +#include "filesystem.h" + +#include +#include + +void N3DS_SetupDefaultConfigOverrides(dictionary* p_dictionary) +{ + SDL_Log("Overriding default config for 3DS"); + + // We are currently not bundling the assets into romfs. + // User must place assets in sdmc:/3ds/isle where + // sdmc:/3ds/isle/LEGO/SCRIPTS/CREDITS.si exists, for example. + iniparser_set(p_dictionary, "isle:diskpath", "sdmc:/3ds/isle/LEGO/disk"); + iniparser_set(p_dictionary, "isle:cdpath", "sdmc:/3ds/isle"); + + // TODO: Save path: can we use libctru FS save data functions? Would be neat, especially for CIA install + // Extra / at the end causes some issues + iniparser_set(p_dictionary, "isle:savepath", "sdmc:/3ds/isle"); + + // We are currently just rendering to the touch screen + iniparser_set(p_dictionary, "isle:Full Screen", "true"); + + // Wide view angle takes more resources + iniparser_set(p_dictionary, "isle:Wide View Angle", "false"); + + // Set back buffers in video RAM + iniparser_set(p_dictionary, "isle:Back Buffers in Video RAM", "1"); + + // Use e_noAnimation/cut transition + iniparser_set(p_dictionary, "isle:Transition Type", "1"); +} diff --git a/ISLE/3ds/filesystem.h b/ISLE/3ds/filesystem.h new file mode 100644 index 00000000..699fd52b --- /dev/null +++ b/ISLE/3ds/filesystem.h @@ -0,0 +1,8 @@ +#ifndef N3DS_FILESYSTEM_H +#define N3DS_FILESYSTEM_H + +#include "dictionary.h" + +void N3DS_SetupDefaultConfigOverrides(dictionary* p_dictionary); + +#endif // N3DS_FILESYSTEM_H diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 62c156ff..a460c899 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -50,6 +50,10 @@ #include "emscripten/messagebox.h" #endif +#ifdef __3DS__ +#include "3ds/filesystem.h" +#endif + DECOMP_SIZE_ASSERT(IsleApp, 0x8c) // GLOBAL: ISLE 0x410030 @@ -824,6 +828,9 @@ bool IsleApp::LoadConfig() iniparser_set(dict, "isle:Max Allowed Extras", SDL_itoa(m_maxAllowedExtras, buf, 10)); iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10)); +#ifdef __3DS__ + N3DS_SetupDefaultConfigOverrides(dict); +#endif iniparser_dump_ini(dict, iniFP); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "New config written at '%s'", iniConfig); fclose(iniFP);