mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-17 20:35:41 +02:00
cleanup
This commit is contained in:
parent
84c4f97c6c
commit
ca596cbaf9
9 changed files with 1164 additions and 1160 deletions
|
@ -48,7 +48,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ RB_METHOD(mkxpUserName) {
|
||||||
|
|
||||||
// Using the Windows API isn't working with usernames that involve Unicode
|
// Using the Windows API isn't working with usernames that involve Unicode
|
||||||
// characters for some dumb reason
|
// characters for some dumb reason
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
VALUE env = rb_const_get(rb_mKernel, rb_intern("ENV"));
|
VALUE env = rb_const_get(rb_mKernel, rb_intern("ENV"));
|
||||||
return rb_funcall(env, rb_intern("[]"), 1, rb_str_new_cstr("USERNAME"));
|
return rb_funcall(env, rb_intern("[]"), 1, rb_str_new_cstr("USERNAME"));
|
||||||
#else
|
#else
|
||||||
|
@ -919,7 +919,7 @@ static void configureWindowsStreams() {
|
||||||
|
|
||||||
#undef HANDLE_VALID
|
#undef HANDLE_VALID
|
||||||
}
|
}
|
||||||
#endif // #ifdef __WINDOWS__
|
#endif // #ifdef __WIN32__
|
||||||
|
|
||||||
static void showExc(VALUE exc, const BacktraceData &btData) {
|
static void showExc(VALUE exc, const BacktraceData &btData) {
|
||||||
VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
|
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,
|
/* Normally only a ruby executable would do a sysinit,
|
||||||
* but not doing it will lead to crashes due to closed
|
* but not doing it will lead to crashes due to closed
|
||||||
* stdio streams on some platforms (eg. Windows) */
|
* stdio streams on some platforms (eg. Windows) */
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
if (!conf.editor.debug) {
|
if (!conf.editor.debug) {
|
||||||
#endif
|
#endif
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char **argv = 0;
|
char **argv = 0;
|
||||||
ruby_sysinit(&argc, &argv);
|
ruby_sysinit(&argc, &argv);
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ endif
|
||||||
# ====================
|
# ====================
|
||||||
|
|
||||||
# Suppress warnings
|
# 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'
|
if compilers['cpp'].get_id() == 'clang'
|
||||||
global_args += ['-Wno-undefined-var-template', '-Wno-delete-non-abstract-non-virtual-dtor']
|
global_args += ['-Wno-undefined-var-template', '-Wno-delete-non-abstract-non-virtual-dtor']
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#define FLUID_LIB "@rpath/libfluidsynth.dylib"
|
#define FLUID_LIB "@rpath/libfluidsynth.dylib"
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
#define FLUID_LIB "libfluidsynth.3.dylib"
|
#define FLUID_LIB "libfluidsynth.3.dylib"
|
||||||
#elif __WINDOWS__
|
#elif __WIN32__
|
||||||
#define FLUID_LIB "fluidsynth.dll"
|
#define FLUID_LIB "fluidsynth.dll"
|
||||||
#else
|
#else
|
||||||
#error "platform not recognized"
|
#error "platform not recognized"
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ std::string filesystemImpl::normalizePath(const char *path, bool preferred, bool
|
||||||
for (size_t i = 0; i < ret.length(); i++) {
|
for (size_t i = 0; i < ret.length(); i++) {
|
||||||
char sep;
|
char sep;
|
||||||
char sep_alt;
|
char sep_alt;
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
if (preferred) {
|
if (preferred) {
|
||||||
sep = '\\';
|
sep = '\\';
|
||||||
sep_alt = '/';
|
sep_alt = '/';
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
#include "system/system.h"
|
#include "system/system.h"
|
||||||
|
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WIN32__)
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
#include "util/win-consoleutils.h"
|
#include "util/win-consoleutils.h"
|
||||||
|
@ -276,7 +276,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WIN32__)
|
||||||
WSAData wsadata = {0};
|
WSAData wsadata = {0};
|
||||||
if (WSAStartup(0x101, &wsadata) || wsadata.wVersion != 0x101) {
|
if (WSAStartup(0x101, &wsadata) || wsadata.wVersion != 0x101) {
|
||||||
char buf[200];
|
char buf[200];
|
||||||
|
@ -443,7 +443,7 @@ int main(int argc, char *argv[]) {
|
||||||
alcCloseDevice(alcDev);
|
alcCloseDevice(alcDev);
|
||||||
SDL_DestroyWindow(win);
|
SDL_DestroyWindow(win);
|
||||||
|
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WIN32__)
|
||||||
if (wsadata.wVersion)
|
if (wsadata.wVersion)
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#define MKXPZ_PLATFORM_MACOS 1
|
#define MKXPZ_PLATFORM_MACOS 1
|
||||||
#define MKXPZ_PLATFORM_LINUX 2
|
#define MKXPZ_PLATFORM_LINUX 2
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
#define MKXPZ_PLATFORM MKXPZ_PLATFORM_WINDOWS
|
#define MKXPZ_PLATFORM MKXPZ_PLATFORM_WINDOWS
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
#define MKXPZ_PLATFORM MKXPZ_PLATFORM_MACOS
|
#define MKXPZ_PLATFORM MKXPZ_PLATFORM_MACOS
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <SDL_loadso.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -43,10 +44,13 @@ std::string systemImpl::getSystemLanguage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string systemImpl::getUserName() {
|
std::string systemImpl::getUserName() {
|
||||||
char ret[30];
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WIN32__
|
||||||
GetUserName(ret, sizeof(ret));
|
// 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
|
#else
|
||||||
|
char ret[30];
|
||||||
char *username = getenv("USER");
|
char *username = getenv("USER");
|
||||||
if (username)
|
if (username)
|
||||||
strncpy(ret, username, sizeof(ret));
|
strncpy(ret, username, sizeof(ret));
|
||||||
|
|
Loading…
Add table
Reference in a new issue