*Lot's of cleanup and file/function movement.

*Homebrew boot changed a bit (cleanup)
*A lot more stuff i can't remember anymore
This commit is contained in:
dimok321 2010-11-06 15:30:14 +00:00
parent bed86339f7
commit 33ce3e48ab
31 changed files with 471 additions and 632 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r994</version>
<release_date>201010280947</release_date>
<version>1.0 r995</version>
<release_date>201010311348</release_date>
<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.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

@ -61,7 +61,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80B00
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lpngu -lpng -lgd -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lmxml -ljpeg -lunzip
LIBS := -lpngu -lpng -lgd -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lmxml -ljpeg -lzip
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,8 @@
#include "mload/mload.h"
#include "mload/mload_modules.h"
#include "usbloader/disc.h"
#include "usbloader/apploader.h"
#include "usbloader/wdvd.h"
#include "usbloader/GameList.h"
#include "settings/Settings.h"
#include "settings/CGameSettings.h"
@ -9,17 +11,87 @@
#include "usbloader/wbfs.h"
#include "settings/newtitles.h"
#include "patches/fst.h"
#include "patches/gamepatches.h"
#include "patches/wip.h"
#include "system/IosLoader.h"
#include "wad/nandtitle.h"
#include "menu/menus.h"
#include "memory/memory.h"
#include "fatmounter.h"
#include "FontSystem.h"
#include "sys.h"
//appentrypoint has to be global because of asm
u32 AppEntrypoint = 0;
struct discHdr *dvdheader = NULL;
extern int load_from_fs;
extern int mountMethod;
static u32 BootPartition(char * dolpath, u8 videoselected, u8 languageChoice, u8 cheat, u8 vipatch, u8 patchcountrystring,
u8 alternatedol, u32 alternatedoloffset, u32 returnTo, u8 fix002)
{
gprintf("booting partition IOS %u v%u\n", IOS_GetVersion(), IOS_GetRevision());
entry_point p_entry;
s32 ret;
u64 offset;
/* Find game partition offset */
ret = __Disc_FindPartition(&offset);
if (ret < 0)
return 0;
/* Open specified partition */
ret = WDVD_OpenPartition(offset);
if (ret < 0)
return 0;
load_wip_code((u8*) Disc_ID);
/* If a wip file is loaded for this game this does nothing - Dimok */
PoPPatch();
/* Setup low memory */
__Disc_SetLowMem();
/* Run apploader */
ret = Apploader_Run(&p_entry, dolpath, cheat, videoselected, languageChoice, vipatch, patchcountrystring,
alternatedol, alternatedoloffset, returnTo, fix002);
if (ret < 0)
return 0;
free_wip();
return (u32) p_entry;
}
int BootGame(const char * gameID)
{
if(!gameID || strlen(gameID) < 3)
return -1;
if (mountMethod == 3)
{
ExitApp();
struct discHdr *header = gameList.GetDiscHeader(gameID);
u32 tid;
memcpy(&tid, header->id, 4);
gprintf("\nBooting title %016llx", TITLE_ID( ( header->id[5] == '1' ? 0x00010001 : 0x00010002 ), tid ));
WII_Initialize();
return WII_LaunchTitle(TITLE_ID( ( header->id[5] == '1' ? 0x00010001 : 0x00010002 ), tid ));
}
if (mountMethod == 2)
{
ExitApp();
gprintf("\nLoading BC for GameCube");
WII_Initialize();
return WII_LaunchTitle(0x0000000100000100ULL);
}
AppCleanUp();
gprintf("\tSettings.partition: %d\n", Settings.partition);
gameList.LoadUnfiltered();
@ -63,6 +135,14 @@ int BootGame(const char * gameID)
returnToLoaderGV = game_cfg->returnTo;
}
if(iosChoice != IOS_GetVersion())
{
gprintf("Reloading into cIOS: %i\n", iosChoice);
IosLoader::LoadGameCios(iosChoice);
if(MountGamePartition(false) < 0)
return -1;
}
if (!mountMethod)
{
gprintf("Loading fragment list...");
@ -114,16 +194,35 @@ int BootGame(const char * gameID)
gprintf("\tDisc_wiiBoot\n");
shadow_mload();
ret = Disc_WiiBoot(Settings.dolpath, videoChoice, languageChoice, ocarinaChoice, viChoice, countrystrings,
/* Boot partition */
AppEntrypoint = BootPartition(Settings.dolpath, videoChoice, languageChoice, ocarinaChoice, viChoice, countrystrings,
alternatedol, alternatedoloffset, channel, fix002);
if (ret < 0)
Sys_LoadMenu();
if(AppEntrypoint != 0)
{
bool enablecheat = false;
//should never get here
printf("Returning entry point: 0x%0x\n", ret);
if (ocarinaChoice)
{
// OCARINA STUFF - FISHEARS
if (ocarina_load_code((u8 *) Disc_ID) > 0)
{
ocarina_do_code();
enablecheat = true;
}
}
return ret;
shadow_mload();
UnmountNTFS();
SDCard_deInit();
USBDevice_deInit();
gprintf("Jumping to game entrypoint: 0x%08X.\n", AppEntrypoint);
return Disc_JumpToEntrypoint(videoChoice, enablecheat);
}
WDVD_ClosePartition();
return -1;
}

View File

@ -33,7 +33,6 @@
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <unzip/unzip.h>
#include "prompts/ProgressWindow.h"
#include "FileOperations/fileops.h"

View File

@ -28,7 +28,7 @@
#ifndef _ZIPFILE_H_
#define _ZIPFILE_H_
#include <unzip/unzip.h>
#include <zip/unzip.h>
typedef struct
{

View File

@ -1,6 +1,7 @@
#include <gccore.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
/* init-globals */
bool geckoinit = false;
@ -9,22 +10,24 @@ bool textVideoInit = false;
#ifndef NO_DEBUG
#include <stdarg.h>
//using the gprintf from crediar because it is smaller than mine
void gprintf(const char *str, ...)
void gprintf(const char *format, ...)
{
if (!(geckoinit)) return;
if (!geckoinit)
return;
char astr[0x100];
char * tmp = NULL;
va_list va;
va_start(va, format);
if((vasprintf(&tmp, format, va) >= 0) && tmp)
{
u32 level = IRQ_Disable();
usb_sendbuffer(1, tmp, strlen(tmp));
IRQ_Restore(level);
}
va_end(va);
va_list ap;
va_start( ap, str );
vsprintf(astr, str, ap);
va_end( ap );
usb_sendbuffer(1, astr, strlen(astr));
//usb_sendbuffer_safe( 1, astr, strlen(astr) );
if(tmp)
free(tmp);
}
bool InitGecko()

View File

@ -1,141 +1,3 @@
#if 0
#include <gccore.h>
#include <ogcsys.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <ogc/machine/processor.h>
#include <wiiuse/wpad.h>
#include <vector>
#include <string>
#include "usbloader/usbstorage2.h"
#include "dolloader.h"
#include "fatmounter.h"
#include "sys.h"
extern const u8 app_booter_dol[];
extern const u32 app_booter_dol_size;
static u8 *homebrewbuffer = ( u8 * ) 0x92000000;
static int homebrewsize = 0;
static std::vector<std::string> Arguments;
void AddBootArgument( const char * argv )
{
std::string arg( argv );
Arguments.push_back( arg );
}
int CopyHomebrewMemory( u8 *temp, u32 pos, u32 len )
{
homebrewsize += len;
memcpy( ( homebrewbuffer ) + pos, temp, len );
return 1;
}
void FreeHomebrewBuffer()
{
homebrewbuffer = ( u8 * )0x92000000;
homebrewsize = 0;
}
static int SetupARGV( struct __argv * args )
{
if ( !args )
return -1;
bzero( args, sizeof( struct __argv ) );
args->argvMagic = ARGV_MAGIC;
u32 stringlength = 1;
/** Append Arguments **/
for ( u32 i = 0; i < Arguments.size(); i++ )
{
stringlength += Arguments[i].size() + 1;
}
args->length = stringlength;
args->commandLine = ( char* ) malloc( args->length );
if ( !args->commandLine )
return -1;
u32 argc = 0;
u32 position = 0;
/** Append Arguments **/
for ( u32 i = 0; i < Arguments.size(); i++ )
{
strcpy( &args->commandLine[position], Arguments[i].c_str() );
position += Arguments[i].size() + 1;
argc++;
}
args->argc = argc;
args->commandLine[args->length - 1] = '\0';
args->argv = &args->commandLine;
args->endARGV = args->argv + 1;
Arguments.clear();
return 0;
}
int BootHomebrew()
{
if ( homebrewsize <= 0 )
Sys_BackToLoader();
SDCard_deInit();
USBDevice_deInit();
USBStorage2_Deinit();
struct __argv args;
SetupARGV( &args );
u32 cpu_isr;
entrypoint entry = ( entrypoint ) load_dol( app_booter_dol, &args );
if ( !entry )
Sys_BackToLoader();
VIDEO_SetBlack( true );
VIDEO_Flush();
VIDEO_WaitVSync();
SYS_ResetSystem( SYS_SHUTDOWN, 0, 0 );
_CPU_ISR_Disable ( cpu_isr );
__exception_closeall();
entry();
_CPU_ISR_Restore ( cpu_isr );
return 0;
}
int BootHomebrew( const char * filepath )
{
FILE * file = fopen( filepath, "rb" );
if ( !file )
Sys_BackToLoader();
fseek( file, 0, SEEK_END );
int size = ftell( file );
rewind( file );
homebrewsize = fread( homebrewbuffer, 1, size, file );
fclose( file );
AddBootArgument( filepath );
return BootHomebrew();
}
#endif
#include <gccore.h>
#include <ogcsys.h>
#include <malloc.h>
@ -153,23 +15,12 @@ int BootHomebrew( const char * filepath )
#include "fatmounter.h"
#include "dolloader.h"
void *innetbuffer = NULL;
static u8 *homebrewbuffer = (u8 *) 0x92000000;
u32 homebrewsize = 0;
static u32 homebrewsize = 0;
static std::vector<std::string> Arguments;
extern const u8 app_booter_dol[];
int AllocHomebrewMemory(u32 filesize)
{
innetbuffer = malloc(filesize);
if (!innetbuffer) return -1;
homebrewsize = filesize;
return 1;
}
extern const u32 app_booter_dol_size;
void AddBootArgument(const char * argv)
{
@ -190,12 +41,6 @@ void FreeHomebrewBuffer()
homebrewbuffer = (u8 *) 0x92000000;
homebrewsize = 0;
if (innetbuffer)
{
free(innetbuffer);
innetbuffer = NULL;
}
Arguments.clear();
}
@ -245,6 +90,8 @@ static int RunAppbooter()
{
if (homebrewsize == 0) return -1;
ExitApp();
struct __argv args;
SetupARGV(&args);
@ -271,13 +118,6 @@ static int RunAppbooter()
}
}
SDCard_deInit();
USBDevice_deInit();
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
_CPU_ISR_Disable( cpu_isr );
__exception_closeall();
@ -287,7 +127,7 @@ static int RunAppbooter()
return 0;
}
int BootHomebrew(char * filepath)
int BootHomebrew(const char * filepath)
{
void *buffer = NULL;
u32 filesize = 0;
@ -327,18 +167,5 @@ int BootHomebrew(char * filepath)
int BootHomebrewFromMem()
{
gprintf("BootHomebrewFromMem()\n %p, %08x\n", innetbuffer, homebrewsize);
if (!innetbuffer)
{
gprintf("!innetbuffer\n");
SDCard_deInit();
USBDevice_deInit();
Sys_BackToLoader();
}
CopyHomebrewMemory((u8*) innetbuffer, 0, homebrewsize);
free(innetbuffer);
return RunAppbooter();
}

View File

@ -1,15 +1,10 @@
#ifndef _BOOTHOMEBREW_H_
#define _BOOTHOMEBREW_H_
//int BootHomebrew();
int BootHomebrew(const char * filepath);
int BootHomebrewFromMem();
int BootHomebrew(char * filepath);
int CopyHomebrewMemory(u8 *temp, u32 pos, u32 len);
void AddBootArgument(const char * arg);
void FreeHomebrewBuffer();
int LoadHomebrew(const char * filepath);
int AllocHomebrewMemory(u32 filesize);
extern void *innetbuffer;
extern u32 homebrewsize;
#endif

View File

@ -9,7 +9,7 @@
#include <string.h>
#include <unistd.h>
#include <zlib.h>
#include <unzip/unzip.h>
#include <zip/unzip.h>
#include "language/gettext.h"
#include "libwiigui/gui.h"
@ -34,16 +34,12 @@ extern void ResumeGui();
extern void HaltGui();
/*** Extern variables ***/
extern GuiImage * bgImg;
extern u32 infilesize;
extern u32 uncfilesize;
extern char wiiloadVersion[2];
extern u8 shutdown;
extern u8 reset;
/*** Variables used elsewhere ***/
u8 boothomebrew = 0;
/****************************************************************************
* roundup Function
***************************************************************************/
@ -54,6 +50,137 @@ int roundup(float number)
else return (int) (number + 1);
}
static int ReceiveFile()
{
char filesizetxt[50];
char temp[50];
u32 filesize = 0;
if (infilesize < MB_SIZE)
snprintf(filesizetxt, sizeof(filesizetxt), tr( "Incoming file %0.2fKB" ), infilesize / KB_SIZE);
else snprintf(filesizetxt, sizeof(filesizetxt), tr( "Incoming file %0.2fMB" ), infilesize / MB_SIZE);
snprintf(temp, sizeof(temp), tr( "Load file from: %s ?" ), GetIncommingIP());
int choice = WindowPrompt(filesizetxt, temp, tr( "OK" ), tr( "Cancel" ));
if (choice == 0)
return MENU_NONE;
u32 read = 0;
int len = NETWORKBLOCKSIZE;
filesize = infilesize;
u8 * buffer = (u8 *) malloc(infilesize);
if(!buffer)
{
WindowPrompt(tr( "Not enough memory." ), 0, tr( "OK" ));
return MENU_NONE;
}
bool error = false;
while (read < infilesize)
{
ShowProgress(tr( "Receiving file from:" ), GetIncommingIP(), NULL, read, infilesize, true);
if (infilesize - read < (u32) len)
len = infilesize - read;
else len = NETWORKBLOCKSIZE;
int result = network_read(buffer+read, len);
if (result < 0)
{
WindowPrompt(tr( "Error while transfering data." ), 0, tr( "OK" ));
free(buffer);
return MENU_NONE;
}
if (!result)
{
break;
}
read += result;
}
char filename[101];
network_read((u8*) &filename, 100);
// Do we need to unzip this thing?
if (wiiloadVersion[0] > 0 || wiiloadVersion[1] > 4)
{
// We need to unzip...
if (buffer[0] == 'P' && buffer[1] == 'K' && buffer[2] == 0x03 && buffer[3] == 0x04)
{
// It's a zip file, unzip to the apps directory
// Zip archive, ask for permission to install the zip
char zippath[255];
sprintf((char *) &zippath, "%s%s", Settings.homebrewapps_path, filename);
FILE *fp = fopen(zippath, "wb");
if (!fp)
{
WindowPrompt(tr( "Error writing the data." ), 0, tr( "OK" ));
return MENU_NONE;
}
fwrite(buffer, 1, infilesize, fp);
fclose(fp);
free(buffer);
buffer = NULL;
// Now unzip the zip file...
unzFile uf = unzOpen(zippath);
if (uf == NULL)
{
WindowPrompt(tr( "Error while opening the zip." ), 0, tr( "OK" ));
return MENU_NONE;
}
extractZip(uf, 0, 1, 0, Settings.homebrewapps_path);
unzCloseCurrentFile(uf);
remove(zippath);
WindowPrompt(tr( "Success:" ),
tr( "Uploaded ZIP file installed to homebrew directory." ), tr( "OK" ));
// Reload this menu here...
return MENU_HOMEBREWBROWSE;
}
else if (uncfilesize != 0) // if uncfilesize == 0, it's not compressed
{
// It's compressed, uncompress
u8 *unc = (u8 *) malloc(uncfilesize);
uLongf f = uncfilesize;
error = uncompress(unc, &f, buffer, infilesize) != Z_OK;
uncfilesize = f;
filesize = uncfilesize;
free(buffer);
buffer = unc;
}
}
CopyHomebrewMemory(buffer, 0, filesize);
free(buffer);
ProgressStop();
if (error || read != infilesize || strcasestr(filename, ".dol") || strcasestr(filename, ".elf"))
{
WindowPrompt(tr( "Error:" ), tr( "No data could be read." ), tr( "OK" ));
FreeHomebrewBuffer();
return MENU_NONE;
}
CloseConnection();
AddBootArgument(filename);
return BootHomebrewFromMem();
}
/****************************************************************************
* MenuHomebrewBrowse
***************************************************************************/
@ -695,10 +822,9 @@ int MenuHomebrewBrowse()
XMLInfo[0].GetReleasedate(), XMLInfo[0].GetLongDescription(), iconpath, filesize);
if (choice == 1)
{
boothomebrew = 1;
menu = MENU_EXIT;
snprintf(Settings.selected_homebrew, sizeof(Settings.selected_homebrew), "%s%s",
HomebrewFiles.GetFilepath(fileoffset), HomebrewFiles.GetFilename(fileoffset));
BootHomebrew(Settings.selected_homebrew);
break;
}
MainButton1.ResetState();
@ -728,10 +854,9 @@ int MenuHomebrewBrowse()
XMLInfo[1].GetReleasedate(), XMLInfo[1].GetLongDescription(), iconpath, filesize);
if (choice == 1)
{
boothomebrew = 1;
menu = MENU_EXIT;
snprintf(Settings.selected_homebrew, sizeof(Settings.selected_homebrew), "%s%s",
HomebrewFiles.GetFilepath(fileoffset + 1), HomebrewFiles.GetFilename(fileoffset + 1));
BootHomebrew(Settings.selected_homebrew);
break;
}
MainButton2.ResetState();
@ -761,10 +886,9 @@ int MenuHomebrewBrowse()
XMLInfo[2].GetReleasedate(), XMLInfo[2].GetLongDescription(), iconpath, filesize);
if (choice == 1)
{
boothomebrew = 1;
menu = MENU_EXIT;
snprintf(Settings.selected_homebrew, sizeof(Settings.selected_homebrew), "%s%s",
HomebrewFiles.GetFilepath(fileoffset + 2), HomebrewFiles.GetFilename(fileoffset + 2));
BootHomebrew(Settings.selected_homebrew);
break;
}
MainButton3.ResetState();
@ -794,10 +918,9 @@ int MenuHomebrewBrowse()
XMLInfo[3].GetReleasedate(), XMLInfo[3].GetLongDescription(), iconpath, filesize);
if (choice == 1)
{
boothomebrew = 1;
menu = MENU_EXIT;
snprintf(Settings.selected_homebrew, sizeof(Settings.selected_homebrew), "%s%s",
HomebrewFiles.GetFilepath(fileoffset + 3), HomebrewFiles.GetFilename(fileoffset + 3));
BootHomebrew(Settings.selected_homebrew);
break;
}
MainButton4.ResetState();
@ -864,166 +987,9 @@ int MenuHomebrewBrowse()
else if (infilesize > 0)
{
char filesizetxt[50];
char temp[50];
if (infilesize < MB_SIZE)
snprintf(filesizetxt, sizeof(filesizetxt), tr( "Incoming file %0.2fKB" ), infilesize / KB_SIZE);
else snprintf(filesizetxt, sizeof(filesizetxt), tr( "Incoming file %0.2fMB" ), infilesize / MB_SIZE);
snprintf(temp, sizeof(temp), tr( "Load file from: %s ?" ), GetIncommingIP());
int choice = WindowPrompt(filesizetxt, temp, tr( "OK" ), tr( "Cancel" ));
if (choice == 1)
{
int res = AllocHomebrewMemory(infilesize);
if (res < 0)
{
CloseConnection();
WindowPrompt(tr( "Not enough free memory." ), 0, tr( "OK" ));
}
else
{
u32 read = 0;
u8 *temp = NULL;
int len = NETWORKBLOCKSIZE;
temp = (u8 *) malloc(infilesize);
bool error = false;
u8 *ptr = temp;
while (read < infilesize)
{
ShowProgress(tr( "Receiving file from:" ), GetIncommingIP(), NULL, read, infilesize, true);
if (infilesize - read < (u32) len)
len = infilesize - read;
else len = NETWORKBLOCKSIZE;
int result = network_read(ptr, len);
if (result < 0)
{
WindowPrompt(tr( "Error while transfering data." ), 0, tr( "OK" ));
error = true;
break;
}
if (!result)
{
break;
}
ptr += result;
read += result;
}
char filename[101];
if (!error)
{
network_read((u8*) &filename, 100);
// Do we need to unzip this thing?
if (wiiloadVersion[0] > 0 || wiiloadVersion[1] > 4)
{
// We need to unzip...
if (temp[0] == 'P' && temp[1] == 'K' && temp[2] == 0x03 && temp[3] == 0x04)
{
// It's a zip file, unzip to the apps directory
// Zip archive, ask for permission to install the zip
char zippath[255];
sprintf((char *) &zippath, "%s%s", Settings.homebrewapps_path, filename);
FILE *fp = fopen(zippath, "wb");
if (fp != NULL)
{
fwrite(temp, 1, infilesize, fp);
fclose(fp);
// Now unzip the zip file...
unzFile uf = unzOpen(zippath);
if (uf == NULL)
{
error = true;
}
else
{
extractZip(uf, 0, 1, 0, Settings.homebrewapps_path);
unzCloseCurrentFile(uf);
remove(zippath);
// Reload this menu here...
menu = MENU_HOMEBREWBROWSE;
break;
}
}
else
{
error = true;
}
}
else if (uncfilesize != 0) // if uncfilesize == 0, it's not compressed
{
// It's compressed, uncompress
u8 *unc = (u8 *) malloc(uncfilesize);
uLongf f = uncfilesize;
error = uncompress(unc, &f, temp, infilesize) != Z_OK;
uncfilesize = f;
homebrewsize = uncfilesize;
free(temp);
temp = unc;
}
}
if (!error && strstr(filename, ".zip") == NULL)
{
innetbuffer = temp;
}
}
ProgressStop();
if (error || read != infilesize)
{
WindowPrompt(tr( "Error:" ), tr( "No data could be read." ), tr( "OK" ));
FreeHomebrewBuffer();
}
else
{
if (strstr(filename, ".dol") || strstr(filename, ".DOL") || strstr(filename, ".elf")
|| strstr(filename, ".ELF"))
{
boothomebrew = 2;
AddBootArgument(filename);
menu = MENU_EXIT;
CloseConnection();
break;
}
else if (strstr(filename, ".zip"))
{
WindowPrompt(tr( "Success:" ),
tr( "Uploaded ZIP file installed to homebrew directory." ), tr( "OK" ));
CloseConnection();
}
else
{
FreeHomebrewBuffer();
WindowPrompt(tr( "ERROR:" ), tr( "Not a DOL/ELF file." ), tr( "OK" ));
}
}
}
}
CloseConnection();
ResumeNetworkWait();
menu = ReceiveFile();
CloseConnection();
ResumeNetworkWait();
}
else if (channelBtn.GetState() == STATE_CLICKED)

