mirror of
https://github.com/wiiu-env/AromaBasePlugin.git
synced 2024-11-27 14:04:17 +01:00
Only display the write lock error when a sd card is mounted
This commit is contained in:
parent
f8261378ee
commit
2f0c88f157
@ -1,8 +1,9 @@
|
|||||||
FROM ghcr.io/wiiu-env/devkitppc:20230218
|
FROM ghcr.io/wiiu-env/devkitppc:20230326
|
||||||
|
|
||||||
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20230215 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20230215 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libnotifications:20230126 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libnotifications:20230126 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/librpxloader:20220903 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/librpxloader:20220903 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libcurlwrapper:20230121 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libcurlwrapper:20230121 /artifacts $DEVKITPRO
|
||||||
|
COPY --from=ghcr.io/wiiu-env/libsdutils:20220903 /artifacts $DEVKITPRO
|
||||||
|
|
||||||
WORKDIR project
|
WORKDIR project
|
2
Makefile
2
Makefile
@ -48,7 +48,7 @@ CXXFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
|
|||||||
CFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
|
CFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS := -lcurlwrapper -lnotifications -lrpxloader -lwups -lwut
|
LIBS := -lcurlwrapper -lnotifications -lrpxloader -lsdutils -lwups -lwut
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level
|
# list of directories containing libraries, this must be the top level
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <coreinit/thread.h>
|
#include <coreinit/thread.h>
|
||||||
#include <notifications/notification_defines.h>
|
#include <notifications/notification_defines.h>
|
||||||
#include <notifications/notifications.h>
|
#include <notifications/notifications.h>
|
||||||
|
#include <sdutils/sdutils.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
std::unique_ptr<std::thread> sShowHintThread;
|
std::unique_ptr<std::thread> sShowHintThread;
|
||||||
@ -19,19 +20,31 @@ void ShowHints() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isMounted = false;
|
||||||
|
if (SDUtils_IsSdCardMounted(&isMounted) != SDUTILS_RESULT_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("SDUtils_IsSdCardMounted failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMounted) {
|
||||||
const char *tmp_file = "fs:/vol/external01/wiiu/write_lock";
|
const char *tmp_file = "fs:/vol/external01/wiiu/write_lock";
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
if ((fd = open(tmp_file, O_CREAT | O_TRUNC | O_RDWR)) < 0) {
|
if ((fd = open(tmp_file, O_CREAT | O_TRUNC | O_RDWR)) < 0) {
|
||||||
|
DEBUG_FUNCTION_LINE_VERBOSE("SD Card mounted but not writable");
|
||||||
NotificationModuleStatus err;
|
NotificationModuleStatus err;
|
||||||
NMColor red = {237, 28, 36, 255};
|
NMColor red = {237, 28, 36, 255};
|
||||||
NotificationModuleHandle outHandle;
|
NotificationModuleHandle outHandle;
|
||||||
if ((err = NotificationModule_SetDefaultValue(NOTIFICATION_MODULE_NOTIFICATION_TYPE_DYNAMIC, NOTIFICATION_MODULE_DEFAULT_OPTION_BACKGROUND_COLOR, red)) == NOTIFICATION_MODULE_RESULT_SUCCESS &&
|
if ((err = NotificationModule_SetDefaultValue(NOTIFICATION_MODULE_NOTIFICATION_TYPE_DYNAMIC, NOTIFICATION_MODULE_DEFAULT_OPTION_BACKGROUND_COLOR, red)) != NOTIFICATION_MODULE_RESULT_SUCCESS ||
|
||||||
(err = NotificationModule_AddDynamicNotification("Failed to write to the sd card. Please restart the console and make sure the sd card is not write locked.", &outHandle)) == NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
(err = NotificationModule_AddDynamicNotification("Failed to write to the sd card. Please restart the console and make sure the sd card is not write locked.", &outHandle)) != NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("Failed to display notification: %s", NotificationModule_GetStatusStr(err));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
DEBUG_FUNCTION_LINE_VERBOSE("SD Card is mounted and writeable");
|
||||||
close(fd);
|
close(fd);
|
||||||
remove(tmp_file);
|
remove(tmp_file);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG_FUNCTION_LINE_VERBOSE("SD Card is not mounted");
|
||||||
|
}
|
||||||
|
|
||||||
if (!gConfigMenuHintShown) {
|
if (!gConfigMenuHintShown) {
|
||||||
NotificationModuleStatus err;
|
NotificationModuleStatus err;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <nn/spm.h>
|
#include <nn/spm.h>
|
||||||
#include <notifications/notifications.h>
|
#include <notifications/notifications.h>
|
||||||
#include <rpxloader/rpxloader.h>
|
#include <rpxloader/rpxloader.h>
|
||||||
|
#include <sdutils/sdutils.h>
|
||||||
#include <utils/logger.h>
|
#include <utils/logger.h>
|
||||||
#include <wups.h>
|
#include <wups.h>
|
||||||
|
|
||||||
@ -21,6 +22,8 @@ WUPS_PLUGIN_LICENSE("GPL");
|
|||||||
WUPS_USE_WUT_DEVOPTAB();
|
WUPS_USE_WUT_DEVOPTAB();
|
||||||
WUPS_USE_STORAGE("aroma_base_plugin"); // Unique id for the storage api
|
WUPS_USE_STORAGE("aroma_base_plugin"); // Unique id for the storage api
|
||||||
|
|
||||||
|
static bool sSDUtilsInitDone = false;
|
||||||
|
|
||||||
INITIALIZE_PLUGIN() {
|
INITIALIZE_PLUGIN() {
|
||||||
initLogging();
|
initLogging();
|
||||||
if (NotificationModule_InitLibrary() != NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
if (NotificationModule_InitLibrary() != NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
||||||
@ -29,6 +32,9 @@ INITIALIZE_PLUGIN() {
|
|||||||
if (RPXLoader_InitLibrary() != RPX_LOADER_RESULT_SUCCESS) {
|
if (RPXLoader_InitLibrary() != RPX_LOADER_RESULT_SUCCESS) {
|
||||||
DEBUG_FUNCTION_LINE_ERR("RPXLoader_InitLibrary failed");
|
DEBUG_FUNCTION_LINE_ERR("RPXLoader_InitLibrary failed");
|
||||||
}
|
}
|
||||||
|
if (SDUtils_InitLibrary() != SDUTILS_RESULT_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("SDUtils_InitLibrary failed");
|
||||||
|
}
|
||||||
|
|
||||||
// Open storage to read values
|
// Open storage to read values
|
||||||
WUPSStorageError storageRes = WUPS_OpenStorage();
|
WUPSStorageError storageRes = WUPS_OpenStorage();
|
||||||
@ -92,6 +98,7 @@ ON_APPLICATION_ENDS() {
|
|||||||
DEINITIALIZE_PLUGIN() {
|
DEINITIALIZE_PLUGIN() {
|
||||||
NotificationModule_DeInitLibrary();
|
NotificationModule_DeInitLibrary();
|
||||||
RPXLoader_DeInitLibrary();
|
RPXLoader_DeInitLibrary();
|
||||||
|
SDUtils_DeInitLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
DECL_FUNCTION(uint32_t, SuspendDaemonsAndDisconnectIfWireless__Q2_2nn3ndmFv) {
|
DECL_FUNCTION(uint32_t, SuspendDaemonsAndDisconnectIfWireless__Q2_2nn3ndmFv) {
|
||||||
|
Loading…
Reference in New Issue
Block a user