Skip to content

Commit

Permalink
Merge pull request #30 from TraceEntertains/main
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbarrow committed Apr 7, 2024
2 parents 73edbfc + 167414d commit 6376b0b
Show file tree
Hide file tree
Showing 13 changed files with 326 additions and 288 deletions.
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ APP_DESCRIPTION := Nimbus
APP_AUTHOR := Zaksabeast, shutterbug2000
TARGET := nimbus
BUILD := build
SOURCES := source
SOURCES := source source/states source/sysmodules
DATA := data
INCLUDES := include
ROMFS := romfs
Expand Down
11 changes: 7 additions & 4 deletions app/source/common.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "common.hpp"
#include <3ds/services/cfgu.h>

NascEnvironment AccountToNascEnvironment(Account accountId) {
return static_cast<NascEnvironment>(static_cast<u8>(accountId) - 1);
}
#include <format>

// credit to the universal-team for most/all of the code past here
C2D_Font font;
Expand Down Expand Up @@ -104,3 +101,9 @@ std::tuple<u8, u8> UnpackConfigVersion(s64 packed_config_version) {
return { (packed_config_version >> 16) & 0xFF, packed_config_version & 0xFF };
}

void drawLumaInfo(MainStruct *mainStruct) {
DrawString(0.5f, defaultColor, std::format("Luma version is {}.{}.{}\nLuma config version is {}.{}\n\nLuma3DS config bits are:\n{:016b}\n{:016b}\n{:016b}\n{:016b}",
std::get<0>(mainStruct->lumaVersion), std::get<1>(mainStruct->lumaVersion), std::get<2>(mainStruct->lumaVersion),
std::get<0>(mainStruct->lumaConfigVersion), std::get<1>(mainStruct->lumaConfigVersion), mainStruct->lumaOptions >> 48,
(mainStruct->lumaOptions >> 32) & 0xFFFF, (mainStruct->lumaOptions >> 16) & 0xFFFF, mainStruct->lumaOptions & 0xFFFF), 0);
}
56 changes: 44 additions & 12 deletions app/source/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@
#define M_PI 3.14159265358979323846
#endif

#include <stdint.h>
#include "../build/version.hpp"
#include <citro2d.h>
#include <3ds.h>
#include <algorithm>
#include <string>
#include <format>
#include "../build/version.hpp"

enum class Account : u8 {
Undefined = 0,
Nintendo = 1, // prod
Pretendo = 2 // test
};

enum class NascEnvironment : u8 {
NASC_ENV_Prod = 0, // nintendo
Expand All @@ -39,15 +31,53 @@ enum class LumaConfigBitIndex : s32 {

const int targetLumaVersion = 13;
const int GetSystemInfoCFW = 0x10000; // the type for Luma3DS' GetSystemInfo hook that returns CFW info
const u32 defaultColor = C2D_Color32(255, 255, 255, 0xFF);

struct MainStruct {
C2D_Sprite debug_button;
C2D_Sprite debug_header;
C2D_Sprite go_back;
C2D_Sprite header;
C2D_Sprite nintendo_unloaded_deselected;
C2D_Sprite nintendo_unloaded_selected;
C2D_Sprite nintendo_loaded_selected;
C2D_Sprite nintendo_loaded_deselected;
C2D_Sprite pretendo_unloaded_deselected;
C2D_Sprite pretendo_unloaded_selected;
C2D_Sprite pretendo_loaded_selected;
C2D_Sprite pretendo_loaded_deselected;
C2D_Sprite top;

u32 screen = 0;
u32 state = 0;
u32 lastState = 0;

NascEnvironment currentAccount = NascEnvironment::NASC_ENV_Prod;
NascEnvironment buttonSelected = NascEnvironment::NASC_ENV_Prod;

bool firstRunOfState = true;

bool buttonWasPressed = false;
bool needsReboot = false;

// startup checking variables
s64 firmwareVersion;
std::tuple<u8, u8, u8> lumaVersion;

s64 configVersion;
std::tuple<u8, u8> lumaConfigVersion;

s64 lumaOptions;
bool gamePatchingEnabled;
bool externalFirmsAndModulesEnabled;
};

#define handleResult(action, name) \
rc = action; \
if (R_FAILED(rc)) { \
printf("%s error: %08lx\n\n", name, rc); \
}

extern NascEnvironment AccountToNascEnvironment(Account accountId);

// credit to the universal-team for most/all of the code past here
extern C2D_Font font;
extern C2D_TextBuf textBuf;
Expand Down Expand Up @@ -75,4 +105,6 @@ void DrawVersionString();
bool GetLumaOptionByIndex(LumaConfigBitIndex index, s64 options);
s64 GetSystemInfoField(s32 category, CFWSystemInfoField accessor);
std::tuple<u8, u8, u8> UnpackLumaVersion(s64 packed_version);
std::tuple<u8, u8> UnpackConfigVersion(s64 packed_config_version);
std::tuple<u8, u8> UnpackConfigVersion(s64 packed_config_version);

void drawLumaInfo(MainStruct *mainStruct);
11 changes: 0 additions & 11 deletions app/source/frda.hpp

This file was deleted.

0 comments on commit 6376b0b

Please sign in to comment.