diff --git a/CarteSD/games/DinoBlaster/meta.json b/CarteSD/games/DinoBlaster/meta.json index 60adeb0..16ee250 100644 --- a/CarteSD/games/DinoBlaster/meta.json +++ b/CarteSD/games/DinoBlaster/meta.json @@ -11,5 +11,6 @@ "title_w": 320, "title_h": 240, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 3 } diff --git a/CarteSD/games/DinoInvaders/meta.json b/CarteSD/games/DinoInvaders/meta.json index 4913c4c..13b4d2d 100644 --- a/CarteSD/games/DinoInvaders/meta.json +++ b/CarteSD/games/DinoInvaders/meta.json @@ -11,5 +11,6 @@ "title_w": 320, "title_h": 240, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 30 } diff --git a/CarteSD/games/DinoLife/meta.json b/CarteSD/games/DinoLife/meta.json index 8dd132d..a015353 100644 --- a/CarteSD/games/DinoLife/meta.json +++ b/CarteSD/games/DinoLife/meta.json @@ -11,5 +11,6 @@ "title_w": 320, "title_h": 240, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 3 } diff --git a/CarteSD/games/FlappyPtera/meta.json b/CarteSD/games/FlappyPtera/meta.json index 983d3f9..810c0d4 100644 --- a/CarteSD/games/FlappyPtera/meta.json +++ b/CarteSD/games/FlappyPtera/meta.json @@ -11,5 +11,6 @@ "title_w": 320, "title_h": 240, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 30 } diff --git a/CarteSD/games/JurassicBrickBreaker/meta.json b/CarteSD/games/JurassicBrickBreaker/meta.json index 96f6f48..3d26334 100644 --- a/CarteSD/games/JurassicBrickBreaker/meta.json +++ b/CarteSD/games/JurassicBrickBreaker/meta.json @@ -11,5 +11,6 @@ "title_w": 320, "title_h": 240, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 3 } diff --git a/CarteSD/games/ParaRunner/meta.json b/CarteSD/games/ParaRunner/meta.json index 16020c6..59ec7d5 100644 --- a/CarteSD/games/ParaRunner/meta.json +++ b/CarteSD/games/ParaRunner/meta.json @@ -12,5 +12,6 @@ "title_w": 0, "title_h": 0, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 3 } diff --git a/CarteSD/games/PokemonBleu_GB/README.txt b/CarteSD/games/PokemonBleu_GB/README.txt deleted file mode 100644 index 23fe36c..0000000 --- a/CarteSD/games/PokemonBleu_GB/README.txt +++ /dev/null @@ -1,20 +0,0 @@ -Structure SD attendue pour lancer Pokemon Bleu via l'emulateur GB. - -Fichiers a copier manuellement: -- /games/PokemonBleu_GB/gb_emulator.bin (binaire ESP32 de l'emulateur) -- /games/PokemonBleu_GB/roms/PokemonBleu.gb (ROM GB, usage legal uniquement) -- /games/PokemonBleu_GB/icon.raw (50x50) -- /games/PokemonBleu_GB/title.raw (320x240) - -Le launcher charge gb_emulator.bin (champ "bin" de meta.json). -Le binaire emulateur lit ensuite boot.json pour trouver rom_path/save_path. - -Ou trouver gb_emulator.bin ? -- Il n'est pas fourni dans ce depot. -- Tu dois compiler le projet emulateur GB avec Arduino IDE (ou arduino-cli). -- Un template compilable est fourni ici: - RaptorLauncher_GameSDK/examples/GB_Emulator/gb_emulator.ino -- Dans ce depot, les jeux compiles sortent en general dans: - /build/esp32.esp32.esp32/game.bin -- Prends ce game.bin et renomme-le en gb_emulator.bin dans ce dossier. -- Important: n'utilise pas merged.bin / bootloader.bin / partitions.bin. diff --git a/CarteSD/games/PokemonBleu_GB/boot.json b/CarteSD/games/PokemonBleu_GB/boot.json deleted file mode 100644 index ded2bf4..0000000 --- a/CarteSD/games/PokemonBleu_GB/boot.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rom_path": "/games/PokemonBleu_GB/roms/PokemonBleu.gb", - "save_path": "/games/PokemonBleu_GB/sauv.json", - "audio_enabled": true, - "scale": 2 -} diff --git a/CarteSD/games/PokemonBleu_GB/gb_emulator.bin b/CarteSD/games/PokemonBleu_GB/gb_emulator.bin deleted file mode 100644 index 1552b2d..0000000 Binary files a/CarteSD/games/PokemonBleu_GB/gb_emulator.bin and /dev/null differ diff --git a/CarteSD/games/PokemonBleu_GB/icon.raw b/CarteSD/games/PokemonBleu_GB/icon.raw deleted file mode 100644 index 23230b3..0000000 Binary files a/CarteSD/games/PokemonBleu_GB/icon.raw and /dev/null differ diff --git a/CarteSD/games/PokemonBleu_GB/meta.json b/CarteSD/games/PokemonBleu_GB/meta.json deleted file mode 100644 index 075a8e9..0000000 --- a/CarteSD/games/PokemonBleu_GB/meta.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Pokemon Bleu (GB)", - "author": "Inter-Raptor", - "description": "Lance Pokemon Bleu via emulateur GB ESP32.", - "type": "emulationGB", - "indice": 30, - "icon": "icon.raw", - "icon_w": 50, - "icon_h": 50, - "title": "title.raw", - "title_w": 320, - "title_h": 240, - "bin": "gb_emulator.bin", - "save": "sauv.json", - "rom": "roms/PokemonBleu.gb" -} diff --git a/CarteSD/games/PokemonBleu_GB/roms/.gitkeep b/CarteSD/games/PokemonBleu_GB/roms/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/CarteSD/games/PokemonBleu_GB/roms/PokemonBleu.gb b/CarteSD/games/PokemonBleu_GB/roms/PokemonBleu.gb deleted file mode 100644 index d89bf12..0000000 Binary files a/CarteSD/games/PokemonBleu_GB/roms/PokemonBleu.gb and /dev/null differ diff --git a/CarteSD/games/PokemonBleu_GB/title.raw b/CarteSD/games/PokemonBleu_GB/title.raw deleted file mode 100644 index 90213b3..0000000 Binary files a/CarteSD/games/PokemonBleu_GB/title.raw and /dev/null differ diff --git a/CarteSD/games/RaptorSDKTestLab/meta.json b/CarteSD/games/RaptorSDKTestLab/meta.json index 7b93b8b..424cf17 100644 --- a/CarteSD/games/RaptorSDKTestLab/meta.json +++ b/CarteSD/games/RaptorSDKTestLab/meta.json @@ -11,5 +11,6 @@ "title_w": 320, "title_h": 240, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 1 } diff --git a/CarteSD/games/WiFiTouchConsole/meta.json b/CarteSD/games/WiFiTouchConsole/meta.json index 9907866..ee11f20 100644 --- a/CarteSD/games/WiFiTouchConsole/meta.json +++ b/CarteSD/games/WiFiTouchConsole/meta.json @@ -11,5 +11,6 @@ "title_w": 0, "title_h": 0, "bin": "game.bin", - "save": "sauv.json" + "save": "sauv.json", + "index": 2 } diff --git a/CarteSD/games/index.json b/CarteSD/games/index.json index 4c3b6b1..6d83048 100644 --- a/CarteSD/games/index.json +++ b/CarteSD/games/index.json @@ -1,51 +1,54 @@ { "version": 1, - "description": "Index manuel des jeux (ordre de menu recommande via indice).", + "description": "Index manuel des jeux (ordre de menu recommande via index/indice).", "entries": [ { - "indice": 3, - "folder": "DinoLife", - "meta": "DinoLife/meta.json" + "index": 1, + "indice": 1, + "folder": "RaptorSDKTestLab", + "meta": "RaptorSDKTestLab/meta.json" + }, + { + "index": 2, + "indice": 2, + "folder": "WiFiTouchConsole", + "meta": "WiFiTouchConsole/meta.json" }, { + "index": 3, "indice": 3, "folder": "DinoBlaster", "meta": "DinoBlaster/meta.json" }, { - "indice": 30, - "folder": "DinoInvaders", - "meta": "DinoInvaders/meta.json" - }, - { - "indice": 30, - "folder": "FlappyPtera", - "meta": "FlappyPtera/meta.json" + "index": 3, + "indice": 3, + "folder": "DinoLife", + "meta": "DinoLife/meta.json" }, { + "index": 3, "indice": 3, "folder": "JurassicBrickBreaker", "meta": "JurassicBrickBreaker/meta.json" }, { + "index": 3, "indice": 3, "folder": "ParaRunner", "meta": "ParaRunner/meta.json" }, { + "index": 30, "indice": 30, - "folder": "PokemonBleu_GB", - "meta": "PokemonBleu_GB/meta.json" - }, - { - "indice": 1, - "folder": "RaptorSDKTestLab", - "meta": "RaptorSDKTestLab/meta.json" + "folder": "DinoInvaders", + "meta": "DinoInvaders/meta.json" }, { - "indice": 2, - "folder": "WiFiTouchConsole", - "meta": "WiFiTouchConsole/meta.json" + "index": 30, + "indice": 30, + "folder": "FlappyPtera", + "meta": "FlappyPtera/meta.json" } ] } diff --git a/RaptorLauncher_V4/launcher_ui.cpp b/RaptorLauncher_V4/launcher_ui.cpp index 808d342..06d6c78 100644 --- a/RaptorLauncher_V4/launcher_ui.cpp +++ b/RaptorLauncher_V4/launcher_ui.cpp @@ -10,7 +10,6 @@ #include "led_manager.h" #include "mcp23017_manager.h" #include "game_boot_manager.h" -#include "gb_launch_config.h" #include "config.h" #include "types.h" @@ -455,25 +454,6 @@ static void launchGameFromIndex(int index) { const GameInfo& game = gameList[index]; showGameTitleScreen(game); - if (game.type == "emulationGB") { - if (game.rom.length() == 0) { - Serial.println("[GB] rom manquante dans meta.json"); - gSaveStatusText = "ROM manquante"; - currentScreen = SCREEN_HOME; - gNeedsRedraw = true; - return; - } - - String romPath = resolveGamePath(game, game.rom); - if (!gbLaunchSavePendingRom(romPath, game.name)) { - Serial.println("[GB] impossible d'ecrire .gb_launch.json"); - gSaveStatusText = "Config GB KO"; - currentScreen = SCREEN_HOME; - gNeedsRedraw = true; - return; - } - } - String binPath = resolveGamePath(game, game.bin); bool ok = gameBootLaunchFromPath(binPath); if (!ok) { diff --git a/RaptorLauncher_V4/storage_manager.cpp b/RaptorLauncher_V4/storage_manager.cpp index 254cb92..b088586 100644 --- a/RaptorLauncher_V4/storage_manager.cpp +++ b/RaptorLauncher_V4/storage_manager.cpp @@ -2,6 +2,8 @@ #include #include #include +#include +#include #include "storage_manager.h" #define SD_CS 5 @@ -71,7 +73,7 @@ std::vector storageListGames() { game.bin = "game.bin"; game.save = "sauv.json"; - game.rom = ""; + game.index = 30; String metaPath = "/games" + folderName + "/meta.json"; @@ -111,7 +113,7 @@ std::vector storageListGames() { game.bin = doc["bin"] | "game.bin"; game.save = doc["save"] | "sauv.json"; - game.rom = doc["rom"] | ""; + game.index = doc["index"] | (doc["indice"] | 30); Serial.print("[JSON] name = "); Serial.println(game.name); @@ -139,10 +141,8 @@ std::vector storageListGames() { Serial.print("[JSON] save = "); Serial.println(game.save); - if (game.rom.length() > 0) { - Serial.print("[JSON] rom = "); - Serial.println(game.rom); - } + Serial.print("[JSON] index = "); + Serial.println(game.index); } } else { Serial.println("[SD] meta.json absent ou impossible a ouvrir"); @@ -155,5 +155,16 @@ std::vector storageListGames() { } root.close(); + + std::sort(list.begin(), list.end(), [](const GameInfo& a, const GameInfo& b) { + if (a.index != b.index) return a.index < b.index; + + String an = a.name; + String bn = b.name; + an.toLowerCase(); + bn.toLowerCase(); + return an < bn; + }); + return list; } diff --git a/RaptorLauncher_V4/types.h b/RaptorLauncher_V4/types.h index c33a98c..56366cf 100644 --- a/RaptorLauncher_V4/types.h +++ b/RaptorLauncher_V4/types.h @@ -45,5 +45,5 @@ struct GameInfo { String bin; String save; - String rom; + int index; };