*added new feature to force aspec ratio on games/channels (global and per game setting) (thx giantpune for help with disassemble)

*added refresh of partition size when activating wii games mode from none wii games mode
*fixed playback of some BNS banner sounds
*moved every allocation used during or after apploader to mem2 (fixes some memory overwrites problems by the apploader)
*improved detection of game partition when starting the loader without configs (fresh start)
*fixed remove of unused cached titles on wiitdb load
This commit is contained in:
strtoul 2011-12-23 15:48:20 +00:00
parent 76df2b26b6
commit 54fc7320f9
42 changed files with 380 additions and 79 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>2.3 r1135</version>
<release_date>201112222230</release_date>
<version>2.3 r1136</version>
<release_date>201112231542</release_date>
<!-- // remove this line to enable arguments
<arguments>
<arg>--ios=250</arg>

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: David Jelinek (djelinek@hotmail.com) e->e,r->r,u->u, c->c \n"
"Language-Team: r1056 - last version on http://djelinek.sweb.cz/_USBLoderGX/czech.lang \n"
@ -178,6 +178,9 @@ msgstr "Opravdu si prejete provest reset?"
msgid "Are you sure?"
msgstr "Jste si jisti?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Srp"
@ -751,6 +754,12 @@ msgstr ""
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Vynutit NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: Fox888[dk]\n"
"Language-Team: [dk]\n"
@ -178,6 +178,9 @@ msgstr "Er du sikker på at du vil nulstille?"
msgid "Are you sure?"
msgstr "Er du sikker?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr ""
@ -751,6 +754,12 @@ msgstr ""
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Tving NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2011-06-30 14:22+0100\n"
"Last-Translator: glowy\n"
"Language-Team: tj_cool, glowy\n"
@ -178,6 +178,9 @@ msgstr "Wet je zeker dat je wilt resetten?"
msgid "Are you sure?"
msgstr "Zeker weten?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr ""
@ -751,6 +754,12 @@ msgstr "X omwisselen"
msgid "Font Scale Factor"
msgstr "Lettertype Schaal Factor"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Forceer NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr ""
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr ""
@ -751,6 +754,12 @@ msgstr ""
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: c64rmx\n"
"Language-Team: \n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "Oletko varma?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "elo"
@ -751,6 +754,12 @@ msgstr "Käännä-X"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: Cyan\n"
"Language-Team: Badablek, Amour, ikya, Cyan & Kin8\n"
@ -178,6 +178,9 @@ msgstr "Voulez-vous vraiment réinitialiser ?"
msgid "Are you sure?"
msgstr "Êtes-vous sûr ?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Août"
@ -751,6 +754,12 @@ msgstr "Inversion-X"
msgid "Font Scale Factor"
msgstr "Échelle police"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Forcer NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2010-07-03 17:35-0800\n"
"Last-Translator: TheRealVisitor\n"
"Language-Team: Bertilax, Snoozer, wishmasterf, ZEN.13, TheRealVisitor\n"
@ -178,6 +178,9 @@ msgstr "Bist du sicher, dass du resetten willst?"
msgid "Are you sure?"
msgstr "Bist du sicher?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "August"
@ -751,6 +754,12 @@ msgstr "Flip-X"
msgid "Font Scale Factor"
msgstr "Schriftskalierwert"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "NTSC erzw."

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-12-29 11:05+0100\n"
"Last-Translator: Springdale\n"
"Language-Team: Tusk, Springdale\n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "Biztos vagy benne?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr ""
@ -751,6 +754,12 @@ msgstr ""
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2011-09-11 12:19+0100\n"
"Last-Translator: xFede\n"
"Language-Team: Cambo\n"
@ -178,6 +178,9 @@ msgstr "Sei sicuro di voler ripristinare tutto?"
msgid "Are you sure?"
msgstr "Sei sicuro?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Agosto"
@ -751,6 +754,12 @@ msgstr "Scorrimento Dischi"
msgid "Font Scale Factor"
msgstr "Fattore Scala Font"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Forza NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: hosigumayuugi\n"
"Language-Team: hosigumayuugi\n"
@ -178,6 +178,9 @@ msgstr "リセットしますか?"
msgid "Are you sure?"
msgstr "よろしいですか?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "8月"
@ -751,6 +754,12 @@ msgstr "ゲームリストの回転"
msgid "Font Scale Factor"
msgstr "文字サイズの補正率"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "NTSCに強制"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: nextos@korea.com\n"
"Language-Team: \n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "확실합니까?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "8월"
@ -751,6 +754,12 @@ msgstr "좌/우 설정"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: raschi\n"
"Language-Team: raschi\n"
@ -178,6 +178,9 @@ msgstr "Er du sikker på at du vil restarte?"
msgid "Are you sure?"
msgstr "Er du sikker?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr ""
@ -751,6 +754,12 @@ msgstr ""
msgid "Font Scale Factor"
msgstr "Tekst størrelsesfaktor"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Tving NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: ziom666 (zadania_prog@vp.pl)\n"
"Language-Team: \n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "Na pewno?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Sierpien"
@ -751,6 +754,12 @@ msgstr "Obrot na osi X"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-23 18:52+0200\n"
"Last-Translator: aniemotion\n"
"Language-Team: boto12, aniemotion\n"
@ -178,6 +178,9 @@ msgstr "Tem certeza que quer reiniciar?"
msgid "Are you sure?"
msgstr "Tem certeza?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Ago"
@ -751,6 +754,12 @@ msgstr "Paginação Horizontal"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2011-11-03 11:00+0000\n"
"Last-Translator: pplucky <pplucky@gmail.com>\n"
"Language-Team: Sky8000, pplucky\n"
@ -178,6 +178,9 @@ msgstr "Tem a certeza que quer reinicializar?"
msgid "Are you sure?"
msgstr "Tem a certeza?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Ago"
@ -751,6 +754,12 @@ msgstr "Paginação Horizontal"
msgid "Font Scale Factor"
msgstr "Factor Escala Fonte"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Forçar NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: nikolai_ca\n"
"Language-Team: Kir, alendit, nikolai_ca\n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "Вы уверены ?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Авг"
@ -751,6 +754,12 @@ msgstr "Flip-X"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: knife.hu kavid emul8ion\n"
"Language-Team: kavid\n"
@ -178,6 +178,9 @@ msgstr "确定重置吗?"
msgid "Are you sure?"
msgstr "确定?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "八月"
@ -751,6 +754,12 @@ msgstr "按键规则"
msgid "Font Scale Factor"
msgstr "字体比例因数"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "强制 NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2011-07-25 16:40+0200\n"
"Last-Translator: Galen/xFede\n"
"Language-Team: Penn, SirPalax, hvy109\n"
@ -178,6 +178,9 @@ msgstr "¿Estás seguro de resetear?"
msgid "Are you sure?"
msgstr "¿Estás seguro?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Ago"
@ -751,6 +754,12 @@ msgstr "Desplazamiento X"
msgid "Font Scale Factor"
msgstr "Escalado de la Fuente"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "Forzar NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2010-01-19 17:39+0200\n"
"Last-Translator: Katsurou\n"
"Language-Team: Katsurou, pirateX\n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "Är du säker?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr ""
@ -751,6 +754,12 @@ msgstr "Vänd-X"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2010-02-15 21:00+0800\n"
"Last-Translator: Jane.H\n"
"Language-Team: kyogc, Miller, Mika Li, Jane.H\n"
@ -178,6 +178,9 @@ msgstr "確定要重新啟動嗎?"
msgid "Are you sure?"
msgstr "確定?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "八月"
@ -751,6 +754,12 @@ msgstr "按鍵規則"
msgid "Font Scale Factor"
msgstr "字型比例倍數"
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr "強制 NTSC"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: Nitro_subzero \n"
"Language-Team: Nitro_subzero\n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "แน่ใจหรือไม่ ?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "สค."
@ -751,6 +754,12 @@ msgstr "กลับ-X"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-22 23:25+0100\n"
"POT-Creation-Date: 2011-12-23 14:21+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: omercigingelini\n"
"Language-Team: omercigingelini\n"
@ -178,6 +178,9 @@ msgstr ""
msgid "Are you sure?"
msgstr "Emin misiniz?"
msgid "Aspect Ratio"
msgstr ""
msgid "Aug"
msgstr "Ağu"
@ -751,6 +754,12 @@ msgstr "Çevir-X"
msgid "Font Scale Factor"
msgstr ""
msgid "Force 16:9"
msgstr ""
msgid "Force 4:3"
msgstr ""
msgid "Force NTSC"
msgstr ""

