Fix build in Visual Studio (2013) #111

Open
chosenofbear wants to merge 5 commits from chosenofbear/master into master
15 changed files with 44 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#define BINDING_UTIL_H
#include <ruby.h>
#undef inline //ruby's config.h has #define inline __inline, which cause error in xkeycheck.h
#include "exception.h"

View File

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

View File

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

View File

@ -348,7 +348,11 @@ void Config::readGameINI()
size_t inLen = game.title.size();
size_t outLen = inLen * 4;
std::string buf(outLen, '\0');
#ifdef _MSC_VER
const char *inPtr = game.title.c_str();
#else
char *inPtr = const_cast<char*>(game.title.c_str());
#endif
char *outPtr = const_cast<char*>(buf.c_str());
errno = 0;

17
src/crossplatform.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef MKXP_CROSSPLATFORM_H
#define MKXP_CROSSPLATFORM_H
#ifdef _MSC_VER
//#define _CRT_SECURE_NO_DEPRECATE //should be defined in binding-mri's preprocessor for vsnprintf, fopen
#include <direct.h>
#ifndef snprintf
#define snprintf _snprintf
#endif
#ifndef chdir
#define chdir _chdir
#endif
#endif
#endif //MKXP_CROSSPLATFORM_H

View File

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

View File

@ -22,6 +22,8 @@
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include "crossplatform.h"
#include <string>
#include <stdio.h>
#include <stdarg.h>

View File

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

View File

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

View File

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

View File

@ -26,11 +26,14 @@
#include <SDL_ttf.h>
#include <SDL_sound.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <string.h>
#include <assert.h>
#include <string>
#include "crossplatform.h"
#include "sharedstate.h"
#include "eventthread.h"
#include "gl-debug.h"

View File

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

View File

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

View File

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

View File

@ -22,6 +22,8 @@
#ifndef UTIL_H
#define UTIL_H
#include "crossplatform.h"
#include <stdio.h>
#include <string>
#include <algorithm>