fix simulator mode to use shell.rml instead of deleted home.rml

This commit is contained in:
2026-01-20 10:39:27 +01:00
parent ab53bee5c4
commit 41fc6fdd86

View File

@@ -385,54 +385,42 @@ int main(int argc, char* argv[]) {
g_test_apps_path = fs::absolute(g_test_apps_path).string(); g_test_apps_path = fs::absolute(g_test_apps_path).string();
} }
// Find main assets home.rml for simulator mode // Find main assets for simulator mode
// Look for src/main/assets/apps/home/home.rml relative to test-apps // Look for src/main/assets/apps/shell/shell.rml relative to test-apps
fs::path test_apps_fs = fs::path(g_test_apps_path); fs::path test_apps_fs = fs::path(g_test_apps_path);
std::vector<fs::path> home_search_paths = { std::vector<fs::path> shell_search_paths = {
test_apps_fs.parent_path() / "src" / "main" / "assets" / "apps" / "home" / "home.rml", test_apps_fs.parent_path() / "src" / "main" / "assets" / "apps" / "shell" / "shell.rml",
fs::path("src/main/assets/apps/home/home.rml"), fs::path("src/main/assets/apps/shell/shell.rml"),
fs::absolute("src/main/assets/apps/home/home.rml"), fs::absolute("src/main/assets/apps/shell/shell.rml"),
}; };
for (const auto& path : home_search_paths) { for (const auto& path : shell_search_paths) {
if (fs::exists(path)) { if (fs::exists(path)) {
g_simulator_home_path = fs::absolute(path).string(); g_simulator_home_path = fs::absolute(path).string();
break; break;
} }
} }
// Override document path to main home screen or shell // Override document path to shell
if (!g_simulator_home_path.empty()) { if (!g_simulator_home_path.empty()) {
// Also set the main assets path for proper resource loading // Set the main assets path for proper resource loading
// g_simulator_home_path is now shell.rml, go up 3 levels to get assets path
g_main_assets_path = fs::path(g_simulator_home_path).parent_path().parent_path().parent_path().string(); g_main_assets_path = fs::path(g_simulator_home_path).parent_path().parent_path().parent_path().string();
g_shell_path = g_simulator_home_path;
document_path = g_shell_path;
// If shell mode, use shell instead of home std::cout << "Shell mode enabled" << std::endl;
if (g_shell_mode) { std::cout << "Shell: " << g_shell_path << std::endl;
g_shell_path = (fs::path(g_main_assets_path) / "apps" / "shell" / "shell.rml").string();
if (fs::exists(g_shell_path)) {
document_path = g_shell_path;
std::cout << "Shell mode enabled" << std::endl;
std::cout << "Shell: " << g_shell_path << std::endl;
} else {
std::cerr << "Warning: Could not find shell.rml, falling back to direct mode" << std::endl;
document_path = g_simulator_home_path;
g_shell_mode = false;
}
} else {
document_path = g_simulator_home_path;
}
std::cout << "Simulator mode enabled" << std::endl; std::cout << "Simulator mode enabled" << std::endl;
std::cout << "Test apps path: " << g_test_apps_path << std::endl; std::cout << "Test apps path: " << g_test_apps_path << std::endl;
std::cout << "Home screen: " << g_simulator_home_path << std::endl;
} else { } else {
std::cerr << "Warning: Could not find home.rml for simulator" << std::endl; std::cerr << "Warning: Could not find shell.rml for simulator" << std::endl;
g_simulator_mode = false; g_simulator_mode = false;
} }
} }
// Default document // Default document
if (document_path.empty()) { if (document_path.empty()) {
document_path = "apps/home/home.rml"; document_path = "apps/shell/shell.rml";
} }
// Derive assets path from document path if not specified // Derive assets path from document path if not specified
@@ -509,7 +497,7 @@ int main(int argc, char* argv[]) {
test_apps_root = test_apps_root.parent_path(); test_apps_root = test_apps_root.parent_path();
} }
fs::path main_assets = test_apps_root.parent_path() / "src" / "main" / "assets"; fs::path main_assets = test_apps_root.parent_path() / "src" / "main" / "assets";
if (fs::exists(main_assets / "apps" / "home" / "home.rml")) { if (fs::exists(main_assets / "apps" / "shell" / "shell.rml")) {
g_main_assets_path = main_assets.string(); g_main_assets_path = main_assets.string();
std::cout << "Main assets: " << g_main_assets_path << std::endl; std::cout << "Main assets: " << g_main_assets_path << std::endl;
} }
@@ -870,9 +858,9 @@ bool InitializeRmlUi(const std::string& assets_path, int fb_width, int fb_height
} }
} }
// Load home screen from main assets path // Load shell (which shows home by default)
std::string home_path = (fs::path(g_main_assets_path) / "apps" / "home" / "home.rml").string(); std::string home_path = (fs::path(g_main_assets_path) / "apps" / "shell" / "shell.rml").string();
std::cout << "Loading home from: " << home_path << std::endl; std::cout << "Loading shell from: " << home_path << std::endl;
auto* document = g_context->LoadDocument(home_path); auto* document = g_context->LoadDocument(home_path);
if (document) { if (document) {