Skip to content

Commit

Permalink
First step to merge all code into one .srldr file
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Apr 24, 2023
1 parent 504733d commit f35596c
Show file tree
Hide file tree
Showing 27 changed files with 247 additions and 160 deletions.
2 changes: 1 addition & 1 deletion 3dssplash/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -D_NO_MAIN_ALL
CXXFLAGS := $(CFLAGS) -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
2 changes: 1 addition & 1 deletion booter/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -D_NO_MAIN_ALL
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
2 changes: 1 addition & 1 deletion booter_fc/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9 -DNO_SDMMC
CFLAGS += $(INCLUDE) -DARM9 -DNO_SDMMC -DSTANDALONE -D_NO_MAIN_ALL
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS := -g $(ARCH)
Expand Down
4 changes: 2 additions & 2 deletions gbapatcher/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include $(DEVKITARM)/ds_rules
UNIVERSAL := ../../universal
TARGET := gbapatcher
BUILD := build
SOURCES := source source/common source/graphics source/save source/tool $(UNIVERSAL)/source/common $(UNIVERSAL)/source/flashcard $(UNIVERSAL)/source/lodepng $(UNIVERSAL)/source/tonccpy
SOURCES := source source/common source/graphics source/save source/tool $(UNIVERSAL)/source/common $(UNIVERSAL)/source/flashcard $(UNIVERSAL)/source/tonccpy
INCLUDES := include source source/common source/graphics source/save source/tool $(UNIVERSAL)/include
DATA := ../data
GRAPHICS := ../gfx
Expand All @@ -36,7 +36,7 @@ CFLAGS := -g -Wall -O3\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -D_NO_MAIN_ALL
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
8 changes: 5 additions & 3 deletions imageview/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ endif

include $(DEVKITARM)/ds_rules

CURRENT_SCREEN_MODE := 6

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
Expand All @@ -20,8 +22,8 @@ include $(DEVKITARM)/ds_rules
UNIVERSAL := ../../universal
TARGET := imageview
BUILD := build
SOURCES := source source/graphics source/tool source/common $(UNIVERSAL)/source/common $(UNIVERSAL)/source/nds_loader $(UNIVERSAL)/source/lodepng $(UNIVERSAL)/source/tonccpy $(UNIVERSAL)/sdmmc/arm9/source
INCLUDES := source $(UNIVERSAL)/include $(UNIVERSAL)/sdmmc/arm9/include
SOURCES := source source/graphics source/tool source/common $(UNIVERSAL)/source/common $(UNIVERSAL)/source/nds_loader $(UNIVERSAL)/source/lodepng $(UNIVERSAL)/source/tonccpy $(UNIVERSAL)/arm9/source $(UNIVERSAL)/sdmmc/arm9/source
INCLUDES := source $(UNIVERSAL)/include $(UNIVERSAL)/arm9/include $(UNIVERSAL)/sdmmc/arm9/include
DATA := ../data
GRAPHICS := ../gfx
MUSIC := ../music
Expand All @@ -36,7 +38,7 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -DCURRENT_SCREEN_MODE=$(CURRENT_SCREEN_MODE)
CXXFLAGS := $(CFLAGS) -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
31 changes: 9 additions & 22 deletions imageview/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ bool fadeType = false; // false = out, true = in
bool fadeSpeed = true; // false = slow (for DSi launch effect), true = fast
bool controlTopBright = true;
bool controlBottomBright = true;
bool useTwlCfg = false;

