3DS: Update ifdef macros

This commit is contained in:
Vicki Pfau 2022-02-14 20:41:44 -08:00
parent 2ee462d88c
commit 7752c0c849
13 changed files with 26 additions and 26 deletions

View File

@ -116,7 +116,7 @@ typedef intptr_t ssize_t;
#define ATOMIC_LOAD_PTR(DST, SRC) ATOMIC_LOAD(DST, SRC) #define ATOMIC_LOAD_PTR(DST, SRC) ATOMIC_LOAD(DST, SRC)
#endif #endif
#if defined(_3DS) || defined(GEKKO) || defined(PSP2) #if defined(__3DS__) || defined(GEKKO) || defined(PSP2)
// newlib doesn't support %z properly by default // newlib doesn't support %z properly by default
#define PRIz "" #define PRIz ""
#elif defined(_MSC_VER) #elif defined(_MSC_VER)

View File

@ -52,7 +52,7 @@ struct Address {
}; };
}; };
#ifdef _3DS #ifdef __3DS__
#include <3ds.h> #include <3ds.h>
#include <malloc.h> #include <malloc.h>
@ -73,7 +73,7 @@ static inline void SocketSubsystemInit() {
#ifdef _WIN32 #ifdef _WIN32
WSADATA data; WSADATA data;
WSAStartup(MAKEWORD(2, 2), &data); WSAStartup(MAKEWORD(2, 2), &data);
#elif defined(_3DS) #elif defined(__3DS__)
if (!SOCUBuffer) { if (!SOCUBuffer) {
SOCUBuffer = memalign(SOCU_ALIGN, SOCU_BUFFERSIZE); SOCUBuffer = memalign(SOCU_ALIGN, SOCU_BUFFERSIZE);
socInit(SOCUBuffer, SOCU_BUFFERSIZE); socInit(SOCUBuffer, SOCU_BUFFERSIZE);
@ -92,7 +92,7 @@ static inline void SocketSubsystemInit() {
static inline void SocketSubsystemDeinit() { static inline void SocketSubsystemDeinit() {
#ifdef _WIN32 #ifdef _WIN32
WSACleanup(); WSACleanup();
#elif defined(_3DS) #elif defined(__3DS__)
socExit(); socExit();
free(SOCUBuffer); free(SOCUBuffer);
SOCUBuffer = NULL; SOCUBuffer = NULL;
@ -168,7 +168,7 @@ static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress)
memset(&bindInfo, 0, sizeof(bindInfo)); memset(&bindInfo, 0, sizeof(bindInfo));
bindInfo.sin_family = AF_INET; bindInfo.sin_family = AF_INET;
bindInfo.sin_port = htons(port); bindInfo.sin_port = htons(port);
#ifndef _3DS #ifndef __3DS__
bindInfo.sin_addr.s_addr = INADDR_ANY; bindInfo.sin_addr.s_addr = INADDR_ANY;
#else #else
bindInfo.sin_addr.s_addr = gethostid(); bindInfo.sin_addr.s_addr = gethostid();
@ -189,7 +189,7 @@ static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress)
#else #else
err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo)); err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo));
#endif #endif
#if !defined(_3DS) && !defined(GEKKO) #if !defined(__3DS__) && !defined(GEKKO)
} else { } else {
struct sockaddr_in6 bindInfo; struct sockaddr_in6 bindInfo;
memset(&bindInfo, 0, sizeof(bindInfo)); memset(&bindInfo, 0, sizeof(bindInfo));
@ -238,7 +238,7 @@ static inline Socket SocketConnectTCP(int port, const struct Address* destinatio
#else #else
err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo)); err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo));
#endif #endif
#if !defined(_3DS) && !defined(GEKKO) #if !defined(__3DS__) && !defined(GEKKO)
} else { } else {
struct sockaddr_in6 bindInfo; struct sockaddr_in6 bindInfo;
memset(&bindInfo, 0, sizeof(bindInfo)); memset(&bindInfo, 0, sizeof(bindInfo));
@ -291,7 +291,7 @@ static inline Socket SocketAccept(Socket socket, struct Address* address) {
#else #else
return accept(socket, (struct sockaddr*) &addrInfo, &len); return accept(socket, (struct sockaddr*) &addrInfo, &len);
#endif #endif
#if !defined(_3DS) && !defined(GEKKO) #if !defined(__3DS__) && !defined(GEKKO)
} else { } else {
struct sockaddr_in6 addrInfo; struct sockaddr_in6 addrInfo;
memset(&addrInfo, 0, sizeof(addrInfo)); memset(&addrInfo, 0, sizeof(addrInfo));

View File

@ -23,7 +23,7 @@ CXX_GUARD_START
#include <mgba-util/platform/windows/threading.h> #include <mgba-util/platform/windows/threading.h>
#elif defined(PSP2) #elif defined(PSP2)
#include <mgba-util/platform/psp2/threading.h> #include <mgba-util/platform/psp2/threading.h>
#elif defined(_3DS) #elif defined(__3DS__)
#include <mgba-util/platform/3ds/threading.h> #include <mgba-util/platform/3ds/threading.h>
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
#include <mgba-util/platform/switch/threading.h> #include <mgba-util/platform/switch/threading.h>
@ -32,7 +32,7 @@ CXX_GUARD_START
#endif #endif
#endif #endif
#ifdef DISABLE_THREADING #ifdef DISABLE_THREADING
#ifdef _3DS #ifdef __3DS__
// ctrulib already has a type called Thread // ctrulib already has a type called Thread
#include <3ds/thread.h> #include <3ds/thread.h>
#elif defined(__SWITCH__) #elif defined(__SWITCH__)

View File

@ -87,7 +87,7 @@ struct VDir* VDirOpenZip(const char* path, int flags);
struct VDir* VDirOpen7z(const char* path, int flags); struct VDir* VDirOpen7z(const char* path, int flags);
#endif #endif
#if defined(__wii__) || defined(_3DS) || defined(PSP2) #if defined(__wii__) || defined(__3DS__) || defined(PSP2)
struct VDir* VDeviceList(void); struct VDir* VDeviceList(void);
#endif #endif

View File

@ -29,7 +29,7 @@
#include <psp2/io/stat.h> #include <psp2/io/stat.h>
#endif #endif
#ifdef _3DS #ifdef __3DS__
#include <mgba-util/platform/3ds/3ds-vfs.h> #include <mgba-util/platform/3ds/3ds-vfs.h>
#endif #endif
@ -239,7 +239,7 @@ void mCoreConfigDirectory(char* out, size_t outLength) {
#elif defined(GEKKO) || defined(__SWITCH__) #elif defined(GEKKO) || defined(__SWITCH__)
snprintf(out, outLength, "/%s", projectName); snprintf(out, outLength, "/%s", projectName);
mkdir(out, 0777); mkdir(out, 0777);
#elif defined(_3DS) #elif defined(__3DS__)
snprintf(out, outLength, "/%s", projectName); snprintf(out, outLength, "/%s", projectName);
FSUSER_CreateDirectory(sdmcArchive, fsMakePath(PATH_ASCII, out), 0); FSUSER_CreateDirectory(sdmcArchive, fsMakePath(PATH_ASCII, out), 0);
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
@ -276,7 +276,7 @@ void mCoreConfigPortablePath(char* out, size_t outLength) {
} }
WideCharToMultiByte(CP_UTF8, 0, wpath, -1, out, outLength, 0, 0); WideCharToMultiByte(CP_UTF8, 0, wpath, -1, out, outLength, 0, 0);
StringCchCatA(out, outLength, PATH_SEP "portable.ini"); 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'; out[0] = '\0';
#else #else
getcwd(out, outLength); getcwd(out, outLength);

View File

@ -638,13 +638,13 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
int frames = 0; int frames = 0;
GUIPollInput(&runner->params, 0, &keys); GUIPollInput(&runner->params, 0, &keys);
while (keys && frames < 30) { while (keys && frames < 30) {
#ifdef _3DS #ifdef __3DS__
if (!frames) { if (!frames) {
#endif #endif
runner->params.drawStart(); runner->params.drawStart();
runner->drawFrame(runner, true); runner->drawFrame(runner, true);
runner->params.drawEnd(); runner->params.drawEnd();
#ifdef _3DS #ifdef __3DS__
} else { } else {
// XXX: Why does this fix #1294? // XXX: Why does this fix #1294?
usleep(15000); usleep(15000);

View File

@ -12,7 +12,7 @@
#include <mgba/internal/gb/serialize.h> #include <mgba/internal/gb/serialize.h>
#include <mgba/internal/gb/io.h> #include <mgba/internal/gb/io.h>
#ifdef _3DS #ifdef __3DS__
#define blip_add_delta blip_add_delta_fast #define blip_add_delta blip_add_delta_fast
#endif #endif

View File

@ -16,7 +16,7 @@
#define MP2K_LOCK_MAX 8 #define MP2K_LOCK_MAX 8
#ifdef _3DS #ifdef __3DS__
#define blip_add_delta blip_add_delta_fast #define blip_add_delta blip_add_delta_fast
#endif #endif

View File

@ -15,7 +15,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi") set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi")
set(3DS ON) set(3DS ON)
add_definitions(-D_3DS -DARM11) add_definitions(-D__3DS__)
create_devkit(ARM) create_devkit(ARM)

View File

@ -16,7 +16,7 @@
#include <mgba-util/string.h> #include <mgba-util/string.h>
#include <mgba-util/vfs.h> #include <mgba-util/vfs.h>
#ifdef _3DS #ifdef __3DS__
#include <3ds.h> #include <3ds.h>
#endif #endif
#ifdef __SWITCH__ #ifdef __SWITCH__
@ -81,7 +81,7 @@ static Socket _socket = INVALID_SOCKET;
static Socket _server = INVALID_SOCKET; static Socket _server = INVALID_SOCKET;
int main(int argc, char** argv) { int main(int argc, char** argv) {
#ifdef _3DS #ifdef __3DS__
UNUSED(_mPerfShutdown); UNUSED(_mPerfShutdown);
gfxInitDefault(); gfxInitDefault();
osSetSpeedupEnable(true); osSetSpeedupEnable(true);
@ -173,7 +173,7 @@ int main(int argc, char** argv) {
cleanup: cleanup:
freeArguments(&args); freeArguments(&args);
#ifdef _3DS #ifdef __3DS__
gfxExit(); gfxExit();
acExit(); acExit();
#elif defined(__SWITCH__) #elif defined(__SWITCH__)

View File

@ -14,7 +14,7 @@
#define ITERATION_SIZE 5 #define ITERATION_SIZE 5
#define SCANNING_THRESHOLD_1 50 #define SCANNING_THRESHOLD_1 50
#ifdef _3DS #ifdef __3DS__
// 3DS is slooooow at opening files // 3DS is slooooow at opening files
#define SCANNING_THRESHOLD_2 10 #define SCANNING_THRESHOLD_2 10
#else #else

View File

@ -8,7 +8,7 @@
#include <mgba-util/gui.h> #include <mgba-util/gui.h>
#include <mgba-util/gui/font.h> #include <mgba-util/gui/font.h>
#ifdef _3DS #ifdef __3DS__
#include <3ds.h> #include <3ds.h>
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
#include <switch.h> #include <switch.h>
@ -29,7 +29,7 @@ enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* men
GUIInvalidateKeys(params); GUIInvalidateKeys(params);
while (true) { while (true) {
#ifdef _3DS #ifdef __3DS__
if (!aptMainLoop()) { if (!aptMainLoop()) {
return GUI_MENU_EXIT_CANCEL; return GUI_MENU_EXIT_CANCEL;
} }

View File

@ -10,7 +10,7 @@
#ifdef PSP2 #ifdef PSP2
#include <mgba-util/platform/psp2/sce-vfs.h> #include <mgba-util/platform/psp2/sce-vfs.h>
#endif #endif
#ifdef _3DS #ifdef __3DS__
#include <mgba-util/platform/3ds/3ds-vfs.h> #include <mgba-util/platform/3ds/3ds-vfs.h>
#endif #endif