mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-28 12:51:52 +01:00
-big code cleanup, removed all those SAFE_ and SMART_
thingys and replaced it with their proper calls -fixed some big memory bugs, downloading much covers shouldn't be a problem anymore, also memory management should work better -fixed typo in debug print on game boot, also changed some things in apploader, making it ready to remove linker script properly, still in but I hope not for long ;) -modified wiiflow startup and init order a bit
This commit is contained in:
parent
bce19e488e
commit
0fc21f82a3
@ -84,7 +84,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "MD5.h"
|
||||
#include "utils.h"
|
||||
#include "mem2.hpp"
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
@ -572,7 +571,7 @@ unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
||||
if(!!buffer)
|
||||
{
|
||||
//no memory
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -583,8 +582,8 @@ unsigned char * MD5fromFile(unsigned char *dst, const char *src)
|
||||
|
||||
} while(read > 0);
|
||||
|
||||
SAFE_CLOSE(file);
|
||||
SAFE_FREE(buffer);
|
||||
fclose(file);
|
||||
MEM2_free(buffer);
|
||||
|
||||
(void)auth_md5CloseCtx( ctx, dst ); /* Close the context. */
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "banner.h"
|
||||
#include "MD5.h"
|
||||
#include "loader/fs.h"
|
||||
#include "loader/utils.h"
|
||||
#include "gecko.h"
|
||||
#include "U8Archive.h"
|
||||
|
||||
@ -156,7 +155,7 @@ Banner * Banner::GetBanner(u64 title, char *appname, bool isfs, bool imetOnly)
|
||||
buf = ISFS_GetFile((u8 *) appname, &size, imetOnly ? sizeof(IMET) + IMET_OFFSET : 0);
|
||||
if (size == 0)
|
||||
{
|
||||
SAFE_FREE(buf);
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -176,7 +175,7 @@ Banner * Banner::GetBanner(u64 title, char *appname, bool isfs, bool imetOnly)
|
||||
buf = MEM2_alloc(size);
|
||||
|
||||
fread(buf, size, 1, fp);
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return new Banner((u8 *)buf, title);
|
||||
|
@ -43,7 +43,7 @@ s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryS
|
||||
Identify(chantitle, &ios);
|
||||
|
||||
entryPoint = LoadChannel(data);
|
||||
SAFE_FREE(data);
|
||||
free(data);
|
||||
|
||||
/* Select an appropriate video mode */
|
||||
GXRModeObj * vmode = __Disc_SelectVMode(vidMode, chantitle);
|
||||
@ -243,8 +243,8 @@ bool Identify(u64 titleid, u32 *ios)
|
||||
if (certBuffer == NULL || certSize == 0)
|
||||
{
|
||||
gprintf("Reading certs...Failed!\n");
|
||||
SAFE_FREE(tmdBuffer);
|
||||
SAFE_FREE(tikBuffer);
|
||||
free(tmdBuffer);
|
||||
free(tikBuffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -271,9 +271,9 @@ bool Identify(u64 titleid, u32 *ios)
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_FREE(tmdBuffer);
|
||||
SAFE_FREE(tikBuffer);
|
||||
SAFE_FREE(certBuffer);
|
||||
free(tmdBuffer);
|
||||
free(tikBuffer);
|
||||
free(certBuffer);
|
||||
|
||||
return ret < 0 ? false : true;
|
||||
}
|
||||
@ -297,14 +297,14 @@ u8 * GetDol(u64 title, u32 bootcontent)
|
||||
if (decompressLZ77content(data, contentSize, &decompressed, &size) < 0)
|
||||
{
|
||||
gprintf("Decompression failed\n");
|
||||
SAFE_FREE(data);
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
SAFE_FREE(data);
|
||||
free(data);
|
||||
data = decompressed;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
gprintf("Failed!\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "banner.h"
|
||||
#include "wstringEx.hpp"
|
||||
#include "gecko.h"
|
||||
#include "utils.h"
|
||||
#include "fs.h"
|
||||
#include "config.hpp"
|
||||
#include "text.hpp"
|
||||
@ -97,8 +96,8 @@ u8 Channels::GetRequestedIOS(u64 title)
|
||||
|
||||
if(size > 0x18B)
|
||||
IOS = titleTMD[0x18B];
|
||||
|
||||
SAFE_FREE(titleTMD);
|
||||
|
||||
free(titleTMD);
|
||||
|
||||
return IOS;
|
||||
}
|
||||
@ -118,14 +117,14 @@ u64* Channels::GetChannelList(u32* count)
|
||||
|
||||
if(ES_GetTitles(titles, countall) < 0)
|
||||
{
|
||||
SAFE_FREE(titles);
|
||||
free(titles);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u64* channels = (u64*)MEM2_alloc(countall * sizeof(u64));
|
||||
if (!channels)
|
||||
{
|
||||
SAFE_FREE(titles);
|
||||
free(titles);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -143,7 +142,7 @@ u64* Channels::GetChannelList(u32* count)
|
||||
channels[(*count)++] = titles[i];
|
||||
}
|
||||
}
|
||||
SAFE_FREE(titles);
|
||||
free(titles);
|
||||
|
||||
return (u64*)MEM2_realloc(channels, *count * sizeof(u64));
|
||||
}
|
||||
@ -170,7 +169,7 @@ bool Channels::GetAppNameFromTmd(u64 title, char* app, bool dol, u32* bootconten
|
||||
break;
|
||||
}
|
||||
|
||||
SAFE_FREE(data);
|
||||
free(data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -246,7 +245,7 @@ void Channels::Search(u32 channelType, string lang)
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_FREE(list);
|
||||
free(list);
|
||||
}
|
||||
|
||||
wchar_t * Channels::GetName(int index)
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include <dirent.h>
|
||||
|
||||
#include "nand.hpp"
|
||||
#include "utils.h"
|
||||
#include "mem2.hpp"
|
||||
#include "wbfs.h"
|
||||
#include "gecko.h"
|
||||
@ -275,30 +274,29 @@ s32 Nand::__configread(void)
|
||||
confbuffer = (u8 *)MEM2_alloc(0x4000);
|
||||
txtbuffer = (char *)MEM2_alloc(0x100);
|
||||
cfg_hdr = (config_header *)NULL;
|
||||
|
||||
|
||||
FILE *f = fopen(cfgpath, "rb");
|
||||
if(f)
|
||||
{
|
||||
fread(confbuffer, 1, 0x4000, f);
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
f = fopen(settxtpath, "rb");
|
||||
if(f)
|
||||
{
|
||||
fread(txtbuffer, 1, 0x100, f);
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
cfg_hdr = (config_header *)confbuffer;
|
||||
|
||||
|
||||
__Dec_Enc_TB();
|
||||
|
||||
|
||||
configloaded = configloaded ? false : true;
|
||||
|
||||
|
||||
if(tbdec && configloaded)
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -307,7 +305,7 @@ s32 Nand::__configwrite(void)
|
||||
if(configloaded)
|
||||
{
|
||||
__Dec_Enc_TB();
|
||||
|
||||
|
||||
if(!tbdec)
|
||||
{
|
||||
FILE *f = fopen(cfgpath, "wb");
|
||||
@ -315,19 +313,18 @@ s32 Nand::__configwrite(void)
|
||||
{
|
||||
fwrite(confbuffer, 1, 0x4000, f);
|
||||
gprintf("SYSCONF written to:\"%s\"\n", cfgpath);
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
f = fopen(settxtpath, "wb");
|
||||
if(f)
|
||||
{
|
||||
fwrite(txtbuffer, 1, 0x100, f);
|
||||
gprintf("setting.txt written to: \"%s\"\n", settxtpath);
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
configloaded = configloaded ? false : true;
|
||||
|
||||
|
||||
if(!tbdec && !configloaded)
|
||||
return 1;
|
||||
}
|
||||
@ -335,7 +332,7 @@ s32 Nand::__configwrite(void)
|
||||
free(confbuffer);
|
||||
free(txtbuffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 Nand::__configsetbyte(const char *item, u8 val)
|
||||
{
|
||||
@ -408,7 +405,7 @@ bool Nand::__FileExists(const char *path, ...)
|
||||
if (f != 0)
|
||||
{
|
||||
gprintf("File \"%s\" exists\n", path);
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -488,30 +485,29 @@ s32 Nand::__FlashNandFile(const char *source, const char *dest)
|
||||
gprintf("Error opening source: \"%s\"\n", source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
u32 fsize = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
|
||||
if(fake)
|
||||
{
|
||||
NandSize += fsize;
|
||||
if(showprogress)
|
||||
dumper(NandSize, 0x1f400000, 0x1f400000, NandSize, FilesDone, FoldersDone, (char *)"", data);
|
||||
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gprintf("Flashing: %s (%uKB) to nand...", dest, (fsize / 0x400)+1);
|
||||
|
||||
|
||||
ISFS_Delete(dest);
|
||||
ISFS_CreateFile(dest, 0, 3, 3, 3);
|
||||
s32 fd = ISFS_Open(dest, ISFS_OPEN_RW);
|
||||
if(fd < 0)
|
||||
{
|
||||
gprintf(" failed\nError: ISFS_OPEN(%s, %d) %d\n", dest, ISFS_OPEN_RW, fd);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@ -528,24 +524,24 @@ s32 Nand::__FlashNandFile(const char *source, const char *dest)
|
||||
{
|
||||
gprintf(" failed\nError: fread(%p, 1, %d, %s) %d\n", buffer, size, source, ret);
|
||||
ISFS_Close(fd);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
MEM2_free(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ret = ISFS_Write(fd, buffer, size);
|
||||
if(ret <= 0)
|
||||
{
|
||||
gprintf(" failed\nError: ISFS_Write(%d, %p, %d) %d\n", fd, buffer, size, ret);
|
||||
ISFS_Close(fd);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
MEM2_free(buffer);
|
||||
return ret;
|
||||
}
|
||||
toread -= size;
|
||||
NandDone += size;
|
||||
FileDone += size;
|
||||
|
||||
|
||||
if(showprogress)
|
||||
{
|
||||
const char *file = strrchr(dest, '/')+1;
|
||||
@ -561,7 +557,7 @@ s32 Nand::__FlashNandFile(const char *source, const char *dest)
|
||||
}
|
||||
ISFS_Close(fd);
|
||||
MEM2_free(buffer);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -574,7 +570,7 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
|
||||
gprintf("Error: IOS_OPEN(%s, %d) %d\n", source, ISFS_OPEN_READ, fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
fstats *status = (fstats *)MEM2_alloc(sizeof(fstats));
|
||||
s32 ret = ISFS_GetFileStats(fd, status);
|
||||
if (ret < 0)
|
||||
@ -584,21 +580,20 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
|
||||
MEM2_free(status);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
if(fake)
|
||||
{
|
||||
NandSize += status->file_length;
|
||||
if(showprogress)
|
||||
dumper(NandSize, 0x1f400000, 0x1f400000, NandSize, FilesDone, FoldersDone, (char *)"", data);
|
||||
|
||||
ISFS_Close(fd);
|
||||
MEM2_free(status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(__FileExists(dest))
|
||||
remove(dest);
|
||||
|
||||
|
||||
FILE *file = fopen(dest, "wb");
|
||||
if (!file)
|
||||
{
|
||||
@ -606,7 +601,7 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
|
||||
ISFS_Close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gprintf("Dumping: %s (%ukb)...", source, (status->file_length / 0x400)+1);
|
||||
|
||||
u8 *buffer = (u8 *)MEM2_alloc(BLOCK);
|
||||
@ -622,18 +617,18 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
|
||||
{
|
||||
gprintf(" failed\nError: ISFS_Read(%d, %p, %d) %d\n", fd, buffer, size, ret);
|
||||
ISFS_Close(fd);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
MEM2_free(status);
|
||||
MEM2_free(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ret = fwrite(buffer, 1, size, file);
|
||||
if(ret < 0)
|
||||
{
|
||||
gprintf(" failed\nError writing to destination: \"%s\" (%d)\n", dest, ret);
|
||||
ISFS_Close(fd);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
MEM2_free(status);
|
||||
MEM2_free(buffer);
|
||||
return ret;
|
||||
@ -641,7 +636,7 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
|
||||
toread -= size;
|
||||
NandDone += size;
|
||||
FileDone += size;
|
||||
|
||||
|
||||
if(showprogress)
|
||||
{
|
||||
const char *file = strrchr(source, '/')+1;
|
||||
@ -655,11 +650,11 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
|
||||
dumper(NandDone, NandSize, status->file_length, FileDone, FilesDone, FoldersDone, (char *)file, data);
|
||||
}
|
||||
gprintf(" done!\n");
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
ISFS_Close(fd);
|
||||
MEM2_free(status);
|
||||
MEM2_free(buffer);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -668,19 +663,19 @@ s32 Nand::__FlashNandFolder(const char *source, const char *dest)
|
||||
{
|
||||
char nsource[MAX_FAT_PATH];
|
||||
char ndest[ISFS_MAXPATH];
|
||||
|
||||
|
||||
DIR *dir_iter;
|
||||
struct dirent *ent;
|
||||
|
||||
|
||||
dir_iter = opendir(source);
|
||||
if (!dir_iter)
|
||||
return 1;
|
||||
|
||||
|
||||
while((ent = readdir(dir_iter)) != NULL)
|
||||
{
|
||||
if(ent->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
|
||||
if(dest[strlen(dest)-1] == '/')
|
||||
snprintf(ndest, sizeof(ndest), "%s%s", dest, ent->d_name);
|
||||
else
|
||||
@ -690,7 +685,7 @@ s32 Nand::__FlashNandFolder(const char *source, const char *dest)
|
||||
snprintf(nsource, sizeof(nsource), "%s%s", source, ent->d_name);
|
||||
else
|
||||
snprintf(nsource, sizeof(nsource), "%s/%s", source, ent->d_name);
|
||||
|
||||
|
||||
if(ent->d_type == DT_DIR)
|
||||
{
|
||||
__NANDify(ndest);
|
||||
@ -717,16 +712,16 @@ s32 Nand::__DumpNandFolder(const char *source, const char *dest)
|
||||
char nsource[ISFS_MAXPATH];
|
||||
char ndest[MAX_FAT_PATH];
|
||||
char tdest[MAX_FAT_PATH];
|
||||
|
||||
|
||||
__GetNameList(source, &names, &cnt);
|
||||
|
||||
|
||||
for(i = 0; i < cnt; i++)
|
||||
{
|
||||
if(source[strlen(source)-1] == '/')
|
||||
snprintf(nsource, sizeof(nsource), "%s%s", source, names[i].name);
|
||||
else
|
||||
snprintf(nsource, sizeof(nsource), "%s/%s", source, names[i].name);
|
||||
|
||||
|
||||
if(!names[i].type)
|
||||
{
|
||||
__FATify(tdest, nsource);
|
||||
@ -745,7 +740,7 @@ s32 Nand::__DumpNandFolder(const char *source, const char *dest)
|
||||
__DumpNandFolder(nsource, dest);
|
||||
}
|
||||
}
|
||||
SAFE_FREE(names);
|
||||
free(names);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -758,7 +753,7 @@ void Nand::CreatePath(const char *path, ...)
|
||||
{
|
||||
if(folder[strlen(folder)-1] == '/')
|
||||
folder[strlen(folder)-1] = 0;
|
||||
|
||||
|
||||
char *check = folder;
|
||||
while (true)
|
||||
{
|
||||
@ -768,7 +763,7 @@ void Nand::CreatePath(const char *path, ...)
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DIR *d;
|
||||
d = opendir(folder);
|
||||
|
||||
@ -784,7 +779,7 @@ void Nand::CreatePath(const char *path, ...)
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
SAFE_FREE(folder);
|
||||
free(folder);
|
||||
}
|
||||
|
||||
void Nand::CreateTitleTMD(const char *path, dir_discHdr *hdr)
|
||||
@ -799,28 +794,28 @@ void Nand::CreateTitleTMD(const char *path, dir_discHdr *hdr)
|
||||
|
||||
if(!titleTMD)
|
||||
return;
|
||||
|
||||
|
||||
u32 highTID = *(u32*)(titleTMD+0x18c);
|
||||
u32 lowTID = *(u32*)(titleTMD+0x190);
|
||||
|
||||
|
||||
CreatePath("%s/title/%08x/%08x/data", path, highTID, lowTID);
|
||||
CreatePath("%s/title/%08x/%08x/content", path, highTID, lowTID);
|
||||
|
||||
|
||||
char nandpath[MAX_FAT_PATH];
|
||||
if(path[strlen(path)-1] == '/')
|
||||
snprintf(nandpath, sizeof(nandpath), "%stitle/%08x/%08x/content/title.tmd", path, highTID, lowTID);
|
||||
else
|
||||
snprintf(nandpath, sizeof(nandpath), "%s/title/%08x/%08x/content/title.tmd", path, highTID, lowTID);
|
||||
|
||||
|
||||
struct stat filestat;
|
||||
if (stat(nandpath, &filestat) == 0)
|
||||
{
|
||||
SAFE_FREE(titleTMD);
|
||||
free(titleTMD);
|
||||
gprintf("%s Exists!\n", nandpath);
|
||||
return;
|
||||
}
|
||||
gprintf("Creating title TMD: %s\n", nandpath);
|
||||
|
||||
|
||||
FILE *file = fopen(nandpath, "wb");
|
||||
if(file)
|
||||
{
|
||||
@ -831,7 +826,7 @@ void Nand::CreateTitleTMD(const char *path, dir_discHdr *hdr)
|
||||
else
|
||||
gprintf("Creating title TMD: %s failed (%i)\n", nandpath, file);
|
||||
|
||||
SAFE_FREE(titleTMD);
|
||||
free(titleTMD);
|
||||
}
|
||||
|
||||
s32 Nand::FlashToNAND(const char *source, const char *dest, dump_callback_t i_dumper, void *i_data)
|
||||
@ -884,15 +879,15 @@ s32 Nand::CalcDumpSpace(const char *source, dump_callback_t i_dumper, void *i_da
|
||||
dumper = i_dumper;
|
||||
fake = true;
|
||||
showprogress = true;
|
||||
|
||||
|
||||
u32 temp = 0;
|
||||
|
||||
|
||||
s32 ret = ISFS_ReadDir(source, NULL, &temp);
|
||||
if(ret < 0)
|
||||
__DumpNandFile(source, "");
|
||||
else
|
||||
__DumpNandFolder(source, "");
|
||||
|
||||
|
||||
return NandSize;
|
||||
}
|
||||
|
||||
@ -913,16 +908,16 @@ s32 Nand::CreateConfig(const char *path)
|
||||
CreatePath("%s/title/00000001", path);
|
||||
CreatePath("%s/title/00000001/00000002", path);
|
||||
CreatePath("%s/title/00000001/00000002/data", path);
|
||||
|
||||
|
||||
fake = false;
|
||||
showprogress = false;
|
||||
|
||||
|
||||
bzero(cfgpath, MAX_FAT_PATH+1);
|
||||
bzero(settxtpath, MAX_FAT_PATH+1);
|
||||
|
||||
|
||||
snprintf(cfgpath, sizeof(cfgpath), "%s%s", path, SYSCONFPATH);
|
||||
snprintf(settxtpath, sizeof(settxtpath), "%s%s", path, TXTPATH);
|
||||
|
||||
|
||||
__DumpNandFile(SYSCONFPATH, cfgpath);
|
||||
__DumpNandFile(TXTPATH, settxtpath);
|
||||
return 0;
|
||||
@ -935,61 +930,57 @@ s32 Nand::Do_Region_Change(string id)
|
||||
switch(id[3])
|
||||
{
|
||||
case 'J':
|
||||
{
|
||||
gprintf("Switching region to NTSC-j \n");
|
||||
gprintf("Switching region to NTSC-J \n");
|
||||
CCode[0] = 1;
|
||||
__configsetbyte( "IPL.LNG", 0 );
|
||||
__configsetbyte( "IPL.LNG", 0 );
|
||||
__configsetbigarray( "SADR.LNG", CCode, 0x1007 );
|
||||
__configsetsetting( "AREA", "JPN" );
|
||||
__configsetsetting( "MODEL", "RVL-001(JPN)" );
|
||||
__configsetsetting( "CODE", "LJM" );
|
||||
__configsetsetting( "VIDEO", "NTSC" );
|
||||
__configsetsetting( "GAME", "JP" );
|
||||
} break;
|
||||
__configsetsetting( "GAME", "JP" );
|
||||
break;
|
||||
case 'E':
|
||||
{
|
||||
gprintf("Switching region to NTSC-u \n");
|
||||
gprintf("Switching region to NTSC-U \n");
|
||||
CCode[0] = 31;
|
||||
__configsetbyte( "IPL.LNG", 1 );
|
||||
__configsetbyte( "IPL.LNG", 1 );
|
||||
__configsetbigarray( "IPL.SADR", CCode, 0x1007 );
|
||||
__configsetsetting( "AREA", "USA" );
|
||||
__configsetsetting( "MODEL", "RVL-001(USA)" );
|
||||
__configsetsetting( "CODE", "LU" );
|
||||
__configsetsetting( "VIDEO", "NTSC" );
|
||||
__configsetsetting( "GAME", "US" );
|
||||
} break;
|
||||
__configsetsetting( "GAME", "US" );
|
||||
break;
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'I':
|
||||
case 'M':
|
||||
case 'P':
|
||||
case 'S':
|
||||
case 'U':
|
||||
{
|
||||
case 'U':
|
||||
gprintf("Switching region to PAL \n");
|
||||
CCode[0] = 110;
|
||||
__configsetbyte( "IPL.LNG", 1 );
|
||||
__configsetbyte( "IPL.LNG", 1 );
|
||||
__configsetbigarray( "IPL.SADR", CCode, 0x1007 );
|
||||
__configsetsetting( "AREA", "EUR" );
|
||||
__configsetsetting( "MODEL", "RVL-001(EUR)" );
|
||||
__configsetsetting( "CODE", "LEH" );
|
||||
__configsetsetting( "VIDEO", "PAL" );
|
||||
__configsetsetting( "GAME", "EU" );
|
||||
} break;
|
||||
case 'K':
|
||||
{
|
||||
gprintf("Switching region to NTSC-k \n");
|
||||
__configsetsetting( "GAME", "EU" );
|
||||
break;
|
||||
case 'K':
|
||||
gprintf("Switching region to NTSC-K \n");
|
||||
CCode[0] = 137;
|
||||
__configsetbyte( "IPL.LNG", 9 );
|
||||
__configsetbyte( "IPL.LNG", 9 );
|
||||
__configsetbigarray( "IPL.SADR", CCode, 0x1007 );
|
||||
__configsetsetting( "AREA", "KOR" );
|
||||
__configsetsetting( "MODEL", "RVL-001(KOR)" );
|
||||
__configsetsetting( "CODE", "LKM" );
|
||||
__configsetsetting( "VIDEO", "NTSC" );
|
||||
__configsetsetting( "GAME", "KR" );
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
__configwrite();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -36,23 +36,25 @@ static s32 stopThread;
|
||||
static u64 folderSize = 0;
|
||||
|
||||
// return false if the file doesn't exist
|
||||
bool fsop_GetFileSizeBytes (char *path, size_t *filesize) // for me stats st_size report always 0 :(
|
||||
bool fsop_GetFileSizeBytes(char *path, size_t *filesize) // for me stats st_size report always 0 :(
|
||||
{
|
||||
FILE *f;
|
||||
size_t size = 0;
|
||||
|
||||
f = fopen(path, "rb");
|
||||
if (!f)
|
||||
if(!f)
|
||||
{
|
||||
if (filesize) *filesize = size;
|
||||
if(filesize)
|
||||
*filesize = size;
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get file size
|
||||
fseek( f, 0, SEEK_END);
|
||||
size = ftell(f);
|
||||
if (filesize) *filesize = size;
|
||||
SAFE_CLOSE(f);
|
||||
if(filesize)
|
||||
*filesize = size;
|
||||
fclose(f);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -176,7 +178,7 @@ bool fsop_CopyFile (char *source, char *target, progress_callback_t spinner, voi
|
||||
ft = fopen(target, "wt");
|
||||
if (!ft)
|
||||
{
|
||||
SAFE_CLOSE(fs);
|
||||
fclose(fs);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -186,8 +188,8 @@ bool fsop_CopyFile (char *source, char *target, progress_callback_t spinner, voi
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
SAFE_CLOSE(fs);
|
||||
SAFE_CLOSE(ft);
|
||||
fclose(fs);
|
||||
fclose(ft);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -246,8 +248,8 @@ bool fsop_CopyFile (char *source, char *target, progress_callback_t spinner, voi
|
||||
stopThread = 1;
|
||||
DCFlushRange(&stopThread, sizeof(stopThread));
|
||||
|
||||
SAFE_CLOSE(fs);
|
||||
SAFE_CLOSE(ft);
|
||||
fclose(fs);
|
||||
fclose(ft);
|
||||
MEM2_free(buff);
|
||||
|
||||
if (err)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <sys/iosupport.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "mem2.hpp"
|
||||
#include "wifi_gecko.h"
|
||||
|
||||
/* init-globals */
|
||||
@ -78,7 +79,7 @@ void WriteToFile(char* tmp)
|
||||
{
|
||||
if(tmpfilebuffer != NULL)
|
||||
{
|
||||
SAFE_FREE(tmpfilebuffer);
|
||||
MEM2_free(tmpfilebuffer);
|
||||
tmpfilebuffer = NULL;
|
||||
}
|
||||
return;
|
||||
@ -111,7 +112,7 @@ void gprintf( const char *format, ... )
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
SAFE_FREE(tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
char ascii(char s)
|
||||
@ -161,7 +162,8 @@ bool InitGecko()
|
||||
|
||||
USBGeckoOutput();
|
||||
|
||||
tmpfilebuffer = (char*)calloc(filebuffer + 1, sizeof(char));
|
||||
tmpfilebuffer = (char*)MEM2_alloc(filebuffer + 1 * sizeof(char));
|
||||
memset(tmpfilebuffer, 0, sizeof(tmpfilebuffer));
|
||||
|
||||
#ifdef sd_write_log
|
||||
WriteToSD = true;
|
||||
|
@ -145,5 +145,5 @@ void wifi_printf(const char * format, ...)
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
SAFE_FREE(tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
@ -31,7 +31,8 @@
|
||||
* @param textureFormat Optional format (GX_TF_*) of the texture as defined by the libogc gx.h header file. If not specified default value is GX_TF_RGBA8.
|
||||
* @param positionFormat Optional positional format (GX_POS_*) of the texture as defined by the libogc gx.h header file. If not specified default value is GX_POS_XYZ.
|
||||
*/
|
||||
FreeTypeGX::FreeTypeGX(uint8_t textureFormat, uint8_t positionFormat) {
|
||||
FreeTypeGX::FreeTypeGX(uint8_t textureFormat, uint8_t positionFormat)
|
||||
{
|
||||
FT_Init_FreeType(&this->ftLibrary);
|
||||
|
||||
this->textureFormat = textureFormat;
|
||||
@ -43,7 +44,8 @@ FreeTypeGX::FreeTypeGX(uint8_t textureFormat, uint8_t positionFormat) {
|
||||
/**
|
||||
* Default destructor for the FreeTypeGX class.
|
||||
*/
|
||||
FreeTypeGX::~FreeTypeGX() {
|
||||
FreeTypeGX::~FreeTypeGX()
|
||||
{
|
||||
this->unloadFont();
|
||||
if (this->ftLibrary != 0)
|
||||
{
|
||||
@ -61,7 +63,8 @@ FreeTypeGX::~FreeTypeGX() {
|
||||
* @param strChar Character string to be converted.
|
||||
* @return Wide character representation of supplied character string.
|
||||
*/
|
||||
wchar_t* FreeTypeGX::charToWideChar(char* strChar) {
|
||||
wchar_t* FreeTypeGX::charToWideChar(char* strChar)
|
||||
{
|
||||
wchar_t *strWChar;
|
||||
strWChar = new wchar_t[strlen(strChar) + 1];
|
||||
|
||||
@ -82,7 +85,8 @@ wchar_t* FreeTypeGX::charToWideChar(char* strChar) {
|
||||
* @param pointSize The desired point size this wrapper's configured font face.
|
||||
* @param cacheAll Optional flag to specify if all font characters should be cached when the class object is created. If specified as false the characters only become cached the first time they are used. If not specified default value is false.
|
||||
*/
|
||||
uint16_t FreeTypeGX::loadFont(uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight, uint32_t index, bool cacheAll) {
|
||||
uint16_t FreeTypeGX::loadFont(uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight, uint32_t index, bool cacheAll)
|
||||
{
|
||||
this->unloadFont();
|
||||
this->ftPointSize = pointSize != 0 ? pointSize : this->ftPointSize;
|
||||
this->ftWeight = weight;
|
||||
@ -114,7 +118,8 @@ uint16_t FreeTypeGX::loadFont(uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt p
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::loadFont(const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight, uint32_t index, bool cacheAll) {
|
||||
uint16_t FreeTypeGX::loadFont(const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight, uint32_t index, bool cacheAll)
|
||||
{
|
||||
return this->loadFont((uint8_t *)fontBuffer, bufferSize, pointSize, weight, index, cacheAll);
|
||||
}
|
||||
|
||||
@ -123,11 +128,17 @@ uint16_t FreeTypeGX::loadFont(const uint8_t* fontBuffer, FT_Long bufferSize, FT_
|
||||
*
|
||||
* This routine clears all members of the font map structure and frees all allocated memory back to the system.
|
||||
*/
|
||||
void FreeTypeGX::unloadFont() {
|
||||
for( std::map<wchar_t, ftgxCharData>::iterator i = this->fontData.begin(); i != this->fontData.end(); i++) {
|
||||
SAFE_FREE(i->second.glyphDataTexture);
|
||||
void FreeTypeGX::unloadFont()
|
||||
{
|
||||
for( std::map<wchar_t, ftgxCharData>::iterator i = this->fontData.begin(); i != this->fontData.end(); i++)
|
||||
{
|
||||
if(i->second.glyphDataTexture != NULL)
|
||||
{
|
||||
MEM2_free(i->second.glyphDataTexture);
|
||||
i->second.glyphDataTexture = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this->fontData.clear();
|
||||
if (this->ftFace != NULL)
|
||||
{
|
||||
@ -145,7 +156,8 @@ void FreeTypeGX::unloadFont() {
|
||||
* @param textureFormat The texture format to which the data is to be converted.
|
||||
* @return The correctly adjusted texture width.
|
||||
*/
|
||||
uint16_t FreeTypeGX::adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat) {
|
||||
uint16_t FreeTypeGX::adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat)
|
||||
{
|
||||
uint16_t alignment;
|
||||
|
||||
switch(textureFormat) {
|
||||
@ -176,7 +188,8 @@ uint16_t FreeTypeGX::adjustTextureWidth(uint16_t textureWidth, uint8_t textureFo
|
||||
* @param textureFormat The texture format to which the data is to be converted.
|
||||
* @return The correctly adjusted texture height.
|
||||
*/
|
||||
uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat) {
|
||||
uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat)
|
||||
{
|
||||
uint16_t alignment;
|
||||
|
||||
switch(textureFormat) {
|
||||
@ -207,22 +220,26 @@ uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t texture
|
||||
* @param charCode The requested glyph's character code.
|
||||
* @return A pointer to the allocated font structure.
|
||||
*/
|
||||
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode) {
|
||||
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode)
|
||||
{
|
||||
FT_UInt gIndex;
|
||||
uint16_t textureWidth = 0, textureHeight = 0;
|
||||
|
||||
gIndex = FT_Get_Char_Index( this->ftFace, charCode );
|
||||
if (!FT_Load_Glyph(this->ftFace, gIndex, FT_LOAD_DEFAULT )) {
|
||||
if (!FT_Load_Glyph(this->ftFace, gIndex, FT_LOAD_DEFAULT ))
|
||||
{
|
||||
FT_Render_Glyph( this->ftSlot, FT_RENDER_MODE_NORMAL );
|
||||
|
||||
if(this->ftSlot->format == FT_GLYPH_FORMAT_BITMAP) {
|
||||
|
||||
if(this->ftSlot->format == FT_GLYPH_FORMAT_BITMAP)
|
||||
{
|
||||
FT_Bitmap *glyphBitmap = &this->ftSlot->bitmap;
|
||||
FT_Bitmap_Embolden(this->ftLibrary, glyphBitmap, this->ftWeight, this->ftWeight);
|
||||
|
||||
|
||||
textureWidth = adjustTextureWidth(glyphBitmap->width, this->textureFormat);
|
||||
textureHeight = adjustTextureHeight(glyphBitmap->rows, this->textureFormat);
|
||||
|
||||
this->fontData[charCode] = (ftgxCharData){
|
||||
this->fontData[charCode] = (ftgxCharData)
|
||||
{
|
||||
this->ftSlot->advance.x >> 6,
|
||||
gIndex,
|
||||
textureWidth,
|
||||
@ -233,7 +250,7 @@ ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode) {
|
||||
NULL
|
||||
};
|
||||
this->loadGlyphData(glyphBitmap, &this->fontData[charCode]);
|
||||
|
||||
|
||||
return &this->fontData[charCode];
|
||||
}
|
||||
}
|
||||
@ -247,15 +264,15 @@ ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode) {
|
||||
* This routine locates each character in the configured font face and renders the glyph's bitmap.
|
||||
* Each bitmap and relevant information is loaded into its own quickly addressible structure within an instance-specific map.
|
||||
*/
|
||||
uint16_t FreeTypeGX::cacheGlyphDataComplete() {
|
||||
uint16_t FreeTypeGX::cacheGlyphDataComplete()
|
||||
{
|
||||
uint16_t i = 0;
|
||||
FT_UInt gIndex;
|
||||
FT_ULong charCode = FT_Get_First_Char( this->ftFace, &gIndex );
|
||||
while ( gIndex != 0 ) {
|
||||
|
||||
if(this->cacheGlyphData(charCode) != NULL) {
|
||||
while( gIndex != 0 )
|
||||
{
|
||||
if(this->cacheGlyphData(charCode) != NULL)
|
||||
i++;
|
||||
}
|
||||
|
||||
charCode = FT_Get_Next_Char( this->ftFace, charCode, &gIndex );
|
||||
}
|
||||
@ -310,18 +327,14 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData)
|
||||
* @param width Current pixel width of the string.
|
||||
* @param format Positional format of the string.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
||||
|
||||
if (format & FTGX_JUSTIFY_LEFT ) {
|
||||
uint16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format)
|
||||
{
|
||||
if (format & FTGX_JUSTIFY_LEFT )
|
||||
return 0;
|
||||
}
|
||||
else if (format & FTGX_JUSTIFY_CENTER ) {
|
||||
else if (format & FTGX_JUSTIFY_CENTER )
|
||||
return width >> 1;
|
||||
}
|
||||
else if (format & FTGX_JUSTIFY_RIGHT ) {
|
||||
else if (format & FTGX_JUSTIFY_RIGHT )
|
||||
return width;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -333,17 +346,14 @@ uint16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
||||
* @param offset Current pixel offset data of the string.
|
||||
* @param format Positional format of the string.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset offset, uint16_t format) {
|
||||
if (format & FTGX_ALIGN_TOP ) {
|
||||
uint16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset offset, uint16_t format)
|
||||
{
|
||||
if (format & FTGX_ALIGN_TOP )
|
||||
return -offset.max;
|
||||
}
|
||||
else if (format & FTGX_ALIGN_MIDDLE ) {
|
||||
else if (format & FTGX_ALIGN_MIDDLE )
|
||||
return -(offset.max - offset.min) >> 1;
|
||||
}
|
||||
else if (format & FTGX_ALIGN_BOTTOM ) {
|
||||
else if (format & FTGX_ALIGN_BOTTOM )
|
||||
return offset.min;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -360,35 +370,34 @@ uint16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset offset, uint16_t format
|
||||
* @param textStyle Flags which specify any styling which should be applied to the rendered string.
|
||||
* @return The number of characters printed.
|
||||
*/
|
||||
uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor color, uint16_t textStyle) {
|
||||
uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor color, uint16_t textStyle)
|
||||
{
|
||||
uint16_t strLength = wcslen(text);
|
||||
uint16_t x_pos = x, printed = 0;
|
||||
uint16_t x_offset = 0, y_offset = 0;
|
||||
GXTexObj glyphTexture;
|
||||
FT_Vector pairDelta;
|
||||
|
||||
if(textStyle & 0x000F) {
|
||||
if(textStyle & 0x000F)
|
||||
x_offset = this->getStyleOffsetWidth(this->getWidth(text), textStyle);
|
||||
}
|
||||
if(textStyle & 0x00F0) {
|
||||
if(textStyle & 0x00F0)
|
||||
y_offset = this->getStyleOffsetHeight(this->getOffset(text), textStyle);
|
||||
}
|
||||
|
||||
|
||||
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||
|
||||
for (uint16_t i = 0; i < strLength; i++) {
|
||||
|
||||
|
||||
for (uint16_t i = 0; i < strLength; i++)
|
||||
{
|
||||
ftgxCharData* glyphData = NULL;
|
||||
if( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||
if( this->fontData.find(text[i]) != this->fontData.end() )
|
||||
glyphData = &this->fontData[text[i]];
|
||||
}
|
||||
else {
|
||||
else
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
}
|
||||
|
||||
if(glyphData != NULL) {
|
||||
|
||||
if(glyphData != NULL)
|
||||
{
|
||||
|
||||
if(this->ftKerningEnabled && i) {
|
||||
if(this->ftKerningEnabled && i)
|
||||
{
|
||||
FT_Get_Kerning( this->ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta );
|
||||
x_pos += pairDelta.x >> 6;
|
||||
}
|
||||
@ -401,9 +410,8 @@ uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor col
|
||||
}
|
||||
}
|
||||
|
||||
if(textStyle & 0x0F00) {
|
||||
if(textStyle & 0x0F00)
|
||||
this->drawTextFeature(x - x_offset, y, this->getWidth(text), this->getOffset(text), textStyle, color);
|
||||
}
|
||||
|
||||
return printed;
|
||||
}
|
||||
@ -411,15 +419,19 @@ uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor col
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t const *text, GXColor color, uint16_t textStyle) {
|
||||
uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t const *text, GXColor color, uint16_t textStyle)
|
||||
{
|
||||
return this->drawText(x, y, (wchar_t *)text, color, textStyle);
|
||||
}
|
||||
|
||||
void FreeTypeGX::drawTextFeature(uint16_t x, uint16_t y, uint16_t width, ftgxDataOffset offsetData, uint16_t format, GXColor color) {
|
||||
void FreeTypeGX::drawTextFeature(uint16_t x, uint16_t y, uint16_t width, ftgxDataOffset offsetData, uint16_t format, GXColor color)
|
||||
{
|
||||
uint16_t featureHeight = this->ftPointSize >> 4 > 0 ? this->ftPointSize >> 4 : 1;
|
||||
|
||||
if (format & FTGX_STYLE_UNDERLINE ) {
|
||||
switch(format & 0x00F0) {
|
||||
if (format & FTGX_STYLE_UNDERLINE )
|
||||
{
|
||||
switch(format & 0x00F0)
|
||||
{
|
||||
case FTGX_ALIGN_TOP:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y + offsetData.max + 1, color);
|
||||
break;
|
||||
@ -435,8 +447,10 @@ void FreeTypeGX::drawTextFeature(uint16_t x, uint16_t y, uint16_t width, ftgxDa
|
||||
}
|
||||
}
|
||||
|
||||
if (format & FTGX_STYLE_STRIKE ) {
|
||||
switch(format & 0x00F0) {
|
||||
if (format & FTGX_STYLE_STRIKE )
|
||||
{
|
||||
switch(format & 0x00F0)
|
||||
{
|
||||
case FTGX_ALIGN_TOP:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y + ((offsetData.max + offsetData.min) >> 1), color);
|
||||
break;
|
||||
@ -462,23 +476,23 @@ void FreeTypeGX::drawTextFeature(uint16_t x, uint16_t y, uint16_t width, ftgxDa
|
||||
* @param text NULL terminated string to calculate.
|
||||
* @return The width of the text string in pixels.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getWidth(wchar_t *text) {
|
||||
uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
||||
{
|
||||
uint16_t strLength = wcslen(text);
|
||||
uint16_t strWidth = 0;
|
||||
FT_Vector pairDelta;
|
||||
|
||||
for (uint16_t i = 0; i < strLength; i++) {
|
||||
|
||||
for (uint16_t i = 0; i < strLength; i++)
|
||||
{
|
||||
ftgxCharData* glyphData = NULL;
|
||||
if( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||
if( this->fontData.find(text[i]) != this->fontData.end() )
|
||||
glyphData = &this->fontData[text[i]];
|
||||
}
|
||||
else {
|
||||
else
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
}
|
||||
|
||||
if(glyphData != NULL) {
|
||||
if(this->ftKerningEnabled && (i > 0)) {
|
||||
if(glyphData != NULL)
|
||||
{
|
||||
if(this->ftKerningEnabled && (i > 0))
|
||||
{
|
||||
FT_Get_Kerning( this->ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta );
|
||||
strWidth += pairDelta.x >> 6;
|
||||
}
|
||||
@ -486,7 +500,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text) {
|
||||
strWidth += glyphData->glyphAdvanceX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return strWidth;
|
||||
}
|
||||
|
||||
@ -494,7 +508,8 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text) {
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::getWidth(wchar_t const *text) {
|
||||
uint16_t FreeTypeGX::getWidth(wchar_t const *text)
|
||||
{
|
||||
return this->getWidth((wchar_t *)text);
|
||||
}
|
||||
|
||||
@ -507,9 +522,9 @@ uint16_t FreeTypeGX::getWidth(wchar_t const *text) {
|
||||
* @param text NULL terminated string to calculate.
|
||||
* @return The height of the text string in pixels.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getHeight(wchar_t *text) {
|
||||
uint16_t FreeTypeGX::getHeight(wchar_t *text)
|
||||
{
|
||||
ftgxDataOffset offset = this->getOffset(text);
|
||||
|
||||
return offset.max + offset.min;
|
||||
}
|
||||
|
||||
@ -517,7 +532,8 @@ uint16_t FreeTypeGX::getHeight(wchar_t *text) {
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::getHeight(wchar_t const *text) {
|
||||
uint16_t FreeTypeGX::getHeight(wchar_t const *text)
|
||||
{
|
||||
return this->getHeight((wchar_t *)text);
|
||||
}
|
||||
|
||||
@ -530,26 +546,25 @@ uint16_t FreeTypeGX::getHeight(wchar_t const *text) {
|
||||
* @param text NULL terminated string to calculate.
|
||||
* @return The max and min values above and below the font origin line.
|
||||
*/
|
||||
ftgxDataOffset FreeTypeGX::getOffset(wchar_t *text) {
|
||||
ftgxDataOffset FreeTypeGX::getOffset(wchar_t *text)
|
||||
{
|
||||
uint16_t strLength = wcslen(text);
|
||||
uint16_t strMax = 0, strMin = 0;
|
||||
|
||||
for (uint16_t i = 0; i < strLength; i++) {
|
||||
|
||||
for (uint16_t i = 0; i < strLength; i++)
|
||||
{
|
||||
ftgxCharData* glyphData = NULL;
|
||||
if( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||
if( this->fontData.find(text[i]) != this->fontData.end() )
|
||||
glyphData = &this->fontData[text[i]];
|
||||
}
|
||||
else {
|
||||
else
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
}
|
||||
|
||||
if(glyphData != NULL) {
|
||||
|
||||
if(glyphData != NULL)
|
||||
{
|
||||
strMax = glyphData->renderOffsetMax > strMax ? glyphData->renderOffsetMax : strMax;
|
||||
strMin = glyphData->renderOffsetMin > strMin ? glyphData->renderOffsetMin : strMin;
|
||||
}
|
||||
}
|
||||
|
||||
return (ftgxDataOffset){strMax, strMin};
|
||||
}
|
||||
|
||||
@ -557,7 +572,8 @@ ftgxDataOffset FreeTypeGX::getOffset(wchar_t *text) {
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
ftgxDataOffset FreeTypeGX::getOffset(wchar_t const *text) {
|
||||
ftgxDataOffset FreeTypeGX::getOffset(wchar_t const *text)
|
||||
{
|
||||
return this->getOffset(text);
|
||||
}
|
||||
|
||||
@ -574,8 +590,8 @@ ftgxDataOffset FreeTypeGX::getOffset(wchar_t const *text) {
|
||||
* @param screenY The screen Y coordinate at which to output the rendered texture.
|
||||
* @param color Color to apply to the texture.
|
||||
*/
|
||||
void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionFormat, uint16_t texWidth, uint16_t texHeight, int16_t screenX, int16_t screenY, GXColor color) {
|
||||
|
||||
void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionFormat, uint16_t texWidth, uint16_t texHeight, int16_t screenX, int16_t screenY, GXColor color)
|
||||
{
|
||||
f32 f32TexWidth = texWidth, f32TexHeight = texHeight;
|
||||
float x = (float)screenX + xPos;
|
||||
float y = (float)screenY + yPos;
|
||||
@ -584,9 +600,10 @@ void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionForm
|
||||
|
||||
// GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
|
||||
// GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
|
||||
|
||||
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
switch(positionFormat) {
|
||||
switch(positionFormat)
|
||||
{
|
||||
case GX_POS_XY:
|
||||
GX_Position2f32(x * xScale, y * yScale);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
@ -626,7 +643,6 @@ void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionForm
|
||||
break;
|
||||
}
|
||||
GX_End();
|
||||
|
||||
// GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
// GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
||||
}
|
||||
@ -643,11 +659,13 @@ void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionForm
|
||||
* @param screenY The screen Y coordinate at which to output the quad.
|
||||
* @param color Color to apply to the texture.
|
||||
*/
|
||||
void FreeTypeGX::copyFeatureToFramebuffer(uint8_t positionFormat, uint16_t featureWidth, uint16_t featureHeight, int16_t screenX, int16_t screenY, GXColor color) {
|
||||
void FreeTypeGX::copyFeatureToFramebuffer(uint8_t positionFormat, uint16_t featureWidth, uint16_t featureHeight, int16_t screenX, int16_t screenY, GXColor color)
|
||||
{
|
||||
f32 f32FeatureWidth = featureWidth, f32FeatureHeight = featureHeight;
|
||||
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
switch(positionFormat) {
|
||||
switch(positionFormat)
|
||||
{
|
||||
case GX_POS_XY:
|
||||
GX_Position2f32(screenX, screenY);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
@ -251,10 +251,11 @@ CCoverFlow::~CCoverFlow(void)
|
||||
{
|
||||
clear();
|
||||
/* for(u8 i = 0; i < 4; i++) */
|
||||
SMART_FREE(m_sound[0]);
|
||||
SMART_FREE(m_hoverSound);
|
||||
SMART_FREE(m_selectSound);
|
||||
SMART_FREE(m_cancelSound);
|
||||
if(m_sound[0].get())
|
||||
m_sound[0].release();
|
||||
m_hoverSound.release();
|
||||
m_selectSound.release();
|
||||
m_cancelSound.release();
|
||||
LWP_MutexDestroy(m_mutex);
|
||||
}
|
||||
|
||||
@ -550,7 +551,8 @@ void CCoverFlow::setBlur(u32 blurResolution, u32 blurRadius, float blurFactor)
|
||||
u32 i = min(max(0u, blurResolution), sizeof blurRes / sizeof blurRes[0] - 1u);
|
||||
m_effectTex.width = blurRes[i].x;
|
||||
m_effectTex.height = blurRes[i].y;
|
||||
SMART_FREE(m_effectTex.data);
|
||||
if(m_effectTex.data.get())
|
||||
m_effectTex.data.release();
|
||||
m_blurRadius = min(max(1u, blurRadius), 3u);
|
||||
m_blurFactor = min(max(1.f, blurFactor), 2.f);
|
||||
}
|
||||
@ -617,7 +619,8 @@ void CCoverFlow::stopCoverLoader(bool empty)
|
||||
{
|
||||
for (u32 i = 0; i < m_items.size(); ++i)
|
||||
{
|
||||
SMART_FREE(m_items[i].texture.data);
|
||||
if(m_items[i].texture.data.get())
|
||||
m_items[i].texture.data.release();
|
||||
m_items[i].state = CCoverFlow::STATE_Loading;
|
||||
}
|
||||
}
|
||||
@ -2497,7 +2500,7 @@ bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full)
|
||||
SWFCHeader header(tex, full, m_compressCache);
|
||||
fwrite(&header, 1, sizeof header, file);
|
||||
fwrite(zBuffer.get(), 1, zBufferSize, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2516,7 +2519,7 @@ bool CCoverFlow::fullCoverCached(const char *id)
|
||||
&& header.full != 0 && m_compressTextures == (header.cmpr != 0)
|
||||
&& header.getWidth() >= 8 && header.getHeight() >= 8
|
||||
&& header.getWidth() <= 1090 && header.getHeight() <= 1090;
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
@ -2553,7 +2556,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq)
|
||||
SWFCHeader header(tex, box, m_compressCache);
|
||||
fwrite(&header, 1, sizeof header, file);
|
||||
fwrite(zBuffer.get(), 1, zBufferSize, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
if (m_deletePicsAfterCaching)
|
||||
remove(path);
|
||||
}
|
||||
@ -2671,7 +2674,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq)
|
||||
}
|
||||
}
|
||||
//
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
if (success) return CCoverFlow::CL_OK;
|
||||
}
|
||||
}
|
||||
@ -2700,7 +2703,8 @@ int CCoverFlow::_coverLoader(CCoverFlow *cf)
|
||||
firstItem = cf->m_covers[cf->m_range / 2].index;
|
||||
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
|
||||
LWP_MutexLock(cf->m_mutex);
|
||||
SMART_FREE(cf->m_items[i].texture.data);
|
||||
if(cf->m_items[i].texture.data.get())
|
||||
cf->m_items[i].texture.data.release();
|
||||
cf->m_items[i].state = CCoverFlow::STATE_Loading;
|
||||
LWP_MutexUnlock(cf->m_mutex);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ VideoFile::VideoFile(FILE* f)
|
||||
|
||||
VideoFile::~VideoFile()
|
||||
{
|
||||
SAFE_CLOSE(_f);
|
||||
fclose(_f);
|
||||
}
|
||||
|
||||
int VideoFile::getWidth() const
|
||||
@ -620,7 +620,7 @@ VideoFile* openVideo(const string& fileName)
|
||||
return new JpgVideoFile(f);
|
||||
|
||||
default:
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -153,8 +153,8 @@ int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buff
|
||||
*(ctx->row_pointers[y]+x*6+3), *(ctx->row_pointers[y]+x*6+4), *(ctx->row_pointers[y]+x*6+5));
|
||||
|
||||
// Free resources
|
||||
SAFE_FREE (ctx->img_data);
|
||||
SAFE_FREE (ctx->row_pointers);
|
||||
MEM2_free(ctx->img_data);
|
||||
MEM2_free(ctx->row_pointers);
|
||||
|
||||
// Success
|
||||
return PNGU_OK;
|
||||
@ -177,8 +177,8 @@ int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buff
|
||||
(((PNGU_u16) (ctx->row_pointers[y][x*3+2] & 0xF8)) >> 3);
|
||||
|
||||
// Free resources
|
||||
SAFE_FREE (ctx->img_data);
|
||||
SAFE_FREE (ctx->row_pointers);
|
||||
MEM2_free(ctx->img_data);
|
||||
MEM2_free(ctx->row_pointers);
|
||||
|
||||
// Success
|
||||
return PNGU_OK;
|
||||
@ -213,8 +213,8 @@ int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffe
|
||||
}
|
||||
|
||||
// Free resources
|
||||
SAFE_FREE (ctx->img_data);
|
||||
SAFE_FREE (ctx->row_pointers);
|
||||
MEM2_free(ctx->img_data);
|
||||
MEM2_free(ctx->row_pointers);
|
||||
|
||||
// Success
|
||||
return PNGU_OK;
|
||||
@ -276,8 +276,8 @@ int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *b
|
||||
}
|
||||
|
||||
// Free resources
|
||||
SAFE_FREE (ctx->img_data);
|
||||
SAFE_FREE (ctx->row_pointers);
|
||||
MEM2_free(ctx->img_data);
|
||||
MEM2_free(ctx->row_pointers);
|
||||
|
||||
// Success
|
||||
return PNGU_OK;
|
||||
@ -523,8 +523,8 @@ int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *b
|
||||
}
|
||||
|
||||
// Free resources
|
||||
SAFE_FREE (ctx->img_data);
|
||||
SAFE_FREE (ctx->row_pointers);
|
||||
MEM2_free(ctx->img_data);
|
||||
MEM2_free(ctx->row_pointers);
|
||||
|
||||
// Success
|
||||
return PNGU_OK;
|
||||
@ -647,8 +647,8 @@ int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *bu
|
||||
}
|
||||
|
||||
// Free resources
|
||||
SAFE_FREE (ctx->img_data);
|
||||
SAFE_FREE (ctx->row_pointers);
|
||||
MEM2_free(ctx->img_data);
|
||||
MEM2_free(ctx->row_pointers);
|
||||
|
||||
// Success
|
||||
return PNGU_OK;
|
||||
@ -1123,8 +1123,8 @@ int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlph
|
||||
{
|
||||
error:
|
||||
memcpy(png_jmpbuf(ctx->png_ptr), save_jmp, sizeof(save_jmp));
|
||||
SAFE_FREE(ctx->row_pointers);
|
||||
SAFE_FREE(ctx->img_data);
|
||||
MEM2_free(ctx->row_pointers);
|
||||
MEM2_free(ctx->img_data);
|
||||
pngu_free_info (ctx);
|
||||
//printf("*** This is a corrupted image!!\n"); sleep(5);
|
||||
return mem_err ? PNGU_LIB_ERROR : -666;
|
||||
|
@ -187,7 +187,8 @@ bool SFont::fromBuffer(const SmartBuf &buffer, u32 bufferSize, u32 size, u32 lsp
|
||||
weight = min(w, 32u);
|
||||
index = idx;
|
||||
|
||||
SMART_FREE(data);
|
||||
if(data.get())
|
||||
data.release();
|
||||
data = smartMem2Alloc(bufferSize);
|
||||
if(!data) return false;
|
||||
|
||||
@ -214,12 +215,13 @@ bool SFont::fromFile(const char *filename, u32 size, u32 lspacing, u32 w, u32 id
|
||||
u32 fileSize = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
if (fileSize == 0) return false;
|
||||
|
||||
SMART_FREE(data);
|
||||
|
||||
if(data.get())
|
||||
data.release();
|
||||
data = smartMem2Alloc(fileSize);
|
||||
if (!data)
|
||||
{
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -211,9 +211,9 @@ STexture::TexErr STexture::fromPNGFile(const char *filename, u8 f, Alloc alloc,
|
||||
ptrPng = smartMem2Alloc(fileSize);
|
||||
if (!!ptrPng)
|
||||
if (fread(ptrPng.get(), 1, fileSize, file) != fileSize)
|
||||
SMART_FREE(ptrPng);
|
||||
ptrPng.release();
|
||||
}
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return !!ptrPng ? fromPNG(ptrPng.get(), f, alloc, minMipSize, maxMipSize) : STexture::TE_NOMEM;
|
||||
}
|
||||
|
||||
@ -319,8 +319,8 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, Alloc alloc, u32 minM
|
||||
}
|
||||
if (!tmpData || !tmpData2)
|
||||
{
|
||||
SMART_FREE(tmpData);
|
||||
SMART_FREE(tmpData2);
|
||||
tmpData.release();
|
||||
tmpData2.release();
|
||||
PNGU_ReleaseImageContext(ctx);
|
||||
return STexture::TE_NOMEM;
|
||||
}
|
||||
|
@ -226,8 +226,8 @@ void CVideo::cleanup(void)
|
||||
gprintf("Cleaning up video...\n");
|
||||
for (u32 i = 0; i < sizeof m_aaBuffer / sizeof m_aaBuffer[0]; ++i)
|
||||
{
|
||||
SMART_FREE(m_aaBuffer[i]);
|
||||
m_aaBufferSize[i] = 0;
|
||||
if(m_aaBuffer[i].get())
|
||||
m_aaBuffer[i].release();
|
||||
}
|
||||
//MEM1_free(m_fifo);
|
||||
}
|
||||
@ -524,7 +524,8 @@ void CVideo::CheckWaitThread()
|
||||
|
||||
LWP_JoinThread(waitThread, NULL);
|
||||
|
||||
SMART_FREE(waitThreadStack);
|
||||
if(waitThreadStack.get())
|
||||
waitThreadStack.release();
|
||||
waitThread = LWP_THREAD_NULL;
|
||||
|
||||
m_waitMessages.clear();
|
||||
|
@ -79,10 +79,10 @@ int LoadHomebrew(const char * filepath)
|
||||
bool good_read = fread(homebrewbuffer, 1, filesize, file) == filesize;
|
||||
if (!good_read)
|
||||
{
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return -4;
|
||||
}
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
|
||||
homebrewsize += filesize;
|
||||
return 1;
|
||||
|
@ -198,7 +198,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
fread( &tmp.hdr, sizeof( discHdr ), 1, fp);
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
|
||||
if ( tmp.hdr.gc_magic == 0xc2339f3d )
|
||||
{
|
||||
@ -280,7 +280,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
{
|
||||
fseek(fp, wbfs ? 512 : 0, SEEK_SET);
|
||||
fread(&tmp.hdr, sizeof(discHdr), 1, fp);
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
if (tmp.hdr.magic == 0x5D1C9EA3)
|
||||
|
@ -17,6 +17,9 @@ typedef int (*app_main)(void **dst, int *size, int *offset);
|
||||
typedef void (*app_init)(void (*report)(const char *fmt, ...));
|
||||
typedef void *(*app_final)();
|
||||
typedef void (*app_entry)(void (**init)(void (*report)(const char *fmt, ...)), int (**main)(), void *(**final)());
|
||||
|
||||
/* Apploader pointers */
|
||||
static u8 *appldr = (u8 *) 0x81200000;
|
||||
|
||||
/* Constants */
|
||||
#define APPLDR_OFFSET 0x2440
|
||||
@ -33,27 +36,25 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc
|
||||
void *dst = NULL;
|
||||
int len = 0;
|
||||
int offset = 0;
|
||||
u32 appldr_len;
|
||||
s32 ret;
|
||||
app_init appldr_init;
|
||||
app_main appldr_main;
|
||||
app_final appldr_final;
|
||||
|
||||
/* Read apploader header */
|
||||
s32 ret = WDVD_Read(buffer, 0x20, APPLDR_OFFSET);
|
||||
if (ret < 0) return ret;
|
||||
|
||||
/* Calculate apploader length */
|
||||
u32 appldr_len = buffer[5] + buffer[6];
|
||||
app_final appldr_final;
|
||||
|
||||
SYS_SetArena1Hi(APPLOADER_END);
|
||||
/* Read apploader header */
|
||||
ret = WDVD_Read(buffer, 0x20, APPLDR_OFFSET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Read apploader code */
|
||||
// Either you limit memory usage or you don't touch the heap after that, because this is writing at 0x1200000
|
||||
ret = WDVD_Read(APPLOADER_START, appldr_len, APPLDR_OFFSET + 0x20);
|
||||
/* Calculate apploader length */
|
||||
appldr_len = buffer[5] + buffer[6];
|
||||
|
||||
/* Read apploader code */
|
||||
ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
DCFlushRange(APPLOADER_START, appldr_len);
|
||||
|
||||
/* Set apploader entry function */
|
||||
app_entry appldr_entry = (app_entry)buffer[4];
|
||||
|
||||
|
@ -45,7 +45,7 @@ bool cIOSInfo::D2X(u8 ios, u8 *base)
|
||||
if(!info)
|
||||
return false;
|
||||
*base = (u8)info->baseios;
|
||||
SAFE_FREE(info);
|
||||
free(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -64,14 +64,14 @@ iosinfo_t *cIOSInfo::GetInfo(u8 ios)
|
||||
|
||||
if (ES_GetStoredTMD(TITLE_ID(1, ios), TMD, TMD_Length) < 0)
|
||||
{
|
||||
SAFE_FREE(TMD);
|
||||
free(TMD);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
|
||||
sprintf(filepath, "/title/00000001/%08x/content/%08x.app", ios, *(u8 *)((u32)TMD+0x1E7));
|
||||
|
||||
SAFE_FREE(TMD);
|
||||
free(TMD);
|
||||
|
||||
u32 size = 0;
|
||||
u8 *buffer = ISFS_GetFile((u8 *) filepath, &size, sizeof(iosinfo_t));
|
||||
@ -93,10 +93,10 @@ iosinfo_t *cIOSInfo::GetInfo(u8 ios)
|
||||
|| !baseMatch /* Base */
|
||||
|| strncasecmp(iosinfo->name, "d2x", 3) != 0) /* Name */
|
||||
{
|
||||
SAFE_FREE(buffer);
|
||||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
SAFE_FREE(buffer);
|
||||
free(buffer);
|
||||
|
||||
return iosinfo;
|
||||
}
|
||||
|
@ -359,7 +359,8 @@ s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString,
|
||||
IOSReloadBlock(IOS_GetVersion(), true);
|
||||
|
||||
s32 ret = WDVD_OpenPartition(offset, 0, 0, 0, Tmd_Buffer);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Select an appropriate video mode */
|
||||
__Disc_SelectVMode(vidMode, 0);
|
||||
@ -369,14 +370,16 @@ s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString,
|
||||
|
||||
/* Run apploader */
|
||||
ret = Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
free_wip();
|
||||
|
||||
if (hooktype != 0)
|
||||
ocarina_do_code();
|
||||
|
||||
gprintf("\n\nEntry Point is: %0x8\n", p_entry);
|
||||
gprintf("\n\nEntry Point is: 0x%08x\n", p_entry);
|
||||
appentrypoint = (u32)p_entry;
|
||||
|
||||
/* Set time */
|
||||
__Disc_SetTime();
|
||||
@ -400,10 +403,8 @@ s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString,
|
||||
// fix for PeppaPig
|
||||
memcpy((void*)0x800000F4,(char *) &temp_data, 4);
|
||||
|
||||
appentrypoint = (u32) p_entry;
|
||||
|
||||
gprintf("Jumping to entrypoint\n");
|
||||
|
||||
|
||||
if (hooktype != 0)
|
||||
{
|
||||
__asm__(
|
||||
|
@ -28,7 +28,7 @@ u8 *ISFS_GetFile(u8 *path, u32 *size, s32 length)
|
||||
if (ISFS_Read(fd, (char*)buf, length) != length)
|
||||
{
|
||||
*size = 0;
|
||||
SAFE_FREE(buf);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ int ocarina_do_code(u64 chantitle)
|
||||
{
|
||||
memcpy(codelist, code_buf, code_size);
|
||||
DCFlushRange(codelist, (u32)codelistend - (u32)codelist);
|
||||
SAFE_FREE(code_buf);
|
||||
MEM2_free(code_buf);
|
||||
}
|
||||
|
||||
// TODO What's this???
|
||||
|
@ -138,7 +138,7 @@ s32 GCDump::__DiscWrite(char * path, u64 offset, u32 length, u8 *ReadBuffer)
|
||||
|
||||
wrote = __DiscWriteFile(f, offset, length, ReadBuffer);
|
||||
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
return wrote;
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ s32 GCDump::DumpGame()
|
||||
{
|
||||
MEM2_free(ReadBuffer);
|
||||
MEM2_free(FSTBuffer);
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
return gc_error;
|
||||
}
|
||||
}
|
||||
@ -455,7 +455,7 @@ s32 GCDump::DumpGame()
|
||||
gprintf("Updating FST\n");
|
||||
fseek(f, FSTOffset, SEEK_SET);
|
||||
fwrite(fst, 1, FSTSize, f);
|
||||
SAFE_CLOSE(f);
|
||||
fclose(f);
|
||||
|
||||
gprintf("Done!! Disc old size: %d, disc new size: %d, saved: %d\n", DiscSize, wrote, DiscSize - wrote);
|
||||
}
|
||||
|
@ -16,12 +16,6 @@
|
||||
#define ALIGN32(x) (((x) + 31) & ~31)
|
||||
#define ALIGNED(x) __attribute__((aligned(x)))
|
||||
|
||||
#define SMART_FREE(P) {if(!!P)P.release();}
|
||||
#define SAFE_FREE(P) {if(P != NULL){free(P);P = NULL;}}
|
||||
#define MEM2_SAFE_FREE(P) {if(P){MEM2_free(P);P = NULL;}}
|
||||
#define SAFE_DELETE(P) {if(P != NULL){delete P;P = NULL;}}
|
||||
#define SAFE_CLOSE(P) {if(P != NULL){fclose(P);P = NULL; }}
|
||||
|
||||
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
|
||||
#define TITLE_UPPER(x) ((u32)((x) >> 32))
|
||||
#define TITLE_LOWER(x) ((u32)(x) & 0xFFFFFFFF)
|
||||
|
@ -86,7 +86,7 @@ s32 __WBFS_ReadDVD(void *fp, u32 lba, u32 len, void *iobuf)
|
||||
|
||||
out:
|
||||
/* Free memory */
|
||||
SAFE_FREE(fp);
|
||||
MEM2_free(fp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ wbfs_disc_t* WBFS_Ext_OpenDisc(u8 *discid, char *fname)
|
||||
int fd = open(fname, O_RDONLY);
|
||||
if (fd == -1) return NULL;
|
||||
|
||||
wbfs_disc_t *iso_file = calloc(sizeof(wbfs_disc_t),1);
|
||||
wbfs_disc_t *iso_file = MEM2_alloc(sizeof(wbfs_disc_t));
|
||||
if (iso_file == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -79,7 +79,7 @@ void WBFS_Ext_CloseDisc(wbfs_disc_t* disc)
|
||||
if (part == &wbfs_iso_file)
|
||||
{
|
||||
close((int)disc->header);
|
||||
SAFE_FREE(disc);
|
||||
MEM2_free(disc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void wip_reset_counter()
|
||||
void free_wip()
|
||||
{
|
||||
if(CodeList)
|
||||
SAFE_FREE(CodeList);
|
||||
MEM2_free(CodeList);
|
||||
|
||||
CodesCount = 0;
|
||||
ProcessedLength = 0;
|
||||
@ -115,7 +115,7 @@ int load_wip_patches(u8 *dir, u8 *gameid)
|
||||
if(!tmp)
|
||||
{
|
||||
MEM2_free(CodeList);
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ int load_wip_patches(u8 *dir, u8 *gameid)
|
||||
CodeList[CodesCount].dstaddress = dstaddress;
|
||||
CodesCount++;
|
||||
}
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
gprintf("\n");
|
||||
|
||||
return 0;
|
||||
|
@ -18,21 +18,36 @@
|
||||
#include "defines.h"
|
||||
#include "svnrev.h"
|
||||
|
||||
extern "C" { extern void __exception_setreload(int t);}
|
||||
|
||||
CMenu *mainMenu;
|
||||
extern "C" void ShowError(const wstringEx &error){mainMenu->error(error); }
|
||||
extern "C" void HideWaitMessage() {mainMenu->_hideWaitMessage(); }
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern void __exception_setreload(int t);
|
||||
|
||||
void ShowError(const wstringEx &error)
|
||||
{
|
||||
mainMenu->error(error);
|
||||
}
|
||||
void HideWaitMessage()
|
||||
{
|
||||
mainMenu->_hideWaitMessage();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
geckoinit = InitGecko();
|
||||
__exception_setreload(5);
|
||||
MEM2_init(52);
|
||||
ISFS_Initialize();
|
||||
|
||||
geckoinit = InitGecko();
|
||||
gprintf(" \nWelcome to %s (%s-r%s)!\nThis is the debug output.\n", APP_NAME, APP_VERSION, SVN_REV);
|
||||
|
||||
SYS_SetArena1Hi(APPLOADER_START);
|
||||
// Init video
|
||||
CVideo vid;
|
||||
vid.init();
|
||||
WIILIGHT_Init();
|
||||
vid.waitMessage(0.2f);
|
||||
|
||||
char *gameid = NULL;
|
||||
bool Emulator_boot = false;
|
||||
@ -59,28 +74,19 @@ int main(int argc, char **argv)
|
||||
|
||||
// Load Custom IOS
|
||||
bool iosOK = loadIOS(mainIOS, false);
|
||||
MEM2_init(52);
|
||||
|
||||
ISFS_Initialize();
|
||||
|
||||
|
||||
u8 mainIOSBase = 0;
|
||||
iosOK = iosOK && cIOSInfo::D2X(mainIOS, &mainIOSBase);
|
||||
gprintf("Loaded cIOS: %u has base %u\n", mainIOS, mainIOSBase);
|
||||
|
||||
|
||||
Open_Inputs(); //init wiimote early
|
||||
|
||||
// Init video
|
||||
vid.init();
|
||||
WIILIGHT_Init();
|
||||
|
||||
vid.waitMessage(0.2f);
|
||||
|
||||
|
||||
// Init
|
||||
Sys_Init();
|
||||
Sys_ExitTo(EXIT_TO_HBC);
|
||||
|
||||
|
||||
int ret = 0;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
bool deviceAvailable = false;
|
||||
@ -92,8 +98,10 @@ int main(int argc, char **argv)
|
||||
sleep(1);
|
||||
|
||||
for(u8 device = USB1; device <= USB8; device++)
|
||||
{
|
||||
if(DeviceHandler::Instance()->IsInserted(device))
|
||||
deviceAvailable = true;
|
||||
}
|
||||
}
|
||||
if(DeviceHandler::Instance()->IsInserted(SD))
|
||||
deviceAvailable = true;
|
||||
@ -106,8 +114,6 @@ int main(int argc, char **argv)
|
||||
CMenu menu(vid);
|
||||
menu.init();
|
||||
|
||||
//Open_Inputs(); //we should init inputs as last point
|
||||
|
||||
mainMenu = &menu;
|
||||
if (!iosOK)
|
||||
{
|
||||
|
@ -47,10 +47,6 @@ void MEM1_free(void *p)
|
||||
void MEM2_init(unsigned int mem2Size)
|
||||
{
|
||||
g_mem2gp.init(mem2Size);
|
||||
g_mem2gp.clear();
|
||||
|
||||
/* Protect space reserved for apploader */
|
||||
SYS_SetArena1Hi(APPLOADER_START);
|
||||
}
|
||||
|
||||
void MEM2_cleanup(void)
|
||||
|
@ -26,13 +26,13 @@ public:
|
||||
switch (m_srcAlloc)
|
||||
{
|
||||
case SRCALL_NEW:
|
||||
SAFE_DELETE(m_p);
|
||||
delete m_p;
|
||||
break;
|
||||
default:
|
||||
SAFE_FREE(m_p);
|
||||
free(m_p);
|
||||
break;
|
||||
}
|
||||
SAFE_DELETE(m_refcount);
|
||||
delete m_refcount;
|
||||
}
|
||||
|
||||
m_p = NULL;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <wchar.h>
|
||||
#include <network.h>
|
||||
#include <errno.h>
|
||||
#include <wiilight.h>
|
||||
|
||||
#include "gecko.h"
|
||||
#include "defines.h"
|
||||
@ -467,11 +468,9 @@ void CMenu::cleanup(bool ios_reload)
|
||||
m_cf.stopCoverLoader();
|
||||
|
||||
_stopSounds();
|
||||
|
||||
|
||||
if (!ios_reload)
|
||||
{
|
||||
SMART_FREE(m_cameraSound);
|
||||
}
|
||||
m_cameraSound.release();
|
||||
|
||||
m_plugin.Cleanup();
|
||||
|
||||
@ -491,11 +490,13 @@ void CMenu::cleanup(bool ios_reload)
|
||||
DeviceHandler::DestroyInstance();
|
||||
|
||||
if (!ios_reload)
|
||||
{
|
||||
_cleanupDefaultFont();
|
||||
}
|
||||
|
||||
if (!ios_reload || (!m_use_wifi_gecko && ios_reload))
|
||||
_deinitNetwork();
|
||||
|
||||
WIILIGHT_SetLevel(0);
|
||||
WIILIGHT_TurnOff();
|
||||
}
|
||||
|
||||
void CMenu::_reload_wifi_gecko(void)
|
||||
@ -1700,7 +1701,8 @@ void CMenu::_updateBg(void)
|
||||
return;
|
||||
}
|
||||
if (m_curBg.data.get() == m_prevBg.data.get())
|
||||
SMART_FREE(m_curBg.data);
|
||||
m_curBg.data.release();
|
||||
|
||||
m_vid.prepare();
|
||||
GX_SetViewport(0.f, 0.f, 640.f, 480.f, 0.f, 1.f);
|
||||
guOrtho(projMtx, 0.f, 480.f, 0.f, 640.f, 0.f, 1000.0f);
|
||||
@ -1868,8 +1870,9 @@ bool CMenu::_loadChannelList(void)
|
||||
gprintf("Written SYSCONF to: %s\n", filepath);
|
||||
fclose(file);
|
||||
}
|
||||
else gprintf("Openning %s failed returning %i\n", filepath, file);
|
||||
SAFE_FREE(sysconf);
|
||||
else
|
||||
gprintf("Openning %s failed returning %i\n", filepath, file);
|
||||
free(sysconf);
|
||||
}
|
||||
|
||||
sprintf(filepath, "/shared2/menu/FaceLib/RFL_DB.dat");
|
||||
@ -1885,8 +1888,9 @@ bool CMenu::_loadChannelList(void)
|
||||
gprintf("Written Mii's to: %s\n", filepath);
|
||||
fclose(file);
|
||||
}
|
||||
else gprintf("Openning %s failed returning %i\n", filepath, file);
|
||||
SAFE_FREE(meez);
|
||||
else
|
||||
gprintf("Openning %s failed returning %i\n", filepath, file);
|
||||
free(meez);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
@ -1905,7 +1909,8 @@ bool CMenu::_loadChannelList(void)
|
||||
Nand::Instance()->Disable_Emu();
|
||||
failed = true;
|
||||
}
|
||||
else failed = false;
|
||||
else
|
||||
failed = false;
|
||||
}
|
||||
|
||||
if(!DeviceHandler::Instance()->IsInserted(currentPartition))
|
||||
@ -1920,7 +1925,7 @@ bool CMenu::_loadChannelList(void)
|
||||
m_cfg.setString("NAND", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
||||
m_cfg.save();
|
||||
}
|
||||
|
||||
|
||||
lastPartition = currentPartition;
|
||||
last_emu_state = disable_emu;
|
||||
|
||||
@ -2104,11 +2109,10 @@ void CMenu::_stopSounds(void)
|
||||
|
||||
bool CMenu::_loadFile(SmartBuf &buffer, u32 &size, const char *path, const char *file)
|
||||
{
|
||||
SMART_FREE(buffer);
|
||||
size = 0;
|
||||
FILE *fp = fopen(file == NULL ? path : fmt("%s/%s", path, file), "rb");
|
||||
|
||||
if (fp == 0) return false;
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
u32 fileSize = ftell(fp);
|
||||
@ -2116,34 +2120,42 @@ bool CMenu::_loadFile(SmartBuf &buffer, u32 &size, const char *path, const char
|
||||
SmartBuf fileBuf = smartAnyAlloc(fileSize);
|
||||
if (!fileBuf)
|
||||
{
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
if (fread(fileBuf.get(), 1, fileSize, fp) != fileSize)
|
||||
{
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
|
||||
if(buffer.get())
|
||||
buffer.release();
|
||||
buffer = fileBuf;
|
||||
|
||||
size = fileSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMenu::_load_installed_cioses()
|
||||
{
|
||||
if (_installed_cios.size() > 0) return;
|
||||
if (_installed_cios.size() > 0)
|
||||
return;
|
||||
|
||||
gprintf("Loading cIOS map\n");
|
||||
|
||||
|
||||
_installed_cios[0] = 1;
|
||||
u8 base = 0;
|
||||
|
||||
for (u8 slot = 100; slot < 254; slot++)
|
||||
for (u8 slot = 200; slot < 254; slot++)
|
||||
{
|
||||
if(cIOSInfo::D2X(slot, &base))
|
||||
{
|
||||
gprintf("Found base %u in slot %u\n", base, slot);
|
||||
_installed_cios[slot] = base;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_hideWaitMessage()
|
||||
@ -2171,11 +2183,11 @@ void CMenu::_loadDefaultFont(bool korean)
|
||||
{
|
||||
u32 size;
|
||||
bool retry = false;
|
||||
|
||||
|
||||
// Read content.map from ISFS
|
||||
u8 *content = ISFS_GetFile((u8 *) "/shared1/content.map", &size, 0);
|
||||
int items = size / sizeof(map_entry_t);
|
||||
|
||||
|
||||
//gprintf("Open content.map, size %d, items %d\n", size, items);
|
||||
|
||||
retry:
|
||||
@ -2189,39 +2201,39 @@ retry:
|
||||
char u8_font_filename[22] = {0};
|
||||
strcpy(u8_font_filename, "/shared1/XXXXXXXX.app"); // Faster than sprintf
|
||||
memcpy(u8_font_filename+9, cm[i].filename, 8);
|
||||
|
||||
|
||||
u8 *u8_font_archive = ISFS_GetFile((u8 *) u8_font_filename, &size, 0);
|
||||
|
||||
|
||||
//gprintf("Opened fontfile: %s: %d bytes\n", u8_font_filename, size);
|
||||
|
||||
|
||||
if (u8_font_archive != NULL)
|
||||
{
|
||||
const u8 *font_file = u8_get_file_by_index(u8_font_archive, 1, &size); // There is only one file in that app
|
||||
|
||||
|
||||
//gprintf("Extracted font: %d\n", size);
|
||||
|
||||
|
||||
m_base_font = smartMem2Alloc(size);
|
||||
memcpy(m_base_font.get(), font_file, size);
|
||||
if(!!m_base_font)
|
||||
m_base_font_size = size;
|
||||
}
|
||||
SAFE_FREE(u8_font_archive);
|
||||
free(u8_font_archive);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!retry)
|
||||
{
|
||||
retry = true;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
SAFE_FREE(content);
|
||||
|
||||
free(content);
|
||||
}
|
||||
|
||||
void CMenu::_cleanupDefaultFont()
|
||||
{
|
||||
SMART_FREE(m_base_font);
|
||||
m_base_font.release();
|
||||
m_base_font_size = 0;
|
||||
}
|
||||
|
||||
@ -2289,13 +2301,13 @@ bool CMenu::MIOSisDML()
|
||||
if(*(u32*)(appfile+i) == 0x44494F53)
|
||||
{
|
||||
gprintf("DML is installed as MIOS\n");
|
||||
SAFE_FREE(appfile);
|
||||
free(appfile);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_FREE(appfile);
|
||||
free(appfile);
|
||||
gprintf("DML is not installed as MIOS\n");
|
||||
return false;
|
||||
}
|
||||
@ -2303,21 +2315,23 @@ bool CMenu::MIOSisDML()
|
||||
void CMenu::RemoveCover( char * id )
|
||||
{
|
||||
FILE *fp = fopen(fmt("%s/%s.png", m_boxPicDir.c_str(), id), "rb");
|
||||
if (fp != 0)
|
||||
if (fp != NULL)
|
||||
{
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
remove(fmt("%s/%s.png", m_boxPicDir.c_str(), id));
|
||||
}
|
||||
|
||||
fp = fopen(fmt("%s/%s.png", m_picDir.c_str(), id), "rb");
|
||||
if (fp != 0)
|
||||
if (fp != NULL)
|
||||
{
|
||||
SAFE_CLOSE(fp);
|
||||
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 != 0)
|
||||
if (fp != NULL)
|
||||
{
|
||||
SAFE_CLOSE(fp);
|
||||
fclose(fp);
|
||||
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), id));
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ void CMenu::_about(void)
|
||||
SetupInput();
|
||||
_showAbout();
|
||||
|
||||
do
|
||||
while(1)
|
||||
{
|
||||
_mainLoopCommon();
|
||||
|
||||
@ -74,7 +74,7 @@ void CMenu::_about(void)
|
||||
m_cf.startCoverLoader();
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
_hideAbout(false);
|
||||
}
|
||||
|
||||
@ -85,8 +85,10 @@ void CMenu::_hideAbout(bool instant)
|
||||
m_btnMgr.hide(m_aboutLblInfo, instant);
|
||||
m_btnMgr.hide(m_aboutBtnSystem, instant);
|
||||
for (u32 i = 0; i < ARRAY_SIZE(m_aboutLblUser); ++i)
|
||||
{
|
||||
if (m_aboutLblUser[i] != -1u)
|
||||
m_btnMgr.hide(m_aboutLblUser[i], instant);
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_showAbout(void)
|
||||
@ -98,8 +100,10 @@ void CMenu::_showAbout(void)
|
||||
if (!m_locked)
|
||||
m_btnMgr.show(m_aboutBtnSystem);
|
||||
for (u32 i = 0; i < ARRAY_SIZE(m_aboutLblUser); ++i)
|
||||
{
|
||||
if (m_aboutLblUser[i] != -1u)
|
||||
m_btnMgr.show(m_aboutLblUser[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_initAboutMenu(CMenu::SThemeData &theme)
|
||||
@ -111,12 +115,12 @@ void CMenu::_initAboutMenu(CMenu::SThemeData &theme)
|
||||
m_aboutLblInfo = _addText(theme, "ABOUT/INFO", theme.txtFont, L"", 20, 200, 600, 280, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
|
||||
m_aboutBtnSystem = _addButton(theme, "ABOUT/SYSTEM_BTN", theme.btnFont, L"", 20, 400, 200, 56, theme.btnFontColor);
|
||||
m_aboutLblIOS = _addLabel(theme, "ABOUT/IOS", theme.txtFont, L"", 240, 400, 360, 56, theme.txtFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE);
|
||||
//
|
||||
|
||||
_setHideAnim(m_aboutLblTitle, "ABOUT/TITLE", 0, 100, 0.f, 0.f);
|
||||
_setHideAnim(m_aboutLblInfo, "ABOUT/INFO", 0, 100, 0.f, 0.f);
|
||||
_setHideAnim(m_aboutBtnSystem, "ABOUT/SYSTEM_BTN", 0, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_aboutLblIOS, "ABOUT/IOS", 0, 100, 0.f, 0.f);
|
||||
//
|
||||
|
||||
_hideAbout(true);
|
||||
_textAbout();
|
||||
}
|
||||
@ -126,7 +130,9 @@ void CMenu::_textAbout(void)
|
||||
m_btnMgr.setText(m_aboutBtnSystem, _t("sys4", L"Update"));
|
||||
m_btnMgr.setText(m_aboutLblTitle, wfmt(_fmt("appname", L"%s (%s-r%s)"), APP_NAME, APP_VERSION, SVN_REV), false);
|
||||
|
||||
char *help = (char*)calloc(4096, sizeof(char));
|
||||
char *help = (char*)MEM2_alloc(4096 * sizeof(char));
|
||||
memset(help, 0, sizeof(help));
|
||||
|
||||
FILE * f = fopen(fmt("%s/%s.txt", m_helpDir.c_str(), m_curLanguage.c_str()), "r");
|
||||
if (f == NULL)
|
||||
f = fopen(fmt("%s/english.txt", m_helpDir.c_str()), "r");
|
||||
@ -152,7 +158,8 @@ void CMenu::_textAbout(void)
|
||||
|
||||
wstringEx translator(wfmt(L", %s", m_loc.getWString(m_curLanguage, "translation_author").toUTF8().c_str()));
|
||||
wstringEx thanks(wfmt(_fmt("about4", L"Thanks To:\n%s"), THANKS));
|
||||
if(translator.size() > 3) thanks.append(translator);
|
||||
if(translator.size() > 3)
|
||||
thanks.append(translator);
|
||||
|
||||
m_btnMgr.setText(m_aboutLblInfo,
|
||||
wfmt(L"%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s",
|
||||
@ -167,12 +174,14 @@ void CMenu::_textAbout(void)
|
||||
false
|
||||
);
|
||||
|
||||
SAFE_FREE(help);
|
||||
MEM2_free(help);
|
||||
Nand::Instance()->Disable_Emu();
|
||||
|
||||
iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS);
|
||||
if(iosInfo != NULL)
|
||||
m_btnMgr.setText(m_aboutLblIOS, wfmt(_fmt("ios", L"IOS%i base %i v%i"), mainIOS, iosInfo->baseios, iosInfo->version), true);
|
||||
SAFE_FREE(iosInfo);
|
||||
free(iosInfo);
|
||||
|
||||
if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt("NAND", "emulation", 0) > 0)
|
||||
Nand::Instance()->Enable_Emu();
|
||||
}
|
||||
|
@ -29,7 +29,8 @@ void CMenu::_showCheatDownload(void)
|
||||
u32 CMenu::_downloadCheatFileAsync(void *obj)
|
||||
{
|
||||
CMenu *m = (CMenu *)obj;
|
||||
if (!m->m_thrdWorking) return 0;
|
||||
if (!m->m_thrdWorking)
|
||||
return 0;
|
||||
|
||||
m->m_thrdStop = false;
|
||||
|
||||
@ -42,7 +43,7 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
|
||||
m->m_thrdWorking = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
u32 bufferSize = 0x080000; // Maximum download size 512kb
|
||||
SmartBuf buffer = smartAnyAlloc(bufferSize);
|
||||
if (!buffer)
|
||||
@ -63,12 +64,14 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(cheatfile.data, 1, cheatfile.size, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
buffer.release();
|
||||
m->m_thrdWorking = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buffer.release();
|
||||
m->m_thrdWorking = false;
|
||||
return -3;
|
||||
}
|
||||
|
@ -29,6 +29,13 @@
|
||||
#define GAMETDB_URL "http://www.gametdb.com/wiitdb.zip?LANG=%s&FALLBACK=TRUE&WIIWARE=TRUE&GAMECUBE=TRUE"
|
||||
#define UPDATE_URL_VERSION "http://dl.dropbox.com/u/25620767/WiiflowMod/versions.txt"
|
||||
|
||||
#define STACK_ALIGN(type, name, cnt, alignment) \
|
||||
u8 _al__##name[((sizeof(type)*(cnt)) + (alignment) + \
|
||||
(((sizeof(type)*(cnt))%(alignment)) > 0 ? ((alignment) - \
|
||||
((sizeof(type)*(cnt))%(alignment))) : 0))]; \
|
||||
type *name = (type*)(((u32)(_al__##name)) + ((alignment) - (( \
|
||||
(u32)(_al__##name))&((alignment)-1))))
|
||||
|
||||
static const char FMT_BPIC_URL[] = "http://art.gametdb.com/wii/coverfullHQ/{loc}/{gameid}.png"\
|
||||
"|http://art.gametdb.com/wii/coverfull/{loc}/{gameid}.png";
|
||||
static const char FMT_PIC_URL[] = "http://art.gametdb.com/wii/cover/{loc}/{gameid}.png";
|
||||
@ -372,7 +379,7 @@ static bool checkPNGFile(const char *filename)
|
||||
buffer = smartAnyAlloc(fileSize);
|
||||
if (!!buffer) fread(buffer.get(), 1, fileSize, file);
|
||||
}
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
return !buffer ? false : checkPNGBuf(buffer.get());
|
||||
}
|
||||
|
||||
@ -391,7 +398,7 @@ bool CMenu::_isNetworkAvailable()
|
||||
if (buf && size > 4)
|
||||
{
|
||||
retval = buf[4] > 0; // There is a valid connection defined.
|
||||
SAFE_FREE(buf);
|
||||
free(buf);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@ -399,7 +406,7 @@ bool CMenu::_isNetworkAvailable()
|
||||
s32 CMenu::_networkComplete(s32 ok, void *usrData)
|
||||
{
|
||||
CMenu *m = (CMenu *) usrData;
|
||||
|
||||
|
||||
m->m_networkInit = ok == 0;
|
||||
m->m_thrdNetwork = false;
|
||||
|
||||
@ -436,13 +443,6 @@ int CMenu::_initNetwork()
|
||||
return val;
|
||||
}
|
||||
|
||||
#define STACK_ALIGN(type, name, cnt, alignment) \
|
||||
u8 _al__##name[((sizeof(type)*(cnt)) + (alignment) + \
|
||||
(((sizeof(type)*(cnt))%(alignment)) > 0 ? ((alignment) - \
|
||||
((sizeof(type)*(cnt))%(alignment))) : 0))]; \
|
||||
type *name = (type*)(((u32)(_al__##name)) + ((alignment) - (( \
|
||||
(u32)(_al__##name))&((alignment)-1))))
|
||||
|
||||
void CMenu::_deinitNetwork()
|
||||
{
|
||||
net_wc24cleanup();
|
||||
@ -466,6 +466,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
_setThrdMsg(L"Not enough memory!", 1.f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
m_thrdWorking = false;
|
||||
buffer.release();
|
||||
return 0;
|
||||
}
|
||||
bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true);
|
||||
@ -474,10 +475,10 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
vector<string> fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|');
|
||||
vector<string> fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|');
|
||||
vector<string> fmtURLCFlat = stringToVector(m_cfg.getString("GENERAL", "url_custom_flat_covers", FMT_CPIC_URL), '|');
|
||||
|
||||
|
||||
u32 nbSteps = m_gameList.size();
|
||||
u32 step = 0;
|
||||
|
||||
|
||||
GameTDB c_gameTDB;
|
||||
if (m_settingsDir.size() > 0)
|
||||
{
|
||||
@ -517,6 +518,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
_setThrdMsg(_t("dlmsg2", L"Network initialization failed!"), 1.f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
m_thrdWorking = false;
|
||||
buffer.release();
|
||||
return 0;
|
||||
}
|
||||
m_thrdStepLen = dlWeight / (float)nbSteps;
|
||||
@ -524,7 +526,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
Config m_newID;
|
||||
m_newID.load(fmt("%s/newid.ini", m_settingsDir.c_str()));
|
||||
m_newID.setString("CHANNELS", "WFSF", "DWFA");
|
||||
|
||||
|
||||
u32 CoverType = 0;
|
||||
|
||||
for(u32 i = 0; i < coverList.size() && !m_thrdStop; ++i)
|
||||
@ -535,7 +537,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
bool original = true;
|
||||
bool custom = false;
|
||||
FILE *file = NULL;
|
||||
|
||||
|
||||
int c_altCase = 0;
|
||||
|
||||
string newID = m_newID.getString(domain, coverList[i], coverList[i]);
|
||||
@ -546,31 +548,30 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
{
|
||||
gprintf("old id = %s\nnew id = %s\n", coverList[i].c_str(), newID.c_str());
|
||||
}
|
||||
|
||||
|
||||
for( int p = 0; p < 4; ++p )
|
||||
{
|
||||
switch(p)
|
||||
{
|
||||
case 0:
|
||||
CoverType = m_downloadPrioVal&C_TYPE_PRIOA ? CBOX : BOX;
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
CoverType = m_downloadPrioVal&C_TYPE_PRIOA ? ( m_downloadPrioVal&C_TYPE_PRIOB ? CFLAT : BOX ) : ( m_downloadPrioVal&C_TYPE_PRIOB ? CBOX : FLAT );
|
||||
break;
|
||||
break;
|
||||
case 2:
|
||||
CoverType = m_downloadPrioVal&C_TYPE_PRIOA ? ( m_downloadPrioVal&C_TYPE_PRIOB ? BOX : CFLAT ) : ( m_downloadPrioVal&C_TYPE_PRIOB ? FLAT : CBOX );
|
||||
break;
|
||||
break;
|
||||
case 3:
|
||||
CoverType = m_downloadPrioVal&C_TYPE_PRIOA ? FLAT : CFLAT;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch( CoverType )
|
||||
{
|
||||
case BOX:
|
||||
if( m_downloadPrioVal&C_TYPE_ONOR )
|
||||
original = false;
|
||||
|
||||
if (!success && !m_thrdStop && original)
|
||||
{
|
||||
path = sfmt("%s/%s.png", m_boxPicDir.c_str(), coverList[i].c_str());
|
||||
@ -579,103 +580,98 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
for (u32 j = 0; !success && j < fmtURLBox.size() && !m_thrdStop; ++j)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, countryCode(newID));
|
||||
|
||||
if (j == 0) ++step;
|
||||
m_thrdStep = listWeight + dlWeight * (float)step / (float)nbSteps;
|
||||
LWP_MutexLock(m_mutex);
|
||||
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
|
||||
|
||||
|
||||
for( int o = 0; o < 12; ++o )
|
||||
{
|
||||
bool tdl = false;
|
||||
if( download.data != NULL )
|
||||
break;
|
||||
|
||||
switch( o )
|
||||
{
|
||||
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;
|
||||
break;
|
||||
case JA:
|
||||
if(newID[3] == 'J' && m_downloadPrioVal&C_TYPE_JA)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "JA");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case FR:
|
||||
if((newID[3] == 'F' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_FR)
|
||||
{;
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "FR");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case DE:
|
||||
if((newID[3] == 'D' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_DE)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "DE");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ES:
|
||||
if((newID[3] == 'S' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_ES)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "ES");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case IT:
|
||||
if((newID[3] == 'I' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_IT)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "IT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case NL:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "NL");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case PT:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "PT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case RU:
|
||||
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "RU");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case KO:
|
||||
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "KO");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case AU:
|
||||
if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], newID, "ZH");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ZHCN:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( tdl )
|
||||
{
|
||||
LWP_MutexLock(m_mutex);
|
||||
@ -684,7 +680,6 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
|
||||
}
|
||||
}
|
||||
|
||||
if (download.data != NULL)
|
||||
{
|
||||
if (savePNG)
|
||||
@ -696,7 +691,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(download.data, download.size, 1, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -712,13 +707,11 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case CBOX:
|
||||
if( m_downloadPrioVal&C_TYPE_ONCU )
|
||||
custom = true;
|
||||
|
||||
c_altCase = c_gameTDB.GetCaseVersions( coverList[i].c_str() );
|
||||
|
||||
if (!success && !m_thrdStop && c_gameTDB.IsLoaded() && c_altCase > 1 && custom)
|
||||
{
|
||||
path = sfmt("%s/%s.png", m_boxPicDir.c_str(), coverList[i].c_str());
|
||||
@ -727,14 +720,12 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
for (u32 j = 0; !success && j < fmtURLCBox.size() && !m_thrdStop; ++j)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, countryCode(newID));
|
||||
|
||||
if (j == 0) ++step;
|
||||
m_thrdStep = listWeight + dlWeight * (float)step / (float)nbSteps;
|
||||
LWP_MutexLock(m_mutex);
|
||||
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
|
||||
|
||||
for( int o = 0; o < 12; ++o )
|
||||
{
|
||||
bool tdl = false;
|
||||
@ -749,82 +740,81 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
url = makeURL(fmtURLCBox[j], newID, "EN");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case JA:
|
||||
if(newID[3] == 'J' && m_downloadPrioVal&C_TYPE_JA)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "JA");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case FR:
|
||||
if((newID[3] == 'F' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_FR)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "FR");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case DE:
|
||||
if((newID[3] == 'D' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_DE)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "DE");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ES:
|
||||
if((newID[3] == 'S' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_ES)
|
||||
{
|
||||
|
||||
url = makeURL(fmtURLCBox[j], newID, "ES");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case IT:
|
||||
if((newID[3] == 'I' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_IT)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "IT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case NL:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "NL");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case PT:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "PT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case RU:
|
||||
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "RU");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case KO:
|
||||
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "KO");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case AU:
|
||||
if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], newID, "ZH");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ZHCN:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( tdl )
|
||||
{
|
||||
LWP_MutexLock(m_mutex);
|
||||
@ -845,7 +835,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(download.data, download.size, 1, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -861,11 +851,10 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case FLAT:
|
||||
if( m_downloadPrioVal&C_TYPE_ONOR )
|
||||
original = false;
|
||||
|
||||
if (!success && !m_thrdStop && original)
|
||||
{
|
||||
path = sfmt("%s/%s.png", m_picDir.c_str(), coverList[i].c_str());
|
||||
@ -880,13 +869,13 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
_setThrdMsg(wfmt(_fmt("dlmsg8", L"Full cover not found. Downloading from %s"), url.c_str()), listWeight + dlWeight * (float)step / (float)nbSteps);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
|
||||
|
||||
|
||||
for( int o = 0; o < 12; ++o )
|
||||
{
|
||||
bool tdl = false;
|
||||
if( download.data != NULL )
|
||||
break;
|
||||
|
||||
|
||||
switch( o )
|
||||
{
|
||||
case EN:
|
||||
@ -895,81 +884,80 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
url = makeURL(fmtURLFlat[j], newID, "EN");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case JA:
|
||||
if(newID[3] == 'J' && m_downloadPrioVal&C_TYPE_JA)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "JA");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case FR:
|
||||
if((newID[3] == 'F' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_FR)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "FR");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case DE:
|
||||
if((newID[3] == 'D' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_DE)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "DE");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ES:
|
||||
if((newID[3] == 'S' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_ES)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "ES");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case IT:
|
||||
if((newID[3] == 'I' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_IT)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "IT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case NL:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "NL");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case PT:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "PT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case RU:
|
||||
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "RU");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case KO:
|
||||
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "KO");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case AU:
|
||||
if(newID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], newID, "ZH");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ZHCN:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( tdl )
|
||||
{
|
||||
LWP_MutexLock(m_mutex);
|
||||
@ -978,7 +966,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (download.data != NULL)
|
||||
{
|
||||
if (savePNG)
|
||||
@ -990,7 +978,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(download.data, download.size, 1, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1006,11 +994,10 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case CFLAT:
|
||||
if( m_downloadPrioVal&C_TYPE_ONCU )
|
||||
custom = true;
|
||||
|
||||
if (!success && !m_thrdStop && c_gameTDB.IsLoaded() && c_altCase > 1 && custom)
|
||||
{
|
||||
path = sfmt("%s/%s.png", m_picDir.c_str(), coverList[i].c_str());
|
||||
@ -1025,13 +1012,13 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
_setThrdMsg(wfmt(_fmt("dlmsg8", L"Full cover not found. Downloading from %s"), url.c_str()), listWeight + dlWeight * (float)step / (float)nbSteps);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
|
||||
|
||||
|
||||
for( int o = 0; o < 12; ++o )
|
||||
{
|
||||
bool tdl = false;
|
||||
if( download.data != NULL )
|
||||
break;
|
||||
|
||||
|
||||
switch( o )
|
||||
{
|
||||
case EN:
|
||||
@ -1040,81 +1027,80 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
url = makeURL(fmtURLCFlat[j], newID, "EN");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case JA:
|
||||
if(newID[3] == 'J' && m_downloadPrioVal&C_TYPE_JA)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "JA");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case FR:
|
||||
if((newID[3] == 'F' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_FR)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "FR");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case DE:
|
||||
if((newID[3] == 'D' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_DE)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "DE");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ES:
|
||||
if((newID[3] == 'S' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_ES)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "ES");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case IT:
|
||||
if((newID[3] == 'I' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_IT)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "IT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case NL:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_NL)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "NL");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case PT:
|
||||
if(newID[3] == 'P' && m_downloadPrioVal&C_TYPE_PT)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "PT");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case RU:
|
||||
if((newID[3] == 'R' || newID[3] == 'P') && m_downloadPrioVal&C_TYPE_RU)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "RU");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case KO:
|
||||
if(newID[3] == 'K' && m_downloadPrioVal&C_TYPE_KO)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "KO");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case AU:
|
||||
if((newID[3] == 'P' || newID[3] == 'Y' || newID[3] == 'X') && m_downloadPrioVal&C_TYPE_ZHCN)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], newID, "ZH");
|
||||
tdl = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ZHCN:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( tdl )
|
||||
{
|
||||
LWP_MutexLock(m_mutex);
|
||||
@ -1123,7 +1109,6 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
|
||||
}
|
||||
}
|
||||
|
||||
if (download.data != NULL)
|
||||
{
|
||||
if (savePNG)
|
||||
@ -1135,7 +1120,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(download.data, download.size, 1, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1151,15 +1136,15 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
newID.clear();
|
||||
++step;
|
||||
}
|
||||
if(c_gameTDB.IsLoaded())
|
||||
c_gameTDB.CloseFile();
|
||||
|
||||
|
||||
coverList.clear();
|
||||
m_newID.unload();
|
||||
}
|
||||
@ -1170,6 +1155,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
_setThrdMsg(wfmt(_fmt("dlmsg9", L"%i/%i files downloaded. %i are front covers only."), count + countFlat, n, countFlat), 1.f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
m_thrdWorking = false;
|
||||
buffer.release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1178,7 +1164,7 @@ void CMenu::_download(string gameId)
|
||||
lwp_t thread = LWP_THREAD_NULL;
|
||||
int msg = 0;
|
||||
wstringEx prevMsg;
|
||||
|
||||
|
||||
bool _updateGametdb = false;
|
||||
|
||||
SetupInput();
|
||||
@ -1218,13 +1204,9 @@ void CMenu::_download(string gameId)
|
||||
m_btnMgr.hide(m_downloadBtnGameTDBDownload);
|
||||
m_btnMgr.hide(m_downloadLblCovers);
|
||||
m_btnMgr.hide(m_downloadLblGameTDBDownload);
|
||||
//m_btnMgr.hide(m_downloadLblCoverPrio);
|
||||
//m_btnMgr.hide(m_downloadLblPrio);
|
||||
//m_btnMgr.hide(m_downloadBtnPrioM);
|
||||
//m_btnMgr.hide(m_downloadBtnPrioP);
|
||||
m_btnMgr.hide(m_downloadLblCoverSet);
|
||||
m_btnMgr.hide(m_downloadBtnCoverSet);
|
||||
|
||||
|
||||
m_thrdStop = false;
|
||||
m_thrdWorking = true;
|
||||
gameId.clear();
|
||||
@ -1436,7 +1418,6 @@ void CMenu::_download(string gameId)
|
||||
|
||||
else if (m_btnMgr.selected(m_downloadBtnGameTDBDownload) && !m_thrdWorking)
|
||||
{
|
||||
// bool dlAll = m_btnMgr.selected(m_downloadBtnAllTitles);
|
||||
m_btnMgr.show(m_downloadPBar);
|
||||
m_btnMgr.setProgress(m_downloadPBar, 0.f);
|
||||
_hideSettings();
|
||||
@ -1449,7 +1430,7 @@ void CMenu::_download(string gameId)
|
||||
m_btnMgr.hide(m_downloadBtnCoverSet);
|
||||
m_thrdStop = false;
|
||||
m_thrdWorking = true;
|
||||
|
||||
|
||||
_updateGametdb = true;
|
||||
|
||||
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_gametdbDownloader, (void *)this, 0, 8192, 40);
|
||||
@ -1556,7 +1537,6 @@ void CMenu::_initDownloadMenu(CMenu::SThemeData &theme)
|
||||
m_downloadBtnAUs = _addPicButton(theme, "DOWNLOAD/AUS", theme.btnAUOn, theme.btnAUOns, 465, 340, 120, 56);
|
||||
m_downloadBtnBack = _addButton(theme, "DOWNLOAD/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor);
|
||||
|
||||
|
||||
// Download menu
|
||||
_setHideAnim(m_downloadLblTitle, "DOWNLOAD/TITLE", 0, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_downloadPBar, "DOWNLOAD/PROGRESS_BAR", 0, 0, -2.f, 0.f);
|
||||
@ -1647,7 +1627,6 @@ void CMenu::_textDownload(void)
|
||||
m_btnMgr.setText(m_downloadBtnZHCNs, L"ZHCN");
|
||||
m_btnMgr.setText(m_downloadBtnAUs, L"AU");
|
||||
m_btnMgr.setText(m_downloadBtnBack, _t("dl18", L"Back"));
|
||||
|
||||
}
|
||||
|
||||
s8 CMenu::_versionTxtDownloaderInit(CMenu *m) //Handler to download versions txt file
|
||||
@ -1658,7 +1637,7 @@ s8 CMenu::_versionTxtDownloaderInit(CMenu *m) //Handler to download versions txt
|
||||
|
||||
s8 CMenu::_versionTxtDownloader() // code to download new version txt file
|
||||
{
|
||||
u32 bufferSize = 0x001000; // Maximum download size 4kb
|
||||
u32 bufferSize = 0x010000; // Maximum download size 64kb
|
||||
SmartBuf buffer = smartAnyAlloc(bufferSize);
|
||||
if (!buffer)
|
||||
{
|
||||
@ -1672,7 +1651,7 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
|
||||
LWP_MutexLock(m_mutex);
|
||||
_setThrdMsg(_t("dlmsg1", L"Initializing network..."), 0.f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
|
||||
|
||||
if (_initNetwork() < 0)
|
||||
{
|
||||
LWP_MutexLock(m_mutex);
|
||||
@ -1707,7 +1686,7 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(download.data, 1, download.size, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
|
||||
// version file valid, check for version with SVN_REV
|
||||
int svnrev = atoi(SVN_REV);
|
||||
@ -1740,12 +1719,14 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
|
||||
}
|
||||
}
|
||||
m_thrdWorking = false;
|
||||
buffer.release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s8 CMenu::_versionDownloaderInit(CMenu *m) //Handler to download new dol
|
||||
{
|
||||
if (!m->m_thrdWorking) return 0;
|
||||
if (!m->m_thrdWorking)
|
||||
return 0;
|
||||
return m->_versionDownloader();
|
||||
}
|
||||
|
||||
@ -1755,9 +1736,11 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
strcpy(dol_backup, m_dol.c_str());
|
||||
strcat(dol_backup, ".backup");
|
||||
|
||||
if (m_app_update_size == 0) m_app_update_size = 0x400000;
|
||||
if (m_data_update_size == 0) m_data_update_size = 0x400000;
|
||||
|
||||
if (m_app_update_size == 0)
|
||||
m_app_update_size = 0x400000;
|
||||
if (m_data_update_size == 0)
|
||||
m_data_update_size = 0x400000;
|
||||
|
||||
// check for existing dol
|
||||
ifstream filestr;
|
||||
gprintf("DOL Path: %s\n", m_dol.c_str());
|
||||
@ -1803,6 +1786,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
sleep(3);
|
||||
m_thrdWorking = false;
|
||||
buffer.release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1824,6 +1808,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
sleep(3);
|
||||
m_thrdWorking = false;
|
||||
buffer.release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1841,7 +1826,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(download.data, 1, download.size, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
|
||||
LWP_MutexLock(m_mutex);
|
||||
_setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f);
|
||||
@ -1851,7 +1836,8 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
bool result = zFile.ExtractAll(m_app_update_drive);
|
||||
remove(m_app_update_zip.c_str());
|
||||
|
||||
if (!result) goto fail;
|
||||
if (!result)
|
||||
goto fail;
|
||||
|
||||
//Update apps dir succeeded, try to update the data dir.
|
||||
download.data = NULL;
|
||||
@ -1883,7 +1869,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
if (file != NULL)
|
||||
{
|
||||
fwrite(download.data, 1, download.size, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
|
||||
LWP_MutexLock(m_mutex);
|
||||
_setThrdMsg(_t("dlmsg24", L"Extracting..."), 0.8f);
|
||||
@ -1930,6 +1916,7 @@ fail:
|
||||
_setThrdMsg(_t("dlmsg15", L"Saving failed!"), 1.f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
out:
|
||||
buffer.release();
|
||||
sleep(3);
|
||||
m_thrdWorking = false;
|
||||
return 0;
|
||||
@ -1999,7 +1986,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
else
|
||||
{
|
||||
fwrite(download.data, download.size, 1, file);
|
||||
SAFE_CLOSE(file);
|
||||
fclose(file);
|
||||
|
||||
gprintf("Extracting zip file: ");
|
||||
|
||||
@ -2010,11 +1997,11 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
|
||||
// We don't need the zipfile anymore
|
||||
remove(zippath.c_str());
|
||||
|
||||
|
||||
// We should always remove the offsets file to make sure it's reloaded
|
||||
string offsetspath = sfmt("%s/gametdb_offsets.bin", m_settingsDir.c_str());
|
||||
remove(offsetspath.c_str());
|
||||
|
||||
|
||||
// Update cache
|
||||
m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
||||
UpdateCache();
|
||||
@ -2022,7 +2009,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
LWP_MutexLock(m_mutex);
|
||||
_setThrdMsg(_t("dlmsg26", L"Updating cache..."), 0.f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
|
||||
|
||||
m_GameTDBLoaded = true;
|
||||
|
||||
_loadList();
|
||||
@ -2030,6 +2017,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
}
|
||||
}
|
||||
}
|
||||
buffer.release();
|
||||
m_thrdWorking = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -399,17 +399,16 @@ void CMenu::_game(bool launch)
|
||||
FILE *file = fopen(videoPath.c_str(), "rb");
|
||||
if (file)
|
||||
{
|
||||
SAFE_CLOSE(file);
|
||||
|
||||
fclose(file);
|
||||
_hideGame();
|
||||
WiiMovie movie(videoPath.c_str());
|
||||
movie.SetScreenSize(m_cfg.getInt("GENERAL", "tv_width", 640), m_cfg.getInt("GENERAL", "tv_height", 480), m_cfg.getInt("GENERAL", "tv_x", 0), m_cfg.getInt("GENERAL", "tv_y", 0));
|
||||
movie.SetVolume(m_cfg.getInt("GENERAL", "sound_volume_bnr", 255));
|
||||
//_stopSounds();
|
||||
movie.Play();
|
||||
|
||||
|
||||
m_video_playing = true;
|
||||
|
||||
|
||||
STexture videoBg;
|
||||
while (!BTN_B_PRESSED && !BTN_A_PRESSED && !BTN_HOME_PRESSED && movie.GetNextFrame(&videoBg))
|
||||
{
|
||||
@ -1393,21 +1392,22 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
_extractBnr(m->m_gameSoundHdr) : m->m_current_view == COVERFLOW_CHANNEL ?
|
||||
_extractChannelBnr(m->m_gameSoundHdr->hdr.chantitle) : NULL;
|
||||
m->m_gameSoundHdr = NULL;
|
||||
|
||||
|
||||
if (banner == NULL || !banner->IsValid())
|
||||
{
|
||||
gprintf("no valid banner found\n");
|
||||
SAFE_DELETE(banner);
|
||||
delete banner;
|
||||
return;
|
||||
}
|
||||
_extractBannerTitle(banner, GetLanguage(m->m_loc.getString(m->m_curLanguage, "gametdb_code", "EN").c_str()));
|
||||
|
||||
|
||||
const u8 *soundBin = banner->GetFile((char *) "sound.bin", &sndSize);
|
||||
SAFE_DELETE(banner);
|
||||
|
||||
delete banner;
|
||||
|
||||
if (soundBin == NULL || (((IMD5Header *)soundBin)->fcc != 'IMD5' && ((IMD5Header *)soundBin)->fcc != 'RIFF'))
|
||||
{
|
||||
gprintf("Failed to load banner sound!\n\n");
|
||||
delete soundBin;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1435,7 +1435,7 @@ void CMenu::CheckGameSoundThread()
|
||||
|
||||
LWP_JoinThread(m_gameSoundThread, NULL);
|
||||
if(gameSoundThreadStack.get())
|
||||
SMART_FREE(gameSoundThreadStack);
|
||||
gameSoundThreadStack.release();
|
||||
m_gameSoundThread = LWP_THREAD_NULL;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,8 @@ int CMenu::main(void)
|
||||
{
|
||||
LWP_JoinThread(coverStatus, NULL);
|
||||
coverStatus = LWP_THREAD_NULL;
|
||||
SMART_FREE(coverstatus_stack);
|
||||
if(coverstatus_stack.get())
|
||||
coverstatus_stack.release();
|
||||
WDVD_GetCoverStatus(&disc_check);
|
||||
}
|
||||
|
||||
@ -753,7 +754,6 @@ int CMenu::main(void)
|
||||
m_btnMgr.show(m_mainBtnHomebrew);
|
||||
else
|
||||
m_btnMgr.show(m_mainBtnUsb);
|
||||
break;
|
||||
}
|
||||
m_btnMgr.show(m_mainLblUser[2]);
|
||||
m_btnMgr.show(m_mainLblUser[3]);
|
||||
@ -780,15 +780,16 @@ int CMenu::main(void)
|
||||
m_btnMgr.hide(m_mainLblUser[4]);
|
||||
m_btnMgr.hide(m_mainLblUser[5]);
|
||||
}
|
||||
//
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if (WPadIR_Valid(chan) || (m_show_pointer[chan] && !WPadIR_Valid(chan)))
|
||||
m_cf.mouse(m_vid, chan, m_cursor[chan].x(), m_cursor[chan].y());
|
||||
else
|
||||
m_cf.mouse(m_vid, chan, -1, -1);
|
||||
m_cf.mouse(m_vid, chan, -1, -1);
|
||||
}
|
||||
}
|
||||
_showWaitMessage();
|
||||
//
|
||||
|
||||
gprintf("Invalidate GX\n");
|
||||
|
||||
GX_InvVtxCache();
|
||||
@ -802,7 +803,9 @@ int CMenu::main(void)
|
||||
gprintf("Wait for dvd\n");
|
||||
LWP_JoinThread(coverStatus, NULL);
|
||||
coverStatus = LWP_THREAD_NULL;
|
||||
SMART_FREE(coverstatus_stack);
|
||||
if(coverstatus_stack.get())
|
||||
coverstatus_stack.release();
|
||||
|
||||
gprintf("Done with main\n");
|
||||
return m_reload ? 1 : 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user