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