Skip to content

Commit d596552

Browse files
authored
Merge pull request #570 from XorTroll/0.9-dev
0.9
2 parents a253e14 + 4294fe1 commit d596552

File tree

163 files changed

+6704
-3682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+6704
-3682
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Build/
33
Output/
44
*.nso
55
*.nro
6+
*.nacp
67
*.nsp
78
*.elf
89
keys.dat

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "Plutonium"]
22
path = Plutonium
33
url = https://github.com/XorTroll/Plutonium
4+
[submodule "libusbhsfs"]
5+
path = libusbhsfs
6+
url = https://github.com/DarkMatterCore/libusbhsfs

Changelog-v0.9.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Changelog
2+
3+
## General
4+
5+
- Simplified directory deleting logic for both Goldleaf and Quark, making everything less slower (thanks @pheki)
6+
7+
## Goldleaf
8+
9+
- Introducing savedata browsing! select a game from the game manager menu, and mount it's savedata. Note that, if you forget to unmount them manually, they will be automatically unmounted when Goldleaf is exited
10+
11+
- Support for firmware installing, via Atmosphere's ams:su service extension!
12+
13+
- Now fatal crashes are avoided, and Goldleaf will just display an error message via the console's error applet, and save its own report with information about the crash/error.
14+
15+
- Simplified and cleaned a lot of internal code, hopefully making everything more stable
16+
17+
- Updated libnx and Plutonium - this implies support for previously unsupported special text (Japanese and Chinese characters, etc.) with last Plutonium
18+
19+
- Removed emuiibo manager - emuiibo's overlay is now the optimal and recommended manager for emuiibo
20+
21+
- Amiibo dumping support was updated to match emuiibo v0.5.x's format
22+
23+
- Non-lowercase file extensions (.TXT, .biN, .Nsp, etc.) are now properly supported
24+
25+
- Fixed resetting a title's launch version, which wasn't properly implemented on previous releases
26+
27+
- Now dumped firmware will be compatible with Atmosphere's Daybreak firmware tool, deprecating Choi support (as Daybreak is a better and safer alternative)
28+
29+
- Removed support for dumping firmware as NSP packages, as no relevent firmware tool makes use of that format
30+
31+
- Reboot-to-payload functionality (which can be used with .bin files) has been internally improved with Atmosphere's bpc:ams extensions
32+
33+
- 🌈 Random color schemes/pallets are used by default now, instead of default light/dark blue schemes
34+
35+
- Fixed a small bug where no personalized tickets would be detected if no common tickets were present in the console
36+
37+
- Introducing USB drive support, thanks to me and DarkMatterCore's new project: [libusbhsfs](https://github.com/DarkMatterCore/libusbhsfs), a library to include USB drive support in your homebrew projects!
38+
39+
- Both FAT (including exFAT) and NTFS filesystems are supported ;)
40+
41+
- Other minor code improvements or small bug fixes
42+
43+
## Quark
44+
45+
- Several improvements related to various small errors
46+
47+
- From now on, two different builds will be compiled/released: one for Java 8 and one for Java 9 or higher, in order to avoid version issues

Goldleaf/Goldleaf.nacp

-16 KB
Binary file not shown.

Goldleaf/Include/ByteBuffer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
44
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5-
Copyright (C) 2018-2019 XorTroll
5+
Copyright (C) 2018-2020 XorTroll
66
77
This program is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by

Goldleaf/Include/ByteBuffer.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
44
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5-
Copyright (C) 2018-2019 XorTroll
5+
Copyright (C) 2018-2020 XorTroll
66
77
This program is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by

Goldleaf/Include/Types.hpp

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
44
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5-
Copyright (C) 2018-2019 XorTroll
5+
Copyright (C) 2018-2020 XorTroll
66
77
This program is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -26,19 +26,15 @@
2626
#include <arpa/inet.h>
2727
#include <ByteBuffer.hpp>
2828
#include <json.hpp>
29+
#include <codecvt>
2930
#include <pu/Plutonium>
31+
#include <usbhsfs.h>
3032

3133
using JSON = nlohmann::json;
32-
template<typename ...Args>
33-
using ResultWith = std::tuple<Result, Args...>;
3434

3535
using String = pu::String;
3636

37-
template<typename ...Args>
38-
inline constexpr ResultWith<Args...> MakeResultWith(Result res, Args &...args)
39-
{
40-
return std::make_tuple(res, std::forward<Args>(args)...);
41-
}
37+
String LowerCaseString(String str);
4238

4339
// Thanks SciresM
4440
#define R_TRY(res_expr) \
@@ -49,20 +45,13 @@ inline constexpr ResultWith<Args...> MakeResultWith(Result res, Args &...args)
4945
} \
5046
})
5147

