-fixed issue with emu nand path string.

-recoded cheats download. it should work but geckocodes.org now uses some browser check which prevents downloads on wii. either manually download via pc or get abz's master pack which contains a lot of cheats.
-added comments and minor changes to wait message code.
This commit is contained in:
fledge68 2018-06-06 21:56:21 +00:00
parent 52ea6f6b99
commit 493e4dc8a9
10 changed files with 108 additions and 176 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -553,18 +553,18 @@ void CVideo::render(void)
GX_InvalidateTexAll(); GX_InvalidateTexAll();
} }
void * CVideo::_showWaitMessages(void *obj) void * CVideo::_showWaitMessages(void *obj)// wait images thread
{ {
CVideo *m = static_cast<CVideo *>(obj); CVideo *m = static_cast<CVideo *>(obj);
m->m_showingWaitMessages = true; m->m_showingWaitMessages = true;
u32 frames = m->m_waitMessageDelay * 50; u32 frames = m->m_waitMessageDelay * 50;// set delay start
u32 waitFrames = frames; u32 waitFrames = frames;// set delay counter to delay start
s8 fadeDirection = 1; s8 fadeDirection = 1;
s8 PNGfadeDirection = 1; s8 PNGfadeDirection = 1;// set frames movement direction
s16 currentLightLevel = 0; s16 currentLightLevel = 0;
vector<TexData>::iterator waitItr = m->m_waitMessages.begin(); vector<TexData>::iterator waitItr = m->m_waitMessages.begin();// set start frame image
m->_clearScreen(); m->_clearScreen();
m->prepare(); m->prepare();
@ -586,25 +586,25 @@ void * CVideo::_showWaitMessages(void *obj)
} }
wiiLightSetLevel(currentLightLevel); wiiLightSetLevel(currentLightLevel);
if(waitFrames == 0) if(waitFrames == 0)// if delay count reaches 0
{ {
m->waitMessage(*waitItr); m->waitMessage(*waitItr);// draw frame image
waitItr += PNGfadeDirection; waitItr += PNGfadeDirection;// move to next image
if(waitItr + 1 == m->m_waitMessages.end() || waitItr == m->m_waitMessages.begin()) if(waitItr + 1 == m->m_waitMessages.end() || waitItr == m->m_waitMessages.begin())
PNGfadeDirection *= (-1); PNGfadeDirection *= (-1);// change direction if at beginning or end
waitFrames = frames; waitFrames = frames;// reset delay count
m->render(); m->render();
} }
else else
VIDEO_WaitVSync(); VIDEO_WaitVSync();
waitFrames--; waitFrames--;// decrement delay count
} }
//gprintf("Wait Message Thread: End\n"); //gprintf("Wait Message Thread: End\n");
m->m_showingWaitMessages = false; m->m_showingWaitMessages = false;
return NULL; return NULL;
} }
void CVideo::hideWaitMessage() void CVideo::hideWaitMessage()// stop wait images and wii disc slot light threads
{ {
m_showWaitMessage = false; m_showWaitMessage = false;
if(waitThread != LWP_THREAD_NULL) if(waitThread != LWP_THREAD_NULL)
@ -622,7 +622,7 @@ void CVideo::hideWaitMessage()
waitThread = LWP_THREAD_NULL; waitThread = LWP_THREAD_NULL;
} }
void CVideo::waitMessage(float delay) void CVideo::waitMessage(float delay)// called from main.cpp to show wait animation on wf boot
{ {
if(m_defaultWaitMessages.size() == 0) if(m_defaultWaitMessages.size() == 0)
{ {
@ -638,10 +638,10 @@ void CVideo::waitMessage(float delay)
for(int i = 0; i < 8; i++) for(int i = 0; i < 8; i++)
m_defaultWaitMessages.push_back(m_wTextures[i]); m_defaultWaitMessages.push_back(m_wTextures[i]);
} }
waitMessage(vector<TexData>(), delay); waitMessage(m_defaultWaitMessages, delay);
} }
void CVideo::waitMessage(const vector<TexData> &tex, float delay) void CVideo::waitMessage(const vector<TexData> &tex, float delay)// start wait images and wii slot light threads or draw
{ {
hideWaitMessage(); hideWaitMessage();
m_WaitThreadRunning = true; m_WaitThreadRunning = true;
@ -658,19 +658,19 @@ void CVideo::waitMessage(const vector<TexData> &tex, float delay)
} }
if(m_waitMessages.size() == 1) if(m_waitMessages.size() == 1)
waitMessage(m_waitMessages[0]); waitMessage(m_waitMessages[0]);// draws frame image using function below (for one frame image only) but no render?
else if(m_waitMessages.size() > 1) else if(m_waitMessages.size() > 1)// if more than one frame
{ {
/* changing light */ /* changing light */
wiiLightSetLevel(0); wiiLightSetLevel(0);
wiiLightStartThread(); wiiLightStartThread();// start thread in gekko.c that pulses the wii disc slot light on and off
/* onscreen animation */ /* onscreen animation */
m_showWaitMessage = true; m_showWaitMessage = true;// start wait images thread to animate them
LWP_CreateThread(&waitThread, _showWaitMessages, this, waitMessageStack, waitMessageStackSize, LWP_PRIO_HIGHEST); LWP_CreateThread(&waitThread, _showWaitMessages, this, waitMessageStack, waitMessageStackSize, LWP_PRIO_HIGHEST);
} }
} }
void CVideo::waitMessage(const TexData &tex) void CVideo::waitMessage(const TexData &tex)//draw frame image
{ {
Mtx modelViewMtx; Mtx modelViewMtx;
GXTexObj texObj; GXTexObj texObj;
@ -715,7 +715,7 @@ s32 CVideo::TakeScreenshot(const char *path)
return ret; return ret;
} }
void DrawTexture(TexData * &tex) void DrawTexture(TexData * &tex)// used by coverflow to draw cover texture. use in mainloopcommon() in menu.cpp
{ {
if(tex == NULL) if(tex == NULL)
return; return;
@ -758,7 +758,7 @@ void DrawTexture(TexData * &tex)
GX_End(); GX_End();
} }
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color) void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)// used by banner window and screen saver below
{ {
Mtx modelViewMtx; Mtx modelViewMtx;
guMtxIdentity(modelViewMtx); guMtxIdentity(modelViewMtx);
@ -786,7 +786,7 @@ void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE); GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
} }
void DrawTexturePos(const TexData *tex) void DrawTexturePos(const TexData *tex)// draws movie frame texture when playing movie in menu_game.cpp
{ {
Mtx modelViewMtx; Mtx modelViewMtx;
GXTexObj texObj; GXTexObj texObj;

View File

@ -2292,8 +2292,7 @@ bool CMenu::_loadChannelList(void)
if(chantypes & CHANNELS_EMU) if(chantypes & CHANNELS_EMU)
{ {
NANDemuView = true; NANDemuView = true;
string emuPath; int emuPartition = _FindEmuPart(false, false);// check if emunand folder exist and on FAT
int emuPartition = _FindEmuPart(emuPath, false, false);// check if emunand folder exist and on FAT
if(emuPartition >= 0) if(emuPartition >= 0)
{ {
currentPartition = emuPartition; currentPartition = emuPartition;
@ -2461,7 +2460,8 @@ void CMenu::_hideWaitMessage()
void CMenu::_showWaitMessage() void CMenu::_showWaitMessage()
{ {
m_vid.waitMessage(_textures("GENERAL", "waitmessage"), m_theme.getFloat("GENERAL", "waitmessage_delay", 0.f)); m_vid.waitMessage(0.15f);
//m_vid.waitMessage(_textures("GENERAL", "waitmessage"), m_theme.getFloat("GENERAL", "waitmessage_delay", 0.f));
} }
typedef struct map_entry typedef struct map_entry

View File

@ -5,6 +5,7 @@
#include <ogc/pad.h> #include <ogc/pad.h>
#include <vector> #include <vector>
#include <map> #include <map>
#include <string>
#include "btnmap.h" #include "btnmap.h"
#include "channel/banner.h" #include "channel/banner.h"
@ -968,7 +969,6 @@ private:
void _hideCategorySettings(bool instant = false); void _hideCategorySettings(bool instant = false);
void _hideSystem(bool instant = false); void _hideSystem(bool instant = false);
void _hideGameInfo(bool instant = false); void _hideGameInfo(bool instant = false);
void _hideCheatDownload(bool instant = false);
void _hideNandEmu(bool instant = false); void _hideNandEmu(bool instant = false);
void _hideNandEmuPg(); void _hideNandEmuPg();
void _hideHome(bool instant = false); void _hideHome(bool instant = false);
@ -1005,7 +1005,6 @@ private:
void _showWBFS(WBFS_OP op); void _showWBFS(WBFS_OP op);
void _showCFTheme(u32 curParam, int version, bool wide); void _showCFTheme(u32 curParam, int version, bool wide);
void _showGameSettings(void); void _showGameSettings(void);
void _showCheatDownload(void);
void _showHome(void); void _showHome(void);
void _showExitTo(void); void _showExitTo(void);
void _showCoverBanner(void); void _showCoverBanner(void);
@ -1178,14 +1177,14 @@ private:
void _stopSounds(void); void _stopSounds(void);
static void * _NandDumper(void *obj); static void * _NandDumper(void *obj);
static void * _NandFlasher(void *obj); static void * _NandFlasher(void *obj);
int _FindEmuPart(string &emuPath, bool searchvalid, bool savesnand); int _FindEmuPart(bool searchvalid, bool savesnand);
bool _checkSave(string id, bool nand); bool _checkSave(string id, bool nand);
bool _TestEmuNand(int epart, const char *path, bool indept); bool _TestEmuNand(int epart, const char *path, bool indept);
void _checkEmuNandSettings(void); void _checkEmuNandSettings(void);
void _FullNandCheck(void); void _FullNandCheck(void);
void _listEmuNands(const char *path, vector<string> &emuNands); void _listEmuNands(const char *path, vector<string> &emuNands);
static void * _downloadCheatFileAsync(void *obj); int _downloadCheatFileAsync();
int _downloadBannerAsync(); int _downloadBannerAsync();
static void * _downloadUrlAsync(void *obj); static void * _downloadUrlAsync(void *obj);

View File

@ -10,62 +10,29 @@
u8 m_cheatSettingsPage = 0; u8 m_cheatSettingsPage = 0;
void CMenu::_hideCheatDownload(bool instant) int CMenu::_downloadCheatFileAsync()
{ {
m_btnMgr.hide(m_downloadBtnCancel, instant); m_thrdTotal = 2;// download and save
m_btnMgr.hide(m_downloadPBar, instant);
m_btnMgr.hide(m_downloadLblMessage[0], 0, 0, -2.f, 0.f, instant);
m_btnMgr.hide(m_downloadLblMessage[1], 0, 0, -2.f, 0.f, instant);
}
void CMenu::_showCheatDownload(void) m_thrdMessage = _t("dlmsg1", L"Initializing network...");
{ m_thrdMessageAdded = true;
_setBg(m_downloadBg, m_downloadBg); if(_initNetwork() < 0)
m_btnMgr.show(m_downloadBtnCancel);
m_btnMgr.show(m_downloadPBar);
}
void * CMenu::_downloadCheatFileAsync(void *obj)
{
CMenu *m = (CMenu *)obj;
if (!m->m_thrdWorking)
return 0;
m->m_thrdStop = false;
LWP_MutexLock(m->m_mutex);
m->_setThrdMsg(m->_t("cfgg23", L"Downloading cheat file..."), 0);
LWP_MutexUnlock(m->m_mutex);
if (m->_initNetwork() < 0)
{ {
m->m_thrdWorking = false; return -2;
return 0;
} }
/*u32 bufferSize = 0x080000; // Maximum download size 512kb
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
if(buffer == NULL)
{
m->m_thrdWorking = false;
return 0;
}*/
const char *id = CoverFlow.getId(); const char *id = CoverFlow.getId();
//char type = id[0] == 'S' ? 'R' : id[0]; //char type = id[0] == 'S' ? 'R' : id[0];
block cheatfile = downloadfile(fmt(GECKOURL, id)); block cheatfile = downloadfile(fmt(GECKOURL, id));
if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<') if(cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<')
{ {
fsop_WriteFile(fmt("%s/%s.txt", m->m_txtCheatDir.c_str(), id), cheatfile.data, cheatfile.size); update_pThread(1);//its downloaded
//free(buffer); fsop_WriteFile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id), cheatfile.data, cheatfile.size);
m->m_thrdWorking = false;
return 0; return 0;
} }
//free(buffer); return -3;// download failed
m->m_thrdWorking = false;
return 0;
} }
void CMenu::_CheatSettings() void CMenu::_CheatSettings()
@ -164,73 +131,41 @@ void CMenu::_CheatSettings()
} }
else if (m_btnMgr.selected(m_cheatBtnDownload)) else if (m_btnMgr.selected(m_cheatBtnDownload))
{ {
int msg = 0;
wstringEx prevMsg;
// Download cheat code
m_btnMgr.setProgress(m_downloadPBar, 0.f);
_hideCheatSettings(); _hideCheatSettings();
_showCheatDownload(); bool dl_finished = false;
m_btnMgr.setText(m_downloadBtnCancel, _t("dl1", L"Cancel")); while(!m_exit)
m_thrdStop = false;
m_thrdMessageAdded = false;
m_thrdWorking = true;
lwp_t thread = LWP_THREAD_NULL;
LWP_CreateThread(&thread, _downloadCheatFileAsync, this, downloadStack, downloadStackSize, 40);
while(m_thrdWorking)
{ {
_mainLoopCommon(); _mainLoopCommon();
if ((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking) if((BTN_HOME_PRESSED || BTN_B_PRESSED) && dl_finished)
{
m_btnMgr.hide(m_wbfsPBar);
m_btnMgr.hide(m_wbfsLblMessage);
m_btnMgr.hide(m_wbfsLblDialog);
break; break;
if (BTN_A_PRESSED && !(m_thrdWorking && m_thrdStop))
{
if (m_btnMgr.selected(m_downloadBtnCancel))
{
LockMutex lock(m_mutex);
m_thrdStop = true;
m_thrdMessageAdded = true;
m_thrdMessage = _t("dlmsg6", L"Canceling...");
}
} }
if (Sys_Exiting()) if(!dl_finished)
{ {
LockMutex lock(m_mutex); m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
m_thrdStop = true; m_btnMgr.setText(m_wbfsLblMessage, L"0%");
m_thrdMessageAdded = true; m_btnMgr.setText(m_wbfsLblDialog, L"");
m_thrdMessage = _t("dlmsg6", L"Canceling..."); m_btnMgr.show(m_wbfsPBar);
m_thrdWorking = false; m_btnMgr.show(m_wbfsLblMessage);
} m_btnMgr.show(m_wbfsLblDialog);
if (m_thrdMessageAdded) _start_pThread();
{ int ret = _downloadCheatFileAsync();
LockMutex lock(m_mutex); _stop_pThread();
m_thrdMessageAdded = false; if(ret == -1)
m_btnMgr.setProgress(m_downloadPBar, m_thrdProgress); m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg27", L"Not enough memory!"));
if (m_thrdProgress >= 1.f) { else if(ret == -2)
// m_btnMgr.setText(m_downloadBtnCancel, _t("dl2", L"Back")); m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg2", L"Network initialization failed!"));
break; else if(ret == -3)
} m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg12", L"Download failed!"));
if (prevMsg != m_thrdMessage) else
{ m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg14", L"Done."));
prevMsg = m_thrdMessage; dl_finished = true;
m_btnMgr.setText(m_downloadLblMessage[msg], m_thrdMessage, false);
m_btnMgr.hide(m_downloadLblMessage[msg], 0, 0, -1.f, -1.f, true);
m_btnMgr.show(m_downloadLblMessage[msg]);
msg ^= 1;
m_btnMgr.hide(m_downloadLblMessage[msg], 0, 0, -1.f, -1.f);
}
} }
if (m_thrdStop && !m_thrdWorking)
break;
} }
if (thread != LWP_THREAD_NULL)
{
LWP_JoinThread(thread, NULL);
thread = LWP_THREAD_NULL;
}
_hideCheatDownload();
txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id)); txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id));
_showCheatSettings(); _showCheatSettings();
@ -242,9 +177,9 @@ void CMenu::_CheatSettings()
if (m_cheatfile.getCnt() == 0) if (m_cheatfile.getCnt() == 0)
{ {
// cheat code not found, show result // cheat code not found, show result
char type = id[0] == 'S' ? 'R' : id[0]; //char type = id[0] == 'S' ? 'R' : id[0];
m_btnMgr.setText(m_cheatLblItem[0], _t("cheat4", L"Download not found.")); m_btnMgr.setText(m_cheatLblItem[0], _t("cheat4", L"Download not found."));
m_btnMgr.setText(m_cheatLblItem[1], sfmt(GECKOURL, type, id)); m_btnMgr.setText(m_cheatLblItem[1], sfmt(GECKOURL, id));
m_btnMgr.show(m_cheatLblItem[1]); m_btnMgr.show(m_cheatLblItem[1]);
} }
} }