View File

@ -116,8 +116,6 @@ int main(int argc, char *argv[])
SetupDefaultFont(fontPath);
free(fontPath);
//gprintf("\tEnd of Main()\n");
InitGUIThreads();
MainMenu(MENU_DISCLIST);
return 0;
}

View File

@ -1,36 +1,36 @@
#ifndef __MEMORY_H_
#define __MEMORY_H_
#ifdef __cplusplus
extern "C"
{
#endif
#define Disc_ID ((u32*) 0x80000000)
#define Disc_Region ((u32*) 0x80000003)
#define Disc_Magic ((u32*) 0x80000018)
#define Sys_Magic ((u32*) 0x80000020)
#define Version ((u32*) 0x80000024)
#define Mem_Size ((u32*) 0x80000028)
#define Board_Model ((u32*) 0x8000002C)
#define Arena_L ((u32*) 0x80000030)
#define Arena_H ((u32*) 0x80000034)
#define FST ((u32*) 0x80000038)
#define Max_FST ((u32*) 0x8000003C)
#define Assembler ((u32*) 0x80000060)
#define Video_Mode ((u32*) 0x800000CC)
#define Dev_Debugger ((u32*) 0x800000EC)
#define Simulated_Mem ((u32*) 0x800000F0)
#define BI2 ((u32*) 0x800000F4)
#define Bus_Speed ((u32*) 0x800000F8)
#define CPU_Speed ((u32*) 0x800000FC)
#define Online_Check ((u32*) 0x80003180)
#define GameID_Address ((u32*) 0x80003184)
#define allocate_memory(size) memalign(32, (size+31)&(~31))
#ifdef __cplusplus
}
#endif
#endif
#ifndef __MEMORY_H_
#define __MEMORY_H_
#ifdef __cplusplus
extern "C"
{
#endif
#define Disc_ID ((u32*) 0x80000000)
#define Disc_Region ((u32*) 0x80000003)
#define Disc_Magic ((u32*) 0x80000018)
#define Sys_Magic ((u32*) 0x80000020)
#define Version ((u32*) 0x80000024)
#define Mem_Size ((u32*) 0x80000028)
#define Board_Model ((u32*) 0x8000002C)
#define Arena_L ((u32*) 0x80000030)
#define Arena_H ((u32*) 0x80000034)
#define FST ((u32*) 0x80000038)
#define Max_FST ((u32*) 0x8000003C)
#define Assembler ((u32*) 0x80000060)
#define Video_Mode ((u32*) 0x800000CC)
#define Dev_Debugger ((u32*) 0x800000EC)
#define Simulated_Mem ((u32*) 0x800000F0)
#define BI2 ((u32*) 0x800000F4)
#define Bus_Speed ((u32*) 0x800000F8)
#define CPU_Speed ((u32*) 0x800000FC)
#define Online_Check ((u32*) 0x80003180)
#define GameID_Address ((u32*) 0x80003184)
#define allocate_memory(size) memalign(32, (size+31)&(~31))
#ifdef __cplusplus
}
#endif
#endif

