* Added alternative cover download if original is not on server ( a option for choose original/alternative will be better though )

* Added some missing frees
* Other littles changes
This commit is contained in:
fedeanto11 2012-02-03 22:38:00 +00:00
parent 28d10bbcdc
commit 5cfe1c11b5
7 changed files with 28 additions and 37 deletions

View File

@ -50,7 +50,8 @@ s32 BootChannel(u8 *data, u64 chantitle, u8 vidMode, bool vipatch, bool countryS
/* Set time */
__Disc_SetTime();
/* Set low memery */
__Disc_SetLowMem();
if (hooktype != 0)
@ -147,7 +148,7 @@ u32 LoadChannel(u8 *buffer)
DCFlushRange((void *)dolfile->bss_start, dolfile->bss_size);
}
int i;
int i;
for(i = 0; i < 18; i++)
{
if (!dolfile->section_size[i]) continue;
@ -171,7 +172,7 @@ void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
{
bool hookpatched = false;
int i;
int i;
for (i=0;i < dolchunkcount;i++)
{
patchVideoModes(dolchunkoffset[i], dolchunksize[i], vidMode, vmode, patchVidModes);
@ -283,7 +284,7 @@ u8 * GetDol(u64 title, char *id, u32 bootcontent)
gprintf("Loading DOL: %s...", filepath);
u32 contentSize = 0;
u8 *data = ISFS_GetFile((u8 *) &filepath, &contentSize, -1);
if (data != NULL)
if (data != NULL && contentSize != 0)
{
gprintf("Done!\n");

View File

@ -150,13 +150,10 @@ u64* Channels::GetChannelList(u32* count)
bool Channels::GetAppNameFromTmd(u64 title, char* app, bool dol, u32* bootcontent)
{
u32 high = TITLE_UPPER(title);
u32 low = TITLE_LOWER(title);
bool ret = false;
char tmd[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
sprintf(tmd, "/title/%08x/%08x/content/title.tmd", high, low);
sprintf(tmd, "/title/%08x/%08x/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title));
u32 size;
u8 *data = ISFS_GetFile((u8 *) &tmd, &size, -1);
@ -168,7 +165,7 @@ bool Channels::GetAppNameFromTmd(u64 title, char* app, bool dol, u32* bootconten
if(tmd_file->contents[i].index == (dol ? tmd_file->boot_index : 0))
{
*bootcontent = tmd_file->contents[i].cid;
sprintf(app, "/title/%08x/%08x/content/%08x.app", high, low, *bootcontent);
sprintf(app, "/title/%08x/%08x/content/%08x.app", TITLE_UPPER(title), TITLE_LOWER(title), *bootcontent);
ret = true;
break;
}

View File

@ -36,10 +36,7 @@ FreeTypeGX::FreeTypeGX(uint8_t textureFormat, uint8_t positionFormat) {
this->textureFormat = textureFormat;
this->positionFormat = positionFormat;
xScale = 1.f;
yScale = 1.f;
xPos = 0.f;
yPos = 0.f;
reset();
this->ftFace = 0;
}
@ -591,16 +588,10 @@ ftgxDataOffset FreeTypeGX::getOffset(wchar_t const *text) {
*/
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 y = (float)screenY + yPos;
// Mtx model;
// guMtxIdentity(model);
// guMtxTransApply(model, model, screenX, screenY, 0.0f);
// GX_LoadPosMtxImm(model, GX_PNMTX0);
GX_LoadTexObj(texObj, GX_TEXMAP0);
// GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
@ -665,10 +656,8 @@ void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionForm
* @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) {
f32 f32FeatureWidth = featureWidth,
f32FeatureHeight = featureHeight;
f32 f32FeatureWidth = featureWidth, f32FeatureHeight = featureHeight;
return;
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
switch(positionFormat) {
case GX_POS_XY:

View File

@ -1,6 +1,5 @@
#include <gccore.h>
#include <ogcsys.h>
//#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <ogc/machine/processor.h>
@ -27,12 +26,10 @@ bool bootHB;
bool IsDollZ (u8 *buff)
{
int ret;
u8 dollz_stamp[] = {0x3C};
int dollz_offs = 0x100;
ret = memcmp (&buff[dollz_offs], dollz_stamp, sizeof(dollz_stamp));
int ret = memcmp (&buff[dollz_offs], dollz_stamp, sizeof(dollz_stamp));
if (ret == 0) return true;
return false;
@ -75,13 +72,17 @@ int LoadHomebrew(const char * filepath)
SmartBuf buffer = smartAnyAlloc(filesize);
if (!buffer)
{
fclose(file);
SAFE_CLOSE(file);
return -3;
}
bool good_read = fread((u8 *)buffer.get(), 1, filesize, file) == filesize;
if (!good_read)
{
SAFE_CLOSE(file);
return -4;
}
SAFE_CLOSE(file);
if (!good_read) return -4;
DCFlushRange((u8 *)buffer.get(), filesize);

View File

@ -76,7 +76,7 @@ iosinfo_t *cIOSInfo::GetInfo(u8 ios)
u32 size = 0;
u8 *buffer = ISFS_GetFile((u8 *) filepath, &size, sizeof(iosinfo_t));
if(!buffer) return NULL;
if(buffer == NULL || size == 0) return NULL;
iosinfo_t *iosinfo = (iosinfo_t *) buffer;
@ -97,5 +97,7 @@ iosinfo_t *cIOSInfo::GetInfo(u8 ios)
SAFE_FREE(buffer);
return NULL;
}
SAFE_FREE(buffer);
return iosinfo;
}

View File

@ -359,15 +359,14 @@ s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString,
/* Run apploader */
ret = Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio);
free_wip();
if (ret < 0) return ret;
free_wip();
if (hooktype != 0)
ocarina_do_code();
gprintf("\n\nEntry Point is: %0x8\n", p_entry);
// gprintf("Lowmem:\n\n");
// ghexdump((void*)0x80000000, 0x3f00);
/* Set time */
__Disc_SetTime();

View File

@ -31,8 +31,10 @@
using namespace std;
static const char FMT_BPIC_URL[] = "http://art.gametdb.com/wii/coverfullHQ/{loc}/{gameid}.png"\
"|http://art.gametdb.com/wii/coverfullHQ2/{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"\
"|http://art.gametdb.com/wii/cover2/{loc}/{gameid}.png";
static block download = { 0, 0 };
static string countryCode(const string &gameId)
@ -570,7 +572,7 @@ void CMenu::_download(string gameId)
m_thrdMessage = _t("dlmsg6", L"Canceling...");
m_thrdWorking = false;
}
//
if (m_thrdMessageAdded)
{
LockMutex lock(m_mutex);
@ -618,7 +620,7 @@ void CMenu::_initDownloadMenu(CMenu::SThemeData &theme)
m_downloadLblGameTDB = _addLabel(theme, "DOWNLOAD/GAMETDB", theme.btnFont, L"", 40, 400, 370, 60, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadLblMessage[0] = _addLabel(theme, "DOWNLOAD/MESSAGE1", theme.lblFont, L"", 40, 228, 560, 100, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_downloadLblMessage[1] = _addLabel(theme, "DOWNLOAD/MESSAGE2", theme.lblFont, L"", 40, 228, 560, 100, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
//
_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_downloadLblCovers, "DOWNLOAD/COVERS", 0, 0, -2.f, 0.f);