-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

@ -338,23 +338,12 @@ s32 Nand::__configwrite(void)
if(!tbdec)
{
FILE *f = fopen(cfgpath, "wb");
if(f)
{
fwrite(confbuffer, 1, 0x4000, f);
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;
/* SYSCONF */
fsop_WriteFile(cfgpath, confbuffer, 0x4000);
/* setting.txt */
fsop_WriteFile(settxtpath, txtbuffer, 0x100);
configloaded = !configloaded;
if(!tbdec && !configloaded)
return 1;
}
@ -829,25 +818,17 @@ void Nand::CreateTitleTMD(dir_discHdr *hdr)
char nandpath[MAX_FAT_PATH];
snprintf(nandpath, sizeof(nandpath), "%s/title/%08x/%08x/content/title.tmd", FullNANDPath, highTID, lowTID);
struct stat filestat;
if(stat(nandpath, &filestat) == 0)
if(fsop_FileExist(nandpath))
{
free(titleTMD);
gprintf("%s Exists!\n", nandpath);
gprintf("%s exists!\n", nandpath);
return;
}
gprintf("Creating title TMD: %s\n", nandpath);
FILE *file = fopen(nandpath, "wb");
if(file)
{
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);
bool res = fsop_WriteFile(nandpath, titleTMD, tmd_size);
if(!res)
gprintf("Creating title TMD: %s failed\n", nandpath);
free(titleTMD);
}

View File

@ -387,7 +387,7 @@ u8 *fsop_ReadFile(const char *path, u32 *size)
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)
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_deleteFolder(const char *source);
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

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

View File

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

View File

@ -7,6 +7,7 @@
#include "texture.hpp"
#include "coverflow.hpp"
#include "fileOps/fileOps.h"
#include "memory/mem2.hpp"
#include "pngu.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)
{
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);
file = fopen(filename, "rb");
Image = fsop_ReadFile(filename, &fileSize);
}
if(file == NULL)
if(Image == NULL)
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;
if(Image != NULL)
{
if(*(vu32*)Image == 0x89504E47) /* PNG Magic */
result = fromPNG(dest, Image, f, minMipSize, maxMipSize);
else
result = fromJPG(dest, Image, fileSize, f, minMipSize, maxMipSize);
free(Image);
}
return result;
}

View File

@ -431,8 +431,7 @@ s32 GCDump::DumpGame()
u32 correction;
u32 toread;
FILE *f;
f = fopen(gamepath, "wb");
FILE *f = fopen(gamepath, "wb");
ret = __DiscWriteFile(f, NextOffset, (FSTOffset + FSTSize), ReadBuffer);
wrote += (FSTOffset + FSTSize);

View File

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

View File

