dgen local fix for the quotes issue
This commit is contained in:
@@ -31,6 +31,10 @@
|
||||
#include <OS.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 1024
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
static long dgen_mingw_detach = 1;
|
||||
#endif
|
||||
@@ -427,8 +431,34 @@ int main(int argc, char *argv[])
|
||||
samples = (dgen_soundsegs * (rate / dgen_hz));
|
||||
pd_sound_init(rate, samples);
|
||||
}
|
||||
|
||||
char path_buf[MAX_PATH];
|
||||
char *p = path_buf;
|
||||
int r;
|
||||
|
||||
rom = argv[optind];
|
||||
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];
|
||||
}
|
||||
// Create the megadrive object.
|
||||
megad = new md(dgen_pal, dgen_region);
|
||||
if ((megad == NULL) || (!megad->okay())) {
|
||||
|
||||
Reference in New Issue
Block a user