all repos — mgba @ fc74db8c09969404f484146b90c7f914c963a449

mGBA Game Boy Advance Emulator

All: Initial work on MSVC support.
Augustin Cavalier waddlesplash@gmail.com
Tue, 30 Jun 2015 22:08:13 -0400
commit

fc74db8c09969404f484146b90c7f914c963a449

parent

bddebef90b5726534b04e921c2f19c2059c343ea

5 files changed, 16 insertions(+), 9 deletions(-)

jump to
M .gitignore.gitignore

@@ -1,3 +1,4 @@

/build +*.user* *~ *.swp
M CMakeLists.txtCMakeLists.txt

@@ -1,7 +1,11 @@

cmake_minimum_required(VERSION 2.6) project(mGBA C) set(BINARY_NAME mgba CACHE INTERNAL "Name of output binaries") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99") +if(NOT MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99") +else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146") +endif() set(USE_CLI_DEBUGGER ON CACHE BOOL "Whether or not to enable the CLI-mode ARM debugger") set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger") set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support")

@@ -187,7 +191,7 @@ add_definitions(-D_DARWIN_C_SOURCE)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6") endif() -if(NOT HAIKU) +if(NOT HAIKU AND NOT MSVC) list(APPEND OS_LIB m) endif()
M src/debugger/memory-debugger.csrc/debugger/memory-debugger.c

@@ -29,14 +29,14 @@ } \

} \ } -#define CREATE_SHIM(NAME, RETURN, TYPES, ARGS...) \ +#define CREATE_SHIM(NAME, RETURN, TYPES, ...) \ static RETURN ARMDebuggerShim_ ## NAME TYPES { \ struct ARMDebugger* debugger; \ FIND_DEBUGGER(debugger, cpu); \ - return debugger->originalMemory.NAME(cpu, ARGS); \ + return debugger->originalMemory.NAME(cpu, __VA_ARGS__); \ } -#define CREATE_WATCHPOINT_SHIM(NAME, WIDTH, RETURN, TYPES, ARGS...) \ +#define CREATE_WATCHPOINT_SHIM(NAME, WIDTH, RETURN, TYPES, ...) \ static RETURN ARMDebuggerShim_ ## NAME TYPES { \ struct ARMDebugger* debugger; \ FIND_DEBUGGER(debugger, cpu); \

@@ -44,7 +44,7 @@ struct DebuggerEntryInfo info; \

if (_checkWatchpoints(debugger, address, &info, WIDTH)) { \ ARMDebuggerEnter(debugger, DEBUGGER_ENTER_WATCHPOINT, &info); \ } \ - return debugger->originalMemory.NAME(cpu, ARGS); \ + return debugger->originalMemory.NAME(cpu, __VA_ARGS__); \ } #define CREATE_MULTIPLE_WATCHPOINT_SHIM(NAME) \
M src/util/common.hsrc/util/common.h

@@ -22,12 +22,14 @@

#include "version.h" #ifdef _MSC_VER -typedef intptr_t off_t; +#include <sys/types.h> typedef intptr_t ssize_t; +#define inline __inline #define restrict __restrict #define strcasecmp _stricmp #define strncasecmp _strnicmp #define ftruncate _chsize +#define snprintf _snprintf #else #include <strings.h> #include <unistd.h>
M src/util/string.hsrc/util/string.h

@@ -8,12 +8,12 @@ #define UTIL_STRING_H

#include "util/common.h" -#ifndef strndup +#ifndef HAVE_STRNDUP // This is sometimes a macro char* strndup(const char* start, size_t len); #endif -#ifndef strdup +#ifndef HAVE_STRDUP char* strdup(const char* str); #endif