This commit is contained in:
Struma 2021-05-23 21:55:02 -04:00 committed by Roza
parent 84c4f97c6c
commit ca596cbaf9
9 changed files with 1164 additions and 1160 deletions

View file

@ -48,7 +48,7 @@ extern "C" {
#endif
}
#ifdef __WINDOWS__
#ifdef __WIN32__
#include <fcntl.h>
#endif
@ -447,7 +447,7 @@ RB_METHOD(mkxpUserName) {
// Using the Windows API isn't working with usernames that involve Unicode
// characters for some dumb reason
#ifdef __WINDOWS__
#ifdef __WIN32__
VALUE env = rb_const_get(rb_mKernel, rb_intern("ENV"));
return rb_funcall(env, rb_intern("[]"), 1, rb_str_new_cstr("USERNAME"));
#else
@ -919,7 +919,7 @@ static void configureWindowsStreams() {
#undef HANDLE_VALID
}
#endif // #ifdef __WINDOWS__
#endif // #ifdef __WIN32__
static void showExc(VALUE exc, const BacktraceData &btData) {
VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
@ -996,13 +996,13 @@ static void mriBindingExecute() {
/* Normally only a ruby executable would do a sysinit,
* but not doing it will lead to crashes due to closed
* stdio streams on some platforms (eg. Windows) */
#ifdef __WINDOWS__
#ifdef __WIN32__
if (!conf.editor.debug) {
#endif
int argc = 0;
char **argv = 0;
ruby_sysinit(&argc, &argv);
#ifdef __WINDOWS__
#ifdef __WIN32__
}
#endif

View file

@ -78,7 +78,7 @@ endif
# ====================
# Suppress warnings
global_args += ['-Wno-non-virtual-dtor', '-Wno-reorder', '-Wno-uninitialized', '-Wno-unknown-pragmas']
global_args += ['-Wno-non-virtual-dtor', '-Wno-reorder', '-Wno-uninitialized', '-Wno-unknown-pragmas', '-Wno-stringop-truncation']
if compilers['cpp'].get_id() == 'clang'
global_args += ['-Wno-undefined-var-template', '-Wno-delete-non-abstract-non-virtual-dtor']
endif

View file

@ -12,7 +12,7 @@
#define FLUID_LIB "@rpath/libfluidsynth.dylib"
#elif __APPLE__
#define FLUID_LIB "libfluidsynth.3.dylib"
#elif __WINDOWS__
#elif __WIN32__
#define FLUID_LIB "fluidsynth.dll"
#else
#error "platform not recognized"

View file

@ -1,23 +1,23 @@
/*
** bitmap.cpp
**
** This file is part of mkxp.
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.
**
** mkxp is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/
** bitmap.cpp
**
** This file is part of mkxp.
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.
**
** mkxp is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bitmap.h"
@ -59,24 +59,24 @@ extern "C" {
}
#define GUARD_MEGA \
{ \
if (p->megaSurface) \
throw Exception(Exception::MKXPError, \
"Operation not supported for mega surfaces"); \
}
{ \
if (p->megaSurface) \
throw Exception(Exception::MKXPError, \
"Operation not supported for mega surfaces"); \
}
#define GUARD_ANIMATED \
{ \
if (p->animation.enabled) \
throw Exception(Exception::MKXPError, \
"Operation not supported for animated bitmaps"); \
if (p->animation.enabled) \
throw Exception(Exception::MKXPError, \
"Operation not supported for animated bitmaps"); \
}
#define GUARD_UNANIMATED \
{ \
if (!p->animation.enabled) \
throw Exception(Exception::MKXPError, \
"Operation not supported for static bitmaps"); \
if (!p->animation.enabled) \
throw Exception(Exception::MKXPError, \
"Operation not supported for static bitmaps"); \
}
#define OUTLINE_SIZE 1

View file

@ -46,7 +46,7 @@
#include <iconv.h>
#endif
#ifdef __WINDOWS__
#ifdef __WIN32__
#include <direct.h>
#endif

View file

@ -79,7 +79,7 @@ std::string filesystemImpl::normalizePath(const char *path, bool preferred, bool
for (size_t i = 0; i < ret.length(); i++) {
char sep;
char sep_alt;
#ifdef __WINDOWS__
#ifdef __WIN32__
if (preferred) {
sep = '\\';
sep_alt = '/';

View file

@ -47,7 +47,7 @@
#include "system/system.h"
#if defined(__WINDOWS__)
#if defined(__WIN32__)
#include "resource.h"
#include <Winsock2.h>
#include "util/win-consoleutils.h"
@ -276,7 +276,7 @@ int main(int argc, char *argv[]) {
return 0;
}
#if defined(__WINDOWS__)
#if defined(__WIN32__)
WSAData wsadata = {0};
if (WSAStartup(0x101, &wsadata) || wsadata.wVersion != 0x101) {
char buf[200];
@ -443,7 +443,7 @@ int main(int argc, char *argv[]) {
alcCloseDevice(alcDev);
SDL_DestroyWindow(win);
#if defined(__WINDOWS__)
#if defined(__WIN32__)
if (wsadata.wVersion)
WSACleanup();
#endif

View file

@ -14,7 +14,7 @@
#define MKXPZ_PLATFORM_MACOS 1
#define MKXPZ_PLATFORM_LINUX 2
#ifdef __WINDOWS__
#ifdef __WIN32__
#define MKXPZ_PLATFORM MKXPZ_PLATFORM_WINDOWS
#elif defined __APPLE__
#define MKXPZ_PLATFORM MKXPZ_PLATFORM_MACOS

View file

@ -14,6 +14,7 @@
#include <locale>
#endif
#include <SDL_loadso.h>
#include <cstring>
#include <string>
@ -43,10 +44,13 @@ std::string systemImpl::getSystemLanguage() {
}
std::string systemImpl::getUserName() {
char ret[30];
#ifdef __WINDOWS__
GetUserName(ret, sizeof(ret));
#ifdef __WIN32__
// The Ruby binding gets the username from the environment loaded
// with Ruby instead, should fix getting it from WinAPI at some point
return std::string("unused");
#else
char ret[30];
char *username = getenv("USER");
if (username)
strncpy(ret, username, sizeof(ret));