From 2459793f9c826a45c22eece3220f457ed69d2217 Mon Sep 17 00:00:00 2001 From: Themaister Date: Thu, 27 Jan 2011 22:43:12 +0100 Subject: [PATCH] Set O_BINARY in Win32 on stdin reads. --- file.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/file.c b/file.c index f435dbaa3d..13e3f9bff1 100644 --- a/file.c +++ b/file.c @@ -23,12 +23,21 @@ #include #include "dynamic.h" +#ifdef _WIN32 +#include +#include +#endif + // Load SNES rom only. Applies a hack for headered ROMs. static ssize_t read_rom_file(FILE* file, void** buf) { ssize_t ret; if (file == NULL) // stdin { +#ifdef _WIN32 + setmode(0, O_BINARY); +#endif + SSNES_LOG("Reading ROM from stdin ...\n"); size_t buf_size = 0xFFFFF; // Some initial guesstimate. size_t buf_ptr = 0;