@ -13,7 +13,6 @@
#include "banner/BannerWindow.hpp"
#include "channel/nand.hpp"
#include "channel/nand_save.hpp"
#include "fileOps/fileOps.h"
#include "gc/gc.hpp"
#include "gui/Gekko.h"
#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)
{
size = 0;
FILE *fp = fopen(file == NULL ? path : fmt("%s/%s", path, file), "rb");
if (fp == NULL)
u32 fileSize = 0;
u8 *fileBuf = fsop_ReadFile(file == NULL ? path : fmt("%s/%s", path, file), &fileSize);
if(fileBuf == NULL)
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)
free(buffer);
buffer = fileBuf;
size = fileSize;
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,6 @@
#include "lockMutex.hpp"
#include "channel/nand.hpp"
#include "devicemounter/usbstorage.h"
#include "fileOps/fileOps.h"
#include "gui/GameTDB.hpp"
#include "gui/pngu.h"
#include "loader/fs.h"
@ -365,23 +364,14 @@ static bool checkPNGBuf(u8 *data)
static bool checkPNGFile(const char *filename)
{
u8 *buffer = NULL;
FILE *file = fopen(filename, "rb");
if(file == NULL)
return false;
fseek(file, 0, SEEK_END);
u32 fileSize = ftell(file);
fseek(file, 0, SEEK_SET);
if(fileSize > 0)
u32 fileSize = 0;
u8 *buffer = fsop_ReadFile(filename, &fileSize);
bool ret = false;
if(buffer != NULL)
{
buffer = (u8*)MEM2_alloc(fileSize);
if(buffer != NULL)
fread(buffer, 1, fileSize, file);
}
fclose(file);
bool ret = checkPNGBuf(buffer);
if(buffer != NULL)
ret = checkPNGBuf(buffer);
MEM2_free(buffer);
}
return ret;
}
@ -538,7 +528,6 @@ int CMenu::_coverDownloader(bool missingOnly)
Config m_newID;
m_newID.load(fmt("%s/newid.ini", m_settingsDir.c_str()));
m_newID.setString("CHANNELS", "WFSF", "DWFA");
u32 CoverType = 0;
for(u32 i = 0; i < coverList.size() && !m_thrdStop; ++i)
@ -548,8 +537,6 @@ int CMenu::_coverDownloader(bool missingOnly)
bool success = false;
bool original = true;
bool custom = false;
FILE *file = NULL;
int c_altCase = 0;
string newID = m_newID.getString(domain, coverList[i], coverList[i]);
@ -706,14 +693,8 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb");
if(file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
fsop_WriteFile(path.c_str(), download.data, download.size);
}
}
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);
LWP_MutexUnlock(m_mutex);
@ -854,14 +835,8 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb");
if (file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
fsop_WriteFile(path.c_str(), download.data, download.size);
}
}
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);
LWP_MutexUnlock(m_mutex);
@ -1001,14 +976,8 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb");
if (file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
fsop_WriteFile(path.c_str(), download.data, download.size);
}
}
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);
LWP_MutexUnlock(m_mutex);
@ -1139,19 +1108,13 @@ int CMenu::_coverDownloader(bool missingOnly)
if(download.data == NULL || download.size == 0 || !checkPNGBuf(download.data))
continue;
if (savePNG)
if(savePNG)
{
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
file = fopen(path.c_str(), "wb");
if (file != NULL)
{
fwrite(download.data, download.size, 1, file);
fclose(file);
fsop_WriteFile(path.c_str(), download.data, download.size);
}
}
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);
LWP_MutexUnlock(m_mutex);
@ -1724,12 +1687,9 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
_setThrdMsg(_t("dlmsg13", L"Saving..."), 0.9f);
LWP_MutexUnlock(m_mutex);
FILE *file = fopen(m_ver.c_str(), "wb");
if (file != NULL)
bool res = fsop_WriteFile(m_ver.c_str(), download.data, download.size);
if (res == true)
{
fwrite(download.data, 1, download.size, file);
fclose(file);
// version file valid, check for version with SVN_REV
int svnrev = atoi(SVN_REV);
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);
LWP_MutexUnlock(m_mutex);
}
}
}
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
{
bool result = false;
char dol_backup[33];
strcpy(dol_backup, m_dol.c_str());
strcat(dol_backup, ".backup");
@ -1863,19 +1823,15 @@ s8 CMenu::_versionDownloader() // code to download new version
rename(m_dol.c_str(), dol_backup);
fsop_deleteFile(m_app_update_zip.c_str());
FILE *file = fopen(m_app_update_zip.c_str(), "wb");
if (file != NULL)
result = fsop_WriteFile(m_app_update_zip.c_str(), download.data, download.size);
if (result == true)
{
fwrite(download.data, 1, download.size, file);
fclose(file);
LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f);
LWP_MutexUnlock(m_mutex);
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());
if (!result)
@ -1906,13 +1862,9 @@ s8 CMenu::_versionDownloader() // code to download new version
LWP_MutexUnlock(m_mutex);
fsop_deleteFile(m_data_update_zip.c_str());
file = fopen(m_data_update_zip.c_str(), "wb");
if (file != NULL)
result = fsop_WriteFile(m_data_update_zip.c_str(), download.data, download.size);
if (result == true)
{
fwrite(download.data, 1, download.size, file);
fclose(file);
LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f);
LWP_MutexUnlock(m_mutex);
@ -2016,8 +1968,8 @@ int CMenu::_gametdbDownloaderAsync()
fsop_deleteFile(zippath.c_str());
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip"), 1.f);
FILE *file = fopen(zippath.c_str(), "wb");
if (file == NULL)
bool res = fsop_WriteFile(zippath.c_str(), download.data, download.size);
if (res == false)
{
gprintf("Can't save zip file\n");
@ -2027,22 +1979,17 @@ int CMenu::_gametdbDownloaderAsync()
}
else
{
fwrite(download.data, download.size, 1, file);
fclose(file);
gprintf("Extracting zip file: ");
ZipFile zFile(zippath.c_str());
bool zres = zFile.ExtractAll(m_settingsDir.c_str());
gprintf(zres ? "success\n" : "failed\n");
// We don't need the zipfile anymore
fsop_deleteFile(zippath.c_str());
// 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(offsetspath.c_str());
fsop_deleteFile(fmt("%s/gametdb_offsets.bin", m_settingsDir.c_str()));
// Update cache
//m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
@ -2099,17 +2046,11 @@ u32 CMenu::_downloadBannerAsync(void *obj)
/* minimum 50kb */
if (banner.data != NULL && banner.size > 51200 && banner.data[0] != '<')
{
FILE *file = fopen(banner_location, "wb");
if(file != NULL)
{
fwrite(banner.data, 1, banner.size, file);
fclose(file);
fsop_WriteFile(banner_location, banner.data, banner.size);
free(buffer);
m->m_thrdWorking = false;
return 0;
}
}
free(buffer);
m->m_thrdWorking = false;
return -3;

View File

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

View File

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

View File

@ -10,9 +10,12 @@ s16 m_exittoLblTitle;
s16 m_homeBtnSettings;
s16 m_homeBtnReloadCache;
s16 m_homeBtnUpdate;
s16 m_homeBtnExplorer;
s16 m_homeBtnInstall;
s16 m_homeBtnAbout;
s16 m_homeBtnExitTo;
s16 m_homeBtnSource;
s16 m_homeBtnExitToHBC;
s16 m_homeBtnExitToMenu;
@ -93,6 +96,22 @@ bool CMenu::_Home(void)
_ExitTo();
_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)
{
@ -175,9 +194,12 @@ void CMenu::_showHome(void)
m_btnMgr.show(m_homeBtnSettings);
m_btnMgr.show(m_homeBtnReloadCache);
m_btnMgr.show(m_homeBtnUpdate);
m_btnMgr.show(m_homeBtnExplorer);
m_btnMgr.show(m_homeBtnInstall);
m_btnMgr.show(m_homeBtnAbout);
m_btnMgr.show(m_homeBtnExitTo);
m_btnMgr.show(m_homeBtnSource);
m_btnMgr.show(m_homeLblBattery);
}
@ -201,9 +223,12 @@ void CMenu::_hideHome(bool instant)
m_btnMgr.hide(m_homeBtnSettings, instant);
m_btnMgr.hide(m_homeBtnReloadCache, instant);
m_btnMgr.hide(m_homeBtnUpdate, instant);
m_btnMgr.hide(m_homeBtnExplorer, instant);
m_btnMgr.hide(m_homeBtnInstall, instant);
m_btnMgr.hide(m_homeBtnAbout, instant);
m_btnMgr.hide(m_homeBtnExitTo, instant);
m_btnMgr.hide(m_homeBtnSource, 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);
m_homeBtnSettings = _addButton("HOME/SETTINGS", theme.btnFont, L"", 60, 120, 250, 56, theme.btnFontColor);
m_homeBtnReloadCache = _addButton("HOME/RELOAD_CACHE", theme.btnFont, L"", 60, 230, 250, 56, theme.btnFontColor);
m_homeBtnUpdate = _addButton("HOME/UPDATE", theme.btnFont, L"", 60, 340, 250, 56, theme.btnFontColor);
m_homeBtnInstall = _addButton("HOME/INSTALL", theme.btnFont, L"", 330, 120, 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_homeBtnSettings = _addButton("HOME/SETTINGS", theme.btnFont, L"", 60, 100, 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, 260, 250, 56, theme.btnFontColor);
m_homeBtnExplorer = _addButton("HOME/EXPLORER", theme.btnFont, L"", 60, 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);
_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_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_homeBtnAbout, "HOME/ABOUT", 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);
_textHome();
@ -273,9 +306,12 @@ void CMenu::_textHome(void)
m_btnMgr.setText(m_homeBtnSettings, _t("home1", L"Settings"));
m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache"));
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_homeBtnAbout, _t("home4", L"Credits"));
m_btnMgr.setText(m_homeBtnExitTo, _t("home5", L"Exit To"));
m_btnMgr.setText(m_homeBtnSource, _t("home9", L"Source Menu"));
}
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_mainBtnPrev, instant);
m_btnMgr.hide(m_mainBtnConfig, instant);
m_btnMgr.hide(m_mainBtnExplorer, instant);
m_btnMgr.hide(m_mainBtnInfo, instant);
m_btnMgr.hide(m_mainBtnQuit, instant);
m_btnMgr.hide(m_mainBtnHomebrew, instant);
@ -91,7 +90,6 @@ void CMenu::_showMain(void)
_setBg(m_gameBg, m_gameBgLQ);
m_btnMgr.show(m_mainBtnInfo);
m_btnMgr.show(m_mainBtnConfig);
m_btnMgr.show(m_mainBtnExplorer);
m_btnMgr.show(m_mainBtnQuit);
switch(m_current_view)
@ -449,14 +447,6 @@ int CMenu::main(void)
if(BTN_B_HELD)
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))
{
_hideMain();
@ -752,7 +742,6 @@ int CMenu::main(void)
m_btnMgr.show(m_mainLblUser[1]);
m_btnMgr.show(m_mainBtnInfo);
m_btnMgr.show(m_mainBtnConfig);
m_btnMgr.show(m_mainBtnExplorer);
m_btnMgr.show(m_mainBtnQuit);
static bool 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]);
if(!m_gameList.empty())
m_btnMgr.hide(m_mainBtnConfig);
m_btnMgr.hide(m_mainBtnExplorer);
m_btnMgr.hide(m_mainBtnInfo);
m_btnMgr.hide(m_mainBtnQuit);
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_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_mainBtnChannel = _addPicButton("MAIN/CHANNEL_BTN", texChannel, texChannels, 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_mainBtnPrev, "MAIN/PREV_BTN", 0, 0, 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_mainBtnQuit, "MAIN/QUIT_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 "lockMutex.hpp"
#include "channel/nand.hpp"
#include "fileOps/fileOps.h"
#include "loader/cios.h"
#include "loader/nk.h"

View File

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

View File

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