From 3696e15f5350230f3428aac464854347c4cd75d5 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 3 May 2026 19:08:20 -0700
Subject: [PATCH] Fixed data corruption dumping raw resources on Windows
---
macres/macres.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/macres/macres.cpp b/macres/macres.cpp
index 31c26ffc..b3d1f9d5 100644
--- a/macres/macres.cpp
+++ b/macres/macres.cpp
@@ -303,7 +303,7 @@ static void ExportFont(Mac_Resource *res, const char *type, Uint16 id, const cha
FILE *output;
Mac_ResData *entry;
- if ( (output=fopen(path, "w")) != NULL ) {
+ if ( (output=fopen(path, "wb")) != NULL ) {
entry = res->Resource(type, id);
fwrite(entry->data, entry->length, 1, output);
fclose(output);
@@ -469,7 +469,7 @@ int main(int argc, char *argv[])
SDL_snprintf(path, sizeof(path), "%s/%s#%hu", argv[arg], types[i], ids[j]);
FILE *output;
Mac_ResData *D;
- if ( (output=fopen(path, "w")) != NULL ) {
+ if ( (output=fopen(path, "wb")) != NULL ) {
D = res->Resource(types[i], ids[j]);
fwrite(D->data, D->length, 1, output);
fclose(output);