-updated to compile with devkitPPC r30 and the latest libogc which i think is 1.8.19.

-downloading covers is still broken.
This commit is contained in:
fledge68 2018-05-29 09:59:57 +00:00
parent 8fe2349084
commit 113c7e015e
30 changed files with 260 additions and 217 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -250,8 +250,8 @@ void Nand::__GetNameList(const char *source, namelist **entries, int *count)
u32 i, j, k, l; u32 i, j, k, l;
u32 numentries = 0; u32 numentries = 0;
char *names = NULL; char *names = NULL;
char curentry[ISFS_MAXPATH]; char curentry[ISFS_MAXPATH];//64
char entrypath[ISFS_MAXPATH]; char entrypath[ISFS_MAXPATH];//64
s32 ret = ISFS_ReadDir(source, NULL, &numentries); s32 ret = ISFS_ReadDir(source, NULL, &numentries);
names = (char *)memalign(32, ALIGN32((ISFS_MAXPATH) * numentries)); names = (char *)memalign(32, ALIGN32((ISFS_MAXPATH) * numentries));
@ -284,11 +284,12 @@ void Nand::__GetNameList(const char *source, namelist **entries, int *count)
strcpy((*entries)[i].name, curentry); strcpy((*entries)[i].name, curentry);
if(source[strlen(source)-1] == '/') /* this could still cause a buffer overrun */
snprintf(entrypath, sizeof(entrypath), "%s%s", source, curentry); strcpy(entrypath, source);
else if(source[strlen(source)-1] != '/')
snprintf(entrypath, sizeof(entrypath), "%s/%s", source, curentry); strcat(entrypath, "/");
strcat(entrypath, curentry);
ret = ISFS_ReadDir(entrypath, NULL, &l); ret = ISFS_ReadDir(entrypath, NULL, &l);
(*entries)[i].type = ret < 0 ? 0 : 1; (*entries)[i].type = ret < 0 ? 0 : 1;
} }
@ -774,8 +775,8 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
s32 Nand::__FlashNandFolder(const char *source, const char *dest) s32 Nand::__FlashNandFolder(const char *source, const char *dest)
{ {
char nsource[MAX_FAT_PATH]; char nsource[MAX_FAT_PATH];//1024
char ndest[ISFS_MAXPATH]; char ndest[ISFS_MAXPATH];//64
DIR *dir_iter; DIR *dir_iter;
struct dirent *ent; struct dirent *ent;
@ -789,11 +790,12 @@ s32 Nand::__FlashNandFolder(const char *source, const char *dest)
if(ent->d_name[0] == '.') if(ent->d_name[0] == '.')
continue; continue;
if(dest[strlen(dest)-1] == '/') /* this could still cause a buffer overrun */
snprintf(ndest, sizeof(ndest), "%s%s", dest, ent->d_name); strcpy(ndest, dest);
else if(dest[strlen(dest)-1] != '/')
snprintf(ndest, sizeof(ndest), "%s/%s", dest, ent->d_name); strcat(ndest, "/");
strcat(ndest, ent->d_name);
if(source[strlen(source)-1] == '/') if(source[strlen(source)-1] == '/')
snprintf(nsource, sizeof(nsource), "%s%s", source, ent->d_name); snprintf(nsource, sizeof(nsource), "%s%s", source, ent->d_name);
else else
@ -830,11 +832,12 @@ s32 Nand::__DumpNandFolder(const char *source, const char *dest)
for(i = 0; i < cnt; i++) for(i = 0; i < cnt; i++)
{ {
if(source[strlen(source)-1] == '/') /* this could still cause a buffer overrun */
snprintf(nsource, sizeof(nsource), "%s%s", source, names[i].name); strcpy(nsource, source);
else if(source[strlen(source)-1] != '/')
snprintf(nsource, sizeof(nsource), "%s/%s", source, names[i].name); strcat(nsource, "/");
strcat(nsource, names[i].name);
if(!names[i].type) if(!names[i].type)
{ {
__FATify(tdest, nsource); __FATify(tdest, nsource);

View File

@ -69,7 +69,7 @@ u32 hdd_sector_size[2] = { 512, 512 };
bool first = false; bool first = false;
int usb_libogc_mode = 0; int usb_libogc_mode = 0;
inline s32 __USBStorage_isMEM2Buffer(const void *buffer) static inline s32 __USBStorage_isMEM2Buffer(const void *buffer)
{ {
u32 high_addr = ((u32)buffer) >> 24; u32 high_addr = ((u32)buffer) >> 24;
return(high_addr == 0x90) || (high_addr == 0xD0); return(high_addr == 0x90) || (high_addr == 0xD0);

View File

@ -63,7 +63,7 @@ u64 fsop_GetFolderBytes(const char *source)
{ {
DIR *pdir; DIR *pdir;
struct dirent *pent; struct dirent *pent;
char newSource[300]; char newSource[1024];
u64 bytes = 0; u64 bytes = 0;
pdir = opendir(source); pdir = opendir(source);
@ -247,7 +247,7 @@ static bool doCopyFolder(const char *source, const char *target, progress_callba
{ {
DIR *pdir; DIR *pdir;
struct dirent *pent; struct dirent *pent;
char newSource[300], newTarget[300]; char newSource[1024], newTarget[1024];
bool ret = true; bool ret = true;
// If target folder doesn't exist, create it ! // If target folder doesn't exist, create it !
@ -288,7 +288,7 @@ void fsop_deleteFolder(const char *source)
{ {
DIR *pdir; DIR *pdir;
struct dirent *pent; struct dirent *pent;
char newSource[300]; char newSource[1024];
pdir = opendir(source); pdir = opendir(source);

View File

@ -264,7 +264,7 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 l
struct stat st; struct stat st;
int data_fd; int data_fd;
char iso2path[256]; char iso2path[256];
iso2path[255] = '\0'; memset(iso2path, 0, sizeof(iso2path));
stat(isopath, &st); stat(isopath, &st);
FILE *f = fopen(isopath, "rb"); FILE *f = fopen(isopath, "rb");
@ -293,15 +293,15 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 l
char *ptz = strstr(iso2path, "game.iso"); char *ptz = strstr(iso2path, "game.iso");
if(ptz != NULL) if(ptz != NULL)
{ {
strncpy(ptz, "gam1.iso", 8); memcpy(ptz, "gam1.iso", 8);
f = fopen(iso2path, "rb"); f = fopen(iso2path, "rb");
if(f == NULL) if(f == NULL)
{ {
strncpy(ptz, "gam2.iso", 8); memcpy(ptz, "gam2.iso", 8);
f = fopen(iso2path, "rb"); f = fopen(iso2path, "rb");
if(f == NULL) if(f == NULL)
{ {
strncpy(ptz, "disc2.iso", 9); memcpy(ptz, "disc2.iso", 9);
f = fopen(iso2path, "rb"); f = fopen(iso2path, "rb");
} }
} }
@ -379,11 +379,11 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 l
case 2:// PAL60 480i case 2:// PAL60 480i
rmode = &TVEurgb60Hz480IntDf; rmode = &TVEurgb60Hz480IntDf;
rmode_reg = 5;// VI_EURGB60 rmode_reg = 5;// VI_EURGB60
default: break;
case 3:// NTSC 480i case 3:// NTSC 480i
default:
rmode = &TVNtsc480IntDf; rmode = &TVNtsc480IntDf;
break; break;
} }
/* Set video mode register */ /* Set video mode register */

View File

@ -655,8 +655,7 @@ void CCoverFlow::startCoverLoader(void)
m_loadingCovers = true; m_loadingCovers = true;
m_moved = true; m_moved = true;
LWP_CreateThread(&coverLoaderThread, (void*(*)(void*))CCoverFlow::_coverLoader, LWP_CreateThread(&coverLoaderThread, _coverLoader, this, coverThreadStack, coverThreadStackSize, 30);
(void*)this, coverThreadStack, coverThreadStackSize, 30);
gprintf("Coverflow started!\n"); gprintf("Coverflow started!\n");
} }
@ -2936,8 +2935,9 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR; return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR;
} }
int CCoverFlow::_coverLoader(CCoverFlow *cf) void * CCoverFlow::_coverLoader(void *obj)
{ {
CCoverFlow *cf = static_cast<CCoverFlow *>(obj);
cf->m_coverThrdBusy = true; cf->m_coverThrdBusy = true;
CLRet ret; CLRet ret;
u32 firstItem; u32 firstItem;

View File

@ -360,7 +360,7 @@ private:
static bool _sortByWifiPlayers(CItem item1, CItem item2); static bool _sortByWifiPlayers(CItem item1, CItem item2);
private: private:
static int _coverLoader(CCoverFlow *cf); static void * _coverLoader(void *obj);
static float _step(float cur, float tgt, float spd); static float _step(float cur, float tgt, float spd);
private: private:
CCoverFlow(const CCoverFlow &); CCoverFlow(const CCoverFlow &);

View File

@ -222,7 +222,7 @@ TexErr STexture::fromImageFile(TexData &dest, const char *filename, u8 f, u32 mi
u8 *Image = fsop_ReadFile(filename, &fileSize); u8 *Image = fsop_ReadFile(filename, &fileSize);
if(Image == NULL) if(Image == NULL)
{ {
strncpy((char*)filename+(strlen(filename)-3), "jp", 2); memcpy((char*)filename+(strlen(filename)-3), "jp", 2);// change .png to .jpg
Image = fsop_ReadFile(filename, &fileSize); Image = fsop_ReadFile(filename, &fileSize);
} }
if(Image == NULL) if(Image == NULL)

View File

@ -553,8 +553,9 @@ void CVideo::render(void)
GX_InvalidateTexAll(); GX_InvalidateTexAll();
} }
void CVideo::_showWaitMessages(CVideo *m) void * CVideo::_showWaitMessages(void *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;
u32 waitFrames = frames; u32 waitFrames = frames;
@ -600,6 +601,7 @@ void CVideo::_showWaitMessages(CVideo *m)
} }
//gprintf("Wait Message Thread: End\n"); //gprintf("Wait Message Thread: End\n");
m->m_showingWaitMessages = false; m->m_showingWaitMessages = false;
return NULL;
} }
void CVideo::hideWaitMessage() void CVideo::hideWaitMessage()
@ -664,8 +666,7 @@ void CVideo::waitMessage(const vector<TexData> &tex, float delay)
wiiLightStartThread(); wiiLightStartThread();
/* onscreen animation */ /* onscreen animation */
m_showWaitMessage = true; m_showWaitMessage = true;
LWP_CreateThread(&waitThread, (void *(*)(void *))_showWaitMessages, LWP_CreateThread(&waitThread, _showWaitMessages, this, waitMessageStack, waitMessageStackSize, LWP_PRIO_HIGHEST);
(void*)this, waitMessageStack, waitMessageStackSize, LWP_PRIO_HIGHEST);
} }
} }

View File

@ -120,7 +120,7 @@ private:
void _drawAASceneWithAlpha(float w, float h); void _drawAASceneWithAlpha(float w, float h);
void _setViewPort(float x, float y, float w, float h); void _setViewPort(float x, float y, float w, float h);
void _clearScreen(); void _clearScreen();
static void _showWaitMessages(CVideo *m); static void * _showWaitMessages(void *obj);
private: private:
CVideo(const CVideo &); CVideo(const CVideo &);
}; };

View File

@ -180,7 +180,7 @@ static void Create_Plugin_List(char *FullPath)
memset((void*)&ListElement, 0, sizeof(dir_discHdr)); memset((void*)&ListElement, 0, sizeof(dir_discHdr));
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1); strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
strncpy(ListElement.id, "PLUGIN", 6); memcpy(ListElement.id, "PLUGIN", 6);
FolderTitle = strrchr(FullPath, '/') + 1; FolderTitle = strrchr(FullPath, '/') + 1;
*strrchr(FolderTitle, '.') = '\0'; *strrchr(FolderTitle, '.') = '\0';
@ -211,7 +211,7 @@ static void Create_Homebrew_List(char *FullPath)
ListElement.index = m_cacheList.size(); ListElement.index = m_cacheList.size();
*strrchr(FullPath, '/') = '\0'; *strrchr(FullPath, '/') = '\0';
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1); strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
strncpy(ListElement.id, "HB_APP", 6); memcpy(ListElement.id, "HB_APP", 6);
FolderTitle = strrchr(FullPath, '/') + 1; FolderTitle = strrchr(FullPath, '/') + 1;
ListElement.casecolor = CustomTitles.getColor("COVERS", FolderTitle, 0xFFFFFF).intVal(); ListElement.casecolor = CustomTitles.getColor("COVERS", FolderTitle, 0xFFFFFF).intVal();
@ -239,7 +239,7 @@ static void Create_Channel_List(bool realNAND)
ListElement.settings[0] = TITLE_UPPER(chan->title); ListElement.settings[0] = TITLE_UPPER(chan->title);
ListElement.settings[1] = TITLE_LOWER(chan->title); ListElement.settings[1] = TITLE_LOWER(chan->title);
if(chan->title == HBC_108) if(chan->title == HBC_108)
strncpy(ListElement.id, "JODI", 4); memcpy(ListElement.id, "JODI", 4);
else else
strncpy(ListElement.id, chan->id, 4); strncpy(ListElement.id, chan->id, 4);
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, 0xFFFFFF).intVal(); ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, 0xFFFFFF).intVal();
@ -385,13 +385,16 @@ void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const stri
memset((void*)&ListElement, 0, sizeof(dir_discHdr)); memset((void*)&ListElement, 0, sizeof(dir_discHdr));
ListElement.index = m_cacheList.size(); ListElement.index = m_cacheList.size();
strncpy(ListElement.id, "SOURCE", 6); memcpy(ListElement.id, "SOURCE", 6);
strncpy(ListElement.path, path, sizeof(ListElement.path) - 1); strncpy(ListElement.path, path, sizeof(ListElement.path) - 1);
ListElement.casecolor = 0xFFFFFF; ListElement.casecolor = 0xFFFFFF;
ListElement.type = TYPE_SOURCE; ListElement.type = TYPE_SOURCE;
ListElement.settings[0] = i; ListElement.settings[0] = i;
const char *title = m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str(); //const char *title = m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
mbstowcs(ListElement.title, title, 63); char SourceTitle[64];
memset(SourceTitle, 0, sizeof(SourceTitle));
strncpy(SourceTitle, m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str(), 63);
mbstowcs(ListElement.title, SourceTitle, 63);
Asciify(ListElement.title); Asciify(ListElement.title);
m_cacheList.push_back(ListElement); m_cacheList.push_back(ListElement);
} }