BIN
data/images/loader_mode.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -213,7 +213,15 @@ u8 * Channels::GetDol(const u64 &title, u8 *tmdBuffer)
filesize = size;
}
// move dol to mem2
u8 *outBuf = (u8 *) MEM2_alloc(filesize);
if(!outBuf)
return buffer;
memcpy(outBuf, buffer, filesize);
free(buffer);
return outBuf;
}
u8 Channels::GetRequestedIOS(const u64 &title)

View File

@ -80,7 +80,7 @@ void BNSDecoder::OpenFile()
while(done < file_fd->size())
{
int read = file_fd->read(tempbuff, file_fd->size());
int read = file_fd->read(tempbuff+done, file_fd->size()-done);
if(read > 0)
done += read;
else
@ -324,7 +324,7 @@ SoundBlock DecodefromBNS(const u8 *buffer, u32 size)
// Check sizes
if (size < hdr.size || size < hdr.infoOffset + hdr.infoSize || size < hdr.dataOffset + hdr.dataSize
|| hdr.infoSize < 0x60 || hdr.dataSize < sizeof dataChunk
|| infoChunk.size != hdr.infoSize || dataChunk.size != hdr.dataSize)
|| infoChunk.size != hdr.infoSize || dataChunk.size > hdr.dataSize)
return OutBlock;
// Check format
if (infoChunk.codecNum != 0) // Only codec i've found : 0 = ADPCM. Maybe there's also 1 and 2 for PCM 8 or 16 bits ?

