Skip to content

Commit

Permalink
Add '--verbose' cli argument (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr authored Jun 19, 2024
1 parent a74ee0a commit 1d5f6f1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/harness/harness.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ void Harness_Init(int* argc, char* argv[]) {
harness_game_config.volume_multiplier = 1.0f;
// start window in windowed mode
harness_game_config.start_full_screen = 0;
// Emulate gore check
// Disable gore check emulation
harness_game_config.gore_check = 0;
// Enable Sound Options menu
// Disable "Sound Options" menu
harness_game_config.sound_options = 0;
// Skip binding socket to allow local network testing
harness_game_config.no_bind = 0;
// Disable verbose logging
harness_game_config.verbose = 0;

// install signal handler by default
harness_game_config.install_signalhandler = 1;
Expand Down
1 change: 1 addition & 0 deletions src/harness/include/harness/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef struct tHarness_game_config {
int gore_check;
int sound_options;
int no_bind;
int verbose;

int install_signalhandler;
} tHarness_game_config;
Expand Down
7 changes: 5 additions & 2 deletions src/harness/os/linux.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Based on https://gist.github.com/jvranish/4441299

#define _GNU_SOURCE
#include "harness/config.h"
#include "harness/os.h"
#include <assert.h>
#include <ctype.h>
Expand Down Expand Up @@ -259,8 +260,10 @@ FILE* OS_fopen(const char* pathname, const char* mode) {
}
}
closedir(pDir);
if (f == NULL) {
fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(errno));
if (harness_game_config.verbose) {
if (f == NULL) {
fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(errno));
}
}
return f;
}
Expand Down
7 changes: 5 additions & 2 deletions src/harness/os/macos.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Based on https://gist.github.com/jvranish/4441299

#include "harness/config.h"
#include "harness/os.h"
#include <assert.h>
#include <dirent.h>
Expand Down Expand Up @@ -223,8 +224,10 @@ FILE* OS_fopen(const char* pathname, const char* mode) {
FILE* f;

f = fopen(pathname, mode);
if (f == NULL) {
fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(errno));
if (harness_game_config.verbose) {
if (f == NULL) {
fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(errno));
}
}

return f;
Expand Down
7 changes: 5 additions & 2 deletions src/harness/os/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <imagehlp.h>

#include "harness/config.h"
#include "harness/os.h"

#include <assert.h>
Expand Down Expand Up @@ -159,8 +160,10 @@ FILE* OS_fopen(const char* pathname, const char* mode) {

f = NULL;
err = fopen_s(&f, pathname, mode);
if (err != 0) {
fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(err));
if (harness_game_config.verbose) {
if (err != 0) {
fprintf(stderr, "Failed to open \"%s\" (%s)\r\n", pathname, strerror(err));
}
}

return f;
Expand Down

0 comments on commit 1d5f6f1

Please sign in to comment.