-using the file read/write functions more often

-placed both file explorer and source menu into the home menu
This commit is contained in:
fix94.1 2013-06-30 18:40:49 +00:00
parent 128f426ef7
commit 791a2dc41b
23 changed files with 173 additions and 304 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -334,27 +334,16 @@ s32 Nand::__configwrite(void)
{ {
if(configloaded) if(configloaded)
{ {
__Dec_Enc_TB(); __Dec_Enc_TB();
if(!tbdec) if(!tbdec)
{ {
FILE *f = fopen(cfgpath, "wb"); /* SYSCONF */
if(f) fsop_WriteFile(cfgpath, confbuffer, 0x4000);
{ /* setting.txt */
fwrite(confbuffer, 1, 0x4000, f); fsop_WriteFile(settxtpath, txtbuffer, 0x100);
gprintf("SYSCONF written to:\"%s\"\n", cfgpath);
fclose(f);
}
f = fopen(settxtpath, "wb");
if(f)
{
fwrite(txtbuffer, 1, 0x100, f);
gprintf("setting.txt written to: \"%s\"\n", settxtpath);
fclose(f);
}
configloaded = configloaded ? false : true;
configloaded = !configloaded;
if(!tbdec && !configloaded) if(!tbdec && !configloaded)
return 1; return 1;
} }
@ -829,25 +818,17 @@ void Nand::CreateTitleTMD(dir_discHdr *hdr)
char nandpath[MAX_FAT_PATH]; char nandpath[MAX_FAT_PATH];
snprintf(nandpath, sizeof(nandpath), "%s/title/%08x/%08x/content/title.tmd", FullNANDPath, highTID, lowTID); snprintf(nandpath, sizeof(nandpath), "%s/title/%08x/%08x/content/title.tmd", FullNANDPath, highTID, lowTID);
struct stat filestat; if(fsop_FileExist(nandpath))
if(stat(nandpath, &filestat) == 0)
{ {
free(titleTMD); free(titleTMD);
gprintf("%s Exists!\n", nandpath); gprintf("%s exists!\n", nandpath);
return; return;
} }
gprintf("Creating title TMD: %s\n", nandpath); gprintf("Creating title TMD: %s\n", nandpath);
bool res = fsop_WriteFile(nandpath, titleTMD, tmd_size);
FILE *file = fopen(nandpath, "wb"); if(!res)
if(file) gprintf("Creating title TMD: %s failed\n", nandpath);
{
fwrite(titleTMD, 1, tmd_size, file);
gprintf("Title TMD written to: %s\n", nandpath);
fclose(file);
}
else
gprintf("Creating title TMD: %s failed (%i)\n", nandpath, file);
free(titleTMD); free(titleTMD);
} }

View File

@ -387,7 +387,7 @@ u8 *fsop_ReadFile(const char *path, u32 *size)
return mem; return mem;
} }
bool fsop_WriteFile(const char *path, u8 *mem, u32 size) bool fsop_WriteFile(const char *path, const void *mem, const u32 size)
{ {
if(mem == NULL || size == 0) if(mem == NULL || size == 0)
return false; return false;

View File

@ -20,7 +20,7 @@ bool fsop_CopyFolder(const char *source, const char *target, progress_callback_t
void fsop_deleteFile(const char *source); void fsop_deleteFile(const char *source);
void fsop_deleteFolder(const char *source); void fsop_deleteFolder(const char *source);
u8 *fsop_ReadFile(const char *path, u32 *size); u8 *fsop_ReadFile(const char *path, u32 *size);
bool fsop_WriteFile(const char *path, u8 *mem, u32 size); bool fsop_WriteFile(const char *path, const void *mem, const u32 size);
#endif #endif

View File

@ -112,9 +112,7 @@ void DML_New_SetOptions(const char *GamePath, char *CheatPath, const char *NewCh
void DML_Old_SetOptions(const char *GamePath) void DML_Old_SetOptions(const char *GamePath)
{ {
gprintf("DIOS-MIOS: Launch game '%s' through boot.bin (old method)\n", GamePath); gprintf("DIOS-MIOS: Launch game '%s' through boot.bin (old method)\n", GamePath);
FILE *f = fopen("sd:/games/boot.bin", "wb"); fsop_WriteFile(DML_BOOT_PATH, GamePath, strlen(GamePath)+1);
fwrite(GamePath, 1, strlen(GamePath) + 1, f);
fclose(f);
//Tell DML to boot the game from sd card //Tell DML to boot the game from sd card
*(vu32*)0x80001800 = 0xB002D105; *(vu32*)0x80001800 = 0xB002D105;
@ -160,31 +158,23 @@ static gconfig *DEVO_CONFIG = (gconfig*)0x80000020;
bool DEVO_Installed(const char *path) bool DEVO_Installed(const char *path)
{ {
loader_size = 0;
bool devo = false; bool devo = false;
const char *loader_path = fmt("%s/loader.bin", path); fsop_GetFileSizeBytes(fmt(DEVO_LOADER_PATH, path), &loader_size);
FILE *f = fopen(loader_path, "rb"); if(loader_size > 0x80) //Size should be more than 128b
if(f != NULL)
{ {
fseek(f, 0, SEEK_END); gprintf("Devolution found\n");
if(ftell(f) > 0x80) //Size should be more than 128b devo = true;
{
gprintf("Devolution: Found %s\n", loader_path);
devo = true;
}
rewind(f);
fclose(f);
} }
return devo; return devo;
} }
void DEVO_GetLoader(const char *path) void DEVO_GetLoader(const char *path)
{ {
tmp_buffer = fsop_ReadFile(fmt("%s/loader.bin", path), &loader_size); loader_size = 0;
tmp_buffer = fsop_ReadFile(fmt(DEVO_LOADER_PATH, path), &loader_size);
if(tmp_buffer == NULL) if(tmp_buffer == NULL)
{
gprintf("Devolution: Loader not found!\n"); gprintf("Devolution: Loader not found!\n");
return;
}
} }
void DEVO_SetOptions(const char *isopath, const char *gameID, bool memcard_emu, void DEVO_SetOptions(const char *isopath, const char *gameID, bool memcard_emu,

View File

@ -20,6 +20,8 @@
#include <gccore.h> #include <gccore.h>
// DIOS-MIOS // DIOS-MIOS
#define DML_BOOT_PATH "sd:/games/boot.bin"
typedef struct DML_CFG typedef struct DML_CFG
{ {
u32 Magicbytes; //0xD1050CF6 u32 Magicbytes; //0xD1050CF6
@ -72,6 +74,8 @@ void DML_New_WriteOptions();
// Devolution // Devolution
#define DEVO_LOADER_PATH "%s/loader.bin"
typedef struct global_config typedef struct global_config
{ {
u32 signature; u32 signature;

View File

@ -7,6 +7,7 @@
#include "texture.hpp" #include "texture.hpp"
#include "coverflow.hpp" #include "coverflow.hpp"
#include "fileOps/fileOps.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "pngu.h" #include "pngu.h"
#include "gcvid.h" #include "gcvid.h"
@ -238,37 +239,25 @@ bool STexture::CopyTexture(const TexData &src, TexData &dest)
TexErr STexture::fromImageFile(TexData &dest, const char *filename, u8 f, u32 minMipSize, u32 maxMipSize) TexErr STexture::fromImageFile(TexData &dest, const char *filename, u8 f, u32 minMipSize, u32 maxMipSize)
{ {
Cleanup(dest); Cleanup(dest);
FILE *file = fopen(filename, "rb");
if(file == NULL) u32 fileSize = 0;
u8 *Image = fsop_ReadFile(filename, &fileSize);
if(Image == NULL)
{ {
strncpy((char*)filename+(strlen(filename)-3), "jp", 2); strncpy((char*)filename+(strlen(filename)-3), "jp", 2);
file = fopen(filename, "rb"); Image = fsop_ReadFile(filename, &fileSize);
} }
if(file == NULL) if(Image == NULL)
return TE_ERROR; return TE_ERROR;
fseek(file, 0, SEEK_END);
u32 fileSize = ftell(file);
fseek(file, 0, SEEK_SET);
u8 *Image = NULL;
if(fileSize)
{
Image = (u8*)MEM2_alloc(fileSize);
if(Image != NULL)
fread(Image, 1, fileSize, file);
}
fclose(file);
TexErr result = TE_NOMEM; TexErr result = TE_NOMEM;
if(Image != NULL)
{ if(*(vu32*)Image == 0x89504E47) /* PNG Magic */
if(*(vu32*)Image == 0x89504E47) /* PNG Magic */ result = fromPNG(dest, Image, f, minMipSize, maxMipSize);
result = fromPNG(dest, Image, f, minMipSize, maxMipSize); else
else result = fromJPG(dest, Image, fileSize, f, minMipSize, maxMipSize);
result = fromJPG(dest, Image, fileSize, f, minMipSize, maxMipSize); free(Image);
free(Image);
}
return result; return result;
} }

View File

@ -128,7 +128,7 @@ s32 GCDump::__DiscReadRaw(void *outbuf, u64 offset, u32 length)
} }
} }
wiiLightOff(); wiiLightOff();
return -1; return -1;
} }
s32 GCDump::__DiscWrite(char * path, u64 offset, u32 length, u8 *ReadBuffer) s32 GCDump::__DiscWrite(char * path, u64 offset, u32 length, u8 *ReadBuffer)
@ -431,8 +431,7 @@ s32 GCDump::DumpGame()
u32 correction; u32 correction;
u32 toread; u32 toread;
FILE *f; FILE *f = fopen(gamepath, "wb");
f = fopen(gamepath, "wb");
ret = __DiscWriteFile(f, NextOffset, (FSTOffset + FSTSize), ReadBuffer); ret = __DiscWriteFile(f, NextOffset, (FSTOffset + FSTSize), ReadBuffer);
wrote += (FSTOffset + FSTSize); wrote += (FSTOffset + FSTSize);

View File

@ -30,6 +30,7 @@
#include "nk.h" #include "nk.h"
#include "armboot.h" #include "armboot.h"
#include "fileOps/fileOps.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"
@ -70,29 +71,17 @@ bool neek2o(void)
bool Load_Neek2o_Kernel() bool Load_Neek2o_Kernel()
{ {
bool ret = true;
if(neek2o()) if(neek2o())
return true; return ret;
FILE *file = NULL; Kernel = fsop_ReadFile("usb1:/sneek/kernel.bin", &kernelSize);
file = fopen("usb1:/sneek/kernel.bin", "rb"); if(Kernel == NULL)
if(!file) Kernel = fsop_ReadFile("sd:/sneek/kernel.bin", &kernelSize);
file = fopen("sd:/sneek/kernel.bin", "rb"); if(Kernel == NULL)
if(file) ret = false;
{
fseek(file , 0 , SEEK_END); return ret;
kernelSize = ftell(file);
rewind(file);
Kernel = malloc(kernelSize);
if(!Kernel)
{
fclose(file);
return false;
}
fread(Kernel, 1, kernelSize, file);
fclose(file);
return true;
}
return false;
} }
s32 Launch_nk(u64 TitleID, const char *nandpath, u64 ReturnTo) s32 Launch_nk(u64 TitleID, const char *nandpath, u64 ReturnTo)

View File

@ -13,7 +13,6 @@
#include "banner/BannerWindow.hpp" #include "banner/BannerWindow.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "channel/nand_save.hpp" #include "channel/nand_save.hpp"
#include "fileOps/fileOps.h"
#include "gc/gc.hpp" #include "gc/gc.hpp"
#include "gui/Gekko.h" #include "gui/Gekko.h"
#include "gui/GameTDB.hpp" #include "gui/GameTDB.hpp"
@ -2338,31 +2337,14 @@ void CMenu::_stopSounds(void)
bool CMenu::_loadFile(u8 * &buffer, u32 &size, const char *path, const char *file) bool CMenu::_loadFile(u8 * &buffer, u32 &size, const char *path, const char *file)
{ {
size = 0; u32 fileSize = 0;
FILE *fp = fopen(file == NULL ? path : fmt("%s/%s", path, file), "rb"); u8 *fileBuf = fsop_ReadFile(file == NULL ? path : fmt("%s/%s", path, file), &fileSize);
if (fp == NULL) if(fileBuf == NULL)
return false; return false;
fseek(fp, 0, SEEK_END);
u32 fileSize = ftell(fp);
fseek(fp, 0, SEEK_SET);
u8 *fileBuf = (u8*)MEM2_alloc(fileSize);
if (fileBuf == NULL)
{
fclose(fp);
return false;
}
if (fread(fileBuf, 1, fileSize, fp) != fileSize)
{
fclose(fp);
return false;
}
fclose(fp);
if(buffer != NULL) if(buffer != NULL)
free(buffer); free(buffer);
buffer = fileBuf; buffer = fileBuf;
size = fileSize; size = fileSize;
return true; return true;
} }

View File

@ -12,6 +12,7 @@
#include "channel/channels.h" #include "channel/channels.h"
#include "cheats/gct.h" #include "cheats/gct.h"
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "fileOps/fileOps.h"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"
#include "gecko/wifi_gecko.hpp" #include "gecko/wifi_gecko.hpp"
#include "gui/coverflow.hpp" #include "gui/coverflow.hpp"
@ -150,7 +151,6 @@ private:
TexData m_mainBgLQ; TexData m_mainBgLQ;
//Main Coverflow //Main Coverflow
s16 m_mainBtnConfig; s16 m_mainBtnConfig;
s16 m_mainBtnExplorer;
s16 m_mainBtnInfo; s16 m_mainBtnInfo;
s16 m_mainBtnFavoritesOn; s16 m_mainBtnFavoritesOn;
s16 m_mainBtnFavoritesOff; s16 m_mainBtnFavoritesOff;

View File

@ -16,7 +16,6 @@
****************************************************************************/ ****************************************************************************/
#include "menu.hpp" #include "menu.hpp"
#include "const_str.hpp" #include "const_str.hpp"
#include "fileOps/fileOps.h"
#include "channel/nand_save.hpp" #include "channel/nand_save.hpp"
s16 m_bootLblTitle; s16 m_bootLblTitle;

View File

@ -5,7 +5,6 @@
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "network/http.h" #include "network/http.h"
#include "fileOps/fileOps.h"
#define GECKOURL "http://geckocodes.org/codes/%c/%s.txt" #define GECKOURL "http://geckocodes.org/codes/%c/%s.txt"
#define CHEATSPERPAGE 4 #define CHEATSPERPAGE 4
@ -60,18 +59,11 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<') if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<')
{ {
FILE *file = fopen(fmt("%s/%s.txt", m->m_txtCheatDir.c_str(), id), "wb"); fsop_WriteFile(fmt("%s/%s.txt", m->m_txtCheatDir.c_str(), id), cheatfile.data, cheatfile.size);
free(buffer);
if (file != NULL) m->m_thrdWorking = false;
{ return 0;
fwrite(cheatfile.data, 1, cheatfile.size, file);
fclose(file);
free(buffer);
m->m_thrdWorking = false;
return 0;
}
} }
free(buffer); free(buffer);
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -3; return -3;

View File

@ -16,7 +16,6 @@
****************************************************************************/ ****************************************************************************/
#include "menu.hpp" #include "menu.hpp"
#include "defines.h" #include "defines.h"
#include "fileOps/fileOps.h"
s16 m_coverbnrLblDlCover; s16 m_coverbnrLblDlCover;
s16 m_coverbnrLblDeleteCover; s16 m_coverbnrLblDeleteCover;

View File

@ -9,7 +9,6 @@
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "fileOps/fileOps.h"
#include "gui/GameTDB.hpp" #include "gui/GameTDB.hpp"
#include "gui/pngu.h" #include "gui/pngu.h"
#include "loader/fs.h" #include "loader/fs.h"
@ -365,23 +364,14 @@ static bool checkPNGBuf(u8 *data)
static bool checkPNGFile(const char *filename) static bool checkPNGFile(const char *filename)
{ {
u8 *buffer = NULL; u32 fileSize = 0;
FILE *file = fopen(filename, "rb"); u8 *buffer = fsop_ReadFile(filename, &fileSize);
if(file == NULL) bool ret = false;
return false;
fseek(file, 0, SEEK_END);
u32 fileSize = ftell(file);
fseek(file, 0, SEEK_SET);
if(fileSize > 0)
{
buffer = (u8*)MEM2_alloc(fileSize);
if(buffer != NULL)
fread(buffer, 1, fileSize, file);
}
fclose(file);
bool ret = checkPNGBuf(buffer);
if(buffer != NULL) if(buffer != NULL)
{
ret = checkPNGBuf(buffer);
MEM2_free(buffer); MEM2_free(buffer);
}
return ret; return ret;
} }
@ -537,9 +527,8 @@ int CMenu::_coverDownloader(bool missingOnly)
Config m_newID; Config m_newID;
m_newID.load(fmt("%s/newid.ini", m_settingsDir.c_str())); m_newID.load(fmt("%s/newid.ini", m_settingsDir.c_str()));
m_newID.setString("CHANNELS", "WFSF", "DWFA"); m_newID.setString("CHANNELS", "WFSF", "DWFA");
u32 CoverType = 0;
u32 CoverType = 0;
for(u32 i = 0; i < coverList.size() && !m_thrdStop; ++i) for(u32 i = 0; i < coverList.size() && !m_thrdStop; ++i)
{ {
@ -548,8 +537,6 @@ int CMenu::_coverDownloader(bool missingOnly)
bool success = false; bool success = false;
bool original = true; bool original = true;
bool custom = false; bool custom = false;
FILE *file = NULL;
int c_altCase = 0; int c_altCase = 0;
string newID = m_newID.getString(domain, coverList[i], coverList[i]); string newID = m_newID.getString(domain, coverList[i], coverList[i]);
@ -577,7 +564,7 @@ int CMenu::_coverDownloader(bool missingOnly)
case 3: case 3:
CoverType = m_downloadPrioVal&C_TYPE_PRIOA ? FLAT : CFLAT; CoverType = m_downloadPrioVal&C_TYPE_PRIOA ? FLAT : CFLAT;
break; break;
} }
switch( CoverType ) switch( CoverType )
{ {
@ -651,45 +638,45 @@ int CMenu::_coverDownloader(bool missingOnly)
tdl = true; tdl = true;
} }
break; break;
case NL: case NL:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
{ {
url = makeURL(fmtURLBox[j], newID, "NL"); url = makeURL(fmtURLBox[j], newID, "NL");
tdl = true; tdl = true;
} }
break; break;
case PT: case PT:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
{ {
url = makeURL(fmtURLBox[j], newID, "PT"); url = makeURL(fmtURLBox[j], newID, "PT");
tdl = true; tdl = true;
} }
break; break;
case RU: case RU:
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU) if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
{ {
url = makeURL(fmtURLBox[j], newID, "RU"); url = makeURL(fmtURLBox[j], newID, "RU");
tdl = true; tdl = true;
} }
break; break;
case KO: case KO:
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO) if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
{ {
url = makeURL(fmtURLBox[j], newID, "KO"); url = makeURL(fmtURLBox[j], newID, "KO");
tdl = true; tdl = true;
} }
break; break;
case AU: case AU:
if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN) if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN)
{ {
url = makeURL(fmtURLBox[j], newID, "ZH"); url = makeURL(fmtURLBox[j], newID, "ZH");
tdl = true; tdl = true;
} }
break; break;
case ZHCN: case ZHCN:
break; break;
} }
if ( tdl ) if ( tdl )
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep); _setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
@ -706,14 +693,8 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb"); fsop_WriteFile(path.c_str(), download.data, download.size);
if(file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
}
} }
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
@ -798,46 +779,46 @@ int CMenu::_coverDownloader(bool missingOnly)
tdl = true; tdl = true;
} }
break; break;
case NL: case NL:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
{ {
url = makeURL(fmtURLCBox[j], newID, "NL"); url = makeURL(fmtURLCBox[j], newID, "NL");
tdl = true; tdl = true;
} }
break; break;
case PT: case PT:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
{ {
url = makeURL(fmtURLCBox[j], newID, "PT"); url = makeURL(fmtURLCBox[j], newID, "PT");
tdl = true; tdl = true;
} }
break; break;
case RU: case RU:
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU) if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
{ {
url = makeURL(fmtURLCBox[j], newID, "RU"); url = makeURL(fmtURLCBox[j], newID, "RU");
tdl = true; tdl = true;
} }
break; break;
case KO: case KO:
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO) if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
{ {
url = makeURL(fmtURLCBox[j], newID, "KO"); url = makeURL(fmtURLCBox[j], newID, "KO");
tdl = true; tdl = true;
} }
break; break;
case AU: case AU:
if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN) if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN)
{ {
url = makeURL(fmtURLCBox[j], newID, "ZH"); url = makeURL(fmtURLCBox[j], newID, "ZH");
tdl = true; tdl = true;
} }
break; break;
case ZHCN: case ZHCN:
break; break;
} }
if ( tdl ) if ( tdl )
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep); _setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
@ -854,14 +835,8 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb"); fsop_WriteFile(path.c_str(), download.data, download.size);
if (file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
}
} }
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
@ -946,45 +921,45 @@ int CMenu::_coverDownloader(bool missingOnly)
tdl = true; tdl = true;
} }
break; break;
case NL: case NL:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
{ {
url = makeURL(fmtURLFlat[j], newID, "NL"); url = makeURL(fmtURLFlat[j], newID, "NL");
tdl = true; tdl = true;
} }
break; break;
case PT: case PT:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
{ {
url = makeURL(fmtURLFlat[j], newID, "PT"); url = makeURL(fmtURLFlat[j], newID, "PT");
tdl = true; tdl = true;
} }
break; break;
case RU: case RU:
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU) if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
{ {
url = makeURL(fmtURLFlat[j], newID, "RU"); url = makeURL(fmtURLFlat[j], newID, "RU");
tdl = true; tdl = true;
} }
break; break;
case KO: case KO:
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO) if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
{ {
url = makeURL(fmtURLFlat[j], newID, "KO"); url = makeURL(fmtURLFlat[j], newID, "KO");
tdl = true; tdl = true;
} }
break; break;
case AU: case AU:
if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN) if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN)
{ {
url = makeURL(fmtURLFlat[j], newID, "ZH"); url = makeURL(fmtURLFlat[j], newID, "ZH");
tdl = true; tdl = true;
} }
break; break;
case ZHCN: case ZHCN:
break; break;
} }
if ( tdl ) if ( tdl )
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep); _setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
@ -1001,14 +976,8 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb"); fsop_WriteFile(path.c_str(), download.data, download.size);
if (file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
}
} }
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
@ -1021,7 +990,7 @@ int CMenu::_coverDownloader(bool missingOnly)
} }
} }
break; break;
case CFLAT: case CFLAT:
if( m_downloadPrioVal&C_TYPE_ONCU ) if( m_downloadPrioVal&C_TYPE_ONCU )
custom = true; custom = true;
if (!success && !m_thrdStop && c_gameTDB.IsLoaded() && c_altCase > 1 && custom) if (!success && !m_thrdStop && c_gameTDB.IsLoaded() && c_altCase > 1 && custom)
@ -1043,11 +1012,11 @@ int CMenu::_coverDownloader(bool missingOnly)
{ {
bool tdl = false; bool tdl = false;
if(download.data != NULL && download.size > 0 && checkPNGBuf(download.data)) if(download.data != NULL && download.size > 0 && checkPNGBuf(download.data))
break; break;
switch( o ) switch( o )
{ {
case EN: case EN:
if(( newID[3] == 'E' || newID[3] == 'X' || newID[3] == 'Y' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_EN ) if(( newID[3] == 'E' || newID[3] == 'X' || newID[3] == 'Y' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_EN )
{ {
url = makeURL(fmtURLCFlat[j], newID, "EN"); url = makeURL(fmtURLCFlat[j], newID, "EN");
@ -1089,45 +1058,45 @@ int CMenu::_coverDownloader(bool missingOnly)
tdl = true; tdl = true;
} }
break; break;
case NL: case NL:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
{ {
url = makeURL(fmtURLCFlat[j], newID, "NL"); url = makeURL(fmtURLCFlat[j], newID, "NL");
tdl = true; tdl = true;
} }
break; break;
case PT: case PT:
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT) if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
{ {
url = makeURL(fmtURLCFlat[j], newID, "PT"); url = makeURL(fmtURLCFlat[j], newID, "PT");
tdl = true; tdl = true;
} }
break; break;
case RU: case RU:
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU) if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
{ {
url = makeURL(fmtURLCFlat[j], newID, "RU"); url = makeURL(fmtURLCFlat[j], newID, "RU");
tdl = true; tdl = true;
} }
break; break;
case KO: case KO:
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO) if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
{ {
url = makeURL(fmtURLCFlat[j], newID, "KO"); url = makeURL(fmtURLCFlat[j], newID, "KO");
tdl = true; tdl = true;
} }
break; break;
case AU: case AU:
if((newID[3] == 'P' || newID[3] == 'Y' || newID[3] == 'X') && m_downloadPrioVal&C_TYPE_ZHCN) if((newID[3] == 'P' || newID[3] == 'Y' || newID[3] == 'X') && m_downloadPrioVal&C_TYPE_ZHCN)
{ {
url = makeURL(fmtURLCFlat[j], newID, "ZH"); url = makeURL(fmtURLCFlat[j], newID, "ZH");
tdl = true; tdl = true;
} }
break; break;
case ZHCN: case ZHCN:
break; break;
} }
if ( tdl ) if ( tdl )
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep); _setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
@ -1139,19 +1108,13 @@ int CMenu::_coverDownloader(bool missingOnly)
if(download.data == NULL || download.size == 0 || !checkPNGBuf(download.data)) if(download.data == NULL || download.size == 0 || !checkPNGBuf(download.data))
continue; continue;
if (savePNG) if(savePNG)
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb"); fsop_WriteFile(path.c_str(), download.data, download.size);
if (file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
}
} }
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
@ -1722,14 +1685,11 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
// txt download finished, now save file // txt download finished, now save file
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg13", L"Saving..."), 0.9f); _setThrdMsg(_t("dlmsg13", L"Saving..."), 0.9f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
FILE *file = fopen(m_ver.c_str(), "wb");
if (file != NULL)
{
fwrite(download.data, 1, download.size, file);
fclose(file);
bool res = fsop_WriteFile(m_ver.c_str(), download.data, download.size);
if (res == true)
{
// version file valid, check for version with SVN_REV // version file valid, check for version with SVN_REV
int svnrev = atoi(SVN_REV); int svnrev = atoi(SVN_REV);
gprintf("Installed Version: %d\n", svnrev); gprintf("Installed Version: %d\n", svnrev);
@ -1757,7 +1717,6 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
_setThrdMsg(_t("dlmsg15", L"Saving failed!"), 1.f); _setThrdMsg(_t("dlmsg15", L"Saving failed!"), 1.f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
} }
} }
} }
m_thrdWorking = false; m_thrdWorking = false;
@ -1774,6 +1733,7 @@ s8 CMenu::_versionDownloaderInit(CMenu *m) //Handler to download new dol
s8 CMenu::_versionDownloader() // code to download new version s8 CMenu::_versionDownloader() // code to download new version
{ {
bool result = false;
char dol_backup[33]; char dol_backup[33];
strcpy(dol_backup, m_dol.c_str()); strcpy(dol_backup, m_dol.c_str());
strcat(dol_backup, ".backup"); strcat(dol_backup, ".backup");
@ -1857,25 +1817,21 @@ s8 CMenu::_versionDownloader() // code to download new version
// download finished, backup boot.dol and write new files. // download finished, backup boot.dol and write new files.
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg13", L"Saving..."), 0.8f); _setThrdMsg(_t("dlmsg13", L"Saving..."), 0.8f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
fsop_deleteFile(dol_backup); fsop_deleteFile(dol_backup);
rename(m_dol.c_str(), dol_backup); rename(m_dol.c_str(), dol_backup);
fsop_deleteFile(m_app_update_zip.c_str()); fsop_deleteFile(m_app_update_zip.c_str());
result = fsop_WriteFile(m_app_update_zip.c_str(), download.data, download.size);
FILE *file = fopen(m_app_update_zip.c_str(), "wb"); if (result == true)
if (file != NULL)
{ {
fwrite(download.data, 1, download.size, file);
fclose(file);
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f); _setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
ZipFile zFile(m_app_update_zip.c_str()); ZipFile zFile(m_app_update_zip.c_str());
bool result = zFile.ExtractAll(m_app_update_drive); result = zFile.ExtractAll(m_app_update_drive);
fsop_deleteFile(m_app_update_zip.c_str()); fsop_deleteFile(m_app_update_zip.c_str());
if (!result) if (!result)
@ -1906,13 +1862,9 @@ s8 CMenu::_versionDownloader() // code to download new version
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
fsop_deleteFile(m_data_update_zip.c_str()); fsop_deleteFile(m_data_update_zip.c_str());
result = fsop_WriteFile(m_data_update_zip.c_str(), download.data, download.size);
file = fopen(m_data_update_zip.c_str(), "wb"); if (result == true)
if (file != NULL)
{ {
fwrite(download.data, 1, download.size, file);
fclose(file);
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f); _setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
@ -2016,8 +1968,8 @@ int CMenu::_gametdbDownloaderAsync()
fsop_deleteFile(zippath.c_str()); fsop_deleteFile(zippath.c_str());
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip"), 1.f); _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip"), 1.f);
FILE *file = fopen(zippath.c_str(), "wb"); bool res = fsop_WriteFile(zippath.c_str(), download.data, download.size);
if (file == NULL) if (res == false)
{ {
gprintf("Can't save zip file\n"); gprintf("Can't save zip file\n");
@ -2027,27 +1979,22 @@ int CMenu::_gametdbDownloaderAsync()
} }
else else
{ {
fwrite(download.data, download.size, 1, file);
fclose(file);
gprintf("Extracting zip file: "); gprintf("Extracting zip file: ");
ZipFile zFile(zippath.c_str()); ZipFile zFile(zippath.c_str());
bool zres = zFile.ExtractAll(m_settingsDir.c_str()); bool zres = zFile.ExtractAll(m_settingsDir.c_str());
gprintf(zres ? "success\n" : "failed\n"); gprintf(zres ? "success\n" : "failed\n");
// We don't need the zipfile anymore // We don't need the zipfile anymore
fsop_deleteFile(zippath.c_str()); fsop_deleteFile(zippath.c_str());
// We should always remove the offsets file to make sure it's reloaded // We should always remove the offsets file to make sure it's reloaded
string offsetspath = fmt("%s/gametdb_offsets.bin", m_settingsDir.c_str()); fsop_deleteFile(fmt("%s/gametdb_offsets.bin", m_settingsDir.c_str()));
fsop_deleteFile(offsetspath.c_str());
// Update cache // Update cache
//m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str()); //m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
UpdateCache(); UpdateCache();
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg26", L"Updating cache..."), 0.f); _setThrdMsg(_t("dlmsg26", L"Updating cache..."), 0.f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
@ -2099,17 +2046,11 @@ u32 CMenu::_downloadBannerAsync(void *obj)
/* minimum 50kb */ /* minimum 50kb */
if (banner.data != NULL && banner.size > 51200 && banner.data[0] != '<') if (banner.data != NULL && banner.size > 51200 && banner.data[0] != '<')
{ {
FILE *file = fopen(banner_location, "wb"); fsop_WriteFile(banner_location, banner.data, banner.size);
if(file != NULL) free(buffer);
{ m->m_thrdWorking = false;
fwrite(banner.data, 1, banner.size, file); return 0;
fclose(file);
free(buffer);
m->m_thrdWorking = false;
return 0;
}
} }
free(buffer); free(buffer);
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -3; return -3;

View File

@ -18,7 +18,6 @@
#include <unistd.h> #include <unistd.h>
#include "menu.hpp" #include "menu.hpp"
#include "defines.h" #include "defines.h"
#include "fileOps/fileOps.h"
extern const u8 blank_png[]; extern const u8 blank_png[];

View File

@ -17,7 +17,6 @@
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "devicemounter/sdhc.h" #include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "fileOps/fileOps.h"
#include "gc/gc.hpp" #include "gc/gc.hpp"
#include "gc/gcdisc.hpp" #include "gc/gcdisc.hpp"
#include "gui/WiiMovie.hpp" #include "gui/WiiMovie.hpp"

View File

@ -10,9 +10,12 @@ s16 m_exittoLblTitle;
s16 m_homeBtnSettings; s16 m_homeBtnSettings;
s16 m_homeBtnReloadCache; s16 m_homeBtnReloadCache;
s16 m_homeBtnUpdate; s16 m_homeBtnUpdate;
s16 m_homeBtnExplorer;
s16 m_homeBtnInstall; s16 m_homeBtnInstall;
s16 m_homeBtnAbout; s16 m_homeBtnAbout;
s16 m_homeBtnExitTo; s16 m_homeBtnExitTo;
s16 m_homeBtnSource;
s16 m_homeBtnExitToHBC; s16 m_homeBtnExitToHBC;
s16 m_homeBtnExitToMenu; s16 m_homeBtnExitToMenu;
@ -93,6 +96,22 @@ bool CMenu::_Home(void)
_ExitTo(); _ExitTo();
_showHome(); _showHome();
} }
else if(m_btnMgr.selected(m_homeBtnExplorer))
{
_hideHome();
_Explorer();
_showHome();
}
else if(m_btnMgr.selected(m_homeBtnSource))
{
_hideHome();
if(!_Source()) //Different source selected
{
LoadView();
break;
}
_showHome();
}
} }
else if(BTN_HOME_PRESSED) else if(BTN_HOME_PRESSED)
{ {
@ -175,9 +194,12 @@ void CMenu::_showHome(void)
m_btnMgr.show(m_homeBtnSettings); m_btnMgr.show(m_homeBtnSettings);
m_btnMgr.show(m_homeBtnReloadCache); m_btnMgr.show(m_homeBtnReloadCache);
m_btnMgr.show(m_homeBtnUpdate); m_btnMgr.show(m_homeBtnUpdate);
m_btnMgr.show(m_homeBtnExplorer);
m_btnMgr.show(m_homeBtnInstall); m_btnMgr.show(m_homeBtnInstall);
m_btnMgr.show(m_homeBtnAbout); m_btnMgr.show(m_homeBtnAbout);
m_btnMgr.show(m_homeBtnExitTo); m_btnMgr.show(m_homeBtnExitTo);
m_btnMgr.show(m_homeBtnSource);
m_btnMgr.show(m_homeLblBattery); m_btnMgr.show(m_homeLblBattery);
} }
@ -201,9 +223,12 @@ void CMenu::_hideHome(bool instant)
m_btnMgr.hide(m_homeBtnSettings, instant); m_btnMgr.hide(m_homeBtnSettings, instant);
m_btnMgr.hide(m_homeBtnReloadCache, instant); m_btnMgr.hide(m_homeBtnReloadCache, instant);
m_btnMgr.hide(m_homeBtnUpdate, instant); m_btnMgr.hide(m_homeBtnUpdate, instant);
m_btnMgr.hide(m_homeBtnExplorer, instant);
m_btnMgr.hide(m_homeBtnInstall, instant); m_btnMgr.hide(m_homeBtnInstall, instant);
m_btnMgr.hide(m_homeBtnAbout, instant); m_btnMgr.hide(m_homeBtnAbout, instant);
m_btnMgr.hide(m_homeBtnExitTo, instant); m_btnMgr.hide(m_homeBtnExitTo, instant);
m_btnMgr.hide(m_homeBtnSource, instant);
m_btnMgr.hide(m_homeLblBattery, instant); m_btnMgr.hide(m_homeLblBattery, instant);
} }
@ -228,20 +253,28 @@ void CMenu::_initHomeAndExitToMenu()
_setHideAnim(m_homeLblTitle, "HOME/TITLE", 0, 0, -2.f, 0.f); _setHideAnim(m_homeLblTitle, "HOME/TITLE", 0, 0, -2.f, 0.f);
m_homeBtnSettings = _addButton("HOME/SETTINGS", theme.btnFont, L"", 60, 120, 250, 56, theme.btnFontColor); m_homeBtnSettings = _addButton("HOME/SETTINGS", theme.btnFont, L"", 60, 100, 250, 56, theme.btnFontColor);
m_homeBtnReloadCache = _addButton("HOME/RELOAD_CACHE", theme.btnFont, L"", 60, 230, 250, 56, theme.btnFontColor); m_homeBtnReloadCache = _addButton("HOME/RELOAD_CACHE", theme.btnFont, L"", 60, 180, 250, 56, theme.btnFontColor);
m_homeBtnUpdate = _addButton("HOME/UPDATE", theme.btnFont, L"", 60, 340, 250, 56, theme.btnFontColor); m_homeBtnUpdate = _addButton("HOME/UPDATE", theme.btnFont, L"", 60, 260, 250, 56, theme.btnFontColor);
m_homeBtnInstall = _addButton("HOME/INSTALL", theme.btnFont, L"", 330, 120, 250, 56, theme.btnFontColor); m_homeBtnExplorer = _addButton("HOME/EXPLORER", theme.btnFont, L"", 60, 340, 250, 56, theme.btnFontColor);
m_homeBtnAbout = _addButton("HOME/ABOUT", theme.btnFont, L"", 330, 230, 250, 56, theme.btnFontColor);
m_homeBtnExitTo = _addButton("HOME/EXIT_TO", theme.btnFont, L"", 330, 340, 250, 56, theme.btnFontColor); m_homeBtnInstall = _addButton("HOME/INSTALL", theme.btnFont, L"", 330, 100, 250, 56, theme.btnFontColor);
m_homeBtnAbout = _addButton("HOME/ABOUT", theme.btnFont, L"", 330, 180, 250, 56, theme.btnFontColor);
m_homeBtnExitTo = _addButton("HOME/EXIT_TO", theme.btnFont, L"", 330, 260, 250, 56, theme.btnFontColor);
m_homeBtnSource = _addButton("HOME/SOURCE", theme.btnFont, L"", 330, 340, 250, 56, theme.btnFontColor);
m_homeLblBattery = _addLabel("HOME/BATTERY", theme.btnFont, L"", 0, 420, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); m_homeLblBattery = _addLabel("HOME/BATTERY", theme.btnFont, L"", 0, 420, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
_setHideAnim(m_homeBtnSettings, "HOME/SETTINGS", 0, 0, -2.f, 0.f); _setHideAnim(m_homeBtnSettings, "HOME/SETTINGS", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnReloadCache, "HOME/RELOAD_CACHE", 0, 0, -2.f, 0.f); _setHideAnim(m_homeBtnReloadCache, "HOME/RELOAD_CACHE", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnUpdate, "HOME/UPDATE", 0, 0, -2.f, 0.f); _setHideAnim(m_homeBtnUpdate, "HOME/UPDATE", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnExplorer, "HOME/EXPLORER", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnInstall, "HOME/INSTALL", 0, 0, -2.f, 0.f); _setHideAnim(m_homeBtnInstall, "HOME/INSTALL", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnAbout, "HOME/ABOUT", 0, 0, -2.f, 0.f); _setHideAnim(m_homeBtnAbout, "HOME/ABOUT", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnExitTo, "HOME/EXIT_TO", 0, 0, -2.f, 0.f); _setHideAnim(m_homeBtnExitTo, "HOME/EXIT_TO", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnSource, "HOME/SOURCE", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeLblBattery, "HOME/BATTERY", 0, 0, -2.f, 0.f); _setHideAnim(m_homeLblBattery, "HOME/BATTERY", 0, 0, -2.f, 0.f);
_textHome(); _textHome();
@ -273,9 +306,12 @@ void CMenu::_textHome(void)
m_btnMgr.setText(m_homeBtnSettings, _t("home1", L"Settings")); m_btnMgr.setText(m_homeBtnSettings, _t("home1", L"Settings"));
m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache")); m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache"));
m_btnMgr.setText(m_homeBtnUpdate, _t("home3", L"Update")); m_btnMgr.setText(m_homeBtnUpdate, _t("home3", L"Update"));
m_btnMgr.setText(m_homeBtnExplorer, _t("home8", L"File Explorer"));
m_btnMgr.setText(m_homeBtnInstall, _t("home7", L"Install Game")); m_btnMgr.setText(m_homeBtnInstall, _t("home7", L"Install Game"));
m_btnMgr.setText(m_homeBtnAbout, _t("home4", L"Credits")); m_btnMgr.setText(m_homeBtnAbout, _t("home4", L"Credits"));
m_btnMgr.setText(m_homeBtnExitTo, _t("home5", L"Exit To")); m_btnMgr.setText(m_homeBtnExitTo, _t("home5", L"Exit To"));
m_btnMgr.setText(m_homeBtnSource, _t("home9", L"Source Menu"));
} }
void CMenu::_textExitTo(void) void CMenu::_textExitTo(void)

