-fixed too short help and synopsis (issue 146)

-cleaned up and speeded up some stuff
This commit is contained in:
fix94.1 2012-11-01 16:39:42 +00:00
parent 7e0fa2417c
commit f82408249c
23 changed files with 210 additions and 240 deletions

13
source/const_str.hpp Normal file
View File

@ -0,0 +1,13 @@
#ifndef _CONST_STR_HPP_
#define _CONST_STR_HPP_
#include "wstringEx/wstringEx.hpp"
#include "gui/text.hpp"
#include "defines.h"
#include "svnrev.h"
static const string &VERSION_STRING = sfmt("%s (%s-r%s)", APP_NAME, APP_VERSION, SVN_REV);
static const wstringEx SVN_REV_W(SVN_REV);
#endif

View File

@ -100,7 +100,7 @@ u32 fsop_GetFolderKb(const char *source)
return ret; return ret;
} }
u32 fsop_GetFreeSpaceKb(char *path) // Return free kb on the device passed u32 fsop_GetFreeSpaceKb(const char *path) // Return free kb on the device passed
{ {
struct statvfs s; struct statvfs s;

View File

@ -11,7 +11,7 @@ typedef void (*progress_callback_t)(int status,int total,void *user_data);
bool fsop_GetFileSizeBytes(char *path, size_t *filesize); bool fsop_GetFileSizeBytes(char *path, size_t *filesize);
u64 fsop_GetFolderBytes(const char *source); u64 fsop_GetFolderBytes(const char *source);
u32 fsop_GetFolderKb(const char *source); u32 fsop_GetFolderKb(const char *source);
u32 fsop_GetFreeSpaceKb(char *path); u32 fsop_GetFreeSpaceKb(const char *path);
bool fsop_FileExist(const char *fn); bool fsop_FileExist(const char *fn);
bool fsop_DirExist(const char *path); bool fsop_DirExist(const char *path);
void fsop_MakeFolder(char *path); void fsop_MakeFolder(char *path);

View File

@ -36,37 +36,33 @@
#include "memory/memory.h" #include "memory/memory.h"
// DIOS-MIOS // DIOS-MIOS
DML_CFG *DMLCfg = NULL; DML_CFG DMLCfg;
void DML_New_SetOptions(const char *GamePath, char *CheatPath, const char *NewCheatPath, const char *partition, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting, bool widescreen, bool new_dm_cfg) void DML_New_SetOptions(const char *GamePath, char *CheatPath, const char *NewCheatPath, const char *partition, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting, bool widescreen, bool new_dm_cfg)
{ {
gprintf("Wiiflow GC: Launch game '%s' through memory (new method)\n", GamePath); gprintf("Wiiflow GC: Launch game '%s' through memory (new method)\n", GamePath);
memset(&DMLCfg, 0, sizeof(DML_CFG));
DMLCfg = (DML_CFG*)malloc(sizeof(DML_CFG)); DMLCfg.Magicbytes = 0xD1050CF6;
if(DMLCfg == NULL)
return;
memset(DMLCfg, 0, sizeof(DML_CFG));
DMLCfg->Magicbytes = 0xD1050CF6;
if(new_dm_cfg) if(new_dm_cfg)
DMLCfg->CfgVersion = 0x00000002; DMLCfg.CfgVersion = 0x00000002;
else else
DMLCfg->CfgVersion = 0x00000001; DMLCfg.CfgVersion = 0x00000001;
if(videoSetting == 0) if(videoSetting == 0)
DMLCfg->VideoMode |= DML_VID_NONE; DMLCfg.VideoMode |= DML_VID_NONE;
else if(videoSetting == 1) else if(videoSetting == 1)
DMLCfg->VideoMode |= DML_VID_DML_AUTO; DMLCfg.VideoMode |= DML_VID_DML_AUTO;
else else
DMLCfg->VideoMode |= DML_VID_FORCE; DMLCfg.VideoMode |= DML_VID_FORCE;
DMLCfg->Config |= DML_CFG_ACTIVITY_LED; //Sorry but I like it lol, option will may follow DMLCfg.Config |= DML_CFG_ACTIVITY_LED; //Sorry but I like it lol, option will may follow
DMLCfg->Config |= DML_CFG_PADHOOK; //Makes life easier, l+z+b+digital down... DMLCfg.Config |= DML_CFG_PADHOOK; //Makes life easier, l+z+b+digital down...
if(GamePath != NULL) if(GamePath != NULL)
{ {
strncpy(DMLCfg->GamePath, GamePath, sizeof(DMLCfg->GamePath)); strncpy(DMLCfg.GamePath, GamePath, sizeof(DMLCfg.GamePath));
DMLCfg->Config |= DML_CFG_GAME_PATH; DMLCfg.Config |= DML_CFG_GAME_PATH;
} }
if(CheatPath != NULL && NewCheatPath != NULL && cheats) if(CheatPath != NULL && NewCheatPath != NULL && cheats)
@ -79,31 +75,31 @@ void DML_New_SetOptions(const char *GamePath, char *CheatPath, const char *NewCh
} }
else else
ptr = strstr(CheatPath, ":/") + 1; ptr = strstr(CheatPath, ":/") + 1;
strncpy(DMLCfg->CheatPath, ptr, sizeof(DMLCfg->CheatPath)); strncpy(DMLCfg.CheatPath, ptr, sizeof(DMLCfg.CheatPath));
gprintf("Cheat Path: %s\n", ptr); gprintf("Cheat Path: %s\n", ptr);
DMLCfg->Config |= DML_CFG_CHEAT_PATH; DMLCfg.Config |= DML_CFG_CHEAT_PATH;
} }
if(cheats) if(cheats)
DMLCfg->Config |= DML_CFG_CHEATS; DMLCfg.Config |= DML_CFG_CHEATS;
if(debugger) if(debugger)
DMLCfg->Config |= DML_CFG_DEBUGGER; DMLCfg.Config |= DML_CFG_DEBUGGER;
if(NMM > 0) if(NMM)
DMLCfg->Config |= DML_CFG_NMM; DMLCfg.Config |= DML_CFG_NMM;
if(NMM > 1) if(NMM > 1)
DMLCfg->Config |= DML_CFG_NMM_DEBUG; DMLCfg.Config |= DML_CFG_NMM_DEBUG;
if(nodisc > 0) if(nodisc)
{ {
if(new_dm_cfg) if(new_dm_cfg)
DMLCfg->Config |= DML_CFG_NODISC_CFG2; DMLCfg.Config |= DML_CFG_NODISC_CFG2;
else else
DMLCfg->Config |= DML_CFG_NODISC_CFG1; DMLCfg.Config |= DML_CFG_NODISC_CFG1;
} }
if(widescreen && new_dm_cfg) if(widescreen && new_dm_cfg)
DMLCfg->Config |= DML_CFG_FORCE_WIDE; DMLCfg.Config |= DML_CFG_FORCE_WIDE;
if(DMLvideoMode > 3) if(DMLvideoMode > 3)
DMLCfg->VideoMode |= DML_VID_PROG_PATCH; DMLCfg.VideoMode |= DML_VID_PROG_PATCH;
} }
void DML_Old_SetOptions(const char *GamePath) void DML_Old_SetOptions(const char *GamePath)
@ -125,36 +121,27 @@ void DML_Old_SetOptions(const char *GamePath)
void DML_New_SetBootDiscOption(bool new_dm_cfg) void DML_New_SetBootDiscOption(bool new_dm_cfg)
{ {
gprintf("Booting GC game\n"); gprintf("Booting GC game\n");
memset(&DMLCfg, 0, sizeof(DML_CFG));
DMLCfg = (DML_CFG*)malloc(sizeof(DML_CFG)); DMLCfg.Magicbytes = 0xD1050CF6;
if(DMLCfg == NULL)
return;
memset(DMLCfg, 0, sizeof(DML_CFG));
DMLCfg->Magicbytes = 0xD1050CF6;
if(new_dm_cfg) if(new_dm_cfg)
DMLCfg->CfgVersion = 0x00000002; DMLCfg.CfgVersion = 0x00000002;
else else
DMLCfg->CfgVersion = 0x00000001; DMLCfg.CfgVersion = 0x00000001;
DMLCfg->VideoMode |= DML_VID_DML_AUTO; DMLCfg.VideoMode |= DML_VID_DML_AUTO;
DMLCfg->Config |= DML_CFG_BOOT_DISC; DMLCfg.Config |= DML_CFG_BOOT_DISC;
} }
void DML_New_WriteOptions() void DML_New_WriteOptions()
{ {
if(DMLCfg == NULL)
return;
//Write options into memory //Write options into memory
memcpy((void *)0x80001700, DMLCfg, sizeof(DML_CFG)); memcpy((void *)0x80001700, &DMLCfg, sizeof(DML_CFG));
DCFlushRange((void *)(0x80001700), sizeof(DML_CFG)); DCFlushRange((void *)(0x80001700), sizeof(DML_CFG));
//DML v1.2+ //DML v1.2+
memcpy((void *)0x81200000, DMLCfg, sizeof(DML_CFG)); memcpy((void *)0x81200000, &DMLCfg, sizeof(DML_CFG));
DCFlushRange((void *)(0x81200000), sizeof(DML_CFG)); DCFlushRange((void *)(0x81200000), sizeof(DML_CFG));
free(DMLCfg);
} }
@ -328,7 +315,7 @@ u32 __SYS_UnlockSram(u32 write);
u32 __SYS_SyncSram(void); u32 __SYS_SyncSram(void);
} }
void GC_SetVideoMode(u8 videomode, u8 videoSetting) void GC_SetVideoMode(u8 videomode, u8 videoSetting, bool DIOSMIOS)
{ {
syssram *sram; syssram *sram;
sram = __SYS_LockSram(); sram = __SYS_LockSram();
@ -354,33 +341,33 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting)
if(videomode == 1) if(videomode == 1)
{ {
if(DMLCfg != NULL && videoSetting == 2) if(DIOSMIOS && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PAL50; DMLCfg.VideoMode |= DML_VID_FORCE_PAL50;
vmode = &TVPal528IntDf; vmode = &TVPal528IntDf;
} }
else if(videomode == 2) else if(videomode == 2)
{ {
if(DMLCfg != NULL && videoSetting == 2) if(DIOSMIOS && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_NTSC; DMLCfg.VideoMode |= DML_VID_FORCE_NTSC;
vmode = &TVNtsc480IntDf; vmode = &TVNtsc480IntDf;
} }
else if(videomode == 3) else if(videomode == 3)
{ {
if(DMLCfg != NULL && videoSetting == 2) if(DIOSMIOS && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PAL60; DMLCfg.VideoMode |= DML_VID_FORCE_PAL60;
vmode = &TVEurgb60Hz480IntDf; vmode = &TVEurgb60Hz480IntDf;
vmode_reg = 5; vmode_reg = 5;
} }
else if(videomode == 4 ||videomode == 6) else if(videomode == 4 ||videomode == 6)
{ {
if(DMLCfg != NULL && videoSetting == 2) if(DIOSMIOS && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PROG; DMLCfg.VideoMode |= DML_VID_FORCE_PROG;
vmode = &TVNtsc480Prog; vmode = &TVNtsc480Prog;
} }
else if(videomode == 5 || videomode == 7) else if(videomode == 5 || videomode == 7)
{ {
if(DMLCfg != NULL && videoSetting == 2) if(DIOSMIOS && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PROG; DMLCfg.VideoMode |= DML_VID_FORCE_PROG;
vmode = &TVNtsc480Prog; vmode = &TVNtsc480Prog;
vmode_reg = 5; vmode_reg = 5;
} }

View File

@ -85,7 +85,7 @@ void DEVO_SetOptions(const char *isopath, int CurrentPartition, const char *game
void DEVO_Boot(); void DEVO_Boot();
// General // General
void GC_SetVideoMode(u8 videomode, u8 videoSetting); void GC_SetVideoMode(u8 videomode, u8 videoSetting, bool DIOSMIOS);
void GC_SetLanguage(u8 lang); void GC_SetLanguage(u8 lang);
int GC_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir); int GC_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir);

View File

@ -3,7 +3,7 @@
int currentStr = 0; int currentStr = 0;
static char fmt_buffer[MAX_USES][MAX_MSG_SIZE]; static char fmt_buffer[MAX_USES][MAX_MSG_SIZE];
static char general_buffer[MAX_MSG_SIZE]; static char general_buffer[MAX_MSG_SIZE * 2];
// Simplified use of sprintf // Simplified use of sprintf
char *fmt(const char *format, ...) char *fmt(const char *format, ...)
@ -449,9 +449,9 @@ void Asciify( wchar_t *str )
{ {
const wchar_t *ptr = str; const wchar_t *ptr = str;
wchar_t *ctr = str; wchar_t *ctr = str;
while(*ptr != '\0') while(*ptr != '\0')
{ {
switch(*ptr) switch(*ptr)
{ {
case 0x14c: case 0x14c:
@ -460,7 +460,7 @@ void Asciify( wchar_t *str )
} }
*ctr = *ptr; *ctr = *ptr;
++ptr; ++ptr;
++ctr; ++ctr;
} }
*ctr = '\0'; *ctr = '\0';
} }

View File

@ -24,16 +24,16 @@ WIP_Code *get_wip_list()
int load_wip_patches(u8 *dir, u8 *gameid) int load_wip_patches(u8 *dir, u8 *gameid)
{ {
char filepath[150]; char filepath[150];
char GameID[8]; char GameID[7];
memset(GameID, 0, sizeof(GameID)); GameID[6] = '\0';
memcpy(GameID, gameid, 6); memcpy(GameID, gameid, 6);
snprintf(filepath, sizeof(filepath), "%s/%s.wip", dir, GameID); snprintf(filepath, sizeof(filepath), "%s/%s.wip", dir, GameID);
FILE *fp = fopen(filepath, "rb"); FILE *fp = fopen(filepath, "rb");
if(!fp) if(!fp)
{ {
memset(GameID, 0, sizeof(GameID));
memcpy(GameID, gameid, 3); memcpy(GameID, gameid, 3);
GameID[3] = '\0';
snprintf(filepath, sizeof(filepath), "%s/%s.wip", dir, GameID); snprintf(filepath, sizeof(filepath), "%s/%s.wip", dir, GameID);
fp = fopen(filepath, "rb"); fp = fopen(filepath, "rb");
} }

View File

@ -2,14 +2,11 @@
#include <ogc/system.h> #include <ogc/system.h>
#include <unistd.h> #include <unistd.h>
#include "defines.h" #include "const_str.hpp"
#include "svnrev.h"
#include "booter/external_booter.hpp" #include "booter/external_booter.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.h"
#include "gecko/wifi_gecko.h"
#include "gui/video.hpp" #include "gui/video.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "homebrew/homebrew.h" #include "homebrew/homebrew.h"
@ -25,12 +22,13 @@
CMenu mainMenu; CMenu mainMenu;
bool useMainIOS = false; bool useMainIOS = false;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
mainIOS = DOL_MAIN_IOS; mainIOS = DOL_MAIN_IOS;
__exception_setreload(5); __exception_setreload(5);
InitGecko(); //USB Gecko and SD buffer InitGecko(); //USB Gecko and SD buffer
gprintf(" \nWelcome to %s (%s-r%s)!\nThis is the debug output.\n", APP_NAME, APP_VERSION, SVN_REV); gprintf(" \nWelcome to %s!\nThis is the debug output.\n", VERSION_STRING.c_str());
m_vid.init(); // Init video m_vid.init(); // Init video
MEM_init(); //Inits both mem1lo and mem2 MEM_init(); //Inits both mem1lo and mem2

View File

@ -77,7 +77,7 @@ void MEM1_free(void *p)
unsigned int MEM1_freesize() unsigned int MEM1_freesize()
{ {
return SYS_GetArena1Size(); return (g_mem1lo.FreeSize() + SYS_GetArena1Size());
} }
void MEM2_cleanup(void) void MEM2_cleanup(void)

View File

@ -1,19 +1,20 @@
#include "mem2alloc.hpp" #include "mem2alloc.hpp"
#include <ogc/system.h> #include <ogc/system.h>
#include <ogc/cache.h>
#include <algorithm> #include <algorithm>
#include <string.h> #include <string.h>
#define IOS_RELOAD_AREA 0x90200000 #define IOS_RELOAD_AREA 0x90200000
#include "lockMutex.hpp" #include "lockMutex.hpp"
void CMEM2Alloc::init(unsigned int size) void CMEM2Alloc::init(unsigned int size)
{ {
m_baseAddress = (SBlock *) std::max(((u32)SYS_GetArena2Lo() + 31) & ~31, IOS_RELOAD_AREA); m_baseAddress = (SBlock *)std::max(((u32)SYS_GetArena2Lo() + 31) & ~31, IOS_RELOAD_AREA);
m_endAddress = (SBlock *)((char *)m_baseAddress + std::min(size * 0x100000, SYS_GetArena2Size() & ~31)); m_endAddress = (SBlock *)((u8*)m_baseAddress + std::min(size * 0x100000, SYS_GetArena2Size() & ~31));
if (m_endAddress > (SBlock *) 0x93100000) //rest is reserved for usb/usb2/network and other stuff... (0xE0000 bytes) if (m_endAddress > (SBlock *)0x93100000) //rest is reserved for usb/usb2/network and other stuff... (0xE0000 bytes)
m_endAddress = (SBlock *) 0x93100000; m_endAddress = (SBlock *)0x93100000;
SYS_SetArena2Lo(m_endAddress); SYS_SetArena2Lo(m_endAddress);
LWP_MutexInit(&m_mutex, 0); LWP_MutexInit(&m_mutex, 0);
} }
@ -40,7 +41,9 @@ void CMEM2Alloc::cleanup(void)
void CMEM2Alloc::clear(void) void CMEM2Alloc::clear(void)
{ {
m_first = 0; m_first = 0;
memset(m_baseAddress, 0, (u8 *)m_endAddress - (u8 *)m_baseAddress); u32 Size = (u32)m_endAddress - (u32)m_baseAddress;
memset(m_baseAddress, 0, Size);
DCFlushRange(m_baseAddress, Size);
} }
unsigned int CMEM2Alloc::usableSize(void *p) unsigned int CMEM2Alloc::usableSize(void *p)
@ -211,7 +214,7 @@ unsigned int CMEM2Alloc::FreeSize()
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
if (m_first == 0) if (m_first == 0)
return (const char *) m_endAddress - (const char *) m_baseAddress; return (u32)m_endAddress - (u32)m_baseAddress;
SBlock *i; SBlock *i;
unsigned int size = 0; unsigned int size = 0;

View File

@ -2591,28 +2591,17 @@ int CMenu::MIOSisDML()
return 0; return 0;
} }
void CMenu::RemoveCover( char * id ) void CMenu::RemoveCover(const char *id)
{ {
FILE *fp = fopen(fmt("%s/%s.png", m_boxPicDir.c_str(), id), "rb"); const char *CoverPath = NULL;
if (fp != NULL) if(id == NULL)
{ return;
fclose(fp); CoverPath = fmt("%s/%s.png", m_boxPicDir.c_str(), id);
remove(fmt("%s/%s.png", m_boxPicDir.c_str(), id)); fsop_deleteFile(CoverPath);
} CoverPath = fmt("%s/%s.png", m_picDir.c_str(), id);
fsop_deleteFile(CoverPath);
fp = fopen(fmt("%s/%s.png", m_picDir.c_str(), id), "rb"); CoverPath = fmt("%s/%s.wfc", m_cacheDir.c_str(), id);
if (fp != NULL) fsop_deleteFile(CoverPath);
{
fclose(fp);
remove(fmt("%s/%s.png", m_picDir.c_str(), id));
}
fp = fopen(fmt("%s/%s.wfc", m_cacheDir.c_str(), id), "rb");
if (fp != NULL)
{
fclose(fp);
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), id));
}
} }
void CMenu::_TempLoadIOS(int IOS) void CMenu::_TempLoadIOS(int IOS)

View File

@ -967,13 +967,7 @@ private:
void _CategorySettings(bool fromGameSet = false); void _CategorySettings(bool fromGameSet = false);
bool _Home(); bool _Home();
bool _ExitTo(); bool _ExitTo();
//
void _mainLoopCommon(bool withCF = false, bool adjusting = false); void _mainLoopCommon(bool withCF = false, bool adjusting = false);
//
vector<dir_discHdr> _searchGamesByID(const char *gameId);
/* vector<dir_discHdr> _searchGamesByTitle(wchar_t letter);
vector<dir_discHdr> _searchGamesByType(const char type);
vector<dir_discHdr> _searchGamesByRegion(const char region); */
public: public:
void directlaunch(const char *GameID); void directlaunch(const char *GameID);
private: private:
@ -998,10 +992,10 @@ private:
void _cleanupDefaultFont(); void _cleanupDefaultFont();
string _getId(void); string _getId(void);
const char *_domainFromView(void); const char *_domainFromView(void);
const char *_cfDomain(bool selected = false); const char *_cfDomain(bool selected = false);
void UpdateCache(u32 view = COVERFLOW_MAX); void UpdateCache(u32 view = COVERFLOW_MAX);
int MIOSisDML(); int MIOSisDML();
void RemoveCover( char * id ); void RemoveCover(const char *id);
SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey); SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey);
STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def); STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def);
vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key); vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key);