View File

@ -290,12 +290,12 @@ s32 GCDump::DumpGame()
char *FSTNameOff = NULL; char *FSTNameOff = NULL;
char folder[MAX_FAT_PATH]; char folder[MAX_FAT_PATH + 76];
memset(folder, 0, MAX_FAT_PATH); memset(folder, 0, sizeof(folder));
char gamepath[MAX_FAT_PATH]; char gamepath[MAX_FAT_PATH + 90];
memset(gamepath, 0, MAX_FAT_PATH); memset(gamepath, 0, sizeof(gamepath));
char basedir[MAX_FAT_PATH]; char basedir[MAX_FAT_PATH];
memset(basedir, 0, MAX_FAT_PATH); memset(basedir, 0, sizeof(basedir));
strncpy(basedir, fmt(gc_gamesDir, gamepartition), MAX_FAT_PATH); strncpy(basedir, fmt(gc_gamesDir, gamepartition), MAX_FAT_PATH);
while(!gamedone) while(!gamedone)
@ -409,7 +409,7 @@ s32 GCDump::DumpGame()
{ {
char *ptz = strstr(gamepath, "game.iso"); char *ptz = strstr(gamepath, "game.iso");
if(ptz != NULL) if(ptz != NULL)
strncpy(ptz, "gam1.iso", 8); memcpy(ptz, "gam1.iso", 8);
} }
gprintf("Writing %s\n", gamepath); gprintf("Writing %s\n", gamepath);
if(compressed) if(compressed)

View File

@ -39,6 +39,7 @@ void Open_Inputs(void)
WUPC_Init(); WUPC_Init();
WPAD_Init(); WPAD_Init();
DS3_Init(); DS3_Init();
//drc
/* Set POWER button callback */ /* Set POWER button callback */
WPAD_SetPowerButtonCallback(__Wpad_PowerCallback); WPAD_SetPowerButtonCallback(__Wpad_PowerCallback);

View File

