Fixed Windows build, added Unicode support in Windows.

This commit is contained in:
Lior Halphon 2018-03-28 21:59:27 +03:00
parent 4cf78139a8
commit 96063fb0da
8 changed files with 26 additions and 12 deletions

View File

@ -11,9 +11,10 @@
#endif
#include "gb.h"
/* The libretro frontend does not link against rewind.c, so we provide empty weak alternatives to its functions */
void __attribute__((weak)) GB_rewind_free(GB_gameboy_t *gb) { }
void __attribute__((weak)) GB_rewind_push(GB_gameboy_t *gb) { }
#ifdef DISABLE_REWIND
#define GB_rewind_free(...)
#define GB_rewind_push(...)
#endif
void GB_attributed_logv(GB_gameboy_t *gb, GB_log_attributes attributes, const char *fmt, va_list args)
{

View File

@ -2,7 +2,6 @@
#define GB_h
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include "gb_struct_def.h"

View File

@ -106,6 +106,10 @@ COCOA_SOURCES := $(shell ls Cocoa/*.m) $(shell ls HexFiend/*.m)
QUICKLOOK_SOURCES := $(shell ls QuickLook/*.m) $(shell ls QuickLook/*.c)
endif
ifeq ($(PLATFORM),windows32)
CORE_SOURCES += $(shell ls Windows/*.c)
endif
CORE_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(CORE_SOURCES))
COCOA_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(COCOA_SOURCES))
QUICKLOOK_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(QUICKLOOK_SOURCES))

View File

@ -1,5 +1,6 @@
#include <SDL2/SDL.h>
#include <stdbool.h>
#include <stdio.h>
#include "utils.h"
#include "gui.h"
#include "font.h"

View File

@ -1,4 +1,5 @@
#include <stdbool.h>
#include <stdio.h>
#include <signal.h>
#include <SDL2/SDL.h>
#include <Core/gb.h>

14
Windows/utf8_compat.c Executable file
View File

@ -0,0 +1,14 @@
#include <windows.h>
#include <stdio.h>
#include <winnls.h>
FILE *fopen(const char *filename, const char *mode)
{
wchar_t w_filename[MAX_PATH] = {0,};
MultiByteToWideChar(CP_UTF8, 0, filename, -1, w_filename, sizeof(w_filename) / sizeof(w_filename[0]));
wchar_t w_mode[8] = {0,};
MultiByteToWideChar(CP_UTF8, 0, mode, -1, w_mode, sizeof(w_mode) / sizeof(w_mode[0]));
return _wfopen(w_filename, w_mode);
}

View File

@ -16,13 +16,7 @@ SOURCES_C := $(CORE_DIR)/Core/gb.c \
$(CORE_DIR)/libretro/dmg_boot.c \
$(CORE_DIR)/libretro/libretro.c
ifeq ($(HAVE_DEBUGGER), 1)
SOURCES_C += $(CORE_DIR)/Core/debugger.c \
$(CORE_DIR)/Core/z80_disassembler.c
else
CFLAGS += -DDISABLE_DEBUGGER
endif
CFLAGS += -DDISABLE_TIMEKEEPING
CFLAGS += -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER
SOURCES_CXX :=

View File

@ -28,7 +28,7 @@ CORE_DIR := $(realpath ../..)
include ../Makefile.common
LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C)
LOCAL_CFLAGS += -DINLINE=inline -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DNDEBUG -D_USE_MATH_DEFINES -DGB_INTERNAL -std=c99 -I$(CORE_DIR) -DSAMEBOY_CORE_VERSION=\"$(VERSION)\" -DDISABLE_DEBUGGER -DDISABLE_TIMEKEEPING -Wno-multichar
LOCAL_CFLAGS += -DINLINE=inline -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DNDEBUG -D_USE_MATH_DEFINES -DGB_INTERNAL -std=c99 -I$(CORE_DIR) -DSAMEBOY_CORE_VERSION=\"$(VERSION)\" -DDISABLE_DEBUGGER -DDISABLE_REWIND -DDISABLE_TIMEKEEPING -Wno-multichar
LOCAL_C_INCLUDES = $(INCFLAGS)
include $(BUILD_SHARED_LIBRARY)