View File

@ -1,15 +1,15 @@
#include "menu.hpp" #include "menu.hpp"
#include "defines.h"
#include "svnrev.h"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "loader/alt_ios.h" #include "loader/alt_ios.h"
#include "loader/cios.h" #include "loader/cios.h"
#include "loader/sys.h" #include "loader/sys.h"
#include "const_str.hpp"
const int pixels_to_skip = 10; const int pixels_to_skip = 10;
extern const u8 english_txt[]; extern const u8 english_txt[];
static const wstringEx ENGLISH_TXT_W((const char*)english_txt);
//About menu //About menu
s16 m_aboutLblTitle; s16 m_aboutLblTitle;
@ -125,16 +125,15 @@ void CMenu::_textAbout(void)
help_text.fromUTF8(help); help_text.fromUTF8(help);
MEM2_free(help); MEM2_free(help);
fclose(f); fclose(f);
m_btnMgr.setText(m_aboutLblInfo, help_text);
} }
else else
help_text.fromUTF8((char*)english_txt); m_btnMgr.setText(m_aboutLblInfo, ENGLISH_TXT_W);
m_btnMgr.setText(m_aboutLblInfo, wfmt(L"%s", help_text.toUTF8().c_str()), false);
} }
else else
{ {
m_btnMgr.setText(m_aboutLblTitle, wfmt( L"%s (%s-r%s)", APP_NAME, APP_VERSION, SVN_REV), false); m_btnMgr.setText(m_aboutLblTitle, VERSION_STRING);
wstringEx developers(wfmt(_fmt("about6", L"\nCurrent Developers:\n%s"), DEVELOPERS)); wstringEx developers(wfmt(_fmt("about6", L"\nCurrent Developers:\n%s"), DEVELOPERS));
wstringEx pDevelopers(wfmt(_fmt("about7", L"Past Developers:\n%s"), PAST_DEVELOPERS)); wstringEx pDevelopers(wfmt(_fmt("about7", L"Past Developers:\n%s"), PAST_DEVELOPERS));
@ -157,11 +156,9 @@ void CMenu::_textAbout(void)
origGUI.toUTF8().c_str(), origGUI.toUTF8().c_str(),
codethx.toUTF8().c_str(), codethx.toUTF8().c_str(),
sites.toUTF8().c_str(), sites.toUTF8().c_str(),
thanks.toUTF8().c_str()), thanks.toUTF8().c_str())
false
); );
} }
switch(IOS_GetType(CurrentIOS.Version)) switch(IOS_GetType(CurrentIOS.Version))
{ {
case IOS_TYPE_D2X: case IOS_TYPE_D2X:

View File

@ -90,9 +90,9 @@ void CMenu::_CheatSettings()
_textCheatSettings(); _textCheatSettings();
if (txtavailable) if (txtavailable)
m_btnMgr.setText(m_cheatLblTitle,wfmt(L"%s",m_cheatfile.getGameName().c_str())); m_btnMgr.setText(m_cheatLblTitle, m_cheatfile.getGameName());
else else
m_btnMgr.setText(m_cheatLblTitle,L""); m_btnMgr.setText(m_cheatLblTitle, L"");
while(!m_exit) while(!m_exit)
{ {
@ -243,10 +243,10 @@ void CMenu::_CheatSettings()
txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id.c_str())); txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id.c_str()));
_showCheatSettings(); _showCheatSettings();
if (txtavailable) if(txtavailable)
m_btnMgr.setText(m_cheatLblTitle,wfmt(L"%s",m_cheatfile.getGameName().c_str())); m_btnMgr.setText(m_cheatLblTitle, m_cheatfile.getGameName());
else else
m_btnMgr.setText(m_cheatLblTitle,L""); m_btnMgr.setText(m_cheatLblTitle, L"");
if (m_cheatfile.getCnt() == 0) if (m_cheatfile.getCnt() == 0)
{ {
@ -308,7 +308,7 @@ void CMenu::_showCheatSettings(void)
// cheat in range? // cheat in range?
if (((m_cheatSettingsPage-1)*CHEATSPERPAGE + i + 1) <= m_cheatfile.getCnt()) if (((m_cheatSettingsPage-1)*CHEATSPERPAGE + i + 1) <= m_cheatfile.getCnt())
{ {
m_btnMgr.setText(m_cheatLblItem[i], wfmt(L"%s", m_cheatfile.getCheatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i).c_str())); m_btnMgr.setText(m_cheatLblItem[i], m_cheatfile.getCheatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i));
m_btnMgr.setText(m_cheatBtnItem[i], _optBoolToString(m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i])); m_btnMgr.setText(m_cheatBtnItem[i], _optBoolToString(m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i]));
m_btnMgr.show(m_cheatLblItem[i], true); m_btnMgr.show(m_cheatLblItem[i], true);

