* Updated runtimeiospatch to 1.5.2

Nintendont: 
* Added support for CFG v4 (v3.354+)
* Added VideoScale and VideoOffset options
This commit is contained in:
cyan06 2015-07-12 13:01:24 +00:00
parent be6092e1e9
commit 26c671bd7b
8 changed files with 134 additions and 30 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>3.0 r1251</version>
<release_date>20150707190220</release_date>
<version>3.0 r1252</version>
<release_date>20150712124252</release_date>
<!-- // remove this line to enable arguments
<arguments>
<arg>--ios=250</arg>

View File

@ -20,12 +20,12 @@
#include <gctypes.h>
#define NIN_MAGIC 0x01070CF6
#define NIN_CFG_VERSION 0x00000003
#define NIN_CFG_VERSION 0x00000004
typedef struct NIN_CFG
{
u32 Magicbytes; // 0x01070CF6
u32 Version; // 0x00000003 since r42
u32 Version; // 0x00000004 since v3.354
u32 Config;
u32 VideoMode;
u32 Language;
@ -33,7 +33,17 @@ typedef struct NIN_CFG
char CheatPath[255];
u32 MaxPads; // added in r42 - cfg version 2
u32 GameID; // added in r83 - cfg version 2
u32 MemCardBlocks; // added in v1.135 - cfg version 3
union
{
u32 MemCardBlocks; // added in v1.135 - cfg version 3 - u32 in v3, Char in v4
struct
{
char MemCardBlocksV4;// replaced in v3.354 - cfg version 4 - from u32 in v3 to Char in v4
char VideoScale; // added in v3.354 - cfg version 4
char VideoOffset; // added in v3.354 - cfg version 4
char Unused; // added in v3.354 - cfg version 4
};
};
} NIN_CFG;
enum ninconfig

View File