View File

@ -36,7 +36,6 @@
#include "usbloader/frag.h"
#include "usbloader/wbfs.h"
#include "wad/nandtitle.h"
#include "GameBootProcess.h"
/*** Variables that are also used extern ***/
GuiWindow * mainWindow = NULL;
@ -61,13 +60,12 @@ bool altdoldefault = true;
static lwp_t guithread = LWP_THREAD_NULL;
static bool guiHalt = true;
static int ExitRequested = 0;
static bool ExitRequested = false;
/*** Extern variables ***/
extern u8 shutdown;
extern u8 reset;
extern s32 gameSelected, gameStart;
extern u8 boothomebrew;
/****************************************************************************
* ResumeGui
@ -168,6 +166,7 @@ static void * UpdateGUI(void *arg)
Menu_DrawRectangle(0, 0, screenwidth, screenheight, (GXColor) {0, 0, 0, i}, 1);
Menu_Render();
}
mainWindow->RemoveAll();
ShutoffRumble();
@ -181,18 +180,22 @@ static void * UpdateGUI(void *arg)
***************************************************************************/
void InitGUIThreads()
{
LWP_CreateThread(&guithread, UpdateGUI, NULL, NULL, 65536, LWP_PRIO_HIGHEST);
InitProgressThread();
InitNetworkThread();
ExitRequested = false;
if (Settings.autonetwork) ResumeNetworkThread();
if(guithread == LWP_THREAD_NULL)
LWP_CreateThread(&guithread, UpdateGUI, NULL, NULL, 65536, LWP_PRIO_HIGHEST);
}
void ExitGUIThreads()
{
ExitRequested = 1;
LWP_JoinThread(guithread, NULL);
guithread = LWP_THREAD_NULL;
ExitRequested = true;
if(guithread != LWP_THREAD_NULL)
{
ResumeGui();
LWP_JoinThread(guithread, NULL);
guithread = LWP_THREAD_NULL;
}
}
/****************************************************************************
@ -254,6 +257,14 @@ int MainMenu(int menu)
{
currentMenu = menu;
InitGUIThreads();
InitProgressThread();
InitNetworkThread();
if (Settings.autonetwork)
ResumeNetworkThread();
pointer[0] = Resources::GetImageData("player1_point.png");
pointer[1] = Resources::GetImageData("player2_point.png");
pointer[2] = Resources::GetImageData("player3_point.png");
@ -301,61 +312,8 @@ int MainMenu(int menu)
}
}
// MemInfoPrompt();
gprintf("Exiting main GUI. mountMethod = %d\n", mountMethod);
//! THIS SHOULD NEVER HAPPEN ANYMORE
ExitApp();
CloseXMLDatabase();
NewTitles::DestroyInstance();
ResumeGui();
ExitGUIThreads();
bgMusic->Stop();
delete bgMusic;
delete background;
delete bgImg;
delete mainWindow;
for (int i = 0; i < 4; i++)
delete pointer[i];
delete GameRegionTxt;
delete GameIDTxt;
delete cover;
delete coverImg;
delete fontSystem;
ShutdownAudio();
StopGX();
gettextCleanUp();
if (mountMethod == 3)
{
struct discHdr *header = gameList[gameSelected];
char tmp[20];
u32 tid;
sprintf(tmp, "%c%c%c%c", header->id[0], header->id[1], header->id[2], header->id[3]);
memcpy(&tid, tmp, 4);
gprintf("\nBooting title %016llx", TITLE_ID( ( header->id[5] == '1' ? 0x00010001 : 0x00010002 ), tid ));
WII_Initialize();
WII_LaunchTitle(TITLE_ID( ( header->id[5] == '1' ? 0x00010001 : 0x00010002 ), tid ));
}
if (mountMethod == 2)
{
gprintf("\nLoading BC for GameCube");
WII_Initialize();
WII_LaunchTitle(0x0000000100000100ULL);
}
if (boothomebrew == 1)
{
gprintf("\nBootHomebrew");
BootHomebrew(Settings.selected_homebrew);
return 0;
}
else if (boothomebrew == 2)
{
gprintf("\nBootHomebrew from Menu");
BootHomebrewFromMem();
return 0;
}
return BootGame((const char *) gameList[gameSelected]->id);
return -1;
}

View File

@ -10,6 +10,8 @@
#define _MENU_H_
#include <ogcsys.h>
#include "libwiigui/gui.h"
#include "libwiigui/gui_bgm.h"
#include "settings/CSettings.h"
#include "main.h"
@ -30,8 +32,21 @@ enum
BOOTHOMEBREW,
MENU_THEMEDOWNLOADER
};
class GuiImageData;
void ResumeGui();
void HaltGui();
GuiImageData *LoadCoverImage(struct discHdr *header, bool Prefere3D = true, bool noCover = true);
class GuiSound;
extern GuiSound *btnClick2;
extern GuiBGM *bgMusic;
extern GuiImageData *pointer[4];
extern GuiImageData *background;
extern GuiImage *bgImg;
extern GuiWindow *mainWindow;
extern GuiText *GameRegionTxt;
extern GuiText *GameIDTxt;
extern GuiImageData *cover;
extern GuiImage *coverImg;
extern FreeTypeGX *fontSystem;
#endif

View File

@ -13,6 +13,7 @@
#include "settings/CGameStatistics.h"
#include "settings/GameTitles.h"
#include "themes/CTheme.h"
#include "GameBootProcess.h"
#include "wpad.h"
#include "sys.h"
@ -1472,9 +1473,8 @@ int MenuDiscList()
header->id[3], header->id[4], header->id[5], GameStatistics.GetPlayCount(header->id));
}
menu = MENU_EXIT;
break;
//Just calling that shuts down everything and starts game
BootGame((const char *) header->id);
}
bool returnHere = true;// prompt to start game
while (returnHere)
@ -1494,7 +1494,7 @@ int MenuDiscList()
if (exeFile == NULL)
{
gprintf("\n\tTried to load alt dol that isn't there");
sprintf(nipple, "%s %s", nipple, tr( "does not exist! You Messed something up, Idiot." ));
sprintf(nipple, "%s %s", nipple, tr( "does not exist! You messed something up." ));
WindowPrompt(tr( "Error" ), nipple, tr( "OK" ));
menu = MENU_DISCLIST;
wiilight(0);
@ -1524,8 +1524,8 @@ int MenuDiscList()
}
wiilight(0);
returnHere = false;
menu = MENU_EXIT;
//Just calling that shuts down everything and starts game
BootGame((const char *) gameList[gameSelected]->id);
}
else if (choice == 2)
{

View File

@ -10,10 +10,6 @@
#include "filelist.h"
#include "sys.h"
extern void ResumeGui();
extern void HaltGui();
extern GuiWindow * mainWindow;
extern GuiBGM * bgMusic;
extern u8 shutdown;
extern u8 reset;

View File

@ -1,6 +1,10 @@
#ifndef GAMEPATCHES_H_
#define GAMEPATCHES_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gccore.h>
bool Anti_002_fix(u8 * Address, int Size);
@ -10,4 +14,8 @@ bool Search_and_patch_Video_Modes(u8 * Address, u32 Size, GXRModeObj* Table[]);
void VideoModePatcher(u8 * dst, int len, u8 videoSelected);
bool PatchReturnTo(void *Address, int Size, u32 id);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -20,7 +20,7 @@
#include "sys.h"
#include "settings/GameTitles.h"
#include "themes/CTheme.h"
#include "memory.h"
#include "memory/memory.h"
#include "../gecko.h"
#include "../patches/dvd_broadway.h"
@ -32,7 +32,6 @@ extern void HaltGui();
extern GuiWindow * mainWindow;
extern u8 shutdown;
extern u8 reset;
extern u8 mountMethod;
/********************************************************************************
*Disk Browser

View File

@ -51,8 +51,6 @@ int cntMissFiles = 0;
static char missingFiles[500][12];
/*** Extern variables ***/
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
s32 gameSelected = 0, gameStart = 0;
extern float gamesize;
extern u8 shutdown;
@ -61,10 +59,6 @@ extern u8 mountMethod;
extern struct discHdr *dvdheader;
extern char game_partition[6];
/*** Extern functions ***/
extern void ResumeGui();
extern void HaltGui();
/****************************************************************************
* OnScreenNumpad
*

View File

@ -585,14 +585,18 @@ bool CSettings::FindConfig()
if (i == 1) strcpy(BootDevice, "USB:");
if (!found)
{
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice);
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
CreateSubfolder(ConfigPath);
strcat(ConfigPath, "GXGlobal.cfg");
testFp = fopen(ConfigPath, "wb");
found = (testFp != NULL);
fclose(testFp);
}
if (!found)
{
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice);
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
CreateSubfolder(ConfigPath);
strcat(ConfigPath, "GXGlobal.cfg");
testFp = fopen(ConfigPath, "wb");
found = (testFp != NULL);
fclose(testFp);

View File

@ -4,12 +4,17 @@
#include "mload/mload.h"
#include "settings/CSettings.h"
#include "settings/newtitles.h"
#include "language/gettext.h"
#include "utils/ResourceManager.h"
#include "FontSystem.h"
#include "audio.h"
#include "fatmounter.h"
#include "lstub.h"
#include "menu.h"
#include "video.h"
#include "gecko.h"
#include "xml/xml.h"
extern char game_partition[6];
extern u8 load_from_fs;
@ -49,25 +54,50 @@ void Sys_Init(void)
SYS_SetPowerCallback(__Sys_PowerCallback);
}
static void _ExitApp()
void AppCleanUp(void)
{
extern u8 mountMethod;
gprintf("Exiting main GUI. mountMethod = %d\n", mountMethod);
ExitGUIThreads();
delete bgMusic;
delete background;
delete bgImg;
delete mainWindow;
for (int i = 0; i < 4; i++)
delete pointer[i];
delete GameRegionTxt;
delete GameIDTxt;
delete cover;
delete coverImg;
gettextCleanUp();
CloseXMLDatabase();
ClearFontData();
NewTitles::DestroyInstance();
StopGX();
ShutdownAudio();
ResourceManager::DestroyInstance();
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
}
void ExitApp(void)
{
AppCleanUp();
UnmountNTFS();
SDCard_deInit();
USBDevice_deInit();
mload_set_ES_ioctlv_vector(NULL);
mload_close();
}
void Sys_Reboot(void)
{
/* Restart console */
_ExitApp();
ExitApp();
STM_RebootSystem();
}
@ -77,10 +107,7 @@ void Sys_Reboot(void)
static void _Sys_Shutdown(int SHUTDOWN_MODE)
{
_ExitApp();
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
ExitApp();
/* Poweroff console */
if ((CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE && SHUTDOWN_MODE != ShutdownToStandby) || SHUTDOWN_MODE
@ -118,7 +145,7 @@ void Sys_ShutdownToStandby(void)
void Sys_LoadMenu(void)
{
_ExitApp();
ExitApp();
/* Return to the Wii system menu */
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
@ -128,7 +155,7 @@ void Sys_BackToLoader(void)
if (hbcStubAvailable())
{
_ExitApp();
ExitApp();
exit(0);
}
// Channel Version

View File

@ -4,6 +4,8 @@
void wiilight(int enable);
/* Prototypes */
void AppCleanUp(void); //! Deletes all allocated space for everything
void ExitApp(void); //! Like AppCleanUp() and additional device unmount
void Sys_Init(void);
void Sys_Reboot(void);
void Sys_Shutdown(void);

View File

@ -4,6 +4,7 @@
#include "../fatmounter.h"
#include "../usbloader/usbstorage2.h"
#include "../usbloader/disc.h"
#include "../usbloader/wdvd.h"
#include "../wad/nandtitle.h"
#include "../mload/mload_modules.h"
#include "../settings/CSettings.h"
@ -66,6 +67,35 @@ s32 IosLoader::LoadAppCios()
return ret;
}
/*
* Loads a CIOS before a game start.
* @return 0 if a cios has been successfully loaded. Else a value below 0 is returned.
*/
s32 IosLoader::LoadGameCios(s32 ios)
{
if(ios == IOS_GetVersion())
return 0;
s32 ret = -1;
// Unmount fat before reloading IOS.
SDCard_deInit();
USBDevice_deInit();
WDVD_Close();
__io_usbstorage.shutdown(); // libogc usb
__io_usbstorage2.shutdown(); // cios usb
USB_Deinitialize(); // main usb handle
ret = ReloadIosSafe(ios);
// Remount devices after reloading IOS.
SDCard_Init();
USBDevice_Init();
return ret;
}
/*
* Reloads a certain IOS under the condition, that an appropriate version of the IOS is installed.
* @return a negative value if a safe reload of the ios was not possible.

View File

@ -7,6 +7,7 @@ class IosLoader
{
public:
static s32 LoadAppCios();
static s32 LoadGameCios(s32 ios);
static s32 ReloadIosSafe(s32 ios);
private:
static void LoadIOSModules(s32 ios, s32 ios_rev);

View File

@ -25,14 +25,7 @@
#include "ZipFile.h"
#include "gecko.h"
/*** Extern functions ***/
extern void ResumeGui();
extern void HaltGui();
/*** Extern variables ***/
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
extern GuiImage * bgImg;
extern u8 shutdown;
extern u8 reset;

View File

@ -33,7 +33,7 @@
#include "xml/xml.h"
#include "FreeTypeGX.h"
#include "GameList.h"
#include "memory.h"
#include "memory/memory.h"
GameList gameList;

View File

@ -37,23 +37,24 @@ void gamepatches( u8 * dst, int len, u8 videoSelected, u8 languageChoice, u8 pat
VideoModePatcher( dst, len, videoSelected );
if ( cheat )
dogamehooks( dst, len );
dogamehooks( dst, len );
if ( vipatch )
vidolpatcher( dst, len );
vidolpatcher( dst, len );
/*LANGUAGE PATCH - FISHEARS*/
langpatcher( dst, len, languageChoice );
/*Thanks to WiiPower*/
if ( patchcountrystring == 1 ) PatchCountryStrings( dst, len );
if ( patchcountrystring == 1 )
PatchCountryStrings( dst, len );
NSMBPatch( dst, len );
do_wip_code( ( u8 * ) dst, len );
if ( fix002 == 2 )
Anti_002_fix( dst, len );
Anti_002_fix( dst, len );
PatchReturnTo( dst, len, returnTo );
}
@ -108,10 +109,10 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
/* Read data from DVD */
WDVD_Read(dst, len, (u64) (offset << 2));
if( !alternatedol )
gamepatches(dst, len, videoSelected, languageChoice, patchcountrystring, vipatch, cheat, returnTo, fix002 );
if( !alternatedol )
gamepatches(dst, len, videoSelected, languageChoice, patchcountrystring, vipatch, cheat, returnTo, fix002 );
DCFlushRange(dst, len);
DCFlushRange(dst, len);
}
*entry = appldr_final();
@ -123,7 +124,7 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
void *dolbuffer = NULL;
int dollen = 0;
bool dolloaded = Load_Dol(&dolbuffer, &dollen, dolpath, videoSelected, languageChoice, patchcountrystring, vipatch, cheat, returnTo);
bool dolloaded = Load_Dol(&dolbuffer, &dollen, dolpath, videoSelected, languageChoice, patchcountrystring, vipatch, cheat, returnTo);
if (dolloaded)
{
*entry = (entry_point) load_dol_image(dolbuffer);
@ -136,10 +137,8 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
wip_reset_counter();
FST_ENTRY *fst = (FST_ENTRY *) *(u32 *) 0x80000038;
*entry = (entry_point) Load_Dol_from_disc(fst[alternatedoloffset].fileoffset, videoSelected, languageChoice,
*entry = (entry_point) Load_Dol_from_disc(fst[alternatedoloffset].fileoffset, videoSelected, languageChoice,
patchcountrystring, vipatch, cheat, returnTo);
if (*entry == 0) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
return 0;

View File

@ -13,7 +13,7 @@
#include "video.h"
#include "wdvd.h"
#include "alternatedol.h"
#include "memory.h"
#include "memory/memory.h"
#include "wbfs.h"
#include "../settings/SettingsEnums.h"
#include "../gecko.h"
@ -23,9 +23,6 @@
#define PTABLE_OFFSET 0x40000
#define WII_MAGIC 0x5D1C9EA3
//appentrypoint
u32 appentrypoint;
/* Disc pointers */
static u32 *buffer = (u32 *) 0x93000000;
static u8 *diskid = (u8 *) Disc_ID;
@ -48,11 +45,7 @@ void __Disc_SetLowMem(void)
*(vu32 *) 0xCD00643C = 0x00000000; // 32Mhz on Bus
//If the game is sam & max: season 1 put this shit in
char gameid[8];
memset(gameid, 0, 8);
memcpy(gameid, (char*) Disc_ID, 6);
if ((strcmp(gameid, "R3XE6U") == 0) || (strcmp(gameid, "R3XP6V") == 0))
if ((strncmp((char*) Disc_ID, "R3XE6U", 6) == 0) || (strncmp((char*) Disc_ID, "R3XP6V", 6) == 0))
{
*GameID_Address = 0x80000000; // Game ID Address
}
@ -284,84 +277,33 @@ s32 Disc_IsWii(void)
return 0;
}
s32 Disc_BootPartition(u64 offset, char * dolpath, u8 videoselected, u8 languageChoice, u8 cheat, u8 vipatch, u8 patchcountrystring,
u8 alternatedol, u32 alternatedoloffset, u32 returnTo, u8 fix002)
s32 Disc_JumpToEntrypoint(u8 videoselected, bool enablecheat)
{
gprintf("booting partition IOS %u v%u\n", IOS_GetVersion(), IOS_GetRevision());
entry_point p_entry;
s32 ret;
/* Open specified partition */
ret = WDVD_OpenPartition(offset);
if (ret < 0) return ret;
/* Setup low memory */
__Disc_SetLowMem();
char gameid[8];
memset(gameid, 0, 8);
memcpy(gameid, (char*) Disc_ID, 6);
load_wip_code((u8 *) &gameid);
/* If a wip file is loaded for this game this does nothing - Dimok */
PoPPatch();
/* Run apploader */
ret = Apploader_Run(&p_entry, dolpath, cheat, videoselected, languageChoice, vipatch, patchcountrystring,
alternatedol, alternatedoloffset, returnTo, fix002);
if (ret < 0) return ret;
free_wip();
bool cheatloaded = false;
if (cheat)
{
// OCARINA STUFF - FISHEARS
if (ocarina_load_code((u8 *) gameid) > 0)
{
ocarina_do_code();
cheatloaded = true;
}
}
//kill the USB and SD
USBDevice_deInit();
SDCard_deInit();
/* Set an appropiate video mode */
__Disc_SetVMode(videoselected);
/* Set time */
__Disc_SetTime();
/* Disconnect Wiimote */
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
// Anti-green screen fix
VIDEO_SetBlack(TRUE);
VIDEO_Flush();
VIDEO_WaitVSync();
VIDEO_WaitVSync();
gprintf("USB Loader GX is done.\n");
/* Shutdown IOS subsystems */
// fix for PeppaPig (from NeoGamma)
extern void __exception_closeall();
IRQ_Disable();
__IOS_ShutdownSubsystems();
__exception_closeall();
// fix for PeppaPig (from WiiFlow)
u8 temp_data[4];
memcpy(temp_data, (u8 *) 0x800000F4, 4);
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
memcpy((u8 *) 0x800000F4, temp_data, 4);
appentrypoint = (u32) p_entry;
if (cheat == 1 && cheatloaded)
if (enablecheat)
{
__asm__(
"lis %r3, appentrypoint@h\n"
"ori %r3, %r3, appentrypoint@l\n"
"lis %r3, AppEntrypoint@h\n"
"ori %r3, %r3, AppEntrypoint@l\n"
"lwz %r3, 0(%r3)\n"
"mtlr %r3\n"
"lis %r3, 0x8000\n"
@ -373,8 +315,8 @@ s32 Disc_BootPartition(u64 offset, char * dolpath, u8 videoselected, u8 language
else
{
__asm__(
"lis %r3, appentrypoint@h\n"
"ori %r3, %r3, appentrypoint@l\n"
"lis %r3, AppEntrypoint@h\n"
"ori %r3, %r3, AppEntrypoint@l\n"
"lwz %r3, 0(%r3)\n"
"mtlr %r3\n"
"blr\n"
@ -384,21 +326,6 @@ s32 Disc_BootPartition(u64 offset, char * dolpath, u8 videoselected, u8 language
return 0;
}
s32 Disc_WiiBoot(char * dolpath, u8 videoselected, u8 languageChoice, u8 cheat, u8 vipatch, u8 patchcountrystring,
u8 alternatedol, u32 alternatedoloffset, u32 returnTo, u8 fix002)
{
u64 offset;
s32 ret;
/* Find game partition offset */
ret = __Disc_FindPartition(&offset);
if (ret < 0) return ret;
/* Boot partition */
return Disc_BootPartition(offset, dolpath, videoselected, languageChoice, cheat, vipatch, patchcountrystring,
alternatedol, alternatedoloffset, returnTo, fix002);
}
void PatchCountryStrings(void *Address, int Size)
{
u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 };

View File

@ -40,7 +40,7 @@ extern "C"
/* Padding */
u8 unused3[30];
}ATTRIBUTE_PACKED;
} ATTRIBUTE_PACKED;
/* Prototypes */
s32 Disc_Init(void);
@ -50,11 +50,10 @@ extern "C"
s32 Disc_SetUSB(const u8 *);
s32 Disc_ReadHeader(void *);
s32 Disc_IsWii(void);
s32 Disc_BootPartition(u64, char *, u8, u8 languageChoice, u8, u8, u8, u8, u32, u32 returnTo, u8 fix002);
s32 Disc_WiiBoot(char *, u8, u8 languageChoice, u8, u8, u8, u8, u32, u32 returnTo, u8 fix002);
s32 __Disc_FindPartition(u64 *outbuf);
void PatchCountryStrings(void *Address, int Size);
s32 __Disc_FindPartition(u64 *outbuf);
s32 Disc_JumpToEntrypoint(u8 videoselected, bool enablecheat);
#ifdef __cplusplus
}

View File

@ -6,7 +6,7 @@ extern "C"
{
#endif
#include <unzip/unzip.h>
#include <zip/unzip.h>
int extractZip(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password,
const char *basedir);

View File

@ -5,7 +5,7 @@
*/
#include <malloc.h>
#include <unzip/unzip.h>
#include <zip/unzip.h>
#include "settings/CSettings.h"
#include "settings/CGameSettings.h"
#include "settings/GameTitles.h"
@ -321,7 +321,7 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
}
/* if enabled, force English title for all games set to Japanese */
if (forcejptoen && (!strcmp(langcode, "JA"))) strcpy(langcode, "EN");
if (forcejptoen && (strcmp(langcode, "JA")) == 0) strcpy(langcode, "EN");
/* load title from nodes */
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND);