[Plugins] Don't mount the SDCard withing the SDCafiine plugin.

This breaks the SDCafiine, but will be hopefully fixed later!
This commit is contained in:
Maschell 2018-02-14 19:47:52 +01:00
parent dc8a9a81fc
commit b8d2c51f76
5 changed files with 8 additions and 113 deletions

View File

@ -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;

View File

@ -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_

View File

@ -1,142 +1,44 @@
#include <wups.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <dynamic_libs/os_functions.h>
#include <dynamic_libs/vpad_functions.h>
#include <dynamic_libs/sys_functions.h>
#include <dynamic_libs/fs_functions.h>
#include <dynamic_libs/proc_ui_functions.h>
#include <dynamic_libs/socket_functions.h>
#include <fs/sd_fat_devoptab.h>
#include <utils/logger.h>
#include "common/retain_vars.h"
#include <iosuhax.h>
#include <fswrapper/fs_retain_vars.h>
#include <fswrapper/FileReplacerUtils.h>
#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();
}

View File

@ -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<std::string,std::string>::iterator it=mounting_points.begin(); it!=mounting_points.end(); ++it){

View File

@ -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;
}