mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
- added ability to use custom private servers #261. add them to wiiflow_lite.ini like this:
[CUSTOM_SERVERS] servers=AltWFC|NewWFC AltWFC_url=zwei.moe NewWFC_url=newwfc.xyz the servers are separated by '|'. use the server name before '_url='
This commit is contained in:
parent
5b7bb4f582
commit
bdefb68ff6
Binary file not shown.
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
@ -150,7 +150,7 @@ u32 LoadChannel(u64 title, bool dol, u32 *IOS)
|
||||
}
|
||||
|
||||
void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio,
|
||||
u8 private_server, bool patchFix480p, u8 deflicker, u8 bootType)
|
||||
u8 private_server, const char *server_addr, bool patchFix480p, u8 deflicker, u8 bootType)
|
||||
{
|
||||
u8 vfilter_off[7] = {0, 0, 21, 22, 21, 0, 0};
|
||||
u8 vfilter_low[7] = {4, 4, 16, 16, 16, 4, 4};
|
||||
@ -170,7 +170,7 @@ void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
|
||||
if(aspectRatio != -1)
|
||||
PatchAspectRatio(dolchunkoffset[i], dolchunksize[i], aspectRatio);
|
||||
if(private_server)
|
||||
PrivateServerPatcher(dolchunkoffset[i], dolchunksize[i], private_server);
|
||||
PrivateServerPatcher(dolchunkoffset[i], dolchunksize[i], private_server, server_addr);
|
||||
if(hooktype != 0 && hookpatched == false)
|
||||
hookpatched = dogamehooks(dolchunkoffset[i], dolchunksize[i], true);
|
||||
|
||||
|
@ -14,7 +14,7 @@ typedef struct _dolheader
|
||||
} ATTRIBUTE_PACKED dolheader;
|
||||
|
||||
void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString,
|
||||
u8 patchVidModes, int aspectRatio, u8 private_server, bool patchFix480p, u8 deflicker, u8 bootType);
|
||||
u8 patchVidModes, int aspectRatio, u8 private_server, const char *server_addr, bool patchFix480p, u8 deflicker, u8 bootType);
|
||||
u32 LoadChannel(u64 title, bool dol, u32 *IOS);
|
||||
|
||||
#endif /* __CHANHANDLE_HPP_ */
|
||||
|
@ -50,6 +50,7 @@ struct the_CFG {
|
||||
bool patchFix480p;
|
||||
u8 deflicker;
|
||||
u8 private_server;
|
||||
char server_addr[24];
|
||||
u8 *cheats;
|
||||
u32 cheatSize;
|
||||
u8 debugger;
|
||||
|
@ -28,14 +28,13 @@ static const char *GameID = (const char*)0x80000000;
|
||||
#define APPLDR_OFFSET 0x910
|
||||
#define APPLDR_CODE 0x918
|
||||
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch,
|
||||
bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion, u8 private_server, u8 deflicker, u8 bootType);
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio,
|
||||
u32 returnTo, bool patchregion, u8 private_server, const char *server_addr, u8 deflicker, u8 bootType);
|
||||
static void patch_NoDiscinDrive(void *buffer, u32 len);
|
||||
static void Anti_002_fix(void *Address, int Size);
|
||||
static bool Remove_001_Protection(void *Address, int Size);
|
||||
static void PrinceOfPersiaPatch();
|
||||
static void NewSuperMarioBrosPatch();
|
||||
static void WiimmfiPatch(u8 server);
|
||||
static void Patch_23400_and_MKWii_vulnerability();
|
||||
bool hookpatched = false;
|
||||
|
||||
@ -50,7 +49,7 @@ static struct
|
||||
} apploader_hdr ATTRIBUTE_ALIGN(32);
|
||||
|
||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo,
|
||||
bool patchregion , u8 private_server, bool patchFix480p, u8 deflicker, u8 bootType)
|
||||
bool patchregion , u8 private_server, const char *server_addr, bool patchFix480p, u8 deflicker, u8 bootType)
|
||||
{
|
||||
//! Disable private server for games that still have official servers.
|
||||
if (memcmp(GameID, "SC7", 3) == 0 || memcmp(GameID, "RJA", 3) == 0 ||
|
||||
@ -103,11 +102,13 @@ u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
|
||||
{
|
||||
/* Read data from DVD */
|
||||
WDVD_Read(dst, len, offset);
|
||||
// if server is wiimmfi and game is mario kart wii don't use private server. use MarioKartWiiWiimmfiPatch below
|
||||
if(private_server == PRIVSERV_WIIMMFI && memcmp("RMC", GameID, 3) == 0)// 2= wiimmfi
|
||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString, patchVidModes, aspectRatio, returnTo, patchregion, 0, deflicker, bootType);
|
||||
// if server is wiimmfi and game is mario kart wii don't patch private server here, do_new_wiimfi() patches it below.
|
||||
if(private_server == PRIVSERV_WIIMMFI && memcmp("RMC", GameID, 3) == 0)
|
||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString, patchVidModes, aspectRatio, returnTo, patchregion,
|
||||
0, NULL, deflicker, bootType);
|
||||
else
|
||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString, patchVidModes, aspectRatio, returnTo, patchregion, private_server, deflicker, bootType);
|
||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString, patchVidModes, aspectRatio, returnTo, patchregion,
|
||||
private_server, server_addr, deflicker, bootType);
|
||||
|
||||
DCFlushRange(dst, len);
|
||||
ICInvalidateRange(dst, len);
|
||||
@ -126,13 +127,20 @@ u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
|
||||
if(private_server != PRIVSERV_WIIMMFI)
|
||||
Patch_23400_and_MKWii_vulnerability();
|
||||
|
||||
WiimmfiPatch(private_server);// only done if wiimfi server and game is mario kart wii
|
||||
else //wiimmfi patch
|
||||
{
|
||||
if(memcmp("RMC", GameID, 3) != 0)// This isn't MKWii, perform the patch for other games.
|
||||
do_new_wiimmfi_nonMKWii();
|
||||
else // This is MKWii, perform the known patch from 2018.
|
||||
do_new_wiimmfi();
|
||||
}
|
||||
|
||||
/* Set entry point from apploader */
|
||||
return (u32)appldr_final();
|
||||
}
|
||||
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion , u8 private_server, u8 deflicker, u8 bootType)
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio,
|
||||
u32 returnTo, bool patchregion , u8 private_server, const char *serverAddr, u8 deflicker, u8 bootType)
|
||||
{
|
||||
u8 vfilter_off[7] = {0, 0, 21, 22, 21, 0, 0};
|
||||
u8 vfilter_low[7] = {4, 4, 16, 16, 16, 4, 4};
|
||||
@ -166,7 +174,7 @@ void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipa
|
||||
if(patchregion)
|
||||
PatchRegion(dst, len);
|
||||
if(private_server)
|
||||
PrivateServerPatcher(dst,len, private_server);
|
||||
PrivateServerPatcher(dst, len, private_server, serverAddr);
|
||||
|
||||
if(deflicker == DEFLICKER_ON_LOW)
|
||||
{
|
||||
@ -222,21 +230,6 @@ static void Anti_002_fix(void *Address, int Size)
|
||||
}
|
||||
}
|
||||
|
||||
static void WiimmfiPatch(u8 server)
|
||||
{
|
||||
|
||||
if (server != PRIVSERV_WIIMMFI) return; // no Wiimmfi Patch needed
|
||||
|
||||
if(memcmp("RMC", GameID, 3) != 0) {
|
||||
// This isn't MKWii, perform the patch for other games.
|
||||
do_new_wiimmfi_nonMKWii();
|
||||
}
|
||||
else {
|
||||
// This is MKWii, perform the known patch from 2018.
|
||||
do_new_wiimmfi();
|
||||
}
|
||||
}
|
||||
|
||||
static void PrinceOfPersiaPatch()
|
||||
{
|
||||
if(memcmp("SPX", GameID, 3) != 0 && memcmp("RPW", GameID, 3) != 0)
|
||||
|
@ -7,7 +7,7 @@ extern "C" {
|
||||
|
||||
/* Prototypes */
|
||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo,
|
||||
bool patchregion, u8 private_server, bool patchFix480p, u8 deflicker, u8 bootType);
|
||||
bool patchregion, u8 private_server, const char * server_addr, bool patchFix480p, u8 deflicker, u8 bootType);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ int main()
|
||||
normalCFG.patchVidMode = 1; //progressive mode requires this
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
AppEntrypoint = Apploader_Run(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString, normalCFG.patchVidMode, normalCFG.aspectRatio,
|
||||
normalCFG.returnTo, normalCFG.patchregion, normalCFG.private_server, normalCFG.patchFix480p, normalCFG.deflicker, normalCFG.BootType);
|
||||
normalCFG.returnTo, normalCFG.patchregion, normalCFG.private_server, normalCFG.server_addr, normalCFG.patchFix480p, normalCFG.deflicker, normalCFG.BootType);
|
||||
WDVD_Close();
|
||||
}
|
||||
else if(normalCFG.BootType == TYPE_CHANNEL)
|
||||
@ -117,7 +117,7 @@ int main()
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
AppEntrypoint = LoadChannel(normalCFG.title, normalCFG.use_dol, &GameIOS);
|
||||
PatchChannel(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString, normalCFG.patchVidMode, normalCFG.aspectRatio,
|
||||
normalCFG.private_server, normalCFG.patchFix480p, normalCFG.deflicker, normalCFG.BootType);
|
||||
normalCFG.private_server, normalCFG.server_addr, normalCFG.patchFix480p, normalCFG.deflicker, normalCFG.BootType);
|
||||
ISFS_Deinitialize();
|
||||
}
|
||||
gprintf("Entrypoint: %08x, Requested Game IOS: %i\n", AppEntrypoint, GameIOS);
|
||||
|
@ -657,7 +657,7 @@ void PatchRegion(void *Address, int Size)
|
||||
}
|
||||
|
||||
/** Patch URLs for private Servers - Thanks to ULGX **/
|
||||
void PrivateServerPatcher(void *addr, u32 len, u8 private_server)
|
||||
void PrivateServerPatcher(void *addr, u32 len, u8 private_server, const char *serverAddr)
|
||||
{
|
||||
// Patch protocol https -> http
|
||||
char *cur = (char *)addr;
|
||||
@ -675,6 +675,8 @@ void PrivateServerPatcher(void *addr, u32 len, u8 private_server)
|
||||
while (++cur < end);
|
||||
if(private_server == PRIVSERV_WIIMMFI)
|
||||
domainpatcher(addr, len, "wiimmfi.de");
|
||||
else if (private_server > PRIVSERV_WIIMMFI && strlen(serverAddr) > 3)
|
||||
domainpatcher(addr, len, serverAddr);
|
||||
}
|
||||
|
||||
void domainpatcher(void *addr, u32 len, const char* domain)
|
||||
@ -1099,7 +1101,7 @@ u32 do_new_wiimmfi() {
|
||||
strncpy(patched, (char *)&patcher, 42);
|
||||
|
||||
// Do the plain old patching with the string search
|
||||
PrivateServerPatcher((void*)0x80004000, 0x385200, PRIVSERV_WIIMMFI);
|
||||
PrivateServerPatcher((void*)0x80004000, 0x385200, PRIVSERV_WIIMMFI, NULL);
|
||||
|
||||
// Replace some URLs for Wiimmfi's new update system
|
||||
char newURL1[] = "http://ca.nas.wiimmfi.de/ca";
|
||||
|
@ -46,7 +46,7 @@ void PatchRegion(void *Address, int Size);
|
||||
void PatchFix480p();
|
||||
u32 do_new_wiimmfi();
|
||||
u32 do_new_wiimmfi_nonMKWii();
|
||||
void PrivateServerPatcher(void *addr, u32 len, u8 private_server);
|
||||
void PrivateServerPatcher(void *addr, u32 len, u8 private_server, const char *serverAddr);
|
||||
void domainpatcher(void *addr, u32 len, const char* domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -50,6 +50,7 @@ struct the_CFG {
|
||||
bool patchFix480p;
|
||||
u8 deflicker;
|
||||
u8 private_server;
|
||||
char server_addr[24];
|
||||
u8 *cheats;
|
||||
u32 cheatSize;
|
||||
u8 debugger;
|
||||
|
@ -61,8 +61,8 @@ extern u32 *gameconf;
|
||||
u8 *booter_ptr = NULL;
|
||||
u32 booter_size = 0;
|
||||
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, s8 aspectRatio, u8 private_server, bool patchFix480p,
|
||||
u8 deflicker, u32 returnTo, u8 BootType, bool use_led)
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, s8 aspectRatio, u8 private_server, const char *server_addr,
|
||||
bool patchFix480p, u8 deflicker, u32 returnTo, u8 BootType, bool use_led)
|
||||
{
|
||||
normalCFG.vidMode = vidMode;
|
||||
normalCFG.vipatch = vipatch;
|
||||
@ -70,6 +70,7 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
|
||||
normalCFG.patchVidMode = patchVidMode;
|
||||
normalCFG.aspectRatio = aspectRatio;
|
||||
normalCFG.private_server = private_server;
|
||||
strncpy(normalCFG.server_addr, server_addr, 23);
|
||||
normalCFG.patchFix480p = patchFix480p;
|
||||
normalCFG.deflicker = deflicker;
|
||||
normalCFG.returnTo = returnTo;
|
||||
|
@ -28,8 +28,8 @@ extern u32 hooktype;
|
||||
}
|
||||
#endif
|
||||
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, s8 aspectRatio, u8 private_server, bool patchFix480p,
|
||||
u8 deflicker, u32 returnTo, u8 BootType, bool use_led);
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, s8 aspectRatio, u8 private_server, const char *server_addr,
|
||||
bool patchFix480p, u8 deflicker, u32 returnTo, u8 BootType, bool use_led);
|
||||
bool ExternalBooter_LoadBins(const char *binDir);
|
||||
void ExternalBooter_ChannelSetup(u64 title, bool dol);
|
||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, bool patchregion, const char *ID);
|
||||
|
@ -332,6 +332,7 @@ void CMenu::_hideGameSettingsPg(bool instant)
|
||||
|
||||
void CMenu::_showGameSettings()
|
||||
{
|
||||
vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|');
|
||||
u32 i;
|
||||
char id[74];
|
||||
memset(id, 0, 74);
|
||||
@ -667,7 +668,10 @@ void CMenu::_showGameSettings()
|
||||
m_btnMgr.setText(m_gameSettingsBtnVipatch, _optBoolToString(m_gcfg2.getOptBool(id, "vipatch", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnCountryPatch, _optBoolToString(m_gcfg2.getOptBool(id, "country_patch", 0)));
|
||||
i = min(m_gcfg2.getUInt(id, "private_server", 0), ARRAY_SIZE(CMenu::_privateServer) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblPrivateServerVal, _t(CMenu::_privateServer[i].id, CMenu::_privateServer[i].text));
|
||||
if(i < 3)
|
||||
m_btnMgr.setText(m_gameSettingsLblPrivateServerVal, _t(CMenu::_privateServer[i].id, CMenu::_privateServer[i].text));
|
||||
else
|
||||
m_btnMgr.setText(m_gameSettingsLblPrivateServerVal, custom_servers[i - 3]);//wstringEx()
|
||||
|
||||
m_btnMgr.setText(m_gameSettingsBtnFix480p, _optBoolToString(m_gcfg2.getOptBool(id, "fix480p", 2)));
|
||||
|
||||
@ -717,6 +721,7 @@ void CMenu::_showGameSettings()
|
||||
|
||||
void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc)
|
||||
{
|
||||
vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|');
|
||||
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
|
||||
GameHdr = hdr;// set for global use in other fuctions
|
||||
char id[74];
|
||||
@ -1021,7 +1026,8 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc)
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnPrivateServerP) || m_btnMgr.selected(m_gameSettingsBtnPrivateServerM))
|
||||
{
|
||||
s8 direction = m_btnMgr.selected(m_gameSettingsBtnPrivateServerP) ? 1 : -1;
|
||||
m_gcfg2.setInt(id, "private_server", loopNum(m_gcfg2.getUInt(id, "private_server") + direction, ARRAY_SIZE(CMenu::_privateServer)));
|
||||
u8 val = loopNum(m_gcfg2.getUInt(id, "private_server") + direction, ARRAY_SIZE(CMenu::_privateServer) + custom_servers.size());
|
||||
m_gcfg2.setUInt(id, "private_server", val);
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnFix480p))
|
||||
|
@ -779,6 +779,12 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
u8 patchVidMode = min(m_gcfg2.getUInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
|
||||
s8 aspectRatio = min(m_gcfg2.getUInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1) - 1;// -1,0,1
|
||||
u8 private_server = m_gcfg2.getUInt(id, "private_server", 0);
|
||||
string server_addr = "";
|
||||
if(private_server > 2)
|
||||
{
|
||||
vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|');
|
||||
server_addr = m_cfg.getString("custom_servers", fmt("%s_url", custom_servers[private_server - 3]), "");
|
||||
}
|
||||
int fix480pVal = m_gcfg2.getOptBool(id, "fix480p", 2);
|
||||
bool fix480p = fix480pVal == 0 ? false : (fix480pVal == 1 ? true : m_cfg.getBool(WII_DOMAIN, "fix480p", false));
|
||||
u8 deflicker = min(m_gcfg2.getUInt(id, "deflicker_wii", 0), ARRAY_SIZE(CMenu::_DeflickerOptions) - 1u);
|
||||
@ -911,7 +917,8 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
Identify(gameTitle);
|
||||
|
||||
ExternalBooter_ChannelSetup(gameTitle, use_dol);
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, private_server, fix480p, deflicker, 0, TYPE_CHANNEL, use_led);
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, private_server, server_addr.c_str(),
|
||||
fix480p, deflicker, 0, TYPE_CHANNEL, use_led);
|
||||
}
|
||||
Sys_Exit();
|
||||
}
|
||||
@ -985,6 +992,12 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg)
|
||||
bool vipatch = m_gcfg2.getBool(id, "vipatch", false);
|
||||
bool countryPatch = m_gcfg2.getBool(id, "country_patch", false);
|
||||
u8 private_server = m_gcfg2.getUInt(id, "private_server", 0);
|
||||
string server_addr = "";
|
||||
if(private_server > 2)
|
||||
{
|
||||
vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|');
|
||||
server_addr = m_cfg.getString("custom_servers", fmt("%s_url", custom_servers[private_server - 3]), "");
|
||||
}
|
||||
int fix480pVal = m_gcfg2.getOptBool(id, "fix480p", 2);
|
||||
bool fix480p = fix480pVal == 0 ? false : (fix480pVal == 1 ? true : m_cfg.getBool(WII_DOMAIN, "fix480p", false));
|
||||
|
||||
@ -1176,7 +1189,8 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg)
|
||||
}
|
||||
|
||||
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, patchregion, id.c_str());
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, private_server, fix480p, deflicker, returnTo, TYPE_WII_GAME, use_led);
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, private_server, server_addr.c_str(),
|
||||
fix480p, deflicker, returnTo, TYPE_WII_GAME, use_led);
|
||||
|
||||
Sys_Exit();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user