From 9bbcf638dddc7b57efc83ec5e189f578fcc3e8ed Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Mon, 10 Feb 2025 16:18:42 +0000 Subject: [PATCH] gb: use "Game Boy" save path for both GB and GBC Fixes using the same rom file on both GB and GBC hardware without losing save-data between them Fixes Pokemon Stadium when loading a .gbc rom (the Transfer Pak only used the GB path) Existing users using a custom save game path will have to manually move their saves from "Game Boy Color" to "Game Boy" Users using the default "Save alongside rom files" will not have to take any action. --- mia/medium/game-boy-color.cpp | 1 + mia/pak/pak.cpp | 2 +- mia/pak/pak.hpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mia/medium/game-boy-color.cpp b/mia/medium/game-boy-color.cpp index 59a7287306..85882983d2 100644 --- a/mia/medium/game-boy-color.cpp +++ b/mia/medium/game-boy-color.cpp @@ -1,4 +1,5 @@ struct GameBoyColor : GameBoy { auto name() -> string override { return "Game Boy Color"; } + auto saveName() -> string override { return "Game Boy"; } auto extensions() -> vector override { return {"gb", "gbc"}; } }; diff --git a/mia/pak/pak.cpp b/mia/pak/pak.cpp index d2d3220785..af988f3656 100644 --- a/mia/pak/pak.cpp +++ b/mia/pak/pak.cpp @@ -149,7 +149,7 @@ auto Pak::saveLocation(string location, string name, string extension) -> string string saveLocation; if(auto path = mia::saveLocation()) { //if the user has chosen a specific location to save files to ... - saveLocation = {path, this->name(), "/", Location::prefix(location), extension}; + saveLocation = {path, this->saveName(), "/", Location::prefix(location), extension}; } else if(directory::exists(location)) { //if this is a pak ... saveLocation = {location, name}; diff --git a/mia/pak/pak.hpp b/mia/pak/pak.hpp index eb5e79fabc..1fee815b4f 100644 --- a/mia/pak/pak.hpp +++ b/mia/pak/pak.hpp @@ -4,6 +4,7 @@ struct Pak { virtual ~Pak() = default; virtual auto type() -> string { return pak->attribute("type"); } virtual auto name() -> string { return pak->attribute("name"); } + virtual auto saveName() -> string { return pak->attribute("name"); } virtual auto extensions() -> vector { return {}; } virtual auto load(string location = {}) -> LoadResult { return successful; } virtual auto loadMultiple(vector location = {}) -> bool { return true; }