View File

@ -8,6 +8,7 @@
#include "menu.hpp" #include "menu.hpp"
#include "types.h" #include "types.h"
#include "const_str.hpp"
#include "banner/BannerWindow.hpp" #include "banner/BannerWindow.hpp"
#include "booter/external_booter.hpp" #include "booter/external_booter.hpp"
#include "channel/channel_launcher.h" #include "channel/channel_launcher.h"
@ -845,10 +846,10 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
if(disc) if(disc)
{ {
loader = 0; loader = 1;
DML_New_SetBootDiscOption(m_new_dm_cfg); DML_New_SetBootDiscOption(m_new_dm_cfg);
} }
else if(loader == 1 || (loader == 0 && (strcasestr(path.c_str(), "boot.bin") != NULL || !m_devo_installed))) else if(loader == 1 || strcasestr(path.c_str(), "boot.bin") != NULL || !m_devo_installed)
{ {
loader = 1; loader = 1;
m_cfg.setString("DML", "current_item", id); m_cfg.setString("DML", "current_item", id);
@ -875,18 +876,19 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id.c_str())); snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
string newPath = &path[path.find_first_of(":/")+1]; string newPath = &path[path.find_first_of(":/")+1];
if(m_new_dml) if(m_new_dml)
DML_New_SetOptions(newPath.c_str(), CheatPath, NewCheatPath.c_str(), DeviceName[currentPartition], cheats, DML_debug, NMM, nodisc, videoMode, videoSetting, DM_Widescreen, m_new_dm_cfg); DML_New_SetOptions(newPath.c_str(), CheatPath, NewCheatPath.c_str(), DeviceName[currentPartition],
cheats, DML_debug, NMM, nodisc, videoMode, videoSetting, DM_Widescreen, m_new_dm_cfg);
else else
DML_Old_SetOptions(newPath.c_str()); DML_Old_SetOptions(newPath.c_str());
if(!nodisc || !m_new_dml) if(!nodisc || !m_new_dml)
WDVD_StopMotor(); WDVD_StopMotor();
} }
else if(loader == 2 || (loader == 0 && m_devo_installed && strcasestr(path.c_str(), "boot.bin") == NULL)) else
{ {
loader = 2; loader = 2;
DEVO_GetLoader(m_dataDir.c_str()); DEVO_GetLoader(m_dataDir.c_str());
} }
bool DIOSMIOS = (loader == 1);
m_gcfg1.save(true); m_gcfg1.save(true);
m_gcfg2.save(true); m_gcfg2.save(true);
@ -894,10 +896,17 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
m_cfg.save(true); m_cfg.save(true);
cleanup(); cleanup();
GC_SetVideoMode(videoMode, videoSetting); GC_SetVideoMode(videoMode, videoSetting, DIOSMIOS);
GC_SetLanguage(GClanguage); GC_SetLanguage(GClanguage);
if(loader == 2 && !disc) if(DIOSMIOS)
{
DML_New_WriteOptions();
ShutdownBeforeExit();
WII_Initialize();
WII_LaunchTitle(0x100000100LL);
}
else
{ {
if(AHBRPOT_Patched()) if(AHBRPOT_Patched())
loadIOS(58, false); loadIOS(58, false);
@ -907,13 +916,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
DEVO_SetOptions(path.c_str(), currentPartition, id.c_str(), memcard_emu); DEVO_SetOptions(path.c_str(), currentPartition, id.c_str(), memcard_emu);
DEVO_Boot(); DEVO_Boot();
} }
else
{
DML_New_WriteOptions();
ShutdownBeforeExit();
WII_Initialize();
WII_LaunchTitle(0x100000100LL);
}
Sys_Exit(); Sys_Exit();
} }

