From adef6c30e2bf1f2269c20df1509696dd89951fa5 Mon Sep 17 00:00:00 2001 From: Cray Elliott Date: Fri, 1 Jul 2022 10:18:17 -0700 Subject: [PATCH] Super Game Boy: test for file extension size (#653) it was hard coded to 4 which caused MSU-1 files to not be found for .GB extension ROMs --- support/snes/snes.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/support/snes/snes.cpp b/support/snes/snes.cpp index dbee2c6..32d18c5 100644 --- a/support/snes/snes.cpp +++ b/support/snes/snes.cpp @@ -363,7 +363,8 @@ void snes_msu_init(const char* name) FileClose(&f_audio); memset(snes_romFileName, 0, 1024); - strncpy(snes_romFileName, name, strlen(name) - 4); + int extSize = strlen(strrchr(name, '.')); + strncpy(snes_romFileName, name, strlen(name) - extSize); printf("MSU: Rom named '%s' initialised\n", name); snprintf(SelectedPath, sizeof(SelectedPath), "%s.msu", snes_romFileName);