@ -146,9 +146,9 @@ s32 WBFS_Ext_RemoveGame(u8 *discid, char *gamepath)
{ {
DIR *dir_iter; DIR *dir_iter;
struct dirent *ent; struct dirent *ent;
char file[MAX_FAT_PATH]; char file[MAX_FAT_PATH + 768];//not sure why 768 but whatever
char folder[MAX_FAT_PATH]; char folder[MAX_FAT_PATH];
STRCOPY(folder, gamepath); STRCOPY(folder, gamepath);//STRCOPY ?
char *p = strrchr(folder, '/'); char *p = strrchr(folder, '/');
if(p) *p = 0; if(p) *p = 0;
@ -160,6 +160,7 @@ s32 WBFS_Ext_RemoveGame(u8 *discid, char *gamepath)
{ {
snprintf(file, sizeof(file), "%s/%s", folder, ent->d_name); snprintf(file, sizeof(file), "%s/%s", folder, ent->d_name);
remove(file); remove(file);
break;
} }
} }
closedir(dir_iter); closedir(dir_iter);

View File

@ -36,7 +36,7 @@
#define HW_GPIOB_OUT ((vu32*)0xCD8000C0) #define HW_GPIOB_OUT ((vu32*)0xCD8000C0)
#define HW_AHBPROT ((vu32*)0xCD800064) #define HW_AHBPROT ((vu32*)0xCD800064)
#define HW_PROCESSOR ((vu32*)0xCD8005A0) #define HW_PROCESSOR ((vu32*)0xCD8005A0)
#define MEM_PROT ((vu32)0xCD8B420A) #define MEM_PROT (0xCD8B420A)
#define HW_AES_CMD ((vu32)0x0D020000) #define HW_AES_CMD ((vu32)0x0D020000)
#define HW_AES_SRC ((vu32)0x0D020004) #define HW_AES_SRC ((vu32)0x0D020004)

View File

