diff --git a/include/mgba-util/common.h b/include/mgba-util/common.h index e908c40ea..d370d67a5 100644 --- a/include/mgba-util/common.h +++ b/include/mgba-util/common.h @@ -116,7 +116,7 @@ typedef intptr_t ssize_t; #define ATOMIC_LOAD_PTR(DST, SRC) ATOMIC_LOAD(DST, SRC) #endif -#if defined(_3DS) || defined(GEKKO) || defined(PSP2) +#if defined(__3DS__) || defined(GEKKO) || defined(PSP2) // newlib doesn't support %z properly by default #define PRIz "" #elif defined(_MSC_VER) diff --git a/include/mgba-util/socket.h b/include/mgba-util/socket.h index 377d53a2e..bcafd28d1 100644 --- a/include/mgba-util/socket.h +++ b/include/mgba-util/socket.h @@ -52,7 +52,7 @@ struct Address { }; }; -#ifdef _3DS +#ifdef __3DS__ #include <3ds.h> #include @@ -73,7 +73,7 @@ static inline void SocketSubsystemInit() { #ifdef _WIN32 WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); -#elif defined(_3DS) +#elif defined(__3DS__) if (!SOCUBuffer) { SOCUBuffer = memalign(SOCU_ALIGN, SOCU_BUFFERSIZE); socInit(SOCUBuffer, SOCU_BUFFERSIZE); @@ -92,7 +92,7 @@ static inline void SocketSubsystemInit() { static inline void SocketSubsystemDeinit() { #ifdef _WIN32 WSACleanup(); -#elif defined(_3DS) +#elif defined(__3DS__) socExit(); free(SOCUBuffer); SOCUBuffer = NULL; @@ -168,7 +168,7 @@ static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress) memset(&bindInfo, 0, sizeof(bindInfo)); bindInfo.sin_family = AF_INET; bindInfo.sin_port = htons(port); -#ifndef _3DS +#ifndef __3DS__ bindInfo.sin_addr.s_addr = INADDR_ANY; #else bindInfo.sin_addr.s_addr = gethostid(); @@ -189,7 +189,7 @@ static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress) #else err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo)); #endif -#if !defined(_3DS) && !defined(GEKKO) +#if !defined(__3DS__) && !defined(GEKKO) } else { struct sockaddr_in6 bindInfo; memset(&bindInfo, 0, sizeof(bindInfo)); @@ -238,7 +238,7 @@ static inline Socket SocketConnectTCP(int port, const struct Address* destinatio #else err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo)); #endif -#if !defined(_3DS) && !defined(GEKKO) +#if !defined(__3DS__) && !defined(GEKKO) } else { struct sockaddr_in6 bindInfo; memset(&bindInfo, 0, sizeof(bindInfo)); @@ -291,7 +291,7 @@ static inline Socket SocketAccept(Socket socket, struct Address* address) { #else return accept(socket, (struct sockaddr*) &addrInfo, &len); #endif -#if !defined(_3DS) && !defined(GEKKO) +#if !defined(__3DS__) && !defined(GEKKO) } else { struct sockaddr_in6 addrInfo; memset(&addrInfo, 0, sizeof(addrInfo)); diff --git a/include/mgba-util/threading.h b/include/mgba-util/threading.h index 1a7fcceab..eefff031f 100644 --- a/include/mgba-util/threading.h +++ b/include/mgba-util/threading.h @@ -23,7 +23,7 @@ CXX_GUARD_START #include #elif defined(PSP2) #include -#elif defined(_3DS) +#elif defined(__3DS__) #include #elif defined(__SWITCH__) #include @@ -32,7 +32,7 @@ CXX_GUARD_START #endif #endif #ifdef DISABLE_THREADING -#ifdef _3DS +#ifdef __3DS__ // ctrulib already has a type called Thread #include <3ds/thread.h> #elif defined(__SWITCH__) diff --git a/include/mgba-util/vfs.h b/include/mgba-util/vfs.h index c9faded6e..334f84419 100644 --- a/include/mgba-util/vfs.h +++ b/include/mgba-util/vfs.h @@ -87,7 +87,7 @@ struct VDir* VDirOpenZip(const char* path, int flags); struct VDir* VDirOpen7z(const char* path, int flags); #endif -#if defined(__wii__) || defined(_3DS) || defined(PSP2) +#if defined(__wii__) || defined(__3DS__) || defined(PSP2) struct VDir* VDeviceList(void); #endif diff --git a/src/core/config.c b/src/core/config.c index 5d23f0d8d..4308b50ba 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -29,7 +29,7 @@ #include #endif -#ifdef _3DS +#ifdef __3DS__ #include #endif @@ -253,7 +253,7 @@ void mCoreConfigDirectory(char* out, size_t outLength) { #elif defined(GEKKO) || defined(__SWITCH__) snprintf(out, outLength, "/%s", projectName); mkdir(out, 0777); -#elif defined(_3DS) +#elif defined(__3DS__) snprintf(out, outLength, "/%s", projectName); FSUSER_CreateDirectory(sdmcArchive, fsMakePath(PATH_ASCII, out), 0); #elif defined(__HAIKU__) @@ -290,7 +290,7 @@ void mCoreConfigPortablePath(char* out, size_t outLength) { } WideCharToMultiByte(CP_UTF8, 0, wpath, -1, out, outLength, 0, 0); StringCchCatA(out, outLength, PATH_SEP "portable.ini"); -#elif defined(PSP2) || defined(GEKKO) || defined(__SWITCH__) || defined(_3DS) +#elif defined(PSP2) || defined(GEKKO) || defined(__SWITCH__) || defined(__3DS__) out[0] = '\0'; #else getcwd(out, outLength); diff --git a/src/feature/gui/gui-runner.c b/src/feature/gui/gui-runner.c index dc203e158..a79b01042 100644 --- a/src/feature/gui/gui-runner.c +++ b/src/feature/gui/gui-runner.c @@ -667,13 +667,13 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) { int frames = 0; GUIPollInput(&runner->params, 0, &keys); while (keys && frames < 30) { -#ifdef _3DS +#ifdef __3DS__ if (!frames) { #endif runner->params.drawStart(); runner->drawFrame(runner, true); runner->params.drawEnd(); -#ifdef _3DS +#ifdef __3DS__ } else { // XXX: Why does this fix #1294? usleep(15000); diff --git a/src/gb/audio.c b/src/gb/audio.c index 6824072bf..9c06de737 100644 --- a/src/gb/audio.c +++ b/src/gb/audio.c @@ -12,7 +12,7 @@ #include #include -#ifdef _3DS +#ifdef __3DS__ #define blip_add_delta blip_add_delta_fast #endif diff --git a/src/gba/audio.c b/src/gba/audio.c index a8e2324b9..fc264349f 100644 --- a/src/gba/audio.c +++ b/src/gba/audio.c @@ -16,7 +16,7 @@ #define MP2K_LOCK_MAX 8 -#ifdef _3DS +#ifdef __3DS__ #define blip_add_delta blip_add_delta_fast #endif diff --git a/src/platform/3ds/CMakeToolchain.txt b/src/platform/3ds/CMakeToolchain.txt index ea0fb7e70..eb9d76db2 100644 --- a/src/platform/3ds/CMakeToolchain.txt +++ b/src/platform/3ds/CMakeToolchain.txt @@ -15,7 +15,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor") set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi") set(3DS ON) -add_definitions(-D_3DS -DARM11) +add_definitions(-D__3DS__) create_devkit(ARM) diff --git a/src/platform/test/perf-main.c b/src/platform/test/perf-main.c index 2e1736390..23cb1d4a8 100644 --- a/src/platform/test/perf-main.c +++ b/src/platform/test/perf-main.c @@ -16,7 +16,7 @@ #include #include -#ifdef _3DS +#ifdef __3DS__ #include <3ds.h> #endif #ifdef __SWITCH__ @@ -81,7 +81,7 @@ static Socket _socket = INVALID_SOCKET; static Socket _server = INVALID_SOCKET; int main(int argc, char** argv) { -#ifdef _3DS +#ifdef __3DS__ UNUSED(_mPerfShutdown); gfxInitDefault(); osSetSpeedupEnable(true); @@ -173,7 +173,7 @@ int main(int argc, char** argv) { cleanup: freeArguments(&args); -#ifdef _3DS +#ifdef __3DS__ gfxExit(); acExit(); #elif defined(__SWITCH__) diff --git a/src/util/gui/file-select.c b/src/util/gui/file-select.c index 8c6b86ca8..0cdfba35d 100644 --- a/src/util/gui/file-select.c +++ b/src/util/gui/file-select.c @@ -14,7 +14,7 @@ #define ITERATION_SIZE 5 #define SCANNING_THRESHOLD_1 50 -#ifdef _3DS +#ifdef __3DS__ // 3DS is slooooow at opening files #define SCANNING_THRESHOLD_2 10 #else diff --git a/src/util/gui/menu.c b/src/util/gui/menu.c index e70323d37..584f2d0d5 100644 --- a/src/util/gui/menu.c +++ b/src/util/gui/menu.c @@ -8,7 +8,7 @@ #include #include -#ifdef _3DS +#ifdef __3DS__ #include <3ds.h> #elif defined(__SWITCH__) #include @@ -62,7 +62,7 @@ enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* men GUIMenuStateInit(&state); GUIInvalidateKeys(params); while (true) { -#ifdef _3DS +#ifdef __3DS__ if (!aptMainLoop()) { return GUI_MENU_EXIT_CANCEL; } diff --git a/src/util/vfs.c b/src/util/vfs.c index 736a88ec9..28d366c53 100644 --- a/src/util/vfs.c +++ b/src/util/vfs.c @@ -10,7 +10,7 @@ #ifdef PSP2 #include #endif -#ifdef _3DS +#ifdef __3DS__ #include #endif