From 5a711e9e00330df284a27f35a093432ec596cb5f Mon Sep 17 00:00:00 2001 From: Aidan Fischer Date: Mon, 23 Oct 2023 15:31:18 -0400 Subject: [PATCH] Allow MinGW build to work out-of-box on Windows --- Makefile | 3 +++ romprocessor.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 23bf94f..3305ae3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ CXX = g++ CXXFLAGS = -Wall -Wextra -Wpedantic -Wshadow +ifeq ($(OS),Windows_NT) + CXXFLAGS += -static +endif OUTPUT = range_randomizer all: main diff --git a/romprocessor.cpp b/romprocessor.cpp index 8477596..027c2cf 100644 --- a/romprocessor.cpp +++ b/romprocessor.cpp @@ -3,8 +3,8 @@ using namespace std; RomProcessor::RomProcessor(const char *in_path, const char *out_path) { - rom_file.open(in_path); - out_file.open(out_path, fstream::in | fstream::out | fstream::trunc); + rom_file.open(in_path, fstream::in | fstream::binary); + out_file.open(out_path, fstream::in | fstream::out | fstream::trunc | fstream::binary); out_file << rom_file.rdbuf(); out_file.flush(); // copy over file