@ -185,6 +185,9 @@ void CSettings::SetDefault()
DMLJPNPatch = OFF;
DMLDebug = OFF;
NINDeflicker = OFF;
NINWiiUWide = widescreen;
NINVideoScale = 40;
NINVideoOffset = 0;
NINMCEmulation = ON;
NINMCSize = 2;
NINAutoboot = ON;
@ -192,7 +195,6 @@ void CSettings::SetDefault()
NINUSBHID = OFF;
NINMaxPads = 4;
NINNativeSI = OFF;
NINWiiUWide = widescreen;
NINOSReport = OFF;
NINLED = OFF;
NINLog = OFF;
@ -436,6 +438,9 @@ bool CSettings::Save()
fprintf(file, "DMLJPNPatch = %d\n", DMLJPNPatch);
fprintf(file, "DMLDebug = %d\n", DMLDebug);
fprintf(file, "NINDeflicker = %d\n", NINDeflicker);
fprintf(file, "NINWiiUWide = %d\n", NINWiiUWide);
fprintf(file, "NINVideoScale = %d\n", NINVideoScale);
fprintf(file, "NINVideoOffset = %d\n", NINVideoOffset);
fprintf(file, "NINMCEmulation = %d\n", NINMCEmulation);
fprintf(file, "NINMCSize = %d\n", NINMCSize);
fprintf(file, "NINAutoboot = %d\n", NINAutoboot);
@ -443,7 +448,6 @@ bool CSettings::Save()
fprintf(file, "NINUSBHID = %d\n", NINUSBHID);
fprintf(file, "NINMaxPads = %d\n", NINMaxPads);
fprintf(file, "NINNativeSI = %d\n", NINNativeSI);
fprintf(file, "NINWiiUWide = %d\n", NINWiiUWide);
fprintf(file, "NINOSReport = %d\n", NINOSReport);
fprintf(file, "NINLED = %d\n", NINLED);
fprintf(file, "NINLog = %d\n", NINLog);
@ -927,6 +931,21 @@ bool CSettings::SetSetting(char *name, char *value)
NINDeflicker = atoi(value);
return true;
}
else if (strcmp(name, "NINWiiUWide") == 0)
{
NINWiiUWide = atoi(value);
return true;
}
else if (strcmp(name, "NINVideoScale") == 0)
{
NINVideoScale = atoi(value);
return true;
}
else if (strcmp(name, "NINVideoOffset") == 0)
{
NINVideoOffset = atoi(value);
return true;
}
else if (strcmp(name, "NINMCEmulation") == 0)
{
NINMCEmulation = atoi(value);
@ -962,11 +981,6 @@ bool CSettings::SetSetting(char *name, char *value)
NINNativeSI = atoi(value);
return true;
}
else if (strcmp(name, "NINWiiUWide") == 0)
{
NINWiiUWide = atoi(value);
return true;
}
else if (strcmp(name, "NINOSReport") == 0)
{
NINOSReport = atoi(value);

View File

@ -189,14 +189,16 @@ class CSettings
short DMLJPNPatch;
short DMLDebug;
short NINDeflicker;
short NINMCEmulation;
short NINWiiUWide;
short NINVideoScale;
s8 NINVideoOffset;
s8 NINMCEmulation;
short NINMCSize;
short NINAutoboot;
short NINSettings;
short NINUSBHID;
short NINMaxPads;
short NINNativeSI;
short NINWiiUWide;
short NINOSReport;
short NINLED;
short NINLog;

View File

@ -230,12 +230,14 @@ LoaderSettings::LoaderSettings()
Options->SetName(Idx++, "%s", tr( "Auto Boot" ));
Options->SetName(Idx++, "%s", tr( "Settings File" ));
Options->SetName(Idx++, "%s", tr( "Video Deflicker" ));
Options->SetName(Idx++, "%s", tr( "WiiU Widescreen" ));
Options->SetName(Idx++, "%s", tr( "Video scale" ));
Options->SetName(Idx++, "%s", tr( "Video offset" ));
Options->SetName(Idx++, "%s", tr( "Memory Card Emulation" ));
Options->SetName(Idx++, "%s", tr( "Memory Card Blocks Size" ));
Options->SetName(Idx++, "%s", tr( "USB-HID Controller" ));
Options->SetName(Idx++, "%s", tr( "GameCube Controller" ));
Options->SetName(Idx++, "%s", tr( "Native Controller" ));
Options->SetName(Idx++, "%s", tr( "WiiU Widescreen" ));
Options->SetName(Idx++, "%s", tr( "LED Activity" ));
Options->SetName(Idx++, "%s", tr( "OSReport" ));
Options->SetName(Idx++, "%s", tr( "Log to file" ));
@ -418,6 +420,15 @@ void LoaderSettings::SetOptionValues()
//! Settings: NIN Video Deflicker
Options->SetValue(Idx++, "%s", tr(OnOffText[Settings.NINDeflicker]));
//! Settings: WiiU Widescreen
Options->SetValue(Idx++, "%s", tr(OnOffText[Settings.NINWiiUWide]));
//! Settings: NIN VideoScale
Options->SetValue(Idx++, "%d (40~120)", Settings.NINVideoScale);
//! Settings: NIN VideoOffset
Options->SetValue(Idx++, "%d (-20~20)", Settings.NINVideoOffset);
//! Settings: NIN Memory Card Emulation
Options->SetValue(Idx++, "%s", tr(NINMCText[Settings.NINMCEmulation]));
@ -433,9 +444,6 @@ void LoaderSettings::SetOptionValues()
//! Settings: NIN Native Controller
Options->SetValue(Idx++, "%s", tr(OnOffText[Settings.NINNativeSI]));
//! Settings: WiiU Widescreen
Options->SetValue(Idx++, "%s", tr(OnOffText[Settings.NINWiiUWide]));
//! Settings: NIN LED Activity
Options->SetValue(Idx++, "%s", tr(OnOffText[Settings.NINLED]));
@ -768,6 +776,32 @@ int LoaderSettings::GetMenuInternal()
if (++Settings.NINDeflicker >= MAX_ON_OFF) Settings.NINDeflicker = 0;
}
//! Settings: WiiU Widescreen
else if (ret == ++Idx)
{
if (++Settings.NINWiiUWide >= MAX_ON_OFF) Settings.NINWiiUWide = 0;
}
//! Settings: NIN VideoScale
else if (ret == ++Idx)
{
char entrie[20];
snprintf(entrie, sizeof(entrie), "%i", Settings.NINVideoScale);
int ret = OnScreenNumpad(entrie, sizeof(entrie));
if(ret)
Settings.NINVideoScale = LIMIT(atoi(entrie), 40, 120);
}
//! Settings: NIN VideoOffset
else if (ret == ++Idx)
{
char entrie[20];
snprintf(entrie, sizeof(entrie), "%i", Settings.NINVideoOffset);
int ret = OnScreenNumpad(entrie, sizeof(entrie));
if(ret)
Settings.NINVideoOffset = LIMIT(atoi(entrie), -20, 20);
}
//! Settings: NIN Memory Card Emulation
else if (ret == ++Idx)
{
@ -800,12 +834,6 @@ int LoaderSettings::GetMenuInternal()
if (++Settings.NINNativeSI >= MAX_ON_OFF) Settings.NINNativeSI = 0;
}
//! Settings: WiiU Widescreen
else if (ret == ++Idx)
{
if (++Settings.NINWiiUWide >= MAX_ON_OFF) Settings.NINWiiUWide = 0;
}
//! Settings: NIN LED Activity
else if (ret == ++Idx)
{

View File

@ -9,9 +9,10 @@
// Copyright (C) 2010 Joseph Jordan <joe.ftpii@psychlaw.com.au>
// Copyright (C) 2012-2013 damysteryman
// Copyright (C) 2012-2013 Christopher Bratusek <nano@tuxfamily.org>
// Copyright (C) 2012-2015 Christopher Bratusek <nano@jpberlin.de>
// Copyright (C) 2013 DarkMatterCore
// Copyright (C) 2014 megazig
// Copyright (C) 2015 FIX94
#include <gccore.h>
#include <ogc/machine/processor.h>
@ -50,6 +51,16 @@ static const u8 addticket_patch[] = { 0xE0 };
static const u8 es_set_ahbprot_old[] = { 0x68, 0x5B, 0x22, 0xEC, 0x00, 0x52, 0x18, 0x9B, 0x68, 0x1B, 0x46, 0x98, 0x07, 0xDB };
static const u8 es_set_ahbprot_patch[] = { 0x01 };
/* SSL patches made by FIX94 for Nintendont. Ported to libruntimeiospatch by DarkMatterCore */
static const u8 ssl_patch1_old[] = { 0xFE, 0x0E, 0xE3, 0x50, 0x00, 0x00, 0x05, 0x9F };
static const u8 ssl_patch1_new[] = { 0xFE, 0x0E, 0xE3, 0x28, 0xF1, 0x02, 0x05, 0x9F }; // Fixes SSL error -9 (wrong host)
static const u8 ssl_patch2_old[] = { 0x00, 0x00, 0x0A, 0x00, 0x00, 0x09, 0xEA, 0x00 };
static const u8 ssl_patch2_new[] = { 0x00, 0x00, 0xEA, 0x00, 0x00, 0x09, 0xEA, 0x00 }; // Fixes SSL error -10 (part 1) (wrong root cert)
static const u8 ssl_patch3_old[] = { 0x00, 0x00, 0x1A, 0x00, 0x00, 0x08, 0xE3, 0xE0 };
static const u8 ssl_patch3_new[] = { 0x00, 0x00, 0xEA, 0x00, 0x00, 0x08, 0xE3, 0xE0 }; // Fixes SSL error -10 (part 2) (wrong root cert)
static const u8 ssl_patch4_old[] = { 0x00, 0x00, 0xDA, 0x00, 0x00, 0x16, 0xE7, 0x96 };
static const u8 ssl_patch4_new[] = { 0x00, 0x00, 0xEA, 0x00, 0x00, 0x16, 0xE7, 0x96 }; // Fixes SSL error -11 (wrong client cert)
//Following patches added to iospatch.c by damysteryman, taken from sciifii v5
static const u8 MEM2_prot_old[] = { 0xB5, 0x00, 0x4B, 0x09, 0x22, 0x01, 0x80, 0x1A, 0x22, 0xF0 };
static const u8 MEM2_prot_patch[] = { 0xB5, 0x00, 0x4B, 0x09, 0x22, 0x00, 0x80, 0x1A, 0x22, 0xF0 };
@ -72,7 +83,6 @@ static const u8 ES_TitleVersionCheck_patch[] = { 0xE0, 0x01, 0x4E, 0x56 };
static const u8 ES_TitleDeleteCheck_old[] = { 0xD8, 0x00, 0x4A, 0x04 };
static const u8 ES_TitleDeleteCheck_patch[] = { 0xE0, 0x00, 0x4A, 0x04 };
//Following set of patches made by damysteryman for use with Wii U's vWii
static const u8 Kill_AntiSysTitleInstallv3_pt1_old[] = { 0x68, 0x1A, 0x2A, 0x01, 0xD0, 0x05 }; // Make sure that the pt1
static const u8 Kill_AntiSysTitleInstallv3_pt1_patch[] = { 0x68, 0x1A, 0x2A, 0x01, 0x46, 0xC0 }; // patch is applied twice. -dmm
@ -81,6 +91,7 @@ static const u8 Kill_AntiSysTitleInstallv3_pt2_patch[] = { 0x46, 0xC0, 0x33, 0x0
static const u8 Kill_AntiSysTitleInstallv3_pt3_old[] = { 0x68, 0xFB, 0x2B, 0x00, 0xDB, 0x01 };
static const u8 Kill_AntiSysTitleInstallv3_pt3_patch[] = { 0x68, 0xFB, 0x2B, 0x00, 0xDB, 0x10 };
/* ISFS_SetAttr patches made by megazig */
static const u8 isfs_setattr_pt1_old[] = { 0x42, 0xAB, 0xD0, 0x02, 0x20, 0x66 };
static const u8 isfs_setattr_pt1_patch[] = { 0x42, 0xAB, 0xE0, 0x02, 0x20, 0x66 };
static const u8 isfs_setattr_pt2_old[] = { 0x2D, 0x00, 0xD0, 0x02, 0x20, 0x66 };
@ -143,6 +154,10 @@ s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) {
count += apply_patch("new_hash_check", new_hash_old, sizeof(new_hash_old), hash_patch, sizeof(hash_patch), 1, verbose);
//count += apply_patch("isfs_setattr_pt1", isfs_setattr_pt1_old, sizeof(isfs_setattr_pt1_old), isfs_setattr_pt1_patch, sizeof(isfs_setattr_pt1_patch), 0, verbose);
//count += apply_patch("isfs_setattr_pt2", isfs_setattr_pt2_old, sizeof(isfs_setattr_pt2_old), isfs_setattr_pt2_patch, sizeof(isfs_setattr_pt2_patch), 0, verbose);
//count += apply_patch("ssl_patch1", ssl_patch1_old, sizeof(ssl_patch1_old), ssl_patch1_new, sizeof(ssl_patch1_new), 0, verbose);
//count += apply_patch("ssl_patch2", ssl_patch2_old, sizeof(ssl_patch2_old), ssl_patch2_new, sizeof(ssl_patch2_new), 0, verbose);
//count += apply_patch("ssl_patch3", ssl_patch3_old, sizeof(ssl_patch3_old), ssl_patch3_new, sizeof(ssl_patch3_new), 0, verbose);
//count += apply_patch("ssl_patch4", ssl_patch4_old, sizeof(ssl_patch4_old), ssl_patch4_new, sizeof(ssl_patch4_new), 0, verbose);
}
if(sciifii)
{
@ -186,3 +201,18 @@ s32 IosPatch_FULL(bool wii, bool sciifii, bool vwii, bool verbose, int IOS) {
return xret;
}
s32 IosPatch_SSL(bool verbose) {
s32 count = 0;
if (AHBPROT_DISABLED) {
disable_memory_protection();
if(verbose) printf(">> Applying SSL patches:\n");
count += apply_patch("ssl_patch1", ssl_patch1_old, sizeof(ssl_patch1_old), ssl_patch1_new, sizeof(ssl_patch1_new), 0, verbose);
count += apply_patch("ssl_patch2", ssl_patch2_old, sizeof(ssl_patch2_old), ssl_patch2_new, sizeof(ssl_patch2_new), 0, verbose);
count += apply_patch("ssl_patch3", ssl_patch3_old, sizeof(ssl_patch3_old), ssl_patch3_new, sizeof(ssl_patch3_new), 0, verbose);
count += apply_patch("ssl_patch4", ssl_patch4_old, sizeof(ssl_patch4_old), ssl_patch4_new, sizeof(ssl_patch4_new), 0, verbose);
return count;
}
return ERROR_AHBPROT;
}

View File

@ -9,9 +9,10 @@
// Copyright (C) 2010 Joseph Jordan <joe.ftpii@psychlaw.com.au>
// Copyright (C) 2012-2013 damysteryman
// Copyright (C) 2012-2013 Christopher Bratusek <nano@tuxfamily.org>
// Copyright (C) 2012-2015 Christopher Bratusek <nano@jpberlin.de>
// Copyright (C) 2013 DarkMatterCore
// Copyright (C) 2014 megazig
// Copyright (C) 2015 FIX94
#ifndef __RUNTIMEIOSPATCH_H__
#define __RUNTIMEIOSPATCH_H__
@ -19,7 +20,7 @@
/**
* Version information for Libruntimeiospatch.
*/
#define LIB_RUNTIMEIOSPATCH_VERSION "1.5.1"
#define LIB_RUNTIMEIOSPATCH_VERSION "1.5.2"
//==============================================================================
// HW_RVL header
@ -62,6 +63,7 @@ Wii:
* ES SetIdentify
* Hash Check (aka Trucha)
* New Hash Check (aka New Trucha)
* SSL patches
Sciifii:
* MEM2 Prot

View File

@ -970,6 +970,8 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
u8 ninDebugChoice = game_cfg->DMLDebug == INHERIT ? Settings.DMLDebug : game_cfg->DMLDebug;
u8 ninOSReportChoice = game_cfg->NINOSReport == INHERIT ? Settings.NINOSReport : game_cfg->NINOSReport;
u8 ninLogChoice = game_cfg->NINLog == INHERIT ? Settings.NINLog : game_cfg->NINLog;
s8 ninVideoScale = Settings.NINVideoScale;
s8 ninVideoOffset = Settings.NINVideoOffset;
const char *ninLoaderPath = game_cfg->NINLoaderPath.size() == 0 ? Settings.NINLoaderPath : game_cfg->NINLoaderPath.c_str();
@ -1097,6 +1099,8 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
NIN_cfg_version = 2;
// no need to fake NIN_CFG struct size, the size is checked in nintendont only since v1.143
}
else if(NINLoaderTime >= mktime(&time))
NINRev = 135;
// v2.200 to 2.207
strptime("Nov 6 2014.17:33:30", "%b %d %Y %H:%M:%S", &time); // v1.208
@ -1153,6 +1157,12 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
return -1;
}
}
// needed since v3.354 CFG v4 to still work with old CFG version 3
if(NINRev >= 135 && NINRev < 354) // v3
{
NIN_cfg_version = 3;
}
// Set used device when launching game from disc
if(gameHdr->type == TYPE_GAME_GC_DISC)
@ -1405,8 +1415,16 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
memcpy((u8 *)Disc_ID, gameHdr->id, 6);
DCFlushRange((u8 *)Disc_ID, 6);
// Memory Card Emulation Blocks size
nin_config->MemCardBlocks = ninMCSizeChoice; // NIN_CFG_VERSION 3 v1.135
// Memory Card Emulation Blocs size with NIN_CFG v3
if(NIN_cfg_version == 3)
nin_config->MemCardBlocks = ninMCSizeChoice; // NIN_CFG_VERSION 3 v1.135
// Memory Card Emulation Blocs size + Aspect ratio with NIN_CFG v4
else if(NIN_cfg_version == 4)
{
nin_config->MemCardBlocksV4 = ninMCSizeChoice; // NIN_CFG_VERSION 4 v3.354
nin_config->VideoScale = ninVideoScale; // v3.354+
nin_config->VideoOffset = ninVideoOffset; // v3.354+
}
// Setup Video Mode