Skip to content

Commit

Permalink
2.9, with ntr 3.6, updater now support .3dsx version (in theory)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanquitas committed Jul 28, 2017
1 parent e742fc4 commit 0e90213
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 65 deletions.
10 changes: 5 additions & 5 deletions BootNTR.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand Down Expand Up @@ -27,26 +27,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ LIBRARY_DIRS := $(PORTLIBS) $(CTRULIB)
LIBRARIES := citro3d ctru png z m

VERSION_MAJOR := 2
VERSION_MINOR := 8
VERSION_MINOR := 9
VERSION_MICRO := 0


Expand Down Expand Up @@ -135,8 +135,8 @@ FONZD: cleanupdater
PABLOMK7: cleanupdater
make PABLOMK7=1

FONZDM3: cleanupdater
FONZDM3: clean
make FONZD=1 EXTENDEDMODE=1

PABLOMK7M3: cleanupdater
PABLOMK7M3: clean
make PABLOMK7=1 EXTENDEDMODE=1
Binary file added resources/Old sprites/32Version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/Old sprites/33Version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file modified romfs/ntr.n3ds.bin
Binary file not shown.
Binary file modified romfs/ntr.o3ds.bin
Binary file not shown.
Binary file modified romfs/sprites/textSprites/32Version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified romfs/sprites/textSprites/33Version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added romfs/sprites/textSprites/36Version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 13 additions & 8 deletions source/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ static ntrConfig_t g_ntrConfig = { 0 };
bootNtrConfig_t *bnConfig;
ntrConfig_t *ntrConfig;

static const char *configPath = "/Nintendo 3DS/EBNTR/config";
static const char *configDir = "/Nintendo 3DS/EBNTR/";
static const char *configPath = "/3ds/BootNTRSelector/config";
static const char *configDir = "/3ds/BootNTRSelector/";

bool checkPath(void)
{
Expand Down Expand Up @@ -107,7 +107,7 @@ void resetConfig(void)
strJoin(path, config->binariesPath + 5, "ntr_3_3.bin");
remove(path);
memset(path, 0, 0x100);
strJoin(path, config->binariesPath + 5, "ntr_3_5.bin");
strJoin(path, config->binariesPath + 5, "ntr_3_6.bin");
remove(path);

exit:
Expand Down Expand Up @@ -146,13 +146,18 @@ void configInit(void)
if (!saveConfig())
newAppTop(DEFAULT_COLOR, 0, "A problem occured while saving the settings.");
if (g_bnConfig.isMode3)
g_bnConfig.versionToLaunch = V35;
g_bnConfig.versionToLaunch = V36;
}
else
{

time_t current = time(NULL);
time_t last = g_bnConfig.isMode3 ? config->lastUpdateTime3 : config->lastUpdateTime;
time_t last;

if (envIsHomebrew())
last = config->lastUpdateTime3dsx;
else
last = g_bnConfig.isMode3 ? config->lastUpdateTime3 : config->lastUpdateTime;

if (current - last >= SECONDS_IN_WEEK)
bnConfig->checkForUpdate = true;
Expand All @@ -162,13 +167,13 @@ void configInit(void)

if (g_bnConfig.isMode3)
{
bnConfig->versionToLaunch = V35;
bnConfig->versionToLaunch = V36;
}
else
{
if (config->flags & LV32) bnConfig->versionToLaunch = V32;
else if (config->flags & LV33) bnConfig->versionToLaunch = V33;
else if (config->flags & LV35) bnConfig->versionToLaunch = V35;
else if (config->flags & LV36) bnConfig->versionToLaunch = V36;
}
error:
return;
Expand All @@ -186,7 +191,7 @@ void configExit(void)
{
if (version == V32) flags = LV32;
else if (version == V33) flags = LV33;
else if (version == V35) flags = LV35;
else if (version == V36) flags = LV36;
else flags = 0;
config->flags = flags;
}
Expand Down
5 changes: 3 additions & 2 deletions source/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(((major)<<24)|((minor)<<16)|((revision)<<8))
#endif

#define CURRENT_CONFIG_VERSION SYSTEM_VERSION(1, 0, 7)
#define CURRENT_CONFIG_VERSION SYSTEM_VERSION(1, 0, 8)

#define SECONDS_IN_WEEK 604800
#define SECONDS_IN_DAY 86400
Expand All @@ -20,7 +20,7 @@ enum
{
LV32 = BIT(0),
LV33 = BIT(1),
LV35 = BIT(2),
LV36 = BIT(2),
CUSTOM_PLUGIN_PATH = BIT(3)
}configFlags;

Expand All @@ -32,6 +32,7 @@ typedef struct config_s
char pluginPath[0x100];
time_t lastUpdateTime;
time_t lastUpdateTime3;
time_t lastUpdateTime3dsx;

} config_t;

