diff --git a/Makefile.main b/Makefile.main index bc544c5c..76ea8494 100644 --- a/Makefile.main +++ b/Makefile.main @@ -55,7 +55,7 @@ ios := 249 #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -ggdb -Os -Wall -Wextra $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H +CFLAGS = -g -ggdb -Os -Wall -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H CXXFLAGS = $(CFLAGS) LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register diff --git a/out/bins/app_booter.bin b/out/bins/app_booter.bin index 6b66aefc..5b6e1c35 100644 Binary files a/out/bins/app_booter.bin and b/out/bins/app_booter.bin differ diff --git a/out/bins/ext_booter.bin b/out/bins/ext_booter.bin index 785562ef..e1f67849 100644 Binary files a/out/bins/ext_booter.bin and b/out/bins/ext_booter.bin differ diff --git a/out/bins/ext_loader.bin b/out/bins/ext_loader.bin index 078e8996..f392664c 100644 Binary files a/out/bins/ext_loader.bin and b/out/bins/ext_loader.bin differ diff --git a/out/boot.dol b/out/boot.dol index 78efd12b..6e4095cb 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/portlibs/lib/libcustomfat.a b/portlibs/lib/libcustomfat.a index 6a7ffd78..0cbd9ca1 100644 Binary files a/portlibs/lib/libcustomfat.a and b/portlibs/lib/libcustomfat.a differ diff --git a/portlibs/lib/libturbojpeg.a b/portlibs/lib/libturbojpeg.a index 7cda9dff..2fac7b11 100644 Binary files a/portlibs/lib/libturbojpeg.a and b/portlibs/lib/libturbojpeg.a differ diff --git a/portlibs/lib/libvorbisidec.a b/portlibs/lib/libvorbisidec.a index 61bbfd72..e5509293 100644 Binary files a/portlibs/lib/libvorbisidec.a and b/portlibs/lib/libvorbisidec.a differ diff --git a/resources/wiiflow_game_booter/source/ChannelHandler.cpp b/resources/wiiflow_game_booter/source/ChannelHandler.cpp index dc2d4b71..c30756af 100644 --- a/resources/wiiflow_game_booter/source/ChannelHandler.cpp +++ b/resources/wiiflow_game_booter/source/ChannelHandler.cpp @@ -54,7 +54,7 @@ char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32); static u8 *GetDol(u32 bootcontent, u64 title) { memset(filepath, 0, ISFS_MAXPATH); - sprintf(filepath, "/title/%08x/%08x/content/%08x.app", TITLE_UPPER(title), TITLE_LOWER(title), bootcontent); + sprintf(filepath, "/title/%08lx/%08lx/content/%08lx.app", TITLE_UPPER(title), TITLE_LOWER(title), bootcontent); u32 contentSize = 0; @@ -83,7 +83,7 @@ static bool GetAppNameFromTmd(bool dol, u32 *bootcontent, u64 title, u32 *IOS) bool ret = false; memset(filepath, 0, ISFS_MAXPATH); - sprintf(filepath, "/title/%08x/%08x/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)); + sprintf(filepath, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)); u32 size; u8 *data = ISFS_GetFile(filepath, &size, -1); diff --git a/resources/wiiflow_game_booter/source/patchcode.c b/resources/wiiflow_game_booter/source/patchcode.c index e6d5dd63..88c8396a 100644 --- a/resources/wiiflow_game_booter/source/patchcode.c +++ b/resources/wiiflow_game_booter/source/patchcode.c @@ -59,28 +59,28 @@ extern void multidolhook(u32 address); extern void langvipatch(u32 address, u32 len, u8 langbyte); extern void vipatch(u32 address, u32 len); -static const u32 multidolpatch1[2] = {0x3C03FFB4,0x28004F43}; -static const u32 multidolpatch2[2] = {0x3F608000, 0x807B0018}; +//static const u32 multidolpatch1[2] = {0x3C03FFB4,0x28004F43}; +//static const u32 multidolpatch2[2] = {0x3F608000, 0x807B0018}; -static const u32 healthcheckhook[2] = {0x41810010,0x881D007D}; -static const u32 updatecheckhook[3] = {0x80650050,0x80850054,0xA0A50058}; +//static const u32 healthcheckhook[2] = {0x41810010,0x881D007D}; +//static const u32 updatecheckhook[3] = {0x80650050,0x80850054,0xA0A50058}; -static const u32 recoveryhooks[3] = {0xA00100AC,0x5400073E,0x2C00000F}; +//static const u32 recoveryhooks[3] = {0xA00100AC,0x5400073E,0x2C00000F}; -static const u32 nocopyflag1[3] = {0x540007FF, 0x4182001C, 0x80630068}; -static const u32 nocopyflag2[3] = {0x540007FF, 0x41820024, 0x387E12E2}; +//static const u32 nocopyflag1[3] = {0x540007FF, 0x4182001C, 0x80630068}; +//static const u32 nocopyflag2[3] = {0x540007FF, 0x41820024, 0x387E12E2}; // this one is for the GH3 and VC saves //static const u32 nocopyflag3[5] = {0x2C030000, 0x40820010, 0x88010020, 0x28000002, 0x41820234}; -static const u32 nocopyflag3[5] = {0x2C030000, 0x41820200,0x48000058,0x38610100}; +//static const u32 nocopyflag3[5] = {0x2C030000, 0x41820200,0x48000058,0x38610100}; // this removes the display warning for no copy VC and GH3 saves -static const u32 nocopyflag4[4] = {0x80010008, 0x2C000000, 0x4182000C, 0x3BE00001}; -static const u32 nocopyflag5[3] = {0x801D0024,0x540007FF,0x41820024}; +//static const u32 nocopyflag4[4] = {0x80010008, 0x2C000000, 0x4182000C, 0x3BE00001}; +//static const u32 nocopyflag5[3] = {0x801D0024,0x540007FF,0x41820024}; -static const u32 movedvdpatch[3] = {0x2C040000, 0x41820120, 0x3C608109}; -static const u32 regionfreehooks[5] = {0x7C600774, 0x2C000001, 0x41820030,0x40800010,0x2C000000}; -static const u32 cIOScode[16] = {0x7f06c378, 0x7f25cb78, 0x387e02c0, 0x4cc63182}; -static const u32 cIOSblock[16] = {0x2C1800F9, 0x40820008, 0x3B000024}; -static const u32 fwritepatch[8] = {0x9421FFD0,0x7C0802A6,0x90010034,0xBF210014,0x7C9B2378,0x7CDC3378,0x7C7A1B78,0x7CB92B78}; // bushing fwrite +//static const u32 movedvdpatch[3] = {0x2C040000, 0x41820120, 0x3C608109}; +//static const u32 regionfreehooks[5] = {0x7C600774, 0x2C000001, 0x41820030,0x40800010,0x2C000000}; +//static const u32 cIOScode[16] = {0x7f06c378, 0x7f25cb78, 0x387e02c0, 0x4cc63182}; +//static const u32 cIOSblock[16] = {0x2C1800F9, 0x40820008, 0x3B000024}; +//static const u32 fwritepatch[8] = {0x9421FFD0,0x7C0802A6,0x90010034,0xBF210014,0x7C9B2378,0x7CDC3378,0x7C7A1B78,0x7CB92B78}; // bushing fwrite static const u32 vipatchcode[3] = {0x4182000C,0x4180001C,0x48000018}; const u32 viwiihooks[4] = {0x7CE33B78,0x38870034,0x38A70038,0x38C7004C}; @@ -99,8 +99,8 @@ const u32 multidolchanhooks[4] = {0x4200FFF4, 0x48000004, 0x38800000, 0x4E800020 const u32 langpatch[3] = {0x7C600775, 0x40820010, 0x38000000}; -static const u32 oldpatch002[3] = {0x2C000000, 0x40820214, 0x3C608000}; -static const u32 newpatch002[3] = {0x2C000000, 0x48000214, 0x3C608000}; +//static const u32 oldpatch002[3] = {0x2C000000, 0x40820214, 0x3C608000}; +//static const u32 newpatch002[3] = {0x2C000000, 0x48000214, 0x3C608000}; unsigned char sig_fwrite[32] = { diff --git a/source/banner/BannerWindow.hpp b/source/banner/BannerWindow.hpp index 32f3b4eb..605397fd 100644 --- a/source/banner/BannerWindow.hpp +++ b/source/banner/BannerWindow.hpp @@ -65,10 +65,10 @@ protected: void ChangeGame(Banner *banner); void Init(u8 *font1, u8 *font2); - static const float fBannerWidth = 608.f; - static const float fBannerHeight = 448.f; - static const float fIconWidth = 128.f; - static const float fIconHeight = 96.f; + static constexpr float fBannerWidth = 608.f; + static constexpr float fBannerHeight = 448.f; + static constexpr float fIconWidth = 128.f; + static constexpr float fIconHeight = 96.f; bool reducedVol; int returnVal; diff --git a/source/booter/external_booter.cpp b/source/booter/external_booter.cpp index eaa71f38..dd765e42 100644 --- a/source/booter/external_booter.cpp +++ b/source/booter/external_booter.cpp @@ -44,7 +44,7 @@ the_CFG normalCFG; #define LDR_ENTRY ((entry)LDR_ADDR) u8 *extldr_ptr = NULL; -size_t extldr_size = 0; +u32 extldr_size = 0; extern "C" { u8 configbytes[2]; @@ -59,7 +59,7 @@ extern u32 gameconfsize; extern u32 *gameconf; u8 *booter_ptr = NULL; -size_t booter_size = 0; +u32 booter_size = 0; void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio, u32 returnTo, u8 BootType, bool use_led) diff --git a/source/channel/MD5.h b/source/channel/MD5.h index 33b9fe40..f33a93c8 100644 --- a/source/channel/MD5.h +++ b/source/channel/MD5.h @@ -88,7 +88,7 @@ extern "C" typedef struct { unsigned int len; - unsigned int ABCD[4]; + unsigned long int ABCD[4]; int b_used; unsigned char block[64]; } auth_md5Ctx; diff --git a/source/channel/channel_launcher.cpp b/source/channel/channel_launcher.cpp index bfca91fe..7d9936d9 100644 --- a/source/channel/channel_launcher.cpp +++ b/source/channel/channel_launcher.cpp @@ -42,8 +42,8 @@ bool Identify(u64 titleid) char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32); memset(filepath, 0, ISFS_MAXPATH); - gprintf("Reading TMD for %08x %08x...", TITLE_UPPER(titleid), TITLE_LOWER(titleid)); - sprintf(filepath, "/title/%08x/%08x/content/title.tmd", TITLE_UPPER(titleid), TITLE_LOWER(titleid)); + gprintf("Reading TMD for %08lx %08lx...", TITLE_UPPER(titleid), TITLE_LOWER(titleid)); + sprintf(filepath, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(titleid), TITLE_LOWER(titleid)); u32 tmdSize; u8 *tmdBuffer = ISFS_GetFile(filepath, &tmdSize, -1); if (tmdBuffer == NULL || tmdSize == 0) diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index dbeee987..c9486ccf 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -898,11 +898,11 @@ void Nand::CreateTitleTMD(dir_discHdr *hdr) u32 highTID = *(u32*)(titleTMD+0x18c); u32 lowTID = *(u32*)(titleTMD+0x190); - CreatePath("%s/title/%08x/%08x/data", FullNANDPath, highTID, lowTID); - CreatePath("%s/title/%08x/%08x/content", FullNANDPath, highTID, lowTID); + CreatePath("%s/title/%08lx/%08lx/data", FullNANDPath, highTID, lowTID); + CreatePath("%s/title/%08lx/%08lx/content", FullNANDPath, highTID, lowTID); char nandpath[MAX_FAT_PATH]; - snprintf(nandpath, sizeof(nandpath), "%s/title/%08x/%08x/content/title.tmd", FullNANDPath, highTID, lowTID); + snprintf(nandpath, sizeof(nandpath), "%s/title/%08lx/%08lx/content/title.tmd", FullNANDPath, highTID, lowTID); if(fsop_FileExist(nandpath)) { @@ -1234,8 +1234,7 @@ u8 *Nand::GetTMD(u64 title, u32 *size) { u8 *tmd_buf = NULL; u32 tmd_size = 0; - char *tmd_path = fmt_malloc("/title/%08x/%08x/content/title.tmd", - TITLE_UPPER(title), TITLE_LOWER(title)); + char *tmd_path = fmt_malloc("/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)); if(tmd_path != NULL) { tmd_buf = GetEmuFile(tmd_path, &tmd_size); diff --git a/source/cheats/gct.cpp b/source/cheats/gct.cpp index 97699981..509669b9 100644 --- a/source/cheats/gct.cpp +++ b/source/cheats/gct.cpp @@ -53,100 +53,6 @@ string GCTCheats::getCheatComment(unsigned int nr) return ERRORRANGE; } -int GCTCheats::createGCT(unsigned int nr,const char * filename) -{ - if (nr == 0)return 0; - - ofstream filestr; - filestr.open(filename); - if (filestr.fail()) return 0; - - //Header and Footer - char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde}; - char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - string buf = getCheat(nr); - filestr.write(header,sizeof(header)); - - int x = 0; - while (x < (int)buf.size()) - { - string temp = buf.substr(x,2); - long int li = strtol(temp.c_str(),NULL,16); - temp = li; - filestr.write(temp.c_str(),1); - x +=2; - } - filestr.write(footer,sizeof(footer)); - filestr.close(); - - return 1; -} - -int GCTCheats::createGCT(const char * chtbuffer,const char * filename) -{ - ofstream filestr; - filestr.open(filename); - if (filestr.fail()) return 0; - - //Header and Footer - char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde}; - char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - string buf = chtbuffer; - filestr.write(header,sizeof(header)); - - int x = 0; - while (x < (int)buf.size()) - { - string temp = buf.substr(x,2); - long int li = strtol(temp.c_str(),NULL,16); - temp = li; - filestr.write(temp.c_str(),1); - x +=2; - } - filestr.write(footer,sizeof(footer)); - filestr.close(); - - return 1; -} - -int GCTCheats::createGCT(int nr[],int cnt,const char * filename) -{ - if (cnt == 0) return 0; - - ofstream filestr; - filestr.open(filename); - if (filestr.fail()) return 0; - - //Header and Footer - char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde}; - char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - filestr.write(header,sizeof(header)); - - int c = 0; - while (c != cnt) - { - string buf = getCheat(nr[c]); - - int x = 0; - while (x < (int)buf.size()) - { - string temp = buf.substr(x,2); - long int li = strtol(temp.c_str(),NULL,16); - temp = li; - filestr.write(temp.c_str(),1); - x +=2; - } - c++; - } - filestr.write(footer,sizeof(footer)); - filestr.close(); - - return 1; -} - //creates gct from internal array int GCTCheats::createGCT(const char * filename) { @@ -182,7 +88,7 @@ int GCTCheats::createGCT(const char * filename) return 1; } -//creates txt from internal array +//rewrite and save code.txt to mark which codes are #selected# int GCTCheats::createTXT(const char * filename) { @@ -231,8 +137,6 @@ int GCTCheats::openTxtfile(const char * filename) int i = 0; string str; - int codestatus; - bool codedynamic = false; // cheat contains X-Codes? filestr.seekg(0,ios_base::end); int size = filestr.tellg(); @@ -247,36 +151,27 @@ int GCTCheats::openTxtfile(const char * filename) if (sGameTitle[sGameTitle.length() - 1] == '\r') sGameTitle.erase(sGameTitle.length() - 1); - getline(filestr,sCheatName[i]); // skip first line if file uses CRLF - if (!sGameTitle[sGameTitle.length() - 1] == '\r') - filestr.seekg(0,ios_base::beg); - - while (!filestr.eof()) { - getline(filestr,sCheatName[i]); // '\n' delimiter by default + while (!filestr.eof()) + { + getline(filestr,sCheatName[i]); if (sCheatName[i][sCheatName[i].length() - 1] == '\r') sCheatName[i].erase(sCheatName[i].length() - 1); + if (sCheatName[i].length() == 0) + continue; + string cheatdata; - bool emptyline = false; - while (!emptyline) + while (!filestr.eof()) { getline(filestr,str); if (str[str.length() - 1] == '\r') str.erase(str.length() - 1); if (str == "" || str[0] == '\r' || str[0] == '\n') - { - emptyline = true; break; - } - codestatus = IsCodeEx(str); - if (codestatus == 1) - // line contains X code, so whole cheat is dynamic - codedynamic = true; - - if (codestatus == 2) + if (IsCode(str)) { // remove any garbage (comment) after code while (str.size() > 17) @@ -288,16 +183,13 @@ int GCTCheats::openTxtfile(const char * filename) } else sCheatComment[i] = str; - - if (filestr.eof()) break; - } - if (!codedynamic && cheatdata.size() > 0) + if (cheatdata.size() > 0) { sCheats[i] = cheatdata; sCheatSelected[i] = false; - // if comment starts with dynamic, it is selected + // wiiflow rewrites and saves code.txt with #selected# added to comments if cheat selected if (sCheatComment[i].compare(0,10,"#selected#") == 0) { sCheatSelected[i] = true; @@ -308,7 +200,6 @@ int GCTCheats::openTxtfile(const char * filename) else sCheatComment[i] = ""; - codedynamic = false; if (i == MAXCHEATS) break; } iCntCheats = i; diff --git a/source/cheats/gct.h b/source/cheats/gct.h index 2032920d..e882b8e5 100644 --- a/source/cheats/gct.h +++ b/source/cheats/gct.h @@ -34,30 +34,10 @@ public: //!\param filename name of TXT file //!\return error code int openTxtfile(const char * filename); - //!Creates GCT file for one cheat - //!\param nr selected Cheat Numbers - //!\param filename name of GCT file - //!\return error code - int createGCT(unsigned int nr,const char * filename); - //!Creates GCT file from a buffer - //!\param chtbuffer buffer that holds the cheat data - //!\param filename name of GCT file - //!\return error code - int createGCT(const char * chtbuffer,const char * filename); - //!Creates GCT file - //!\param nr[] array of selected Cheat Numbers - //!\param cnt size of array - //!\param filename name of GCT file - //!\return error code - int createGCT(int nr[],int cnt,const char * filename); //!Creates GCT file //!\param filename name of GCT file //!\return error code int createGCT(const char * filename); - //!Creates directly gct in memory - //!\param filename name of TXT file - //!\return GCT buffer - string createGCTbuff(int nr[],int cnt); //!Creates TXT file //!\param filename name of GCT file //!\return error code diff --git a/source/fileOps/fileOps.c b/source/fileOps/fileOps.c index 88287d26..3536ff90 100644 --- a/source/fileOps/fileOps.c +++ b/source/fileOps/fileOps.c @@ -33,7 +33,7 @@ static u64 folderSize = 0; u64 FolderProgressBytes; // return false if the file doesn't exist -bool fsop_GetFileSizeBytes(const char *path, size_t *filesize) // for me stats st_size report always 0 :( +bool fsop_GetFileSizeBytes(const char *path, u32 *filesize) // for me stats st_size report always 0 :( { FILE *f; size_t size = 0; @@ -79,7 +79,7 @@ u64 fsop_GetFolderBytes(const char *source) bytes += fsop_GetFolderBytes(newSource); else // It is a file ! { - size_t s; + u32 s; fsop_GetFileSizeBytes(newSource, &s); bytes += s; } @@ -203,7 +203,7 @@ bool fsop_CopyFile(const char *source, const char *target, progress_callback_t s // write current block wb = fwrite(&buff[bi*block], 1, rb, ft); - if(wb != wb || rb == 0) + if(wb != rb || rb == 0) err = 1; bytes += rb; diff --git a/source/fileOps/fileOps.h b/source/fileOps/fileOps.h index 552b0737..6758d71c 100644 --- a/source/fileOps/fileOps.h +++ b/source/fileOps/fileOps.h @@ -12,7 +12,7 @@ extern "C" typedef void (*progress_callback_t)(int status,int total,void *user_data); -bool fsop_GetFileSizeBytes(const char *path, size_t *filesize); +bool fsop_GetFileSizeBytes(const char *path, u32 *filesize); u64 fsop_GetFolderBytes(const char *source); u32 fsop_GetFolderKb(const char *source); u32 fsop_GetFreeSpaceKb(const char *path); diff --git a/source/gecko/gecko.cpp b/source/gecko/gecko.cpp index de313727..ac3c480f 100644 --- a/source/gecko/gecko.cpp +++ b/source/gecko/gecko.cpp @@ -20,7 +20,8 @@ bool bufferMessages = true; char gprintfBuffer[GPRINTF_SIZE]; char sdwritebuffer[SDWRITE_SIZE]; -static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len) +//static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len) +static ssize_t __out_write(struct _reent *r __attribute__((unused)), void *fd __attribute__((unused)), const char *ptr, size_t len) { if(geckoinit && ptr) { @@ -58,6 +59,7 @@ static const devoptab_t gecko_out = { NULL, // device deviceData NULL, // device chmod_r NULL, // device fchmod_r + NULL, // device rmdir_r }; static void USBGeckoOutput() diff --git a/source/gecko/wifi_gecko.cpp b/source/gecko/wifi_gecko.cpp index 62e6c685..6565c364 100644 --- a/source/gecko/wifi_gecko.cpp +++ b/source/gecko/wifi_gecko.cpp @@ -73,8 +73,8 @@ int WifiGecko::Connect() if(inited == false) return -2; - if(connection != -1 || dest_ip == NULL || dest_port == 0) - return connection; + if(connection != -1 || dest_ip == NULL || dest_port == 0) + return connection; int tmp_con = -1; memset(&connect_addr, 0, sizeof(connect_addr)); @@ -85,8 +85,8 @@ int WifiGecko::Connect() connect_addr.sin_family = AF_INET; tmp_con = net_socket(connect_addr.sin_family, SOCK_DGRAM, IPPROTO_IP); #endif - if(tmp_con < 0) - return -3; + if(tmp_con < 0) + return -3; connect_addr.sin_port = htons(dest_port); inet_aton(dest_ip, &connect_addr.sin_addr); diff --git a/source/gui/GameTDB.cpp b/source/gui/GameTDB.cpp index c6c6819c..100419eb 100644 --- a/source/gui/GameTDB.cpp +++ b/source/gui/GameTDB.cpp @@ -902,7 +902,7 @@ int GameTDB::GetAccessories(const char *id, vector & acc_list) u32 GameTDB::FindCaseColor(char *data) { - u32 color = -1; + u32 color = -1;// -1 = ffffffff char *ColorNode = GetNodeText(data, "> 16), month = (return >> 8) & 0xFF, day = return & 0xFF - unsigned int GetPublishDate(const char *id); + u32 GetPublishDate(const char *id); //! Get the genre list of a game for a specific game id bool GetGenres(const char * id, const char * &gen); //! Get the rating type for a specific game id @@ -110,7 +110,7 @@ public: int GetAccessories(const char * id, vector & acc_list); //! Get the box (case) color for a specific game id //! Returns the color in RGB (first 3 bytes) - unsigned int GetCaseColor(const char * id); + u32 GetCaseColor(const char * id); int GetCaseVersions(const char * id); //! Convert a specific game rating to a string static const char * RatingToString(int rating); @@ -126,7 +126,7 @@ private: bool SaveGameOffsets(const char * path); bool CheckTitlesIni(const char * path); bool FindTitle(char *data, const char * &title, const string &langCode); - unsigned int FindCaseColor(char * data); + u32 FindCaseColor(char * data); inline int GetData(char * data, int offset, int size); inline char * LoadGameNode(const char * id); inline char * GetGameNode(const char * id); diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index f9ae5708..3312ce9d 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -309,7 +309,7 @@ void CCoverFlow::setHQcover(bool HQ) void CCoverFlow::setBufferSize(u32 numCovers) { if(m_covers != NULL) return; - m_numBufCovers = min(max(4u, numCovers / 2u), 40u);//8 to 80 + m_numBufCovers = min(max(4ul, numCovers / 2ul), 40ul);//8 to 80 } void CCoverFlow::setTextures(const string &loadingPic, const string &loadingPicFlat, const string &noCoverPic, const string &noCoverPicFlat) @@ -348,8 +348,8 @@ void CCoverFlow::_transposeCover(CCover* &dst, u32 rows, u32 columns, int pos) void CCoverFlow::setRange(u32 rows, u32 columns) { - rows = rows < 3u ? 1u : min(rows | 1u, 9u) + 2u; - columns = min(max(3u, columns | 1u), 21u) + 2u; + rows = rows < 3ul ? 1ul : min(rows | 1ul, 9ul) + 2ul; + columns = min(max(3ul, columns | 1ul), 21ul) + 2ul; u32 range = rows * columns; if (rows == m_rows && columns == m_columns && range == m_range) return; @@ -562,7 +562,7 @@ void CCoverFlow::setBlur(u32 blurResolution, u32 blurRadius, float blurFactor) static const struct { u32 x; u32 y; } blurRes[] = { { 64, 48 }, { 96, 72 }, { 128, 96 }, { 192, 144 } }; - u32 i = min(max(0u, blurResolution), sizeof blurRes / sizeof blurRes[0] - 1u); + u32 i = min(max(0ul, blurResolution), sizeof blurRes / sizeof blurRes[0] - 1ul); m_effectTex.width = blurRes[i].x; m_effectTex.height = blurRes[i].y; if(m_effectTex.data != NULL) @@ -570,7 +570,7 @@ void CCoverFlow::setBlur(u32 blurResolution, u32 blurRadius, float blurFactor) free(m_effectTex.data); m_effectTex.data = NULL; } - m_blurRadius = min(max(1u, blurRadius), 3u); + m_blurRadius = min(max(1ul, blurRadius), 3ul); m_blurFactor = min(max(1.f, blurFactor), 2.f); } @@ -2683,7 +2683,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover) gameNameOrID = strrchr(blankCoverPath, '/') + 1; } else - gameNameOrID = getPathId(m_items[i].hdr); + gameNameOrID = getFilenameId(m_items[i].hdr); if(m_items[i].hdr->type == TYPE_PLUGIN && m_pluginCacheFolders && !blankBoxCover) coverWfcDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]); @@ -2779,7 +2779,7 @@ void CCoverFlow::_dropHQLOD(int i) m_items[i].texture = newTex; } -const char *CCoverFlow::getPathId(const dir_discHdr *curHdr, bool extension) +const char *CCoverFlow::getFilenameId(const dir_discHdr *curHdr, bool extension) { const char *NameOrID = NULL; if(NoGameID(curHdr->type)) @@ -2826,7 +2826,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank gameNameOrID = strrchr(blankCoverPath, '/') + 1; } else - gameNameOrID = getPathId(m_items[i].hdr); + gameNameOrID = getFilenameId(m_items[i].hdr); if(m_items[i].hdr->type == TYPE_PLUGIN && m_pluginCacheFolders && !blankBoxCover) coverWfcDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]); @@ -2945,7 +2945,7 @@ int CCoverFlow::_coverLoader(CCoverFlow *cf) u32 i, j; bool hq_req = cf->m_useHQcover; bool cur_pos_hq = false; - u32 bufferSize = min(cf->m_numBufCovers * max(2u, cf->m_rows), 80u); + u32 bufferSize = min(cf->m_numBufCovers * max(2ul, cf->m_rows), 80ul); while(cf->m_loadingCovers) { diff --git a/source/gui/coverflow.hpp b/source/gui/coverflow.hpp index 1f273a66..cfb8d509 100644 --- a/source/gui/coverflow.hpp +++ b/source/gui/coverflow.hpp @@ -135,7 +135,7 @@ public: const dir_discHdr * getSpecificHdr(u32) const; wstringEx getTitle(void) const; u64 getChanTitle(void) const; - const char *getPathId(const dir_discHdr *curHdr, bool extension = true); + const char *getFilenameId(const dir_discHdr *curHdr, bool extension = true); // bool getRenderTex(void); void setRenderTex(bool); diff --git a/source/gui/gui.cpp b/source/gui/gui.cpp index 4cdd356c..94273928 100644 --- a/source/gui/gui.cpp +++ b/source/gui/gui.cpp @@ -551,7 +551,7 @@ void CButtonsMgr::up(void) } for(u32 i = 1; i <= m_elts.size(); ++i) { - u32 j = loopNum(start - i, m_elts.size()); + u32 j = loopNum(start - i, m_elts.size()); SElement &b = *m_elts[j]; if (b.t == GUIELT_BUTTON && b.visible) { @@ -584,7 +584,7 @@ void CButtonsMgr::down(void) } for(u32 i = 1; i <= m_elts.size(); ++i) { - u32 j = loopNum(start + i, m_elts.size()); + u32 j = loopNum(start + i, m_elts.size()); SElement &b = *m_elts[j]; if (b.t == GUIELT_BUTTON && b.visible) { diff --git a/source/gui/pngu.c b/source/gui/pngu.c index c29a4286..b93617e6 100644 --- a/source/gui/pngu.c +++ b/source/gui/pngu.c @@ -1101,7 +1101,7 @@ int pngu_info (IMGCTX ctx) int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlpha, int force32bit) { u32 i; - int mem_err = 0; + //int mem_err = 0; // Read info if it hasn't been read before if (!ctx->infoRead) @@ -1129,7 +1129,8 @@ int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlph free(ctx->img_data); pngu_free_info (ctx); //printf("*** This is a corrupted image!!\n"); sleep(5); - return mem_err ? PNGU_LIB_ERROR : -666; + //return mem_err ? PNGU_LIB_ERROR : -666; + return PNGU_LIB_ERROR; } png_set_error_fn(ctx->png_ptr, NULL, user_error, user_error); // Scale 16 bit samples to 8 bit @@ -1163,14 +1164,14 @@ int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlph ctx->img_data = malloc(rowbytes * ctx->prop.imgHeight); if (!ctx->img_data) { - mem_err = 1; + //mem_err = 1; goto error; } ctx->row_pointers = malloc(sizeof (png_bytep) * ctx->prop.imgHeight); if (!ctx->row_pointers) { - mem_err = 1; + //mem_err = 1; goto error; } diff --git a/source/gui/text.cpp b/source/gui/text.cpp index 46e49e8f..13c8f025 100644 --- a/source/gui/text.cpp +++ b/source/gui/text.cpp @@ -168,9 +168,9 @@ bool SFont::fromBuffer(const u8 *buffer, const u32 bufferSize, u32 size, u32 lsp { if(buffer == NULL) return false; - fSize = min(max(6u, size), 1000u); - lineSpacing = min(max(6u, lspacing), 1000u); - weight = min(w, 32u); + fSize = min(max(6ul, size), 1000ul); + lineSpacing = min(max(6ul, lspacing), 1000ul); + weight = min(w, 32ul); index = idx; if(data != NULL) @@ -190,11 +190,11 @@ bool SFont::fromBuffer(const u8 *buffer, const u32 bufferSize, u32 size, u32 lsp bool SFont::fromFile(const char *path, u32 size, u32 lspacing, u32 w, u32 idx, const char *fontname) { - fSize = min(max(6u, size), 1000u); - weight = min(w, 32u); + fSize = min(max(6ul, size), 1000ul); + weight = min(w, 32ul); index = idx = 0; - lineSpacing = min(max(6u, lspacing), 1000u); + lineSpacing = min(max(6ul, lspacing), 1000ul); if(data != NULL) free(data); diff --git a/source/gui/text.hpp b/source/gui/text.hpp index b7fb5e54..5decd9d2 100644 --- a/source/gui/text.hpp +++ b/source/gui/text.hpp @@ -28,7 +28,7 @@ public: char name[128]; private: u8 *data; - size_t dataSize; + u32 dataSize; }; struct SWord diff --git a/source/gui/video.cpp b/source/gui/video.cpp index 427d0b2c..43ff7fb8 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -262,8 +262,8 @@ void CVideo::_clearScreen() void CVideo::set2DViewport(u32 w, u32 h, int x, int y) { - m_width2D = std::min(std::max(512u, w), 800u); - m_height2D = std::min(std::max(384u, h), 600u); + m_width2D = std::min(std::max(512ul, w), 800ul); + m_height2D = std::min(std::max(384ul, h), 600ul); m_x2D = std::min(std::max(-50, x), 50); m_y2D = std::min(std::max(-50, y), 50); } @@ -271,8 +271,8 @@ void CVideo::set2DViewport(u32 w, u32 h, int x, int y) void CVideo::setup2DProjection(bool setViewPort, bool noScale) { Mtx44 projMtx; - float width2D = noScale ? 640.f : (int)m_width2D; - float height2D = noScale ? 480.f : (int)m_height2D; + float width2D = noScale ? 640.f : (float)m_width2D; + float height2D = noScale ? 480.f : (float)m_height2D; float x = noScale ? 0.f : (float)(640 - width2D) * 0.5f + (float)m_x2D; float y = noScale ? 0.f : (float)(480 - height2D) * 0.5f + (float)m_y2D; diff --git a/source/libwbfs/libwbfs.c b/source/libwbfs/libwbfs.c index c85baedb..0c7b0686 100644 --- a/source/libwbfs/libwbfs.c +++ b/source/libwbfs/libwbfs.c @@ -663,7 +663,7 @@ error: //int (*read_wiidisc_callback_t)(void*fp,u32 offset,u32 count,void*iobuf); // connect wiidisc to wbfs_disc -int read_wiidisc_wbfsdisc(void *fp, u32 offset, u32 count, void *iobuf) +s32 read_wiidisc_wbfsdisc(void *fp, u32 offset, u32 count, void *iobuf) { return wbfs_disc_read((wbfs_disc_t *)fp, offset, count, iobuf); } diff --git a/source/libwbfs/libwbfs.h b/source/libwbfs/libwbfs.h index 540d7f29..1796886d 100644 --- a/source/libwbfs/libwbfs.h +++ b/source/libwbfs/libwbfs.h @@ -63,7 +63,7 @@ typedef struct wbfs_disc_info // // callback definition. Return 1 on fatal error (callback is supposed to make retries until no hopes..) -typedef int (*rw_sector_callback_t)(void *fp, u32 lba, u32 count, void *iobuf); +typedef s32 (*rw_sector_callback_t)(void *fp, u32 lba, u32 count, void *iobuf); typedef void (*progress_callback_t)(int status, int total, void *user_data); diff --git a/source/libwbfs/wiidisc.h b/source/libwbfs/wiidisc.h index 2227ed5c..1b1b4120 100644 --- a/source/libwbfs/wiidisc.h +++ b/source/libwbfs/wiidisc.h @@ -11,7 +11,7 @@ extern "C" // callback definition. Return 1 on fatal error (callback is supposed to make retries until no hopes..) // offset points 32bit words, count counts bytes - typedef int (*read_wiidisc_callback_t)(void *fp, u32 offset, u32 count, void *iobuf); + typedef s32 (*read_wiidisc_callback_t)(void *fp, u32 offset, u32 count, void *iobuf); typedef enum { diff --git a/source/loader/fst.c b/source/loader/fst.c index 85753cb6..83934192 100644 --- a/source/loader/fst.c +++ b/source/loader/fst.c @@ -160,7 +160,7 @@ int app_gameconfig_load(const char *discid, u8 *tempgameconf, u32 tempgameconfsi } if (strncasecmp("poke", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 4) { - ret = sscanf((char *) tempgameconf + i, "( %x , %x", &codeaddr, &codeval); + ret = sscanf((char *) tempgameconf + i, "( %lx , %lx", &codeaddr, &codeval); if (ret == 2) { *(gameconf + (gameconfsize / 4)) = 0; @@ -176,7 +176,7 @@ int app_gameconfig_load(const char *discid, u8 *tempgameconf, u32 tempgameconfsi } if (strncasecmp("pokeifequal", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 11) { - ret = sscanf((char *) (tempgameconf + i), "( %x , %x , %x , %x", &codeaddr, &codeval, + ret = sscanf((char *) (tempgameconf + i), "( %lx , %lx , %lx , %lx", &codeaddr, &codeval, &codeaddr2, &codeval2); if (ret == 4) { @@ -196,7 +196,7 @@ int app_gameconfig_load(const char *discid, u8 *tempgameconf, u32 tempgameconfsi if (strncasecmp("searchandpoke", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 13) { - ret = sscanf((char *) (tempgameconf + i), "( %x%n", &codeval, &tempoffset); + ret = sscanf((char *) (tempgameconf + i), "( %lx%ln", &codeval, &tempoffset); if (ret == 1) { gameconfsize += 4; @@ -207,10 +207,10 @@ int app_gameconfig_load(const char *discid, u8 *tempgameconf, u32 tempgameconfsi gameconfsize += 4; temp++; i += tempoffset; - ret = sscanf((char *) (tempgameconf + i), " %x%n", &codeval, &tempoffset); + ret = sscanf((char *) (tempgameconf + i), " %lx%ln", &codeval, &tempoffset); } *(gameconf + (gameconfsize / 4) - temp - 1) = temp; - ret = sscanf((char *) (tempgameconf + i), " , %x , %x , %x , %x", &codeaddr, &codeaddr2, + ret = sscanf((char *) (tempgameconf + i), " , %lx , %lx , %lx , %lx", &codeaddr, &codeaddr2, &codeoffset, &codeval2); if (ret == 4) { diff --git a/source/loader/splits.c b/source/loader/splits.c index 12d3e158..ca0b4a8e 100644 --- a/source/loader/splits.c +++ b/source/loader/splits.c @@ -149,7 +149,7 @@ int split_get_file(split_info_t *s, u32 lba, u32 *sec_count, int fill) return fd; } -int split_read_sector(void *_fp, u32 lba, u32 count, void *buf) +s32 split_read_sector(void *_fp, u32 lba, u32 count, void *buf) { split_info_t *s = _fp; int fd; @@ -181,7 +181,7 @@ int split_read_sector(void *_fp, u32 lba, u32 count, void *buf) return 0; } -int split_write_sector(void *_fp, u32 lba, u32 count, void *buf) +s32 split_write_sector(void *_fp, u32 lba, u32 count, void *buf) { split_info_t *s = _fp; int fd; diff --git a/source/loader/splits.h b/source/loader/splits.h index 461461a8..c043e600 100644 --- a/source/loader/splits.h +++ b/source/loader/splits.h @@ -30,8 +30,8 @@ void split_get_fname(split_info_t *s, int idx, char *fname); int split_open_file(split_info_t *s, int idx); int split_get_file(split_info_t *s, u32 lba, u32 *sec_count, int fill); int split_fill(split_info_t *s, int idx, u64 size); -int split_read_sector(void *_fp, u32 lba, u32 count, void *buf); -int split_write_sector(void *_fp, u32 lba, u32 count, void *buf); +s32 split_read_sector(void *_fp, u32 lba, u32 count, void *buf); +s32 split_write_sector(void *_fp, u32 lba, u32 count, void *buf); void split_init(split_info_t *s, char *fname); void split_set_size(split_info_t *s, u64 split_size, u64 total_size); void split_close(split_info_t *s); diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 7620243c..d0cb7904 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -187,8 +187,10 @@ bool CMenu::init() for(u8 i = USB1; i <= USB8; i++) { if(DeviceHandle.IsInserted(i) && DeviceHandle.GetFSType(i) != PART_FS_WBFS) + { drive = DeviceName[i]; break; + } } if(drive == check && DeviceHandle.IsInserted(SD))//if no available USB partition then force SD drive = DeviceName[SD]; diff --git a/source/menu/menu_cftheme.cpp b/source/menu/menu_cftheme.cpp index 8459e81c..da9289f4 100644 --- a/source/menu/menu_cftheme.cpp +++ b/source/menu/menu_cftheme.cpp @@ -351,10 +351,12 @@ void CMenu::_cfTheme(void) if (copyVersion != cfVersion || copySelected != CoverFlow.selected()) m_coverflow.copyDomain(domDst, domSrc); else if (copyWide != wide) + { for (u32 i = 0; i < ARRAY_SIZE(CMenu::_cfParams); ++i) { const CMenu::SCFParamDesc &p = CMenu::_cfParams[i]; if (p.scrnFmt) + { for (int k = 0; k < 4; ++k) { string keySrc(p.key[k]); @@ -370,10 +372,12 @@ void CMenu::_cfTheme(void) else if (p.paramType[k] == CMenu::SCFParamDesc::PDT_INT) m_coverflow.setInt(domDst, keyDst, m_coverflow.getInt(domSrc, keySrc)); } + } } _showCFTheme(curParam, cfVersion, wide); _loadCFLayout(cfVersion, true, wide != m_vid.wide()); CoverFlow.applySettings(); + } } bool sel = CoverFlow.selected(); if (BTN_B_HELD) @@ -381,7 +385,7 @@ void CMenu::_cfTheme(void) if (BTN_PLUS_PRESSED || BTN_MINUS_PRESSED) { s8 direction = BTN_PLUS_PRESSED ? 1 : -1; - curParam = loopNum(curParam + direction, ARRAY_SIZE(CMenu::_cfParams)); + curParam = loopNum(curParam + direction, (u32)ARRAY_SIZE(CMenu::_cfParams)); if (CMenu::_cfParams[curParam].domain == CMenu::SCFParamDesc::PDD_SELECTED) CoverFlow.select(); _showCFTheme(curParam, cfVersion, wide); @@ -447,7 +451,7 @@ void CMenu::_cfTheme(void) else if (m_btnMgr.selected(m_cfThemeBtnParamP) || m_btnMgr.selected(m_cfThemeBtnParamM)) { s8 direction = m_btnMgr.selected(m_cfThemeBtnParamP) ? 1 : -1; - curParam = loopNum(curParam + direction, ARRAY_SIZE(CMenu::_cfParams)); + curParam = loopNum(curParam + direction, (u32)ARRAY_SIZE(CMenu::_cfParams)); if (CMenu::_cfParams[curParam].domain == CMenu::SCFParamDesc::PDD_SELECTED) CoverFlow.select(); _showCFTheme(curParam, cfVersion, wide); diff --git a/source/menu/menu_cheat.cpp b/source/menu/menu_cheat.cpp index 79b1eb7f..90cef3a8 100644 --- a/source/menu/menu_cheat.cpp +++ b/source/menu/menu_cheat.cpp @@ -299,7 +299,9 @@ void CMenu::_showCheatSettings(void) // cheat in range? if (((m_cheatSettingsPage-1)*CHEATSPERPAGE + i + 1) <= m_cheatfile.getCnt()) { - m_btnMgr.setText(m_cheatLblItem[i], m_cheatfile.getCheatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i)); + wstringEx chtName; + chtName.fromUTF8(m_cheatfile.getCheatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i)); + m_btnMgr.setText(m_cheatLblItem[i], chtName); m_btnMgr.setText(m_cheatBtnItem[i], _optBoolToString(m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i])); m_btnMgr.show(m_cheatLblItem[i], true); diff --git a/source/menu/menu_code.cpp b/source/menu/menu_code.cpp index 56d4ec36..69a73bb9 100644 --- a/source/menu/menu_code.cpp +++ b/source/menu/menu_code.cpp @@ -35,7 +35,7 @@ bool CMenu::_code(char code[4], bool erase) memset(code, 0, 4); m_btnMgr.setText(m_codeLblTitle, codeLbl); _showCode(); - if(erase) + if(erase)// only for setting code and erase btn clears the code so you no longer need to unlock wiiflow m_btnMgr.show(m_codeBtnErase); while(!m_exit) @@ -98,7 +98,7 @@ bool CMenu::_code(char code[4], bool erase) } } _hideCode(); - return n == sizeof code; + return n == 4; } void CMenu::_initCodeMenu() diff --git a/source/menu/menu_config3.cpp b/source/menu/menu_config3.cpp index 1d26c22a..d1772e74 100644 --- a/source/menu/menu_config3.cpp +++ b/source/menu/menu_config3.cpp @@ -86,13 +86,13 @@ int CMenu::_config3(void) if (m_btnMgr.selected(m_config3BtnLanguageP) || m_btnMgr.selected(m_config3BtnLanguageM)) { s8 direction = m_btnMgr.selected(m_config3BtnLanguageP) ? 1 : -1; - m_cfg.setInt("GENERAL", "game_language", (int)loopNum((u32)m_cfg.getInt("GENERAL", "game_language", 0) + direction, ARRAY_SIZE(CMenu::_languages))); + m_cfg.setInt("GENERAL", "game_language", (int)loopNum(m_cfg.getUInt("GENERAL", "game_language", 0) + direction, ARRAY_SIZE(CMenu::_languages))); _showConfig3(); } else if (m_btnMgr.selected(m_config3BtnVideoP) || m_btnMgr.selected(m_config3BtnVideoM)) { s8 direction = m_btnMgr.selected(m_config3BtnVideoP) ? 1 : -1; - m_cfg.setInt("GENERAL", "video_mode", (int)loopNum((u32)m_cfg.getInt("GENERAL", "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GlobalVideoModes))); + m_cfg.setInt("GENERAL", "video_mode", (int)loopNum(m_cfg.getUInt("GENERAL", "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GlobalVideoModes))); _showConfig3(); } else if (m_btnMgr.selected(m_config3BtnGCDefaults)) @@ -104,7 +104,7 @@ int CMenu::_config3(void) else if (m_btnMgr.selected(m_config3BtnChannelsTypeP) || m_btnMgr.selected(m_config3BtnChannelsTypeM)) { s8 direction = m_btnMgr.selected(m_config3BtnChannelsTypeP) ? 1 : -1; - m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", 1 + (int)loopNum((u32)m_cfg.getInt(CHANNEL_DOMAIN, "channels_type", 1) - 1 + direction, ARRAY_SIZE(CMenu::_ChannelsType))); + m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", 1 + (int)loopNum(m_cfg.getUInt(CHANNEL_DOMAIN, "channels_type", 1) - 1 + direction, ARRAY_SIZE(CMenu::_ChannelsType))); _showConfig3(); if(m_current_view & COVERFLOW_CHANNEL || m_current_view & COVERFLOW_PLUGIN) m_refreshGameList = true; diff --git a/source/menu/menu_config4.cpp b/source/menu/menu_config4.cpp index 3b2cdbc4..51acd1b2 100644 --- a/source/menu/menu_config4.cpp +++ b/source/menu/menu_config4.cpp @@ -98,7 +98,7 @@ int CMenu::_config4(void) { if (m_btnMgr.selected(m_config4BtnHome)) { - int exit_to = (int)loopNum((u32)m_cfg.getInt("GENERAL", "exit_to", 0) + 1, ARRAY_SIZE(CMenu::_exitTo)); + int exit_to = (int)loopNum(m_cfg.getUInt("GENERAL", "exit_to", 0) + 1, ARRAY_SIZE(CMenu::_exitTo)); m_cfg.setInt("GENERAL", "exit_to", exit_to); Sys_ExitTo(exit_to + 1); _showConfig4(); diff --git a/source/menu/menu_config_adv.cpp b/source/menu/menu_config_adv.cpp index 1b5ccc1e..e04535f1 100644 --- a/source/menu/menu_config_adv.cpp +++ b/source/menu/menu_config_adv.cpp @@ -19,7 +19,7 @@ void AddLanguage(char *Path) char lng[32]; memset(lng, 0, 32); char *lang_chr = strrchr(Path, '/')+1; - memcpy(lng, lang_chr, min(31u, (u32)(strrchr(lang_chr, '.')-lang_chr))); + memcpy(lng, lang_chr, min(31ul, (u32)(strrchr(lang_chr, '.')-lang_chr))); languages_available.push_back(lng); } @@ -153,7 +153,7 @@ int CMenu::_configAdv(void) else if(m_btnMgr.selected(m_configAdvBtnCurLanguageP) || m_btnMgr.selected(m_configAdvBtnCurLanguageM)) { s8 direction = m_btnMgr.selected(m_configAdvBtnCurLanguageP) ? 1 : -1; - available_pos = loopNum(available_pos + direction, languages_available.size()); + available_pos = loopNum(available_pos + direction, (u32)languages_available.size()); m_curLanguage = languages_available[available_pos]; if(!m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()))) { diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index 2e81c371..847262b6 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -153,8 +153,8 @@ void CMenu::_showGameSettings() if(GameHdr->type == TYPE_GC_GAME) { - GCLoader = min((u32)m_gcfg2.getInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); - GCLoader = (GCLoader == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 1), ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1u) : GCLoader-1; + GCLoader = min(m_gcfg2.getUInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); + GCLoader = (GCLoader == 0) ? min(m_cfg.getUInt(GC_DOMAIN, "default_loader", 1), ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1u) : GCLoader-1; } m_gameSettingsMaxPgs = 5; @@ -380,7 +380,7 @@ void CMenu::_showGameSettings() m_btnMgr.setText(m_gameSettingsBtnOcarina, _optBoolToString(m_gcfg2.getOptBool(id, "cheat", 0))); m_btnMgr.setText(m_gameSettingsBtnLED, _optBoolToString(m_gcfg2.getOptBool(id, "led", 0))); - i = min((u32)m_gcfg2.getInt(id, "debugger", 0), ARRAY_SIZE(CMenu::_debugger) - 1u); + i = min(m_gcfg2.getUInt(id, "debugger", 0), ARRAY_SIZE(CMenu::_debugger) - 1u); m_btnMgr.setText(m_gameSettingsLblDebuggerV, _t(CMenu::_debugger[i].id, CMenu::_debugger[i].text)); if(GameHdr->type == TYPE_GC_GAME) @@ -408,16 +408,16 @@ void CMenu::_showGameSettings() else m_btnMgr.setText(m_gameSettingsLblPosVal, wfmt(L"%i", max(-20, min(20, videoOffset)))); - i = min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_GCvideoModes) - 1u); + i = min(m_gcfg2.getUInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_GCvideoModes) - 1u); m_btnMgr.setText(m_gameSettingsLblVideo, _t(CMenu::_GCvideoModes[i].id, CMenu::_GCvideoModes[i].text)); - i = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); + i = min(m_gcfg2.getUInt(id, "language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); m_btnMgr.setText(m_gameSettingsLblLanguage, _t(CMenu::_GClanguages[i].id, CMenu::_GClanguages[i].text)); - i = min((u32)m_gcfg2.getInt(id, "emu_memcard", 0), ARRAY_SIZE(CMenu::_NinEmuCard) - 1u); + i = min(m_gcfg2.getUInt(id, "emu_memcard", 0), ARRAY_SIZE(CMenu::_NinEmuCard) - 1u); m_btnMgr.setText(m_gameSettingsLblEmuMemCard_Val, _t(CMenu::_NinEmuCard[i].id, CMenu::_NinEmuCard[i].text)); - i = min((u32)m_gcfg2.getInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); + i = min(m_gcfg2.getUInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); m_btnMgr.setText(m_gameSettingsLblGCLoader_Val, _t(CMenu::_GCLoader[i].id, CMenu::_GCLoader[i].text)); } else @@ -429,13 +429,13 @@ void CMenu::_showGameSettings() m_btnMgr.setText(m_gameSettingsBtnLaunchNK, _optBoolToString(m_gcfg2.getOptBool(id, "useneek", 0))); m_btnMgr.setText(m_gameSettingsBtnApploader, _optBoolToString(m_gcfg2.getOptBool(id, "apploader", 0))); - i = min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u); + i = min(m_gcfg2.getUInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u); m_btnMgr.setText(m_gameSettingsLblVideo, _t(CMenu::_VideoModes[i].id, CMenu::_VideoModes[i].text)); - i = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u); + i = min(m_gcfg2.getUInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u); m_btnMgr.setText(m_gameSettingsLblLanguage, _t(CMenu::_languages[i].id, CMenu::_languages[i].text)); - i = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u); + i = min(m_gcfg2.getUInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u); m_btnMgr.setText(m_gameSettingsLblAspectRatioVal, _t(CMenu::_AspectRatio[i].id, CMenu::_AspectRatio[i].text)); int j = 0; @@ -451,13 +451,13 @@ void CMenu::_showGameSettings() else m_btnMgr.setText(m_gameSettingsLblIOS, L"AUTO"); - i = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); + i = min(m_gcfg2.getUInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); m_btnMgr.setText(m_gameSettingsLblPatchVidModesVal, _t(CMenu::_vidModePatch[i].id, CMenu::_vidModePatch[i].text)); - i = min((u32)m_gcfg2.getInt(id, "hooktype", 0), ARRAY_SIZE(CMenu::_hooktype) - 1u); + i = min(m_gcfg2.getUInt(id, "hooktype", 0), ARRAY_SIZE(CMenu::_hooktype) - 1u); m_btnMgr.setText(m_gameSettingsLblHooktypeVal, _t(CMenu::_hooktype[i].id, CMenu::_hooktype[i].text)); - i = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); + i = min(m_gcfg2.getUInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); m_btnMgr.setText(m_gameSettingsLblEmulationVal, _t(CMenu::_SaveEmu[i].id, CMenu::_SaveEmu[i].text)); } } @@ -552,24 +552,24 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnLanguageP) ? 1 : -1; if(GameHdr->type == TYPE_GC_GAME) - m_gcfg2.setInt(id, "language", (int)loopNum((u32)m_gcfg2.getInt(id, "language", 0) + direction, ARRAY_SIZE(CMenu::_GClanguages))); + m_gcfg2.setInt(id, "language", (int)loopNum(m_gcfg2.getUInt(id, "language", 0) + direction, ARRAY_SIZE(CMenu::_GClanguages))); else - m_gcfg2.setInt(id, "language", (int)loopNum((u32)m_gcfg2.getInt(id, "language", 0) + direction, ARRAY_SIZE(CMenu::_languages))); + m_gcfg2.setInt(id, "language", (int)loopNum(m_gcfg2.getUInt(id, "language", 0) + direction, ARRAY_SIZE(CMenu::_languages))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnVideoP) || m_btnMgr.selected(m_gameSettingsBtnVideoM)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnVideoP) ? 1 : -1; if(GameHdr->type == TYPE_GC_GAME) - m_gcfg2.setInt(id, "video_mode", (int)loopNum((u32)m_gcfg2.getInt(id, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GCvideoModes))); + m_gcfg2.setInt(id, "video_mode", (int)loopNum(m_gcfg2.getUInt(id, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GCvideoModes))); else - m_gcfg2.setInt(id, "video_mode", (int)loopNum((u32)m_gcfg2.getInt(id, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_VideoModes))); + m_gcfg2.setInt(id, "video_mode", (int)loopNum(m_gcfg2.getUInt(id, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_VideoModes))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) || m_btnMgr.selected(m_gameSettingsBtnAspectRatioM)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) ? 1 : -1; - m_gcfg2.setInt(id, "aspect_ratio", (int)loopNum((u32)m_gcfg2.getInt(id, "aspect_ratio", 0) + direction, ARRAY_SIZE(CMenu::_AspectRatio))); + m_gcfg2.setInt(id, "aspect_ratio", (int)loopNum(m_gcfg2.getUInt(id, "aspect_ratio", 0) + direction, ARRAY_SIZE(CMenu::_AspectRatio))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnWidthP) || m_btnMgr.selected(m_gameSettingsBtnWidthM)) @@ -617,13 +617,13 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) else if(m_btnMgr.selected(m_gameSettingsBtnEmuMemCard_P) || m_btnMgr.selected(m_gameSettingsBtnEmuMemCard_M)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnEmuMemCard_P) ? 1 : -1; - m_gcfg2.setInt(id, "emu_memcard", (int)loopNum((u32)m_gcfg2.getInt(id, "emu_memcard", 2) + direction, ARRAY_SIZE(CMenu::_NinEmuCard))); + m_gcfg2.setInt(id, "emu_memcard", (int)loopNum(m_gcfg2.getUInt(id, "emu_memcard", 2) + direction, ARRAY_SIZE(CMenu::_NinEmuCard))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnGCLoader_P) || m_btnMgr.selected(m_gameSettingsBtnGCLoader_M)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnGCLoader_P) ? 1 : -1; - m_gcfg2.setInt(id, "gc_loader", (int)loopNum((u32)m_gcfg2.getInt(id, "gc_loader", 0) + direction, ARRAY_SIZE(CMenu::_GCLoader))); + m_gcfg2.setInt(id, "gc_loader", (int)loopNum(m_gcfg2.getUInt(id, "gc_loader", 0) + direction, ARRAY_SIZE(CMenu::_GCLoader))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnIOSM) || m_btnMgr.selected(m_gameSettingsBtnIOSP)) @@ -652,7 +652,7 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) else if(m_btnMgr.selected(m_gameSettingsBtnPatchVidModesP) || m_btnMgr.selected(m_gameSettingsBtnPatchVidModesM)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnPatchVidModesP) ? 1 : -1; - m_gcfg2.setInt(id, "patch_video_modes", (int)loopNum((u32)m_gcfg2.getInt(id, "patch_video_modes", 0) + direction, ARRAY_SIZE(CMenu::_vidModePatch))); + m_gcfg2.setInt(id, "patch_video_modes", (int)loopNum(m_gcfg2.getUInt(id, "patch_video_modes", 0) + direction, ARRAY_SIZE(CMenu::_vidModePatch))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnManage)) @@ -677,19 +677,19 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) else if(m_btnMgr.selected(m_gameSettingsBtnHooktypeP) || m_btnMgr.selected(m_gameSettingsBtnHooktypeM)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnHooktypeP) ? 1 : -1; - m_gcfg2.setInt(id, "hooktype", (int)loopNum((u32)m_gcfg2.getInt(id, "hooktype", 1) + direction, ARRAY_SIZE(CMenu::_hooktype))); + m_gcfg2.setInt(id, "hooktype", (int)loopNum(m_gcfg2.getUInt(id, "hooktype", 1) + direction, ARRAY_SIZE(CMenu::_hooktype))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnEmulationP) || m_btnMgr.selected(m_gameSettingsBtnEmulationM)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnEmulationP) ? 1 : -1; - m_gcfg2.setInt(id, "emulate_save", (int)loopNum((u32)m_gcfg2.getInt(id, "emulate_save", 0) + direction, ARRAY_SIZE(CMenu::_SaveEmu))); + m_gcfg2.setInt(id, "emulate_save", (int)loopNum(m_gcfg2.getUInt(id, "emulate_save", 0) + direction, ARRAY_SIZE(CMenu::_SaveEmu))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnDebuggerP) || m_btnMgr.selected(m_gameSettingsBtnDebuggerM)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnDebuggerP) ? 1 : -1; - m_gcfg2.setInt(id, "debugger", (int)loopNum((u32)m_gcfg2.getInt(id, "debugger", 0) + direction, ARRAY_SIZE(CMenu::_debugger))); + m_gcfg2.setInt(id, "debugger", (int)loopNum(m_gcfg2.getUInt(id, "debugger", 0) + direction, ARRAY_SIZE(CMenu::_debugger))); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnApploader)) diff --git a/source/menu/menu_config_gc.cpp b/source/menu/menu_config_gc.cpp index d57fb63d..b645b66a 100644 --- a/source/menu/menu_config_gc.cpp +++ b/source/menu/menu_config_gc.cpp @@ -105,19 +105,19 @@ void CMenu::_configGC(void) else if(m_btnMgr.selected(m_configGCBtnGCLanguageP) || m_btnMgr.selected(m_configGCBtnGCLanguageM)) { s8 direction = m_btnMgr.selected(m_configGCBtnGCLanguageP) ? 1 : -1; - m_cfg.setInt(GC_DOMAIN, "game_language", (int)loopNum((u32)m_cfg.getInt(GC_DOMAIN, "game_language", 0) + direction, ARRAY_SIZE(CMenu::_GlobalGClanguages))); + m_cfg.setInt(GC_DOMAIN, "game_language", (int)loopNum(m_cfg.getUInt(GC_DOMAIN, "game_language", 0) + direction, ARRAY_SIZE(CMenu::_GlobalGClanguages))); _showConfigGC(); } else if(m_btnMgr.selected(m_configGCBtnGCVideoP) || m_btnMgr.selected(m_configGCBtnGCVideoM)) { s8 direction = m_btnMgr.selected(m_configGCBtnGCVideoP) ? 1 : -1; - m_cfg.setInt(GC_DOMAIN, "video_mode", (int)loopNum((u32)m_cfg.getInt(GC_DOMAIN, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GlobalGCvideoModes))); + m_cfg.setInt(GC_DOMAIN, "video_mode", (int)loopNum(m_cfg.getUInt(GC_DOMAIN, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GlobalGCvideoModes))); _showConfigGC(); } else if(m_btnMgr.selected(m_configGCBtnGCLoaderP) || m_btnMgr.selected(m_configGCBtnGCLoaderM)) { s8 direction = m_btnMgr.selected(m_configGCBtnGCLoaderP) ? 1 : -1; - m_cfg.setInt(GC_DOMAIN, "default_loader", (int)loopNum((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 1) + direction, ARRAY_SIZE(CMenu::_GlobalGCLoaders))); + m_cfg.setInt(GC_DOMAIN, "default_loader", (int)loopNum(m_cfg.getUInt(GC_DOMAIN, "default_loader", 1) + direction, ARRAY_SIZE(CMenu::_GlobalGCLoaders))); _showConfigGC(); } } diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index a17857db..05e565d6 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -607,8 +607,10 @@ int CMenu::_coverDownloader(bool missingOnly) { case EN: if(( newID[3] == 'E' || newID[3] == 'X' || newID[3] == 'Y' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_EN ) + { url = makeURL(fmtURLBox[j], newID, "EN"); tdl = true; + } break; case JA: if(newID[3] == 'J' && m_downloadPrioVal&C_TYPE_JA) diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 99cd4b44..ba5fd3ba 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -278,7 +278,7 @@ static u8 GetRequestedGameIOS(dir_discHdr *hdr) void CMenu::_setCurrentItem(const dir_discHdr *hdr) { - const char *title = CoverFlow.getPathId(hdr, true);// with extension + const char *title = CoverFlow.getFilenameId(hdr, true);// with extension m_cfg.setString(_domainFromView(), "current_item", title); if(m_source_cnt > 1) m_cfg.setInt(_domainFromView(), "current_item_type", hdr->type); @@ -368,7 +368,7 @@ bool CMenu::_startVideo() const dir_discHdr *GameHdr = CoverFlow.getHdr(); char curId3[4]; memset(curId3, 0, 4); - const char *videoId = CoverFlow.getPathId(GameHdr);//title.ext + const char *videoId = CoverFlow.getFilenameId(GameHdr);//title.ext if(!NoGameID(GameHdr->type)) { //id3 memcpy(curId3, GameHdr->id, 3); @@ -1017,7 +1017,7 @@ void CMenu::_launch(const dir_discHdr *hdr) } /* get title from hdr */ u32 title_len_no_ext = 0; - const char *title = CoverFlow.getPathId(hdr, true);// with extension + const char *title = CoverFlow.getFilenameId(hdr, true);// with extension //m_cfg.setString(_domainFromView(), "current_item", title); /* get path from hdr */ @@ -1087,8 +1087,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) const char *id = hdr->id; /* Get loader choice*/ - u8 loader = min((u32)m_gcfg2.getInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); - loader = (loader == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 1), ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1u) : loader-1; + u8 loader = min(m_gcfg2.getUInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); + loader = (loader == 0) ? min(m_cfg.getUInt(GC_DOMAIN, "default_loader", 1), ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1u) : loader-1; if(disc) loader = NINTENDONT; @@ -1117,14 +1117,14 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) else path = hdr->path; - u8 GClanguage = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); - GClanguage = (GClanguage == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1; + u8 GClanguage = min(m_gcfg2.getUInt(id, "language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); + GClanguage = (GClanguage == 0) ? min(m_cfg.getUInt(GC_DOMAIN, "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1; // language selection only works for PAL games if(id[3] == 'E' || id[3] == 'J') GClanguage = 1; //=english - u8 videoMode = min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_GCvideoModes) - 1u); - videoMode = (videoMode == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalGCvideoModes) - 1u) : videoMode-1; + u8 videoMode = min(m_gcfg2.getUInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_GCvideoModes) - 1u); + videoMode = (videoMode == 0) ? min(m_cfg.getUInt(GC_DOMAIN, "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalGCvideoModes) - 1u) : videoMode-1; bool widescreen = m_gcfg2.getBool(id, "widescreen", false); bool activity_led = m_gcfg2.getBool(id, "led", false); @@ -1132,8 +1132,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) if(loader == NINTENDONT) { /* might add here - if not a disc use path to check for disc2.iso - if so then we need to prompt disc 1 or disc 2? */ - u8 emuMC = min((u32)m_gcfg2.getInt(id, "emu_memcard", 0), ARRAY_SIZE(CMenu::_NinEmuCard) - 1u); - emuMC = (emuMC == 0) ? m_cfg.getInt(GC_DOMAIN, "emu_memcard", 1) : emuMC - 1; + u8 emuMC = min(m_gcfg2.getUInt(id, "emu_memcard", 0), ARRAY_SIZE(CMenu::_NinEmuCard) - 1u); + emuMC = (emuMC == 0) ? m_cfg.getUInt(GC_DOMAIN, "emu_memcard", 1) : emuMC - 1; // these 2 settings have global defaults in wfl main config bool cc_rumble = m_gcfg2.testOptBool(id, "cc_rumble", m_cfg.getBool(GC_DOMAIN, "cc_rumble", false)); @@ -1475,14 +1475,14 @@ void CMenu::_launchChannel(dir_discHdr *hdr) bool cheat = m_gcfg2.getBool(id, "cheat", false); bool countryPatch = m_gcfg2.getBool(id, "country_patch", false); - u8 videoMode = (u8)min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1); - videoMode = (videoMode == 0) ? (u8)min((u32)m_cfg.getInt("GENERAL", "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalVideoModes) - 1) : videoMode - 1; + u8 videoMode = min(m_gcfg2.getUInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u); + videoMode = (videoMode == 0) ? min(m_cfg.getUInt("GENERAL", "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalVideoModes) - 1u) : videoMode - 1; - int language = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1); - language = (language == 0) ? min((u32)m_cfg.getInt("GENERAL", "game_language", 0), ARRAY_SIZE(CMenu::_languages) - 1) : language; + 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; - u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1); - int aspectRatio = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1) - 1;// -1,0,1 + 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 const char *rtrn = m_gcfg2.getBool(id, "returnto", true) ? m_cfg.getString("GENERAL", "returnto").c_str() : NULL; u32 returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3]; @@ -1690,17 +1690,17 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg) bool countryPatch = m_gcfg2.getBool(id, "country_patch", false); bool private_server = m_gcfg2.getBool(id, "private_server", false); - u8 videoMode = (u8)min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u); - videoMode = (videoMode == 0) ? (u8)min((u32)m_cfg.getInt("GENERAL", "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalVideoModes) - 1) : videoMode-1; + u8 videoMode = min(m_gcfg2.getUInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u); + videoMode = (videoMode == 0) ? min(m_cfg.getUInt("GENERAL", "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalVideoModes) - 1u) : videoMode-1; - int language = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u); - language = (language == 0) ? min((u32)m_cfg.getInt("GENERAL", "game_language", 0), ARRAY_SIZE(CMenu::_languages) - 1) : language; + 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; const char *rtrn = m_cfg.getString("GENERAL", "returnto", "").c_str(); - int aspectRatio = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u) - 1; - u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); + 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 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); + u8 emulate_mode = min(m_gcfg2.getUInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); u8 gameEmuMode = emulate_mode; if(emulate_mode == 0)// default then use global emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1); @@ -1995,9 +1995,9 @@ void CMenu::_gameSoundThread(CMenu *m) coverDir = m_plugin.GetCoverFolderName(GameHdr->settings[0]); if(coverDir == NULL || strlen(coverDir) == 0) - strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), CoverFlow.getPathId(GameHdr)), 255); + strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), CoverFlow.getFilenameId(GameHdr)), 255); else - strncpy(custom_banner, fmt("%s/%s/%s.bnr", m->m_customBnrDir.c_str(), coverDir, CoverFlow.getPathId(GameHdr)), 255); + strncpy(custom_banner, fmt("%s/%s/%s.bnr", m->m_customBnrDir.c_str(), coverDir, CoverFlow.getFilenameId(GameHdr)), 255); fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); if(custom_bnr_size > 0) { diff --git a/source/menu/menu_input.cpp b/source/menu/menu_input.cpp index 06c4eba5..2c4eedc8 100644 --- a/source/menu/menu_input.cpp +++ b/source/menu/menu_input.cpp @@ -206,7 +206,7 @@ void CMenu::LeftStick() if(LEFT_STICK_LEFT) { speed = (u8)(left_stick_mag[chan] * 10.00); - pSpeed = (u8)((abs(PAD_StickX(chan))/10)|(abs(DS3_StickX()/10))|(abs(WUPC_lStickX(chan))/80)); + pSpeed = (u8)(((int)abs(PAD_StickX(chan))/10)|((int)abs(DS3_StickX()/10))|((int)abs(WUPC_lStickX(chan))/80)); if(stickPointer_x[chan] > m_cursor[chan].width()/2) stickPointer_x[chan] = stickPointer_x[chan]-speed-pSpeed; pointerhidedelay[chan] = 150; @@ -214,7 +214,7 @@ void CMenu::LeftStick() if(LEFT_STICK_DOWN) { speed = (u8)(left_stick_mag[chan] * 10.00); - pSpeed = (u8)((abs(PAD_StickY(chan))/10)|(abs(DS3_StickY()/10))|(abs(WUPC_lStickY(chan))/80)); + pSpeed = (u8)(((int)abs(PAD_StickY(chan))/10)|((int)abs(DS3_StickY()/10))|((int)abs(WUPC_lStickY(chan))/80)); if(stickPointer_y[chan] < (m_vid.height() + (m_cursor[chan].height()/2))) stickPointer_y[chan] = stickPointer_y[chan]+speed+pSpeed; pointerhidedelay[chan] = 150; @@ -222,7 +222,7 @@ void CMenu::LeftStick() if(LEFT_STICK_RIGHT) { speed = (u8)(left_stick_mag[chan] * 10.00); - pSpeed = (u8)((abs(PAD_StickX(chan))/10)|(abs(DS3_StickX()/10))|(abs(WUPC_lStickX(chan))/80)); + pSpeed = (u8)(((int)abs(PAD_StickX(chan))/10)|((int)abs(DS3_StickX()/10))|((int)abs(WUPC_lStickX(chan))/80)); if(stickPointer_x[chan] < (m_vid.width() + (m_cursor[chan].width()/2))) stickPointer_x[chan] = stickPointer_x[chan]+speed+pSpeed; pointerhidedelay[chan] = 150; @@ -230,7 +230,7 @@ void CMenu::LeftStick() if(LEFT_STICK_UP) { speed = (u8)(left_stick_mag[chan] * 10.00); - pSpeed = (u8)((abs(PAD_StickY(chan))/10)|(abs(DS3_StickY()/10))|(abs(WUPC_lStickY(chan))/80)); + pSpeed = (u8)(((int)abs(PAD_StickY(chan))/10)|((int)abs(DS3_StickY()/10))|((int)abs(WUPC_lStickY(chan))/80)); if(stickPointer_y[chan] > m_cursor[chan].height()/2) stickPointer_y[chan] = stickPointer_y[chan]-speed-pSpeed; pointerhidedelay[chan] = 150; diff --git a/source/menu/menu_source.cpp b/source/menu/menu_source.cpp index 37d56290..5b161e65 100644 --- a/source/menu/menu_source.cpp +++ b/source/menu/menu_source.cpp @@ -1,8 +1,8 @@ -#include -#include +//#include +//#include #include "menu.hpp" -#include "defines.h" +//#include "defines.h" // Source menu s16 m_sourceLblPage; @@ -148,8 +148,9 @@ void CMenu::_updateSourceBtns(void) memset(current_btn, 0, 16); strncpy(current_btn, fmt("BUTTON_%i", i), 15); string btnSource = m_source.getString(current_btn, "source", ""); - const char *btn_image = m_source.getString(current_btn,"image", "").c_str(); - const char *btn_imageSel = m_source.getString(current_btn,"image_s", "").c_str(); + bool src_selected = false; + //const char *btn_image = m_source.getString(current_btn,"image", "").c_str(); + //const char *btn_imageSel = m_source.getString(current_btn,"image_s", "").c_str(); if(btnSource == "") continue; if(m_multisource) @@ -163,7 +164,7 @@ void CMenu::_updateSourceBtns(void) { sourceBtn = i; selectedBtns++; - btn_image = btn_imageSel; + src_selected = true; } } } @@ -178,7 +179,7 @@ void CMenu::_updateSourceBtns(void) { sourceBtn = i; selectedBtns++; - btn_image = btn_imageSel; + src_selected = true; } } } @@ -188,7 +189,7 @@ void CMenu::_updateSourceBtns(void) { sourceBtn = i; selectedBtns++; - btn_image = btn_imageSel; + src_selected = true; } } else if(btnSource == "dml" || btnSource == "homebrew" || btnSource == "wii") @@ -198,12 +199,20 @@ void CMenu::_updateSourceBtns(void) { sourceBtn = i; selectedBtns++; - btn_image = btn_imageSel; + src_selected = true; } } } + char btn_image[255]; + if(src_selected) + snprintf(btn_image, sizeof(btn_image), "%s", m_source.getString(current_btn,"image_s", "").c_str()); + else + snprintf(btn_image, sizeof(btn_image), "%s", m_source.getString(current_btn,"image", "").c_str()); + if(i >= j && i < (j + 12)) { + //m_btnMgr.hide(m_sourceBtnSource[i - j], true); + //m_btnMgr.tick(); TexData texConsoleImg; TexData texConsoleImgs; if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK) diff --git a/source/menu/menu_system.cpp b/source/menu/menu_system.cpp index ff73ef8a..fd42c574 100644 --- a/source/menu/menu_system.cpp +++ b/source/menu/menu_system.cpp @@ -4,8 +4,7 @@ #include "lockMutex.hpp" #include "loader/wbfs.h" -int version_num = 0, num_versions = 0; -static int i; +unsigned int i, version_num = 0, num_versions = 0; const int CMenu::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}; @@ -71,7 +70,7 @@ void CMenu::_system() //add the changelog info here } if (num_versions > 1 && version_num == 0) version_num = 1; - i = min((u32)version_num, ARRAY_SIZE(CMenu::_version) -1u); + i = min(version_num, ARRAY_SIZE(CMenu::_version) -1u); newVer = CMenu::_version[i]; _showSystem(); } @@ -135,7 +134,7 @@ void CMenu::_system() --version_num; else version_num = num_versions; - i = min((u32)version_num, ARRAY_SIZE(CMenu::_version) -1u); + i = min(version_num, ARRAY_SIZE(CMenu::_version) -1u); { m_btnMgr.setText(m_systemLblVerSelectVal, wstringEx(sfmt("%i", CMenu::_version[i]))); newVer = CMenu::_version[i]; @@ -155,7 +154,7 @@ void CMenu::_system() ++version_num; else version_num = 1; - i = min((u32)version_num, ARRAY_SIZE(CMenu::_version) -1u); + i = min(version_num, ARRAY_SIZE(CMenu::_version) -1u); { m_btnMgr.setText(m_systemLblVerSelectVal, wstringEx(sfmt("%i", CMenu::_version[i]))); newVer = CMenu::_version[i]; @@ -280,7 +279,7 @@ void CMenu::_textSystem(void) m_btnMgr.setText(m_systemLblVersion, SVN_REV_W); m_btnMgr.setText(m_systemBtnBack, _t("sys3", L"Cancel")); m_btnMgr.setText(m_systemBtnDownload, _t("sys4", L"Upgrade")); - i = min((u32)version_num, ARRAY_SIZE(CMenu::_version) -1u); + i = min(version_num, ARRAY_SIZE(CMenu::_version) -1u); if (i == 0) m_btnMgr.setText(m_systemLblVerSelectVal, SVN_REV_W); else diff --git a/source/sicksaxis-wrapper/sicksaxis-wrapper.h b/source/sicksaxis-wrapper/sicksaxis-wrapper.h index 731b0c5c..30855088 100644 --- a/source/sicksaxis-wrapper/sicksaxis-wrapper.h +++ b/source/sicksaxis-wrapper/sicksaxis-wrapper.h @@ -37,7 +37,7 @@ typedef struct ss_device DS3; bool DS3_Init(); void DS3_Rumble(); void DS3_Cleanup(); -u32 DS3_ButtonsDown(); +unsigned int DS3_ButtonsDown(); void DS3_ScanPads(); int DS3_StickX(); int DS3_SubStickX(); diff --git a/source/unzip/ZipFile.cpp b/source/unzip/ZipFile.cpp index 42d32841..02580550 100644 --- a/source/unzip/ZipFile.cpp +++ b/source/unzip/ZipFile.cpp @@ -67,8 +67,8 @@ bool ZipFile::ExtractAll(const char *dest) if(buffer == NULL) return false; - char writepath[MAXPATHLEN]; - char filename[MAXPATHLEN]; + char writepath[1024]; + char filename[1024]; memset(filename, 0, sizeof(filename)); int ret = unzGoToFirstFile(File);