View File

@ -24,7 +24,6 @@ void CMenu::error(const wstringEx &msg)
_hideCategorySettings(); _hideCategorySettings();
_hideSystem(); _hideSystem();
_hideGameInfo(); _hideGameInfo();
_hideCheatDownload();
_hideGameSettings(); _hideGameSettings();
_hideSource(); _hideSource();
_hideWaitMessage(); _hideWaitMessage();

View File

@ -1716,8 +1716,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
if(emulate_mode && !dvd && !neek2o()) if(emulate_mode && !dvd && !neek2o())
{ {
string emuPath; int emuPart = _FindEmuPart( true, true);
int emuPart = _FindEmuPart(emuPath, true, true);
if(emuPart == -1)//if savepartition is unusable if(emuPart == -1)//if savepartition is unusable
{ {
_hideWaitMessage(); _hideWaitMessage();
@ -1729,10 +1728,11 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
{ {
bool need_config = false; bool need_config = false;
bool need_miis = false; bool need_miis = false;
const char *emuPath = NandHandle.Get_NandPath();
//char testpath[MAX_FAT_PATH];
char basepath[MAX_FAT_PATH]; char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str()); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath);
char testpath[strlen(basepath) + 42]; char testpath[strlen(basepath) + 42];
// does not check to see if actual tmd exist just if the folder exist // does not check to see if actual tmd exist just if the folder exist

View File

@ -762,8 +762,7 @@ int CMenu::main(void)
const char *ReturnPath = NULL; const char *ReturnPath = NULL;
if(!m_cfg.getBool(CHANNEL_DOMAIN, "neek_return_default", false)) if(!m_cfg.getBool(CHANNEL_DOMAIN, "neek_return_default", false))
{ {
string emuPath; if(_FindEmuPart(false, false) >= 0)// make sure emunand folder exists
if(_FindEmuPart(emuPath, false, false) >= 0)// make sure emunand folder exists
ReturnPath = NandHandle.Get_NandPath(); ReturnPath = NandHandle.Get_NandPath();
} }
Sys_SetNeekPath(ReturnPath); Sys_SetNeekPath(ReturnPath);

View File

@ -197,26 +197,30 @@ void CMenu::_FullNandCheck(void)
emulate_mode = m_cfg.getInt(WII_DOMAIN, "save_emulation", 0); emulate_mode = m_cfg.getInt(WII_DOMAIN, "save_emulation", 0);
if((i == 0 && emulate_mode == 1) || (i == 1 && emulate_mode == 2))//full if((i == 0 && emulate_mode == 1) || (i == 1 && emulate_mode == 2))//full
{ {
string emuPath; int emuPart = _FindEmuPart( true, i);
int emuPart = _FindEmuPart(emuPath, true, i);
if(emuPart < 0) if(emuPart < 0)
continue; continue;
bool need_config = false; bool need_config = false;
bool need_miis = false; bool need_miis = false;
const char *emuPath = NandHandle.Get_NandPath();
string testpath; char basepath[MAX_FAT_PATH];
string basepath = DeviceName[emuPart] + ':' + emuPath; snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath);
char testpath[MAX_FAT_PATH + 42];
//check config files //check config files
testpath.assign(basepath + "/shared2/sys/SYSCONF"); snprintf(testpath, sizeof(testpath), "%s/shared2/sys/SYSCONF", basepath);
if(!fsop_FileExist(testpath.c_str())) if(!fsop_FileExist(testpath))
need_config = true; need_config = true;
testpath.assign(basepath + "/title/00000001/00000002/data/setting.txt");
if(!fsop_FileExist(testpath.c_str())) snprintf(testpath, sizeof(testpath), "%s/title/00000001/00000002/data/setting.txt", basepath);
if(!fsop_FileExist(testpath))
need_config = true; need_config = true;
// Check Mii's // Check Mii's
testpath.assign(basepath + "/shared2/menu/FaceLib/RFL_DB.dat"); snprintf(testpath, sizeof(testpath), "%s/shared2/menu/FaceLib/RFL_DB.dat", basepath);
if(!fsop_FileExist(testpath.c_str())) if(!fsop_FileExist(testpath))
need_miis = true; need_miis = true;
NandHandle.PreNandCfg(need_miis, need_config);//copy to emunand if needed NandHandle.PreNandCfg(need_miis, need_config);//copy to emunand if needed
@ -224,19 +228,19 @@ void CMenu::_FullNandCheck(void)
} }
} }
int CMenu::_FindEmuPart(string &emuPath, bool skipchecks, bool savesnand) int CMenu::_FindEmuPart(bool skipchecks, bool savesnand)
{ {
int emuPart; int emuPart;
const char *tmpPath = NULL; char tmpPath[MAX_FAT_PATH];
if(savesnand) if(savesnand)
{ {
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition"); emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition");
tmpPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); snprintf(tmpPath, sizeof(tmpPath), "/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str());
} }
else else
{ {
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition"); emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition");
tmpPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str()); snprintf(tmpPath, sizeof(tmpPath), "/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str());
} }
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart)) if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))
return -1; return -1;
@ -244,7 +248,6 @@ int CMenu::_FindEmuPart(string &emuPath, bool skipchecks, bool savesnand)
{ {
NandHandle.SetNANDEmu(emuPart); NandHandle.SetNANDEmu(emuPart);
NandHandle.SetPaths(tmpPath, DeviceName[emuPart]); NandHandle.SetPaths(tmpPath, DeviceName[emuPart]);
emuPath = tmpPath;
return emuPart; return emuPart;
} }
return -2; return -2;
@ -584,8 +587,7 @@ int CMenu::_NandEmuCfg(void)
} }
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandDump) || m_btnMgr.selected(m_nandemuBtnAll) || m_btnMgr.selected(m_nandemuBtnMissing))) else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandDump) || m_btnMgr.selected(m_nandemuBtnAll) || m_btnMgr.selected(m_nandemuBtnMissing)))
{ {
string emuPath; int emuPart = _FindEmuPart(true, !m_fulldump);
int emuPart = _FindEmuPart(emuPath, true, !m_fulldump);
if(emuPart < 0) if(emuPart < 0)
{ {
_hideNandEmu(true); _hideNandEmu(true);
@ -702,8 +704,7 @@ int CMenu::_NandEmuCfg(void)
int CMenu::_FlashSave(string gameId) int CMenu::_FlashSave(string gameId)
{ {
string emuPath; if(_FindEmuPart(false, true) < 0)// if savenand not found
if(_FindEmuPart(emuPath, false, true) < 0)// if savenand not found
return 0; return 0;
if(!_checkSave(gameId, false))// if save not on savenand if(!_checkSave(gameId, false))// if save not on savenand
@ -772,8 +773,7 @@ int CMenu::_FlashSave(string gameId)
int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or launching wii game int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or launching wii game
{ {
string emuPath; int emuPart = _FindEmuPart(false, true);
int emuPart = _FindEmuPart(emuPath, false, true);
if(m_forceext && emuPart == -1)// if game config force extract and savenand partition unusable if(m_forceext && emuPart == -1)// if game config force extract and savenand partition unusable
{ {
m_forceext = false; m_forceext = false;
@ -781,7 +781,7 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
} }
/*else if(emuPart == -2)// emunand folder not found so make it /*else if(emuPart == -2)// emunand folder not found so make it
{ {
emuPart = _FindEmuPart(emuPath, true, true); emuPart = _FindEmuPart(true, true);
char basepath[MAX_FAT_PATH]; char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str()); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str());
NandHandle.CreatePath("%s/import", basepath); NandHandle.CreatePath("%s/import", basepath);
@ -893,21 +893,21 @@ void * CMenu::_NandFlasher(void *obj)
char source[MAX_FAT_PATH]; char source[MAX_FAT_PATH];
char dest[ISFS_MAXPATH]; char dest[ISFS_MAXPATH];
string emuPath; int emuPartition = m._FindEmuPart(true, true);
int emuPartition = m._FindEmuPart(emuPath, true, true);
const char *SaveGameID = m.m_saveExtGameId.c_str(); const char *SaveGameID = m.m_saveExtGameId.c_str();
int flashID = SaveGameID[0] << 24 | SaveGameID[1] << 16 | SaveGameID[2] << 8 | SaveGameID[3]; int flashID = SaveGameID[0] << 24 | SaveGameID[1] << 16 | SaveGameID[2] << 8 | SaveGameID[3];
const char *emuPath = NandHandle.Get_NandPath();
/* we know it exist on emunand just need to figure out which folder */ /* we know it exist on emunand just need to figure out which folder */
if(_saveExists(fmt("%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID))) if(_saveExists(fmt("%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath, flashID)))
{ {
snprintf(source, sizeof(source), "%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID); snprintf(source, sizeof(source), "%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath, flashID);
snprintf(dest, sizeof(dest), "/title/00010000/%08x", flashID); snprintf(dest, sizeof(dest), "/title/00010000/%08x", flashID);
} }
else //if(_saveExists(fmt("%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID))) else //if(_saveExists(fmt("%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath, flashID)))
{ {
snprintf(source, sizeof(source), "%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID); snprintf(source, sizeof(source), "%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath, flashID);
snprintf(dest, sizeof(dest), "/title/00010004/%08x", flashID); snprintf(dest, sizeof(dest), "/title/00010004/%08x", flashID);
} }
NandHandle.ResetCounters(); NandHandle.ResetCounters();
@ -939,10 +939,10 @@ void * CMenu::_NandDumper(void *obj)
NandHandle.ResetCounters(); NandHandle.ResetCounters();
string emuPath; int emuPartition = m._FindEmuPart(true, !m_fulldump);
int emuPartition = m._FindEmuPart(emuPath, true, !m_fulldump); const char *emuPath = NandHandle.Get_NandPath();
char basepath[64]; char basepath[64];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath.c_str()); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath);
/* create basepath in case it doesn't exist */ /* create basepath in case it doesn't exist */
NandHandle.CreatePath("%s", basepath); NandHandle.CreatePath("%s", basepath);

View File

@ -444,7 +444,7 @@ void CMenu::_Wad(const char *wad_path)
int emuPart = 0; int emuPart = 0;
if(!mios) if(!mios)
{ {
emuPart = _FindEmuPart(emuPath, false, false); emuPart = _FindEmuPart(false, false);
if(emuPart < 0) if(emuPart < 0)
{ {
//cfgne8=No valid FAT partition found for NAND Emulation! //cfgne8=No valid FAT partition found for NAND Emulation!