mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-more work on the new wii game loader, hopefully you can use
cheats, save emu, nsmbw + pop patch, wanin cios and hermes cios, and return to wiiflow again (works here with d2x again) -fixed some important stuff in wiiflow itself, less corruption of the dol and more static stuff to get it back to stability
This commit is contained in:
parent
bb1774e2c3
commit
d61801fd3e
@ -54,7 +54,7 @@ ios := 249
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS = -g -ggdb -Os -Wall -Wno-multichar -Wno-unused-parameter -Wextra $(MACHDEP) $(INCLUDE) -DBUILD_IOS=$(IOS)
|
||||
CFLAGS = -g -ggdb -O1 -Wall -Wno-multichar -Wno-unused-parameter -Wextra $(MACHDEP) $(INCLUDE) -DBUILD_IOS=$(IOS)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size
|
||||
|
||||
@ -88,8 +88,6 @@ export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
SVNREV := $(shell bash ./scripts/svnrev.sh)
|
||||
IOSTYPE := $(shell bash ./scripts/buildtype.sh $(ios))
|
||||
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
@ -141,6 +139,8 @@ export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@bash ./scripts/svnrev.sh
|
||||
@bash ./scripts/buildtype.sh $(ios)
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.main
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -150,7 +150,7 @@ all:
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol $(CURDIR)/source/svnrev.h $(CURDIR)/source/loader/alt_ios_gen.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
@ -21,9 +21,11 @@ ASFLAGS = -D_LANGUAGE_ASSEMBLY -DHW_RVL -DTINY
|
||||
TARGET_LINKED = boot.elf
|
||||
TARGET = booter.bin
|
||||
|
||||
CFILES = apploader.c cios.c cache.c debug.c di.c disc.c ios.c patchcode.c usb.c utils.c main.c
|
||||
CFILES = apploader.c cios.c cache.c debug.c di.c disc.c ios.c patchcode.c usb.c utils.c video.c \
|
||||
fst.c multidol.c wip.c main.c
|
||||
#OBJS = crt0.o _all.o
|
||||
OBJS = crt0.o apploader.o cios.o cache.o debug.o di.o disc.o ios.o patchcode.o patchhook.o usb.o utils.o main.o
|
||||
OBJS = crt0.o apploader.o cios.o cache.o debug.o di.o disc.o ios.o patchcode.o patchhook.o usb.o utils.o video.o \
|
||||
fst.o multidol.o wip.o main.o
|
||||
|
||||
DEPDIR = .deps
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "di.h"
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "video.h"
|
||||
|
||||
/* Apploader function pointers */
|
||||
typedef int (*app_main)(void **dst, int *size, int *offset);
|
||||
@ -26,9 +27,10 @@ void maindolpatches(void *dst, int len, u8 vidMode, u8 vipatch, u8 countryString
|
||||
static void patch_NoDiscinDrive(void *buffer, u32 len);
|
||||
static void Anti_002_fix(void *Address, int Size);
|
||||
static u8 Remove_001_Protection(void *Address, int Size);
|
||||
//static u8 PrinceOfPersiaPatch();
|
||||
//static u8 NewSuperMarioBrosPatch();
|
||||
static u8 PrinceOfPersiaPatch();
|
||||
static u8 NewSuperMarioBrosPatch();
|
||||
u8 hookpatched = 0;
|
||||
u8 wip_needed = 0;
|
||||
|
||||
static void simple_report(const char *fmt, ...)
|
||||
{
|
||||
@ -37,12 +39,25 @@ static void simple_report(const char *fmt, ...)
|
||||
|
||||
u32 Apploader_Run(u8 vidMode, u8 vipatch, u8 countryString, u8 patchVidModes, int aspectRatio, u32 returnTo)
|
||||
{
|
||||
void *dst = NULL;
|
||||
int len = 0;
|
||||
int offset = 0;
|
||||
u32 appldr_len;
|
||||
/* Check if WIP patches are needed */
|
||||
if(PrinceOfPersiaPatch() == 1)
|
||||
{
|
||||
debug_string("PoP patch\n");
|
||||
wip_needed = 1;
|
||||
}
|
||||
else if(NewSuperMarioBrosPatch() == 1)
|
||||
{
|
||||
debug_string("NSMBW patch\n");
|
||||
wip_needed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_string("No WIP patch\n");
|
||||
wip_needed = 0;
|
||||
}
|
||||
/* Variables */
|
||||
s32 ret;
|
||||
u32 Entry = 0;
|
||||
u32 appldr_len;
|
||||
app_init appldr_init;
|
||||
app_main appldr_main;
|
||||
app_final appldr_final;
|
||||
@ -50,7 +65,7 @@ u32 Apploader_Run(u8 vidMode, u8 vipatch, u8 countryString, u8 patchVidModes, in
|
||||
/* Read apploader header */
|
||||
ret = di_read(buffer, 0x20, 0x910);
|
||||
if(ret < 0)
|
||||
return Entry;
|
||||
return ret;
|
||||
|
||||
/* Calculate apploader length */
|
||||
appldr_len = buffer[5] + buffer[6];
|
||||
@ -72,49 +87,48 @@ u32 Apploader_Run(u8 vidMode, u8 vipatch, u8 countryString, u8 patchVidModes, in
|
||||
/* Initialize apploader */
|
||||
appldr_init(simple_report);
|
||||
|
||||
void *dst = NULL;
|
||||
int len = 0;
|
||||
int offset = 0;
|
||||
while(appldr_main(&dst, &len, &offset))
|
||||
{
|
||||
/* Read data from DVD */
|
||||
di_read(dst, len, offset);
|
||||
maindolpatches(dst, len, vidMode, vipatch, countryString, patchVidModes, aspectRatio, returnTo);
|
||||
sync_after_write(dst, len);
|
||||
prog10();
|
||||
}
|
||||
|
||||
/*free_wip();
|
||||
if(hooktype != 0 && hookpatched)
|
||||
ocarina_do_code(0);*/
|
||||
|
||||
if(wip_needed == 1)
|
||||
free_wip();
|
||||
if(hooktype != 0 && hookpatched == 1)
|
||||
ocarina_do_code(0);
|
||||
/* Set entry point from apploader */
|
||||
//*entry = appldr_final();
|
||||
Entry = (u32)appldr_final();
|
||||
|
||||
return Entry;
|
||||
return (u32)appldr_final();
|
||||
}
|
||||
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, u8 vipatch, u8 countryString, u8 patchVidModes, int aspectRatio, u32 returnTo)
|
||||
{
|
||||
//PrinceOfPersiaPatch();
|
||||
//NewSuperMarioBrosPatch();
|
||||
// Patch NoDiscInDrive only for IOS 249 < rev13 or IOS 222/223/224
|
||||
if((CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision < 13) || CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
patch_NoDiscinDrive(dst, len);
|
||||
if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision < 13)
|
||||
Anti_002_fix(dst, len);
|
||||
Remove_001_Protection(dst, len);
|
||||
//patchVideoModes(dst, len, vidMode, vmode, patchVidModes);
|
||||
//if(conf->hooktype != 0 && dogamehooks(dst, len, 0))
|
||||
// hookpatched = 1;
|
||||
if(vipatch)
|
||||
if(hooktype != 0 && dogamehooks(dst, len, 0))
|
||||
hookpatched = 1;
|
||||
if(vipatch == 1)
|
||||
vidolpatcher(dst, len);
|
||||
if(configbytes[0] != 0xCD)
|
||||
langpatcher(dst, len);
|
||||
if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision < 13)
|
||||
Anti_002_fix(dst, len);
|
||||
//if(conf->countryString)
|
||||
// PatchCountryStrings(dst, len); // Country Patch by WiiPower
|
||||
if(aspectRatio != -1)
|
||||
PatchAspectRatio(dst, len, aspectRatio);
|
||||
if(returnTo > 0)
|
||||
PatchReturnTo(dst, len, returnTo);
|
||||
Remove_001_Protection(dst, len);
|
||||
//do_wip_code((u8 *)dst, len);
|
||||
if(wip_needed == 1)
|
||||
do_wip_code((u8*)dst, len);
|
||||
}
|
||||
|
||||
static void patch_NoDiscinDrive(void *buffer, u32 len)
|
||||
@ -145,12 +159,12 @@ static void Anti_002_fix(void *Address, int Size)
|
||||
Addr += 4;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
static u8 PrinceOfPersiaPatch()
|
||||
{
|
||||
if (memcmp("SPX", (char *) 0x80000000, 3) != 0 && memcmp("RPW", (char *) 0x80000000, 3) != 0)
|
||||
if(memcmp("SPX", (char *)0x80000000, 3) != 0 && memcmp("RPW", (char *) 0x80000000, 3) != 0)
|
||||
return 0;
|
||||
|
||||
WIP_Code CodeList[5*sizeof(WIP_Code)];
|
||||
CodeList[0].offset = 0x007AAC6A;
|
||||
CodeList[0].srcaddress = 0x7A6B6F6A;
|
||||
@ -167,10 +181,7 @@ static u8 PrinceOfPersiaPatch()
|
||||
CodeList[4].offset = 0x007AAC9D;
|
||||
CodeList[4].srcaddress = 0x82806F3F;
|
||||
CodeList[4].dstaddress = 0x6F3F8280;
|
||||
|
||||
if (set_wip_list(CodeList, 5) == 0)
|
||||
return 0;
|
||||
|
||||
set_wip_list(CodeList, 5);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -178,7 +189,7 @@ static u8 NewSuperMarioBrosPatch()
|
||||
{
|
||||
WIP_Code CodeList[3 * sizeof(WIP_Code)];
|
||||
|
||||
if (memcmp("SMNE01", (char *) 0x80000000, 6) == 0)
|
||||
if(memcmp("SMNE01", (char *) 0x80000000, 6) == 0)
|
||||
{
|
||||
CodeList[0].offset = 0x001AB610;
|
||||
CodeList[0].srcaddress = 0x9421FFD0;
|
||||
@ -189,8 +200,10 @@ static u8 NewSuperMarioBrosPatch()
|
||||
CodeList[2].offset = 0x001CED6B;
|
||||
CodeList[2].srcaddress = 0xDA000000;
|
||||
CodeList[2].dstaddress = 0x71000000;
|
||||
set_wip_list(CodeList, 3);
|
||||
return 1;
|
||||
}
|
||||
else if (memcmp("SMNP01", (char *) 0x80000000, 6) == 0)
|
||||
else if(memcmp("SMNP01", (char *) 0x80000000, 6) == 0)
|
||||
{
|
||||
CodeList[0].offset = 0x001AB750;
|
||||
CodeList[0].srcaddress = 0x9421FFD0;
|
||||
@ -201,8 +214,10 @@ static u8 NewSuperMarioBrosPatch()
|
||||
CodeList[2].offset = 0x001CEEA8;
|
||||
CodeList[2].srcaddress = 0x388000DA;
|
||||
CodeList[2].dstaddress = 0x38800071;
|
||||
set_wip_list(CodeList, 3);
|
||||
return 1;
|
||||
}
|
||||
else if (memcmp("SMNJ01", (char *) 0x80000000, 6) == 0)
|
||||
else if(memcmp("SMNJ01", (char *) 0x80000000, 6) == 0)
|
||||
{
|
||||
CodeList[0].offset = 0x001AB420;
|
||||
CodeList[0].srcaddress = 0x9421FFD0;
|
||||
@ -213,12 +228,12 @@ static u8 NewSuperMarioBrosPatch()
|
||||
CodeList[2].offset = 0x001CEB7B;
|
||||
CodeList[2].srcaddress = 0xDA000000;
|
||||
CodeList[2].dstaddress = 0x71000000;
|
||||
}
|
||||
if(set_wip_list(CodeList, 3) == 0)
|
||||
return 0;
|
||||
set_wip_list(CodeList, 3);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
static u8 Remove_001_Protection(void *Address, int Size)
|
||||
{
|
||||
static const u8 SearchPattern[] = {0x40, 0x82, 0x00, 0x0C, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18};
|
||||
|
@ -183,9 +183,8 @@ int di_readdiscid(void *dst)
|
||||
int WDVD_SetFragList(int device, void *fraglist, int size)
|
||||
{
|
||||
debug_string("WDVD_SetFragList\n");
|
||||
debug_uint(device);
|
||||
debug_uint((u32)fraglist);
|
||||
debug_uint(size);
|
||||
memset(inbuf, 0, 0x20);
|
||||
|
||||
/* Set FRAG mode */
|
||||
inbuf[0] = 0xF9000000;
|
||||
inbuf[1] = device;
|
||||
|
@ -18,15 +18,10 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gccore.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <ogc/ipc.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
#include "cache.h"
|
||||
#include "fst.h"
|
||||
|
||||
#include "patchcode.h"
|
||||
#include "codehandler.h"
|
||||
#include "codehandleronly.h"
|
||||
@ -104,7 +99,7 @@ void app_pokevalues()
|
||||
*((u32 *) (*(gameconf + i + 1))) == *(gameconf + i + 2))
|
||||
{
|
||||
*((u32 *) (*(gameconf + i + 3))) = *(gameconf + i + 4);
|
||||
DCFlushRange((void *) *(gameconf + i + 3), 4);
|
||||
sync_after_write((void *) *(gameconf + i + 3), 4);
|
||||
}
|
||||
i += 4;
|
||||
}
|
||||
@ -154,7 +149,7 @@ void load_handler()
|
||||
memcpy((void*)0x80001CE2, ((u8*) &codelist) + 2, 2);
|
||||
memcpy((void*)0x80001F5A, &codelist, 2);
|
||||
memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
|
||||
DCFlushRange((void*)0x80001800,codehandler_size);
|
||||
sync_after_write((void*)0x80001800,codehandler_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -163,13 +158,13 @@ void load_handler()
|
||||
memcpy((void*)0x80001800,codehandleronly,codehandleronly_size);
|
||||
memcpy((void*)0x80001906, &codelist, 2);
|
||||
memcpy((void*)0x8000190A, ((u8*) &codelist) + 2, 2);
|
||||
DCFlushRange((void*)0x80001800,codehandleronly_size);
|
||||
sync_after_write((void*)0x80001800,codehandleronly_size);
|
||||
}
|
||||
|
||||
// Load multidol handler
|
||||
memset((void*)0x80001000,0,multidol_size);
|
||||
memcpy((void*)0x80001000,multidol,multidol_size);
|
||||
DCFlushRange((void*)0x80001000,multidol_size);
|
||||
sync_after_write((void*)0x80001000,multidol_size);
|
||||
switch(hooktype)
|
||||
{
|
||||
case 0x01:
|
||||
@ -216,7 +211,7 @@ void load_handler()
|
||||
//memcpy((void*)0x80001198,wpadbuttonsdown2hooks+3,4);
|
||||
break;
|
||||
}
|
||||
DCFlushRange((void*)0x80001198,16);
|
||||
sync_after_write((void*)0x80001198,16);
|
||||
}
|
||||
memcpy((void *)0x80001800, (void*)0x80000000, 6);
|
||||
}
|
||||
@ -241,7 +236,7 @@ int ocarina_do_code(u64 chantitle)
|
||||
if(chantitle != 0)
|
||||
{
|
||||
memcpy((void *)0x80001800, gameidbuffer, 8);
|
||||
DCFlushRange((void *)0x80001800, 8);
|
||||
sync_after_write((void *)0x80001800, 8);
|
||||
}
|
||||
|
||||
if(codelist)
|
||||
@ -251,7 +246,7 @@ int ocarina_do_code(u64 chantitle)
|
||||
if(code_size > 0 && code_buf)
|
||||
{
|
||||
memcpy(codelist, code_buf, code_size);
|
||||
DCFlushRange(codelist, (u32)codelistend - (u32)codelist);
|
||||
sync_after_write(codelist, (u32)codelistend - (u32)codelist);
|
||||
}
|
||||
|
||||
// TODO What's this???
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "ios.h"
|
||||
#include "cache.h"
|
||||
#include "utils.h"
|
||||
#include "di.h"
|
||||
|
||||
#define virt_to_phys(x) ((u32*)(((u32)(x))&0x3FFFFFFF))
|
||||
#define phys_to_virt(x) ((u32*)(((u32)(x))|0x80000000))
|
||||
|
@ -19,23 +19,13 @@
|
||||
#include "apploader.h"
|
||||
#include "patchcode.h"
|
||||
#include "Config.h"
|
||||
|
||||
#define COLOR_BLACK 0x00800080
|
||||
#define COLOR_GRAY 0x80808080
|
||||
#define COLOR_WHITE 0xFF80FF80
|
||||
#define COLOR_RED 0x4C544CFF
|
||||
#define COLOR_GREEN 0x4B554B4A
|
||||
#define COLOR_BLUE 0x1DFF1D6B
|
||||
#define COLOR_YELLOW 0xE100E194
|
||||
|
||||
#define IOCTL_ES_LAUNCH 0x08
|
||||
#define IOCTL_ES_GETVIEWCNT 0x12
|
||||
#define IOCTL_ES_GETVIEWS 0x13
|
||||
#include "video.h"
|
||||
#include "fst.h"
|
||||
|
||||
IOS_Info CurrentIOS;
|
||||
static the_CFG *conf = (the_CFG*)0x93100000;
|
||||
|
||||
static struct ioctlv vecs[16] ALIGNED(64);
|
||||
//static struct ioctlv vecs[16] ALIGNED(64);
|
||||
static u32 disc_id[0x40] ALIGNED(32);
|
||||
static u32 AppEntrypoint = 0;
|
||||
static u8 tmd[0x5000] ALIGNED(64);
|
||||
@ -50,80 +40,11 @@ static struct {
|
||||
u32 offset;
|
||||
u32 type;
|
||||
} partition_table[32] ALIGNED(32);
|
||||
/*
|
||||
static struct
|
||||
{
|
||||
char revision[16];
|
||||
void *entry;
|
||||
s32 size;
|
||||
s32 trailersize;
|
||||
s32 padding;
|
||||
} apploader_hdr ALIGNED(32);
|
||||
*/
|
||||
static int es_fd;
|
||||
|
||||
void fail(void) __attribute__((noreturn));
|
||||
void prog10(void) __attribute__((noinline));
|
||||
//static int es_fd;
|
||||
|
||||
static int es_launchtitle(u64 titleID)
|
||||
{
|
||||
static u64 xtitleID __attribute__((aligned(32)));
|
||||
static u32 cntviews __attribute__((aligned(32)));
|
||||
static u8 tikviews[0xd8*4] __attribute__((aligned(32)));
|
||||
int ret;
|
||||
void fail(void);
|
||||
|
||||
debug_string("es_fd:");
|
||||
debug_uint(es_fd);
|
||||
debug_string("\n");
|
||||
|
||||
debug_string("LaunchTitle: ");
|
||||
debug_uint(titleID>>32);
|
||||
debug_string("-");
|
||||
debug_uint(titleID&0xFFFFFFFF);
|
||||
|
||||
xtitleID = titleID;
|
||||
|
||||
debug_string("\nGetTicketViewCount: ");
|
||||
|
||||
vecs[0].data = &xtitleID;
|
||||
vecs[0].len = 8;
|
||||
vecs[1].data = &cntviews;
|
||||
vecs[1].len = 4;
|
||||
ret = ios_ioctlv(es_fd, IOCTL_ES_GETVIEWCNT, 1, 1, vecs);
|
||||
debug_uint(ret);
|
||||
debug_string(", views: ");
|
||||
debug_uint(cntviews);
|
||||
debug_string("\n");
|
||||
if(ret<0) return ret;
|
||||
if(cntviews>4) return -1;
|
||||
|
||||
debug_string("GetTicketViews: ");
|
||||
//vecs[0].data = &xtitleID;
|
||||
//vecs[0].len = 8;
|
||||
//vecs[1].data = &cntviews;
|
||||
//vecs[1].len = 4;
|
||||
vecs[2].data = tikviews;
|
||||
vecs[2].len = 0xd8*cntviews;
|
||||
ret = ios_ioctlv(es_fd, IOCTL_ES_GETVIEWS, 2, 1, vecs);
|
||||
debug_uint(ret);
|
||||
debug_string("\n");
|
||||
if(ret<0) return ret;
|
||||
debug_string("Attempting to launch...\n");
|
||||
//vecs[0].data = &xtitleID;
|
||||
//vecs[0].len = 8;
|
||||
vecs[1].data = tikviews;
|
||||
vecs[1].len = 0xd8;
|
||||
ret = ios_ioctlvreboot(es_fd, IOCTL_ES_LAUNCH, 2, 0, vecs);
|
||||
if(ret < 0) {
|
||||
debug_string("Launch failed: ");
|
||||
debug_uint(ret);
|
||||
debug_string("\r\n");
|
||||
}
|
||||
udelay(100000);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static s32 ios_getversion() __attribute__((unused));
|
||||
static s32 ios_getversion()
|
||||
{
|
||||
u32 vercode;
|
||||
@ -143,20 +64,6 @@ static void printversion(void)
|
||||
debug_string("\n");
|
||||
}
|
||||
|
||||
static int es_init(void)
|
||||
{
|
||||
debug_string("Opening /dev/es: ");
|
||||
es_fd = ios_open("/dev/es", 0);
|
||||
debug_uint(es_fd);
|
||||
debug_string("\n");
|
||||
return es_fd;
|
||||
}
|
||||
/*
|
||||
static void simple_report(const char *fmt, ...)
|
||||
{
|
||||
debug_string(fmt);
|
||||
}
|
||||
*/
|
||||
static u8 conf_buffer[0x4000] ALIGNED(32);
|
||||
|
||||
static u32 get_counter_bias(void)
|
||||
@ -225,46 +132,11 @@ static inline void write16(u16 w, u16 addr)
|
||||
*((u16 *)(addr + 0x80000000)) = w;
|
||||
}
|
||||
|
||||
#define framebuffer ((u32*)(0x81600000))
|
||||
|
||||
void memset32(u32 *addr, u32 data, u32 count) __attribute__ ((externally_visible));
|
||||
|
||||
void memset32(u32 *addr, u32 data, u32 count)
|
||||
{
|
||||
int sc = count;
|
||||
void *sa = addr;
|
||||
while(count--)
|
||||
*addr++ = data;
|
||||
sync_after_write(sa, 4*sc);
|
||||
}
|
||||
|
||||
static void drawbar(int pix)
|
||||
{
|
||||
int i = 16;
|
||||
u32* p = framebuffer + 320 * 400;
|
||||
while(i--) {
|
||||
memset32(p, COLOR_WHITE, pix);
|
||||
p += 320;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
u32 vir(u32 addr) __attribute__((noinline));
|
||||
u32 vir(u32 addr)
|
||||
{
|
||||
return *(vu32*)(addr+0xCC002000);
|
||||
}*/
|
||||
|
||||
inline void viw(u32 addr, u32 data)
|
||||
{
|
||||
*(vu32*)(addr+0xCC002000) = data;
|
||||
}
|
||||
|
||||
void fail(void)
|
||||
{
|
||||
memset32(framebuffer, COLOR_RED, 320*100);
|
||||
debug_string("\nFAILURE\n");
|
||||
es_launchtitle(0x100014a4f4449LL);
|
||||
void (*entrypoint)(void) = (void(*)(void))0x80001800;
|
||||
entrypoint();
|
||||
while(1);
|
||||
}
|
||||
|
||||
@ -280,21 +152,7 @@ static void failnotone(int v) {
|
||||
}
|
||||
#endif
|
||||
|
||||
int progress = 20;
|
||||
|
||||
static void prog(int p) __attribute__((noinline));
|
||||
static void prog(int p) {
|
||||
progress += p;
|
||||
drawbar(progress);
|
||||
}
|
||||
|
||||
void prog10(void) {
|
||||
prog(10);
|
||||
}
|
||||
|
||||
//#define prog10() do{}while(0)
|
||||
//#define prog(x) do{}while(0)
|
||||
|
||||
u32 hooktype;
|
||||
extern s32 wbfsDev;
|
||||
extern u32 wbfs_part_idx;
|
||||
extern FragList *frag_list;
|
||||
@ -309,52 +167,10 @@ void _main (void)
|
||||
u32 rtc2 = 1;
|
||||
u64 tbtime;
|
||||
u32 tmp;
|
||||
u32 vtrdcr;
|
||||
u32 oldvtrdcr;
|
||||
u32 vimode;
|
||||
u32 vto,vte;
|
||||
u64 oldvtovte;
|
||||
/*
|
||||
void (*app_init)(void (*report)(const char *fmt, ...));
|
||||
int (*app_main)(void **dst, int *size, int *offset);
|
||||
void *(*app_final)(void);
|
||||
void (*app_entry)(void(**init)(void (*report)(const char *fmt, ...)), int (**main)(), void *(**final)());
|
||||
*/
|
||||
|
||||
debug_string("WiiFlow External Booter by FIX94 - based on TinyLoad v0.2\n");
|
||||
|
||||
memset32(framebuffer, COLOR_BLACK, 320*574);
|
||||
memset32(framebuffer + 320 * 398, COLOR_WHITE, 320*2);
|
||||
memset32(framebuffer + 320 * 416, COLOR_WHITE, 320*2);
|
||||
|
||||
vtrdcr = oldvtrdcr = *(vu32*)(0xCC002000);
|
||||
oldvtovte = *(vu64*)0xCC00200c;
|
||||
vtrdcr &= 0xFFFFF;
|
||||
vtrdcr |= 0x0F000000;
|
||||
vimode = (vtrdcr>>8)&3;
|
||||
|
||||
vto = 0x30018;
|
||||
vte = 0x20019;
|
||||
|
||||
if(vtrdcr & 4) { // progressive
|
||||
vto = vte = 0x60030;
|
||||
vtrdcr += 0x0F000000;
|
||||
} else if(vimode == 1) {
|
||||
vto = 0x10023;
|
||||
vte = 0x24;
|
||||
vtrdcr += 0x02F00000;
|
||||
}
|
||||
viw(0x0, vtrdcr);
|
||||
viw(0xc, vto);
|
||||
viw(0x10, vte);
|
||||
|
||||
viw(0x1c, (((u32)framebuffer) >> 5) | 0x10000000);
|
||||
viw(0x24, (((u32)framebuffer) >> 5) | 0x10000000);
|
||||
|
||||
prog(0);
|
||||
|
||||
video_init();
|
||||
ipc_init();
|
||||
ios_cleanup();
|
||||
//reset_ios();
|
||||
printversion();
|
||||
|
||||
bias = get_counter_bias();
|
||||
@ -372,22 +188,23 @@ void _main (void)
|
||||
: "=&r" (tmp)
|
||||
: "b" ((u32)(tbtime >> 32)), "b" ((u32)(tbtime & 0xFFFFFFFF))
|
||||
);
|
||||
|
||||
if(es_init() < 0) {
|
||||
debug_string("es_init() failed\n");
|
||||
fail();
|
||||
}
|
||||
debug_string("Initializing DI\n");
|
||||
if(di_init() < 0) {
|
||||
debug_string("di_init() failed\n");
|
||||
fail();
|
||||
}
|
||||
prog10();
|
||||
|
||||
app_gameconfig_set(conf->gameconf, conf->gameconfsize);
|
||||
ocarina_set_codes(conf->codelist, conf->codelistend, conf->cheats, conf->cheatSize);
|
||||
debuggerselect = conf->debugger;
|
||||
hooktype = conf->hooktype;
|
||||
frag_list = conf->fragments;
|
||||
wbfsDev = conf->wbfsDevice;
|
||||
wbfs_part_idx = conf->wbfsPart;
|
||||
configbytes[0] = conf->configbytes[0];
|
||||
configbytes[1] = conf->configbytes[1];
|
||||
|
||||
if(conf->GameBootType == TYPE_WII_DISC)
|
||||
{
|
||||
Disc_SetUSB(NULL, 0);
|
||||
@ -430,7 +247,6 @@ void _main (void)
|
||||
debug_string("Reading partition table\n");
|
||||
FAILNOTONE(di_unencryptedread(partition_table, sizeof(partition_table), part_table_info.offset), "Read failed\n");
|
||||
prog10();
|
||||
|
||||
for(i=0; i<part_table_info.count; i++) {
|
||||
if(partition_table[i].type == 0) {
|
||||
break;
|
||||
@ -445,149 +261,40 @@ void _main (void)
|
||||
debug_string("\n");
|
||||
FAILNOTONE(di_openpartition(partition_table[i].offset, tmd), "Failed to open partition");
|
||||
prog10();
|
||||
|
||||
debug_string("Reloading IOS...\n");
|
||||
if(es_launchtitle(0x0000000100000000 | ios_getversion()) < 0) {
|
||||
debug_string("Failed to launch disc IOS\n");
|
||||
fail();
|
||||
}
|
||||
debug_string("IOS reloaded!\n");
|
||||
ipc_init();
|
||||
debug_string("IPC reinited.\n");
|
||||
printversion();
|
||||
if(es_init() < 0) {
|
||||
debug_string("es_init() failed\n");
|
||||
fail();
|
||||
}
|
||||
debug_string("Initializing DI\n");
|
||||
if(di_init() < 0) {
|
||||
debug_string("di_init() failed\n");
|
||||
fail();
|
||||
}
|
||||
|
||||
if(conf->GameBootType == TYPE_WII_DISC)
|
||||
{
|
||||
Disc_SetUSB(NULL, 0);
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
Hermes_Disable_EHC();
|
||||
}
|
||||
else
|
||||
{
|
||||
Disc_SetUSB((u8*)conf->gameID, conf->GameBootType == TYPE_WII_WBFS_EXT);
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
Hermes_shadow_mload(conf->mload_rev);
|
||||
}
|
||||
prog(20);
|
||||
debug_string("Reading Disc ID\n");
|
||||
FAILNOTONE(di_readdiscid(disc_id), "di_readdiscid() failed\n");
|
||||
prog10();
|
||||
debug_string("Opening partition again\n");
|
||||
FAILNOTONE(di_openpartition(partition_table[i].offset, tmd), "Failed to open partition the second time");
|
||||
prog10();
|
||||
debug_string("Reading partition header\n");
|
||||
FAILNOTONE(di_read((void*)0x80000000, 0x20, 0), "Failed to read partition header");
|
||||
prog10();
|
||||
|
||||
CurrentIOS = conf->IOS;
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
/* IOS Reload Block */
|
||||
static struct ioctlv block_vector[2] ALIGNED(32);
|
||||
static u32 mode ALIGNED(64);
|
||||
static u32 ios ALIGNED(64);
|
||||
mode = 2;
|
||||
block_vector[0].data = &mode;
|
||||
block_vector[0].len = sizeof(u32);
|
||||
ios = ios_getversion();
|
||||
block_vector[1].data = &ios;
|
||||
block_vector[1].len = sizeof(u32);
|
||||
ios_ioctlv(es_fd, 0xA0, 2, 0, block_vector);
|
||||
/* Return to */
|
||||
if(conf->returnTo > 0)
|
||||
{
|
||||
debug_string("Return to d2x way, ID:"); debug_uint(conf->returnTo); debug_string("\n");
|
||||
static u64 sm_title_id[1] ALIGNED(64);
|
||||
static struct ioctlv rtn_vector[1] ALIGNED(64);
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (conf->returnTo & 0xFFFFFFFF));
|
||||
rtn_vector[0].data = sm_title_id;
|
||||
rtn_vector[0].len = sizeof(u64);
|
||||
ios_ioctlv(es_fd, 0xA1, 1, 0, rtn_vector);
|
||||
memset(&conf->returnTo, 0, sizeof(u32));
|
||||
}
|
||||
}
|
||||
AppEntrypoint = Apploader_Run(conf->vidMode, conf->vipatch, conf->countryString,
|
||||
conf->patchVidMode, conf->aspectRatio, conf->returnTo);
|
||||
/*debug_string("Reading apploader header\n");
|
||||
FAILNOTONE(di_read(&apploader_hdr, 0x20, 0x910), "Failed to read apploader header");
|
||||
prog10();
|
||||
debug_string("Reading apploader\n");
|
||||
FAILNOTONE(di_read((void*)0x81200000, apploader_hdr.size+apploader_hdr.trailersize, 0x918),"Failed to read apploader ");
|
||||
sync_before_exec((void*)0x81200000, apploader_hdr.size+apploader_hdr.trailersize);
|
||||
prog10();
|
||||
|
||||
app_entry = apploader_hdr.entry;
|
||||
app_entry(&app_init, &app_main, &app_final);
|
||||
app_init(simple_report);
|
||||
prog10();
|
||||
|
||||
while(1) {
|
||||
void *dst;
|
||||
int size;
|
||||
int offset;
|
||||
int res;
|
||||
|
||||
res = app_main(&dst, &size, &offset);
|
||||
if(res != 1)
|
||||
break;
|
||||
debug_string("Req: ");
|
||||
debug_uint((u32)dst);debug_string(" ");
|
||||
debug_uint((u32)size);debug_string(" ");
|
||||
debug_uint((u32)offset);debug_string("\n");
|
||||
if(di_read(dst, size, offset) != 1) {
|
||||
debug_string("Warning: failed to read apploader request\n");
|
||||
}
|
||||
prog10();
|
||||
}*/
|
||||
debug_string("Apploader complete\n");
|
||||
di_shutdown();
|
||||
ios_close(es_fd);
|
||||
ios_cleanup();
|
||||
|
||||
prog10();
|
||||
|
||||
//write16(0x0006, 0x0000); // DVDInit
|
||||
|
||||
extern u32 vimode;
|
||||
if(((u8*)disc_id)[3] == 'P' && vimode == 0)
|
||||
vimode = 1;
|
||||
|
||||
debug_string("VI mode: ");
|
||||
debug_uint(vimode);
|
||||
debug_string("\n");
|
||||
|
||||
*(u32*)0x800000cc = vimode;
|
||||
Disc_SetLowMem();
|
||||
|
||||
//*(vu32*)0xCD00643C = 0x00000000; // 32Mhz on Bus
|
||||
*(vu32*)0xCD006C00 = 0x00000000; // deinit audio due to libogc fail
|
||||
|
||||
*(u32*)0x80003180 = *(u32*)0x80000000;
|
||||
|
||||
*(vu32*)0x800000cc = vimode;
|
||||
sync_after_write((void*)0x80000000, 0x3f00);
|
||||
|
||||
progress = 310;
|
||||
prog10();
|
||||
setprog(320);
|
||||
udelay(60000);
|
||||
|
||||
u8 hooktype = 0;
|
||||
//AppEntrypoint = (u32)app_final();
|
||||
debug_string("Game entry: ");
|
||||
debug_uint(AppEntrypoint);
|
||||
debug_string("\n");
|
||||
|
||||
debug_string("ok, taking the plunge\n");
|
||||
video_setblack();
|
||||
di_shutdown();
|
||||
|
||||
/* this sets VI to black, but I can't fit it in yet... */
|
||||
viw(0x0, oldvtrdcr);
|
||||
*(vu64*)(0xCC00200c) = oldvtovte;
|
||||
*(vu32*)0xCD006C00 = 0x00000000; // deinit audio due to libogc fail
|
||||
|
||||
/* Originally from tueidj - taken from NeoGamma (thx) */
|
||||
*(vu32*)0xCC003024 = 1;
|
||||
@ -606,8 +313,8 @@ void _main (void)
|
||||
"mtctr %r3\n"
|
||||
"bctr\n"
|
||||
"returnpoint:\n"
|
||||
"bl DCDisable\n"
|
||||
"bl ICDisable\n"
|
||||
/*"bl DCDisable\n"
|
||||
"bl ICDisable\n"*/
|
||||
"li %r3, 0\n"
|
||||
"mtsrr1 %r3\n"
|
||||
"lis %r4, AppEntrypoint@h\n"
|
||||
@ -657,5 +364,6 @@ void _main (void)
|
||||
"blr\n"
|
||||
);
|
||||
}
|
||||
fail();
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,13 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
#include "cache.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifndef TINY
|
||||
void *memset(void *ptr, int c, int size) {
|
||||
char* ptr2 = ptr;
|
||||
while(size--) *ptr2++ = (char)c;
|
||||
@ -33,7 +38,6 @@ int strlen(const char *ptr) {
|
||||
while(*ptr++) i++;
|
||||
return i;
|
||||
}
|
||||
#endif
|
||||
|
||||
int memcmp(const void *s1, const void *s2, size_t n)
|
||||
{
|
||||
@ -41,17 +45,25 @@ int memcmp(const void *s1, const void *s2, size_t n)
|
||||
const unsigned char *us2 = (const unsigned char *) s2;
|
||||
while (n-- != 0) {
|
||||
if (*us1 != *us2)
|
||||
#ifdef TINY
|
||||
return 1;
|
||||
#else
|
||||
return (*us1 < *us2) ? -1 : +1;
|
||||
#endif
|
||||
us1++;
|
||||
us2++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void memset32(u32 *addr, u32 data, u32 count)
|
||||
{
|
||||
int sc = count;
|
||||
void *sa = addr;
|
||||
while(count--)
|
||||
*addr++ = data;
|
||||
sync_after_write(sa, 4*sc);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Timebase frequency is core frequency / 8. Ignore roundoff, this
|
||||
// doesn't have to be very accurate.
|
||||
|
@ -12,10 +12,20 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void *memset(void *,int,int);
|
||||
void memset32(u32 *addr, u32 data, u32 count) __attribute__ ((externally_visible));
|
||||
void *memcpy(void *ptr, const void *src, int size);
|
||||
int memcmp(const void *s1, const void *s2, size_t n);
|
||||
int strlen(const char *ptr);
|
||||
void udelay(u32 us);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
88
resources/wiiflow_game_booter/video.c
Normal file
88
resources/wiiflow_game_booter/video.c
Normal file
@ -0,0 +1,88 @@
|
||||
#include "utils.h"
|
||||
|
||||
#define COLOR_BLACK 0x00800080
|
||||
#define COLOR_GRAY 0x80808080
|
||||
#define COLOR_WHITE 0xFF80FF80
|
||||
#define COLOR_RED 0x4C544CFF
|
||||
#define COLOR_GREEN 0x4B554B4A
|
||||
#define COLOR_BLUE 0x1DFF1D6B
|
||||
#define COLOR_YELLOW 0xE100E194
|
||||
|
||||
#define framebuffer ((u32*)(0x81600000))
|
||||
|
||||
u32 vtrdcr;
|
||||
u32 oldvtrdcr;
|
||||
u32 vimode;
|
||||
u32 vto,vte;
|
||||
u64 oldvtovte;
|
||||
int progress = 20;
|
||||
|
||||
static void drawbar(int pix)
|
||||
{
|
||||
int i = 16;
|
||||
u32* p = framebuffer + 320 * 400;
|
||||
while(i--) {
|
||||
memset32(p, COLOR_WHITE, pix);
|
||||
p += 320;
|
||||
}
|
||||
}
|
||||
|
||||
void prog(int p) {
|
||||
progress += p;
|
||||
drawbar(progress);
|
||||
}
|
||||
|
||||
void setprog(int p)
|
||||
{
|
||||
progress = p;
|
||||
drawbar(progress);
|
||||
}
|
||||
|
||||
void prog10(void) {
|
||||
prog(10);
|
||||
}
|
||||
|
||||
inline void viw(u32 addr, u32 data)
|
||||
{
|
||||
*(vu32*)(addr+0xCC002000) = data;
|
||||
}
|
||||
|
||||
void video_init(void)
|
||||
{
|
||||
memset32(framebuffer, COLOR_BLACK, 320*574);
|
||||
memset32(framebuffer + 320 * 398, COLOR_WHITE, 320*2);
|
||||
memset32(framebuffer + 320 * 416, COLOR_WHITE, 320*2);
|
||||
|
||||
vtrdcr = oldvtrdcr = *(vu32*)(0xCC002000);
|
||||
oldvtovte = *(vu64*)0xCC00200c;
|
||||
vtrdcr &= 0xFFFFF;
|
||||
vtrdcr |= 0x0F000000;
|
||||
vimode = (vtrdcr>>8)&3;
|
||||
|
||||
vto = 0x30018;
|
||||
vte = 0x20019;
|
||||
|
||||
if(vtrdcr & 4) { // progressive
|
||||
vto = vte = 0x60030;
|
||||
vtrdcr += 0x0F000000;
|
||||
} else if(vimode == 1) {
|
||||
vto = 0x10023;
|
||||
vte = 0x24;
|
||||
vtrdcr += 0x02F00000;
|
||||
}
|
||||
viw(0x0, vtrdcr);
|
||||
viw(0xc, vto);
|
||||
viw(0x10, vte);
|
||||
|
||||
viw(0x1c, (((u32)framebuffer) >> 5) | 0x10000000);
|
||||
viw(0x24, (((u32)framebuffer) >> 5) | 0x10000000);
|
||||
|
||||
prog(0);
|
||||
}
|
||||
|
||||
void video_setblack(void)
|
||||
{
|
||||
/* this sets VI to black, but I can't fit it in yet... */
|
||||
viw(0x0, oldvtrdcr);
|
||||
*(vu64*)(0xCC00200c) = oldvtovte;
|
||||
}
|
12
resources/wiiflow_game_booter/video.h
Normal file
12
resources/wiiflow_game_booter/video.h
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
#ifndef VIDEO_H_
|
||||
#define VIDEO_H_
|
||||
|
||||
void video_init(void);
|
||||
void video_setblack(void);
|
||||
|
||||
void prog(int p);
|
||||
void prog10(void);
|
||||
void setprog(int p);
|
||||
|
||||
#endif
|
@ -1,27 +1,20 @@
|
||||
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include "utils.h"
|
||||
#include "debug.h"
|
||||
#include "wip.h"
|
||||
|
||||
static WIP_Code * CodeList = NULL;
|
||||
static u32 CodesCount = 0;
|
||||
static u32 ProcessedLength = 0;
|
||||
static u32 Counter = 0;
|
||||
WIP_Code *CodeList;
|
||||
u32 CodesCount;
|
||||
u32 ProcessedLength;
|
||||
u32 Counter;
|
||||
|
||||
void do_wip_code(u8 * dst, u32 len)
|
||||
{
|
||||
if(!CodeList)
|
||||
return;
|
||||
|
||||
if(Counter < 3)
|
||||
{
|
||||
Counter++;
|
||||
return;
|
||||
}
|
||||
|
||||
u32 i = 0;
|
||||
s32 n = 0;
|
||||
s32 offset = 0;
|
||||
@ -38,10 +31,12 @@ void do_wip_code(u8 * dst, u32 len)
|
||||
if(dst[offset] == ((u8 *)&CodeList[i].srcaddress)[n])
|
||||
{
|
||||
dst[offset] = ((u8 *)&CodeList[i].dstaddress)[n];
|
||||
debug_string("Address patched:"); debug_uint(CodeList[i].offset+n); debug_string("\n");
|
||||
//printf("WIP: %08X Address Patched.\n", CodeList[i].offset + n);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_string("Address NOT patched:"); debug_uint(CodeList[i].offset+n); debug_string("\n");
|
||||
//printf("WIP: %08X Address does not match with WIP entry.\n", CodeList[i].offset+n);
|
||||
//printf("Destination: %02X | Should be: %02X.\n", dst[offset], ((u8 *)&CodeList[i].srcaddress)[n]);
|
||||
}
|
||||
@ -55,86 +50,17 @@ void do_wip_code(u8 * dst, u32 len)
|
||||
//! .wip files override internal patches
|
||||
//! the codelist has to be freed if the set fails
|
||||
//! if set was successful the codelist will be freed when it's done
|
||||
bool set_wip_list(WIP_Code * list, int size)
|
||||
u8 set_wip_list(WIP_Code *list, int size)
|
||||
{
|
||||
if(!CodeList && size > 0)
|
||||
{
|
||||
CodeList = list;
|
||||
CodesCount = size;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void wip_reset_counter()
|
||||
{
|
||||
ProcessedLength = 0;
|
||||
//alternative dols don't need a skip. only main.dol.
|
||||
Counter = 3;
|
||||
Counter = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void free_wip()
|
||||
{
|
||||
if(CodeList)
|
||||
free(CodeList);
|
||||
|
||||
CodesCount = 0;
|
||||
ProcessedLength = 0;
|
||||
}
|
||||
|
||||
int load_wip_patches(u8 *dir, u8 *gameid)
|
||||
{
|
||||
char filepath[150];
|
||||
char GameID[8];
|
||||
memset(GameID, 0, sizeof(GameID));
|
||||
memcpy(GameID, gameid, 6);
|
||||
snprintf(filepath, sizeof(filepath), "%s/%s.wip", dir, GameID);
|
||||
|
||||
FILE *fp = fopen(filepath, "rb");
|
||||
if(!fp)
|
||||
{
|
||||
memset(GameID, 0, sizeof(GameID));
|
||||
memcpy(GameID, gameid, 3);
|
||||
snprintf(filepath, sizeof(filepath), "%s/%s.wip", dir, GameID);
|
||||
fp = fopen(filepath, "rb");
|
||||
}
|
||||
|
||||
if(!fp)
|
||||
return -1;
|
||||
|
||||
char line[255];
|
||||
//printf("\nLoading WIP code from %s.\n", filepath);
|
||||
|
||||
while(fgets(line, sizeof(line), fp))
|
||||
{
|
||||
if(line[0] == '#' || strlen(line) < 26)
|
||||
continue;
|
||||
|
||||
u32 offset = (u32) strtoul(line, NULL, 16);
|
||||
u32 srcaddress = (u32) strtoul(line+9, NULL, 16);
|
||||
u32 dstaddress = (u32) strtoul(line+18, NULL, 16);
|
||||
|
||||
if(!CodeList)
|
||||
CodeList = malloc(sizeof(WIP_Code));
|
||||
|
||||
WIP_Code *tmp = realloc(CodeList, (CodesCount+1)*sizeof(WIP_Code));
|
||||
if(!tmp)
|
||||
{
|
||||
free(CodeList);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
CodeList = tmp;
|
||||
|
||||
CodeList[CodesCount].offset = offset;
|
||||
CodeList[CodesCount].srcaddress = srcaddress;
|
||||
CodeList[CodesCount].dstaddress = dstaddress;
|
||||
CodesCount++;
|
||||
}
|
||||
fclose(fp);
|
||||
//printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,10 +13,8 @@ typedef struct
|
||||
} WIP_Code;
|
||||
|
||||
u8 set_wip_list(WIP_Code *list, int size);
|
||||
void wip_reset_counter();
|
||||
void free_wip();
|
||||
void do_wip_code(u8 *dst, u32 len);
|
||||
int load_wip_patches(u8 *dir, u8 *gameid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -3,29 +3,6 @@
|
||||
echo buildtype.sh
|
||||
|
||||
FILENAME=source/loader/alt_ios_gen.h
|
||||
GENERATE=0
|
||||
VERSION=249
|
||||
|
||||
if [ ! -z "$1" ];
|
||||
then
|
||||
VERSION=$1
|
||||
fi
|
||||
|
||||
if [ ! -f $FILENAME ];
|
||||
then
|
||||
GENERATE=1
|
||||
else
|
||||
CURRENT_VERSION=`grep DOL_MAIN_IOS $FILENAME | awk '{printf "%d", $4}'`
|
||||
if [ $CURRENT_VERSION -ne $VERSION ];
|
||||
then
|
||||
GENERATE=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $GENERATE -eq 1 ];
|
||||
then
|
||||
|
||||
cat <<EOF > $FILENAME
|
||||
#define DOL_MAIN_IOS $VERSION;
|
||||
cat <<EOF > $FILENAME
|
||||
#define DOL_MAIN_IOS $1
|
||||
EOF
|
||||
fi
|
@ -21,12 +21,12 @@
|
||||
#include "loader/utils.h"
|
||||
#include "menu/menu.hpp"
|
||||
|
||||
BannerWindow *m_banner;
|
||||
BannerWindow m_banner;
|
||||
|
||||
extern const u8 custombanner_bin[];
|
||||
extern const u32 custombanner_bin_size;
|
||||
|
||||
void BannerWindow::Init(CVideo *vid, u8 *font1, u8 *font2)
|
||||
void BannerWindow::Init(u8 *font1, u8 *font2)
|
||||
{
|
||||
MaxAnimSteps = 30;
|
||||
returnVal = -1;
|
||||
@ -37,9 +37,8 @@ void BannerWindow::Init(CVideo *vid, u8 *font1, u8 *font2)
|
||||
sysFont2 = font2;
|
||||
ShowBanner = true;
|
||||
|
||||
video = vid;
|
||||
guMtxIdentity(modelview);
|
||||
guMtxTransApply(modelview, modelview, (!video->wide() || video->vid_50hz()) ? 0.0f : 2.0f, video->vid_50hz() ? -1.0f : 0.0f, 0.0F);
|
||||
guMtxTransApply(modelview, modelview, (!m_vid.wide() || m_vid.vid_50hz()) ? 0.0f : 2.0f, m_vid.vid_50hz() ? -1.0f : 0.0f, 0.0F);
|
||||
|
||||
AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
|
||||
AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
|
||||
@ -47,8 +46,8 @@ void BannerWindow::Init(CVideo *vid, u8 *font1, u8 *font2)
|
||||
Brightness = 0.f;
|
||||
|
||||
// this just looks better for banner/icon ratio
|
||||
xDiff = 0.5f * (video->wide() ? (video->vid_50hz() ? 616 : 620.0f) : 608.0f);
|
||||
yDiff = 0.5f * (video->vid_50hz() ? 448.0f : 470.0f);
|
||||
xDiff = 0.5f * (m_vid.wide() ? (m_vid.vid_50hz() ? 616 : 620.0f) : 608.0f);
|
||||
yDiff = 0.5f * (m_vid.vid_50hz() ? 448.0f : 470.0f);
|
||||
|
||||
iconWidth = fIconWidth - 20;
|
||||
iconHeight = fIconHeight - 20;
|
||||
@ -69,10 +68,10 @@ void BannerWindow::Init(CVideo *vid, u8 *font1, u8 *font2)
|
||||
}
|
||||
}
|
||||
|
||||
void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2)
|
||||
void BannerWindow::LoadBanner(Banner *banner, u8 *font1, u8 *font2)
|
||||
{
|
||||
changing = true;
|
||||
Init(vid, font1, font2);
|
||||
Init(font1, font2);
|
||||
gameBanner->LoadBanner(banner);
|
||||
gameSelected = 1;
|
||||
changing = false;
|
||||
@ -97,20 +96,20 @@ BannerWindow::BannerWindow()
|
||||
gameBanner = new AnimatedBanner;
|
||||
}
|
||||
|
||||
void BannerWindow::LoadBannerBin(u8 *bnr, u32 bnr_size, CVideo *vid, u8 *font1, u8 *font2)
|
||||
void BannerWindow::LoadBannerBin(u8 *bnr, u32 bnr_size, u8 *font1, u8 *font2)
|
||||
{
|
||||
changing = true;
|
||||
Init(vid, font1, font2);
|
||||
Init(font1, font2);
|
||||
gameBanner->LoadBannerBin(bnr, bnr_size);
|
||||
gameSelected = 1;
|
||||
changing = false;
|
||||
ShowBanner = true;
|
||||
}
|
||||
|
||||
void BannerWindow::CreateGCBanner(u8 *bnr, CVideo *vid, u8 *font1, u8 *font2, const wchar_t *title)
|
||||
void BannerWindow::CreateGCBanner(u8 *bnr, u8 *font1, u8 *font2, const wchar_t *title)
|
||||
{
|
||||
GC_OpeningBnr *openingBnr = (GC_OpeningBnr *)bnr;
|
||||
LoadBannerBin((u8*)custombanner_bin, (u32)custombanner_bin_size, vid, font1, font2);
|
||||
LoadBannerBin((u8*)custombanner_bin, (u32)custombanner_bin_size, font1, font2);
|
||||
gameBanner->SetBannerTexture("GCIcon.tpl", openingBnr->tpl_data, 96, 32, GX_TF_RGB5A3);
|
||||
gameBanner->SetBannerText("T_GameTitle", title);
|
||||
}
|
||||
@ -163,7 +162,7 @@ void BannerWindow::Draw(void)
|
||||
|
||||
// draw a black background image first
|
||||
if(AnimStep >= MaxAnimSteps)
|
||||
DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, 255.f});
|
||||
DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, 255.f});
|
||||
|
||||
if(changing)
|
||||
return;
|
||||
@ -185,7 +184,7 @@ void BannerWindow::Draw(void)
|
||||
f32 viewportv[6];
|
||||
f32 projectionv[7];
|
||||
|
||||
GX_GetViewportv(viewportv, video->vid_mode());
|
||||
GX_GetViewportv(viewportv, m_vid.vid_mode());
|
||||
GX_GetProjectionv(projectionv, projection, GX_ORTHOGRAPHIC);
|
||||
|
||||
guVector vecTL;
|
||||
@ -206,20 +205,20 @@ void BannerWindow::Draw(void)
|
||||
|
||||
if(gameBanner->getBanner())
|
||||
{
|
||||
gameBanner->getBanner()->Render(modelview, ScreenProps, video->wide(), 255.f);
|
||||
gameBanner->getBanner()->Render(modelview, ScreenProps, m_vid.wide(), 255.f);
|
||||
gameBanner->getBanner()->AdvanceFrame();
|
||||
}
|
||||
|
||||
// Setup GX
|
||||
ReSetup_GX();
|
||||
GX_SetScissor(0, 0, video->width(), video->height());
|
||||
GX_SetScissor(0, 0, m_vid.width(), m_vid.height());
|
||||
|
||||
// Clear and back to previous projection
|
||||
video->setup2DProjection();
|
||||
m_vid.setup2DProjection();
|
||||
|
||||
// If wanted
|
||||
if(Brightness > 1.f)
|
||||
DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, Brightness});
|
||||
DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, Brightness});
|
||||
}
|
||||
|
||||
void BannerWindow::ToogleGameSettings()
|
||||
@ -268,7 +267,7 @@ void BannerWindow::ReSetup_GX(void)
|
||||
// texture environment
|
||||
GX_SetNumTevStages(1);
|
||||
GX_SetNumIndStages(0);
|
||||
for(u8 i = 0; i < video->getAA(); i++)
|
||||
for(u8 i = 0; i < m_vid.getAA(); i++)
|
||||
{
|
||||
GX_SetTevOp(i, GX_MODULATE);
|
||||
GX_SetTevOrder(i, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
|
@ -47,12 +47,12 @@ class BannerWindow
|
||||
public:
|
||||
BannerWindow();
|
||||
void DeleteBanner(bool gamechange = false);
|
||||
void LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2);
|
||||
void LoadBannerBin(u8 *bnr, u32 bnr_size, CVideo *vid, u8 *font1, u8 *font2);
|
||||
void LoadBanner(Banner *banner, u8 *font1, u8 *font2);
|
||||
void LoadBannerBin(u8 *bnr, u32 bnr_size, u8 *font1, u8 *font2);
|
||||
int GetSelectedGame() { return gameSelected; }
|
||||
bool GetZoomSetting() { return AnimZoom; }
|
||||
bool GetInGameSettings() { return (Brightness > 1.f ? true : false); }
|
||||
void CreateGCBanner(u8 *bnr, CVideo *vid, u8 *font1, u8 *font2, const wchar_t *title);
|
||||
void CreateGCBanner(u8 *bnr, u8 *font1, u8 *font2, const wchar_t *title);
|
||||
void Draw(void);
|
||||
bool ToogleZoom(void);
|
||||
void ToogleGameSettings();
|
||||
@ -64,14 +64,13 @@ class BannerWindow
|
||||
void Animate(void);
|
||||
void ChangeGame(Banner *banner);
|
||||
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
||||
void Init(CVideo *vid, u8 *font1, u8 *font2);
|
||||
void Init(u8 *font1, u8 *font2);
|
||||
|
||||
static const float fBannerWidth = 608.f;
|
||||
static const float fBannerHeight = 448.f;
|
||||
static const float fIconWidth = 128.f;
|
||||
static const float fIconHeight = 96.f;
|
||||
|
||||
CVideo *video;
|
||||
bool reducedVol;
|
||||
int returnVal;
|
||||
int gameSelected;
|
||||
@ -102,6 +101,6 @@ class BannerWindow
|
||||
bool FontLoaded;
|
||||
};
|
||||
|
||||
extern BannerWindow *m_banner;
|
||||
extern BannerWindow m_banner;
|
||||
|
||||
#endif
|
||||
|
@ -17,7 +17,8 @@
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include <ogc/machine/processor.h>
|
||||
|
||||
#include <ogc/lwp_threads.h>
|
||||
#include <ogc/cache.h>
|
||||
#include "external_booter.hpp"
|
||||
#include "booter.h"
|
||||
#include "Config.h"
|
||||
@ -82,12 +83,15 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
|
||||
/* Copy in booter */
|
||||
memcpy(BOOTER_ADDR, booter, booter_size);
|
||||
DCFlushRange(BOOTER_ADDR, booter_size);
|
||||
/* Boot it */
|
||||
//SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
|
||||
_CPU_ISR_Disable(cookie);
|
||||
/* Shutdown IOS subsystems */
|
||||
u32 level = IRQ_Disable();
|
||||
__IOS_ShutdownSubsystems();
|
||||
__lwp_thread_closeall();
|
||||
__exception_closeall();
|
||||
/* Boot it */
|
||||
exeEntryPoint();
|
||||
_CPU_ISR_Restore(cookie);
|
||||
/* Fail */
|
||||
IRQ_Restore(level);
|
||||
}
|
||||
|
||||
extern FragList *frag_list;
|
||||
|
@ -81,6 +81,7 @@ const int CVideo::_stencilHeight = 128;
|
||||
static lwp_t waitThread = LWP_THREAD_NULL;
|
||||
SmartBuf waitThreadStack;
|
||||
|
||||
CVideo m_vid;
|
||||
CVideo::CVideo(void) :
|
||||
m_rmode(NULL), m_frameBuf(), m_curFB(0), m_fifo(NULL),
|
||||
m_yScale(0.0f), m_xfbHeight(0), m_wide(false),
|
||||
|
@ -121,4 +121,5 @@ private:
|
||||
CVideo(const CVideo &);
|
||||
};
|
||||
|
||||
extern CVideo m_vid;
|
||||
#endif //!defined(__VIDEO_HPP)
|
||||
|
@ -24,12 +24,12 @@
|
||||
#include "gui/text.hpp"
|
||||
|
||||
ListGenerator m_gameList;
|
||||
static Config CustomTitles;
|
||||
static GameTDB gameTDB;
|
||||
Config CustomTitles;
|
||||
GameTDB gameTDB;
|
||||
|
||||
static dir_discHdr ListElement;
|
||||
static discHdr WiiGameHeader;
|
||||
static gc_discHdr GCGameHeader;
|
||||
dir_discHdr ListElement;
|
||||
discHdr WiiGameHeader;
|
||||
gc_discHdr GCGameHeader;
|
||||
|
||||
void ListGenerator::Init(const char *settingsDir, const char *Language)
|
||||
{
|
||||
@ -116,9 +116,9 @@ static void Create_Wii_EXT_List(char *FullPath)
|
||||
}
|
||||
}
|
||||
|
||||
static u8 gc_disc[1];
|
||||
static const char *FST_APPEND = "sys/boot.bin";
|
||||
static const u8 FST_APPEND_SIZE = strlen(FST_APPEND);
|
||||
u8 gc_disc[1];
|
||||
const char *FST_APPEND = "sys/boot.bin";
|
||||
const u8 FST_APPEND_SIZE = strlen(FST_APPEND);
|
||||
static void Create_GC_List(char *FullPath)
|
||||
{
|
||||
FILE *fp = fopen(FullPath, "rb");
|
||||
@ -161,6 +161,7 @@ static void Create_Plugin_List(char *FullPath)
|
||||
m_gameList.push_back(ListElement);
|
||||
}
|
||||
|
||||
const char *FolderTitle = NULL;
|
||||
static void Create_Homebrew_List(char *FullPath)
|
||||
{
|
||||
if(strcasestr(FullPath, "boot.") == NULL)
|
||||
@ -171,7 +172,7 @@ static void Create_Homebrew_List(char *FullPath)
|
||||
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
|
||||
strncpy(ListElement.id, "HB_APP", 6);
|
||||
|
||||
static const char *FolderTitle = strrchr(FullPath, '/') + 1;
|
||||
FolderTitle = strrchr(FullPath, '/') + 1;
|
||||
ListElement.casecolor = CustomTitles.getColor("COVERS", FolderTitle, 1).intVal();
|
||||
const string &CustomTitle = CustomTitles.getString("TITLES", FolderTitle);
|
||||
if(CustomTitle.size() > 0)
|
||||
@ -184,7 +185,7 @@ static void Create_Homebrew_List(char *FullPath)
|
||||
m_gameList.push_back(ListElement);
|
||||
}
|
||||
|
||||
static Channel *chan = NULL;
|
||||
Channel *chan = NULL;
|
||||
static void Create_Channel_List()
|
||||
{
|
||||
for(u32 i = 0; i < ChannelHandle.Count(); i++)
|
||||
@ -271,13 +272,13 @@ static inline bool IsFileSupported(const char *File, const vector<string>& FileT
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *NewFileName = NULL;
|
||||
char *FullPathChar = NULL;
|
||||
dirent *pent = NULL;
|
||||
DIR *pdir = NULL;
|
||||
void GetFiles(const char *Path, const vector<string>& FileTypes,
|
||||
FileAdder AddFile, bool CompareFolders, u32 max_depth, u32 depth)
|
||||
{
|
||||
static const char *NewFileName = NULL;
|
||||
static char *FullPathChar = NULL;
|
||||
static dirent *pent = NULL;
|
||||
static DIR *pdir = NULL;
|
||||
vector<string> SubPaths;
|
||||
|
||||
pdir = opendir(Path);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "menu/menu.hpp"
|
||||
#include "memory/memory.h"
|
||||
|
||||
CMenu *mainMenu;
|
||||
CMenu mainMenu;
|
||||
bool useMainIOS = false;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@ -32,8 +32,7 @@ int main(int argc, char **argv)
|
||||
InitGecko();
|
||||
|
||||
// Init video
|
||||
CVideo vid;
|
||||
vid.init();
|
||||
m_vid.init();
|
||||
|
||||
DeviceHandle.Init();
|
||||
Nand::Instance()->Init_ISFS();
|
||||
@ -92,11 +91,10 @@ int main(int argc, char **argv)
|
||||
Sys_ExitTo(EXIT_TO_HBC);
|
||||
|
||||
DeviceHandle.MountAll();
|
||||
vid.waitMessage(0.15f);
|
||||
m_vid.waitMessage(0.15f);
|
||||
|
||||
mainMenu = new CMenu(vid);
|
||||
Open_Inputs();
|
||||
mainMenu->init();
|
||||
mainMenu.init();
|
||||
if(CurrentIOS.Version != mainIOS && !neek2o() && !Sys_DolphinMode())
|
||||
{
|
||||
if(useMainIOS || !DeviceHandle.UsablePartitionMounted())
|
||||
@ -108,25 +106,24 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if(CurrentIOS.Version == mainIOS)
|
||||
useMainIOS = true; //Needed for later checks
|
||||
|
||||
if(!iosOK)
|
||||
mainMenu->terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.");
|
||||
mainMenu.terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.");
|
||||
else if(!DeviceHandle.UsablePartitionMounted())
|
||||
mainMenu->terror("errboot2", L"Could not find a device to save configuration files on!");
|
||||
mainMenu.terror("errboot2", L"Could not find a device to save configuration files on!");
|
||||
else if(WDVD_Init() < 0)
|
||||
mainMenu->terror("errboot3", L"Could not initialize the DIP module!");
|
||||
mainMenu.terror("errboot3", L"Could not initialize the DIP module!");
|
||||
else
|
||||
{
|
||||
writeStub();
|
||||
if(Emulator_boot)
|
||||
mainMenu->m_Emulator_boot = true;
|
||||
mainMenu.m_Emulator_boot = true;
|
||||
if(gameid != NULL && strlen(gameid) == 6)
|
||||
mainMenu->directlaunch(gameid);
|
||||
mainMenu.directlaunch(gameid);
|
||||
else
|
||||
mainMenu->main();
|
||||
mainMenu.main();
|
||||
}
|
||||
//Exit WiiFlow, no game booted...
|
||||
mainMenu->cleanup();
|
||||
mainMenu.cleanup();
|
||||
ShutdownBeforeExit();
|
||||
Sys_Exit();
|
||||
return 0;
|
||||
|
@ -112,8 +112,7 @@ extern const u8 checkboxs_png[];
|
||||
extern const u8 checkboxhid_png[];
|
||||
extern const u8 checkboxreq_png[];
|
||||
|
||||
CMenu::CMenu(CVideo &vid) :
|
||||
m_vid(vid)
|
||||
CMenu::CMenu()
|
||||
{
|
||||
m_aa = 0;
|
||||
m_thrdWorking = false;
|
||||
@ -144,12 +143,11 @@ CMenu::CMenu(CVideo &vid) :
|
||||
m_wbf2_font = NULL;
|
||||
m_current_view = COVERFLOW_USB;
|
||||
m_Emulator_boot = false;
|
||||
m_banner = new BannerWindow;
|
||||
m_gameSound.SetVoice(1);
|
||||
m_music_info = true;
|
||||
}
|
||||
|
||||
void CMenu::init(void)
|
||||
void CMenu::init()
|
||||
{
|
||||
const char *drive = "empty";
|
||||
const char *check = "empty";
|
||||
@ -492,7 +490,7 @@ void CMenu::cleanup()
|
||||
//gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize());
|
||||
m_btnMgr.hide(m_mainLblCurMusic);
|
||||
_cleanupDefaultFont();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
m_plugin.Cleanup();
|
||||
|
||||
_stopSounds();
|
||||
@ -917,7 +915,7 @@ void CMenu::_buildMenus(void)
|
||||
theme.btnTexRSH = _texture(theme.texSet, "GENERAL", "button_texture_hlright_selected", theme.btnTexRSH);
|
||||
theme.btnTexCSH.fromPNG(buthscenter_png);
|
||||
theme.btnTexCSH = _texture(theme.texSet, "GENERAL", "button_texture_hlcenter_selected", theme.btnTexCSH);
|
||||
/*
|
||||
|
||||
theme.btnAUOn.fromPNG(butauon_png);
|
||||
theme.btnAUOn = _texture(theme.texSet, "GENERAL", "button_au_on", theme.btnAUOn);
|
||||
theme.btnAUOns.fromPNG(butauons_png);
|
||||
@ -1025,7 +1023,7 @@ void CMenu::_buildMenus(void)
|
||||
theme.btnZHCNOff = _texture(theme.texSet, "GENERAL", "button_zhcn_off", theme.btnZHCNOff);
|
||||
theme.btnZHCNOffs.fromPNG(butzhcnoffs_png);
|
||||
theme.btnZHCNOffs = _texture(theme.texSet, "GENERAL", "button_zhcn_off_selected", theme.btnZHCNOffs);
|
||||
*/
|
||||
|
||||
theme.checkboxoff.fromPNG(checkbox_png);
|
||||
theme.checkboxoff = _texture(theme.texSet, "GENERAL", "checkbox_off", theme.checkboxoff);
|
||||
theme.checkboxoffs.fromPNG(checkbox_png);
|
||||
@ -1855,7 +1853,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
m_cf.draw();
|
||||
m_vid.setup2DProjection(false, true);
|
||||
m_cf.drawEffect();
|
||||
if(!m_banner->GetSelectedGame())
|
||||
if(!m_banner.GetSelectedGame())
|
||||
m_cf.drawText(adjusting);
|
||||
m_vid.renderAAPass(i);
|
||||
}
|
||||
@ -1873,14 +1871,14 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
m_cf.draw();
|
||||
m_vid.setup2DProjection();
|
||||
m_cf.drawEffect();
|
||||
if(!m_banner->GetSelectedGame())
|
||||
if(!m_banner.GetSelectedGame())
|
||||
m_cf.drawText(adjusting);
|
||||
}
|
||||
}
|
||||
if(m_fa.isLoaded())
|
||||
m_fa.draw();
|
||||
else if(m_banner->GetSelectedGame() && (!m_banner->GetInGameSettings() || (m_banner->GetInGameSettings() && m_bnr_settings)))
|
||||
m_banner->Draw();
|
||||
else if(m_banner.GetSelectedGame() && (!m_banner.GetInGameSettings() || (m_banner.GetInGameSettings() && m_bnr_settings)))
|
||||
m_banner.Draw();
|
||||
|
||||
m_btnMgr.draw();
|
||||
ScanInput();
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "gui/fanart.hpp"
|
||||
#include "gui/gui.hpp"
|
||||
#include "list/ListGenerator.hpp"
|
||||
#include "loader/alt_ios_gen.h"
|
||||
#include "loader/disc.h"
|
||||
#include "loader/gc_disc_dump.hpp"
|
||||
#include "loader/wbfs.h"
|
||||
@ -34,9 +33,8 @@ extern "C" { extern u8 currentPartition; }
|
||||
class CMenu
|
||||
{
|
||||
public:
|
||||
CMenu(CVideo &vid);
|
||||
~CMenu(void) {cleanup();}
|
||||
void init(void);
|
||||
CMenu();
|
||||
void init();
|
||||
void error(const wstringEx &msg);
|
||||
void terror(const char *key, const wchar_t *msg) { error(_fmt(key, msg)); }
|
||||
void exitHandler(int ExitTo);
|
||||
@ -52,7 +50,6 @@ private:
|
||||
int h;
|
||||
bool hide;
|
||||
};
|
||||
CVideo &m_vid;
|
||||
CCursor m_cursor[WPAD_MAX_WIIMOTES];
|
||||
CButtonsMgr m_btnMgr;
|
||||
CCoverFlow m_cf;
|
||||
|
@ -391,8 +391,8 @@ void CMenu::_game(bool launch)
|
||||
}
|
||||
|
||||
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false) && !NoGameID(m_cf.getHdr()->type);
|
||||
if(m_banner->GetZoomSetting() != m_zoom_banner)
|
||||
m_banner->ToogleZoom();
|
||||
if(m_banner.GetZoomSetting() != m_zoom_banner)
|
||||
m_banner.ToogleZoom();
|
||||
|
||||
s8 startGameSound = 1;
|
||||
while(!m_exit)
|
||||
@ -417,10 +417,10 @@ void CMenu::_game(bool launch)
|
||||
if(BTN_B_PRESSED && (m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)))
|
||||
{
|
||||
_hideGame();
|
||||
m_banner->SetShowBanner(false);
|
||||
m_banner.SetShowBanner(false);
|
||||
_CategorySettings(true);
|
||||
_showGame();
|
||||
m_banner->SetShowBanner(true);
|
||||
m_banner.SetShowBanner(true);
|
||||
if(!m_gameSound.IsPlaying())
|
||||
startGameSound = -6;
|
||||
continue;
|
||||
@ -430,17 +430,17 @@ void CMenu::_game(bool launch)
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
ClearGameSoundThreadStack();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
break;
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (m_cf.getHdr()->type == TYPE_WII_GAME || m_cf.getHdr()->type == TYPE_GC_GAME || m_cf.getHdr()->type == TYPE_CHANNEL))
|
||||
{
|
||||
_hideGame();
|
||||
m_banner->SetShowBanner(false);
|
||||
m_banner.SetShowBanner(false);
|
||||
m_gameSelected = true;
|
||||
_gameinfo();
|
||||
_showGame();
|
||||
m_banner->SetShowBanner(true);
|
||||
m_banner.SetShowBanner(true);
|
||||
if(!m_gameSound.IsPlaying())
|
||||
startGameSound = -6;
|
||||
}
|
||||
@ -453,7 +453,7 @@ void CMenu::_game(bool launch)
|
||||
{
|
||||
MusicPlayer.Stop();
|
||||
m_gameSound.Stop();
|
||||
m_banner->SetShowBanner(false);
|
||||
m_banner.SetShowBanner(false);
|
||||
fclose(file);
|
||||
_hideGame();
|
||||
/* Backup Background */
|
||||
@ -467,7 +467,7 @@ void CMenu::_game(bool launch)
|
||||
movie.SetVolume(m_cfg.getInt("GENERAL", "sound_volume_bnr", 255));
|
||||
m_video_playing = true;
|
||||
movie.Play();
|
||||
m_banner->ReSetup_GX();
|
||||
m_banner.ReSetup_GX();
|
||||
m_vid.setup2DProjection();
|
||||
while(!BTN_B_PRESSED && !BTN_A_PRESSED && !BTN_HOME_PRESSED && movie.GetNextFrame(&m_curBg))
|
||||
{
|
||||
@ -488,7 +488,7 @@ void CMenu::_game(bool launch)
|
||||
/* Get back into our coverflow */
|
||||
_showGame();
|
||||
m_video_playing = false;
|
||||
m_banner->SetShowBanner(true);
|
||||
m_banner.SetShowBanner(true);
|
||||
if(!m_gameSound.IsPlaying())
|
||||
startGameSound = -6;
|
||||
}
|
||||
@ -511,16 +511,16 @@ void CMenu::_game(bool launch)
|
||||
if(!m_locked)
|
||||
{
|
||||
_hideGame();
|
||||
m_banner->SetShowBanner(false);
|
||||
m_banner.SetShowBanner(false);
|
||||
if(_wbfsOp(CMenu::WO_REMOVE_GAME))
|
||||
{
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
ClearGameSoundThreadStack();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
break;
|
||||
}
|
||||
m_banner->SetShowBanner(true);
|
||||
m_banner.SetShowBanner(true);
|
||||
if(!m_gameSound.IsPlaying())
|
||||
startGameSound = -6;
|
||||
_showGame();
|
||||
@ -535,12 +535,12 @@ void CMenu::_game(bool launch)
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
ClearGameSoundThreadStack();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
break;
|
||||
}
|
||||
else if((m_btnMgr.selected(m_gameBtnToogle) || m_btnMgr.selected(m_gameBtnToogleFull)) && !NoGameID(m_cf.getHdr()->type))
|
||||
{
|
||||
m_zoom_banner = m_banner->ToogleZoom();
|
||||
m_zoom_banner = m_banner.ToogleZoom();
|
||||
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
|
||||
m_show_zone_game = false;
|
||||
}
|
||||
@ -549,9 +549,9 @@ void CMenu::_game(bool launch)
|
||||
_hideGame();
|
||||
m_gameSelected = true;
|
||||
|
||||
m_banner->ToogleGameSettings();
|
||||
m_banner.ToogleGameSettings();
|
||||
_gameSettings();
|
||||
m_banner->ToogleGameSettings();
|
||||
m_banner.ToogleGameSettings();
|
||||
|
||||
_showGame();
|
||||
if(!m_gameSound.IsPlaying())
|
||||
@ -564,7 +564,7 @@ void CMenu::_game(bool launch)
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
ClearGameSoundThreadStack();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
dir_discHdr *hdr = m_cf.getHdr();
|
||||
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
|
||||
if(currentPartition != SD && hdr->type == TYPE_GC_GAME && m_show_dml == 2 && (strstr(hdr->path, ".iso") == NULL ||
|
||||
@ -685,7 +685,7 @@ void CMenu::_game(bool launch)
|
||||
m_gameSound.Stop();
|
||||
m_gameSelected = false;
|
||||
m_fa.unload();
|
||||
m_banner->DeleteBanner(true);
|
||||
m_banner.DeleteBanner(true);
|
||||
_setBg(m_mainBg, m_mainBgLQ);
|
||||
}
|
||||
if(m_show_zone_game && !m_zoom_banner)
|
||||
@ -1343,6 +1343,34 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
|
||||
Sys_Exit();
|
||||
}
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
/* Open ES Module */
|
||||
s32 ESHandle = IOS_Open("/dev/es", 0);
|
||||
/* IOS Reload Block */
|
||||
static ioctlv block_vector[2] ATTRIBUTE_ALIGN(32);
|
||||
static u32 mode ATTRIBUTE_ALIGN(32);
|
||||
static u32 ios ATTRIBUTE_ALIGN(32);
|
||||
mode = 2;
|
||||
block_vector[0].data = &mode;
|
||||
block_vector[0].len = sizeof(u32);
|
||||
ios = IOS_GetVersion();
|
||||
block_vector[1].data = &ios;
|
||||
block_vector[1].len = sizeof(u32);
|
||||
gprintf("Block IOS Reload for %i %s\n", ios, IOS_Ioctlv(ESHandle, 0xA0, 2, 0, block_vector) < 0 ? "failed!" : "succeeded");
|
||||
/* Return to */
|
||||
if(!m_directLaunch && returnTo)
|
||||
{
|
||||
static ioctlv rtn_vector[1] ATTRIBUTE_ALIGN(32);
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (returnTo & 0xFFFFFFFF));
|
||||
rtn_vector[0].data = sm_title_id;
|
||||
rtn_vector[0].len = sizeof(u64);
|
||||
gprintf("Return to channel %s %s. Using new d2x way\n", rtrn, IOS_Ioctlv(ESHandle, 0xA1, 1, 0, rtn_vector) != -101 ? "succeeded" : "failed!");
|
||||
returnTo = 0;
|
||||
}
|
||||
/* Close ES Module */
|
||||
IOS_Close(ESHandle);
|
||||
}
|
||||
if(emulate_mode && !neek2o() && CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
Nand::Instance()->Init(emuPath.c_str(), emuPartition, false);
|
||||
@ -1383,8 +1411,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
ocarina_load_code(cheatFile.get(), cheatSize);
|
||||
cheatFile.release();
|
||||
}
|
||||
//loadIOS(250, false);
|
||||
usleep(10000);
|
||||
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, id.c_str());
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME);
|
||||
}
|
||||
@ -1486,7 +1512,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
|
||||
if(m->m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
{
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->settings[0]), m->m_plugin.GetBannerSoundSize());
|
||||
m->m_gamesound_changed = true;
|
||||
m->m_gameSoundHdr = NULL;
|
||||
@ -1513,7 +1539,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
if(cached_bnr_file == NULL)
|
||||
{
|
||||
m->m_gameSound.FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
return;
|
||||
}
|
||||
@ -1535,7 +1561,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
disc.init(m->m_cf.getHdr()->path);
|
||||
u8 *opening_bnr = disc.GetGameCubeBanner();
|
||||
if(opening_bnr != NULL)
|
||||
m_banner->CreateGCBanner(opening_bnr, &m->m_vid, m->m_wbf1_font, m->m_wbf2_font, m->m_cf.getHdr()->title);
|
||||
m_banner.CreateGCBanner(opening_bnr, m->m_wbf1_font, m->m_wbf2_font, m->m_cf.getHdr()->title);
|
||||
m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
|
||||
m->m_gamesound_changed = true;
|
||||
m->m_gameSoundHdr = NULL;
|
||||
@ -1553,7 +1579,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
if(custom_bnr_file == NULL)
|
||||
{
|
||||
m->m_gameSound.FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
return;
|
||||
}
|
||||
@ -1570,13 +1596,13 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
_extractChannelBnr(TITLE_ID(m->m_gameSoundHdr->settings[0],m->m_gameSoundHdr->settings[1])) : NULL)));
|
||||
if(banner != NULL && banner->IsValid())
|
||||
{
|
||||
m_banner->LoadBanner(banner, &m->m_vid, m->m_wbf1_font, m->m_wbf2_font);
|
||||
m_banner.LoadBanner(banner, m->m_wbf1_font, m->m_wbf2_font);
|
||||
soundBin = banner->GetFile((char *)"sound.bin", &sndSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
m->m_gameSound.FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
delete banner;
|
||||
return;
|
||||
@ -1597,7 +1623,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
if(newSound == NULL || newSize == 0 || !m->m_gameSound.Load(newSound, newSize))
|
||||
{
|
||||
m->m_gameSound.FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
return;
|
||||
}
|
||||
@ -1611,7 +1637,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
else
|
||||
{
|
||||
m->m_gameSound.FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m_banner.DeleteBanner();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user