extern void ClearBrightness();
extern int imageType;
Expand Down Expand Up @@ -109,33 +108,21 @@ void customSleep() {
}

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
int imageViewer(void) {
//---------------------------------------------------------------------------------
fifoSendValue32(FIFO_PM, PM_REQ_SLEEP_DISABLE); // Disable sleep mode to prevent unexpected crashes from exiting sleep mode
defaultExceptionHandler();
sys().initFilesystem(argv[0]);
sys().initArm7RegStatuses();

if (!sys().fatInitOk()) {
SetBrightness(0, 0);
SetBrightness(1, 0);
consoleDemoInit();
iprintf("FAT init failed!");
stop();
}

keysSetRepeat(25, 25);

useTwlCfg = (dsiFeatures() && (*(u8*)0x02000400 != 0) && (*(u8*)0x02000401 == 0) && (*(u8*)0x02000402 == 0) && (*(u8*)0x02000404 == 0) && (*(u8*)0x02000448 != 0));

ms().loadSettings();

if (argc >= 2) {
if (extension(argv[1], {".gif"})) {
std::string imagePath = ms().homebrewArg[ms().previousUsedDevice];
const char* imagePathChar = imagePath.c_str();

if (strlen(imagePathChar) >= 2) {
if (extension(imagePathChar, {".gif"})) {
imageType = 0;
} else if (extension(argv[1], {".bmp"})) {
} else if (extension(imagePathChar, {".bmp"})) {
imageType = 1;
} else if (extension(argv[1], {".png"})) {
} else if (extension(imagePathChar, {".png"})) {
imageType = 2;
}
} else {
Expand All @@ -147,7 +134,7 @@ int main(int argc, char **argv) {

langInit();

imageLoad((argc >= 2) ? argv[1] : "nitro:/graphics/test.png");
imageLoad((strlen(imagePathChar) >= 2) ? imagePathChar : "nitro:/graphics/test.png");
bgLoad();
if (!ms().macroMode) {
printSmall(false, -88, 174, STR_BACK, Alignment::center);
Expand Down
13 changes: 13 additions & 0 deletions imageview/arm9/source/standaloneStubs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifdef STANDALONE

#include <nds/ndstypes.h>

int titleMode(void);
int settingsMode(void);
int dsClassicMenu(void);
int dsiMenuTheme(void);
int r4Theme(void);
int manualScreen(void);
// Used: int imageViewer(void);

#endif
8 changes: 5 additions & 3 deletions manual/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ endif

include $(DEVKITARM)/ds_rules

CURRENT_SCREEN_MODE := 5

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
Expand All @@ -20,8 +22,8 @@ include $(DEVKITARM)/ds_rules
UNIVERSAL := ../../universal
TARGET := manual
BUILD := build
SOURCES := source source/graphics source/tool source/common $(UNIVERSAL)/source/common $(UNIVERSAL)/source/nds_loader $(UNIVERSAL)/source/tonccpy $(UNIVERSAL)/sdmmc/arm9/source
INCLUDES := source $(UNIVERSAL)/include $(UNIVERSAL)/sdmmc/arm9/include
SOURCES := source source/graphics source/tool source/common $(UNIVERSAL)/source/common $(UNIVERSAL)/source/nds_loader $(UNIVERSAL)/source/lodepng $(UNIVERSAL)/source/tonccpy $(UNIVERSAL)/arm9/source $(UNIVERSAL)/sdmmc/arm9/source
INCLUDES := source $(UNIVERSAL)/include $(UNIVERSAL)/arm9/include $(UNIVERSAL)/sdmmc/arm9/include
DATA := ../data
GRAPHICS := ../gfx
MUSIC := ../music
Expand All @@ -36,7 +38,7 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -DCURRENT_SCREEN_MODE=$(CURRENT_SCREEN_MODE)
CXXFLAGS := $(CFLAGS) -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
20 changes: 1 addition & 19 deletions manual/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ bool fadeType = false; // false = out, true = in
bool fadeSpeed = true; // false = slow (for DSi launch effect), true = fast
bool controlTopBright = true;
bool controlBottomBright = true;
bool useTwlCfg = false;

extern int bgColor1;
extern int bgColor2;
Expand Down Expand Up @@ -252,27 +251,10 @@ void customSleep() {
}

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
int manualScreen(void) {
//---------------------------------------------------------------------------------
fifoSendValue32(FIFO_PM, PM_REQ_SLEEP_DISABLE); // Disable sleep mode to prevent unexpected crashes from exiting sleep mode
defaultExceptionHandler();
sys().initFilesystem(argv[0]);
sys().initArm7RegStatuses();

if (!sys().fatInitOk()) {
SetBrightness(0, 0);
SetBrightness(1, 0);
consoleDemoInit();
iprintf("FAT init failed!");
stop();
}

keysSetRepeat(25, 25);

useTwlCfg = (dsiFeatures() && (*(u8*)0x02000400 != 0) && (*(u8*)0x02000401 == 0) && (*(u8*)0x02000402 == 0) && (*(u8*)0x02000404 == 0) && (*(u8*)0x02000448 != 0));

sysSetCartOwner(BUS_OWNER_ARM9); // Allow arm9 to access GBA ROM

ms().loadSettings();

graphicsInit();
Expand Down
13 changes: 13 additions & 0 deletions manual/arm9/source/standaloneStubs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifdef STANDALONE

#include <nds/ndstypes.h>

int titleMode(void);
int settingsMode(void);
int dsClassicMenu(void);
int dsiMenuTheme(void);
int r4Theme(void);
// Used: int manualScreen(void);
int imageViewer(void);

#endif
4 changes: 3 additions & 1 deletion quickmenu/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ endif

include $(DEVKITARM)/ds_rules

CURRENT_SCREEN_MODE := 2

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
Expand Down Expand Up @@ -36,7 +38,7 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -DCURRENT_SCREEN_MODE=$(CURRENT_SCREEN_MODE)
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
21 changes: 2 additions & 19 deletions quickmenu/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#include "saveMap.h"
#include "ROMList.h"

bool useTwlCfg = false;
extern bool useTwlCfg;

bool whiteScreen = true;
bool fadeType = false; // false = out, true = in
Expand Down Expand Up @@ -1125,25 +1125,8 @@ void customSleep() {
}

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
int dsClassicMenu(void) {
//---------------------------------------------------------------------------------

defaultExceptionHandler();
fifoSendValue32(FIFO_PM, PM_REQ_SLEEP_DISABLE); // Disable sleep mode to prevent unexpected crashes from exiting sleep mode

useTwlCfg = (dsiFeatures() && (*(u8*)0x02000400 != 0) && (*(u8*)0x02000401 == 0) && (*(u8*)0x02000402 == 0) && (*(u8*)0x02000404 == 0) && (*(u8*)0x02000448 != 0));

sys().initFilesystem(argv[0]);
sys().initArm7RegStatuses();

if (!sys().fatInitOk()) {
SetBrightness(0, 0);
SetBrightness(1, 0);
consoleDemoInit();
iprintf("FAT init failed!");
stop();
}

// Read user name
/*char *username = (char*)PersonalData->name;
Expand Down
13 changes: 13 additions & 0 deletions quickmenu/arm9/source/standaloneStubs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifdef STANDALONE

#include <nds/ndstypes.h>

int titleMode(void);
int settingsMode(void);
// Used: int dsClassicMenu(void);
int dsiMenuTheme(void);
int r4Theme(void);
int manualScreen(void);
int imageViewer(void);

#endif
4 changes: 3 additions & 1 deletion romsel_dsimenutheme/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ endif

include $(DEVKITARM)/ds_rules

CURRENT_SCREEN_MODE := 3

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
Expand Down Expand Up @@ -37,7 +39,7 @@ CFLAGS := -g -Wall -O2 \
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -DCURRENT_SCREEN_MODE=$(CURRENT_SCREEN_MODE)
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
21 changes: 2 additions & 19 deletions romsel_dsimenutheme/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#include "saveMap.h"
#include "ROMList.h"

bool useTwlCfg = false;
extern bool useTwlCfg;

bool whiteScreen = true;
bool fadeType = false; // false = out, true = in
Expand Down Expand Up @@ -918,24 +918,7 @@ void bgOperations(bool waitFrame) {
}
}

int main(int argc, char **argv) {
defaultExceptionHandler();
fifoSendValue32(FIFO_PM, PM_REQ_SLEEP_DISABLE); // Disable sleep mode to prevent unexpected crashes from exiting sleep mode
sys().initFilesystem(argv[0]);
sys().initArm7RegStatuses();

if (!sys().fatInitOk()) {
SetBrightness(0, 0);
SetBrightness(1, 0);
consoleDemoInit();
iprintf("FAT init failed!");
stop();
}

useTwlCfg = (dsiFeatures() && (*(u8*)0x02000400 != 0) && (*(u8*)0x02000401 == 0) && (*(u8*)0x02000402 == 0) && (*(u8*)0x02000404 == 0) && (*(u8*)0x02000448 != 0));

sysSetCartOwner(BUS_OWNER_ARM9); // Allow arm9 to access GBA ROM

int dsiMenuTheme(void) {
ms().loadSettings();
bs().loadSettings();
logInit();
Expand Down
13 changes: 13 additions & 0 deletions romsel_dsimenutheme/arm9/source/standaloneStubs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifdef STANDALONE

#include <nds/ndstypes.h>

int titleMode(void);
int settingsMode(void);
int dsClassicMenu(void);
// Used: int dsiMenuTheme(void);
int r4Theme(void);
int manualScreen(void);
int imageViewer(void);

#endif
4 changes: 3 additions & 1 deletion romsel_r4theme/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ endif

include $(DEVKITARM)/ds_rules

CURRENT_SCREEN_MODE := 4

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
Expand Down Expand Up @@ -35,7 +37,7 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CFLAGS += $(INCLUDE) -DARM9 -DSTANDALONE -DCURRENT_SCREEN_MODE=$(CURRENT_SCREEN_MODE)
CXXFLAGS := $(CFLAGS) -fno-exceptions -std=gnu++17

ASFLAGS := -g $(ARCH)
Expand Down
Loading

0 comments on commit f35596c

Please sign in to comment.