dgen local fix for the quotes issue
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 1m34s
Build system / Build (pull_request) Successful in 10m17s

This commit is contained in:
2026-02-27 17:53:42 +02:00
parent cc1034d849
commit e7d1a0b5db

View File

@@ -31,6 +31,10 @@
#include <OS.h> #include <OS.h>
#endif #endif
#ifndef MAX_PATH
#define MAX_PATH 1024
#endif
#ifdef __MINGW32__ #ifdef __MINGW32__
static long dgen_mingw_detach = 1; static long dgen_mingw_detach = 1;
#endif #endif
@@ -428,7 +432,33 @@ int main(int argc, char *argv[])
pd_sound_init(rate, samples); pd_sound_init(rate, samples);
} }
char path_buf[MAX_PATH];
char *p = path_buf;
int r;
path_buf[0] = '\0';
for (r = optind; r < argc; ++r) {
if (r > optind) { // Append a space in later iterations
if (p - path_buf < sizeof(path_buf) - 2) *p++ = ' ';
}
char *src = argv[r];
while (*src && (p - path_buf < sizeof(path_buf) - 1)) {
*p++ = *src++;
}
*p = '\0';
if (access(path_buf, F_OK) == 0) {
rom = path_buf; // Point rom to the static buffer
optind = r; // Update optind
break;
}
}
if (!rom && optind < argc) {
rom = argv[optind]; rom = argv[optind];
}
// Create the megadrive object. // Create the megadrive object.
megad = new md(dgen_pal, dgen_region); megad = new md(dgen_pal, dgen_region);
if ((megad == NULL) || (!megad->okay())) { if ((megad == NULL) || (!megad->okay())) {