From 970a5f562b6092f697233dac7e03497908bd710a Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 22 Jun 2019 18:16:55 +0300 Subject: [PATCH] Fix #183 --- BootROMs/logo-compress.c | 13 +++++++++++-- Makefile | 9 ++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/BootROMs/logo-compress.c b/BootROMs/logo-compress.c index ff29143..2274eb2 100644 --- a/BootROMs/logo-compress.c +++ b/BootROMs/logo-compress.c @@ -1,6 +1,10 @@ #include #include -#include +#include +#ifdef _WIN32 +#include +#include +#endif void pair(size_t count, uint8_t byte) { @@ -35,7 +39,12 @@ int main(int argc, char *argv[]) size_t count = 1; uint8_t byte = getchar(); int new; - size_t position = 0; + size_t position = 0; + +#ifdef _WIN32 + _setmode(0,_O_BINARY); + _setmode(1,_O_BINARY); +#endif while ((new = getchar()) != EOF) { if (byte == new) { diff --git a/Makefile b/Makefile index 4bc4f3d..0246616 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,11 @@ ifneq ($(findstring MSYS,$(PLATFORM)),) PLATFORM := windows32 endif +LOGO_COMPRESS := build/logo-compress + ifeq ($(PLATFORM),windows32) _ := $(shell chcp 65001) +LOGO_COMPRESS := build/logo-compress.exe endif ifeq ($(PLATFORM),Darwin) @@ -326,10 +329,10 @@ $(OBJ)/%.1bpp: %.png -@$(MKDIR) -p $(dir $@) rgbgfx -d 1 -h -o $@ $< -$(OBJ)/BootROMs/SameBoyLogo.rle: $(OBJ)/BootROMs/SameBoyLogo.1bpp build/logo-compress - ./build/logo-compress < $< > $@ +$(OBJ)/BootROMs/SameBoyLogo.rle: $(OBJ)/BootROMs/SameBoyLogo.1bpp $(LOGO_COMPRESS) + $(realpath $(LOGO_COMPRESS)) < $< > $@ -build/logo-compress: BootROMs/logo-compress.c +$(LOGO_COMPRESS): BootROMs/logo-compress.c $(CC) $< -o $@ $(BIN)/BootROMs/agb_boot.bin: BootROMs/cgb_boot.asm