- Fixed a screen issue in menu_about

- Now wiiflow download "US" covers correctly
- A lot of little changes and code clean up (like update GameTDB -> dimok )
This commit is contained in:
fedeanto11 2012-01-23 21:09:03 +00:00
parent c93a673b6a
commit 7d07abdb16
11 changed files with 98 additions and 91 deletions

View File

@ -65,17 +65,16 @@ s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryS
/* Set an appropriate video mode */
__Disc_SetVMode();
// IOS Version Check
*(vu32*)0x80003140 = ((ios << 16)) | 0xFFFF;
*(vu32*)0x80003188 = ((ios << 16)) | 0xFFFF;
DCFlushRange((void *)0x80003140, 32);
DCFlushRange((void *)0x80003188, 32);
// IOS Version Check
*(vu32*)0x80003140 = ((ios << 16)) | 0xFFFF;
*(vu32*)0x80003188 = ((ios << 16)) | 0xFFFF;
DCFlushRange((void *)0x80003140, 4);
DCFlushRange((void *)0x80003188, 4);
// Game ID Online Check
*(vu32 *)0x80000000 = TITLE_LOWER(chantitle);
*(vu32 *)0x80003180 = TITLE_LOWER(chantitle);
DCFlushRange((void *)0x80000000, 32);
DCFlushRange((void *)0x80003180, 32);
// Game ID Online Check
memset((void *)0x80000000, 0, 6);
*(vu32 *)0x80000000 = TITLE_LOWER(chantitle);
DCFlushRange((void *)0x80000000, 6);
/* Shutdown IOS subsystems */
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
@ -135,15 +134,17 @@ u32 LoadChannel(u8 *buffer)
dolchunkcount = 0;
dolheader *dolfile = (dolheader *)buffer;
if(dolfile->bss_start)
{
ICInvalidateRange((void *)dolfile->bss_start, dolfile->bss_size);
memset((void *)dolfile->bss_start, 0, dolfile->bss_size);
DCFlushRange((void *)dolfile->bss_start, dolfile->bss_size);
}
if(dolfile->bss_start)
{
if(!(dolfile->bss_start & 0x80000000))
dolfile->bss_start |= 0x80000000;
int i;
for(i = 0; i < 18; i++)
ICInvalidateRange((void *)dolfile->bss_start, dolfile->bss_size);
memset((void *)dolfile->bss_start, 0, dolfile->bss_size);
DCFlushRange((void *)dolfile->bss_start, dolfile->bss_size);
}
for(int i = 0; i < 18; i++)
{
if (!dolfile->section_size[i]) continue;
if (dolfile->section_pos[i] < sizeof(dolheader)) continue;
@ -159,15 +160,15 @@ u32 LoadChannel(u8 *buffer)
dolchunkcount++;
}
SAFE_FREE(dolfile);
return dolfile->entry_point;
}
void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes)
{
int i;
bool hookpatched = false;
for (i=0;i < dolchunkcount;i++)
for (int i=0;i < dolchunkcount;i++)
{
patchVideoModes(dolchunkoffset[i], dolchunksize[i], vidMode, vmode, patchVidModes);
if (vipatch) vidolpatcher(dolchunkoffset[i], dolchunksize[i]);

View File

@ -22,7 +22,8 @@
"Lustar, CedWii, Benjay, Domi78, Oops, Celtiore, Jiiwah, FluffyKiwi, Roku93, \
Spayrosam, Bluescreen81, Chappy23, BlindDude, Bubba, DJTaz, OggZee, Usptactical, \
WiiPower, Hermes, Spidy1000, Dimok, Kovani, Drexyl, DvZ, Etheboss, FIX94, GaiaKnight, \
nibb, NJ7, Plasma, Pakatus, ravmn, spidercaleb, Ziggy34, And to anyone who has donated or contributed to Wiiflow that we missed!"
nibb, NJ7, Plasma, Pakatus, ravmn, spidercaleb, Ziggy34, And to anyone who has donated or contributed to Wiiflow \
that we missed!"
#define THANKS_SITES "devkitpro.org, wiibrew.org, gametdb.com, ohloh.net, wiifanart.com, wiiflowiki.com, tgames.fr.nf"
#define THANKS_CODE "CFG Loader, uLoader, USB Loader GX, NeoGamma, WiiXplorer, Triiforce, Mighty Channels"

View File

@ -176,9 +176,9 @@ class PartitionHandle
//! UnMount all Partition
void UnMountAll() { for(u32 i = 0; i < PartitionList.size(); ++i) UnMount(i); };
//! Get the Mountname
const char * MountName(int pos) { if(pos < 0 || pos >= (int) MountNameList.size() || !MountNameList[pos].size()) return NULL; else return MountNameList[pos].c_str(); };
const char * MountName(int pos) { if(pos < 0 || pos >= (int) MountNameList.size() || !MountNameList[pos].size()) return ""; else return MountNameList[pos].c_str(); };
//! Get the Name of the FileSystem e.g. "FAT32"
const char * GetFSName(int pos) { if(valid(pos)) return PartitionList[pos].FSName; else return NULL; };
const char * GetFSName(int pos) { if(valid(pos)) return PartitionList[pos].FSName; else return ""; };
//! Get the LBA where the partition is located
u32 GetLBAStart(int pos) { if(valid(pos)) return PartitionList[pos].LBA_Start; else return 0; };
//! Get the partition size in sectors of this partition

View File

@ -388,9 +388,10 @@ static void free_block(wbfs_t *p,int bl)
p->freeblks[i] = wbfs_htonl(v | 1 << j);
}
int install_abort_signal = 0;
u32 wbfs_add_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data,progress_callback_t spinner,void *spinner_data,partition_selector_t sel,int copy_1_1)
{
int i,discn;
int i,discn,ret;
u32 tot,cur;
u32 wii_sec_per_wbfs_sect = 1 << (p->wbfs_sec_sz_s - p->wii_sec_sz_s);
wiidisc_t *d = 0;
@ -450,6 +451,8 @@ u32 wbfs_add_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *ca
tot = num_wbfs_sect_to_copy * wii_sec_per_wbfs_sect;
}
install_abort_signal = 0;
/*
// num of hd sectors to copy could be specified directly
if (copy_1_1 > 1) {
@ -457,7 +460,6 @@ u32 wbfs_add_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *ca
num_wbfs_sect_to_copy = copy_1_1 / hd_sec_per_wii_sec / wii_sec_per_wbfs_sect;
tot = num_wbfs_sect_to_copy * wii_sec_per_wbfs_sect;
}*/
int ret = 0;
if(spinner) spinner(0, tot, spinner_data);
for(i=0; i < num_wbfs_sect_to_copy; i++)
{
@ -495,10 +497,22 @@ u32 wbfs_add_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *ca
if(spinner) spinner(cur,tot,spinner_data);
}
}
if (ret) break;
if (install_abort_signal) break;
info->wlba_table[i] = wbfs_htons(bl);
wbfs_sync(p);
}
if(install_abort_signal)
{
for(int n = 0; n < i; n++)
{
u32 iwlba = wbfs_ntohs(info->wlba_table[n]);
if (iwlba)
free_block(p,iwlba);
}
wbfs_memset(info,0,p->disc_info_sz);
p->head->disc_table[discn] = 0;
}
// write disc info
int disc_info_sz_lba = p->disc_info_sz>>p->hd_sec_sz_s;
p->write_hdsector(p->callback_data,p->part_lba+1+discn*disc_info_sz_lba,disc_info_sz_lba,info);

