mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 01:09:16 +01:00
*Added per game NandEmu, Hooktype, WiirdDebugger setting
*Disabled try to mount of drive when no disc is inserted *Bug in NandEmu fat FD close was fixed with latest d2x, workaround removed *Added create of nand emu path for rabbits go home to /title/00010004/ (Partial Nand Emu) (thx nic for the info) *Fixed loading default values for new added game settings
This commit is contained in:
parent
a0a669a00a
commit
e43c9b108d
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>2.2 r1109</version>
|
||||
<release_date>201108132358</release_date>
|
||||
<version>2.2 r1110</version>
|
||||
<release_date>201109030839</release_date>
|
||||
<!-- // remove this line to enable arguments
|
||||
<arguments>
|
||||
<arg>--ios=250</arg>
|
||||
|
@ -1,12 +0,0 @@
|
||||
#
|
||||
# to use this file rename Make.config.default to Make.config
|
||||
# or create a new Make.config
|
||||
#
|
||||
# you can here add defines
|
||||
#
|
||||
# in example i have included a switch to diseble
|
||||
# the gecko-debug stuff. so also in source gecko.c+gecko.h
|
||||
#
|
||||
# NOTE when add, remove or change a define here then a "make clean" is needed
|
||||
#
|
||||
CFLAGS += -DNO_DEBUG DDEBUG_WBFS
|
@ -1170,12 +1170,17 @@ void GameBrowseMenu::CheckDiscSlotUpdate()
|
||||
else if (dvdBtn->GetState() == STATE_CLICKED)
|
||||
{
|
||||
gprintf("\tdvdBtn Clicked\n");
|
||||
if(!dvdheader)
|
||||
dvdheader = new struct discHdr;
|
||||
mountMethod = DiscMount(dvdheader);
|
||||
dvdBtn->ResetState();
|
||||
if(DiscDriveCover & 0x02)
|
||||
{
|
||||
if(!dvdheader)
|
||||
dvdheader = new struct discHdr;
|
||||
mountMethod = DiscMount(dvdheader);
|
||||
rockout(GetSelectedGame());
|
||||
}
|
||||
else
|
||||
WindowPrompt(tr( "No disc inserted." ), 0, tr( "OK" ));
|
||||
|
||||
rockout(GetSelectedGame());
|
||||
dvdBtn->ResetState();
|
||||
}
|
||||
|
||||
if(DiscDriveCoverOld != DiscDriveCover)
|
||||
|
@ -188,6 +188,9 @@ static const u32 dczeropatch[4] = {
|
||||
void dogamehooks(u32 hooktype, void *addr, u32 len)
|
||||
//---------------------------------------------------------------------------------
|
||||
{
|
||||
if(hooktype == 0x00)
|
||||
return;
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
@ -195,7 +198,6 @@ void dogamehooks(u32 hooktype, void *addr, u32 len)
|
||||
{
|
||||
switch(hooktype)
|
||||
{
|
||||
|
||||
default:
|
||||
case 0x00:
|
||||
|
||||
|
@ -189,6 +189,9 @@ bool CGameSettings::Save()
|
||||
fprintf(f, "alternatedolname:%s; ", GameList[i].alternatedolname);
|
||||
fprintf(f, "returnTo:%d; ", GameList[i].returnTo);
|
||||
fprintf(f, "sneekVideoPatch:%d; ", GameList[i].sneekVideoPatch);
|
||||
fprintf(f, "NandEmuMode:%d; ", GameList[i].NandEmuMode);
|
||||
fprintf(f, "Hooktype:%d; ", GameList[i].Hooktype);
|
||||
fprintf(f, "WiirdDebugger:%d; ", GameList[i].WiirdDebugger);
|
||||
fprintf(f, "Locked:%d;\n", GameList[i].Locked);
|
||||
}
|
||||
fprintf(f, "# END\n");
|
||||
@ -310,6 +313,30 @@ bool CGameSettings::SetSetting(GameCFG & game, char *name, char *value)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if(strcmp(name, "NandEmuMode") == 0)
|
||||
{
|
||||
if (sscanf(value, "%d", &i) == 1)
|
||||
{
|
||||
game.NandEmuMode = i;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if(strcmp(name, "Hooktype") == 0)
|
||||
{
|
||||
if (sscanf(value, "%d", &i) == 1)
|
||||
{
|
||||
game.Hooktype = i;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if(strcmp(name, "WiirdDebugger") == 0)
|
||||
{
|
||||
if (sscanf(value, "%d", &i) == 1)
|
||||
{
|
||||
game.WiirdDebugger = i;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if(strcmp(name, "Locked") == 0)
|
||||
{
|
||||
if (sscanf(value, "%d", &i) == 1)
|
||||
@ -360,7 +387,7 @@ void CGameSettings::ParseLine(char *line)
|
||||
return;
|
||||
|
||||
GameCFG NewCFG;
|
||||
memset(&NewCFG, 0, sizeof(GameCFG));
|
||||
memcpy(&NewCFG, GetDefault(), sizeof(GameCFG));
|
||||
|
||||
strcpy(NewCFG.id, GameID);
|
||||
|
||||
@ -433,6 +460,9 @@ GameCFG * CGameSettings::GetDefault()
|
||||
DefaultConfig.alternatedolname[0] = '\0';
|
||||
DefaultConfig.returnTo = 1;
|
||||
DefaultConfig.sneekVideoPatch = INHERIT;
|
||||
DefaultConfig.NandEmuMode = INHERIT;
|
||||
DefaultConfig.Hooktype = INHERIT;
|
||||
DefaultConfig.WiirdDebugger = INHERIT;
|
||||
DefaultConfig.Locked = OFF;
|
||||
|
||||
return &DefaultConfig;
|
||||
|
@ -24,6 +24,9 @@ typedef struct _GameCFG
|
||||
char alternatedolname[40];
|
||||
short returnTo;
|
||||
short sneekVideoPatch;
|
||||
short NandEmuMode;
|
||||
short Hooktype;
|
||||
short WiirdDebugger;
|
||||
short Locked;
|
||||
} GameCFG;
|
||||
|
||||
|
@ -92,6 +92,25 @@ static const char * AlternateDOLText[] =
|
||||
trNOOP( "Default" ),
|
||||
};
|
||||
|
||||
static const char * NandEmuText[] =
|
||||
{
|
||||
trNOOP( "OFF" ),
|
||||
trNOOP( "Partial" ),
|
||||
trNOOP( "Full" )
|
||||
};
|
||||
|
||||
static const char * HooktypeText[] =
|
||||
{
|
||||
trNOOP( "None" ),
|
||||
trNOOP( "VBI (Default)" ),
|
||||
trNOOP( "KPAD Read" ),
|
||||
trNOOP( "Joypad" ),
|
||||
trNOOP( "GXDraw" ),
|
||||
trNOOP( "GXFlush" ),
|
||||
trNOOP( "OSSleepThread" ),
|
||||
trNOOP( "AXNextFrame" ),
|
||||
};
|
||||
|
||||
GameLoadSM::GameLoadSM(const char * GameID)
|
||||
: SettingsMenu(tr("Game Load"), &GuiOptions, MENU_NONE)
|
||||
{
|
||||
@ -155,6 +174,9 @@ void GameLoadSM::SetOptionNames()
|
||||
Options->SetName(Idx++, "%s", tr( "Alternate DOL" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Select DOL Offset" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Block IOS Reload" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Nand Emulation" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Hooktype" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Wiird Debugger" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Game Lock" ));
|
||||
}
|
||||
|
||||
@ -248,6 +270,24 @@ void GameLoadSM::SetOptionValues()
|
||||
else
|
||||
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.iosreloadblock]) );
|
||||
|
||||
//! Settings: Nand Emulation
|
||||
if(GameConfig.NandEmuMode == INHERIT)
|
||||
Options->SetValue(Idx++, tr("Use global"));
|
||||
else
|
||||
Options->SetValue(Idx++, "%s", tr( NandEmuText[GameConfig.NandEmuMode] ));
|
||||
|
||||
//! Settings: Hooktype
|
||||
if(GameConfig.Hooktype == INHERIT)
|
||||
Options->SetValue(Idx++, tr("Use global"));
|
||||
else
|
||||
Options->SetValue(Idx++, "%s", tr( HooktypeText[GameConfig.Hooktype] ));
|
||||
|
||||
//! Settings: Wiird Debugger
|
||||
if(GameConfig.WiirdDebugger == INHERIT)
|
||||
Options->SetValue(Idx++, tr("Use global"));
|
||||
else
|
||||
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.WiirdDebugger] ));
|
||||
|
||||
//! Settings: Game Lock
|
||||
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.Locked] ));
|
||||
}
|
||||
@ -397,6 +437,26 @@ int GameLoadSM::GetMenuInternal()
|
||||
if(++GameConfig.iosreloadblock >= 3) GameConfig.iosreloadblock = INHERIT;
|
||||
}
|
||||
|
||||
//! Settings: Nand Emulation
|
||||
else if (ret == ++Idx)
|
||||
{
|
||||
if(!IosLoader::IsD2X())
|
||||
WindowPrompt(tr("Error:"), tr("Nand Emulation is only available on D2X cIOS!"), tr("OK"));
|
||||
else if (++GameConfig.NandEmuMode >= 3) GameConfig.NandEmuMode = INHERIT;
|
||||
}
|
||||
|
||||
//! Settings: Hooktype
|
||||
else if (ret == ++Idx)
|
||||
{
|
||||
if (++GameConfig.Hooktype >= 8) GameConfig.Hooktype = INHERIT;
|
||||
}
|
||||
|
||||
//! Settings: Wiird Debugger
|
||||
else if (ret == ++Idx)
|
||||
{
|
||||
if (++GameConfig.WiirdDebugger >= MAX_ON_OFF) GameConfig.WiirdDebugger = INHERIT;
|
||||
}
|
||||
|
||||
//! Settings: Game Lock
|
||||
else if (ret == ++Idx)
|
||||
{
|
||||
|
@ -134,15 +134,15 @@ void GameBooter::SetupAltDOL(u8 * gameID, u8 &alternatedol, u32 &alternatedoloff
|
||||
alternatedol = OFF;
|
||||
}
|
||||
|
||||
void GameBooter::SetupNandEmu(struct discHdr &gameHeader)
|
||||
void GameBooter::SetupNandEmu(u8 NandEmuMode, struct discHdr &gameHeader)
|
||||
{
|
||||
if(Settings.NandEmuMode && strchr(Settings.NandEmuPath, '/'))
|
||||
if(NandEmuMode && strchr(Settings.NandEmuPath, '/'))
|
||||
{
|
||||
//! Create save game path and title.tmd for not existing saves
|
||||
CreateSavePath(&gameHeader);
|
||||
|
||||
gprintf("Enabling Nand Emulation on: %s\n", Settings.NandEmuPath);
|
||||
Set_FullMode(Settings.NandEmuMode == 2);
|
||||
Set_FullMode(NandEmuMode == 2);
|
||||
Set_Path(strchr(Settings.NandEmuPath, '/'));
|
||||
|
||||
//! Set which partition to use (USB only)
|
||||
@ -234,6 +234,9 @@ int GameBooter::BootGame(const char * gameID)
|
||||
u8 alternatedol = game_cfg->loadalternatedol;
|
||||
u32 alternatedoloffset = game_cfg->alternatedolstart;
|
||||
u8 reloadblock = game_cfg->iosreloadblock == INHERIT ? Settings.BlockIOSReload : game_cfg->iosreloadblock;
|
||||
u8 NandEmuMode = game_cfg->NandEmuMode == INHERIT ? Settings.NandEmuMode : game_cfg->NandEmuMode;
|
||||
u8 Hooktype = game_cfg->Hooktype == INHERIT ? Settings.Hooktype : game_cfg->Hooktype;
|
||||
u8 WiirdDebugger = game_cfg->WiirdDebugger == INHERIT ? Settings.WiirdDebugger : game_cfg->WiirdDebugger;
|
||||
u64 returnToChoice = game_cfg->returnTo ? NandTitles.FindU32(Settings.returnTo) : 0;
|
||||
|
||||
if(ocarinaChoice && Settings.Hooktype == OFF)
|
||||
@ -256,7 +259,7 @@ int GameBooter::BootGame(const char * gameID)
|
||||
Playlog_Update((char *) gameHeader.id, BNRInstance::Instance()->GetIMETTitle(CONF_GetLanguage()));
|
||||
|
||||
//! Setup NAND emulation
|
||||
SetupNandEmu(gameHeader);
|
||||
SetupNandEmu(NandEmuMode, gameHeader);
|
||||
|
||||
//! Setup disc in cIOS and open it
|
||||
ret = SetupDisc(gameHeader.id);
|
||||
@ -303,14 +306,14 @@ int GameBooter::BootGame(const char * gameID)
|
||||
|
||||
//! Do all the game patches
|
||||
gprintf("Applying game patches...\n");
|
||||
gamepatches(videoChoice, languageChoice, countrystrings, viChoice, sneekChoice, Settings.Hooktype, fix002, reloadblock, iosChoice, returnToChoice);
|
||||
gamepatches(videoChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, fix002, reloadblock, iosChoice, returnToChoice);
|
||||
|
||||
//! Load Ocarina codes
|
||||
if (ocarinaChoice)
|
||||
ocarina_load_code(Settings.Cheatcodespath);
|
||||
|
||||
//! Load Code handler if needed
|
||||
load_handler(Settings.Cheatcodespath, Settings.Hooktype, Settings.WiirdDebugger, Settings.WiirdDebuggerPause);
|
||||
load_handler(Settings.Cheatcodespath, Hooktype, WiirdDebugger, Settings.WiirdDebuggerPause);
|
||||
|
||||
//! Shadow mload - Only needed on some games with Hermes v5.1 (Check is inside the function)
|
||||
shadow_mload();
|
||||
|
@ -27,7 +27,7 @@ class GameBooter
|
||||
private:
|
||||
static int FindDiscHeader(const char * gameID, struct discHdr &gameHeader);
|
||||
static void SetupAltDOL(u8 * gameID, u8 &alternatedol, u32 &alternatedoloffset);
|
||||
static void SetupNandEmu(struct discHdr &gameHeader);
|
||||
static void SetupNandEmu(u8 NandEmuMode, struct discHdr &gameHeader);
|
||||
static int SetupDisc(u8 *gameID);
|
||||
static u32 BootPartition(char * dolpath, u8 videoselected, u8 alternatedol, u32 alternatedoloffset);
|
||||
};
|
||||
|
@ -74,8 +74,7 @@ static s32 Nand_Mount(nandDevice *dev)
|
||||
ret = IOS_Ioctlv(fd, dev->mountCmd, inlen, 0, vector);
|
||||
|
||||
/* Close FAT module */
|
||||
//!TODO: Figure out why this causes a freeze
|
||||
//IOS_Close(fd);
|
||||
IOS_Close(fd);
|
||||
|
||||
/* Free memory */
|
||||
if(buffer != NULL)
|
||||
|
@ -96,10 +96,18 @@ void CreateSavePath(const struct discHdr *hdr)
|
||||
snprintf(nandPath, sizeof(nandPath), "%s/tmp", Settings.NandEmuPath);
|
||||
CreateNandPath(nandPath);
|
||||
|
||||
snprintf(nandPath, sizeof(nandPath), "%s/title/00010000/%02x%02x%02x%02x/data", Settings.NandEmuPath, hdr->id[0], hdr->id[1], hdr->id[2], hdr->id[3]);
|
||||
const char *titlePath = "title/00010000";
|
||||
|
||||
if( memcmp(hdr->id, "RGWX41", 6) == 0 || memcmp(hdr->id, "RGWP41", 6) == 0 ||
|
||||
memcmp(hdr->id, "RGWJ41", 6) == 0 || memcmp(hdr->id, "RGWE41", 6) == 0)
|
||||
{
|
||||
titlePath = "title/00010004";
|
||||
}
|
||||
|
||||
snprintf(nandPath, sizeof(nandPath), "%s/%s/%02x%02x%02x%02x/data", Settings.NandEmuPath, titlePath, hdr->id[0], hdr->id[1], hdr->id[2], hdr->id[3]);
|
||||
CreateNandPath(nandPath);
|
||||
|
||||
snprintf(nandPath, sizeof(nandPath), "%s/title/00010000/%02x%02x%02x%02x/content", Settings.NandEmuPath, hdr->id[0], hdr->id[1], hdr->id[2], hdr->id[3]);
|
||||
snprintf(nandPath, sizeof(nandPath), "%s/%s/%02x%02x%02x%02x/content", Settings.NandEmuPath, titlePath, hdr->id[0], hdr->id[1], hdr->id[2], hdr->id[3]);
|
||||
CreateNandPath(nandPath);
|
||||
|
||||
strcat(nandPath, "/title.tmd");
|
||||
|
@ -267,7 +267,7 @@ s32 Disc_IsWii(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Disc_JumpToEntrypoint(bool enablecheat, u32 dolparameter)
|
||||
s32 Disc_JumpToEntrypoint(s32 hooktype, u32 dolparameter)
|
||||
{
|
||||
/* Set an appropiate video mode */
|
||||
__Disc_SetVMode();
|
||||
@ -284,7 +284,7 @@ s32 Disc_JumpToEntrypoint(bool enablecheat, u32 dolparameter)
|
||||
/* Originally from tueidj - taken from NeoGamme (thx) */
|
||||
*(vu32*)0xCC003024 = dolparameter != 0 ? dolparameter : 1;
|
||||
|
||||
if (enablecheat)
|
||||
if (hooktype)
|
||||
{
|
||||
__asm__(
|
||||
"lis %r3, AppEntrypoint@h\n"
|
||||
|
@ -53,7 +53,7 @@ extern "C"
|
||||
s32 Disc_FindPartition(u64 *outbuf);
|
||||
void PatchCountryStrings(void *Address, int Size);
|
||||
void Disc_SelectVMode(u8 videoselected);
|
||||
s32 Disc_JumpToEntrypoint(bool enablecheat, u32 dolparameter);
|
||||
s32 Disc_JumpToEntrypoint(s32 hooktype, u32 dolparameter);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user