diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 5cb518e..85884cd 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -20,11 +20,11 @@ */ #include "binding.h" -#include "binding-util.h" +#include "util.h" +#include "binding-util.h" //fatal error C1189 if this is before "util.h" #include "sharedstate.h" #include "eventthread.h" #include "filesystem.h" -#include "util.h" #include "sdl-util.h" #include "debugwriter.h" #include "graphics.h" diff --git a/binding-mri/binding-util.cpp b/binding-mri/binding-util.cpp index e73d999..f5edb44 100644 --- a/binding-mri/binding-util.cpp +++ b/binding-mri/binding-util.cpp @@ -19,11 +19,11 @@ ** along with mkxp. If not, see . */ -#include "binding-util.h" +#include "util.h" +#include "binding-util.h" //fatal error C1189 if this is before "util.h" #include "sharedstate.h" #include "exception.h" -#include "util.h" #include #include diff --git a/binding-mri/etc-binding.cpp b/binding-mri/etc-binding.cpp index 2c2cdd2..931f182 100644 --- a/binding-mri/etc-binding.cpp +++ b/binding-mri/etc-binding.cpp @@ -19,6 +19,10 @@ ** along with mkxp. If not, see . */ +#ifdef _MSC_VER +#define _CRT_SECURE_NO_DEPRECATE +#endif + #include "etc.h" #include "binding-util.h" #include "serializable-binding.h" diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index 17cf50d..c4f5c54 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -19,11 +19,10 @@ ** along with mkxp. If not, see . */ -#include "binding-util.h" - +#include "util.h" +#include "binding-util.h" //fatal error C1189 if this is before "util.h" #include "sharedstate.h" #include "filesystem.h" -#include "util.h" #include "ruby/encoding.h" #include "ruby/intern.h" diff --git a/binding-mri/font-binding.cpp b/binding-mri/font-binding.cpp index 2a8856a..df1efbc 100644 --- a/binding-mri/font-binding.cpp +++ b/binding-mri/font-binding.cpp @@ -19,6 +19,10 @@ ** along with mkxp. If not, see . */ +#ifdef _MSC_VER +#define _CRT_SECURE_NO_DEPRECATE +#endif + #include "font.h" #include "binding-util.h" #include "binding-types.h" diff --git a/binding-mri/input-binding.cpp b/binding-mri/input-binding.cpp index f20b06a..5c00dd3 100644 --- a/binding-mri/input-binding.cpp +++ b/binding-mri/input-binding.cpp @@ -19,6 +19,10 @@ ** along with mkxp. If not, see . */ +#ifdef _MSC_VER +#define _CRT_SECURE_NO_DEPRECATE +#endif + #include "input.h" #include "sharedstate.h" #include "exception.h" diff --git a/binding-mri/table-binding.cpp b/binding-mri/table-binding.cpp index 87a9b58..17b64a3 100644 --- a/binding-mri/table-binding.cpp +++ b/binding-mri/table-binding.cpp @@ -19,6 +19,10 @@ ** along with mkxp. If not, see . */ +#ifdef _MSC_VER +#define NOMINMAX +#endif + #include #include "table.h" #include "binding-util.h" diff --git a/patches/SDL_sound/ima-adpcm.patch b/patches/SDL_sound/ima-adpcm.patch index bf6ba73..73b5dd4 100644 --- a/patches/SDL_sound/ima-adpcm.patch +++ b/patches/SDL_sound/ima-adpcm.patch @@ -186,7 +186,7 @@ diff -r 719dade41745 decoders/wav.c + break; + + rc = read_ima_block_headers(internal->rw, fmt->fmt.ima.d, -+ fmt->wChannels, (Sint16*) (out_buf+bw)); ++ fmt->wChannels, (Sint16*)out_buf+bw); + + if (!rc) + { @@ -210,7 +210,7 @@ diff -r 719dade41745 decoders/wav.c + if (bw+fmt->fmt.ima.dec_frameset_size > internal->buffer_size) + break; + -+ rc = read_ima_frameset(internal->rw, w, (Sint16*) (out_buf+bw)); ++ rc = read_ima_frameset(internal->rw, w, (Sint16*)out_buf+bw); + + if (!rc) + { diff --git a/src/alstream.cpp b/src/alstream.cpp index 18799ff..3220fd4 100644 --- a/src/alstream.cpp +++ b/src/alstream.cpp @@ -19,6 +19,7 @@ ** along with mkxp. If not, see . */ +#include "crossplatform.h" #include "alstream.h" #include "sharedstate.h" diff --git a/src/crossplatform.h b/src/crossplatform.h new file mode 100644 index 0000000..9f4bef6 --- /dev/null +++ b/src/crossplatform.h @@ -0,0 +1,7 @@ +#ifdef _MSC_VER +#define snprintf _snprintf + +#include + +#define chdir _chdir +#endif \ No newline at end of file diff --git a/src/eventthread.cpp b/src/eventthread.cpp index df381e8..864de9b 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -19,6 +19,7 @@ ** along with mkxp. If not, see . */ +#include "crossplatform.h" #include "eventthread.h" #include diff --git a/src/exception.h b/src/exception.h index 47d9c78..5746df7 100644 --- a/src/exception.h +++ b/src/exception.h @@ -22,6 +22,9 @@ #ifndef EXCEPTION_H #define EXCEPTION_H +#ifdef _MSC_VER +#define _CRT_SECURE_NO_DEPRECATE +#endif #include #include #include diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 6642d3b..3dc2119 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -19,6 +19,7 @@ ** along with mkxp. If not, see . */ +#include "crossplatform.h" #include "filesystem.h" #include "rgssad.h" diff --git a/src/graphics.cpp b/src/graphics.cpp index 1862629..a5ae7bc 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -43,7 +43,9 @@ #include #include +#ifndef _MSC_VER #include +#endif #include #include diff --git a/src/keybindings.cpp b/src/keybindings.cpp index 49d2a71..4a89fb6 100644 --- a/src/keybindings.cpp +++ b/src/keybindings.cpp @@ -19,6 +19,7 @@ ** along with mkxp. If not, see . */ +#include "crossplatform.h" #include "keybindings.h" #include "config.h" diff --git a/src/main.cpp b/src/main.cpp index eb07970..0c34a68 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,11 +26,14 @@ #include #include +#ifndef _MSC_VER #include +#endif #include #include #include +#include "crossplatform.h" #include "sharedstate.h" #include "eventthread.h" #include "gl-debug.h" @@ -357,4 +360,4 @@ int main(int argc, char *argv[]) SDL_Quit(); return 0; -} +} \ No newline at end of file diff --git a/src/sdl-util.h b/src/sdl-util.h index 1ed615d..c6044b4 100644 --- a/src/sdl-util.h +++ b/src/sdl-util.h @@ -44,7 +44,11 @@ int __sdlThreadFun(void *obj) template SDL_Thread *createSDLThread(C *obj, const std::string &name = std::string()) { +#ifdef _MSC_VER + return SDL_CreateThread((__sdlThreadFun), name.c_str(), obj); +#else return SDL_CreateThread(__sdlThreadFun, name.c_str(), obj); +#endif } /* On Android, SDL_RWFromFile always opens files from inside diff --git a/src/settingsmenu.cpp b/src/settingsmenu.cpp index a14b488..fe95674 100644 --- a/src/settingsmenu.cpp +++ b/src/settingsmenu.cpp @@ -19,6 +19,7 @@ ** along with mkxp. If not, see . */ +#include "crossplatform.h" #include "settingsmenu.h" #include diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp index 023ff6b..4c29f87 100644 --- a/src/sharedstate.cpp +++ b/src/sharedstate.cpp @@ -38,7 +38,9 @@ #include "exception.h" #include "sharedmidistate.h" +#ifndef _MSC_VER #include +#endif #include #include diff --git a/src/soundemitter.cpp b/src/soundemitter.cpp index 3850c0b..c27ef15 100644 --- a/src/soundemitter.cpp +++ b/src/soundemitter.cpp @@ -19,6 +19,7 @@ ** along with mkxp. If not, see . */ +#include "crossplatform.h" #include "soundemitter.h" #include "sharedstate.h" diff --git a/src/util.h b/src/util.h index ad9141a..f2461cd 100644 --- a/src/util.h +++ b/src/util.h @@ -22,6 +22,9 @@ #ifndef UTIL_H #define UTIL_H +#ifdef _MSC_VER +#define _CRT_SECURE_NO_DEPRECATE +#endif #include #include #include diff --git a/src/vorbissource.cpp b/src/vorbissource.cpp index 07dcdb4..1498dbc 100644 --- a/src/vorbissource.cpp +++ b/src/vorbissource.cpp @@ -19,6 +19,9 @@ ** along with mkxp. If not, see . */ +#ifdef _MSC_VER +#include +#endif #include "aldatasource.h" #include "exception.h"