@ -1973,6 +1973,16 @@ void CMenu::_initCF(void)
CoverFlow.clear(); CoverFlow.clear();
CoverFlow.reserve(m_gameList.size()); CoverFlow.reserve(m_gameList.size());
char requiredCats[10];
char selectedCats[10];
char hiddenCats[10];
strcpy(requiredCats, m_cat.getString("GENERAL", "required_categories").c_str());
strcpy(selectedCats, m_cat.getString("GENERAL", "selected_categories").c_str());
strcpy(hiddenCats, m_cat.getString("GENERAL", "hidden_categories").c_str());
u8 numReqCats = strlen(requiredCats);
u8 numSelCats = strlen(selectedCats);
u8 numHidCats = strlen(hiddenCats);
for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr) for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr)
{ {
const char *id = NULL; const char *id = NULL;
@ -1994,13 +2004,13 @@ void CMenu::_initCF(void)
strcat(tmp1, tmp2); strcat(tmp1, tmp2);
id = tmp1;*/ id = tmp1;*/
} }
else if(hdr->type == TYPE_HOMEBREW) if(hdr->type == TYPE_HOMEBREW)
{ {
CoverFlow.addItem(&(*hdr), 0, 0); CoverFlow.addItem(&(*hdr), 0, 0);
continue; continue;
//id = strrchr(hdr->path, '/') + 1; //id = strrchr(hdr->path, '/') + 1;
} }
else if(hdr->type == TYPE_PLUGIN) if(hdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
wcstombs(tmp2, hdr->title, 64); wcstombs(tmp2, hdr->title, 64);
@ -2020,37 +2030,26 @@ void CMenu::_initCF(void)
id = tmp1; id = tmp1;
} }
} }
if((!m_favorites || m_gcfg1.getBool(favDomain, id, false)) if((!m_favorites || m_gcfg1.getBool(favDomain, id, false))
&& (!m_locked || !m_gcfg1.getBool(adultDomain, id, false))) && (!m_locked || !m_gcfg1.getBool(adultDomain, id, false)))
{ {
const char *catDomain = NULL; string catDomain = "";
switch(hdr->type) if(hdr->type == TYPE_CHANNEL)
{ catDomain = "NAND";
case TYPE_CHANNEL: else if(hdr->type == TYPE_EMUCHANNEL)
catDomain = "NAND"; catDomain = "CHANNELS";
break; else if(hdr->type == TYPE_GC_GAME)
case TYPE_EMUCHANNEL: catDomain = "GAMECUBE";
catDomain = "CHANNELS"; else if(hdr->type == TYPE_WII_GAME)
break; catDomain = "WII";
case TYPE_GC_GAME: else
catDomain = "GAMECUBE"; catDomain = m_plugin.PluginMagicWord;
break;
case TYPE_WII_GAME:
catDomain = "WII";
break;
default:
catDomain = m_plugin.PluginMagicWord;
break;
}
const char *requiredCats = m_cat.getString("GENERAL", "required_categories").c_str();
const char *selectedCats = m_cat.getString("GENERAL", "selected_categories").c_str();
const char *hiddenCats = m_cat.getString("GENERAL", "hidden_categories").c_str();
u8 numReqCats = strlen(requiredCats);
u8 numSelCats = strlen(selectedCats);
u8 numHidCats = strlen(hiddenCats);
if(numReqCats != 0 || numSelCats != 0 || numHidCats != 0) // if all 0 skip checking cats and show all games if(numReqCats != 0 || numSelCats != 0 || numHidCats != 0) // if all 0 skip checking cats and show all games
{ {
const char *idCats = m_cat.getString(catDomain, hdr->type == TYPE_PLUGIN? catID : id).c_str(); char idCats[10];
strcpy(idCats, m_cat.getString(catDomain, hdr->type == TYPE_PLUGIN? catID : id).c_str());
u8 numIdCats = strlen(idCats); u8 numIdCats = strlen(idCats);
bool inaCat = false; bool inaCat = false;
bool inHiddenCat = false; bool inHiddenCat = false;

View File

@ -398,8 +398,8 @@ private:
s16 m_downloadBtnKOs; s16 m_downloadBtnKOs;
s16 m_downloadBtnZHCNs; s16 m_downloadBtnZHCNs;
s16 m_downloadBtnAUs; s16 m_downloadBtnAUs;
static s8 _versionDownloaderInit(CMenu *m); static void * _versionDownloaderInit(void *obj);
static s8 _versionTxtDownloaderInit(CMenu *m); static void * _versionTxtDownloaderInit(void *obj);
s8 _versionDownloader(); s8 _versionDownloader();
s8 _versionTxtDownloader(); s8 _versionTxtDownloader();
//Game menu //Game menu
@ -1122,7 +1122,7 @@ private:
void _cleanupBanner(bool gamechange = false); void _cleanupBanner(bool gamechange = false);
void _cleanupVideo(); void _cleanupVideo();
bool _startVideo(); bool _startVideo();
static int _pThread(void *obj); static void * _pThread(void *obj);
void _start_pThread(void); void _start_pThread(void);
void _stop_pThread(void); void _stop_pThread(void);
lwp_t m_thrdPtr; lwp_t m_thrdPtr;
@ -1152,10 +1152,10 @@ private:
void _setThrdMsg(const wstringEx &msg, float progress); void _setThrdMsg(const wstringEx &msg, float progress);
void _setDumpMsg(const wstringEx &msg, float progress, float fileprog); void _setDumpMsg(const wstringEx &msg, float progress, float fileprog);
int _coverDownloader(bool missingOnly); int _coverDownloader(bool missingOnly);
static int _coverDownloaderAll(CMenu *m); static void * _coverDownloaderAll(void *obj);
static int _coverDownloaderMissing(CMenu *m); static void * _coverDownloaderMissing(void *obj);
static bool _downloadProgress(void *obj, int size, int position); static bool _downloadProgress(void *obj, int size, int position);
static int _gametdbDownloader(CMenu *m); static void * _gametdbDownloader(void *obj);
int _gametdbDownloaderAsync(); int _gametdbDownloaderAsync();
static s32 _networkComplete(s32 result, void *usrData); static s32 _networkComplete(s32 result, void *usrData);
@ -1165,8 +1165,8 @@ private:
void LoadView(void); void LoadView(void);
static void _addDiscProgress(int status, int total, void *user_data); static void _addDiscProgress(int status, int total, void *user_data);
static void _ShowProgress(int dumpstat, int dumpprog, int filestat, int fileprog, int files, int folders, const char *tmess, void *user_data); static void _ShowProgress(int dumpstat, int dumpprog, int filestat, int fileprog, int files, int folders, const char *tmess, void *user_data);
static int _gameInstaller(void *obj); static void * _gameInstaller(void *obj);
static int _GCcopyGame(void *obj); static void * _GCcopyGame(void *obj);
bool _searchGamesByID(const char *gameId); bool _searchGamesByID(const char *gameId);
int _GCgameInstaller(); int _GCgameInstaller();
float m_progress; float m_progress;
@ -1179,8 +1179,8 @@ private:
int m_nandexentry; int m_nandexentry;
wstringEx _optBoolToString(int b); wstringEx _optBoolToString(int b);
void _stopSounds(void); void _stopSounds(void);
static int _NandDumper(void *obj); static void * _NandDumper(void *obj);
static int _NandFlasher(void *obj); static void * _NandFlasher(void *obj);
int _FindEmuPart(string &emuPath, bool searchvalid, bool savesnand); int _FindEmuPart(string &emuPath, 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);
@ -1188,13 +1188,13 @@ private:
void _FullNandCheck(void); void _FullNandCheck(void);
void _listEmuNands(const char *path, vector<string> &emuNands); void _listEmuNands(const char *path, vector<string> &emuNands);
static u32 _downloadCheatFileAsync(void *obj); static void * _downloadCheatFileAsync(void *obj);
static u32 _downloadBannerAsync(void *obj); static void * _downloadBannerAsync(void *obj);
static u32 _downloadUrlAsync(void *obj); static void * _downloadUrlAsync(void *obj);
void _playGameSound(void); void _playGameSound(void);
void _stopGameSoundThread(void); void _stopGameSoundThread(void);
static void _gameSoundThread(CMenu *m); static void * _gameSoundThread(void *obj);
static void _load_installed_cioses(); static void _load_installed_cioses();

View File

@ -24,7 +24,7 @@ void CMenu::_showCheatDownload(void)
m_btnMgr.show(m_downloadPBar); m_btnMgr.show(m_downloadPBar);
} }
u32 CMenu::_downloadCheatFileAsync(void *obj) void * CMenu::_downloadCheatFileAsync(void *obj)
{ {
CMenu *m = (CMenu *)obj; CMenu *m = (CMenu *)obj;
if (!m->m_thrdWorking) if (!m->m_thrdWorking)
@ -39,7 +39,7 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
if (m->_initNetwork() < 0) if (m->_initNetwork() < 0)
{ {
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -1; return 0;
} }
u32 bufferSize = 0x080000; // Maximum download size 512kb u32 bufferSize = 0x080000; // Maximum download size 512kb
@ -47,7 +47,7 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
if(buffer == NULL) if(buffer == NULL)
{ {
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -2; return 0;
} }
const char *id = CoverFlow.getId(); const char *id = CoverFlow.getId();
@ -64,7 +64,7 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
} }
free(buffer); free(buffer);
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -3; return 0;
} }
void CMenu::_CheatSettings() void CMenu::_CheatSettings()
@ -176,8 +176,7 @@ void CMenu::_CheatSettings()
m_thrdWorking = true; m_thrdWorking = true;
lwp_t thread = LWP_THREAD_NULL; lwp_t thread = LWP_THREAD_NULL;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_downloadCheatFileAsync, LWP_CreateThread(&thread, _downloadCheatFileAsync, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
while(m_thrdWorking) while(m_thrdWorking)
{ {
_mainLoopCommon(); _mainLoopCommon();

View File

@ -79,6 +79,7 @@ static string countryCode(const string &gameId)
case CONF_LANG_DUTCH: case CONF_LANG_DUTCH:
return "NL"; return "NL";
} }
return "other";
case 'A': case 'A':
switch (CONF_GetArea()) switch (CONF_GetArea())
{ {
@ -335,17 +336,21 @@ bool CMenu::_downloadProgress(void *obj, int size, int position)
return !m->m_thrdStop; return !m->m_thrdStop;
} }
int CMenu::_coverDownloaderAll(CMenu *m) void * CMenu::_coverDownloaderAll(void *obj)
{ {
if (!m->m_thrdWorking) return 0; CMenu *m = static_cast<CMenu *>(obj);
if(!m->m_thrdWorking)
return 0;
m->_coverDownloader(false); m->_coverDownloader(false);
m->m_thrdWorking = false; m->m_thrdWorking = false;
return 0; return 0;
} }
int CMenu::_coverDownloaderMissing(CMenu *m) void * CMenu::_coverDownloaderMissing(void *obj)
{ {
if (!m->m_thrdWorking) return 0; CMenu *m = static_cast<CMenu *>(obj);
if(!m->m_thrdWorking)
return 0;
m->_coverDownloader(true); m->_coverDownloader(true);
m->m_thrdWorking = false; m->m_thrdWorking = false;
return 0; return 0;
@ -434,22 +439,20 @@ int CMenu::_initNetwork()
int CMenu::_coverDownloader(bool missingOnly) int CMenu::_coverDownloader(bool missingOnly)
{ {
vector<string> coverIDList;
int count = 0, countFlat = 0; int count = 0, countFlat = 0;
float listWeight = missingOnly ? 0.125f : 0.f; // 1/8 of the progress bar for testing the PNGs we already have float listWeight = missingOnly ? 0.125f : 0.f; // 1/8 of the progress bar for testing the PNGs we already have
float dlWeight = 1.f - listWeight; float dlWeight = 1.f - listWeight;
u32 bufferSize = 0x280000; // Maximum download size 2 MB Config m_newID;
u8 *buffer = (u8*)MEM2_alloc(bufferSize); m_newID.load(fmt("%s/newid.ini", m_settingsDir.c_str()));
if(buffer == NULL)
GameTDB c_gameTDB;
if(m_settingsDir.size() > 0)
{ {
LWP_MutexLock(m_mutex); c_gameTDB.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
_setThrdMsg(_t("dlmsg27", L"Not enough memory!"), 1.f); c_gameTDB.SetLanguageCode(m_curLanguage.c_str());
LWP_MutexUnlock(m_mutex);
m_thrdWorking = false;
return 0;
} }
bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true); bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true);
vector<string> fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|'); vector<string> fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|');
@ -460,20 +463,15 @@ int CMenu::_coverDownloader(bool missingOnly)
u32 nbSteps = m_gameList.size(); u32 nbSteps = m_gameList.size();
u32 step = 0; u32 step = 0;
GameTDB c_gameTDB;
if (m_settingsDir.size() > 0)
{
c_gameTDB.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
c_gameTDB.SetLanguageCode(m_curLanguage.c_str());
}
char path[256]; char path[256];
char id[7]; char id[7];
vector<string> coverIDList;
/* create list of cover ID's that need downloading */ /* create list of cover ID's that need downloading */
if (m_coverDLGameId.empty()) if(m_coverDLGameId.empty())
{ {
coverIDList.reserve(m_gameList.size()); coverIDList.reserve(m_gameList.size());
for (u32 i = 0; i < m_gameList.size() && !m_thrdStop; ++i) for(u32 i = 0; i < m_gameList.size() && !m_thrdStop; ++i)
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg7", L"Listing covers to download..."), listWeight * (float)step / (float)nbSteps); _setThrdMsg(_t("dlmsg7", L"Listing covers to download..."), listWeight * (float)step / (float)nbSteps);
@ -489,7 +487,7 @@ int CMenu::_coverDownloader(bool missingOnly)
strncpy(id, m_gameList[i].id, 6); strncpy(id, m_gameList[i].id, 6);
strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), id), 255); strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), id), 255);
} }
if(!missingOnly || (strlen(id) > 0 && !CoverFlow.fullCoverCached(id) && strlen(path) > 0 && !checkPNGFile(path))) if(!missingOnly || (strlen(path) > 0 && fsop_FileExist(path)))
{ {
if(strlen(id) > 0) if(strlen(id) > 0)
coverIDList.push_back(id); coverIDList.push_back(id);
@ -500,29 +498,48 @@ int CMenu::_coverDownloader(bool missingOnly)
coverIDList.push_back(m_coverDLGameId); coverIDList.push_back(m_coverDLGameId);
u32 n = coverIDList.size(); u32 n = coverIDList.size();
u32 bufferSize = 0x280000; // Maximum download size 2 MB
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
if(buffer == NULL)
{
LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg27", L"Not enough memory!"), 1.f);
LWP_MutexUnlock(m_mutex);
m_thrdWorking = false;
if(c_gameTDB.IsLoaded())
c_gameTDB.CloseFile();
coverIDList.clear();
if(m_newID.loaded())
m_newID.unload();
return 0;
}
/* initialize network connection */ /* initialize network connection */
if (n > 0 && !m_thrdStop) if(n > 0 && !m_thrdStop)
{ {
step = 0; step = 0;
nbSteps = 1 + n * 2; nbSteps = 1 + n * 2;
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg1", L"Initializing network..."), listWeight + dlWeight * (float)step / (float)nbSteps); _setThrdMsg(_t("dlmsg1", L"Initializing network..."), listWeight + dlWeight * (float)step / (float)nbSteps);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
if (_initNetwork() < 0) if(_initNetwork() < 0)
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg2", L"Network initialization failed!"), 1.f); _setThrdMsg(_t("dlmsg2", L"Network initialization failed!"), 1.f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
m_thrdWorking = false; m_thrdWorking = false;
free(buffer); MEM2_free(buffer);
if(c_gameTDB.IsLoaded())
c_gameTDB.CloseFile();
coverIDList.clear();
if(m_newID.loaded())
m_newID.unload();
return 0; return 0;
} }
m_thrdStepLen = dlWeight / (float)nbSteps; m_thrdStepLen = dlWeight / (float)nbSteps;
/* download covers in the list */ /* download covers in the list */
Config m_newID;
m_newID.load(fmt("%s/newid.ini", m_settingsDir.c_str()));
u32 CoverType = 0; u32 CoverType = 0;
for(u32 i = 0; i < coverIDList.size() && !m_thrdStop; ++i) for(u32 i = 0; i < coverIDList.size() && !m_thrdStop; ++i)
@ -546,8 +563,10 @@ int CMenu::_coverDownloader(bool missingOnly)
} }
} }
/* try downloading the cover 4 times but a different type each time.*/
for(int p = 0; p < 4; ++p) for(int p = 0; p < 4; ++p)
{ {
/* the cover type (BOX, CBOX, FLAT, CFLAT) is different each time based on m_downloadPrioVal */
switch(p) switch(p)
{ {
case 0: case 0:
@ -577,20 +596,23 @@ int CMenu::_coverDownloader(bool missingOnly)
/* if cover png doesn't already exist download it */ /* if cover png doesn't already exist download it */
if(strlen(path) > 0 && !checkPNGFile(path)) if(strlen(path) > 0 && !checkPNGFile(path))
{ {
for(u32 j = 0; !success && j < fmtURLBox.size() && !m_thrdStop; ++j) /* each fmtURL may have more than one URL */
for(u8 j = 0; !success && j < fmtURLBox.size() && !m_thrdStop; ++j)
{ {
url = makeURL(fmtURLBox[j], coverID, countryCode(coverID)); url = makeURL(fmtURLBox[j], coverID, countryCode(coverID));
if (j == 0) ++step; if (j == 0) ++step;
m_thrdStep = listWeight + dlWeight * (float)step / (float)nbSteps; m_thrdStep = listWeight + dlWeight * (float)step / (float)nbSteps;
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep); // add in n count decreasing
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str()), m_thrdStep);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this); download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
for(int o = 0; o < 12; ++o) for(int o = 0; o < 12; ++o)
{ {
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 )
{ {
@ -683,7 +705,7 @@ 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)
@ -1125,11 +1147,6 @@ int CMenu::_coverDownloader(bool missingOnly)
} }
++step; ++step;
} }
if(c_gameTDB.IsLoaded())
c_gameTDB.CloseFile();
coverIDList.clear();
if(m_newID.loaded())
m_newID.unload();
} }
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);
if (countFlat == 0) if (countFlat == 0)
@ -1137,8 +1154,14 @@ int CMenu::_coverDownloader(bool missingOnly)
else else
_setThrdMsg(wfmt(_fmt("dlmsg9", L"%i/%i files downloaded. %i are front covers only."), count + countFlat, n, countFlat), 1.f); _setThrdMsg(wfmt(_fmt("dlmsg9", L"%i/%i files downloaded. %i are front covers only."), count + countFlat, n, countFlat), 1.f);
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
m_thrdWorking = false; m_thrdWorking = false;
MEM2_free(buffer); MEM2_free(buffer);
if(c_gameTDB.IsLoaded())
c_gameTDB.CloseFile();
coverIDList.clear();
if(m_newID.loaded())
m_newID.unload();
return 0; return 0;
} }
@ -1197,11 +1220,9 @@ void CMenu::_download(string gameId)
m_thrdWorking = true; m_thrdWorking = true;
gameId.clear(); gameId.clear();
if (dlAll) if (dlAll)
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_coverDownloaderAll, LWP_CreateThread(&thread, _coverDownloaderAll, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
else else
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_coverDownloaderMissing, LWP_CreateThread(&thread, _coverDownloaderMissing, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
} }
else if (m_btnMgr.selected(m_downloadBtnPrioM) && !m_thrdWorking) else if (m_btnMgr.selected(m_downloadBtnPrioM) && !m_thrdWorking)
{ {
@ -1428,8 +1449,7 @@ void CMenu::_download(string gameId)
_updateGametdb = true; _updateGametdb = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_gametdbDownloader, LWP_CreateThread(&thread, _gametdbDownloader, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
} }
else if (m_btnMgr.selected(m_downloadBtnCancel)) else if (m_btnMgr.selected(m_downloadBtnCancel))
{ {
@ -1604,10 +1624,13 @@ void CMenu::_textDownload(void)
m_btnMgr.setText(m_downloadBtnBack, _t("dl18", L"Back")); m_btnMgr.setText(m_downloadBtnBack, _t("dl18", L"Back"));
} }
s8 CMenu::_versionTxtDownloaderInit(CMenu *m) //Handler to download versions txt file void * CMenu::_versionTxtDownloaderInit(void *obj) //Handler to download versions txt file
{ {
if (!m->m_thrdWorking) return 0; CMenu *m = static_cast<CMenu *>(obj);
return m->_versionTxtDownloader(); if(!m->m_thrdWorking)
return 0;
m->_versionTxtDownloader();
return 0;
} }
s8 CMenu::_versionTxtDownloader() // code to download new version txt file s8 CMenu::_versionTxtDownloader() // code to download new version txt file
@ -1694,11 +1717,13 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
return 0; return 0;
} }
s8 CMenu::_versionDownloaderInit(CMenu *m) //Handler to download new dol void * CMenu::_versionDownloaderInit(void *obj) //Handler to download new dol
{ {
if (!m->m_thrdWorking) CMenu *m = static_cast<CMenu *>(obj);
if(!m->m_thrdWorking)
return 0; return 0;
return m->_versionDownloader(); m->_versionDownloader();
return 0;
} }
s8 CMenu::_versionDownloader() // code to download new version s8 CMenu::_versionDownloader() // code to download new version
@ -1887,10 +1912,13 @@ out:
return 0; return 0;
} }
int CMenu::_gametdbDownloader(CMenu *m) void * CMenu::_gametdbDownloader(void *obj)
{ {
if (!m->m_thrdWorking) return 0; CMenu *m = static_cast<CMenu *>(obj);
return m->_gametdbDownloaderAsync(); if(!m->m_thrdWorking)
return 0;
m->_gametdbDownloaderAsync();
return 0;
} }
int CMenu::_gametdbDownloaderAsync() int CMenu::_gametdbDownloaderAsync()
@ -1983,10 +2011,10 @@ int CMenu::_gametdbDownloaderAsync()
const char *banner_url = NULL; const char *banner_url = NULL;
const char *banner_url_id3 = NULL; const char *banner_url_id3 = NULL;
char *banner_location = NULL; char *banner_location = NULL;
u32 CMenu::_downloadBannerAsync(void *obj) void * CMenu::_downloadBannerAsync(void *obj)
{ {
CMenu *m = (CMenu *)obj; CMenu *m = (CMenu *)obj;
if (!m->m_thrdWorking) if(!m->m_thrdWorking)
return 0; return 0;
m->m_thrdStop = false; m->m_thrdStop = false;
@ -1995,13 +2023,13 @@ u32 CMenu::_downloadBannerAsync(void *obj)
m->_setThrdMsg(m->_t("cfgbnr7", L"Downloading banner..."), 0); m->_setThrdMsg(m->_t("cfgbnr7", L"Downloading banner..."), 0);
LWP_MutexUnlock(m->m_mutex); LWP_MutexUnlock(m->m_mutex);
if (m->_initNetwork() < 0) if(m->_initNetwork() < 0)
{ {
LWP_MutexLock(m->m_mutex); LWP_MutexLock(m->m_mutex);
m->_setThrdMsg(m->_t("dlmsg2", L"Network initialization failed!"), 1.f); m->_setThrdMsg(m->_t("dlmsg2", L"Network initialization failed!"), 1.f);
LWP_MutexUnlock(m->m_mutex); LWP_MutexUnlock(m->m_mutex);
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -1; return 0;
} }
u32 bufferSize = 0x400000; /* 4mb max */ u32 bufferSize = 0x400000; /* 4mb max */
@ -2012,14 +2040,14 @@ u32 CMenu::_downloadBannerAsync(void *obj)
m->_setThrdMsg(m->_t("dlmsg27", L"Not enough memory!"), 1.f); m->_setThrdMsg(m->_t("dlmsg27", L"Not enough memory!"), 1.f);
LWP_MutexUnlock(m->m_mutex); LWP_MutexUnlock(m->m_mutex);
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -2; return 0;
} }
block banner = downloadfile(buffer, bufferSize, banner_url, CMenu::_downloadProgress, m); block banner = downloadfile(buffer, bufferSize, banner_url, CMenu::_downloadProgress, m);
if(banner.data == NULL || banner.size < 0x5000) if(banner.data == NULL || banner.size < 0x5000)
banner = downloadfile(buffer, bufferSize, banner_url_id3, CMenu::_downloadProgress, m); banner = downloadfile(buffer, bufferSize, banner_url_id3, CMenu::_downloadProgress, m);
/* minimum 50kb */ /* minimum 50kb */
if (banner.data != NULL && banner.size > 51200 && banner.data[0] != '<') if(banner.data != NULL && banner.size > 51200 && banner.data[0] != '<')
{ {
if(banner_location != NULL) if(banner_location != NULL)
fsop_WriteFile(banner_location, banner.data, banner.size); fsop_WriteFile(banner_location, banner.data, banner.size);
@ -2037,8 +2065,9 @@ u32 CMenu::_downloadBannerAsync(void *obj)
LWP_MutexUnlock(m->m_mutex); LWP_MutexUnlock(m->m_mutex);
m->m_thrdWorking = false; m->m_thrdWorking = false;
free(buffer); free(buffer);
return -3; return 0;
} }
return 0;
} }
static const char *GAME_BNR_ID = "{gameid}"; static const char *GAME_BNR_ID = "{gameid}";
@ -2069,8 +2098,7 @@ void CMenu::_downloadBnr(const char *gameID)
m_thrdWorking = true; m_thrdWorking = true;
lwp_t thread = LWP_THREAD_NULL; lwp_t thread = LWP_THREAD_NULL;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_downloadBannerAsync, LWP_CreateThread(&thread, _downloadBannerAsync, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
wstringEx prevMsg; wstringEx prevMsg;
while(m_thrdWorking) while(m_thrdWorking)
@ -2137,7 +2165,7 @@ void CMenu::_downloadBnr(const char *gameID)
} }
const char *url_dl = NULL; const char *url_dl = NULL;
void CMenu::_downloadUrl(const char *url, u8 **dl_file, u32 *dl_size) void CMenu::_downloadUrl(const char *url, u8 **dl_file, u32 *dl_size)// nothing uses this
{ {
m_file = NULL; m_file = NULL;
m_filesize = 0; m_filesize = 0;
@ -2152,8 +2180,7 @@ void CMenu::_downloadUrl(const char *url, u8 **dl_file, u32 *dl_size)
m_thrdWorking = true; m_thrdWorking = true;
lwp_t thread = LWP_THREAD_NULL; lwp_t thread = LWP_THREAD_NULL;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_downloadUrlAsync, LWP_CreateThread(&thread, _downloadUrlAsync, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
wstringEx prevMsg; wstringEx prevMsg;
while(m_thrdWorking) while(m_thrdWorking)
@ -2212,7 +2239,7 @@ void CMenu::_downloadUrl(const char *url, u8 **dl_file, u32 *dl_size)
url_dl = url; url_dl = url;
} }
u32 CMenu::_downloadUrlAsync(void *obj) void * CMenu::_downloadUrlAsync(void *obj)
{ {
CMenu *m = (CMenu *)obj; CMenu *m = (CMenu *)obj;
if (!m->m_thrdWorking) if (!m->m_thrdWorking)
@ -2227,7 +2254,7 @@ u32 CMenu::_downloadUrlAsync(void *obj)
if(m->_initNetwork() < 0 || url_dl == NULL) if(m->_initNetwork() < 0 || url_dl == NULL)
{ {
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -1; return 0;
} }
u32 bufferSize = 0x400000; /* 4mb max */ u32 bufferSize = 0x400000; /* 4mb max */
@ -2235,7 +2262,7 @@ u32 CMenu::_downloadUrlAsync(void *obj)
if(m->m_buffer == NULL) if(m->m_buffer == NULL)
{ {
m->m_thrdWorking = false; m->m_thrdWorking = false;
return -2; return 0;
} }
block file = downloadfile(m->m_buffer, bufferSize, url_dl, CMenu::_downloadProgress, m); block file = downloadfile(m->m_buffer, bufferSize, url_dl, CMenu::_downloadProgress, m);
DCFlushRange(m->m_buffer, bufferSize); DCFlushRange(m->m_buffer, bufferSize);

View File

@ -1209,8 +1209,9 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
else else
{ {
// otherwise copy cheat file from wiiflow cheat folder to Game folder // otherwise copy cheat file from wiiflow cheat folder to Game folder
snprintf(CheatPath, sizeof(CheatPath), "%s%s.gct", GC_Path, id); char GC_game_dir[strlen(GC_Path) + 11];
fsop_CopyFile(fmt("%s/%s.gct", m_cheatDir.c_str(), id), CheatPath, NULL, NULL); snprintf(GC_game_dir, sizeof(GC_game_dir), "%s%s.gct", GC_Path, id);
fsop_CopyFile(fmt("%s/%s.gct", m_cheatDir.c_str(), id), GC_game_dir, NULL, NULL);
//might add err msg here if copy error //might add err msg here if copy error
} }
} }
@ -1483,7 +1484,12 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
u8 patchVidMode = min(m_gcfg2.getUInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); u8 patchVidMode = min(m_gcfg2.getUInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
int aspectRatio = min(m_gcfg2.getUInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1) - 1;// -1,0,1 int aspectRatio = min(m_gcfg2.getUInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1) - 1;// -1,0,1
const char *rtrn = m_gcfg2.getBool(id, "returnto", true) ? m_cfg.getString("GENERAL", "returnto").c_str() : NULL;
//u32 returnTo = 0;
//const char *rtrn = m_cfg.getString("GENERAL", "returnto").c_str();
//if(strlen(rtrn) == 4)
// returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
const char *rtrn = m_cfg.getString("GENERAL", "returnto").c_str();
u32 returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3]; u32 returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
u8 *cheatFile = NULL; u8 *cheatFile = NULL;
@ -1696,7 +1702,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
int language = min(m_gcfg2.getUInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u); int language = min(m_gcfg2.getUInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u);
language = (language == 0) ? min(m_cfg.getUInt("GENERAL", "game_language", 0), ARRAY_SIZE(CMenu::_languages) - 1u) : language; language = (language == 0) ? min(m_cfg.getUInt("GENERAL", "game_language", 0), ARRAY_SIZE(CMenu::_languages) - 1u) : language;
const char *rtrn = m_cfg.getString("GENERAL", "returnto", "").c_str(); const char *rtrn = m_cfg.getString("GENERAL", "returnto").c_str();
u32 returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
int aspectRatio = min(m_gcfg2.getUInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u) - 1; int aspectRatio = min(m_gcfg2.getUInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u) - 1;
u8 patchVidMode = min(m_gcfg2.getUInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); u8 patchVidMode = min(m_gcfg2.getUInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
@ -1723,9 +1731,10 @@ 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;
char testpath[MAX_FAT_PATH]; //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.c_str());
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
if(!_checkSave(id, false))//if save is not on emunand if(!_checkSave(id, false))//if save is not on emunand
@ -1774,7 +1783,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
u8 *cheatFile = NULL; u8 *cheatFile = NULL;
u8 *gameconfig = NULL; u8 *gameconfig = NULL;
u32 cheatSize = 0, gameconfigSize = 0, returnTo = 0; u32 cheatSize = 0, gameconfigSize = 0;
m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1);
m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL));
@ -1789,8 +1798,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str())); _loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
_loadFile(gameconfig, gameconfigSize, m_txtCheatDir.c_str(), "gameconfig.txt"); _loadFile(gameconfig, gameconfigSize, m_txtCheatDir.c_str(), "gameconfig.txt");
if(strlen(rtrn) == 4)
returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
int userIOS = m_gcfg2.getInt(id, "ios", 0); int userIOS = m_gcfg2.getInt(id, "ios", 0);
int gameIOS = dvd && !neek2o() ? userIOS : GetRequestedGameIOS(hdr); int gameIOS = dvd && !neek2o() ? userIOS : GetRequestedGameIOS(hdr);
@ -1971,8 +1978,9 @@ struct IMD5Header
} ATTRIBUTE_PACKED; } ATTRIBUTE_PACKED;
// loads game banner and sound to be played by mainloop // loads game banner and sound to be played by mainloop
void CMenu::_gameSoundThread(CMenu *m) void * CMenu::_gameSoundThread(void *obj)
{ {
CMenu *m = (CMenu*)obj;
m->m_soundThrdBusy = true; m->m_soundThrdBusy = true;
m->m_gamesound_changed = false; m->m_gamesound_changed = false;
CurrentBanner.ClearBanner();//clear current banner from memory CurrentBanner.ClearBanner();//clear current banner from memory
@ -2015,7 +2023,7 @@ void CMenu::_gameSoundThread(CMenu *m)
if(m->m_gameSound.IsLoaded()) if(m->m_gameSound.IsLoaded())
m->m_gamesound_changed = true; m->m_gamesound_changed = true;
m->m_soundThrdBusy = false; m->m_soundThrdBusy = false;
return; return NULL;
} }
} }
else else
@ -2066,7 +2074,7 @@ void CMenu::_gameSoundThread(CMenu *m)
if(m->m_gameSound.IsLoaded()) if(m->m_gameSound.IsLoaded())
m->m_gamesound_changed = true; m->m_gamesound_changed = true;
m->m_soundThrdBusy = false; m->m_soundThrdBusy = false;
return; return NULL;
} }
if(custom_bnr_file == NULL)/* no custom and not GC game try cached banner id6 only*/ if(custom_bnr_file == NULL)/* no custom and not GC game try cached banner id6 only*/
{ {
@ -2105,7 +2113,7 @@ void CMenu::_gameSoundThread(CMenu *m)
m_banner.DeleteBanner(); m_banner.DeleteBanner();
CurrentBanner.ClearBanner(); CurrentBanner.ClearBanner();
m->m_soundThrdBusy = false; m->m_soundThrdBusy = false;
return; return NULL;
} }
//save new wii or channel banner to cache folder, gc and custom banners are not cached //save new wii or channel banner to cache folder, gc and custom banners are not cached
if(cached_bnr_file == NULL && custom_bnr_file == NULL) if(cached_bnr_file == NULL && custom_bnr_file == NULL)
@ -2131,7 +2139,7 @@ void CMenu::_gameSoundThread(CMenu *m)
m->m_gameSound.FreeMemory(); m->m_gameSound.FreeMemory();
m_banner.DeleteBanner(); m_banner.DeleteBanner();
m->m_soundThrdBusy = false; m->m_soundThrdBusy = false;
return; return NULL;
} }
} }
else else
@ -2152,6 +2160,7 @@ void CMenu::_gameSoundThread(CMenu *m)
m->m_gameSound.FreeMemory(); m->m_gameSound.FreeMemory();
} }
m->m_soundThrdBusy = false; m->m_soundThrdBusy = false;
return NULL;
} }
u8 *GameSoundStack = NULL; u8 *GameSoundStack = NULL;
@ -2166,7 +2175,7 @@ void CMenu::_playGameSound(void)// starts banner and gamesound loading thread
if(m_gameSoundThread != LWP_THREAD_NULL) if(m_gameSoundThread != LWP_THREAD_NULL)
_stopGameSoundThread(); _stopGameSoundThread();
GameSoundStack = (u8*)MEM2_lo_alloc(GameSoundSize); GameSoundStack = (u8*)MEM2_lo_alloc(GameSoundSize);
LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void*)this, GameSoundStack, GameSoundSize, 60); LWP_CreateThread(&m_gameSoundThread, _gameSoundThread, this, GameSoundStack, GameSoundSize, 60);
} }
void CMenu::_stopGameSoundThread()//stops banner and gamesound loading thread void CMenu::_stopGameSoundThread()//stops banner and gamesound loading thread

