From da3b79eb1906677332c6e3e239703e1198a468c0 Mon Sep 17 00:00:00 2001 From: LiquidFenrir Date: Wed, 3 Aug 2022 01:00:33 +0200 Subject: [PATCH] 3ds macro name change - fix #464 also fix useless dependency on vector in spi.cpp --- 3ds/Makefile | 2 +- 3ds/source/spi.cpp | 4 ++-- common/Overlay.hpp | 2 +- common/Screen.cpp | 2 +- common/Screen.hpp | 2 +- common/logger.hpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/3ds/Makefile b/3ds/Makefile index 005b5e9..504e61f 100644 --- a/3ds/Makefile +++ b/3ds/Makefile @@ -81,7 +81,7 @@ CFLAGS := -g -gdwarf-4 -Wall -Wextra -Wno-psabi -O2 -mword-relocations -flto \ -DGIT_REV=\"${GIT_REV}\" \ -DCHEAT_SIZE_DECOMPRESSED=${CHEAT_SIZE_DECOMPRESSED} -CFLAGS += $(INCLUDE) -DARM11 -D_3DS -D_GNU_SOURCE=1 +CFLAGS += $(INCLUDE) -DARM11 -D__3DS__ -D_GNU_SOURCE=1 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17 diff --git a/3ds/source/spi.cpp b/3ds/source/spi.cpp index ca9ba3b..0e8a905 100644 --- a/3ds/source/spi.cpp +++ b/3ds/source/spi.cpp @@ -44,7 +44,7 @@ #include "spi.hpp" -static std::vector knownJEDECs = {0x204012, 0x621600, 0x204013, 0x621100, 0x204014, 0x202017, 0x204017, 0x208013}; +static const u32 knownJEDECS[] = {0x204012, 0x621600, 0x204013, 0x621100, 0x204014, 0x202017, 0x204017, 0x208013}; u8* fill_buf = NULL; @@ -409,7 +409,7 @@ Result SPIGetCardType(CardType* type, int infrared) if (R_SUCCEEDED(res)) { Logger::getInstance().log(Logger::INFO, "Found JEDEC: 0x%016lX", jedec); Logger::getInstance().log(Logger::INFO, "CardType (While inside maxTries loop): %016lX", t); - if (std::find(knownJEDECs.begin(), knownJEDECs.end(), jedec) != knownJEDECs.end()) { + if (std::find(std::begin(knownJEDECS), std::end(knownJEDECS), jedec) != std::end(knownJEDECS)) { Logger::getInstance().log(Logger::INFO, "Found a jedec equal to one in the ordered list. Type: %016lX", *type); } else { diff --git a/common/Overlay.hpp b/common/Overlay.hpp index 093f087..b0e6618 100644 --- a/common/Overlay.hpp +++ b/common/Overlay.hpp @@ -35,7 +35,7 @@ public: Overlay(Screen& screen) : screen(screen), me(screen.currentOverlay) {} virtual ~Overlay() = default; virtual void update(const InputState&) = 0; -#if defined(_3DS) +#if defined(__3DS__) virtual void drawTop() const = 0; virtual void drawBottom() const = 0; #elif defined(__SWITCH__) diff --git a/common/Screen.cpp b/common/Screen.cpp index 2ee9c83..9721578 100644 --- a/common/Screen.cpp +++ b/common/Screen.cpp @@ -27,7 +27,7 @@ #include "Screen.hpp" #include "Overlay.hpp" -#if defined(_3DS) +#if defined(__3DS__) void Screen::doDrawTop() const { diff --git a/common/Screen.hpp b/common/Screen.hpp index 60477c6..ee35e53 100644 --- a/common/Screen.hpp +++ b/common/Screen.hpp @@ -38,7 +38,7 @@ class Screen { public: virtual ~Screen() = default; // Call draw, then currentOverlay->draw if it exists -#if defined(_3DS) +#if defined(__3DS__) void doDrawTop(void) const; void doDrawBottom(void) const; virtual void drawTop(void) const = 0; diff --git a/common/logger.hpp b/common/logger.hpp index f20d80b..9b3f2a7 100644 --- a/common/logger.hpp +++ b/common/logger.hpp @@ -67,7 +67,7 @@ private: Logger(Logger const&) = delete; void operator=(Logger const&) = delete; -#if defined(_3DS) +#if defined(__3DS__) const std::string mPath = "sdmc:/3ds/Checkpoint/checkpoint.log"; #elif defined(__SWITCH__) const std::string mPath = "/switch/Checkpoint/checkpoint.log";