52-
namespace result
53-
{
54-
namespace module
55-
{
56-
static constexpr u32 Goldleaf = 356;
57-
static constexpr u32 Errno = 357;
58-
static constexpr u32 ExGUSB = 358;
59-
}
60-
}
61-
6248
namespace consts
6349
{
64-
extern std::string Root;
65-
extern std::string Log;
50+
static const std::string Root = "switch/Goldleaf";
51+
static const std::string Log = Root + "/goldleaf.log";
52+
static const std::string Settings = Root + "/settings.json";
53+
static const std::string TempUpdatedNro = Root + "/update_tmp.nro";
54+
static const std::string AmiiboCache = Root + "/amiibocache";
6655
}
6756

6857
enum class ExecutableMode
@@ -114,38 +103,55 @@ struct Version
114103
s32 Micro;
115104

116105
String AsString();
117-
static Version MakeVersion(u32 major, u32 minor, u32 micro);
106+
107+
static inline constexpr Version MakeVersion(u32 major, u32 minor, u32 micro)
108+
{
109+
return { major, minor, static_cast<s32>(micro) };
110+
}
111+
118112
static Version FromString(String StrVersion);
119113
bool IsLower(Version Other);
120114
bool IsHigher(Version Other);
121115
bool IsEqual(Version Other);
122116
};
123117

118+
class OnScopeExit
119+
{
120+
private:
121+
std::function<void()> call;
122+
123+
public:
124+
OnScopeExit(std::function<void()> call) : call(call) {}
125+
126+
~OnScopeExit()
127+
{
128+
this->call();
129+
}
130+
};
131+
124132
namespace logging
125133
{
126134
template<typename ...Args>
127-
void LogFmt(String fmt, Args &&...args)
135+
inline void LogFmt(std::string fmt, Args &&...args)
128136
{
129-
FILE *f = fopen(("sdmc:/" + consts::Log).c_str(), "a+");
137+
auto f = fopen(("sdmc:/" + consts::Log).c_str(), "a+");
130138
if(f)
131139
{
132-
fprintf(f, (fmt.AsUTF8() + "\n").c_str(), args...);
140+
fprintf(f, (fmt + "\n").c_str(), args...);
133141
fclose(f);
134142
}
135143
}
136144
}
137145

138146
ExecutableMode GetExecutableMode();
139147
LaunchMode GetLaunchMode();
140-
String GetVersion();
141148
u64 GetApplicationId();
142149
bool HasKeyFile();
143-
bool IsAtmosphere();
144150
u64 GetCurrentApplicationId();
145151
u32 RandomFromRange(u32 Min, u32 Max);
146152
void EnsureDirectories();
147153
Result Initialize();
148-
void Close();
154+
void Close(Result rc);
149155

150156
// Exit calls Close!
151-
void Exit();
157+
void Exit(Result rc);

Goldleaf/Include/acc/acc_Service.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
44
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5-
Copyright (C) 2018-2019 XorTroll
5+
Copyright (C) 2018-2020 XorTroll
66
77
This program is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by

Goldleaf/Include/acc/acc_UserSelection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
44
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5-
Copyright (C) 2018-2019 XorTroll
5+
Copyright (C) 2018-2020 XorTroll
66
77
This program is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
/*
3+
4+
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5+
Copyright (C) 2018-2020 XorTroll
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
*/
21+
22+
#pragma once
23+
#include <Types.hpp>
24+
25+
namespace amssu
26+
{
27+
struct UpdateInformation
28+
{
29+
u32 version;
30+
bool exfat_supported;
31+
u32 fw_variation_count;
32+
33+
};
34+
35+
struct UpdateValidationInfo {
36+
Result result;
37+
Result exfat_result;
38+
NcmContentMetaKey invalid_key;
39+
NcmContentId invalid_content_id;
40+
};
41+
42+
struct SystemUpdateProgress {
43+
s64 current_size;
44+
s64 total_size;
45+
};
46+
47+
Result Initialize();
48+
void Exit();
49+
bool HasInitialized();
50+
51+
Result GetUpdateInformation(const char *path, UpdateInformation *out_info);
52+
Result ValidateUpdate(const char *path, UpdateValidationInfo *out_info);
53+
Result SetupUpdate(void *buf, size_t size, const char *path, bool exfat);
54+
Result SetupUpdateWithVariation(void *buf, size_t size, const char *path, bool exfat, u32 variation);
55+
Result RequestPrepareUpdate(AsyncResult *async);
56+
Result GetPrepareUpdateProgress(NsSystemUpdateProgress *out);
57+
Result HasPreparedUpdate(bool *out_has);
58+
Result ApplyPreparedUpdate();
59+
}

0 commit comments

Comments
 (0)