From 0a2977bc860bf34458b907bce05d60dca9797029 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 10 Mar 2022 23:24:22 -0800 Subject: [PATCH] Fix DynOS pack-to-name conversion --- data/dynos_coop_c.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/data/dynos_coop_c.cpp b/data/dynos_coop_c.cpp index 259cb2c0..eb04ffaf 100644 --- a/data/dynos_coop_c.cpp +++ b/data/dynos_coop_c.cpp @@ -17,7 +17,20 @@ int dynos_packs_get_count(void) { const char* dynos_packs_get(s32 index) { std::string path = DynOS_Gfx_GetPacks()[index]->mPath; - return path.substr(path.find(DYNOS_PACKS_FOLDER) + DYNOS_PACK_PATH_SPLIT_LEN).c_str(); + + // extract basename + const char* cpath = path.c_str(); + const char* ctoken = cpath; + while (*ctoken != '\0') { + if (*ctoken == '/' || *ctoken == '\\') { + if (*(ctoken + 1) != '\0') { + cpath = (ctoken + 1); + } + } + ctoken++; + } + + return cpath; } bool dynos_packs_get_enabled(s32 index) {