mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-22 02:29:15 +01:00
Skip Save Redirection if no SD Card is mounted
This commit is contained in:
parent
57eee716bc
commit
cd212a9314
@ -87,9 +87,14 @@ DECL_FUNCTION(int32_t, LoadConsoleAccount__Q2_2nn3actFUc13ACTLoadOptionPCcb, nn:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool sSDIsMounted;
|
||||||
DECL_FUNCTION(int32_t, SAVEInit) {
|
DECL_FUNCTION(int32_t, SAVEInit) {
|
||||||
auto res = real_SAVEInit();
|
auto res = real_SAVEInit();
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
|
if (!sSDIsMounted) {
|
||||||
|
DEBUG_FUNCTION_LINE_VERBOSE("Skip SD redirection, no SD Card is mounted");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
if (OSGetTitleID() == 0x0005001010040000L || // Wii U Menu JPN
|
if (OSGetTitleID() == 0x0005001010040000L || // Wii U Menu JPN
|
||||||
OSGetTitleID() == 0x0005001010040100L || // Wii U Menu USA
|
OSGetTitleID() == 0x0005001010040100L || // Wii U Menu USA
|
||||||
OSGetTitleID() == 0x0005001010040200L) { // Wii U Menu EUR
|
OSGetTitleID() == 0x0005001010040200L) { // Wii U Menu EUR
|
||||||
|
13
src/main.cpp
13
src/main.cpp
@ -88,7 +88,6 @@ bool sSDUtilsInitDone = false;
|
|||||||
bool sSDIsMounted = false;
|
bool sSDIsMounted = false;
|
||||||
bool sTitleRebooting = false;
|
bool sTitleRebooting = false;
|
||||||
|
|
||||||
|
|
||||||
void Cleanup() {
|
void Cleanup() {
|
||||||
{
|
{
|
||||||
const std::lock_guard<std::mutex> lock1(fileReaderListMutex);
|
const std::lock_guard<std::mutex> lock1(fileReaderListMutex);
|
||||||
@ -110,6 +109,7 @@ void SDAttachedHandler([[maybe_unused]] SDUtilsAttachStatus status) {
|
|||||||
ON_APPLICATION_START() {
|
ON_APPLICATION_START() {
|
||||||
Cleanup();
|
Cleanup();
|
||||||
initLogging();
|
initLogging();
|
||||||
|
sSDIsMounted = false;
|
||||||
|
|
||||||
if (OSGetTitleID() == 0x0005001010040000L || // Wii U Menu JPN
|
if (OSGetTitleID() == 0x0005001010040000L || // Wii U Menu JPN
|
||||||
OSGetTitleID() == 0x0005001010040100L || // Wii U Menu USA
|
OSGetTitleID() == 0x0005001010040100L || // Wii U Menu USA
|
||||||
@ -117,9 +117,17 @@ ON_APPLICATION_START() {
|
|||||||
gInWiiUMenu = true;
|
gInWiiUMenu = true;
|
||||||
|
|
||||||
if (SDUtils_Init() >= 0) {
|
if (SDUtils_Init() >= 0) {
|
||||||
|
DEBUG_FUNCTION_LINE("SDUtils_Init done");
|
||||||
sSDUtilsInitDone = true;
|
sSDUtilsInitDone = true;
|
||||||
sTitleRebooting = false;
|
sTitleRebooting = false;
|
||||||
SDUtils_AddAttachHandler(SDAttachedHandler);
|
if (SDUtils_AddAttachHandler(SDAttachedHandler) != SDUTILS_RESULT_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("Failed to add AttachedHandler");
|
||||||
|
}
|
||||||
|
if (SDUtils_IsSdCardMounted(&sSDIsMounted) != SDUTILS_RESULT_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("IsSdCardMounted failed");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("Failed to init SDUtils. Make sure to have the SDHotSwapModule loaded!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gInWiiUMenu = false;
|
gInWiiUMenu = false;
|
||||||
@ -143,7 +151,6 @@ ON_APPLICATION_ENDS() {
|
|||||||
sSDIsMounted = false;
|
sSDIsMounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::optional<std::shared_ptr<FileInfos>> getIDByLowerTitleID(uint32_t titleid_lower) {
|
std::optional<std::shared_ptr<FileInfos>> getIDByLowerTitleID(uint32_t titleid_lower) {
|
||||||
std::lock_guard<std::mutex> lock(fileInfosMutex);
|
std::lock_guard<std::mutex> lock(fileInfosMutex);
|
||||||
for (auto &cur : fileInfos) {
|
for (auto &cur : fileInfos) {
|
||||||
|
Loading…
Reference in New Issue
Block a user