mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-30 02:38:10 +03:00
dDemo/tDemo: Fix .alk filename case sensitivity
Instead of hardcoding "dDEMO.alk" / "tDEMO.alk", use the actual filename stored in nact->files.alk[0] from the directory scan. This fixes loading failures on case-sensitive filesystems where the actual file may be named "dDemo.alk" or "tDemo.alk". Also update gameresource.c to store .alk files without a numeric suffix at index 0 (these games have only one .alk file).
This commit is contained in:
@@ -96,8 +96,13 @@ static void Init() {
|
||||
int p3 = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
alk_t *alk = alk_new("dDEMO.alk");
|
||||
if (!nact->files.alk[0]) {
|
||||
WARNING("dDEMO.alk not found");
|
||||
return;
|
||||
}
|
||||
alk_t *alk = alk_new(nact->files.alk[0]); // dDEMO.alk
|
||||
if (!alk) {
|
||||
WARNING("Cannot open %s", nact->files.alk[0]);
|
||||
*var = 0;
|
||||
return;
|
||||
}
|
||||
@@ -936,7 +941,7 @@ static void Run() {
|
||||
break;
|
||||
}
|
||||
SDL_RenderPresent(gfx_renderer);
|
||||
SDL_Delay(16);
|
||||
sys_wait_vsync();
|
||||
}
|
||||
|
||||
muscd_stop();
|
||||
|
||||
@@ -62,9 +62,13 @@ static void SetLoopFlag() {
|
||||
}
|
||||
|
||||
static void Run() {
|
||||
alk_t *alk = alk_new("tDEMO.alk");
|
||||
if (!nact->files.alk[0]) {
|
||||
WARNING("tDEMO.alk not found");
|
||||
return;
|
||||
}
|
||||
alk_t *alk = alk_new(nact->files.alk[0]); // tDEMO.alk
|
||||
if (!alk) {
|
||||
WARNING("Cannot open tDEMO.alk");
|
||||
WARNING("Cannot open %s", nact->files.alk[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -85,8 +85,8 @@ bool initGameResourceFromDir(GameResource *gr, DIR *dir, const char *savedir, st
|
||||
} else if (len >= 4 && strcasecmp(filename + len - 4, ".bgi") == 0) {
|
||||
gr->bgi = strdup(filename);
|
||||
} else if (len >= 5 && strcasecmp(filename + len - 4, ".alk") == 0) {
|
||||
if (!isdigit(filename[len - 5])) continue;
|
||||
gr->alk[filename[len - 5] - '0'] = strdup(filename);
|
||||
int idx = isdigit(filename[len - 5]) ? filename[len - 5] - '0' : 0;
|
||||
gr->alk[idx] = strdup(filename);
|
||||
} else if (len >= 6 && strcasecmp(filename + len - 4, ".ald") == 0) {
|
||||
int dno = toupper(filename[len - 5]) - 'A';
|
||||
if (dno < 0 || dno >= DRIFILEMAX) continue;
|
||||
|
||||
Reference in New Issue
Block a user