From 2f4c8fb0fde67ed3c40b280a75e2e9e3ca04b0a1 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sun, 21 Oct 2012 15:28:00 +0000 Subject: [PATCH] -cleanup stuff -fixed rebooting wiiflow with holding down b and pressing home twice --- .../wiiflow_game_booter/source/apploader.c | 37 ++- .../wiiflow_game_booter/source/apploader.h | 6 +- resources/wiiflow_game_booter/source/disc.c | 7 + resources/wiiflow_game_booter/source/gecko.c | 31 +- resources/wiiflow_game_booter/source/main.cpp | 52 ++-- resources/wiiflow_game_booter/source/wdvd.c | 291 +++++------------- resources/wiiflow_game_booter/source/wdvd.h | 21 +- source/list/ListGenerator.cpp | 3 +- source/menu/menu.cpp | 44 +-- source/menu/menu_main.cpp | 3 +- 10 files changed, 155 insertions(+), 340 deletions(-) diff --git a/resources/wiiflow_game_booter/source/apploader.c b/resources/wiiflow_game_booter/source/apploader.c index 0feb9f1e..ba071eb7 100644 --- a/resources/wiiflow_game_booter/source/apploader.c +++ b/resources/wiiflow_game_booter/source/apploader.c @@ -27,10 +27,8 @@ static u8 *appldr = (u8 *)0x81200000; #define APPLDR_OFFSET 0x910 #define APPLDR_CODE 0x918 -/* Variables */ -static u32 buffer[0x20] ATTRIBUTE_ALIGN(32); - -void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo); +void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, + bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo); 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); @@ -38,7 +36,17 @@ static void PrinceOfPersiaPatch(); static void NewSuperMarioBrosPatch(); bool hookpatched = false; -s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo) +/* Thanks Tinyload */ +static struct +{ + char revision[16]; + void *entry; + s32 size; + s32 trailersize; + s32 padding; +} apploader_hdr ATTRIBUTE_ALIGN(32); + +u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo) { PrinceOfPersiaPatch(); NewSuperMarioBrosPatch(); @@ -48,29 +56,31 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc int offset = 0; u32 appldr_len; s32 ret; + + app_entry appldr_entry; app_init appldr_init; app_main appldr_main; app_final appldr_final; /* Read apploader header */ - ret = WDVD_Read(buffer, 0x20, APPLDR_OFFSET); + ret = WDVD_Read(&apploader_hdr, 0x20, APPLDR_OFFSET); if(ret < 0) - return ret; + return 0; /* Calculate apploader length */ - appldr_len = buffer[5] + buffer[6]; + appldr_len = apploader_hdr.size + apploader_hdr.trailersize; /* Read apploader code */ ret = WDVD_Read(appldr, appldr_len, APPLDR_CODE); if(ret < 0) - return ret; + return 0; /* Flush into memory */ DCFlushRange(appldr, appldr_len); ICInvalidateRange(appldr, appldr_len); /* Set apploader entry function */ - app_entry appldr_entry = (app_entry)buffer[4]; + appldr_entry = apploader_hdr.entry; /* Call apploader entry */ appldr_entry(&appldr_init, &appldr_main, &appldr_final); @@ -88,15 +98,12 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc ICInvalidateRange(dst, len); prog(20); } - free_wip(); if(hooktype != 0 && hookpatched) ocarina_do_code(); /* Set entry point from apploader */ - *entry = appldr_final(); - - return 0; + return (u32)appldr_final(); } void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo) @@ -236,4 +243,4 @@ static bool Remove_001_Protection(void *Address, int Size) } } return false; -} \ No newline at end of file +} diff --git a/resources/wiiflow_game_booter/source/apploader.h b/resources/wiiflow_game_booter/source/apploader.h index ae80dc60..33135330 100644 --- a/resources/wiiflow_game_booter/source/apploader.h +++ b/resources/wiiflow_game_booter/source/apploader.h @@ -1,15 +1,13 @@ #ifndef _APPLOADER_H_ #define _APPLOADER_H_ -/* Entry point */ -typedef void (*entry_point)(void); - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Prototypes */ -s32 Apploader_Run(entry_point *entry,u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo); +u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, + u8 patchVidModes, int aspectRatio, u32 returnTo); #ifdef __cplusplus } diff --git a/resources/wiiflow_game_booter/source/disc.c b/resources/wiiflow_game_booter/source/disc.c index e9dbe11c..716aeadc 100644 --- a/resources/wiiflow_game_booter/source/disc.c +++ b/resources/wiiflow_game_booter/source/disc.c @@ -11,6 +11,7 @@ #include "cios.h" #include "types.h" #include "wdvd.h" +#include "video_tinyload.h" /* Constants */ #define PART_INFO_OFFSET 0x10000 @@ -103,7 +104,10 @@ s32 Disc_FindPartition(u32 *outbuf) { /* Game partition */ if(partition_table[cnt].type == 0) + { offset = partition_table[cnt].offset; + break; + } } /* No game partition found */ @@ -210,6 +214,9 @@ GXRModeObj *Disc_SelectVMode(u8 videoselected, u32 *rmode_reg) void Disc_SetVMode(GXRModeObj *rmode, u32 rmode_reg) { + /* Remove Load Bar */ + video_clear(); + /* Set video mode register */ *Video_Mode = rmode_reg; DCFlushRange((void*)Video_Mode, 4); diff --git a/resources/wiiflow_game_booter/source/gecko.c b/resources/wiiflow_game_booter/source/gecko.c index f339d2d6..33937e51 100644 --- a/resources/wiiflow_game_booter/source/gecko.c +++ b/resources/wiiflow_game_booter/source/gecko.c @@ -1,40 +1,29 @@ #include -#include #include #include -#include #include #include "gecko.h" /* init-globals */ bool geckoinit = false; -static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len) -{ - if(geckoinit && ptr) - { - u32 level; - level = IRQ_Disable(); - usb_sendbuffer_safe(1, ptr, len); - IRQ_Restore(level); - } - return len; -} - char gprintfBuffer[256]; void gprintf(const char *format, ...) { va_list va; - va_start(va, format); - int len = vsnprintf(gprintfBuffer, 255, format, va); - __out_write(NULL, 0, gprintfBuffer, len); - va_end(va); + if(geckoinit) + { + va_start(va, format); + int len = vsnprintf(gprintfBuffer, 255, format, va); + u32 level = IRQ_Disable(); + usb_sendbuffer_safe(1, gprintfBuffer, len); + IRQ_Restore(level); + va_end(va); + } } bool InitGecko() { - if(geckoinit) - return geckoinit; - + memset(gprintfBuffer, 0, 256); u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1); if(geckoattached) { diff --git a/resources/wiiflow_game_booter/source/main.cpp b/resources/wiiflow_game_booter/source/main.cpp index 4fc6d926..b0d5b1db 100644 --- a/resources/wiiflow_game_booter/source/main.cpp +++ b/resources/wiiflow_game_booter/source/main.cpp @@ -39,10 +39,9 @@ IOS_Info CurrentIOS; /* Boot Variables */ u32 GameIOS = 0; u32 vmode_reg = 0; -entry_point p_entry; GXRModeObj *vmode = NULL; -u32 AppEntrypoint; +u32 AppEntrypoint = 0; extern "C" { extern void __exception_closeall(); @@ -72,11 +71,6 @@ int main() frag_list = normalCFG.fragments; wbfsDev = normalCFG.wbfsDevice; wbfs_part_idx = normalCFG.wbfsPart; - if(CurrentIOS.Type == IOS_TYPE_D2X) - { - s32 ret = BlockIOSReload(); - gprintf("Block IOS Reload using d2x %s.\n", ret < 0 ? "failed" : "succeeded"); - } prog10(); /* Setup Low Memory */ @@ -85,6 +79,11 @@ int main() if(normalCFG.BootType == TYPE_WII_GAME) { WDVD_Init(); + if(CurrentIOS.Type == IOS_TYPE_D2X) + { + s32 ret = BlockIOSReload(); + gprintf("Block IOS Reload using d2x %s.\n", ret < 0 ? "failed" : "succeeded"); + } if(normalCFG.GameBootType == TYPE_WII_DISC) { Disc_SetUSB(NULL, false); @@ -103,17 +102,16 @@ int main() Disc_FindPartition(&offset); WDVD_OpenPartition(offset, &GameIOS); vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg); - Apploader_Run(&p_entry, normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString, normalCFG.patchVidMode, - normalCFG.aspectRatio, normalCFG.returnTo); - AppEntrypoint = (u32)p_entry; + AppEntrypoint = Apploader_Run(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString, + normalCFG.patchVidMode, normalCFG.aspectRatio, normalCFG.returnTo); WDVD_Close(); } else if(normalCFG.BootType == TYPE_CHANNEL) { ISFS_Initialize(); *Disc_ID = TITLE_LOWER(normalCFG.title); - AppEntrypoint = LoadChannel(normalCFG.title, &GameIOS); vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg); + AppEntrypoint = LoadChannel(normalCFG.title, &GameIOS); PatchChannel(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString, normalCFG.patchVidMode, normalCFG.aspectRatio); ISFS_Deinitialize(); @@ -128,7 +126,6 @@ int main() Disc_SetTime(); /* Set an appropriate video mode */ - video_clear(); Disc_SetVMode(vmode, vmode_reg); /* Shutdown IOS subsystems */ @@ -180,31 +177,30 @@ int main() ); } } - else if (hooktype) + else if(hooktype) { asm volatile ( - "lis %r3, AppEntrypoint@h\n" - "ori %r3, %r3, AppEntrypoint@l\n" - "lwz %r3, 0(%r3)\n" - "mtlr %r3\n" - "lis %r3, 0x8000\n" - "ori %r3, %r3, 0x18A8\n" - "nop\n" - "mtctr %r3\n" - "bctr\n" + "lis %r3, AppEntrypoint@h\n" + "ori %r3, %r3, AppEntrypoint@l\n" + "lwz %r3, 0(%r3)\n" + "mtlr %r3\n" + "lis %r3, 0x8000\n" + "ori %r3, %r3, 0x18A8\n" + "nop\n" + "mtctr %r3\n" + "bctr\n" ); } else { asm volatile ( - "lis %r3, AppEntrypoint@h\n" - "ori %r3, %r3, AppEntrypoint@l\n" - "lwz %r3, 0(%r3)\n" - "mtlr %r3\n" - "blr\n" + "lis %r3, AppEntrypoint@h\n" + "ori %r3, %r3, AppEntrypoint@l\n" + "lwz %r3, 0(%r3)\n" + "mtlr %r3\n" + "blr\n" ); } - IRQ_Restore(level); return 0; diff --git a/resources/wiiflow_game_booter/source/wdvd.c b/resources/wiiflow_game_booter/source/wdvd.c index d28bfba2..909f60aa 100644 --- a/resources/wiiflow_game_booter/source/wdvd.c +++ b/resources/wiiflow_game_booter/source/wdvd.c @@ -1,6 +1,4 @@ -#include #include -#include #include #include "gecko.h" @@ -36,32 +34,26 @@ static s32 di_fd = -1; s32 WDVD_Init(void) { /* Open "/dev/di" */ - if (di_fd < 0) { + if(di_fd < 0) + { di_fd = IOS_Open(di_fs, 0); if (di_fd < 0) return di_fd; } - return 0; } s32 WDVD_Close(void) { /* Close "/dev/di" */ - if (di_fd >= 0) { + if(di_fd >= 0) + { IOS_Close(di_fd); di_fd = -1; } - return 0; } -s32 WDVD_GetHandle(void) -{ - /* Return di handle */ - return di_fd; -} - s32 WDVD_Reset(void) { memset(inbuf, 0, sizeof(inbuf)); @@ -71,30 +63,11 @@ s32 WDVD_Reset(void) inbuf[1] = 1; s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_RESET, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - + if(ret < 0) + return ret; return (ret == 1) ? 0 : -ret; } -s32 WDVD_ReadDiskId(void *id) -{ - memset(inbuf, 0, sizeof(inbuf)); - - /* Read disc ID */ - inbuf[0] = IOCTL_DI_READID << 24; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_READID, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - - if (ret == 1) - { - memcpy(id, outbuf, sizeof(dvddiskid)); - return 0; - } - - return -ret; -} - s32 WDVD_Seek(u32 offset) { memset(inbuf, 0, sizeof(inbuf)); @@ -104,16 +77,57 @@ s32 WDVD_Seek(u32 offset) inbuf[1] = offset; s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_SEEK, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; + if(ret < 0) + return ret; + return (ret == 1) ? 0 : -ret; +} +s32 WDVD_ReadDiskId(void *id) +{ + memset(inbuf, 0, sizeof(inbuf)); + + /* Read disc ID */ + inbuf[0] = IOCTL_DI_READID << 24; + + s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_READID, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); + if(ret < 0) + return ret; + memcpy(id, outbuf, sizeof(dvddiskid)); + return (ret == 1) ? 0 : -ret; +} + +s32 WDVD_Read(void *buf, u32 len, u32 offset) +{ + memset(inbuf, 0, sizeof(inbuf)); + + /* Disc read */ + inbuf[0] = IOCTL_DI_READ << 24; + inbuf[1] = len; + inbuf[2] = offset; + + s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_READ, inbuf, sizeof(inbuf), buf, len); + if(ret < 0) + return ret; + return (ret == 1) ? 0 : -ret; +} + +s32 WDVD_UnencryptedRead(void *buf, u32 len, u32 offset) +{ + memset(inbuf, 0, sizeof(inbuf)); + + /* Unencrypted read */ + inbuf[0] = IOCTL_DI_UNENCREAD << 24; + inbuf[1] = len; + inbuf[2] = offset; + + s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_UNENCREAD, inbuf, sizeof(inbuf), buf, len); + if(ret < 0) + return ret; return (ret == 1) ? 0 : -ret; } s32 WDVD_OpenPartition(u32 offset, u32 *IOS) { - if (di_fd < 0) - return di_fd; - static u8 Tmd_Buffer[0x4A00] ATTRIBUTE_ALIGN(32); static ioctlv Vectors[5] ATTRIBUTE_ALIGN(32); s32 ret; @@ -136,144 +150,37 @@ s32 WDVD_OpenPartition(u32 offset, u32 *IOS) Vectors[4].len = 0x20; ret = IOS_Ioctlv(di_fd, IOCTL_DI_OPENPART, 3, 2, (ioctlv *)Vectors); - *IOS = (u32)(Tmd_Buffer[0x18b]); - if (ret < 0) + if(ret < 0) return ret; - + *IOS = (u32)(Tmd_Buffer[0x18b]); return (ret == 1) ? 0 : -ret; } -s32 WDVD_ClosePartition(void) -{ - memset(inbuf, 0, sizeof(inbuf)); - - /* Close partition */ - inbuf[0] = IOCTL_DI_CLOSEPART << 24; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_CLOSEPART, inbuf, sizeof(inbuf), NULL, 0); - if (ret < 0) return ret; - - return (ret == 1) ? 0 : -ret; -} - -s32 WDVD_UnencryptedRead(void *buf, u32 len, u32 offset) -{ - memset(inbuf, 0, sizeof(inbuf)); - - /* Unencrypted read */ - inbuf[0] = IOCTL_DI_UNENCREAD << 24; - inbuf[1] = len; - inbuf[2] = offset; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_UNENCREAD, inbuf, sizeof(inbuf), buf, len); - if (ret < 0) return ret; - - return (ret == 1) ? 0 : -ret; -} - -s32 WDVD_Read(void *buf, u32 len, u32 offset) -{ - memset(inbuf, 0, sizeof(inbuf)); - - /* Disc read */ - inbuf[0] = IOCTL_DI_READ << 24; - inbuf[1] = len; - inbuf[2] = offset; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_READ, inbuf, sizeof(inbuf), buf, len); - if (ret < 0) return ret; - - return (ret == 1) ? 0 : -ret; -} - -s32 WDVD_LowRequestError(u32 *error) -{ - memset(inbuf, 0, sizeof(inbuf)); - - inbuf[0] = IOCTL_DI_REQUESTERROR << 24; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_REQUESTERROR, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - - if (ret == 1) - memcpy(error, outbuf, sizeof(u32)); - - return (ret == 1) ? 0 : -ret; -} - -s32 WDVD_WaitForDisc(void) -{ - memset(inbuf, 0, sizeof(inbuf)); - - /* Wait for disc */ - inbuf[0] = IOCTL_DI_WAITCVRCLOSE << 24; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_WAITCVRCLOSE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - - return (ret == 1) ? 0 : -ret; -} - -s32 WDVD_GetCoverStatus(u32 *status) -{ - memset(inbuf, 0, sizeof(inbuf)); - - /* Get cover status */ - inbuf[0] = IOCTL_DI_GETCOVER << 24; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_GETCOVER, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - - if (ret == 1) { - /* Copy cover status */ - memcpy(status, outbuf, sizeof(u32)); - - return 0; - } - - return -ret; -} - s32 WDVD_SetUSBMode(u32 mode, const u8 *id, s32 partition) { - gprintf("WDVD_SetUSBMode, Mode: %i, ID: %s, Partition: %i\n", mode, id, partition); - memset(inbuf, 0, sizeof(inbuf)); - - /* Set USB mode */ - inbuf[0] = IOCTL_DI_SETWBFSMODE << 24; - inbuf[1] = mode; - - /* Copy ID */ - if(id) - { - memcpy(&inbuf[2], id, 6); - if(partition >= 0) - inbuf[5] = partition; - } - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_SETWBFSMODE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - - if(ret < 0) - return ret; - return(ret == 1) ? 0 : -ret; -} - -s32 WDVD_Read_Disc_BCA(void *buf) -{ + if(id) + gprintf("WDVD_SetUSBMode, Mode: %i, ID: %s, Partition: %i\n", mode, id, partition); memset(inbuf, 0, sizeof(inbuf)); - /* Disc read */ - inbuf[0] = IOCTL_DI_DISC_BCA << 24; - //inbuf[1] = 64; + /* Set USB mode */ + inbuf[0] = IOCTL_DI_SETWBFSMODE << 24; + inbuf[1] = mode; - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_DISC_BCA, inbuf, sizeof(inbuf), buf, 64); - if (ret < 0) return ret; + /* Copy ID */ + if(id) + { + memcpy(&inbuf[2], id, 6); + if(partition >= 0) + inbuf[5] = partition; + } - return (ret == 1) ? 0 : -ret; + s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_SETWBFSMODE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); + if(ret < 0) + return ret; + return(ret == 1) ? 0 : -ret; } // frag - s32 WDVD_SetFragList(int device, void *fraglist, int size) { gprintf("WDVD_SetFragList, Device: %i, Size: %i\n", device, size); @@ -288,63 +195,7 @@ s32 WDVD_SetFragList(int device, void *fraglist, int size) DCFlushRange(fraglist, size); s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_SETFRAG, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - + if(ret < 0) + return ret; return (ret == 1) ? 0 : -ret; } - -s32 WDVD_hello(u32 *status) -{ - memset(inbuf, 0, sizeof(inbuf)); - - inbuf[0] = IOCTL_DI_HELLO << 24; - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_HELLO, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - - if (ret == 1) - { - if (status) memcpy(status, outbuf, sizeof(u32)); - return 0; - } - - return -ret; -} - -s32 WDVD_SetStreaming(void) -{ - memset(inbuf, 0, sizeof(inbuf)); - - inbuf[0] = IOCTL_DI_DVDAUDIOBUFFERCFG << 24; - - if ((*(u32*)0x80000008)>>24) - { - inbuf[1] = 1; - if(((*(u32*)0x80000008)>>16) & 0xFF) - inbuf[2] = 10; - else - inbuf[2] = 0; - } - else - { - inbuf[1] = 0; - inbuf[2] = 0; - } - - s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_DVDAUDIOBUFFERCFG, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); - if (ret < 0) return ret; - - return (ret == 1) ? 0 : -ret; -} - -s32 WDVD_NEEK_LoadDisc(u32 id, u32 magic) -{ - u32 *vec = (u32*)memalign(32, sizeof(u32) * 2); - vec[0] = id; - vec[1] = magic; - - s32 ret = IOS_Ioctl(di_fd, 0x25, vec, sizeof(u32) * 2, NULL, 0); - free(vec); - - return ret; -} diff --git a/resources/wiiflow_game_booter/source/wdvd.h b/resources/wiiflow_game_booter/source/wdvd.h index f6fc45fc..3ab24b06 100644 --- a/resources/wiiflow_game_booter/source/wdvd.h +++ b/resources/wiiflow_game_booter/source/wdvd.h @@ -8,26 +8,19 @@ extern "C" { /* Prototypes */ s32 WDVD_Init(void); s32 WDVD_Close(void); -s32 WDVD_GetHandle(void); s32 WDVD_Reset(void); -s32 WDVD_ReadDiskId(void *); -s32 WDVD_Seek(u32); +s32 WDVD_Seek(u32 offset); + +s32 WDVD_ReadDiskId(void *id); +s32 WDVD_Read(void *buf, u32 len, u32 offset); +s32 WDVD_UnencryptedRead(void *buf, u32 len, u32 offset); s32 WDVD_OpenPartition(u32 offset, u32 *IOS); -s32 WDVD_ClosePartition(void); -s32 WDVD_UnencryptedRead(void *, u32, u32); -s32 WDVD_Read(void *, u32, u32); -s32 WDVD_LowRequestError(u32 *error); -s32 WDVD_WaitForDisc(void); -s32 WDVD_GetCoverStatus(u32 *); -s32 WDVD_SetUSBMode(u32, const u8 *, s32); -s32 WDVD_Read_Disc_BCA(void *); + +s32 WDVD_SetUSBMode(u32 mode, const u8 *id, s32 partition); s32 WDVD_SetFragList(int device, void *fraglist, int size); -s32 WDVD_SetStreaming(void); -s32 WDVD_NEEK_LoadDisc(u32 id, u32 magic); #ifdef __cplusplus } #endif /* __cplusplus */ #endif - diff --git a/source/list/ListGenerator.cpp b/source/list/ListGenerator.cpp index b13796a9..d4e74d72 100644 --- a/source/list/ListGenerator.cpp +++ b/source/list/ListGenerator.cpp @@ -152,8 +152,9 @@ static void Create_Plugin_List(char *FullPath) strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1); strncpy(ListElement.id, "PLUGIN", 6); - *strrchr(FullPath, '.') = '\0'; + FolderTitle = strrchr(FullPath, '/') + 1; + *strrchr(FolderTitle, '.') = '\0'; mbstowcs(ListElement.title, FolderTitle, 63); Asciify(ListElement.title); diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 45e83724..ecf2247b 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -2109,7 +2109,6 @@ bool CMenu::_loadChannelList(void) int emuPartition = -1; bool disable_emu = (m_cfg.getBool("NAND", "disable", true) || neek2o()); - static bool last_emu_state = disable_emu; if(!disable_emu) { @@ -2125,59 +2124,32 @@ bool CMenu::_loadChannelList(void) currentPartition = emuPartition; } - static u8 lastPartition = currentPartition; - - static bool first = true; - - bool changed = lastPartition != currentPartition || last_emu_state != disable_emu || first; - - if(changed) - UpdateCache(COVERFLOW_CHANNEL); - - - if(first && !disable_emu) + if(!disable_emu) { char basepath[64]; snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[currentPartition], emuPath.c_str()); NandHandle.PreNandCfg(basepath, m_cfg.getBool("NAND", "real_nand_miis", false), m_cfg.getBool("NAND", "real_nand_config", false)); - first = false; } - string nandpath = sfmt("%s:%s/", DeviceName[currentPartition], emuPath.empty() ? "" : emuPath.c_str()); - NandHandle.Disable_Emu(); if(!disable_emu) { MusicPlayer.Stop(); _TempLoadIOS(); - if(!DeviceHandle.IsInserted(lastPartition)) - DeviceHandle.Mount(lastPartition); - DeviceHandle.UnMount(currentPartition); - NandHandle.SetPaths(emuPath.c_str(), currentPartition, disable_emu); if(NandHandle.Enable_Emu() < 0) NandHandle.Disable_Emu(); - - gprintf("Using path: \"%s\" for NAND emulation\n", nandpath.c_str()); } - if(!DeviceHandle.IsInserted(currentPartition)) DeviceHandle.Mount(currentPartition); - if(NandHandle.EmulationEnabled() || disable_emu) - { - string cacheDir; - if(!disable_emu) - cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]); - bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache"); - vector NullVector; - m_gameList.CreateList(m_current_view, currentPartition, std::string(), - NullVector, cacheDir, updateCache); - } - - lastPartition = currentPartition; - last_emu_state = disable_emu; - + string cacheDir; + if(!disable_emu) + cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]); + bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache"); + vector NullVector; + m_gameList.CreateList(m_current_view, currentPartition, std::string(), + NullVector, cacheDir, updateCache); return m_gameList.size() > 0 ? true : false; } diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 4d190052..bf619f3a 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -815,7 +815,8 @@ int CMenu::main(void) m_cf.mouse(m_vid, chan, -1, -1); } } - if(m_reload) + ScanInput(); + if(m_reload || BTN_B_HELD) { m_cf.clear(); _showWaitMessage();