Expand Down
17 changes: 9 additions & 8 deletions source/firstLaunchMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

extern bootNtrConfig_t *bnConfig;
static const char *rootPath = "sdmc:/";
static const char *hblPath = "sdmc:/3ds/ntr/";
static const char *hblPath = "sdmc:/3ds/BootNTRSelector/";
static bool pathError = false;
static char *p_globalPath;
static char *p_pluginPath;
Expand Down Expand Up @@ -317,6 +317,7 @@ void secondSettings(void)
static void setFiles(void)
{
int ret;

if (!fileExists(bnConfig->config->binariesPath + 5))
{
newAppTop(COLOR_BLANK, SKINNY, "%s, doesn't exist", bnConfig->config->binariesPath);
Expand Down Expand Up @@ -371,26 +372,26 @@ static void setFiles(void)

newAppTop(COLOR_BLANK, SKINNY, "Setting up 3.5...");
updateUI();
ret = loadAndPatch(V35);
ret = loadAndPatch(V36);
if (!bnConfig->isDebug)
removeAppTop();
if (ret)
newAppTop(COLOR_SALMON, SKINNY, "Setting up 3.5... Error.");
newAppTop(COLOR_SALMON, SKINNY, "Setting up 3.6... Error.");
else
newAppTop(COLOR_LIMEGREEN, SKINNY, "Setting up 3.5... Done.");
newAppTop(COLOR_LIMEGREEN, SKINNY, "Setting up 3.6... Done.");
updateUI();

if (!bnConfig->isNew3DS)
{
newAppTop(COLOR_BLANK, SKINNY, "Setting up 3.5 unpatched...");
newAppTop(COLOR_BLANK, SKINNY, "Setting up 3.6 unpatched...");
updateUI();
ret = loadAndPatch(V35);
ret = loadAndPatch(V36);
if (!bnConfig->isDebug)
removeAppTop();
if (ret)
newAppTop(COLOR_SALMON, SKINNY, "Setting up 3.5 unpatched... Error.");
newAppTop(COLOR_SALMON, SKINNY, "Setting up 3.6 unpatched... Error.");
else
newAppTop(COLOR_LIMEGREEN, SKINNY, "Setting up 3.5... Done.");
newAppTop(COLOR_LIMEGREEN, SKINNY, "Setting up 3.6... Done.");
updateUI();
}

Expand Down
4 changes: 1 addition & 3 deletions source/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#else
#define CIA_VERSION "BootNTRSelector-Mode3-PabloMK7-Banner.cia"
#endif

#else
#define TIMER 3

Expand All @@ -31,7 +30,6 @@
#else
#define CIA_VERSION "BootNTRSelector-PabloMK7-Banner.cia"
#endif

#endif


Expand Down Expand Up @@ -109,7 +107,7 @@ typedef enum version_e
{
V32 = 0,
V33 = 1,
V35 = 2,
V36 = 2,
} version_t;

/*
Expand Down
18 changes: 9 additions & 9 deletions source/mainMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern bootNtrConfig_t *bnConfig;

static button_t *V32Button;
static button_t *V33Button;
static button_t *V35Button;
static button_t *V36Button;
static sprite_t *desiredVersionSprite;
static sprite_t *tinyButtonBGSprite;
static sprite_t *pressExitSprite;
Expand All @@ -18,7 +18,7 @@ void selectVersion(u32 mode)
{
V32Button->disable(V32Button);
V33Button->disable(V33Button);
V35Button->disable(V35Button);
V36Button->disable(V36Button);
userTouch = true;
switch(mode)
{
Expand All @@ -29,7 +29,7 @@ void selectVersion(u32 mode)
bnConfig->versionToLaunch = V33;
break;
case 3:
bnConfig->versionToLaunch = V35;
bnConfig->versionToLaunch = V36;
break;
default:
break;
Expand All @@ -53,15 +53,15 @@ void initMainMenu(void)
V32Button = newButton(11.0f, 35.0f, selectVersion, 1, tinyButtonBGSprite, sprite);
newSpriteFromPNG(&sprite, "romfs:/sprites/textSprites/33Version.png");
V33Button = newButton(11.0f, 94.0f, selectVersion, 2, tinyButtonBGSprite, sprite);
newSpriteFromPNG(&sprite, "romfs:/sprites/textSprites/35Version.png");
V35Button = newButton(11.0f, 152.0f, selectVersion, 3, tinyButtonBGSprite, sprite);
newSpriteFromPNG(&sprite, "romfs:/sprites/textSprites/36Version.png");
V36Button = newButton(11.0f, 152.0f, selectVersion, 3, tinyButtonBGSprite, sprite);

V32Button->show(V32Button);
V33Button->show(V33Button);
V35Button->show(V35Button);
V36Button->show(V36Button);
addBottomObject(V32Button);
addBottomObject(V33Button);
addBottomObject(V35Button);
addBottomObject(V36Button);
}

newSpriteFromPNG(&pressExitSprite, "romfs:/sprites/textSprites/pressBExit.png");
Expand All @@ -78,7 +78,7 @@ void exitMainMenu(void)
{
destroyButton(V32Button);
destroyButton(V33Button);
destroyButton(V35Button);
destroyButton(V36Button);
deleteSprite(tinyButtonBGSprite);
deleteSprite(desiredVersionSprite);
}
Expand All @@ -91,7 +91,7 @@ static const char * versionString[] =
{
"3.2",
"3.3",
"3.5"
"3.6"
};

int mainMenu(void)
Expand Down
17 changes: 6 additions & 11 deletions source/ntr_launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,19 @@ u32 loadNTRBin(void)
u32 ret;
char path[0x100];

static const char *ntrVersionStrings[4] =
{
"ntr_3_2.bin",
"ntr_3_3.bin",
"ntr_3_5.bin",
"ntr_3_5u.bin"
};

extern const char *outNtrVersionStrings[4];

if (bnConfig->versionToLaunch == V32)
strJoin(path, "/", "ntr.bin");
else if (bnConfig->isMode3 && !bnConfig->isNew3DS)
strJoin(path, bnConfig->config->binariesPath + 5, ntrVersionStrings[3]);
strJoin(path, bnConfig->config->binariesPath + 5, outNtrVersionStrings[3]);
else
strJoin(path, bnConfig->config->binariesPath + 5, ntrVersionStrings[bnConfig->versionToLaunch]);
strJoin(path, bnConfig->config->binariesPath + 5, outNtrVersionStrings[bnConfig->versionToLaunch]);

if (bnConfig->versionToLaunch == V35)
if (bnConfig->versionToLaunch == V36)
{
strJoin(ntrConfig->path, bnConfig->config->binariesPath + 5, ntrVersionStrings[bnConfig->versionToLaunch]);
strJoin(ntrConfig->path, bnConfig->config->binariesPath + 5, outNtrVersionStrings[bnConfig->versionToLaunch]);
#if EXTENDEDMODE
ntrConfig->memorymode = 3;
#else
Expand Down
14 changes: 7 additions & 7 deletions source/pathPatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ static const char *ntrVersionStrings[4] =
"ntr.n3ds.bin"
};

static const char *outNtrVersionStrings[4] =
const char *outNtrVersionStrings[4] =
{
"ntr_3_2.bin",
"ntr_3_3.bin",
"ntr_3_5.bin",
"ntr_3_5u.bin"
"ntr_3_6.bin",
"ntr_3_6u.bin"
};

static void patchBinary(u8 *mem, int size)
Expand Down Expand Up @@ -136,7 +136,7 @@ Result loadAndPatch(version_t version)
binPath = bnConfig->config->binariesPath;
plgPath = bnConfig->config->pluginPath;

if (version == V35 && isNew3DS)
if (version == V36 && isNew3DS)
strJoin(inPath, "romfs:/", ntrVersionStrings[version + 1]);
else
strJoin(inPath, "romfs:/", ntrVersionStrings[version]);
Expand All @@ -149,13 +149,13 @@ Result loadAndPatch(version_t version)
{
strJoin(fixedPath[PLUGIN], plgPath, fixedName[PLUGIN]);

if (version != V35 || !unpatched)
if (version != V36 || !unpatched)
{
strJoin(outPath, binPath, outNtrVersionStrings[version]);
strJoin(fixedPath[BINARY], binPath, outNtrVersionStrings[version]);
strJoin(fixedPath[DEBUG], binPath, outNtrVersionStrings[version]);
}
else if (version == V35 && unpatched)
else if (version == V36 && unpatched)
{
strJoin(outPath, binPath, outNtrVersionStrings[3]);
strJoin(fixedPath[BINARY], binPath, outNtrVersionStrings[3]);
Expand Down Expand Up @@ -194,7 +194,7 @@ Result loadAndPatch(version_t version)
fclose(ntr);
free(mem);

if (version == V35)
if (version == V36)
unpatched++;

return(0);
Expand Down
Loading

0 comments on commit 0e90213

Please sign in to comment.