SDL : Output information messages to stdout instead of stderr
This commit is contained in:
parent
474231f6bb
commit
d6fa4b79d2
|
@ -436,10 +436,10 @@ FILE *sdlFindFile(const char *name)
|
||||||
#define EXE_NAME "vbam"
|
#define EXE_NAME "vbam"
|
||||||
#endif // ! _WIN32
|
#endif // ! _WIN32
|
||||||
|
|
||||||
fprintf(stderr, "Searching for file %s\n", name);
|
fprintf(stdout, "Searching for file %s\n", name);
|
||||||
|
|
||||||
if(GETCWD(buffer, 2048)) {
|
if(GETCWD(buffer, 2048)) {
|
||||||
fprintf(stderr, "Searching current directory: %s\n", buffer);
|
fprintf(stdout, "Searching current directory: %s\n", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = fopen(name, "r");
|
FILE *f = fopen(name, "r");
|
||||||
|
@ -448,7 +448,7 @@ FILE *sdlFindFile(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(homeDir) {
|
if(homeDir) {
|
||||||
fprintf(stderr, "Searching home directory: %s%c%s\n", homeDir, FILE_SEP, DOT_DIR);
|
fprintf(stdout, "Searching home directory: %s%c%s\n", homeDir, FILE_SEP, DOT_DIR);
|
||||||
sprintf(path, "%s%c%s%c%s", homeDir, FILE_SEP, DOT_DIR, FILE_SEP, name);
|
sprintf(path, "%s%c%s%c%s", homeDir, FILE_SEP, DOT_DIR, FILE_SEP, name);
|
||||||
f = fopen(path, "r");
|
f = fopen(path, "r");
|
||||||
if(f != NULL)
|
if(f != NULL)
|
||||||
|
@ -458,14 +458,14 @@ FILE *sdlFindFile(const char *name)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char *home = getenv("USERPROFILE");
|
char *home = getenv("USERPROFILE");
|
||||||
if(home != NULL) {
|
if(home != NULL) {
|
||||||
fprintf(stderr, "Searching user profile directory: %s\n", home);
|
fprintf(stdout, "Searching user profile directory: %s\n", home);
|
||||||
sprintf(path, "%s%c%s", home, FILE_SEP, name);
|
sprintf(path, "%s%c%s", home, FILE_SEP, name);
|
||||||
f = fopen(path, "r");
|
f = fopen(path, "r");
|
||||||
if(f != NULL)
|
if(f != NULL)
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
#else // ! _WIN32
|
#else // ! _WIN32
|
||||||
fprintf(stderr, "Searching system config directory: %s\n", SYSCONFDIR);
|
fprintf(stdout, "Searching system config directory: %s\n", SYSCONFDIR);
|
||||||
sprintf(path, "%s%c%s", SYSCONFDIR, FILE_SEP, name);
|
sprintf(path, "%s%c%s", SYSCONFDIR, FILE_SEP, name);
|
||||||
f = fopen(path, "r");
|
f = fopen(path, "r");
|
||||||
if(f != NULL)
|
if(f != NULL)
|
||||||
|
@ -477,7 +477,7 @@ FILE *sdlFindFile(const char *name)
|
||||||
char *path = getenv("PATH");
|
char *path = getenv("PATH");
|
||||||
|
|
||||||
if(path != NULL) {
|
if(path != NULL) {
|
||||||
fprintf(stderr, "Searching PATH\n");
|
fprintf(stdout, "Searching PATH\n");
|
||||||
strncpy(buffer, path, 4096);
|
strncpy(buffer, path, 4096);
|
||||||
buffer[4095] = 0;
|
buffer[4095] = 0;
|
||||||
char *tok = strtok(buffer, PATH_SEP);
|
char *tok = strtok(buffer, PATH_SEP);
|
||||||
|
@ -491,7 +491,7 @@ FILE *sdlFindFile(const char *name)
|
||||||
sprintf(path2, "%s%c%s", tok, FILE_SEP, name);
|
sprintf(path2, "%s%c%s", tok, FILE_SEP, name);
|
||||||
f = fopen(path2, "r");
|
f = fopen(path2, "r");
|
||||||
if(f != NULL) {
|
if(f != NULL) {
|
||||||
fprintf(stderr, "Found at %s\n", path2);
|
fprintf(stdout, "Found at %s\n", path2);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ FILE *sdlFindFile(const char *name)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// executable is relative to some directory
|
// executable is relative to some directory
|
||||||
fprintf(stderr, "Searching executable directory\n");
|
fprintf(stdout, "Searching executable directory\n");
|
||||||
strcpy(buffer, arg0);
|
strcpy(buffer, arg0);
|
||||||
char *p = strrchr(buffer, FILE_SEP);
|
char *p = strrchr(buffer, FILE_SEP);
|
||||||
if(p) {
|
if(p) {
|
||||||
|
@ -541,7 +541,7 @@ void sdlReadPreferences(FILE *f)
|
||||||
char *value = strtok(NULL, "\t\n\r");
|
char *value = strtok(NULL, "\t\n\r");
|
||||||
|
|
||||||
if(value == NULL) {
|
if(value == NULL) {
|
||||||
fprintf(stderr, "Empty value for key %s\n", key);
|
fprintf(stdout, "Empty value for key %s\n", key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,7 +720,7 @@ void sdlReadPreferences(FILE *f)
|
||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown sound quality %d. Defaulting to 22Khz\n",
|
fprintf(stdout, "Unknown sound quality %d. Defaulting to 22Khz\n",
|
||||||
soundQuality);
|
soundQuality);
|
||||||
soundQuality = 2;
|
soundQuality = 2;
|
||||||
break;
|
break;
|
||||||
|
@ -841,10 +841,10 @@ void sdlReadPreferences()
|
||||||
FILE *f = sdlFindFile("vbam.cfg");
|
FILE *f = sdlFindFile("vbam.cfg");
|
||||||
|
|
||||||
if(f == NULL) {
|
if(f == NULL) {
|
||||||
fprintf(stderr, "Configuration file NOT FOUND (using defaults)\n");
|
fprintf(stdout, "Configuration file NOT FOUND (using defaults)\n");
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "Reading configuration file.\n");
|
fprintf(stdout, "Reading configuration file.\n");
|
||||||
|
|
||||||
sdlReadPreferences(f);
|
sdlReadPreferences(f);
|
||||||
|
|
||||||
|
@ -855,10 +855,10 @@ static void sdlApplyPerImagePreferences()
|
||||||
{
|
{
|
||||||
FILE *f = sdlFindFile("vba-over.ini");
|
FILE *f = sdlFindFile("vba-over.ini");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "vba-over.ini NOT FOUND (using emulator settings)\n");
|
fprintf(stdout, "vba-over.ini NOT FOUND (using emulator settings)\n");
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "Reading vba-over.ini\n");
|
fprintf(stdout, "Reading vba-over.ini\n");
|
||||||
|
|
||||||
char buffer[7];
|
char buffer[7];
|
||||||
buffer[0] = '[';
|
buffer[0] = '[';
|
||||||
|
@ -1043,19 +1043,19 @@ void sdlWriteBackupStateExchange(int from, int to, int backup)
|
||||||
/* on POSIX, rename would not do anything anyway for identical names, but let's check it ourselves anyway */
|
/* on POSIX, rename would not do anything anyway for identical names, but let's check it ourselves anyway */
|
||||||
if (to != backup) {
|
if (to != backup) {
|
||||||
if (-1 == rename(stateNameDest, stateNameBack)) {
|
if (-1 == rename(stateNameDest, stateNameBack)) {
|
||||||
fprintf(stderr, "savestate backup: can't backup old state %s to %s", stateNameDest, stateNameBack );
|
fprintf(stdout, "savestate backup: can't backup old state %s to %s", stateNameDest, stateNameBack );
|
||||||
perror(": ");
|
perror(": ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (to != from) {
|
if (to != from) {
|
||||||
if (-1 == rename(stateNameOrig, stateNameDest)) {
|
if (-1 == rename(stateNameOrig, stateNameDest)) {
|
||||||
fprintf(stderr, "savestate backup: can't move new state %s to %s", stateNameOrig, stateNameDest );
|
fprintf(stdout, "savestate backup: can't move new state %s to %s", stateNameOrig, stateNameDest );
|
||||||
perror(": ");
|
perror(": ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
systemConsoleMessage("Savestate store and backup committed"); // with timestamp and newline
|
systemConsoleMessage("Savestate store and backup committed"); // with timestamp and newline
|
||||||
fprintf(stderr, "to slot %d, backup in %d, using temporary slot %d\n", to+1, backup+1, from+1);
|
fprintf(stdout, "to slot %d, backup in %d, using temporary slot %d\n", to+1, backup+1, from+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdlWriteBattery()
|
void sdlWriteBattery()
|
||||||
|
@ -1232,7 +1232,7 @@ static void sdlHandleSavestateKey(int num, int shifted)
|
||||||
if (saveSlotPosition > 0)
|
if (saveSlotPosition > 0)
|
||||||
{
|
{
|
||||||
saveSlotPosition--;
|
saveSlotPosition--;
|
||||||
fprintf(stderr, "Changed savestate slot to %d.\n", saveSlotPosition + 1);
|
fprintf(stdout, "Changed savestate slot to %d.\n", saveSlotPosition + 1);
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "Can't decrease slotnumber below 1.\n");
|
fprintf(stderr, "Can't decrease slotnumber below 1.\n");
|
||||||
return; // handled
|
return; // handled
|
||||||
|
@ -1240,7 +1240,7 @@ static void sdlHandleSavestateKey(int num, int shifted)
|
||||||
if (saveSlotPosition < 7)
|
if (saveSlotPosition < 7)
|
||||||
{
|
{
|
||||||
saveSlotPosition++;
|
saveSlotPosition++;
|
||||||
fprintf(stderr, "Changed savestate slot to %d.\n", saveSlotPosition + 1);
|
fprintf(stdout, "Changed savestate slot to %d.\n", saveSlotPosition + 1);
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "Can't increase slotnumber above 8.\n");
|
fprintf(stderr, "Can't increase slotnumber above 8.\n");
|
||||||
return; // handled
|
return; // handled
|
||||||
|
@ -1780,7 +1780,7 @@ void handleRewinds()
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "VBA-M version %s [SDL]\n", VERSION);
|
fprintf(stdout, "VBA-M version %s [SDL]\n", VERSION);
|
||||||
|
|
||||||
arg0 = argv[0];
|
arg0 = argv[0];
|
||||||
|
|
||||||
|
@ -2080,7 +2080,7 @@ int main(int argc, char **argv)
|
||||||
int size = gbRomSize, patchnum;
|
int size = gbRomSize, patchnum;
|
||||||
// utilApplyIPS(ipsname, &gbRom, &size);
|
// utilApplyIPS(ipsname, &gbRom, &size);
|
||||||
for (patchnum = 0; patchnum < sdl_ips_num; patchnum++) {
|
for (patchnum = 0; patchnum < sdl_ips_num; patchnum++) {
|
||||||
fprintf(stderr, "Trying IPS patch %s.\n", sdl_ips_names[patchnum]);
|
fprintf(stdout, "Trying IPS patch %s.\n", sdl_ips_names[patchnum]);
|
||||||
utilApplyIPS(sdl_ips_names[patchnum], &gbRom, &size);
|
utilApplyIPS(sdl_ips_names[patchnum], &gbRom, &size);
|
||||||
}
|
}
|
||||||
if(size != gbRomSize) {
|
if(size != gbRomSize) {
|
||||||
|
@ -2107,7 +2107,7 @@ int main(int argc, char **argv)
|
||||||
int size = 0x2000000, patchnum;
|
int size = 0x2000000, patchnum;
|
||||||
// utilApplyIPS(ipsname, &rom, &size);
|
// utilApplyIPS(ipsname, &rom, &size);
|
||||||
for (patchnum = 0; patchnum < sdl_ips_num; patchnum++) {
|
for (patchnum = 0; patchnum < sdl_ips_num; patchnum++) {
|
||||||
fprintf(stderr, "Trying IPS patch %s.\n", sdl_ips_names[patchnum]);
|
fprintf(stdout, "Trying IPS patch %s.\n", sdl_ips_names[patchnum]);
|
||||||
utilApplyIPS(sdl_ips_names[patchnum], &rom, &size);
|
utilApplyIPS(sdl_ips_names[patchnum], &rom, &size);
|
||||||
}
|
}
|
||||||
if(size != 0x2000000) {
|
if(size != 0x2000000) {
|
||||||
|
@ -2205,7 +2205,7 @@ int main(int argc, char **argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"Color depth: %d\n", systemColorDepth);
|
fprintf(stdout,"Color depth: %d\n", systemColorDepth);
|
||||||
|
|
||||||
utilUpdateSystemColorMaps();
|
utilUpdateSystemColorMaps();
|
||||||
|
|
||||||
|
@ -2234,13 +2234,13 @@ int main(int argc, char **argv)
|
||||||
p = sdlPreparedCheatCodes[i];
|
p = sdlPreparedCheatCodes[i];
|
||||||
l = strlen(p);
|
l = strlen(p);
|
||||||
if (l == 17 && p[8] == ':') {
|
if (l == 17 && p[8] == ':') {
|
||||||
fprintf(stderr,"Adding cheat code %s\n", p);
|
fprintf(stdout,"Adding cheat code %s\n", p);
|
||||||
cheatsAddCheatCode(p, p);
|
cheatsAddCheatCode(p, p);
|
||||||
} else if (l == 13 && p[8] == ' ') {
|
} else if (l == 13 && p[8] == ' ') {
|
||||||
fprintf(stderr,"Adding CBA cheat code %s\n", p);
|
fprintf(stdout,"Adding CBA cheat code %s\n", p);
|
||||||
cheatsAddCBACode(p, p);
|
cheatsAddCBACode(p, p);
|
||||||
} else if (l == 8) {
|
} else if (l == 8) {
|
||||||
fprintf(stderr,"Adding GB(GS) cheat code %s\n", p);
|
fprintf(stdout,"Adding GB(GS) cheat code %s\n", p);
|
||||||
gbAddGsCheat(p, p);
|
gbAddGsCheat(p, p);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"Unknown format for cheat code %s\n", p);
|
fprintf(stderr,"Unknown format for cheat code %s\n", p);
|
||||||
|
@ -2276,7 +2276,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
emulating = 0;
|
emulating = 0;
|
||||||
fprintf(stderr,"Shutting down\n");
|
fprintf(stdout,"Shutting down\n");
|
||||||
remoteCleanUp();
|
remoteCleanUp();
|
||||||
soundShutdown();
|
soundShutdown();
|
||||||
|
|
||||||
|
@ -2323,7 +2323,7 @@ void systemMessage(int num, const char *msg, ...)
|
||||||
va_start(valist, msg);
|
va_start(valist, msg);
|
||||||
vsprintf(buffer, msg, valist);
|
vsprintf(buffer, msg, valist);
|
||||||
|
|
||||||
fprintf(stderr, "%s\n", buffer);
|
fprintf(stdout, "%s\n", buffer);
|
||||||
va_end(valist);
|
va_end(valist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2546,7 +2546,7 @@ void systemConsoleMessage(const char *msg)
|
||||||
now_time = time(NULL);
|
now_time = time(NULL);
|
||||||
now_time_broken = *(localtime( &now_time ));
|
now_time_broken = *(localtime( &now_time ));
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stdout,
|
||||||
"%02d:%02d:%02d %02d.%02d.%4d: %s\n",
|
"%02d:%02d:%02d %02d.%02d.%4d: %s\n",
|
||||||
now_time_broken.tm_hour,
|
now_time_broken.tm_hour,
|
||||||
now_time_broken.tm_min,
|
now_time_broken.tm_min,
|
||||||
|
|
Loading…
Reference in New Issue