Fix build in Visual Studio (2013) #111

Open
chosenofbear wants to merge 5 commits from chosenofbear/master into master
22 changed files with 58 additions and 10 deletions
Showing only changes of commit c375d27daa - Show all commits

View File

@ -20,11 +20,11 @@
*/ */
#include "binding.h" #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 "sharedstate.h"
#include "eventthread.h" #include "eventthread.h"
#include "filesystem.h" #include "filesystem.h"
#include "util.h"
#include "sdl-util.h" #include "sdl-util.h"
#include "debugwriter.h" #include "debugwriter.h"
#include "graphics.h" #include "graphics.h"

View File

@ -19,11 +19,11 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "binding-util.h" #include "util.h"
#include "binding-util.h" //fatal error C1189 if this is before "util.h"
#include "sharedstate.h" #include "sharedstate.h"
#include "exception.h" #include "exception.h"
#include "util.h"
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>

View File

@ -19,6 +19,10 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include "etc.h" #include "etc.h"
#include "binding-util.h" #include "binding-util.h"
#include "serializable-binding.h" #include "serializable-binding.h"

View File

@ -19,11 +19,10 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "binding-util.h" #include "util.h"
#include "binding-util.h" //fatal error C1189 if this is before "util.h"
#include "sharedstate.h" #include "sharedstate.h"
#include "filesystem.h" #include "filesystem.h"
#include "util.h"
#include "ruby/encoding.h" #include "ruby/encoding.h"
#include "ruby/intern.h" #include "ruby/intern.h"

View File

@ -19,6 +19,10 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include "font.h" #include "font.h"
#include "binding-util.h" #include "binding-util.h"
#include "binding-types.h" #include "binding-types.h"

View File

@ -19,6 +19,10 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include "input.h" #include "input.h"
#include "sharedstate.h" #include "sharedstate.h"
#include "exception.h" #include "exception.h"

View File

@ -19,6 +19,10 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef _MSC_VER
#define NOMINMAX
#endif
#include <algorithm> #include <algorithm>
#include "table.h" #include "table.h"
#include "binding-util.h" #include "binding-util.h"

View File

@ -186,7 +186,7 @@ diff -r 719dade41745 decoders/wav.c
+ break; + break;
+ +
+ rc = read_ima_block_headers(internal->rw, fmt->fmt.ima.d, + 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) + if (!rc)
+ { + {
@ -210,7 +210,7 @@ diff -r 719dade41745 decoders/wav.c
+ if (bw+fmt->fmt.ima.dec_frameset_size > internal->buffer_size) + if (bw+fmt->fmt.ima.dec_frameset_size > internal->buffer_size)
+ break; + 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) + if (!rc)
+ { + {

View File

@ -19,6 +19,7 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crossplatform.h"
#include "alstream.h" #include "alstream.h"
#include "sharedstate.h" #include "sharedstate.h"

7
src/crossplatform.h Normal file
View File

@ -0,0 +1,7 @@
#ifdef _MSC_VER
#define snprintf _snprintf
#include <direct.h>
#define chdir _chdir
#endif

View File

@ -19,6 +19,7 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crossplatform.h"
#include "eventthread.h" #include "eventthread.h"
#include <SDL_events.h> #include <SDL_events.h>

View File

@ -22,6 +22,9 @@
#ifndef EXCEPTION_H #ifndef EXCEPTION_H
#define EXCEPTION_H #define EXCEPTION_H
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -19,6 +19,7 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crossplatform.h"
#include "filesystem.h" #include "filesystem.h"
#include "rgssad.h" #include "rgssad.h"

View File

@ -43,7 +43,9 @@
#include <SDL_image.h> #include <SDL_image.h>
#include <time.h> #include <time.h>
#ifndef _MSC_VER
#include <sys/time.h> #include <sys/time.h>
#endif
#include <errno.h> #include <errno.h>
#include <algorithm> #include <algorithm>

View File

@ -19,6 +19,7 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crossplatform.h"
#include "keybindings.h" #include "keybindings.h"
#include "config.h" #include "config.h"

View File

@ -26,11 +26,14 @@
#include <SDL_ttf.h> #include <SDL_ttf.h>
#include <SDL_sound.h> #include <SDL_sound.h>
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <string> #include <string>
#include "crossplatform.h"
#include "sharedstate.h" #include "sharedstate.h"
#include "eventthread.h" #include "eventthread.h"
#include "gl-debug.h" #include "gl-debug.h"
@ -357,4 +360,4 @@ int main(int argc, char *argv[])
SDL_Quit(); SDL_Quit();
return 0; return 0;
} }

View File

@ -44,7 +44,11 @@ int __sdlThreadFun(void *obj)
template<class C, void (C::*func)()> template<class C, void (C::*func)()>
SDL_Thread *createSDLThread(C *obj, const std::string &name = std::string()) SDL_Thread *createSDLThread(C *obj, const std::string &name = std::string())
{ {
#ifdef _MSC_VER
return SDL_CreateThread((__sdlThreadFun<C, func>), name.c_str(), obj);
#else
return SDL_CreateThread(__sdlThreadFun<C, func>, name.c_str(), obj); return SDL_CreateThread(__sdlThreadFun<C, func>, name.c_str(), obj);
#endif
} }
/* On Android, SDL_RWFromFile always opens files from inside /* On Android, SDL_RWFromFile always opens files from inside

View File

@ -19,6 +19,7 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crossplatform.h"
#include "settingsmenu.h" #include "settingsmenu.h"
#include <SDL_video.h> #include <SDL_video.h>

View File

@ -38,7 +38,9 @@
#include "exception.h" #include "exception.h"
#include "sharedmidistate.h" #include "sharedmidistate.h"
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>

View File

@ -19,6 +19,7 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crossplatform.h"
#include "soundemitter.h" #include "soundemitter.h"
#include "sharedstate.h" #include "sharedstate.h"

View File

@ -22,6 +22,9 @@
#ifndef UTIL_H #ifndef UTIL_H
#define UTIL_H #define UTIL_H
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <algorithm> #include <algorithm>

View File

@ -19,6 +19,9 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef _MSC_VER
#include <algorithm>
#endif
#include "aldatasource.h" #include "aldatasource.h"
#include "exception.h" #include "exception.h"