View File

@ -44,12 +44,12 @@ u8 fi[24], ri[24];
u32 fkey[120];
u32 rkey[120];
static u32 pack(u8 *b)
static inline u32 pack(u8 *b)
{ /* pack bytes into a 32-bit Word */
return ((u32 ) b[3] << 24) | ((u32 ) b[2] << 16) | ((u32 ) b[1] << 8) | (u32 ) b[0];
}
static void unpack(u32 a, u8 *b)
static inline void unpack(u32 a, u8 *b)
{ /* unpack bytes from a word */
b[0] = (u8 ) a;
b[1] = (u8 ) (a >> 8);
@ -57,7 +57,7 @@ static void unpack(u32 a, u8 *b)
b[3] = (u8 ) (a >> 24);
}
static u8 xtime(u8 a)
static inline u8 xtime(u8 a)
{
u8 b;
if (a & 0x80)
@ -68,14 +68,14 @@ static u8 xtime(u8 a)
return a;
}
static u8 bmul(u8 x, u8 y)
static inline u8 bmul(u8 x, u8 y)
{ /* x.y= AntiLog(Log(x) + Log(y)) */
if (x && y)
return ptab[(ltab[x] + ltab[y]) % 255];
else return 0;
}
static u32 SubByte(u32 a)
static inline u32 SubByte(u32 a)
{
u8 b[4];
unpack(a, b);
@ -86,7 +86,7 @@ static u32 SubByte(u32 a)
return pack(b);
}
static u8 product(u32 x, u32 y)
static inline u8 product(u32 x, u32 y)
{ /* dot product of two 4-byte arrays */
u8 xb[4], yb[4];
unpack(x, xb);
@ -94,7 +94,7 @@ static u8 product(u32 x, u32 y)
return bmul(xb[0], yb[0]) ^ bmul(xb[1], yb[1]) ^ bmul(xb[2], yb[2]) ^ bmul(xb[3], yb[3]);
}
static u32 InvMixCol(u32 x)
static inline u32 InvMixCol(u32 x)
{ /* matrix Multiplication */
u32 y, m;
u8 b[4];
@ -111,7 +111,7 @@ static u32 InvMixCol(u32 x)
return y;
}
u8 ByteSub(u8 x)
static inline u8 ByteSub(u8 x)
{
u8 y = ptab[255 - ltab[x]]; /* multiplicative inverse */
x = y;
@ -127,7 +127,7 @@ u8 ByteSub(u8 x)
return y;
}
void gentables(void)
static inline void gentables(void)
{ /* generate tables */
int i;
u8 y, b[4];
@ -181,7 +181,7 @@ void gentables(void)
}
}
void gkey(int nb, int nk, char *key)
static inline void gkey(int nb, int nk, char *key)
{ /* blocksize=32*nb bits. Key=32*nk bits */
/* currently nb,bk = 4, 6 or 8 */
/* key comes as 4*Nk bytes */
@ -266,7 +266,7 @@ void gkey(int nb, int nk, char *key)
* Instead of just one ftable[], I could have 4, the other *
* 3 pre-rotated to save the ROTL8, ROTL16 and ROTL24 overhead */
void encrypt(char *buff)
static inline void encrypt(char *buff)
{
int i, j, k, m;
u32 a[8], b[8], *x, *y, *t;
@ -312,7 +312,7 @@ void encrypt(char *buff)
return;
}
void decrypt(char *buff)
static inline void decrypt(char *buff)
{
int i, j, k, m;
u32 a[8], b[8], *x, *y, *t;

View File

@ -27,13 +27,8 @@ static void _decrypt_title_key(u8 *tik, u8 *title_key)
wbfs_memset(iv, 0, sizeof iv);
wbfs_memcpy(iv, tik + 0x01dc, 8);
aes_set_key(common_key);
//_aes_cbc_dec(common_key, iv, tik + 0x01bf, 16, title_key);
aes_decrypt(iv, tik + 0x01bf, title_key, 16);
}
static u32 _be32(const u8 *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
static void disc_read(wiidisc_t *d, u32 offset, u8 *data, u32 len)
{
@ -107,8 +102,8 @@ static u32 do_fst(wiidisc_t *d, u8 *fst, const char *names, u32 i)
const char *name;
u32 j;
name = names + (_be32(fst + 12 * i) & 0x00ffffff);
size = _be32(fst + 12 * i + 8);
name = names + (wbfs_be32(fst + 12 * i) & 0x00ffffff);
size = wbfs_be32(fst + 12 * i + 8);
if (i == 0)
{
@ -127,7 +122,7 @@ static u32 do_fst(wiidisc_t *d, u8 *fst, const char *names, u32 i)
}
else
{
offset = _be32(fst + 12 * i + 4);
offset = wbfs_be32(fst + 12 * i + 4);
if (d->extract_pathname && strcasecmp(name, d->extract_pathname) == 0)
{
d->extracted_buffer = wbfs_ioalloc(size);
@ -155,13 +150,13 @@ static void do_files(wiidisc_t*d)
u32 n_files;
partition_read(d, 0, b, 0x480, 0);
dol_offset = _be32(b + 0x0420);
fst_offset = _be32(b + 0x0424);
fst_size = _be32(b + 0x0428) << 2;
dol_offset = wbfs_be32(b + 0x0420);
fst_offset = wbfs_be32(b + 0x0424);
fst_size = wbfs_be32(b + 0x0428) << 2;
apl_offset = 0x2440 >> 2;
partition_read(d, apl_offset, apl_header, 0x20, 0);
apl_size = 0x20 + _be32(apl_header + 0x14) + _be32(apl_header + 0x18);
apl_size = 0x20 + wbfs_be32(apl_header + 0x14) + wbfs_be32(apl_header + 0x18);
// fake read dol and partition
if (apl_size) partition_read(d, apl_offset, 0, apl_size, 1);
partition_read(d, dol_offset, 0, (fst_offset - dol_offset) << 2, 1);
@ -171,7 +166,7 @@ static void do_files(wiidisc_t*d)
fst = wbfs_ioalloc(fst_size);
if (fst == 0) wbfs_fatal("malloc fst");
partition_read(d, fst_offset, fst, fst_size,0);
n_files = _be32(fst + 8);
n_files = wbfs_be32(fst + 8);
if (d->extract_pathname && strcmp(d->extract_pathname, "FST") == 0)
@ -209,12 +204,12 @@ static void do_partition(wiidisc_t*d)
partition_raw_read(d, 0, tik, 0x2a4);
partition_raw_read(d, 0x2a4 >> 2, b, 0x1c);
tmd_size = _be32(b);
tmd_offset = _be32(b + 4);
cert_size = _be32(b + 8);
cert_offset = _be32(b + 0x0c);
h3_offset = _be32(b + 0x10);
d->partition_data_offset = _be32(b + 0x14);
tmd_size = wbfs_be32(b);
tmd_offset = wbfs_be32(b + 4);
cert_size = wbfs_be32(b + 8);
cert_offset = wbfs_be32(b + 0x0c);
h3_offset = wbfs_be32(b + 0x10);
d->partition_data_offset = wbfs_be32(b + 0x14);
d->partition_block = (d->partition_raw_offset + d->partition_data_offset) >> 13;
tmd = wbfs_ioalloc(tmd_size);
if (tmd == 0) wbfs_fatal("malloc tmd");
@ -266,7 +261,7 @@ static void do_disc(wiidisc_t *d)
u32 magic;
u32 i;
disc_read(d, 0, b, 0x100);
magic = _be32(b + 24);
magic = wbfs_be32(b + 24);
if (magic != 0x5D1C9EA3)
{
wbfs_iofree(b);
@ -274,12 +269,12 @@ static void do_disc(wiidisc_t *d)
return ;
}
disc_read(d, 0x40000 >> 2, b, 0x100);
n_partitions = _be32(b);
disc_read(d, _be32(b + 4), b, 0x100);
n_partitions = wbfs_be32(b);
disc_read(d, wbfs_be32(b + 4), b, 0x100);
for (i = 0; i < n_partitions; i++)
{
partition_offset[i] = _be32(b + 8 * i);
partition_type[i] = _be32(b + 8 * i + 4);
partition_offset[i] = wbfs_be32(b + 8 * i);
partition_type[i] = wbfs_be32(b + 8 * i + 4);
}
for (i = 0; i < n_partitions; i++)
{
@ -347,16 +342,16 @@ void wd_fix_partition_table(wiidisc_t *d, partition_selector_t selector, u8 *par
u32 n_partitions, i, j;
u32 *b32;
if (selector == ALL_PARTITIONS) return;
n_partitions = _be32(b);
if (_be32(b + 4) - (0x40000 >> 2) > 0x50)
n_partitions = wbfs_be32(b);
if (wbfs_be32(b + 4) - (0x40000 >> 2) > 0x50)
wbfs_fatal("cannot modify this partition table. Please report the bug.");
b += (_be32(b + 4) - (0x40000 >> 2)) * 4;
b += (wbfs_be32(b + 4) - (0x40000 >> 2)) * 4;
j = 0;
for (i = 0; i < n_partitions; i++)
{
partition_offset = _be32(b + 8 * i);
partition_type = _be32(b + 8 * i + 4);
partition_offset = wbfs_be32(b + 8 * i);
partition_type = wbfs_be32(b + 8 * i + 4);
if (!test_parition_skip(partition_type, selector))
{
b32 = (u32*)(b + 8 * j);

View File

@ -779,7 +779,6 @@ int GameTDB::GetRatingDescriptors(const char * id, safe_vector<string> & desc_li
{
if(strncmp(descriptor_text, "</descriptor>", strlen("</descriptor>")) == 0)
{
desc_list[list_num].push_back('\0');
descriptor_text = strstr(descriptor_text, "<descriptor>");
if(!descriptor_text)
break;
@ -820,6 +819,8 @@ int GameTDB::GetWifiPlayers(const char * id)
players = atoi(PlayersNode);
delete [] data;
return players;
}
@ -846,7 +847,6 @@ int GameTDB::GetWifiFeatures(const char * id, safe_vector<string> & feat_list)
{
if(strncmp(feature_text, "</feature>", strlen("</feature>")) == 0)
{
feat_list[list_num].push_back('\0');
feature_text = strstr(feature_text, "<feature>");
if(!feature_text)
break;
@ -892,6 +892,8 @@ int GameTDB::GetPlayers(const char * id)
players = atoi(PlayersNode);
delete [] data;
return players;
}
@ -922,20 +924,14 @@ int GameTDB::GetAccessories(const char * id, safe_vector<Accessory> & acc_list)
for(const char * ptr = ControlsNode; *ptr != '"' && *ptr != '\0'; ptr++)
acc_list[list_num].Name.push_back(*ptr);
acc_list[list_num].Name.push_back('\0');
acc_list[list_num].Required = false;
char * requiredField = strstr(ControlsNode, "required=\"");
if(!requiredField)
{
delete [] data;
return -1;
}
requiredField += strlen("required=\"");
if(requiredField && strncmp(requiredField + strlen("required=\""), "true", 4) == 0)
acc_list[list_num].Required = true;
acc_list[list_num].Required = strncmp(requiredField, "true", 4) == 0;
ControlsNode = strstr(requiredField, "<control type=\"");
ControlsNode = strstr(ControlsNode, "<control type=\"");
if(ControlsNode)
ControlsNode += strlen("<control type=\"");

View File

@ -21,7 +21,7 @@ const Vector3D g_boxSize(
#define h(y) ((float)y / 256.0f)
const SMeshVert g_boxMeshQ[] = { // Quads
const SMeshVert g_boxMeshQ ATTRIBUTE_ALIGN(32)[] = { // Quads
// Bordure du bas devant
{ { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(w(0), h(256)) },
{ { g_frontCoverBL.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(256)) },
@ -101,7 +101,7 @@ const SMeshVert g_boxMeshQ[] = { // Quads
{ { g_backCoverBL.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(0), h(0)) }
};
const SMeshVert g_boxMeshT[] = { // Triangles
const SMeshVert g_boxMeshT ATTRIBUTE_ALIGN(32)[] = { // Triangles
// Haut devant
{ { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(w(0), h(16)) },
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverTR.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(0)) },
@ -126,7 +126,7 @@ const SMeshVert g_boxMeshT[] = { // Triangles
#undef h
#undef w
const SMeshVert g_flatCoverMesh[] = {
const SMeshVert g_flatCoverMesh ATTRIBUTE_ALIGN(32)[] = {
{ { g_coverBL.x, g_coverBL.y, g_coverBL.z }, CTexCoord(0.f, 1.f) },
{ { g_coverTR.x, g_coverBL.y, g_coverBL.z }, CTexCoord(1.f, 1.f) },
{ { g_coverTR.x, g_coverTR.y, g_coverBL.z }, CTexCoord(1.f, 0.f) },
@ -140,7 +140,7 @@ const CTexCoord g_flatCoverBoxTex[sizeof g_flatCoverMesh / sizeof g_flatCoverMes
CTexCoord(1.46f / 2.76f, 0.f)
};
const SMeshVert g_boxBackCoverMesh[] = {
const SMeshVert g_boxBackCoverMesh ATTRIBUTE_ALIGN(32)[] = {
{ { g_backCoverTR.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(0.f, 1.f) },
{ { g_backCoverBL.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(1.3f / 2.76f, 1.f) },
{ { g_backCoverBL.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(1.3f / 2.76f, 0.f) },
@ -152,7 +152,7 @@ const SMeshVert g_boxBackCoverMesh[] = {
{ { g_backCoverBL.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(1.3f / 2.76f, 1.f) },
};
const SMeshVert g_boxCoverMesh[] = {
const SMeshVert g_boxCoverMesh ATTRIBUTE_ALIGN(32)[] = {
{ { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(1.46f / 2.76f, 1.f) },
{ { g_frontCoverTR.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(1.f, 1.f) },
{ { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(1.f, 0.f) },

View File

@ -67,7 +67,7 @@ int LoadHomebrew(const char * filepath)
}
bool good_read = fread((u8 *)buffer.get(), 1, filesize, file) == filesize;
fclose(file);
SAFE_CLOSE(file);
if (!good_read) return -4;
DCFlushRange((u8 *)buffer.get(), filesize);

View File

@ -73,8 +73,8 @@ void __Disc_SetLowMem()
// Fix for Sam & Max (WiiPower)
*(vu32 *)0x80003184 = 0x80000000;
/* Flush cache */
DCFlushRange((void *)0x80000000, 0x3F00);
/* Copy disc ID */
memcpy((void *) Online_Check, (void *) Disc_ID, 4);
}
GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)

View File

@ -390,7 +390,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
if (download.data == NULL && newID[3] != 'E')
if (download.data == NULL && newID[3] == 'E')
{
url = makeURL(fmtURLBox[j], newID, "US");
LWP_MutexLock(m_mutex);