View File

@ -69,6 +69,7 @@ void CMenu::ScanInput()
WPAD_ScanPads(); WPAD_ScanPads();
PAD_ScanPads(); PAD_ScanPads();
DS3_ScanPads(); DS3_ScanPads();
//drc
ButtonsPressed(); ButtonsPressed();
ButtonsHeld(); ButtonsHeld();
@ -130,6 +131,7 @@ void CMenu::ScanInput()
ShowNextZone(); ShowNextZone();
ShowGameZone(); ShowGameZone();
} }
extern "C" { extern bool shutdown; }; extern "C" { extern bool shutdown; };
void CMenu::ButtonsPressed() void CMenu::ButtonsPressed()
{ {
@ -150,6 +152,7 @@ void CMenu::ButtonsPressed()
wii_btnsPressed[chan] = WPAD_ButtonsDown(chan); wii_btnsPressed[chan] = WPAD_ButtonsDown(chan);
gc_btnsPressed |= PAD_ButtonsDown(chan); gc_btnsPressed |= PAD_ButtonsDown(chan);
wupc_btnsPressed[chan] = WUPC_ButtonsDown(chan); wupc_btnsPressed[chan] = WUPC_ButtonsDown(chan);
//drc
} }
} }
} }
@ -162,6 +165,7 @@ void CMenu::ButtonsHeld()
wii_btnsHeld[chan] = WPAD_ButtonsHeld(chan); wii_btnsHeld[chan] = WPAD_ButtonsHeld(chan);
gc_btnsHeld |= PAD_ButtonsHeld(chan); gc_btnsHeld |= PAD_ButtonsHeld(chan);
wupc_btnsHeld[chan] = WUPC_ButtonsHeld(chan); wupc_btnsHeld[chan] = WUPC_ButtonsHeld(chan);
//drc
} }
} }
@ -238,8 +242,7 @@ void CMenu::LeftStick()
} }
else else
{ {
if(pointerhidedelay[chan] > 0 && !wii_btnsHeld[chan] && !wii_btnsPressed[chan] if(pointerhidedelay[chan] > 0 && !wii_btnsHeld[chan] && !wii_btnsPressed[chan] && !gc_btnsHeld && !gc_btnsPressed)
&& !gc_btnsHeld && !gc_btnsPressed)
pointerhidedelay[chan]--; pointerhidedelay[chan]--;
} }
if (pointerhidedelay[chan] == 0) if (pointerhidedelay[chan] == 0)
@ -310,9 +313,9 @@ bool CMenu::wii_btnRepeat(u8 btn)
else else
m_wpadDownDelay = 0; m_wpadDownDelay = 0;
} }
else if(btn == WBTN_LEFT || DBTN_LEFT) else if(btn == WBTN_LEFT)
{ {
if(WBTN_LEFT_HELD || DBTN_LEFT_PRESSED) if(WBTN_LEFT_HELD)
{ {
if(m_wpadLeftDelay == 0 || m_wpadLeftDelay >= g_repeatDelay) if(m_wpadLeftDelay == 0 || m_wpadLeftDelay >= g_repeatDelay)
b = true; b = true;

View File

@ -204,20 +204,19 @@ void CMenu::_FullNandCheck(void)
bool need_config = false; bool need_config = false;
bool need_miis = false; bool need_miis = false;
char testpath[MAX_FAT_PATH]; string testpath;
char basepath[MAX_FAT_PATH]; string basepath = DeviceName[emuPart] + ':' + emuPath;
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str());
//check config files //check config files
snprintf(testpath, sizeof(testpath), "%s/shared2/sys/SYSCONF", basepath); testpath.assign(basepath + "/shared2/sys/SYSCONF");
if(!fsop_FileExist(testpath)) if(!fsop_FileExist(testpath.c_str()))
need_config = true; need_config = true;
snprintf(testpath, sizeof(testpath), "%s/title/00000001/00000002/data/setting.txt", basepath); testpath.assign(basepath + "/title/00000001/00000002/data/setting.txt");
if(!fsop_FileExist(testpath)) if(!fsop_FileExist(testpath.c_str()))
need_config = true; need_config = true;
// Check Mii's // Check Mii's
snprintf(testpath, sizeof(testpath), "%s/shared2/menu/FaceLib/RFL_DB.dat", basepath); testpath.assign(basepath + "/shared2/menu/FaceLib/RFL_DB.dat");
if(!fsop_FileExist(testpath)) if(!fsop_FileExist(testpath.c_str()))
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
@ -623,7 +622,7 @@ int CMenu::_NandEmuCfg(void)
m_thrdStop = false; m_thrdStop = false;
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdWorking = true; m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40); LWP_CreateThread(&thread, _NandDumper, this, 0, 32768, 40);
} }
} }
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandSelectP) || m_btnMgr.selected(m_nandemuBtnNandSelectM))) else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandSelectP) || m_btnMgr.selected(m_nandemuBtnNandSelectM)))
@ -738,7 +737,7 @@ int CMenu::_FlashSave(string gameId)
m_thrdStop = false; m_thrdStop = false;
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdWorking = true; m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandFlasher, (void *)this, 0, 32768, 40); LWP_CreateThread(&thread, _NandFlasher, this, 0, 32768, 40);
} }
if(!m_thrdWorking && (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack)))) if(!m_thrdWorking && (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack))))
break; break;
@ -848,7 +847,7 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
m_thrdStop = false; m_thrdStop = false;
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdWorking = true; m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40); LWP_CreateThread(&thread, _NandDumper, this, 0, 32768, 40);
} }
else if(BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnDisable))//create new save else if(BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnDisable))//create new save
{ {
@ -887,7 +886,7 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
return 1; return 1;
} }
int CMenu::_NandFlasher(void *obj) void * CMenu::_NandFlasher(void *obj)
{ {
CMenu &m = *(CMenu *)obj; CMenu &m = *(CMenu *)obj;
@ -928,7 +927,7 @@ int CMenu::_NandFlasher(void *obj)
return 0; return 0;
} }
int CMenu::_NandDumper(void *obj) void * CMenu::_NandDumper(void *obj)
{ {
CMenu &m = *(CMenu *)obj; CMenu &m = *(CMenu *)obj;

View File

@ -47,8 +47,7 @@ void CMenu::_system()
m_btnMgr.setProgress(m_downloadPBar, 0.f); m_btnMgr.setProgress(m_downloadPBar, 0.f);
m_thrdStop = false; m_thrdStop = false;
m_thrdWorking = true; m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_versionTxtDownloaderInit, LWP_CreateThread(&thread, _versionTxtDownloaderInit, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
} }
if (m_showtimer > 0 && !m_thrdWorking) if (m_showtimer > 0 && !m_thrdWorking)
{ {
@ -113,8 +112,7 @@ void CMenu::_system()
m_data_update_url = fmt("%s/r%i/data.zip", ("http://nintendont.gxarena.com/banners"), newVer); m_data_update_url = fmt("%s/r%i/data.zip", ("http://nintendont.gxarena.com/banners"), newVer);
m_showtimer = 120; m_showtimer = 120;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_versionDownloaderInit, LWP_CreateThread(&thread, _versionDownloaderInit, this, downloadStack, downloadStackSize, 40);
(void *)this, downloadStack, downloadStackSize, 40);
if (m_exit && !m_thrdWorking) if (m_exit && !m_thrdWorking)
{ {
m_thrdStop = true; m_thrdStop = true;

View File

@ -342,7 +342,7 @@ int getTID(const char *path, u64 *tid)
return 0; return 0;
} }
int CMenu::_pThread(void *obj) void * CMenu::_pThread(void *obj)
{ {
CMenu *m = (CMenu*)obj; CMenu *m = (CMenu*)obj;
while(m->m_thrdInstalling) while(m->m_thrdInstalling)
@ -381,7 +381,7 @@ void CMenu::_start_pThread(void)
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdWritten = 0; m_thrdWritten = 0;
m_thrdTotal = 0; m_thrdTotal = 0;
LWP_CreateThread(&m_thrdPtr, (void *(*)(void *))_pThread, (void*)this, 0, 8 * 1024, 64); LWP_CreateThread(&m_thrdPtr, _pThread, this, 0, 8 * 1024, 64);
} }
void CMenu::_stop_pThread(void) void CMenu::_stop_pThread(void)

View File

@ -106,7 +106,7 @@ void CMenu::GC_Messenger(int message, int info, char *cinfo)
m_thrdMessageAdded = true; m_thrdMessageAdded = true;
} }
int CMenu::_gameInstaller(void *obj) void * CMenu::_gameInstaller(void *obj)
{ {
CMenu &m = *(CMenu *)obj; CMenu &m = *(CMenu *)obj;
int ret; int ret;
@ -115,7 +115,7 @@ int CMenu::_gameInstaller(void *obj)
if(!WBFS_Mounted()) if(!WBFS_Mounted())
{ {
m.m_thrdWorking = false; m.m_thrdWorking = false;
return -1; return NULL;
} }
u64 comp_size = 0, real_size = 0; u64 comp_size = 0, real_size = 0;
f32 free, used; f32 free, used;
@ -127,7 +127,7 @@ int CMenu::_gameInstaller(void *obj)
m._setThrdMsg(wfmt(m._fmt("wbfsop10", L"Not enough space: %lld blocks needed, %i available"), comp_size, free), 0.f); m._setThrdMsg(wfmt(m._fmt("wbfsop10", L"Not enough space: %lld blocks needed, %i available"), comp_size, free), 0.f);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
//m.m_thrdWorking = false; //m.m_thrdWorking = false;
ret = -1; //ret = -1;
} }
else else
{ {
@ -137,7 +137,7 @@ int CMenu::_gameInstaller(void *obj)
ret = WBFS_AddGame(_addDiscProgress, obj); ret = WBFS_AddGame(_addDiscProgress, obj);
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
if (ret == 0) if(ret == 0)
m._setThrdMsg(m._t("wbfsop8", L"Game installed, press B to exit."), 1.f); m._setThrdMsg(m._t("wbfsop8", L"Game installed, press B to exit."), 1.f);
else else
m._setThrdMsg(m._t("wbfsop9", L"An error has occurred"), 1.f); m._setThrdMsg(m._t("wbfsop9", L"An error has occurred"), 1.f);
@ -146,7 +146,7 @@ int CMenu::_gameInstaller(void *obj)
} }
WBFS_Close(); WBFS_Close();
m.m_thrdWorking = false; m.m_thrdWorking = false;
return ret; return NULL;
} }
int CMenu::_GCgameInstaller() int CMenu::_GCgameInstaller()
@ -213,7 +213,7 @@ int CMenu::_GCgameInstaller()
return ret; return ret;
} }
int CMenu::_GCcopyGame(void *obj) void * CMenu::_GCcopyGame(void *obj)
{ {
CMenu &m = *(CMenu *)obj; CMenu &m = *(CMenu *)obj;
@ -345,7 +345,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
m_thrdWorking = true; m_thrdWorking = true;
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
LWP_CreateThread(&thread, (void *(*)(void *))_gameInstaller, (void *)this, 0, 8 * 1024, 64); LWP_CreateThread(&thread, _gameInstaller, this, 0, 8 * 1024, 64);
} }
else if(Disc_IsGC() == 0) else if(Disc_IsGC() == 0)
{ {

View File

@ -235,7 +235,7 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, const char *Device, u32
continue; continue;
} }
memset((void*)&ListElement, 0, sizeof(dir_discHdr)); memset((void*)&ListElement, 0, sizeof(dir_discHdr));
strncpy(ListElement.id, PLUGIN, 6); memcpy(ListElement.id, PLUGIN, 6);
ListElement.casecolor = Plugins.back().caseColor; ListElement.casecolor = Plugins.back().caseColor;
mbstowcs(ListElement.title, GameName, 63); mbstowcs(ListElement.title, GameName, 63);
strncpy(ListElement.path, GameDomain, sizeof(ListElement.path)); strncpy(ListElement.path, GameDomain, sizeof(ListElement.path));

View File

@ -68,7 +68,7 @@ bool ZipFile::ExtractAll(const char *dest)
return false; return false;
char writepath[1024]; char writepath[1024];
char filename[1024]; char filename[256];
memset(filename, 0, sizeof(filename)); memset(filename, 0, sizeof(filename));
int ret = unzGoToFirstFile(File); int ret = unzGoToFirstFile(File);