Skip to content

Commit 0735c41

Browse files
committed
Compile 2 versions: old + PC11, and add some error checks
1 parent 9508708 commit 0735c41

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Diff for: CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
set(CMAKE_C_STANDARD 11)
22

33
add_executable(pba-rez rez.c)
4+
add_executable(pba-rez-pc11 rez.c)
5+
target_compile_definitions(pba-rez-pc11 PRIVATE -DPC11)
6+
47
add_executable(pba-csv csv.c json.h)
58
add_executable(format0001 format0001.c)
69
add_executable(format0022 format0022.c)

Diff for: rez.c

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define PC11 //FIXME: Make this a CLI option
2-
31
#include <stdbool.h>
42
#include <assert.h>
53
#include <stdint.h>
@@ -175,9 +173,21 @@ void export(FILE* f, FileHeader* fileHeader, const char* path, bool compressed)
175173
}
176174

177175
int main(int argc, char* argv[]) {
178-
FILE* f = fopen(argv[1], "rb");
176+
177+
if (argc != 3) {
178+
printf("Usage: %s <rez-file-path> <output-folder-path>\n", argv[0]);
179+
return 1;
180+
}
181+
182+
const char* inPath = argv[1];
179183
const char* outPath = argv[2];
180184

185+
FILE* f = fopen(inPath, "rb");
186+
if (f == NULL) {
187+
printf("Could not open '%s'\n", inPath);
188+
return 1;
189+
}
190+
181191
// This is the actual header
182192

183193
fseek(f, -2048, SEEK_END);

0 commit comments

Comments
 (0)