3DS: Update ifdef macros

This commit is contained in:
Vicki Pfau 2022-02-14 20:41:44 -08:00
parent e15911891c
commit 8289222c18
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)
#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)

View File

@ -52,7 +52,7 @@ struct Address {
};
};
#ifdef _3DS
#ifdef __3DS__
#include <3ds.h>
#include <malloc.h>
@ -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));

View File

@ -23,7 +23,7 @@ CXX_GUARD_START
#include <mgba-util/platform/windows/threading.h>
#elif defined(PSP2)
#include <mgba-util/platform/psp2/threading.h>
#elif defined(_3DS)
#elif defined(__3DS__)
#include <mgba-util/platform/3ds/threading.h>
#elif defined(__SWITCH__)
#include <mgba-util/platform/switch/threading.h>
@ -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__)

View File

@ -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

View File

@ -29,7 +29,7 @@
#include <psp2/io/stat.h>
#endif
#ifdef _3DS
#ifdef __3DS__
#include <mgba-util/platform/3ds/3ds-vfs.h>
#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);

View File

@ -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);

View File

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

View File

@ -16,7 +16,7 @@
#define MP2K_LOCK_MAX 8
#ifdef _3DS
#ifdef __3DS__
#define blip_add_delta blip_add_delta_fast
#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(3DS ON)
add_definitions(-D_3DS -DARM11)
add_definitions(-D__3DS__)
create_devkit(ARM)

View File

@ -16,7 +16,7 @@
#include <mgba-util/string.h>
#include <mgba-util/vfs.h>
#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__)

View File

@ -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

View File

@ -8,7 +8,7 @@
#include <mgba-util/gui.h>
#include <mgba-util/gui/font.h>
#ifdef _3DS
#ifdef __3DS__
#include <3ds.h>
#elif defined(__SWITCH__)
#include <switch.h>
@ -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;
}

View File

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