From e1406a592106b28442019a6cd758d7fbad570f9c Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sat, 28 Jul 2012 16:41:48 +0000 Subject: [PATCH] -update wiiflow stub (thanks alot to megazig for it!) -devolution will now return to wiiflow using the hidden channel -added megazig to thanks list -allocating memory for devolution instead of using a fixed position (seems to work just fine now) --- data/stub.bin | Bin 1240 -> 4132 bytes source/defines.h | 2 +- source/gc/gc.c | 30 +++++++++++++++--------------- source/homebrew/homebrew.cpp | 26 ++------------------------ source/homebrew/homebrew.h | 3 ++- source/menu/menu_game.cpp | 12 +++++------- 6 files changed, 25 insertions(+), 48 deletions(-) diff --git a/data/stub.bin b/data/stub.bin index c2baa1cbbea180dc3cbecefdd57da59a2bb8041e..6c1e3eb544abcb57425413065aac6d6726205e96 100644 GIT binary patch literal 4132 zcmb7HeM}qY8Gp`p-~h8Zog0}#gGrcT8X{7SNJlZsk>w9FqAArJQE5|i?2HntG$l)z zj_`snm}rffN=~V?rUgRQ#8RY8YNhUvNegw=rfSt8b<--fTiZG7x`C=mRAo{&0=M6D zcQ(`sZD;AH_r2$yulMwmxL)b9w4bXs+pwe zp;%m}S#ipnWgf+(-9ir=V%VEKK$M7Tv{}>r2{EvYXQ^2+!^HBMo}(g-^#{^faSsp# zwg4gEKA;ZR3Iv|QdmspG0YboiKpn94DO-1xOcEqr782kAynqkb1e5{gfDBXsl|U8X z2daT@0pFG`+dgXKiJCauc)cZ#!*&K30-j4dcJu&6#{(pe!*&K30-kexP&9fVYUUi- zQ;>PSL}nPg&%6F=Vry%kl7w0$OZfUo!0CjHQ) za6DU{ieFirRdnmNxa!S5np(m(+rd$T1r=3yf^ z@frmtE`bN~!uTvJ1TX}g0!DyQ0Dfq?$F6T-{4I8Gn7z2A`Sx&pw}hUb%QSraLh(@1VtX-=iEW zmMhAa)&^#iNYxr_1G(ERG^vsI=!rc*SL%~xgK32tDCPyVlF&?wdp&;?LyiqQH(WzH zjWUg&ZJ*a{-s-ljkGRefTnEf!*IfC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1xWu_#%c zzre|yfbLH0NfpY-6(*1y26NH5V3uKc_*1tu5UEYt69aF)+&YB^|G;_}UKdgy z_85Bv`kNc%xY+BszaDhl^PP@+X|Ln9EvLHsuw$`@wGMa}UQ5vz@$rDGZ}wRqLdz=7 zI~sNJvq-B?Azt*zT>)si`lCL}N8I~r9o0AfPKht#NwJbP$*Gn75)jXeH_^2I$bfsc zz1ERIeF*Wojzs+wQj;Fi^(7=(za;Y(FNj?k@mnj!yTN?G|BWr}t%k&9R`wO-L@VDv z=kt9SGs4(;o}5?fEKg9+n0UnZzlw8d(`!dkUh{#&_^V0>L}R5xp}KcObS5W<0Cick zwiEOOWAH+S}c%tH3IAE1u* z`!CGgcs}#4JF<^5^Wvh+y0s#;#It_#r$^#)mqaG<-sQY<@y?G#7Bsq5`2i=6=Db2b5(MszTC;4 m5*H^<`Ubli?Cml@k2HG5Z>V+j**^3AsfXFh=m*)+bNCktYqH7! diff --git a/source/defines.h b/source/defines.h index 3b40fad1..bc106b79 100644 --- a/source/defines.h +++ b/source/defines.h @@ -32,7 +32,7 @@ Celtiore, Jiiwah, FluffyKiwi, Roku93, Yardape8000, \ Spayrosam, Bluescreen81, Chappy23, fledge68, \ BlindDude, Bubba, DJTaz, OggZee, entropy, \ -Usptactical, WiiPower, Hermes, Spidy1000, \ +Usptactical, WiiPower, Hermes, Spidy1000, megazig, \ Dimok, Kovani, Drexyl, DvZ, Etheboss, stfour, \ GaiaKnight, nibb, NJ7, Plasma, Pakatus, giantpune, \ wolf, ravmn, spidercaleb, Ziggy34, xFede, \ diff --git a/source/gc/gc.c b/source/gc/gc.c index 939a8858..8b00536f 100644 --- a/source/gc/gc.c +++ b/source/gc/gc.c @@ -141,7 +141,7 @@ void DML_New_WriteOptions() // Devolution -u8 *loader_bin = (u8*)0x93100000; +u8 *loader_bin = NULL; extern void __exception_closeall(); static gconfig *DEVO_CONFIG = (gconfig*)0x80000020; #define DEVO_Entry() ((void(*)(void))loader_bin)() @@ -167,7 +167,7 @@ bool DEVO_Installed(const char* path) void DEVO_ShowReport(void) { - gprintf("\n%.72s\n\n", (char *)0x93100004); + gprintf("%s\n", (char*)loader_bin + 4); } void DEVO_SetOptions(const char *isopath, const char *partition, const char *loader, const char *gameID, bool memcard_emu) @@ -177,20 +177,22 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa snprintf(loader_path, sizeof(loader_path), "%s/loader.bin", loader); FILE *f = fopen(loader_path, "rb"); if(f) - { - gprintf("Read devolution loader: \"%s\"\n", loader_path); + { + gprintf("Read Devolution Loader: \"%s\"\n", loader_path); fseek(f, 0, SEEK_END); u32 size = ftell(f); rewind(f); - memset(loader_bin, 0, size); + loader_bin = malloc(size); fread(loader_bin, 1, size, f); - DCFlushRange(loader_bin, size); fclose(f); } else - gprintf("Uh oh!! What now?\n"); - - DEVO_ShowReport(); + { + gprintf("Devolution loader.bin not found!\n"); + return; + } + + DEVO_ShowReport(); //start writing cfg to mem struct stat st; @@ -199,7 +201,7 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa stat(isopath, &st); f = fopen(isopath, "rb"); - gprintf("Read iso file: \"%s\"\n", isopath); + gprintf("Read ISO File: \"%s\"\n", isopath); fread((u8*)0x80000000, 1, 32, f); fclose(f); @@ -214,16 +216,16 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa strcpy(iso2path, isopath); char *ptz = (char *)NULL; ptz = strstr(iso2path, "game.iso"); - if(ptz != NULL) + if(ptz != NULL) strncpy(ptz, "gam1.iso", 8); - + f = fopen(iso2path, "rb"); if(f) { gprintf("Found 2nd iso file for multi DVD game: \"%s\"\n", iso2path); stat(iso2path, &st); DEVO_CONFIG->disc2_cluster = st.st_ino; - fclose(f); + fclose(f); } // make sure these directories exist, they are required for Devolution to function correctly @@ -281,8 +283,6 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa void DEVO_Boot() { u32 cookie; - puts((const char*)loader_bin + 4); - gprintf("WiiFlow GC: Devolution initialized. Booting game...\n"); /* cleaning up and load dol */ SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); diff --git a/source/homebrew/homebrew.cpp b/source/homebrew/homebrew.cpp index 264698fc..ecf834db 100644 --- a/source/homebrew/homebrew.cpp +++ b/source/homebrew/homebrew.cpp @@ -28,9 +28,6 @@ u32 buffer_size = 0; static vector Arguments; -static u32 stubtitlepositions[8] = { 0x80001bf2, 0x80001bf3, 0x80001c06, 0x80001c07, - 0x80001bfa, 0x80001bfb, 0x80001c0a, 0x80001c0b }; - bool IsDollZ (u8 *buff) { u8 dollz_stamp[] = {0x3C}; @@ -109,37 +106,18 @@ static int SetupARGV(struct __argv * args) return 0; } -static void writeStub(u64 chan_title) +void writeStub() { - u8 i; - u32 digit; - char title[2][9]; - snprintf(title[0], sizeof(title[0]), "%08x", TITLE_UPPER(chan_title)); - snprintf(title[1], sizeof(title[1]), "%08x", TITLE_LOWER(chan_title)); - /* Clear potential homebrew channel stub */ memset((void*)0x80001800, 0, 0x1800); /* Copy our own stub into memory */ memcpy((void*)0x80001800, stub_bin, stub_bin_size); - - /* Write in the Title ID we got */ - for(i = 0; i < 4; i++) - { - sscanf(&title[0][i*2], "%02x", &digit); - //gprintf("%x\n", digit); - *(vu8*)stubtitlepositions[i] = digit; - sscanf(&title[1][i*2], "%02x", &digit); - //gprintf("%x\n", digit); - *(vu8*)stubtitlepositions[i+4] = digit; - } - DCFlushRange((void*)0x80001800, stub_bin_size); } -int BootHomebrew(u64 chan_title) +int BootHomebrew() { - writeStub(chan_title); struct __argv args; if (!IsDollZ(EXECUTE_ADDR)) SetupARGV(&args); diff --git a/source/homebrew/homebrew.h b/source/homebrew/homebrew.h index 38fe52e8..7a7f8515 100644 --- a/source/homebrew/homebrew.h +++ b/source/homebrew/homebrew.h @@ -1,8 +1,9 @@ #ifndef _BOOTHOMEBREW_H_ #define _BOOTHOMEBREW_H_ -int BootHomebrew(u64 chan_title); +int BootHomebrew(); void AddBootArgument(const char * arg); int LoadHomebrew(const char * filepath); +void writeStub(); #endif diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 5a787d10..34bcc1a3 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -876,8 +876,10 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) GC_SetVideoMode(videoMode, videoSetting); GC_SetLanguage(GClanguage); if(loader == 2) + { + writeStub(); DEVO_Boot(); - + } DML_New_WriteOptions(); WII_Initialize(); if(WII_LaunchTitle(0x100000100LL) < 0) @@ -888,11 +890,6 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) { Nand::Instance()->Disable_Emu(); - Channels channel; - u64 title = SYSTEM_MENU; - if(channel.GetRequestedIOS(RETURN_CHANNEL) != 0) - title = RETURN_CHANNEL; - m_gcfg1.save(true); m_gcfg2.save(true); m_cat.save(true); @@ -911,7 +908,8 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) USBStorage2_Deinit(); USB_Deinitialize(); #endif - BootHomebrew(title); + writeStub(); + BootHomebrew(); } int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool emu_channel)