View File

@ -78,6 +78,8 @@ extern const u8 pegi_16_png[];
extern const u8 pegi_18_png[]; extern const u8 pegi_18_png[];
GameXMLInfo gameinfo; GameXMLInfo gameinfo;
wstringEx gameinfo_Synopsis_w;
wstringEx gameinfo_Title_w;
static bool titlecheck = false; static bool titlecheck = false;
u8 cnt_controlsreq = 0, cnt_controls = 0; u8 cnt_controlsreq = 0, cnt_controls = 0;
@ -133,9 +135,6 @@ void CMenu::_gameinfo(void)
page = 1; page = 1;
amount_of_skips = 0; amount_of_skips = 0;
m_btnMgr.reset(m_gameinfoLblSynopsis);
m_btnMgr.setText(m_gameinfoLblSynopsis, wfmt(L"%s", gameinfo.Synopsis.c_str()));
m_btnMgr.hide(m_gameinfoLblID, true); m_btnMgr.hide(m_gameinfoLblID, true);
m_btnMgr.hide(m_gameinfoLblDev, true); m_btnMgr.hide(m_gameinfoLblDev, true);
m_btnMgr.hide(m_gameinfoLblRegion, true); m_btnMgr.hide(m_gameinfoLblRegion, true);
@ -148,19 +147,20 @@ void CMenu::_gameinfo(void)
for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControlsReq); ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControlsReq); ++i)
if(m_gameinfoLblControlsReq[i] != -1) if(m_gameinfoLblControlsReq[i] != -1)
m_btnMgr.hide(m_gameinfoLblControlsReq[i], true); m_btnMgr.hide(m_gameinfoLblControlsReq[i], true);
for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControls); ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControls); ++i)
if(m_gameinfoLblControls[i] != -1) if(m_gameinfoLblControls[i] != -1)
m_btnMgr.hide(m_gameinfoLblControls[i], true); m_btnMgr.hide(m_gameinfoLblControls[i], true);
// When showing synopsis, only show user labels 2 and 3 // When showing synopsis, only show user labels 2 and 3
for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblUser); ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblUser); ++i)
if(i < ARRAY_SIZE(m_gameinfoLblUser) / 2) if(i < ARRAY_SIZE(m_gameinfoLblUser) / 2)
m_btnMgr.hide(m_gameinfoLblUser[i], true); m_btnMgr.hide(m_gameinfoLblUser[i], true);
else else
m_btnMgr.show(m_gameinfoLblUser[i]); m_btnMgr.show(m_gameinfoLblUser[i]);
m_btnMgr.show(m_gameinfoLblSynopsis,false); m_btnMgr.reset(m_gameinfoLblSynopsis);
m_btnMgr.show(m_gameinfoLblSynopsis, false);
} }
else if (BTN_LEFT_PRESSED && !(m_thrdWorking && m_thrdStop)) else if (BTN_LEFT_PRESSED && !(m_thrdWorking && m_thrdStop))
{ {
@ -313,23 +313,24 @@ void CMenu::_textGameInfo(void)
GameTDB gametdb; GameTDB gametdb;
gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str())); gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str()); gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
titlecheck = gametdb.IsLoaded() && gametdb.GetGameXMLInfo(m_cf.getId().c_str(), &gameinfo); titlecheck = gametdb.IsLoaded() && gametdb.GetGameXMLInfo(m_cf.getId().c_str(), &gameinfo);
if(titlecheck) if(titlecheck)
{ {
gprintf("ID: %s\nTitle: %s\n", gameinfo.GameID.c_str(), gameinfo.Title.c_str()); gameinfo_Title_w.fromUTF8(gameinfo.Title);
m_btnMgr.setText(m_gameinfoLblTitle, gameinfo_Title_w, true);
gameinfo_Synopsis_w.fromUTF8(gameinfo.Synopsis);
m_btnMgr.setText(m_gameinfoLblSynopsis, gameinfo_Synopsis_w);
m_btnMgr.setText(m_gameinfoLblID, wfmt(L"GameID: %s", gameinfo.GameID.c_str()), true); m_btnMgr.setText(m_gameinfoLblID, wfmt(L"GameID: %s", gameinfo.GameID.c_str()), true);
m_btnMgr.setText(m_gameinfoLblTitle, wfmt(L"%s", gameinfo.Title.c_str()), true);
m_btnMgr.setText(m_gameinfoLblSynopsis, wfmt(L"%s", gameinfo.Synopsis.c_str()), false);
m_btnMgr.setText(m_gameinfoLblDev, wfmt(_fmt("gameinfo1",L"Developer: %s"), gameinfo.Developer.c_str()), true); m_btnMgr.setText(m_gameinfoLblDev, wfmt(_fmt("gameinfo1",L"Developer: %s"), gameinfo.Developer.c_str()), true);
m_btnMgr.setText(m_gameinfoLblPublisher, wfmt(_fmt("gameinfo2",L"Publisher: %s"), gameinfo.Publisher.c_str()), true); m_btnMgr.setText(m_gameinfoLblPublisher, wfmt(_fmt("gameinfo2",L"Publisher: %s"), gameinfo.Publisher.c_str()), true);
m_btnMgr.setText(m_gameinfoLblRegion, wfmt(_fmt("gameinfo3",L"Region: %s"), gameinfo.Region.c_str()), true); m_btnMgr.setText(m_gameinfoLblRegion, wfmt(_fmt("gameinfo3",L"Region: %s"), gameinfo.Region.c_str()), true);
m_btnMgr.setText(m_gameinfoLblGenre, wfmt(_fmt("gameinfo5",L"Genre: %s"), gameinfo.Genres.c_str()), true); m_btnMgr.setText(m_gameinfoLblGenre, wfmt(_fmt("gameinfo5",L"Genre: %s"), gameinfo.Genres.c_str()), true);
int year = gameinfo.PublishDate >> 16; int year = gameinfo.PublishDate >> 16;
int day = gameinfo.PublishDate & 0xFF; int day = gameinfo.PublishDate & 0xFF;
int month = (gameinfo.PublishDate >> 8) & 0xFF; int month = (gameinfo.PublishDate >> 8) & 0xFF;
switch(CONF_GetRegion()) switch(CONF_GetRegion())
{ {
case 0: case 0:

View File

@ -1,9 +1,9 @@
#include "menu.hpp" #include "menu.hpp"
#include "svnrev.h"
#include "loader/cios.h" #include "loader/cios.h"
#include "loader/nk.h" #include "loader/nk.h"
#include "loader/sys.h" #include "loader/sys.h"
#include "const_str.hpp"
s16 m_homeLblTitle; s16 m_homeLblTitle;
s16 m_exittoLblTitle; s16 m_exittoLblTitle;
@ -265,8 +265,7 @@ void CMenu::_initHomeAndExitToMenu(CMenu::SThemeData &theme)
void CMenu::_textHome(void) void CMenu::_textHome(void)
{ {
m_btnMgr.setText(m_homeLblTitle, wfmt( L"%s (%s-r%s)", APP_NAME, APP_VERSION, SVN_REV), false); m_btnMgr.setText(m_homeLblTitle, VERSION_STRING);
m_btnMgr.setText(m_homeBtnSettings, _t("home1", L"Settings")); m_btnMgr.setText(m_homeBtnSettings, _t("home1", L"Settings"));
m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache")); m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache"));
m_btnMgr.setText(m_homeBtnUpdate, _t("home3", L"Update")); m_btnMgr.setText(m_homeBtnUpdate, _t("home3", L"Update"));
@ -278,7 +277,6 @@ void CMenu::_textHome(void)
void CMenu::_textExitTo(void) void CMenu::_textExitTo(void)
{ {
m_btnMgr.setText(m_exittoLblTitle, _t("exit_to", L"Exit To")); m_btnMgr.setText(m_exittoLblTitle, _t("exit_to", L"Exit To"));
m_btnMgr.setText(m_homeBtnExitToHBC, _t("hbc", L"Homebrew Channel")); m_btnMgr.setText(m_homeBtnExitToHBC, _t("hbc", L"Homebrew Channel"));
m_btnMgr.setText(m_homeBtnExitToMenu, _t("menu", L"System Menu")); m_btnMgr.setText(m_homeBtnExitToMenu, _t("menu", L"System Menu"));
m_btnMgr.setText(m_homeBtnExitToPriiloader, _t("prii", L"Priiloader")); m_btnMgr.setText(m_homeBtnExitToPriiloader, _t("prii", L"Priiloader"));
@ -287,4 +285,4 @@ void CMenu::_textExitTo(void)
m_btnMgr.setText(m_homeBtnExitToNeek, _t("neek2o", L"neek2o")); m_btnMgr.setText(m_homeBtnExitToNeek, _t("neek2o", L"neek2o"));
else else
m_btnMgr.setText(m_homeBtnExitToNeek, _t("real", L"Real Nand")); m_btnMgr.setText(m_homeBtnExitToNeek, _t("real", L"Real Nand"));
} }

View File

@ -1,19 +1,19 @@
#include "menu.hpp" #include "menu.hpp"
#include "svnrev.h" #include "const_str.hpp"
#include "defines.h"
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "loader/sys.h" #include "loader/sys.h"
#include "loader/wbfs.h" #include "loader/wbfs.h"
int version_num = 0, num_versions = 0, i; int version_num = 0, num_versions = 0, i;
int CMenu::_version[9] = {0, atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV)}; const u32 SVN_REV_NUM = atoi(SVN_REV);
int CMenu::_version[9] = {0, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM};
const int pixels_to_skip = 10; const int pixels_to_skip = 10;
void CMenu::_system() void CMenu::_system()
{ {
int msg = 0, newVer = atoi(SVN_REV); int msg = 0, newVer = SVN_REV_NUM;
lwp_t thread = LWP_THREAD_NULL; lwp_t thread = LWP_THREAD_NULL;
wstringEx prevMsg; wstringEx prevMsg;
@ -62,11 +62,11 @@ void CMenu::_system()
m_btnMgr.hide(m_downloadPBar); m_btnMgr.hide(m_downloadPBar);
m_btnMgr.hide(m_downloadLblMessage[0], 0, 0, -2.f, 0.f); m_btnMgr.hide(m_downloadLblMessage[0], 0, 0, -2.f, 0.f);
m_btnMgr.hide(m_downloadLblMessage[1], 0, 0, -2.f, 0.f); m_btnMgr.hide(m_downloadLblMessage[1], 0, 0, -2.f, 0.f);
CMenu::_version[1] = m_version.getInt("GENERAL", "version", atoi(SVN_REV)); CMenu::_version[1] = m_version.getInt("GENERAL", "version", SVN_REV_NUM);
num_versions = m_version.getInt("GENERAL", "num_versions", 1); num_versions = m_version.getInt("GENERAL", "num_versions", 1);
for (i = 2; i < num_versions; i++) for (i = 2; i < num_versions; i++)
{ {
CMenu::_version[i] = m_version.getInt(fmt("VERSION%i", i-1u), "version", atoi(SVN_REV)); CMenu::_version[i] = m_version.getInt(fmt("VERSION%i", i-1u), "version", SVN_REV_NUM);
//add the changelog info here //add the changelog info here
} }
if (num_versions > 1 && version_num == 0) version_num = 1; if (num_versions > 1 && version_num == 0) version_num = 1;
@ -277,14 +277,12 @@ void CMenu::_textSystem(void)
{ {
m_btnMgr.setText(m_systemLblTitle, _t("sys1", L"Update WiiFlow")); m_btnMgr.setText(m_systemLblTitle, _t("sys1", L"Update WiiFlow"));
m_btnMgr.setText(m_systemLblVersionTxt, _t("sys2", L"WiiFlow Version:")); m_btnMgr.setText(m_systemLblVersionTxt, _t("sys2", L"WiiFlow Version:"));
m_btnMgr.setText(m_systemLblVersion, wfmt(L"r%s", SVN_REV).c_str()); m_btnMgr.setText(m_systemLblVersion, SVN_REV_W);
m_btnMgr.setText(m_systemBtnBack, _t("sys3", L"Cancel")); m_btnMgr.setText(m_systemBtnBack, _t("sys3", L"Cancel"));
m_btnMgr.setText(m_systemBtnDownload, _t("sys4", L"Upgrade")); m_btnMgr.setText(m_systemBtnDownload, _t("sys4", L"Upgrade"));
i = min((u32)version_num, ARRAY_SIZE(CMenu::_version) -1u); i = min((u32)version_num, ARRAY_SIZE(CMenu::_version) -1u);
if (i == 0) if (i == 0)
{ m_btnMgr.setText(m_systemLblVerSelectVal, SVN_REV_W);
m_btnMgr.setText(m_systemLblVerSelectVal, wfmt(L"%i", atoi(SVN_REV)).c_str());
}
else else
{ {
m_btnMgr.setText(m_systemLblVerSelectVal, wstringEx(sfmt("%i", CMenu::_version[i]))); m_btnMgr.setText(m_systemLblVerSelectVal, wstringEx(sfmt("%i", CMenu::_version[i])));

View File

@ -71,14 +71,14 @@ void CMenu::_addDiscProgress(int status, int total, void *user_data)
} }
} }
vector<dir_discHdr> CMenu::_searchGamesByID(const char *gameId) static inline bool _searchGamesByID(const char *gameId)
{ {
vector<dir_discHdr> retval; for(vector<dir_discHdr>::const_iterator itr = m_gameList.begin(); itr != m_gameList.end(); ++itr)
for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) {
if (strncmp((const char *) (*itr).id, gameId, strlen(gameId)) == 0) if(strncmp(itr->id, gameId, 6) == 0)
retval.push_back(*itr); return true;
}
return retval; return false;
} }
void CMenu::_Messenger(int message, int info, char *cinfo, void *user_data) void CMenu::_Messenger(int message, int info, char *cinfo, void *user_data)
@ -172,14 +172,14 @@ int CMenu::_GCgameInstaller(void *obj)
int ret; int ret;
m.m_progress = 0.f; m.m_progress = 0.f;
if (!DeviceHandle.IsInserted(currentPartition)) if(!DeviceHandle.IsInserted(currentPartition))
{ {
m.m_thrdWorking = false; m.m_thrdWorking = false;
return -1; return -1;
} }
char partition[6]; char partition[6];
snprintf(partition, sizeof(partition), "%s:/", DeviceName[currentPartition]); strncpy(partition, fmt("%s:/", DeviceName[currentPartition]), sizeof(partition));
u32 needed = 0; u32 needed = 0;
@ -226,18 +226,24 @@ int CMenu::_GCgameInstaller(void *obj)
int CMenu::_GCcopyGame(void *obj) int CMenu::_GCcopyGame(void *obj)
{ {
CMenu &m = *(CMenu *)obj; CMenu &m = *(CMenu *)obj;
char folder[50];
char source[300];
char target[300];
string GC_Path(m.m_cf.getHdr()->path); string GC_Path(m.m_cf.getHdr()->path);
if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL) if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL)
GC_Path.erase(GC_Path.end() - 13, GC_Path.end()); GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
else else
GC_Path.erase(GC_Path.end() - 9, GC_Path.end()); GC_Path.erase(GC_Path.end() - 9, GC_Path.end());
char source[300];
strncpy(source, GC_Path.c_str(), sizeof(source)); strncpy(source, GC_Path.c_str(), sizeof(source));
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]); source[299] = '\0';
snprintf(target, sizeof(target), "%s/%s", folder, &GC_Path[GC_Path.find_last_of("/")]+1);
char folder[50];
strncpy(folder, fmt(DML_DIR, DeviceName[SD]), sizeof(folder));
folder[49] = '\0';
char target[300];
strncpy(target, fmt("%s/%s", folder, strrchr(source, '/') + 1), sizeof(target));
target[299] = '\0';
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m._setThrdMsg(L"", 0); m._setThrdMsg(L"", 0);
@ -259,6 +265,8 @@ int CMenu::_GCcopyGame(void *obj)
bool CMenu::_wbfsOp(CMenu::WBFS_OP op) bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
{ {
lwp_t thread = 0; lwp_t thread = 0;
char GameID[7];
GameID[6] = '\0';
static discHdr header ATTRIBUTE_ALIGN(32); static discHdr header ATTRIBUTE_ALIGN(32);
static gc_discHdr gcheader ATTRIBUTE_ALIGN(32); static gc_discHdr gcheader ATTRIBUTE_ALIGN(32);
bool done = false; bool done = false;
@ -266,11 +274,9 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
bool upd_dml = false; bool upd_dml = false;
bool upd_emu = false; bool upd_emu = false;
bool out = false; bool out = false;
struct AutoLight { AutoLight(void) { } ~AutoLight(void) { slotLight(false); } } aw;
string cfPos = m_cf.getNextId(); string cfPos = m_cf.getNextId();
SetupInput(); SetupInput();
_showWBFS(op); _showWBFS(op);
switch (op) switch (op)
{ {
@ -329,14 +335,15 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
if (Disc_IsWii() == 0) if (Disc_IsWii() == 0)
{ {
Disc_ReadHeader(&header); Disc_ReadHeader(&header);
if(_searchGamesByID((const char *) header.id).size() != 0) memcpy(GameID, header.id, 6);
if(_searchGamesByID(GameID))
{ {
error(_t("wbfsoperr4", L"Game already installed")); error(_t("wbfsoperr4", L"Game already installed"));
out = true; out = true;
break; break;
} }
cfPos = string((char *)header.id); cfPos = string(GameID);
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop6", L"Installing [%s] %s..."), string((const char *)header.id, sizeof header.id).c_str(), string((const char *)header.title, sizeof header.title).c_str())); m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop6", L"Installing [%s] %s..."), GameID, header.title));
done = true; done = true;
upd_usb = true; upd_usb = true;
m_thrdWorking = true; m_thrdWorking = true;
@ -347,19 +354,15 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
else if(Disc_IsGC() == 0) else if(Disc_IsGC() == 0)
{ {
Disc_ReadGCHeader(&gcheader); Disc_ReadGCHeader(&gcheader);
memcpy(GameID, gcheader.id, 6);
char gcfolder[300]; if(_searchGamesByID(GameID))
char dmlgamedir[50];
strncpy(dmlgamedir, (currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR, sizeof(dmlgamedir));
snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", gcheader.title, (char *)gcheader.id);
if(_searchGamesByID((const char *) gcheader.id).size() != 0)
{ {
error(_t("wbfsoperr4", L"Game already installed")); error(_t("wbfsoperr4", L"Game already installed"));
out = true; out = true;
break; break;
} }
cfPos = string((char *) gcheader.id); cfPos = string(GameID);
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop6", L"Installing [%s] %s..."), string((const char *)gcheader.id, sizeof gcheader.id).c_str(), string((const char *)gcheader.title, sizeof gcheader.title).c_str())); m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop6", L"Installing [%s] %s..."), GameID, gcheader.title));
done = true; done = true;
upd_dml = true; upd_dml = true;
m_thrdWorking = true; m_thrdWorking = true;
@ -376,12 +379,14 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
case CMenu::WO_REMOVE_GAME: case CMenu::WO_REMOVE_GAME:
if(m_cf.getHdr()->type == TYPE_GC_GAME) if(m_cf.getHdr()->type == TYPE_GC_GAME)
{ {
string GC_Path(m_cf.getHdr()->path); if(strcasestr(m_cf.getHdr()->path, "boot.bin") != NULL)
if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL) {
string GC_Path(m_cf.getHdr()->path);
GC_Path.erase(GC_Path.end() - 13, GC_Path.end()); GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
fsop_deleteFolder(GC_Path.c_str());
}
else else
GC_Path.erase(GC_Path.end() - 9, GC_Path.end()); fsop_deleteFile(m_cf.getHdr()->path);
fsop_deleteFolder(GC_Path.c_str());
upd_dml = true; upd_dml = true;
} }
else if(m_cf.getHdr()->type == TYPE_PLUGIN) else if(m_cf.getHdr()->type == TYPE_PLUGIN)
@ -391,11 +396,11 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
} }
else if(m_cf.getHdr()->type == TYPE_WII_GAME) else if(m_cf.getHdr()->type == TYPE_WII_GAME)
{ {
WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), (char *) m_cf.getHdr()->path); WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), m_cf.getHdr()->path);
upd_usb = true; upd_usb = true;
} }
if(m_cfg.getBool("GENERAL", "delete_cover_and_game", true)) if(m_cfg.getBool("GENERAL", "delete_cover_and_game", false))
RemoveCover((char *)m_cf.getId().c_str()); RemoveCover(m_cf.getId().c_str());
m_btnMgr.show(m_wbfsPBar); m_btnMgr.show(m_wbfsPBar);
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true); m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
m_btnMgr.setProgress(m_wbfsPBar, 1.f); m_btnMgr.setProgress(m_wbfsPBar, 1.f);
@ -413,32 +418,25 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
GC_Path.erase(GC_Path.end() - 13, GC_Path.end()); GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
else else
GC_Path.erase(GC_Path.end() - 9, GC_Path.end()); GC_Path.erase(GC_Path.end() - 9, GC_Path.end());
if(fsop_GetFreeSpaceKb((char*)"sd:/")<fsop_GetFolderKb(GC_Path.c_str())) if(fsop_GetFreeSpaceKb("sd:/") < fsop_GetFolderKb(GC_Path.c_str()))
{ {
m_btnMgr.hide(m_wbfsBtnGo); m_btnMgr.hide(m_wbfsBtnGo);
_setThrdMsg(wfmt(_fmt("wbfsop24", L"Not enough space: %d blocks needed, %d available"), fsop_GetFolderKb(GC_Path.c_str()), fsop_GetFreeSpaceKb((char*)"sd:/")), 0.f); _setThrdMsg(wfmt(_fmt("wbfsop24", L"Not enough space: %d blocks needed, %d available"), fsop_GetFolderKb(GC_Path.c_str()), fsop_GetFreeSpaceKb("sd:/")), 0.f);
break; break;
} }
m_btnMgr.show(m_wbfsPBar); m_btnMgr.show(m_wbfsPBar);
m_btnMgr.setProgress(m_wbfsPBar, 0.f); m_btnMgr.setProgress(m_wbfsPBar, 0.f);
m_btnMgr.hide(m_wbfsBtnGo); m_btnMgr.hide(m_wbfsBtnGo);
m_btnMgr.hide(m_wbfsBtnBack); m_btnMgr.hide(m_wbfsBtnBack);
m_btnMgr.show(m_wbfsLblMessage); m_btnMgr.show(m_wbfsLblMessage);
m_btnMgr.setText(m_wbfsLblMessage, L""); m_btnMgr.setText(m_wbfsLblMessage, L"");
cfPos = string((char*)m_cf.getHdr()->id); cfPos = string(m_cf.getHdr()->id);
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop10", L"Copying [%s] %s..."), (u8*)m_cf.getHdr()->id, (u8*)m_cf.getTitle().toUTF8().c_str())); m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop10", L"Copying [%s] %s..."), m_cf.getHdr()->id, m_cf.getTitle().toUTF8().c_str()));
done = true; done = true;
upd_dml = true; upd_dml = true;
m_thrdWorking = true; m_thrdWorking = true;
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
m_cf.stopCoverLoader();
_stopSounds();
MusicPlayer.Cleanup();
SoundHandle.Cleanup();
soundDeinit();
NandHandle.Disable_Emu();
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_GCcopyGame, (void *)this, 0, 8 * 1024, 64); LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_GCcopyGame, (void *)this, 0, 8 * 1024, 64);
break; break;
} }
@ -454,7 +452,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
if (!m_thrdMessage.empty()) if (!m_thrdMessage.empty())
m_btnMgr.setText(m_wbfsLblDialog, m_thrdMessage); m_btnMgr.setText(m_wbfsLblDialog, m_thrdMessage);
m_btnMgr.setProgress(m_wbfsPBar, m_thrdProgress); m_btnMgr.setProgress(m_wbfsPBar, m_thrdProgress);
m_btnMgr.setText(m_wbfsLblMessage, wfmt( L"%i%%", (int)(m_thrdProgress * 100.f))); m_btnMgr.setText(m_wbfsLblMessage, wfmt(L"%i%%", (int)(m_thrdProgress * 100.f)));
if(!m_thrdWorking) if(!m_thrdWorking)
{ {
if(op == CMenu::WO_ADD_GAME) if(op == CMenu::WO_ADD_GAME)

View File

@ -30,6 +30,7 @@
void Plugin::init(const string& m_pluginsDir) void Plugin::init(const string& m_pluginsDir)
{ {
PluginMagicWord[8] = '\0';
pluginsDir = m_pluginsDir; pluginsDir = m_pluginsDir;
//Ready to add plugins //Ready to add plugins
adding = true; adding = true;
@ -150,8 +151,6 @@ void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode)
{ {
if(pos < Plugins.size()) if(pos < Plugins.size())
{ {
char PluginMagicWord[9];
memset(PluginMagicWord, 0, sizeof(PluginMagicWord));
strncpy(PluginMagicWord, fmt("%08x", Plugins[pos].magicWord), 8); strncpy(PluginMagicWord, fmt("%08x", Plugins[pos].magicWord), 8);
if(ForceMode == 1) if(ForceMode == 1)
cfg.setBool(PLUGIN_DOMAIN, PluginMagicWord, false); cfg.setBool(PLUGIN_DOMAIN, PluginMagicWord, false);
@ -165,11 +164,9 @@ void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode)
const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg) const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg)
{ {
enabledPlugins.clear(); enabledPlugins.clear();
char PluginMagicWord[9];
u8 enabledPluginsNumber = 0; u8 enabledPluginsNumber = 0;
for(u8 i = 0; i < Plugins.size(); i++) for(u8 i = 0; i < Plugins.size(); i++)
{ {
memset(PluginMagicWord, 0, sizeof(PluginMagicWord));
strncpy(PluginMagicWord, fmt("%08x", Plugins[i].magicWord), 8); strncpy(PluginMagicWord, fmt("%08x", Plugins[i].magicWord), 8);
if(cfg.getBool(PLUGIN_DOMAIN, PluginMagicWord, true)) if(cfg.getBool(PLUGIN_DOMAIN, PluginMagicWord, true))
{ {
@ -264,8 +261,8 @@ string Plugin::GenerateCoverLink(dir_discHdr gameHeader, const string& constURL,
strncpy(gamePath, gameHeader.path, sizeof(gamePath)); strncpy(gamePath, gameHeader.path, sizeof(gamePath));
const string& cachedCRC = Checksums.getString("CHECKSUMS", gamePath); const string& cachedCRC = Checksums.getString("CHECKSUMS", gamePath);
char crc_string[9]; char crc_string[9];
memset(crc_string, 0, sizeof(crc_string)); crc_string[8] = '\0';
if(cachedCRC.size() > 1) if(cachedCRC.size() == 8)
{ {
gprintf("CRC32 of %s is cached\n", gamePath); gprintf("CRC32 of %s is cached\n", gamePath);
strncpy(crc_string, cachedCRC.c_str(), 8); strncpy(crc_string, cachedCRC.c_str(), 8);

View File

@ -74,6 +74,7 @@ private:
s8 GetPluginPosition(u32 magic); s8 GetPluginPosition(u32 magic);
vector<PluginOptions> Plugins; vector<PluginOptions> Plugins;
vector<bool> enabledPlugins; vector<bool> enabledPlugins;
char PluginMagicWord[9];
s8 Plugin_Pos; s8 Plugin_Pos;
string pluginsDir; string pluginsDir;
bool adding; bool adding;

View File

@ -1,10 +1,8 @@
#include "wstringEx.hpp" #include "wstringEx.hpp"
using namespace std;
wstringEx::wstringEx(const wchar_t *s) : wstringEx::wstringEx(const wchar_t *s) :
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >(s) basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >(s)
{ {
} }
@ -15,26 +13,22 @@ wstringEx::wstringEx(const basic_string<wchar_t, char_traits<wchar_t>, allocator
wstringEx::wstringEx(const string &s) wstringEx::wstringEx(const string &s)
{ {
std::string::size_type size; size_type size = s.size();
size = s.size();
resize(size); resize(size);
for (std::string::size_type i = 0; i < size; ++i) for (size_type i = 0; i < size; ++i)
(*this)[i] = (unsigned char)s[i]; (*this)[i] = (unsigned char)s[i];
} }
wstringEx &wstringEx::operator=(const string &s) wstringEx &wstringEx::operator=(const string &s)
{ {
std::string::size_type size; size_type size = s.size();
resize(size);
size = s.size(); for (size_type i = 0; i < size; ++i)
this->resize(size);
for (std::string::size_type i = 0; i < size; ++i)
(*this)[i] = (unsigned char)s[i]; (*this)[i] = (unsigned char)s[i];
return *this; return *this;
} }
static size_t utf8Len(const char *s) static inline size_t utf8Len(const string &s)
{ {
size_t len = 0; size_t len = 0;
@ -72,7 +66,7 @@ static size_t utf8Len(const char *s)
return len; return len;
} }
void wstringEx::fromUTF8(const char *s) void wstringEx::fromUTF8(const string &s)
{ {
size_t len = utf8Len(s); size_t len = utf8Len(s);

View File

@ -3,19 +3,19 @@
#define __WSTRINGEX_HPP #define __WSTRINGEX_HPP
#include <string> #include <string>
using namespace std;
class wstringEx : public std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > class wstringEx : public basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >
{ {
public: public:
wstringEx(void) { } wstringEx(void) { }
wstringEx(const wchar_t *s); wstringEx(const wchar_t *s);
wstringEx(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > &ws); wstringEx(const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > &ws);
wstringEx(const std::string &s); wstringEx(const string &s);
wstringEx &operator=(const std::string &s); wstringEx &operator=(const string &s);
void fromUTF8(const char *s); void fromUTF8(const string &s);
std::string toUTF8(void) const; string toUTF8(void) const;
}; };
#endif // !defined(__WSTRINGEX_HPP) #endif // !defined(__WSTRINGEX_HPP)