View File

@ -1127,6 +1127,12 @@ int GameBrowseMenu::MainLoop()
{
WBFS_ReInit(WBFS_DEVICE_USB);
gameList.ReadGameList();
if(Settings.ShowFreeSpace)
{
ThreadedTask::Instance()->AddCallback(&HDDSizeCallback);
ThreadedTask::Instance()->Execute();
}
}
wString oldFilter(gameList.GetCurrentFilter());

View File

@ -9,6 +9,7 @@
#include "patchcode.h"
#include "gamepatches.h"
#include "memory/memory.h"
#include "memory/mem2.h"
#include "settings/SettingsEnums.h"
typedef struct _appDOL
@ -23,12 +24,12 @@ static int dolCount = 0;
void RegisterDOL(u8 *dst, int len)
{
if(!dolList)
dolList = (appDOL *) malloc(sizeof(appDOL));
dolList = (appDOL *) MEM2_alloc(sizeof(appDOL));
appDOL *tmp = (appDOL *) realloc(dolList, (dolCount+1)*sizeof(appDOL));
appDOL *tmp = (appDOL *) MEM2_realloc(dolList, (dolCount+1)*sizeof(appDOL));
if(!tmp)
{
free(dolList);
MEM2_free(dolList);
dolCount = 0;
return;
}
@ -42,14 +43,13 @@ void RegisterDOL(u8 *dst, int len)
void ClearDOLList()
{
if(dolList)
free(dolList);
MEM2_free(dolList);
dolList = NULL;
dolCount = 0;
}
void gamepatches(u8 videoSelected, u8 languageChoice, u8 patchcountrystring,
u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u8 fix002,
u64 returnTo)
void gamepatches(u8 videoSelected, u8 aspectForce, u8 languageChoice, u8 patchcountrystring,
u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u8 fix002, u64 returnTo)
{
int i;
@ -87,6 +87,9 @@ void gamepatches(u8 videoSelected, u8 languageChoice, u8 patchcountrystring,
if(returnTo)
PatchReturnTo(dst, len, (u32) returnTo);
if(aspectForce < 2)
PatchAspectRatio(dst, len, aspectForce);
DCFlushRange(dst, len);
}
@ -114,7 +117,7 @@ bool NSMBPatch()
if (memcmp("SMNE01", (char *) 0x80000000, 6) == 0)
{
CodeList = malloc(3 * sizeof(WIP_Code));
CodeList = MEM2_alloc(3 * sizeof(WIP_Code));
if(!CodeList)
return false;
@ -131,7 +134,7 @@ bool NSMBPatch()
}
else if (memcmp("SMNP01", (char *) 0x80000000, 6) == 0)
{
CodeList = malloc(3 * sizeof(WIP_Code));
CodeList = MEM2_alloc(3 * sizeof(WIP_Code));
if(!CodeList)
return false;
@ -147,7 +150,7 @@ bool NSMBPatch()
}
else if (memcmp("SMNJ01", (char *) 0x80000000, 6) == 0)
{
CodeList = malloc(3 * sizeof(WIP_Code));
CodeList = MEM2_alloc(3 * sizeof(WIP_Code));
if(!CodeList)
return false;
@ -164,7 +167,7 @@ bool NSMBPatch()
if (CodeList && set_wip_list(CodeList, 3) == false)
{
free(CodeList);
MEM2_free(CodeList);
CodeList = NULL;
return false;
}
@ -178,7 +181,7 @@ bool PoPPatch()
if (memcmp("SPX", (char *) 0x80000000, 3) != 0 && memcmp("RPW", (char *) 0x80000000, 3) != 0)
return false;
WIP_Code * CodeList = malloc(5 * sizeof(WIP_Code));
WIP_Code * CodeList = MEM2_alloc(5 * sizeof(WIP_Code));
CodeList[0].offset = 0x007AAC6A;
CodeList[0].srcaddress = 0x7A6B6F6A;
CodeList[0].dstaddress = 0x6F6A7A6B;
@ -197,7 +200,7 @@ bool PoPPatch()
if (set_wip_list(CodeList, 5) == false)
{
free(CodeList);
MEM2_free(CodeList);
CodeList = NULL;
return false;
}
@ -603,3 +606,35 @@ int BlockIOSReload(int es_fd, u8 gameIOS)
return (result >= 0);
}
void PatchAspectRatio(void *addr, u32 len, u8 aspect)
{
if(aspect > 1)
return;
static const u32 aspect_searchpattern1[5] = {
0x9421FFF0, 0x7C0802A6, 0x38800001, 0x90010014, 0x38610008
};
static const u32 aspect_searchpattern2[15] = {
0x2C030000, 0x40820010, 0x38000000, 0x98010008, 0x48000018,
0x88010008, 0x28000001, 0x4182000C, 0x38000000, 0x98010008,
0x80010014, 0x88610008, 0x7C0803A6, 0x38210010, 0x4E800020
};
u8 *addr_start = (u8 *) addr;
u8 *addr_end = addr_start + len - sizeof(aspect_searchpattern1) - 4 - sizeof(aspect_searchpattern2);
while(addr_start < addr_end)
{
if( (memcmp(addr_start, aspect_searchpattern1, sizeof(aspect_searchpattern1)) == 0)
&& (memcmp(addr_start + 4 + sizeof(aspect_searchpattern1), aspect_searchpattern2, sizeof(aspect_searchpattern2)) == 0))
{
*((u32 *)(addr_start+0x44)) = (0x38600000 | aspect);
gprintf("Aspect ratio patched to: %s\n", aspect ? "16:9" : "4:3");
break;
}
addr_start += 4;
}
}

View File

@ -9,9 +9,8 @@ extern "C" {
void RegisterDOL(u8 *dst, int len);
void ClearDOLList();
void gamepatches(u8 videoSelected, u8 languageChoice, u8 patchcountrystring,
u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u8 fix002,
u64 returnTo);
void gamepatches(u8 videoSelected, u8 aspectForce, u8 languageChoice, u8 patchcountrystring,
u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u8 fix002, u64 returnTo);
bool Anti_002_fix(u8 * Address, int Size);
bool NSMBPatch();
bool PoPPatch();
@ -20,6 +19,7 @@ void sneek_video_patch(void *addr, u32 len);
bool PatchReturnTo(void *Address, int Size, u32 id);
int PatchNewReturnTo(int es_fd, u64 title);
int BlockIOSReload(int es_fd, u8 gameIOS);
void PatchAspectRatio(void *addr, u32 len, u8 aspect);
#ifdef __cplusplus
}

View File

@ -33,6 +33,7 @@
#include "patchcode.h"
#include "settings/SettingsEnums.h"
#include "FileOperations/fileops.h"
#include "memory/mem2.h"
#include "memory/memory.h"
#include "gecko.h"
@ -349,7 +350,7 @@ static void app_loadgameconfig()
{
if (gameconf == NULL)
{
gameconf = (u32*) malloc(65536);
gameconf = (u32*) MEM2_alloc(65536);
if (gameconf == NULL)
return;
}
@ -702,7 +703,7 @@ static int LoadGameConfig(const char *CheatFilepath)
filesize = ftell(fp);
fseek(fp, 0, SEEK_SET);
tempgameconf = (u8*) malloc(filesize);
tempgameconf = (u8*) MEM2_alloc(filesize);
if (tempgameconf == NULL) {
tempgameconf = (u8 *) defaultgameconfig;
fclose(fp);
@ -715,7 +716,7 @@ static int LoadGameConfig(const char *CheatFilepath)
if (ret != filesize)
{
free(tempgameconf);
MEM2_free(tempgameconf);
tempgameconf = (u8 *) defaultgameconfig;
return -1;
}
@ -747,7 +748,7 @@ int ocarina_load_code(const char *CheatFilepath, u8 *gameid)
u32 filesize = ftell(fp);
rewind(fp);
code_buf = (u8*) malloc(filesize);
code_buf = (u8*) MEM2_alloc(filesize);
if (!code_buf)
{
gprintf("Ocarina: Not enough memory\n");
@ -762,7 +763,7 @@ int ocarina_load_code(const char *CheatFilepath, u8 *gameid)
if (code_size <= 0)
{
gprintf("Ocarina: could not read file.\n");
free(code_buf);
MEM2_free(code_buf);
code_buf = NULL;
code_size = 0;
return 0;
@ -771,7 +772,7 @@ int ocarina_load_code(const char *CheatFilepath, u8 *gameid)
if (code_size > (s32) codelistend - (s32) codelist)
{
gprintf("Ocarina: Too many codes found\n");
free(code_buf);
MEM2_free(code_buf);
code_buf = NULL;
code_size = 0;
return 0;

View File

@ -5,6 +5,7 @@
#include "gecko.h"
#include "settings/CSettings.h"
#include "memory/mem2.h"
#include "wip.h"
static WIP_Code * CodeList = NULL;
@ -75,7 +76,8 @@ extern "C" void wip_reset_counter()
extern "C" void free_wip()
{
if (CodeList) free(CodeList);
if (CodeList)
MEM2_free(CodeList);
CodeList = NULL;
CodesCount = 0;
Counter = 0;
@ -125,9 +127,9 @@ extern "C" int load_wip_code(u8 *gameid)
u32 srcaddress = (u32) strtoul(line + 9, NULL, 16);
u32 dstaddress = (u32) strtoul(line + 18, NULL, 16);
if (!CodeList) CodeList = (WIP_Code *) malloc(sizeof(WIP_Code));
if (!CodeList) CodeList = (WIP_Code *) MEM2_alloc(sizeof(WIP_Code));
WIP_Code * tmp = (WIP_Code *) realloc(CodeList, (CodesCount + 1) * sizeof(WIP_Code));
WIP_Code * tmp = (WIP_Code *) MEM2_realloc(CodeList, (CodesCount + 1) * sizeof(WIP_Code));
if (!tmp)
{
fclose(fp);

View File

@ -187,6 +187,7 @@ bool CGameSettings::Save()
{
fprintf(f, "game:%s = ", GameList[i].id);
fprintf(f, "video:%d; ", GameList[i].video);
fprintf(f, "aspectratio:%d; ", GameList[i].aspectratio);
fprintf(f, "language:%d; ", GameList[i].language);
fprintf(f, "ocarina:%d; ", GameList[i].ocarina);
fprintf(f, "vipatch:%d; ", GameList[i].vipatch);
@ -224,6 +225,14 @@ bool CGameSettings::SetSetting(GameCFG & game, const char *name, const char *val
}
return true;
}
else if(strcmp(name, "aspectratio") == 0)
{
if (sscanf(value, "%d", &i) == 1)
{
game.aspectratio = i;
}
return true;
}
else if(strcmp(name, "language") == 0)
{
if (sscanf(value, "%d", &i) == 1)
@ -464,6 +473,7 @@ void CGameSettings::SetDefault(GameCFG &game)
{
memset(game.id, 0, sizeof(game.id));
game.video = INHERIT;
game.aspectratio = INHERIT;
game.language = INHERIT;
game.ocarina = INHERIT;
game.vipatch = INHERIT;

View File

@ -11,6 +11,7 @@ typedef struct _GameCFG
{
char id[7];
short video;
short aspectratio;
short language;
short ocarina;
short vipatch;
@ -34,6 +35,7 @@ typedef struct _GameCFG
{
memcpy(this->id, game.id, sizeof(game.id));
this->video = game.video;
this->aspectratio = game.aspectratio;
this->language = game.language;
this->ocarina = game.ocarina;
this->vipatch = game.vipatch;

View File

@ -138,6 +138,7 @@ void CSettings::SetDefault()
RememberUnlock = ON;
LoaderMode = MODE_WIIGAMES;
SearchMode = SEARCH_BEGINNING;
GameAspectRatio = ASPECT_SYSTEM_DEFAULT;
}
bool CSettings::Load()
@ -312,6 +313,7 @@ bool CSettings::Save()
fprintf(file, "ShowPlayCount = %d\n", ShowPlayCount);
fprintf(file, "LoaderMode = %d\n", LoaderMode);
fprintf(file, "SearchMode = %d\n", SearchMode);
fprintf(file, "GameAspectRatio = %d\n", GameAspectRatio);
fclose(file);
return true;
@ -629,6 +631,10 @@ bool CSettings::SetSetting(char *name, char *value)
{
if (sscanf(value, "%d", &i) == 1) SearchMode = i;
}
else if(strcmp(name, "GameAspectRatio") == 0)
{
if (sscanf(value, "%d", &i) == 1) GameAspectRatio = i;
}
else if (strcmp(name, "InstallPartitions") == 0)
{
InstallPartitions = strtoul(value, 0, 16);

View File

@ -137,6 +137,7 @@ class CSettings
short RememberUnlock;
short LoaderMode;
short SearchMode;
short GameAspectRatio;
// This variable is not saved to the settings file
bool FirstTimeRun;

View File

@ -35,7 +35,7 @@ class CGameTitles
//! Get possible number of players for this game
int GetPlayersCount(const char * id) const;
//! Load Game Titles from GameTDB
void LoadTitlesFromGameTDB(const char * path, bool forceCacheReload = false, bool removeUnused = false);
void LoadTitlesFromGameTDB(const char * path, bool forceCacheReload = false, bool removeUnused = true);
//! Set default game titles
void SetDefault();
//! Free memory and remove all titles - Same as SetDefault()

View File

@ -55,6 +55,14 @@ enum
VIDEO_MODE_MAX
};
enum
{
ASPECT_FORCE_4_3,
ASPECT_FORCE_16_9,
ASPECT_SYSTEM_DEFAULT,
ASPECT_MAX
};
enum
{
OFF,

View File

@ -53,6 +53,13 @@ static const char * VideoModeText[] =
trNOOP( "Force NTSC480p" ),
};
static const char * AspectText[] =
{
trNOOP( "Force 4:3" ),
trNOOP( "Force 16:9" ),
trNOOP( "System Default" )
};
static const char * LanguageText[] =
{
trNOOP( "Japanese" ),
@ -166,6 +173,7 @@ void GameLoadSM::SetOptionNames()
Options->SetName(Idx++, "%s", tr( "Video Mode" ));
Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" ));
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" ));
Options->SetName(Idx++, "%s", tr( "Game Language" ));
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
Options->SetName(Idx++, "%s", tr( "Ocarina" ));
@ -211,6 +219,12 @@ void GameLoadSM::SetOptionValues()
else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.sneekVideoPatch]));
//! Settings: Aspect Ratio
if(GameConfig.aspectratio == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr(AspectText[GameConfig.aspectratio]));
//! Settings: Game Language
if(GameConfig.language == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
@ -352,6 +366,12 @@ int GameLoadSM::GetMenuInternal()
if (++GameConfig.sneekVideoPatch >= MAX_ON_OFF) GameConfig.sneekVideoPatch = INHERIT;
}
//! Settings: Aspect Ratio
else if (ret == ++Idx)
{
if (++GameConfig.aspectratio >= ASPECT_MAX) GameConfig.aspectratio = INHERIT;
}
//! Settings: Game Language
else if (ret == ++Idx)
{

View File

@ -51,6 +51,13 @@ static const char * OnOffText[] =
trNOOP( "Auto" )
};
static const char * AspectText[] =
{
trNOOP( "Force 4:3" ),
trNOOP( "Force 16:9" ),
trNOOP( "System Default" )
};
static const char * VideoModeText[] =
{
trNOOP( "System Default" ),
@ -113,6 +120,7 @@ LoaderSettings::LoaderSettings()
Options->SetName(Idx++, "%s", tr( "Video Mode" ));
Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" ));
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" ));
Options->SetName(Idx++, "%s", tr( "Game Language" ));
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
Options->SetName(Idx++, "%s", tr( "Ocarina" ));
@ -166,6 +174,9 @@ void LoaderSettings::SetOptionValues()
//! Settings: Sneek Video Patch
Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.sneekVideoPatch] ));
//! Settings: Aspect Ratio
Options->SetValue(Idx++, "%s", tr( AspectText[Settings.GameAspectRatio] ));
//! Settings: Game Language
Options->SetValue(Idx++, "%s", tr( LanguageText[Settings.language] ));
@ -249,6 +260,12 @@ int LoaderSettings::GetMenuInternal()
if (++Settings.sneekVideoPatch >= MAX_ON_OFF) Settings.sneekVideoPatch = 0;
}
//! Settings: Aspect Ratio
else if (ret == ++Idx )
{
if (++Settings.GameAspectRatio >= ASPECT_MAX) Settings.GameAspectRatio = 0;
}
//! Settings: Game Language
else if (ret == ++Idx)
{

View File

@ -95,29 +95,6 @@ u32 GameBooter::BootPartition(char * dolpath, u8 videoselected, u8 alternatedol,
return (u32) p_entry;
}
int GameBooter::FindDiscHeader(const char * gameID, struct discHdr &gameHeader)
{
gameList.LoadUnfiltered();
if(mountMethod == 0 && !gameList.GetDiscHeader(gameID))
{
gprintf("Game was not found: %s\n", gameID);
return -1;
}
else if(mountMethod && !dvdheader)
{
gprintf("Error: Loading empty disc header from DVD\n");
return -1;
}
memcpy(&gameHeader, (mountMethod ? dvdheader : gameList.GetDiscHeader(gameID)), sizeof(struct discHdr));
delete dvdheader;
dvdheader = NULL;
return 0;
}
void GameBooter::SetupAltDOL(u8 * gameID, u8 &alternatedol, u32 &alternatedoloffset)
{
if(alternatedol == ALT_DOL_ON_LAUNCH)
@ -243,6 +220,7 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
//! Setup game configuration from game settings. If no game settings exist use global/default.
GameCFG * game_cfg = GameSettings.GetGameCFG(gameHeader.id);
u8 videoChoice = game_cfg->video == INHERIT ? Settings.videomode : game_cfg->video;
u8 aspectChoice = game_cfg->aspectratio == INHERIT ? Settings.GameAspectRatio : game_cfg->aspectratio;
u8 languageChoice = game_cfg->language == INHERIT ? Settings.language : game_cfg->language;
u8 ocarinaChoice = game_cfg->ocarina == INHERIT ? Settings.ocarina : game_cfg->ocarina;
u8 viChoice = game_cfg->vipatch == INHERIT ? Settings.videopatch : game_cfg->vipatch;
@ -372,7 +350,7 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
//! Do all the game patches
gprintf("Applying game patches...\n");
gamepatches(videoChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, fix002, returnToChoice);
gamepatches(videoChoice, aspectChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, fix002, returnToChoice);
//! Load Code handler if needed
load_handler(Hooktype, WiirdDebugger, Settings.WiirdDebuggerPause);

View File

@ -26,7 +26,6 @@ class GameBooter
static int BootGame(struct discHdr *gameHdr);
static int BootGCMode();
private:
static int FindDiscHeader(const char * gameID, struct discHdr &gameHeader);
static void SetupAltDOL(u8 * gameID, u8 &alternatedol, u32 &alternatedoloffset);
static void SetupNandEmu(u8 NandEmuMode, const char *NandEmuPath, struct discHdr &gameHeader);
static int SetupDisc(u8 *gameID);

View File

@ -30,6 +30,7 @@ static int FindGamePartition()
}
}
int firstValidPartition = -1;
if(IosLoader::IsWaninkokoIOS() && NandTitles.VersionOf(TITLE_ID(1, IOS_GetVersion())) < 18)
return -1;
@ -57,9 +58,18 @@ static int FindGamePartition()
return 0;
}
if(firstValidPartition < 0)
firstValidPartition = i;
WBFS_Close(i);
}
if(firstValidPartition >= 0)
{
Settings.partition = firstValidPartition;
return 0;
}
return -1;
}
@ -128,7 +138,7 @@ int MountGamePartition(bool ShowGUI)
{
if(Settings.MultiplePartitions)
ret = WBFS_OpenAll();
else
else if(!Settings.FirstTimeRun)
ret = WBFS_OpenPart(Settings.partition);
if(ret < 0)