From e233a56d2f87c4b295f87913173148f0fd1275aa Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Thu, 7 Jun 2012 05:14:51 +0000 Subject: [PATCH] -removed two redundant methods -wbfs stuff is mem1 overjoy as we said :P --- source/channel/nand.cpp | 17 +++-------------- source/channel/nand.hpp | 3 +-- source/devicemounter/libwbfs/libwbfs_os.h | 8 ++++---- source/menu/menu_nandemu.cpp | 19 ++++--------------- 4 files changed, 12 insertions(+), 35 deletions(-) diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index d3831bda..94552247 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -38,6 +38,7 @@ #include "mem2.hpp" #include "wbfs.h" #include "gecko.h" +#include "fileOps.h" u8 *confbuffer ATTRIBUTE_ALIGN(32); u8 CCode[0x1008]; @@ -422,18 +423,6 @@ u32 Nand::__configsetsetting(const char *item, const char *val) return 0; } -bool Nand::__FileExists(const char *path, ...) -{ - FILE *f = fopen(path, "rb"); - if (f != 0) - { - gprintf("File \"%s\" exists\n", path); - fclose(f); - return true; - } - return false; -} - void Nand::__FATify(char *ptr, const char *str) { char ctr; @@ -620,8 +609,8 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest) return 0; } - if(__FileExists(dest)) - remove(dest); + if(fsop_FileExist(dest)) + remove(dest); FILE *file = fopen(dest, "wb"); if (!file) diff --git a/source/channel/nand.hpp b/source/channel/nand.hpp index 7cb02705..6e332df9 100644 --- a/source/channel/nand.hpp +++ b/source/channel/nand.hpp @@ -101,14 +101,13 @@ class Nand u32 __configsetbyte(const char *item, u8 val); u32 __configsetbigarray(const char *item, void *val, u32 size); u32 __configsetsetting(const char *item, const char *val); - bool __FileExists(const char *path, ...); void __NANDify(char *str); void __FATify(char *dst, const char *src); s32 __Unescaped2x(const char *path); s32 __FlashNandFile(const char *source, const char *dest); s32 __FlashNandFolder(const char *source, const char *dest); s32 __DumpNandFile(const char *source, const char *dest); - s32 __DumpNandFolder(const char *source, const char *dest); + s32 __DumpNandFolder(const char *source, const char *dest); u32 MountedDevice; u32 EmuDevice; diff --git a/source/devicemounter/libwbfs/libwbfs_os.h b/source/devicemounter/libwbfs/libwbfs_os.h index 6e4f9abc..47d3cc98 100644 --- a/source/devicemounter/libwbfs/libwbfs_os.h +++ b/source/devicemounter/libwbfs/libwbfs_os.h @@ -14,11 +14,11 @@ #define wbfs_fatal(x) do { gprintf(x); wd_last_error = 1; } while(0) #define wbfs_error(x) do { gprintf(x); wd_last_error = 2; } while(0) -#define wbfs_malloc(x) MEM2_alloc(x) -#define wbfs_free(x) MEM2_free(x) +#define wbfs_malloc(x) MEM1_alloc(x) +#define wbfs_free(x) MEM1_free(x) -#define wbfs_ioalloc(x) MEM2_memalign(32, x) -#define wbfs_iofree(x) MEM2_free(x) +#define wbfs_ioalloc(x) MEM1_memalign(32, x) +#define wbfs_iofree(x) MEM1_free(x) #define wbfs_be16(x) (*((u16*)(x))) #define wbfs_be32(x) (*((u32*)(x))) diff --git a/source/menu/menu_nandemu.cpp b/source/menu/menu_nandemu.cpp index 86908906..df850974 100644 --- a/source/menu/menu_nandemu.cpp +++ b/source/menu/menu_nandemu.cpp @@ -7,24 +7,13 @@ #include "lockMutex.hpp" #include "gecko/gecko.h" #include "defines.h" +#include "fileOps.h" static inline int loopNum(int i, int s) { return i < 0 ? (s - (-i % s)) % s : i % s; } -static bool __FileExists(const char *path) -{ - FILE *f = fopen(path, "rb"); - if (f != 0) - { - //gprintf("File \"%s\" exists\n", path); - fclose(f); - return true; - } - return false; -} - static bool _saveExists(const char *path) { DIR *d; @@ -57,20 +46,20 @@ bool CMenu::_TestEmuNand(int epart, const char *path, bool indept) { // Check Wiimotes && Region snprintf(testpath, sizeof(testpath), "%s:%s/shared2/sys/SYSCONF", DeviceName[epart], path); - if(!__FileExists(testpath)) + if(!fsop_FileExist(testpath)) { //gprintf("Nandcheck: SYSCONF not found\n"); haveValidENand = false; } snprintf(testpath, sizeof(testpath), "%s:%s/title/00000001/00000002/data/setting.txt", DeviceName[epart], path); - if(!__FileExists(testpath)) + if(!fsop_FileExist(testpath)) { //gprintf("Nandcheck: setting.txt not found\n"); haveValidENand = false; } // Check Mii's snprintf(testpath, sizeof(testpath), "%s:%s/shared2/menu/FaceLib/RFL_DB.dat", DeviceName[epart], path); - if(!__FileExists(testpath)) + if(!fsop_FileExist(testpath)) { //gprintf("Nandcheck: Mii's not found\n"); haveValidENand = false;