View File

@ -53,7 +53,6 @@ void CMenu::_hideMain(bool instant)
m_btnMgr.hide(m_mainBtnNext, instant); m_btnMgr.hide(m_mainBtnNext, instant);
m_btnMgr.hide(m_mainBtnPrev, instant); m_btnMgr.hide(m_mainBtnPrev, instant);
m_btnMgr.hide(m_mainBtnConfig, instant); m_btnMgr.hide(m_mainBtnConfig, instant);
m_btnMgr.hide(m_mainBtnExplorer, instant);
m_btnMgr.hide(m_mainBtnInfo, instant); m_btnMgr.hide(m_mainBtnInfo, instant);
m_btnMgr.hide(m_mainBtnQuit, instant); m_btnMgr.hide(m_mainBtnQuit, instant);
m_btnMgr.hide(m_mainBtnHomebrew, instant); m_btnMgr.hide(m_mainBtnHomebrew, instant);
@ -91,7 +90,6 @@ void CMenu::_showMain(void)
_setBg(m_gameBg, m_gameBgLQ); _setBg(m_gameBg, m_gameBgLQ);
m_btnMgr.show(m_mainBtnInfo); m_btnMgr.show(m_mainBtnInfo);
m_btnMgr.show(m_mainBtnConfig); m_btnMgr.show(m_mainBtnConfig);
m_btnMgr.show(m_mainBtnExplorer);
m_btnMgr.show(m_mainBtnQuit); m_btnMgr.show(m_mainBtnQuit);
switch(m_current_view) switch(m_current_view)
@ -449,14 +447,6 @@ int CMenu::main(void)
if(BTN_B_HELD) if(BTN_B_HELD)
bUsed = true; bUsed = true;
} }
else if(m_btnMgr.selected(m_mainBtnExplorer))
{
_hideMain();
_Explorer();
_showMain();
if(BTN_B_HELD)
bUsed = true;
}
else if(m_btnMgr.selected(m_mainBtnInfo)) else if(m_btnMgr.selected(m_mainBtnInfo))
{ {
_hideMain(); _hideMain();
@ -752,7 +742,6 @@ int CMenu::main(void)
m_btnMgr.show(m_mainLblUser[1]); m_btnMgr.show(m_mainLblUser[1]);
m_btnMgr.show(m_mainBtnInfo); m_btnMgr.show(m_mainBtnInfo);
m_btnMgr.show(m_mainBtnConfig); m_btnMgr.show(m_mainBtnConfig);
m_btnMgr.show(m_mainBtnExplorer);
m_btnMgr.show(m_mainBtnQuit); m_btnMgr.show(m_mainBtnQuit);
static bool change = m_favorites; static bool change = m_favorites;
m_btnMgr.show(m_favorites ? m_mainBtnFavoritesOn : m_mainBtnFavoritesOff, change != m_favorites); m_btnMgr.show(m_favorites ? m_mainBtnFavoritesOn : m_mainBtnFavoritesOff, change != m_favorites);
@ -765,7 +754,6 @@ int CMenu::main(void)
m_btnMgr.hide(m_mainLblUser[1]); m_btnMgr.hide(m_mainLblUser[1]);
if(!m_gameList.empty()) if(!m_gameList.empty())
m_btnMgr.hide(m_mainBtnConfig); m_btnMgr.hide(m_mainBtnConfig);
m_btnMgr.hide(m_mainBtnExplorer);
m_btnMgr.hide(m_mainBtnInfo); m_btnMgr.hide(m_mainBtnInfo);
m_btnMgr.hide(m_mainBtnQuit); m_btnMgr.hide(m_mainBtnQuit);
m_btnMgr.hide(m_mainBtnFavoritesOn); m_btnMgr.hide(m_mainBtnFavoritesOn);
@ -942,7 +930,6 @@ void CMenu::_initMainMenu()
m_mainBtnInfo = _addPicButton("MAIN/INFO_BTN", texInfo, texInfoS, 20, 400, 48, 48); m_mainBtnInfo = _addPicButton("MAIN/INFO_BTN", texInfo, texInfoS, 20, 400, 48, 48);
m_mainBtnConfig = _addPicButton("MAIN/CONFIG_BTN", texConfig, texConfigS, 70, 400, 48, 48); m_mainBtnConfig = _addPicButton("MAIN/CONFIG_BTN", texConfig, texConfigS, 70, 400, 48, 48);
m_mainBtnExplorer = _addPicButton("MAIN/EXPLORER_BTN", texEmu, texEmus, 120, 400, 48, 48);
m_mainBtnQuit = _addPicButton("MAIN/QUIT_BTN", texQuit, texQuitS, 570, 400, 48, 48); m_mainBtnQuit = _addPicButton("MAIN/QUIT_BTN", texQuit, texQuitS, 570, 400, 48, 48);
m_mainBtnChannel = _addPicButton("MAIN/CHANNEL_BTN", texChannel, texChannels, 520, 400, 48, 48); m_mainBtnChannel = _addPicButton("MAIN/CHANNEL_BTN", texChannel, texChannels, 520, 400, 48, 48);
m_mainBtnHomebrew = _addPicButton("MAIN/HOMEBREW_BTN", texHomebrew, texHomebrews, 520, 400, 48, 48); m_mainBtnHomebrew = _addPicButton("MAIN/HOMEBREW_BTN", texHomebrew, texHomebrews, 520, 400, 48, 48);
@ -998,7 +985,6 @@ void CMenu::_initMainMenu()
_setHideAnim(m_mainBtnNext, "MAIN/NEXT_BTN", 0, 0, 0.f, 0.f); _setHideAnim(m_mainBtnNext, "MAIN/NEXT_BTN", 0, 0, 0.f, 0.f);
_setHideAnim(m_mainBtnPrev, "MAIN/PREV_BTN", 0, 0, 0.f, 0.f); _setHideAnim(m_mainBtnPrev, "MAIN/PREV_BTN", 0, 0, 0.f, 0.f);
_setHideAnim(m_mainBtnConfig, "MAIN/CONFIG_BTN", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnConfig, "MAIN/CONFIG_BTN", 0, 40, 0.f, 0.f);
_setHideAnim(m_mainBtnExplorer, "MAIN/EXPLORER_BTN", 0, 40, 0.f, 0.f);
_setHideAnim(m_mainBtnInfo, "MAIN/INFO_BTN", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnInfo, "MAIN/INFO_BTN", 0, 40, 0.f, 0.f);
_setHideAnim(m_mainBtnQuit, "MAIN/QUIT_BTN", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnQuit, "MAIN/QUIT_BTN", 0, 40, 0.f, 0.f);
_setHideAnim(m_mainBtnChannel, "MAIN/CHANNEL_BTN", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnChannel, "MAIN/CHANNEL_BTN", 0, 40, 0.f, 0.f);

View File

@ -5,7 +5,6 @@
#include "defines.h" #include "defines.h"
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "fileOps/fileOps.h"
#include "loader/cios.h" #include "loader/cios.h"
#include "loader/nk.h" #include "loader/nk.h"

View File

@ -4,7 +4,6 @@
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "gc/gc.hpp" #include "gc/gc.hpp"
#include "fileOps/fileOps.h"
#include "loader/wbfs.h" #include "loader/wbfs.h"
#include "loader/wdvd.h" #include "loader/wdvd.h"
#include "loader/gc_disc_dump.hpp" #include "loader/gc_disc_dump.hpp"

View File

@ -21,6 +21,7 @@
#include <malloc.h> #include <malloc.h>
#include <algorithm> #include <algorithm>
#include "plugin.hpp" #include "plugin.hpp"
#include "fileOps/fileOps.h"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"
#include "devicemounter/PartitionHandle.h" #include "devicemounter/PartitionHandle.h"
@ -77,17 +78,9 @@ bool Plugin::AddPlugin(Config &plugin)
NewPlugin.consoleCoverID = plugin.getString(PLUGIN_INI_DEF,"consoleCoverID"); NewPlugin.consoleCoverID = plugin.getString(PLUGIN_INI_DEF,"consoleCoverID");
const char *bannerfilepath = fmt("%s/%s", pluginsDir.c_str(), plugin.getString(PLUGIN_INI_DEF,"bannerSound").c_str()); const char *bannerfilepath = fmt("%s/%s", pluginsDir.c_str(), plugin.getString(PLUGIN_INI_DEF,"bannerSound").c_str());
FILE *fp = fopen(bannerfilepath, "rb"); fsop_GetFileSizeBytes(bannerfilepath, &NewPlugin.BannerSoundSize);
if(fp != NULL) if(NewPlugin.BannerSoundSize > 0)
{
fseek(fp, 0, SEEK_END);
NewPlugin.BannerSound = string(bannerfilepath); NewPlugin.BannerSound = string(bannerfilepath);
NewPlugin.BannerSoundSize = ftell(fp);
rewind(fp);
fclose(fp);
}
else
NewPlugin.BannerSoundSize = 0;
Plugins.push_back(NewPlugin); Plugins.push_back(NewPlugin);
return false; return false;
} }
@ -106,15 +99,8 @@ u8* Plugin::GetBannerSound(u32 magic)
{ {
if((Plugin_Pos = GetPluginPosition(magic)) >= 0) if((Plugin_Pos = GetPluginPosition(magic)) >= 0)
{ {
u8 *FileReadBuffer = NULL; u32 size = 0;
FILE *fp = fopen(Plugins[Plugin_Pos].BannerSound.c_str(), "rb"); return fsop_ReadFile(Plugins[Plugin_Pos].BannerSound.c_str(), &size);
if(fp)
{
FileReadBuffer = (u8*)MEM2_alloc(Plugins[Plugin_Pos].BannerSoundSize);
fread(FileReadBuffer, 1, Plugins[Plugin_Pos].BannerSoundSize, fp);
fclose(fp);
}
return FileReadBuffer;
} }
return NULL; return NULL;
} }