diff --git a/plugins/sdcafiine/src/common/retain_vars.cpp b/plugins/sdcafiine/src/common/retain_vars.cpp index f37e94f..42fbf03 100644 --- a/plugins/sdcafiine/src/common/retain_vars.cpp +++ b/plugins/sdcafiine/src/common/retain_vars.cpp @@ -1,11 +1,8 @@ #include "retain_vars.h" -u8 gUsingLibIOSUHAX __attribute__((section(".data"))) = 0; u8 gAppStatus __attribute__((section(".data"))) = 0; + volatile u8 gSDInitDone __attribute__((section(".data"))) = 0; char gModFolder[FS_MAX_ENTNAME_SIZE] __attribute__((section(".data"))); //char gLastMetaPath[FS_MAX_ENTNAME_SIZE] __attribute__((section(".data"))); - -void * ntfs_mounts __attribute__((section(".data"))) = NULL; -int ntfs_mount_count __attribute__((section(".data"))) = 0; diff --git a/plugins/sdcafiine/src/common/retain_vars.h b/plugins/sdcafiine/src/common/retain_vars.h index 7a05e55..afda58f 100644 --- a/plugins/sdcafiine/src/common/retain_vars.h +++ b/plugins/sdcafiine/src/common/retain_vars.h @@ -6,14 +6,10 @@ #define ASYNC_RESULT_CACHE_SIZE 50 #define FS_QUEUE_MESSAGE_COUNT 5 -extern u8 gUsingLibIOSUHAX; extern u8 gAppStatus; extern volatile u8 gSDInitDone; extern char gModFolder[FS_MAX_ENTNAME_SIZE]; -//extern char gLastMetaPath[FS_MAX_ENTNAME_SIZE]; -extern void * ntfs_mounts; -extern int ntfs_mount_count; #endif // RETAINS_VARS_H_ diff --git a/plugins/sdcafiine/src/main.cpp b/plugins/sdcafiine/src/main.cpp index 622469e..3ced8bb 100644 --- a/plugins/sdcafiine/src/main.cpp +++ b/plugins/sdcafiine/src/main.cpp @@ -1,142 +1,44 @@ #include #include +#include +#include #include #include #include #include #include #include -#include #include #include "common/retain_vars.h" -#include #include #include #include "common/common.h" #include "main.h" #include "modpackSelector.h" -#define DEBUG_LOG 1 - WUPS_MODULE_NAME("SDCaffiine lite"); WUPS_MODULE_VERSION("v1.0"); WUPS_MODULE_AUTHOR("Maschell"); WUPS_MODULE_LICENSE("GPL"); -void Init_SD_USB(); INITIALIZE(){ - if(gAppStatus == 2){ - return; - } InitOSFunctionPointers(); InitSocketFunctionPointers(); //For logging - InitSysFunctionPointers(); // For SYSLaunchMenu() - InitProcUIFunctionPointers(); // For SYSLaunchMenu() - InitFSFunctionPointers(); - InitVPadFunctionPointers(); - log_init(); - gSDInitDone = 0; - - DEBUG_FUNCTION_LINE("Mount SD partition\n"); - Init_SD_USB(); - if(FileReplacerUtils::setGroupAndOwnerID()){ DEBUG_FUNCTION_LINE("SUCCESS\n"); } HandleMultiModPacks(OSGetTitleID()); - log_print("Init of sd_cafiine!\n"); -} - - -void Init_SD_USB() { - //int res = IOSUHAX_Open(NULL); - //if(res < 0){ - //ExecuteIOSExploitWithDefaultConfig(); - // return; - //} - deleteDevTabsNames(); - mount_fake(); - gSDInitDone |= SDUSB_MOUNTED_FAKE; - - int res = -1; - if(res < 0){ - DEBUG_FUNCTION_LINE("IOSUHAX_open failed\n"); - if((res = mount_sd_fat("sd")) >= 0){ - DEBUG_FUNCTION_LINE("mount_sd_fat success\n"); - gSDInitDone |= SDUSB_MOUNTED_OS_SD; - }else{ - DEBUG_FUNCTION_LINE("mount_sd_fat failed %d\n",res); - } - }else{ - DEBUG_FUNCTION_LINE("Using IOSUHAX for SD/USB access\n"); - gSDInitDone |= SDUSB_LIBIOSU_LOADED; - int ntfs_mounts = 0; //mountAllNTFS(); - if(ntfs_mounts > 0){ - gSDInitDone |= USB_MOUNTED_LIBNTFS; - } - - /*if(mount_libfatAll() == 0){ - gSDInitDone |= SD_MOUNTED_LIBFAT; - gSDInitDone |= USB_MOUNTED_LIBFAT; - }*/ - } - DEBUG_FUNCTION_LINE("%08X\n",gSDInitDone); -} - - -void deInit_SD_USB(){ - DEBUG_FUNCTION_LINE("Called this function.\n"); - - if(gSDInitDone & SDUSB_MOUNTED_FAKE){ - DEBUG_FUNCTION_LINE("Unmounting fake\n"); - unmount_fake(); - gSDInitDone &= ~SDUSB_MOUNTED_FAKE; - } - if(gSDInitDone & SDUSB_MOUNTED_OS_SD){ - DEBUG_FUNCTION_LINE("Unmounting OS SD\n"); - unmount_sd_fat("sd"); - gSDInitDone &= ~SDUSB_MOUNTED_OS_SD; - } - - /*if(gSDInitDone & SD_MOUNTED_LIBFAT){ - DEBUG_FUNCTION_LINE("Unmounting LIBFAT SD\n"); - unmount_libfat("sd"); - gSDInitDone &= ~SD_MOUNTED_LIBFAT; - } - - if(gSDInitDone & USB_MOUNTED_LIBFAT){ - DEBUG_FUNCTION_LINE("Unmounting LIBFAT USB\n"); - unmount_libfat("usb"); - gSDInitDone &= ~USB_MOUNTED_LIBFAT; - } - - if(gSDInitDone & USB_MOUNTED_LIBNTFS){ - DEBUG_FUNCTION_LINE("Unmounting LIBNTFS USB\n"); - unmountAllNTFS(); - gSDInitDone &= ~USB_MOUNTED_LIBNTFS; - }*/ - - if(gSDInitDone & SDUSB_LIBIOSU_LOADED){ - DEBUG_FUNCTION_LINE("Calling IOSUHAX_Close\n"); - IOSUHAX_Close(); - gSDInitDone &= ~SDUSB_LIBIOSU_LOADED; - } - deleteDevTabsNames(); - if(gSDInitDone != SDUSB_MOUNTED_NONE){ - DEBUG_FUNCTION_LINE("WARNING. Some devices are still mounted.\n"); - } - DEBUG_FUNCTION_LINE("Function end.\n"); + log_print("Init of SDCafiine!\n"); } void deInitApplication(){ //FileReplacerUtils::getInstance()->StopAsyncThread(); FileReplacerUtils::destroyInstance(); - deInit_SD_USB(); } diff --git a/plugins/sdcafiine/src/modpackSelector.cpp b/plugins/sdcafiine/src/modpackSelector.cpp index 101dacc..08673c5 100644 --- a/plugins/sdcafiine/src/modpackSelector.cpp +++ b/plugins/sdcafiine/src/modpackSelector.cpp @@ -32,11 +32,11 @@ void HandleMultiModPacks(u64 titleID/*,bool showMenu*/) { if(gSDInitDone & SDUSB_MOUNTED_OS_SD){ mounting_points[std::string(SD_PATH)] = std::string(NAME_PREFIX_SD); } if(gSDInitDone & SD_MOUNTED_LIBFAT){ mounting_points[std::string(SD_PATH)] = std::string(NAME_PREFIX_SD); } if(gSDInitDone & USB_MOUNTED_LIBFAT){ mounting_points[std::string(USB_PATH)] = std::string(NAME_PREFIX_USB); } - int i = 0; + //int i = 0; - for (i = 0; i < ntfs_mount_count; i++){ + //for (i = 0; i < ntfs_mount_count; i++){ //mounting_points[std::string(((ntfs_md *)ntfs_mounts)[i].name) + ":"] = StringTools::strfmt("%s:(%s)",((ntfs_md *)ntfs_mounts)[i].name, ntfsGetVolumeName(((ntfs_md *)ntfs_mounts)[i].name)); - } + //} for (std::map::iterator it=mounting_points.begin(); it!=mounting_points.end(); ++it){ diff --git a/plugins/sdcafiine/src/patches.cpp b/plugins/sdcafiine/src/patches.cpp index cf71eb4..354105d 100644 --- a/plugins/sdcafiine/src/patches.cpp +++ b/plugins/sdcafiine/src/patches.cpp @@ -26,7 +26,7 @@ DECL_FUNCTION(void, __PPCExit, void){ DECL_FUNCTION(u32, ProcUIProcessMessages, u32 u){ u32 res = real_ProcUIProcessMessages(u); if(res != gAppStatus){ - DEBUG_FUNCTION_LINE("App status changed from %d to %d \n",gAppStatus,res); + //DEBUG_FUNCTION_LINE("App status changed from %d to %d \n",gAppStatus,res); gAppStatus = res; }