mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 20:56:53 +01:00
*Added back license that was removed by mistake
*Fixed bug i added right before commit for Brawl+ *Some compile warnings removed
This commit is contained in:
parent
eb052a0fe9
commit
52a44ef10f
@ -2,8 +2,8 @@
|
|||||||
<app version="1">
|
<app version="1">
|
||||||
<name> USB Loader GX</name>
|
<name> USB Loader GX</name>
|
||||||
<coder>USB Loader GX Team</coder>
|
<coder>USB Loader GX Team</coder>
|
||||||
<version>1.0 r916</version>
|
<version>1.0 r919</version>
|
||||||
<release_date>201002251225</release_date>
|
<release_date>201002271854</release_date>
|
||||||
<short_description>Loads games from USB-devices</short_description>
|
<short_description>Loads games from USB-devices</short_description>
|
||||||
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
||||||
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
||||||
|
@ -110,14 +110,19 @@ void app_loadgameconfig(char *discid)
|
|||||||
//tempgameconfsize = defaultgameconfig_size + 1;
|
//tempgameconfsize = defaultgameconfig_size + 1;
|
||||||
|
|
||||||
char filepath[200];
|
char filepath[200];
|
||||||
snprintf(filepath, "%s/gameconfig.txt", Settings.Cheatcodespath);
|
snprintf(filepath, sizeof(filepath), "%s/gameconfig.txt", Settings.Cheatcodespath);
|
||||||
|
|
||||||
fp = fopen(filepath, "rb");
|
fp = fopen(filepath, "rb");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
snprintf(filepath, "%s/gameconfig.txt", bootDevice);
|
snprintf(filepath, sizeof(filepath), "SD:/gameconfig.txt");
|
||||||
fp = fopen(filepath, "rb");
|
fp = fopen(filepath, "rb");
|
||||||
|
if(!fp)
|
||||||
|
{
|
||||||
|
snprintf(filepath, sizeof(filepath), "USB:/gameconfig.txt");
|
||||||
|
fp = fopen(filepath, "rb");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nuke (wiinuke@gmail.com)
|
||||||
|
*
|
||||||
|
* this file is part of GeckoOS for USB Gecko
|
||||||
|
* http://www.usbgecko.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* 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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -41,11 +61,11 @@ extern void vipatch(u32 address, u32 len);
|
|||||||
|
|
||||||
static const u32 multidolpatch1[2] = {
|
static const u32 multidolpatch1[2] = {
|
||||||
0x3C03FFB4,0x28004F43
|
0x3C03FFB4,0x28004F43
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u32 healthcheckhook[2] = {
|
static const u32 healthcheckhook[2] = {
|
||||||
0x41810010,0x881D007D
|
0x41810010,0x881D007D
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u32 updatecheckhook[3] = {
|
static const u32 updatecheckhook[3] = {
|
||||||
0x80650050,0x80850054,0xA0A50058
|
0x80650050,0x80850054,0xA0A50058
|
||||||
@ -109,7 +129,7 @@ static const u32 vipatchcode[3] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const u32 viwiihooks[4] = {
|
const u32 viwiihooks[4] = {
|
||||||
0x7CE33B78,0x38870034,0x38A70038,0x38C7004C
|
0x7CE33B78,0x38870034,0x38A70038,0x38C7004C
|
||||||
};
|
};
|
||||||
|
|
||||||
const u32 kpadhooks[4] = {
|
const u32 kpadhooks[4] = {
|
||||||
@ -194,12 +214,12 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
{
|
{
|
||||||
switch(hooktype)
|
switch(hooktype)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 0x00:
|
case 0x00:
|
||||||
hookpatched = true;
|
hookpatched = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x01:
|
case 0x01:
|
||||||
if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0)
|
if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0)
|
||||||
{
|
{
|
||||||
patchhook((u32)addr_start, len);
|
patchhook((u32)addr_start, len);
|
||||||
@ -213,7 +233,7 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x02:
|
case 0x02:
|
||||||
|
|
||||||
if(memcmp(addr_start, kpadhooks, sizeof(kpadhooks))==0)
|
if(memcmp(addr_start, kpadhooks, sizeof(kpadhooks))==0)
|
||||||
{
|
{
|
||||||
patchhook((u32)addr_start, len);
|
patchhook((u32)addr_start, len);
|
||||||
@ -231,9 +251,9 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
hookpatched = true;
|
hookpatched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x03:
|
case 0x03:
|
||||||
|
|
||||||
if(memcmp(addr_start, joypadhooks, sizeof(joypadhooks))==0)
|
if(memcmp(addr_start, joypadhooks, sizeof(joypadhooks))==0)
|
||||||
{
|
{
|
||||||
patchhook((u32)addr_start, len);
|
patchhook((u32)addr_start, len);
|
||||||
@ -245,9 +265,9 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
hookpatched = true;
|
hookpatched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x04:
|
case 0x04:
|
||||||
|
|
||||||
if(memcmp(addr_start, gxdrawhooks, sizeof(gxdrawhooks))==0)
|
if(memcmp(addr_start, gxdrawhooks, sizeof(gxdrawhooks))==0)
|
||||||
{
|
{
|
||||||
patchhook((u32)addr_start, len);
|
patchhook((u32)addr_start, len);
|
||||||
@ -259,9 +279,9 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
hookpatched = true;
|
hookpatched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x05:
|
case 0x05:
|
||||||
|
|
||||||
if(memcmp(addr_start, gxflushhooks, sizeof(gxflushhooks))==0)
|
if(memcmp(addr_start, gxflushhooks, sizeof(gxflushhooks))==0)
|
||||||
{
|
{
|
||||||
patchhook((u32)addr_start, len);
|
patchhook((u32)addr_start, len);
|
||||||
@ -273,9 +293,9 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
hookpatched = true;
|
hookpatched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x06:
|
case 0x06:
|
||||||
|
|
||||||
if(memcmp(addr_start, ossleepthreadhooks, sizeof(ossleepthreadhooks))==0)
|
if(memcmp(addr_start, ossleepthreadhooks, sizeof(ossleepthreadhooks))==0)
|
||||||
{
|
{
|
||||||
patchhook((u32)addr_start, len);
|
patchhook((u32)addr_start, len);
|
||||||
@ -287,9 +307,9 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
hookpatched = true;
|
hookpatched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x07:
|
case 0x07:
|
||||||
|
|
||||||
if(memcmp(addr_start, axnextframehooks, sizeof(axnextframehooks))==0)
|
if(memcmp(addr_start, axnextframehooks, sizeof(axnextframehooks))==0)
|
||||||
{
|
{
|
||||||
patchhook((u32)addr_start, len);
|
patchhook((u32)addr_start, len);
|
||||||
@ -301,9 +321,9 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
hookpatched = true;
|
hookpatched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x08:
|
case 0x08:
|
||||||
|
|
||||||
//if(memcmp(addr_start, customhook, customhooksize)==0)
|
//if(memcmp(addr_start, customhook, customhooksize)==0)
|
||||||
//{
|
//{
|
||||||
// patchhook((u32)addr_start, len);
|
// patchhook((u32)addr_start, len);
|
||||||
@ -325,7 +345,7 @@ bool dogamehooks(void *addr, u32 len)
|
|||||||
/*
|
/*
|
||||||
void patchdol(void *addr, u32 len)
|
void patchdol(void *addr, u32 len)
|
||||||
{
|
{
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
@ -345,17 +365,17 @@ void patchdol(void *addr, u32 len)
|
|||||||
*/
|
*/
|
||||||
void langpatcher(void *addr, u32 len)
|
void langpatcher(void *addr, u32 len)
|
||||||
{
|
{
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
while(addr_start < addr_end)
|
while(addr_start < addr_end)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
if(memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
||||||
if(configbytes[0] != 0xCD){
|
if(configbytes[0] != 0xCD){
|
||||||
langvipatch((u32)addr_start, len, configbytes[0]);
|
langvipatch((u32)addr_start, len, configbytes[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addr_start += 4;
|
addr_start += 4;
|
||||||
}
|
}
|
||||||
@ -363,17 +383,17 @@ void langpatcher(void *addr, u32 len)
|
|||||||
/*
|
/*
|
||||||
void patchdebug(void *addr, u32 len)
|
void patchdebug(void *addr, u32 len)
|
||||||
{
|
{
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
while(addr_start < addr_end)
|
while(addr_start < addr_end)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(memcmp(addr_start, fwritepatch, sizeof(fwritepatch))==0) {
|
if(memcmp(addr_start, fwritepatch, sizeof(fwritepatch))==0) {
|
||||||
|
|
||||||
memcpy(addr_start,fwrite_patch_bin,fwrite_patch_bin_len);
|
memcpy(addr_start,fwrite_patch_bin,fwrite_patch_bin_len);
|
||||||
// apply patch
|
// apply patch
|
||||||
}
|
}
|
||||||
addr_start += 4;
|
addr_start += 4;
|
||||||
}
|
}
|
||||||
@ -381,7 +401,7 @@ void patchdebug(void *addr, u32 len)
|
|||||||
*/
|
*/
|
||||||
void vidolpatcher(void *addr, u32 len)
|
void vidolpatcher(void *addr, u32 len)
|
||||||
{
|
{
|
||||||
|
|
||||||
void *addr_start = addr;
|
void *addr_start = addr;
|
||||||
void *addr_end = addr+len;
|
void *addr_end = addr+len;
|
||||||
|
|
||||||
|
@ -282,9 +282,7 @@ s32 USBStorage2_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
|
|||||||
|
|
||||||
static bool __usbstorage_Startup(void)
|
static bool __usbstorage_Startup(void)
|
||||||
{
|
{
|
||||||
|
return USBStorage2_Init()==0;
|
||||||
|
|
||||||
return USBStorage2_Init()==0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool __usbstorage_IsInserted(void)
|
static bool __usbstorage_IsInserted(void)
|
||||||
@ -340,20 +338,6 @@ const DISC_INTERFACE __io_usbstorage2 = {
|
|||||||
(FN_MEDIUM_SHUTDOWN)&__usbstorage_Shutdown
|
(FN_MEDIUM_SHUTDOWN)&__usbstorage_Shutdown
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool __io_usb_Startup(void)
|
|
||||||
{
|
|
||||||
return USBStorage2_Init() >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool __io_usb_IsInserted(void)
|
|
||||||
{
|
|
||||||
s32 ret;
|
|
||||||
if (fd < 0) return false;
|
|
||||||
ret = USBStorage2_GetCapacity(NULL);
|
|
||||||
if (ret == 0) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool __io_usb_ReadSectors(u32 sector, u32 count, void *buffer)
|
bool __io_usb_ReadSectors(u32 sector, u32 count, void *buffer)
|
||||||
{
|
{
|
||||||
s32 ret = USBStorage2_ReadSectors(sector, count, buffer);
|
s32 ret = USBStorage2_ReadSectors(sector, count, buffer);
|
||||||
@ -366,17 +350,6 @@ bool __io_usb_WriteSectors(u32 sector, u32 count, void *buffer)
|
|||||||
return ret > 0;
|
return ret > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool __io_usb_ClearStatus(void)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool __io_usb_Shutdown(void)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool __io_usb_NOP(void)
|
static bool __io_usb_NOP(void)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
|
Loading…
Reference in New Issue
Block a user