mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 11:19:17 +01:00
The known alt dol is now automatically used when launching a game that requires it, if no dol was selected (setting a dol in game settings will override it). This includes the alt dol prompt that was added a few revisions ago for games that require choosing between different dols. Fixed dol name display in the game settings. Added check to prevent empty .gct file creation. The .gct code files can now be deleted from the Uninstall Menu.
This commit is contained in:
parent
75a4d33e4f
commit
370a332fcc
4
Makefile
4
Makefile
@ -105,12 +105,12 @@ $(BUILD):
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
lang:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@[ -d build ] || mkdir -p build
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile language
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@[ -d build ] || mkdir -p build
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile language
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -68,9 +68,8 @@ int CheatMenu(const char * gameID) {
|
||||
WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"));
|
||||
break;
|
||||
case 0:
|
||||
download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),tr("Download Now"));
|
||||
|
||||
if (download==0)
|
||||
download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("Download Now"),tr("Cancel"));
|
||||
if (download==1)
|
||||
download = CodeDownload(gameID);
|
||||
break;
|
||||
case 1:
|
||||
@ -128,6 +127,9 @@ int CheatMenu(const char * gameID) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
if (x == 0) {
|
||||
WindowPrompt(tr("Error"),tr("No cheats were selected"),tr("OK"));
|
||||
} else {
|
||||
subfoldercreate(Settings.Cheatcodespath);
|
||||
string chtpath = Settings.Cheatcodespath;
|
||||
string gctfname = chtpath + c.getGameID() + ".gct";
|
||||
@ -135,6 +137,7 @@ int CheatMenu(const char * gameID) {
|
||||
WindowPrompt(tr("GCT File created"),NULL,tr("OK"));
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
} else WindowPrompt(tr("Error"),tr("Could not create GCT file"),tr("OK"));
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,10 @@ string GCTCheats::getCheatComment(int nr) {
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(int nr,const char * filename) {
|
||||
|
||||
if (nr == 0)
|
||||
return 0;
|
||||
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
@ -91,6 +95,7 @@ int GCTCheats::createGCT(int nr,const char * filename) {
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(const char * chtbuffer,const char * filename) {
|
||||
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
@ -125,6 +130,9 @@ int GCTCheats::createGCT(const char * chtbuffer,const char * filename) {
|
||||
|
||||
int GCTCheats::createGCT(int nr[],int cnt,const char * filename) {
|
||||
|
||||
if (cnt == 0)
|
||||
return 0;
|
||||
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "prompts/ProgressWindow.h"
|
||||
#include "prompts/TitleBrowser.h"
|
||||
#include "prompts/gameinfo.h"
|
||||
#include "prompts/DiscBrowser.h"
|
||||
#include "mload/mload.h"
|
||||
#include "patches/patchcode.h"
|
||||
#include "network/networkops.h"
|
||||
@ -72,6 +73,7 @@ static lwp_t guithread = LWP_THREAD_NULL;
|
||||
static bool guiHalt = true;
|
||||
static int ExitRequested = 0;
|
||||
static char gameregion[7];
|
||||
static bool altdoldefault = true;
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern FreeTypeGX *fontClock;
|
||||
@ -717,7 +719,7 @@ int MenuDiscList() {
|
||||
|
||||
WDVD_GetCoverStatus(&covert);//for detecting if i disc has been inserted
|
||||
|
||||
// if the idiot is showing favoorites and don't have any
|
||||
// if the idiot is showing favorites and don't have any
|
||||
if (Settings.fave && !gameCnt) {
|
||||
WindowPrompt(tr("No Favorites"),tr("You are choosing to display favorites and you do not have any selected."),tr("Back"));
|
||||
Settings.fave=!Settings.fave;
|
||||
@ -1214,8 +1216,8 @@ int MenuDiscList() {
|
||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
||||
if (game_cfg) {
|
||||
ocarinaChoice = game_cfg->ocarina;
|
||||
alternatedol = game_cfg->loadalternatedol;
|
||||
ocarinaChoice = game_cfg->ocarina;
|
||||
} else {
|
||||
alternatedol = off;
|
||||
ocarinaChoice = Settings.ocarina;
|
||||
@ -1230,17 +1232,17 @@ int MenuDiscList() {
|
||||
if (exeFile==NULL) {
|
||||
sprintf(nipple, "%s %s",nipple,tr("does not exist!"));
|
||||
WindowPrompt(tr("Error"),nipple,tr("OK"));
|
||||
|
||||
menu = MENU_CHECK;
|
||||
wiilight(0);
|
||||
break;
|
||||
} else {
|
||||
fclose(exeFile);
|
||||
}
|
||||
}
|
||||
if (ocarinaChoice != off) {
|
||||
/* Open gct File and check exist */
|
||||
sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull);
|
||||
exeFile = fopen (nipple ,"rb");
|
||||
|
||||
if (exeFile==NULL) {
|
||||
sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats."));
|
||||
WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
|
||||
@ -1248,6 +1250,7 @@ int MenuDiscList() {
|
||||
fseek (exeFile, 0, SEEK_END);
|
||||
long size=ftell (exeFile);
|
||||
rewind (exeFile);
|
||||
fclose(exeFile);
|
||||
if (size>2056) {
|
||||
sprintf(nipple, "%s %s",nipple,tr("contains over 255 lines of code. It will produce unexpected results."));
|
||||
WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
|
||||
@ -1272,7 +1275,6 @@ int MenuDiscList() {
|
||||
|
||||
CFG_save_game_num(header->id);
|
||||
}
|
||||
SDCard_deInit();
|
||||
menu = MENU_EXIT;
|
||||
break;
|
||||
|
||||
@ -1292,10 +1294,11 @@ int MenuDiscList() {
|
||||
if (exeFile==NULL) {
|
||||
sprintf(nipple, "%s %s",nipple,tr("does not exist! You Messed something up, Idiot."));
|
||||
WindowPrompt(tr("Error"),nipple,tr("OK"));
|
||||
|
||||
menu = MENU_CHECK;
|
||||
wiilight(0);
|
||||
break;
|
||||
} else {
|
||||
fclose(exeFile);
|
||||
}
|
||||
}
|
||||
if (ocarinaChoice != off) {
|
||||
@ -1317,12 +1320,10 @@ int MenuDiscList() {
|
||||
}
|
||||
|
||||
}
|
||||
SDCard_deInit();
|
||||
wiilight(0);
|
||||
returnHere = false;
|
||||
menu = MENU_EXIT;
|
||||
|
||||
|
||||
} else if (choice == 2) {
|
||||
wiilight(0);
|
||||
HaltGui();
|
||||
@ -1398,6 +1399,39 @@ int MenuDiscList() {
|
||||
covertOld=covert;
|
||||
}
|
||||
|
||||
// set alt dol default
|
||||
if (menu == MENU_EXIT && altdoldefault) {
|
||||
struct discHdr *header = &gameList[gameSelected];
|
||||
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
||||
// use default only if no alt dol was selected manually
|
||||
if (game_cfg) {
|
||||
if (game_cfg->alternatedolstart != 0)
|
||||
altdoldefault = false;
|
||||
}
|
||||
if (altdoldefault) {
|
||||
int autodol = autoSelectDol((char*)header->id);
|
||||
if (autodol>0) {
|
||||
alternatedol = 2;
|
||||
alternatedoloffset = autodol;
|
||||
char temp[20];
|
||||
sprintf(temp,"%d",autodol);
|
||||
} else {
|
||||
// alt dol menu for games that require more than a single alt dol
|
||||
int autodol = autoSelectDolMenu((char*)header->id);
|
||||
if (autodol>0) {
|
||||
alternatedol = 2;
|
||||
alternatedoloffset = autodol;
|
||||
} else if (autodol == 0) { // if Cancel or B is pressed, don't launch game
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (menu == MENU_EXIT) {
|
||||
SDCard_deInit();
|
||||
}
|
||||
|
||||
HaltGui();
|
||||
mainWindow->RemoveAll();
|
||||
mainWindow->Append(bgImg);
|
||||
@ -1412,6 +1446,7 @@ int MenuDiscList() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* MenuInstall
|
||||
***************************************************************************/
|
||||
@ -1891,7 +1926,6 @@ int MainMenu(int menu) {
|
||||
delete GameIDTxt;
|
||||
delete cover;
|
||||
delete coverImg;
|
||||
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
|
||||
@ -1914,8 +1948,10 @@ int MainMenu(int menu) {
|
||||
fix002 = game_cfg->errorfix002;
|
||||
iosChoice = game_cfg->ios;
|
||||
countrystrings = game_cfg->patchcountrystrings;
|
||||
if (!altdoldefault) {
|
||||
alternatedol = game_cfg->loadalternatedol;
|
||||
alternatedoloffset = game_cfg->alternatedolstart;
|
||||
}
|
||||
reloadblock = game_cfg->iosreloadblock;
|
||||
} else {
|
||||
videoChoice = Settings.video;
|
||||
@ -1929,8 +1965,10 @@ int MainMenu(int menu) {
|
||||
}
|
||||
fix002 = Settings.error002;
|
||||
countrystrings = Settings.patchcountrystrings;
|
||||
if (!altdoldefault) {
|
||||
alternatedol = off;
|
||||
alternatedoloffset = 0;
|
||||
}
|
||||
reloadblock = off;
|
||||
}
|
||||
int ios2;
|
||||
|
@ -64,11 +64,13 @@
|
||||
#define _SHIFTR(v, s, w) \
|
||||
((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
||||
|
||||
struct dicommand {
|
||||
struct dicommand
|
||||
{
|
||||
u32 diReg[8];
|
||||
};
|
||||
|
||||
struct dicontext {
|
||||
struct dicontext
|
||||
{
|
||||
lwp_node node;
|
||||
dvdcallbacklow cb;
|
||||
struct dicommand *cmd;
|
||||
@ -91,38 +93,43 @@ static char __di_fs[] ATTRIBUTE_ALIGN(32) = "/dev/di";
|
||||
|
||||
extern u32 __IPC_ClntInit();
|
||||
|
||||
static __inline__ lwp_node* __lwp_queue_head(lwp_queue *queue) {
|
||||
static __inline__ lwp_node* __lwp_queue_head(lwp_queue *queue)
|
||||
{
|
||||
return (lwp_node*)queue;
|
||||
}
|
||||
|
||||
static __inline__ lwp_node* __lwp_queue_tail(lwp_queue *queue) {
|
||||
static __inline__ lwp_node* __lwp_queue_tail(lwp_queue *queue)
|
||||
{
|
||||
return (lwp_node*)&queue->perm_null;
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void __lwp_queue_init_empty(lwp_queue *queue) {
|
||||
static __inline__ void __lwp_queue_init_empty(lwp_queue *queue)
|
||||
{
|
||||
queue->first = __lwp_queue_tail(queue);
|
||||
queue->perm_null = NULL;
|
||||
queue->last = __lwp_queue_head(queue);
|
||||
}
|
||||
|
||||
static struct dicontext* __dvd_getcontext(dvdcallbacklow cb) {
|
||||
static struct dicontext* __dvd_getcontext(dvdcallbacklow cb)
|
||||
{
|
||||
struct dicontext *ctx;
|
||||
|
||||
ctx = (struct dicontext*)__lwp_queue_get(&__di_contextq);
|
||||
if (ctx!=NULL) ctx->cb = cb;
|
||||
if(ctx!=NULL) ctx->cb = cb;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static s32 __dvd_iostransactionCB(s32 result,void *usrdata) {
|
||||
static s32 __dvd_iostransactionCB(s32 result,void *usrdata)
|
||||
{
|
||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||
|
||||
__dvd_reqinprogress = 0;
|
||||
|
||||
if (ctx->cb!=NULL) {
|
||||
if(ctx->cb!=NULL) {
|
||||
__dvd_cbinprogress = 1;
|
||||
if (result!=0) __dvd_readlength = 0;
|
||||
if(result!=0) __dvd_readlength = 0;
|
||||
ctx->cb(result);
|
||||
__dvd_cbinprogress = 0;
|
||||
}
|
||||
@ -131,13 +138,14 @@ static s32 __dvd_iostransactionCB(s32 result,void *usrdata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata) {
|
||||
static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata)
|
||||
{
|
||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||
|
||||
__dvd_reqinprogress = 0;
|
||||
__di_regvalcache[1] = __di_regbuffer[0];
|
||||
|
||||
if (ctx->cb!=NULL) {
|
||||
if(ctx->cb!=NULL) {
|
||||
__dvd_cbinprogress = 1;
|
||||
ctx->cb(result);
|
||||
__dvd_cbinprogress = 0;
|
||||
@ -147,12 +155,13 @@ static s32 __dvd_ioscoverregisterCB(s32 result,void *usrdata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata) {
|
||||
static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata)
|
||||
{
|
||||
struct dicontext *ctx = (struct dicontext*)usrdata;
|
||||
|
||||
__dvd_reqinprogress = 0;
|
||||
|
||||
if (ctx->cb!=NULL) {
|
||||
if(ctx->cb!=NULL) {
|
||||
__dvd_cbinprogress = 1;
|
||||
ctx->cb(result);
|
||||
__dvd_cbinprogress = 0;
|
||||
@ -162,19 +171,20 @@ static s32 __dvd_ioscovercloseCB(s32 result,void *usrdata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowInit() {
|
||||
s32 bwDVD_LowInit()
|
||||
{
|
||||
s32 i,ret = 0;
|
||||
u32 ipclo,ipchi;
|
||||
lwp_queue inactives;
|
||||
struct dicontext *ctx;
|
||||
|
||||
if (__dvd_lowinitcalled==0) {
|
||||
if(__dvd_lowinitcalled==0) {
|
||||
ret = __IPC_ClntInit();
|
||||
if (ret<0) return ret;
|
||||
if(ret<0) return ret;
|
||||
|
||||
ipclo = (((u32)IPC_GetBufferLo()+0x1f)&~0x1f);
|
||||
ipchi = (u32)IPC_GetBufferHi();
|
||||
if (ipchi>=(ipclo+(sizeof(struct dicommand)*DI_CMDCTX_CNT))) {
|
||||
if(ipchi>=(ipclo+(sizeof(struct dicommand)*DI_CMDCTX_CNT))) {
|
||||
__di_commands = (struct dicommand*)ipclo;
|
||||
IPC_SetBufferLo((void*)(ipclo+(sizeof(struct dicommand)*DI_CMDCTX_CNT)));
|
||||
|
||||
@ -183,7 +193,7 @@ s32 bwDVD_LowInit() {
|
||||
i = 0;
|
||||
__lwp_queue_init_empty(&__di_contextq);
|
||||
__lwp_queue_initialize(&inactives,__di_contexts,DI_CMDCTX_CNT,sizeof(struct dicontext));
|
||||
while ((ctx=(struct dicontext*)__lwp_queue_get(&inactives))!=NULL) {
|
||||
while((ctx=(struct dicontext*)__lwp_queue_get(&inactives))!=NULL) {
|
||||
ctx->cmd = &__di_commands[i];
|
||||
ctx->cb = NULL;
|
||||
__lwp_queue_append(&__di_contextq,&ctx->node);
|
||||
@ -193,7 +203,7 @@ s32 bwDVD_LowInit() {
|
||||
}
|
||||
|
||||
ret = IOS_Open(__di_fs,0);
|
||||
if (ret<0) return ret;
|
||||
if(ret<0) return ret;
|
||||
|
||||
__dvd_fd = ret;
|
||||
// __dvd_lowinitcalled = 1;
|
||||
@ -203,7 +213,8 @@ s32 bwDVD_LowInit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -211,7 +222,7 @@ s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_INQUIRY<<24);
|
||||
@ -220,7 +231,8 @@ s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret = 0;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -230,7 +242,7 @@ s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_READID<<24);
|
||||
@ -241,18 +253,19 @@ s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb) {
|
||||
}
|
||||
|
||||
|
||||
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
|
||||
if (buf==NULL || ((u32)buf%32)!=0) return -1;
|
||||
if(buf==NULL || ((u32)buf%32)!=0) return -1;
|
||||
|
||||
__dvd_reqinprogress = 1;
|
||||
__dvd_readlength = len;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_READ<<24);
|
||||
@ -264,7 +277,8 @@ s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
}
|
||||
|
||||
// never got this function working, probably removed from wii
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -273,7 +287,7 @@ s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
__dvd_readlength = len;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_READ_DVDVIDEO<<24);
|
||||
@ -286,7 +300,8 @@ s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
|
||||
|
||||
|
||||
s32 bwDVD_LowStopLaser(dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowStopLaser(dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -294,7 +309,7 @@ s32 bwDVD_LowStopLaser(dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_STOPLASER<<24);
|
||||
@ -304,7 +319,8 @@ s32 bwDVD_LowStopLaser(dvdcallbacklow cb) {
|
||||
}
|
||||
|
||||
// never got this function working, probably removed from wii
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb) {
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -312,7 +328,7 @@ s32 bwDVD_EnableVideo(dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_ENABLE_DVD<<24);
|
||||
@ -321,7 +337,8 @@ s32 bwDVD_EnableVideo(dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -329,7 +346,7 @@ s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_SEEK<<24);
|
||||
@ -339,7 +356,8 @@ s32 bwDVD_LowSeek(u32 offset,dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
u32 *off = (u32*)(void*)(&offset);
|
||||
struct dicontext *ctx;
|
||||
@ -348,19 +366,20 @@ s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_OFFSET<<24);
|
||||
cmd->diReg[1] = 0;
|
||||
if (off[0]) cmd->diReg[1] = 1;
|
||||
if(off[0]) cmd->diReg[1] = 1;
|
||||
cmd->diReg[2] = off[1];
|
||||
ret = IOS_IoctlAsync(__dvd_fd,IOCTL_DI_OFFSET,cmd->diReg,sizeof(struct dicommand),__di_regvalcache,0x20,__dvd_iostransactionCB,ctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -368,7 +387,7 @@ s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_COVER<<24);
|
||||
@ -377,19 +396,20 @@ s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
|
||||
if (eticket!=NULL && ((u32)eticket%32)!=0) return -1;
|
||||
if (certificate_in!=NULL && ((u32)certificate_in%32)!=0) return -1;
|
||||
if (certificate_out!=NULL && ((u32)certificate_out%32)!=0) return -1;
|
||||
if(eticket!=NULL && ((u32)eticket%32)!=0) return -1;
|
||||
if(certificate_in!=NULL && ((u32)certificate_in%32)!=0) return -1;
|
||||
if(certificate_out!=NULL && ((u32)certificate_out%32)!=0) return -1;
|
||||
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_OPENPART<<24);
|
||||
@ -399,11 +419,11 @@ s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certifi
|
||||
__di_iovector[0].len = sizeof(struct dicommand);
|
||||
|
||||
__di_iovector[1].data = eticket;
|
||||
if (eticket==NULL) __di_iovector[1].len = 0;
|
||||
if(eticket==NULL) __di_iovector[1].len = 0;
|
||||
else __di_iovector[1].len = 676;
|
||||
|
||||
__di_iovector[2].data = certificate_in;
|
||||
if (certificate_in==NULL) __di_iovector[2].len = 0;
|
||||
if(certificate_in==NULL) __di_iovector[2].len = 0;
|
||||
else __di_iovector[2].len = certin_len;
|
||||
|
||||
__di_iovector[3].data = certificate_out;
|
||||
@ -415,7 +435,8 @@ s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certifi
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -423,7 +444,7 @@ s32 bwDVD_LowClosePartition(dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_CLOSEPART<<24);
|
||||
@ -432,7 +453,8 @@ s32 bwDVD_LowClosePartition(dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -441,7 +463,7 @@ s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
__dvd_readlength = len;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_UNENCREAD<<24);
|
||||
@ -452,7 +474,8 @@ s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -460,7 +483,7 @@ s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_WAITCVRCLOSE<<24);
|
||||
@ -469,15 +492,16 @@ s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowResetNotify() {
|
||||
s32 bwDVD_LowResetNotify()
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
|
||||
if (__dvd_cbinprogress==1) return -1;
|
||||
if(__dvd_cbinprogress==1) return -1;
|
||||
|
||||
ctx = __dvd_getcontext(NULL);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_RESETNOTIFY<<24);
|
||||
@ -486,7 +510,8 @@ s32 bwDVD_LowResetNotify() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -495,7 +520,7 @@ s32 bwDVD_LowReset(dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_RESET<<24);
|
||||
@ -506,7 +531,8 @@ s32 bwDVD_LowReset(dvdcallbacklow cb) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -514,7 +540,7 @@ s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_STOPMOTOR<<24);
|
||||
@ -526,7 +552,8 @@ s32 bwDVD_LowStopMotor(u8 stop1,u8 stop2,dvdcallbacklow cb) {
|
||||
|
||||
}
|
||||
|
||||
s32 bwDVD_LowRequestError(dvdcallbacklow cb) {
|
||||
s32 bwDVD_LowRequestError(dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -534,7 +561,7 @@ s32 bwDVD_LowRequestError(dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_REQERROR<<24);
|
||||
@ -544,7 +571,8 @@ s32 bwDVD_LowRequestError(dvdcallbacklow cb) {
|
||||
}
|
||||
|
||||
|
||||
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb) {
|
||||
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -552,7 +580,7 @@ s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_SETCRYPTMODE<<24);
|
||||
@ -563,7 +591,8 @@ s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb) {
|
||||
|
||||
}
|
||||
|
||||
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb) {
|
||||
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb)
|
||||
{
|
||||
s32 ret;
|
||||
struct dicontext *ctx;
|
||||
struct dicommand *cmd;
|
||||
@ -571,7 +600,7 @@ s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb) {
|
||||
__dvd_reqinprogress = 1;
|
||||
|
||||
ctx = __dvd_getcontext(cb);
|
||||
if (ctx==NULL) return IPC_ENOMEM;
|
||||
if(ctx==NULL) return IPC_ENOMEM;
|
||||
|
||||
cmd = ctx->cmd;
|
||||
cmd->diReg[0] = (IOCTL_DI_SETOFFBASE<<24);
|
||||
|
@ -27,27 +27,27 @@
|
||||
#include <ogc/dvd.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef void (*dvdcallbacklow)(s32 result);
|
||||
typedef void (*dvdcallbacklow)(s32 result);
|
||||
|
||||
s32 bwDVD_LowInit();
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb);
|
||||
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb);
|
||||
s32 bwDVD_LowInit();
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb);
|
||||
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
@ -37,7 +37,8 @@
|
||||
|
||||
extern struct SSettings Settings;
|
||||
|
||||
u32 do_sd_code(char *filename) {
|
||||
u32 do_sd_code(char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
u8 *filebuff;
|
||||
u32 filesize;
|
||||
@ -66,7 +67,7 @@ u32 do_sd_code(char *filename) {
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
filebuff = (u8*) malloc (filesize);
|
||||
if (filebuff == 0) {
|
||||
if(filebuff == 0){
|
||||
fclose(fp);
|
||||
sleep(2);
|
||||
USBDevice_deInit();
|
||||
@ -75,7 +76,7 @@ u32 do_sd_code(char *filename) {
|
||||
}
|
||||
|
||||
ret = fread(filebuff, 1, filesize, fp);
|
||||
if (ret != filesize) {
|
||||
if(ret != filesize){
|
||||
free(filebuff);
|
||||
fclose(fp);
|
||||
USBDevice_deInit();
|
||||
|
@ -23,11 +23,12 @@
|
||||
#define __FST_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//u32 do_fst(u32 fstlocation);
|
||||
u32 do_sd_code(char *filename);
|
||||
u32 do_sd_code(char *filename);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -146,20 +146,23 @@ static const u32 wpadlibogc[5] = {
|
||||
0x90A402E0,0x806502E4,0x908502E4,0x2C030000,0x906402E4
|
||||
};
|
||||
|
||||
void dogamehooks(void *addr, u32 len) {
|
||||
void dogamehooks(void *addr, u32 len)
|
||||
{
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while (addr_start < addr_end) {
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
|
||||
switch (hooktype) {
|
||||
switch(hooktype)
|
||||
{
|
||||
|
||||
case 0:
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0) {
|
||||
if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0){
|
||||
// printf("\n\n\n");
|
||||
// printf("found at address %x\n", addr_start);
|
||||
// sleep(2);
|
||||
@ -169,7 +172,7 @@ void dogamehooks(void *addr, u32 len) {
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
/*
|
||||
case 2:
|
||||
if(memcmp(addr_start, kpadhooks, sizeof(kpadhooks))==0){
|
||||
patchhook((u32)addr_start, len);
|
||||
@ -194,16 +197,16 @@ void dogamehooks(void *addr, u32 len) {
|
||||
patchhook3((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
*/
|
||||
case 2:
|
||||
|
||||
if (memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0) {
|
||||
if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0){
|
||||
patchhook2((u32)addr_start, len);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
/*
|
||||
case 6:
|
||||
// jap region free
|
||||
if(memcmp(addr_start, regionfreehooks, sizeof(regionfreehooks))==0){
|
||||
@ -265,14 +268,14 @@ void dogamehooks(void *addr, u32 len) {
|
||||
movedvdhooks((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
*/
|
||||
// multidol
|
||||
case 3:
|
||||
|
||||
if (memcmp(addr_start, multidolpatch1, sizeof(multidolpatch1))==0) {
|
||||
if(memcmp(addr_start, multidolpatch1, sizeof(multidolpatch1))==0){
|
||||
multidolpatchone((u32)addr_start, len);
|
||||
}
|
||||
if (memcmp(addr_start, multidolpatch2, sizeof(multidolpatch2))==0) {
|
||||
if(memcmp(addr_start, multidolpatch2, sizeof(multidolpatch2))==0){
|
||||
multidolpatchtwo((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
@ -282,13 +285,15 @@ void dogamehooks(void *addr, u32 len) {
|
||||
}
|
||||
|
||||
// Not used yet, for patching DOL once loaded into memory and befor execution
|
||||
void patchdol(void *addr, u32 len) {
|
||||
void patchdol(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while (addr_start < addr_end) {
|
||||
if (memcmp(addr_start, wpadlibogc, sizeof(wpadlibogc))==0) {
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
if(memcmp(addr_start, wpadlibogc, sizeof(wpadlibogc))==0) {
|
||||
// printf("\n\n\n");
|
||||
// printf("found at address %x\n", addr_start);
|
||||
// sleep(10);
|
||||
@ -300,15 +305,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_end = addr+len;
|
||||
|
||||
while (addr_start < addr_end) {
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
|
||||
if (memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
||||
if (configbytes[0] != 0xCD) {
|
||||
if(memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
||||
if(configbytes[0] != 0xCD){
|
||||
langvipatch((u32)addr_start, len, configbytes[0]);
|
||||
}
|
||||
}
|
||||
@ -316,14 +323,16 @@ void langpatcher(void *addr, u32 len) {
|
||||
}
|
||||
}
|
||||
|
||||
void patchdebug(void *addr, u32 len) {
|
||||
void patchdebug(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
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);
|
||||
// apply patch
|
||||
@ -332,13 +341,15 @@ void patchdebug(void *addr, u32 len) {
|
||||
}
|
||||
}
|
||||
|
||||
void vidolpatcher(void *addr, u32 len) {
|
||||
void vidolpatcher(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while (addr_start < addr_end) {
|
||||
if (memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
if(memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
|
||||
vipatch((u32)addr_start, len);
|
||||
}
|
||||
addr_start += 4;
|
||||
|
@ -22,19 +22,20 @@
|
||||
#ifndef __PATCHCODE_H__
|
||||
#define __PATCHCODE_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
// Globals
|
||||
u32 hooktype;
|
||||
int patched;
|
||||
u8 configbytes[2];
|
||||
u32 regionfree;
|
||||
u32 hooktype;
|
||||
int patched;
|
||||
u8 configbytes[2];
|
||||
u32 regionfree;
|
||||
|
||||
// Function prototypes
|
||||
void dogamehooks(void *addr, u32 len);
|
||||
void langpatcher(void *addr, u32 len);
|
||||
void vidolpatcher(void *addr, u32 len);
|
||||
void patchdebug(void *addr, u32 len);
|
||||
void dogamehooks(void *addr, u32 len);
|
||||
void langpatcher(void *addr, u32 len);
|
||||
void vidolpatcher(void *addr, u32 len);
|
||||
void patchdebug(void *addr, u32 len);
|
||||
|
||||
|
||||
|
||||
|
@ -1,43 +1,43 @@
|
||||
|
||||
# (c) Nuke www.usbgecko.com. Licensed under GPL V2
|
||||
# (c) Nuke www.usbgecko.com. Licensed under GPL V2
|
||||
.text
|
||||
#include "ppc.h"
|
||||
|
||||
|
||||
.globl patchhook # r3 address
|
||||
patchhook:
|
||||
mtctr r4
|
||||
lis r6, 0x4E80
|
||||
ori r6, r6, 0x0020 # blr
|
||||
findblr:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebranch
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findblr # loop length
|
||||
b exit # stop unhooked game hanging
|
||||
|
||||
writebranch:
|
||||
lis r4, 0x8000 # 800018A0 hook location (source)
|
||||
ori r4, r4, 0x18A8
|
||||
subf r4, r3, r4 # subtract r3 from r4 and place in r4
|
||||
lis r5, 0x3FF
|
||||
ori r5, r5, 0xFFFF # 0x3FFFFFF
|
||||
and r4, r4, r5
|
||||
lis r5, 0x4800 # 0x48000000
|
||||
or r4, r4, r5
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit:
|
||||
blr # return
|
||||
|
||||
.globl patchhook2 # r3 address
|
||||
patchhook2:
|
||||
mtctr r4
|
||||
lis r6, 0x4E80
|
||||
ori r6, r6, 0x0020 # blr
|
||||
findblr2:
|
||||
findblr:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebranch
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findblr # loop length
|
||||
b exit # stop unhooked game hanging
|
||||
|
||||
writebranch:
|
||||
lis r4, 0x8000 # 800018A0 hook location (source)
|
||||
ori r4, r4, 0x18A8
|
||||
subf r4, r3, r4 # subtract r3 from r4 and place in r4
|
||||
lis r5, 0x3FF
|
||||
ori r5, r5, 0xFFFF # 0x3FFFFFF
|
||||
and r4, r4, r5
|
||||
lis r5, 0x4800 # 0x48000000
|
||||
or r4, r4, r5
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit:
|
||||
blr # return
|
||||
|
||||
.globl patchhook2 # r3 address
|
||||
patchhook2:
|
||||
mtctr r4
|
||||
lis r6, 0x4E80
|
||||
ori r6, r6, 0x0020 # blr
|
||||
findblr2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebranch2
|
||||
@ -45,7 +45,7 @@ blr # return
|
||||
bdnz findblr2 # loop length
|
||||
b exit2 # stop unhooked game hanging
|
||||
|
||||
writebranch2:
|
||||
writebranch2:
|
||||
lis r4, 0x8000 # 81700000 our temp patcher
|
||||
ori r4, r4, 0x18a8
|
||||
subf r4, r3, r4 # subtract r3 from r4 and place in r4
|
||||
@ -57,15 +57,15 @@ blr # return
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit2:
|
||||
exit2:
|
||||
blr # return
|
||||
|
||||
.globl patchhook3 # r3 address
|
||||
patchhook3:
|
||||
.globl patchhook3 # r3 address
|
||||
patchhook3:
|
||||
mtctr r4
|
||||
lis r6, 0x4BFF
|
||||
ori r6, r6, 0xE955 # blr
|
||||
findbne:
|
||||
findbne:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebl
|
||||
@ -73,21 +73,21 @@ blr # return
|
||||
bdnz findbne # loop length
|
||||
b exit3 # stop unhooked game hanging
|
||||
|
||||
writebl:
|
||||
writebl:
|
||||
lis r4, 0x4BFF # 81700000 our temp patcher
|
||||
ori r4, r4, 0xEA91
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit3:
|
||||
exit3:
|
||||
blr # return
|
||||
|
||||
.globl patchhook4 # r3 address
|
||||
patchhook4:
|
||||
.globl patchhook4 # r3 address
|
||||
patchhook4:
|
||||
mtctr r4
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x001C # blr
|
||||
findregion:
|
||||
findregion:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebr
|
||||
@ -95,21 +95,21 @@ blr # return
|
||||
bdnz findregion # loop length
|
||||
b exit4 # stop unhooked game hanging
|
||||
|
||||
writebr:
|
||||
writebr:
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x001C
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit4:
|
||||
exit4:
|
||||
blr # return
|
||||
|
||||
.globl multidolpatchone # r3 address
|
||||
multidolpatchone:
|
||||
.globl multidolpatchone # r3 address
|
||||
multidolpatchone:
|
||||
mtctr r4
|
||||
lis r6, 0x3800
|
||||
ori r6, r6, 0x0001 # (li r0,1)
|
||||
findmulti:
|
||||
findmulti:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writemulti
|
||||
@ -117,7 +117,7 @@ blr # return
|
||||
bdnz findmulti # loop length
|
||||
b exit5 # stop unhooked game hanging
|
||||
|
||||
writemulti:
|
||||
writemulti:
|
||||
lis r4, 0x8170 # 81700000
|
||||
ori r4, r4, 0x0020
|
||||
subf r18, r3, r4 # subf r18,(source),(dest)
|
||||
@ -131,15 +131,15 @@ blr # return
|
||||
sync
|
||||
icbi r0, r3
|
||||
isync
|
||||
exit5:
|
||||
exit5:
|
||||
blr # return
|
||||
|
||||
.globl multidolpatchtwo # r3 address
|
||||
multidolpatchtwo:
|
||||
.globl multidolpatchtwo # r3 address
|
||||
multidolpatchtwo:
|
||||
mtctr r4
|
||||
lis r6, 0x3F60
|
||||
ori r6, r6, 0x8000 # (lis r27,-32768)
|
||||
findmulti2:
|
||||
findmulti2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writemulti2
|
||||
@ -147,7 +147,7 @@ blr # return
|
||||
bdnz findmulti2 # loop length
|
||||
b exit6 # stop unhooked game hanging
|
||||
|
||||
writemulti2:
|
||||
writemulti2:
|
||||
lis r4, 0x8170 # 81700020
|
||||
ori r4, r4, 0x0000
|
||||
subf r18, r3, r4 # subf r18,(source),(dest)
|
||||
@ -161,15 +161,15 @@ blr # return
|
||||
sync
|
||||
icbi r0, r3
|
||||
isync
|
||||
exit6:
|
||||
exit6:
|
||||
blr # return
|
||||
|
||||
.globl langvipatch # r3 address, r4 len, r5 lang byte
|
||||
langvipatch:
|
||||
.globl langvipatch # r3 address, r4 len, r5 lang byte
|
||||
langvipatch:
|
||||
mtctr r4
|
||||
lis r6, 0x8861
|
||||
ori r6, r6, 0x0008 # lbz r3, 8(sp)
|
||||
findlang:
|
||||
findlang:
|
||||
lwz r7, 0(r3)
|
||||
cmpw r6, r7
|
||||
beq patchlang
|
||||
@ -177,23 +177,23 @@ blr # return
|
||||
bdnz findlang # loop length
|
||||
b exitlang # stop unhooked game hanging
|
||||
|
||||
patchlang:
|
||||
patchlang:
|
||||
|
||||
lis r4, 0x3860 # 0x38600001 li %r3, 1 # eng
|
||||
add r4, r4, r5
|
||||
gofinal:
|
||||
gofinal:
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitlang:
|
||||
exitlang:
|
||||
blr # return
|
||||
|
||||
.globl vipatch # r3 address
|
||||
vipatch:
|
||||
.globl vipatch # r3 address
|
||||
vipatch:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0xFFFE
|
||||
findvi:
|
||||
findvi:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq patchvi
|
||||
@ -201,7 +201,7 @@ blr # return
|
||||
bdnz findvi # loop length
|
||||
b exitvi # stop unhooked game hanging
|
||||
|
||||
patchvi:
|
||||
patchvi:
|
||||
lis r4, 0x8000
|
||||
ori r4, r4, 0x0003
|
||||
lbz r5, 0(r4)
|
||||
@ -210,26 +210,26 @@ blr # return
|
||||
cmpwi r5, 0x4A
|
||||
beq patchjap2 # JAP
|
||||
b exitvi
|
||||
patchjap2:
|
||||
patchjap2:
|
||||
lis r4, 0x3800
|
||||
ori r4, r4, 0x0001
|
||||
b gofinal2
|
||||
patchusa:
|
||||
patchusa:
|
||||
lis r4, 0x3800
|
||||
ori r4, r4, 0x0000
|
||||
gofinal2:
|
||||
gofinal2:
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitvi:
|
||||
exitvi:
|
||||
blr # return
|
||||
|
||||
.globl regionfreejap # r3 address
|
||||
regionfreejap:
|
||||
.globl regionfreejap # r3 address
|
||||
regionfreejap:
|
||||
mtctr r4
|
||||
lis r6, 0x2C1B
|
||||
ori r6, r6, 0x0000 # blr
|
||||
findjap:
|
||||
findjap:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop
|
||||
@ -237,22 +237,22 @@ blr # return
|
||||
bdnz findjap # loop length
|
||||
b exitjap # stop unhooked game hanging
|
||||
|
||||
writenop:
|
||||
writenop:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitjap:
|
||||
exitjap:
|
||||
blr # return
|
||||
|
||||
.globl regionfreeusa # r3 address
|
||||
regionfreeusa:
|
||||
.globl regionfreeusa # r3 address
|
||||
regionfreeusa:
|
||||
mtctr r4
|
||||
lis r6, 0x281B
|
||||
ori r6, r6, 0x0001 # blr
|
||||
findusa:
|
||||
findusa:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop1
|
||||
@ -260,22 +260,22 @@ blr # return
|
||||
bdnz findusa # loop length
|
||||
b exitusa # stop unhooked game hanging
|
||||
|
||||
writenop1:
|
||||
writenop1:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitusa:
|
||||
exitusa:
|
||||
blr # return
|
||||
|
||||
.globl regionfreepal # r3 address
|
||||
regionfreepal:
|
||||
.globl regionfreepal # r3 address
|
||||
regionfreepal:
|
||||
mtctr r4
|
||||
lis r6, 0x281B
|
||||
ori r6, r6, 0x0002 # blr
|
||||
findpal:
|
||||
findpal:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop2
|
||||
@ -283,7 +283,7 @@ blr # return
|
||||
bdnz findpal # loop length
|
||||
b exitpal # stop unhooked game hanging
|
||||
|
||||
writenop2:
|
||||
writenop2:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
@ -293,7 +293,7 @@ blr # return
|
||||
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x001C # bne loc_81377A2C
|
||||
findextra: #this is just the bne to b patch
|
||||
findextra: #this is just the bne to b patch
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writeb
|
||||
@ -301,22 +301,22 @@ blr # return
|
||||
bdnz findextra # loop length
|
||||
b exitpal # stop unhooked game hanging
|
||||
|
||||
writeb:
|
||||
writeb:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x001c # b loc_81377A2C
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitpal:
|
||||
exitpal:
|
||||
blr # return
|
||||
|
||||
.globl removehealthcheck # r3 address
|
||||
removehealthcheck:
|
||||
.globl removehealthcheck # r3 address
|
||||
removehealthcheck:
|
||||
mtctr r4
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x004C # blr
|
||||
findhe:
|
||||
findhe:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebhe
|
||||
@ -324,23 +324,23 @@ blr # return
|
||||
bdnz findhe # loop length
|
||||
b exithe # stop unhooked game hanging
|
||||
|
||||
writebhe:
|
||||
writebhe:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exithe:
|
||||
exithe:
|
||||
blr # return
|
||||
|
||||
|
||||
|
||||
.globl patchupdatecheck # r3 address
|
||||
patchupdatecheck:
|
||||
.globl patchupdatecheck # r3 address
|
||||
patchupdatecheck:
|
||||
mtctr r4
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x0020 # blr
|
||||
finduc:
|
||||
finduc:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenopuc
|
||||
@ -348,24 +348,24 @@ blr # return
|
||||
bdnz finduc # loop length
|
||||
b exituc # stop unhooked game hanging
|
||||
|
||||
writenopuc:
|
||||
writenopuc:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exituc:
|
||||
exituc:
|
||||
blr # return
|
||||
|
||||
|
||||
|
||||
|
||||
.globl copyflagcheck1 # r3 address
|
||||
copyflagcheck1:
|
||||
.globl copyflagcheck1 # r3 address
|
||||
copyflagcheck1:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0x07FF
|
||||
findncf1:
|
||||
findncf1:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf1
|
||||
@ -373,21 +373,21 @@ blr # return
|
||||
bdnz findncf1 # loop length
|
||||
b exitncf1 # stop unhooked game hanging
|
||||
|
||||
writencf1:
|
||||
writencf1:
|
||||
lis r4, 0x7C00
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf1:
|
||||
exitncf1:
|
||||
blr # return
|
||||
|
||||
.globl copyflagcheck2 # r3 address
|
||||
copyflagcheck2:
|
||||
.globl copyflagcheck2 # r3 address
|
||||
copyflagcheck2:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0x07FF
|
||||
findncf2:
|
||||
findncf2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf2
|
||||
@ -395,37 +395,37 @@ blr # return
|
||||
bdnz findncf2 # loop length
|
||||
b exitncf2 # stop unhooked game hanging
|
||||
|
||||
writencf2:
|
||||
writencf2:
|
||||
lis r4, 0x7C00
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf2:
|
||||
exitncf2:
|
||||
blr # return
|
||||
|
||||
|
||||
.globl copyflagcheck3 # r3 address
|
||||
copyflagcheck3:
|
||||
findncf3:
|
||||
.globl copyflagcheck3 # r3 address
|
||||
copyflagcheck3:
|
||||
findncf3:
|
||||
addi r3, r3, 20 # go back one dword (4 bytes)
|
||||
lwz r5, 0(r3)
|
||||
writencf3:
|
||||
writencf3:
|
||||
lis r4, 0x3860
|
||||
ori r4, r4, 0x0001 # li r3,1
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf3:
|
||||
exitncf3:
|
||||
blr # return
|
||||
|
||||
|
||||
.globl copyflagcheck4 # r3 address
|
||||
copyflagcheck4:
|
||||
.globl copyflagcheck4 # r3 address
|
||||
copyflagcheck4:
|
||||
mtctr r4
|
||||
lis r6, 0x3BE0
|
||||
ori r6, r6, 0x0001 # li r31,1
|
||||
findncf4:
|
||||
findncf4:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf4
|
||||
@ -433,21 +433,21 @@ blr # return
|
||||
bdnz findncf4 # loop length
|
||||
b exitncf4 # stop unhooked game hanging
|
||||
|
||||
writencf4:
|
||||
writencf4:
|
||||
lis r4, 0x3BE0
|
||||
ori r4, r4, 0x0000 # change this to 3BE00000 (li r31,0)
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf4:
|
||||
exitncf4:
|
||||
blr # return
|
||||
|
||||
.globl copyflagcheck5 # r3 address
|
||||
copyflagcheck5:
|
||||
.globl copyflagcheck5 # r3 address
|
||||
copyflagcheck5:
|
||||
mtctr r4
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x0024 # beq loc_8134AA60
|
||||
findncf5:
|
||||
findncf5:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf5
|
||||
@ -455,8 +455,8 @@ blr # return
|
||||
bdnz findncf5 # loop length
|
||||
b exitncf5 # stop unhooked game hanging
|
||||
|
||||
writencf5:
|
||||
#addi r3, r3, 8 # skip 2
|
||||
writencf5:
|
||||
#addi r3, r3, 8 # skip 2
|
||||
|
||||
lis r4, 0x801D
|
||||
ori r4, r4, 0x0024 # change to 801D0024 (lwz r0,36(r29))
|
||||
@ -487,22 +487,22 @@ blr # return
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
exitncf5:
|
||||
exitncf5:
|
||||
blr # return
|
||||
|
||||
.globl movedvdhooks # r3 address
|
||||
movedvdhooks:
|
||||
.globl movedvdhooks # r3 address
|
||||
movedvdhooks:
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x0120 # beq loc_813A7938
|
||||
findmd1:
|
||||
findmd1:
|
||||
addi r3, r3, 4 # next word
|
||||
lwz r5, 0(r3)
|
||||
writemd1:
|
||||
writemd1:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000 # nop
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitmd1:
|
||||
exitmd1:
|
||||
blr # return
|
||||
|
||||
|
@ -205,11 +205,11 @@ int DiscBrowse(struct discHdr * header) {
|
||||
|
||||
if (ret > 0) {
|
||||
char temp[100];
|
||||
strncpy(temp, fstfiles(fst, ret), sizeof(temp));
|
||||
strlcpy(temp, fstfiles(fst, ret), sizeof(temp));
|
||||
choice = WindowPrompt(temp, tr("Load this dol as alternate dol?"), tr("OK"), tr("Cancel"));
|
||||
if (choice) {
|
||||
//ret = offsetselect[ret];
|
||||
snprintf(alternatedname, sizeof(alternatedname), "%s", temp);
|
||||
strlcpy(alternatedname, temp, sizeof(alternatedname));
|
||||
exit = true;
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,6 @@ int DiscBrowse(struct discHdr * header) {
|
||||
|
||||
|
||||
int autoSelectDol(const char *id) {
|
||||
//still not done//
|
||||
//////////ID6/////////////////
|
||||
|
||||
//Boogie
|
||||
@ -271,38 +270,6 @@ int autoSelectDol(const char *id) {
|
||||
//Metal Slug Anthology
|
||||
if (strcmp(id,"RMLP7U") == 0) return 56;//from isostar
|
||||
|
||||
//Metroid Prime Trilogy
|
||||
if (strcmp(id,"R3ME01") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "Metroid Prime", "Metroid Prime 2", "Metroid Prime 3");
|
||||
switch (choice) {
|
||||
case 1:
|
||||
choice = 780;
|
||||
break;
|
||||
case 2:
|
||||
choice = 781;
|
||||
break;
|
||||
default:
|
||||
choice = 782;
|
||||
break;
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
if (strcmp(id,"R3MP01") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "Metroid Prime", "Metroid Prime 2", "Metroid Prime 3");
|
||||
switch (choice) {
|
||||
case 1:
|
||||
choice = 782;
|
||||
break;
|
||||
case 2:
|
||||
choice = 783;
|
||||
break;
|
||||
default:
|
||||
choice = 784;
|
||||
break;
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
//Mortal Kombat
|
||||
if (strcmp(id,"RKMP5D") == 0) return 290;//from isostar
|
||||
if (strcmp(id,"RKME5D") == 0) return 290;//starstremr
|
||||
@ -342,3 +309,41 @@ int autoSelectDol(const char *id) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int autoSelectDolMenu(const char *id) {
|
||||
|
||||
//Metroid Prime Trilogy
|
||||
if (strcmp(id,"R3ME01") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "Metroid Prime", "Metroid Prime 2", "Metroid Prime 3", tr("Cancel"));
|
||||
switch (choice) {
|
||||
case 1:
|
||||
choice = 780;
|
||||
break;
|
||||
case 2:
|
||||
choice = 781;
|
||||
break;
|
||||
case 3:
|
||||
choice = 782;
|
||||
default: // 0
|
||||
break;
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
if (strcmp(id,"R3MP01") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "Metroid Prime", "Metroid Prime 2", "Metroid Prime 3", tr("Cancel"));
|
||||
switch (choice) {
|
||||
case 1:
|
||||
choice = 782;
|
||||
break;
|
||||
case 2:
|
||||
choice = 783;
|
||||
break;
|
||||
case 3:
|
||||
choice = 784;
|
||||
default: // 0
|
||||
break;
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -10,5 +10,6 @@
|
||||
|
||||
int DiscBrowse(struct discHdr * header);
|
||||
int autoSelectDol(const char *id);
|
||||
int autoSelectDolMenu(const char *id);
|
||||
|
||||
#endif
|
||||
|
@ -1957,7 +1957,7 @@ int GameSettings(struct discHdr * header) {
|
||||
alternatedol = game_cfg->loadalternatedol;
|
||||
alternatedoloffset = game_cfg->alternatedolstart;
|
||||
reloadblock = game_cfg->iosreloadblock;
|
||||
strncpy(alternatedname, game_cfg->alternatedolname, sizeof(alternatedname));
|
||||
strlcpy(alternatedname, game_cfg->alternatedolname, sizeof(alternatedname));
|
||||
} else {
|
||||
videoChoice = Settings.video;
|
||||
languageChoice = Settings.language;
|
||||
@ -1974,11 +1974,9 @@ int GameSettings(struct discHdr * header) {
|
||||
alternatedol = off;
|
||||
alternatedoloffset = 0;
|
||||
reloadblock = off;
|
||||
sprintf(alternatedname, " ");
|
||||
strcpy(alternatedname, "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
ResumeGui();
|
||||
|
||||
while (MainButton1.GetEffect() > 0) usleep(50);
|
||||
@ -2187,16 +2185,21 @@ int GameSettings(struct discHdr * header) {
|
||||
snprintf(filename,sizeof(filename),"%c%c%c%c%c%c",header->id[0], header->id[1], header->id[2],
|
||||
header->id[3],header->id[4], header->id[5]);
|
||||
int dolchoice = 0;
|
||||
//alt dol menu for games that require more than a single alt dol
|
||||
int autodol = autoSelectDolMenu(filename);
|
||||
if (autodol>0) {
|
||||
alternatedoloffset = autodol;
|
||||
snprintf(alternatedname, sizeof(alternatedname), "%s <%i>", tr("AUTO"),autodol);
|
||||
} else if (autodol!=0) {
|
||||
//check to see if we already know the offset of the correct dol
|
||||
int autodol = autoSelectDol(filename);
|
||||
|
||||
//if we do know that offset ask if they want to use it
|
||||
if (autodol>0) {
|
||||
dolchoice = WindowPrompt(0,tr("Do you want to use the alt dol that is known to be correct?"),tr("Yes"),tr("Pick from a list"));
|
||||
if (dolchoice==1) {
|
||||
alternatedoloffset = autodol;
|
||||
snprintf(alternatedname, sizeof(alternatedname), "%s <%i>", tr("AUTO"),autodol);
|
||||
} else {//they want to search for the correct dol themselves
|
||||
} else if (dolchoice!=0){//they want to search for the correct dol themselves
|
||||
int res = DiscBrowse(header);
|
||||
if ((res >= 0)&&(res !=696969)) {//if res==696969 they pressed the back button
|
||||
alternatedoloffset = res;
|
||||
@ -2206,13 +2209,13 @@ int GameSettings(struct discHdr * header) {
|
||||
int res = DiscBrowse(header);
|
||||
if ((res >= 0)&&(res !=696969)){
|
||||
alternatedoloffset = res;
|
||||
|
||||
char tmp[170];
|
||||
snprintf(tmp,sizeof(tmp),"%s %s - %i",tr("It seems that you have some information that will be helpful to us. Please pass this information along to the DEV team.") ,filename,alternatedoloffset);
|
||||
WindowPrompt(0,tmp,tr("Ok"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
reloadblock = (reloadblock+1) % 2;
|
||||
@ -2281,6 +2284,7 @@ int GameSettings(struct discHdr * header) {
|
||||
options2.SetName(2,"%s", tr("Delete Boxart"));
|
||||
options2.SetName(3,"%s", tr("Delete Discart"));
|
||||
options2.SetName(4,"%s", tr("Delete CheatTxt"));
|
||||
options2.SetName(5,"%s", tr("Delete Cheat GCT"));
|
||||
for (int i = 0; i <= MAXOPTIONS-1; i++) options2.SetValue(i, NULL);
|
||||
w.Append(&optionBrowser2);
|
||||
optionBrowser2.SetClickable(true);
|
||||
@ -2399,7 +2403,16 @@ int GameSettings(struct discHdr * header) {
|
||||
remove(tmp);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
||||
snprintf(tmp,sizeof(tmp),"%s%c%c%c%c%c%c.gct", Settings.Cheatcodespath, header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||
|
||||
choice1 = WindowPrompt(tr("Delete"),tmp,tr("Yes"),tr("No"));
|
||||
if (choice1==1) {
|
||||
if (checkfile(tmp))
|
||||
remove(tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
||||
@ -2428,7 +2441,7 @@ int GameSettings(struct discHdr * header) {
|
||||
iosChoice = i249;
|
||||
}
|
||||
parentalcontrolChoice = 0;
|
||||
sprintf(alternatedname, " ");
|
||||
strcpy(alternatedname, "");
|
||||
CFG_forget_game_opt(header->id);
|
||||
/* commented because the database language now depends on the main language setting, this could be enabled again if there is a separate language setting for the database
|
||||
// if default language is different than language from main settings, reload titles
|
||||
|
@ -1016,7 +1016,7 @@ bool trimsplit(char *line, char *part1, char *part2, char delim, int size) {
|
||||
}
|
||||
void cfg_parseline(char *line, void (*set_func)(char*, char*)) {
|
||||
// split name = value
|
||||
char tmp[200], name[200], val[200];
|
||||
char tmp[300], name[200], val[200];
|
||||
strcopy(tmp, line, sizeof(tmp));
|
||||
char *eq = strchr(tmp, '=');
|
||||
if (!eq) return;
|
||||
@ -1054,7 +1054,7 @@ void cfg_parsetitleline(char *line, void (*set_func)(char*, char*, u8)) {
|
||||
|
||||
bool cfg_parsefile(char *fname, void (*set_func)(char*, char*)) {
|
||||
FILE *f;
|
||||
char line[200];
|
||||
char line[300];
|
||||
|
||||
//printf("opening(%s)\n", fname);
|
||||
f = fopen(fname, "r");
|
||||
@ -1137,8 +1137,12 @@ void cfg_set_game_opt(struct Game_CFG *game, u8 *id) {
|
||||
game->iosreloadblock = reloadblock;
|
||||
game->patchcountrystrings = countrystrings;
|
||||
game->loadalternatedol = alternatedol;
|
||||
if (game->loadalternatedol == 0) {
|
||||
alternatedoloffset = 0;
|
||||
strcpy(alternatedname, "");
|
||||
}
|
||||
game->alternatedolstart = alternatedoloffset;
|
||||
strcpy(game->alternatedolname, alternatedname);
|
||||
strlcpy(game->alternatedolname, alternatedname,sizeof(game->alternatedolname));
|
||||
}
|
||||
|
||||
struct Game_NUM* cfg_get_game_num(u8 *id) {
|
||||
@ -1254,7 +1258,7 @@ void game_set(char *name, char *val) {
|
||||
|
||||
// parse val
|
||||
// first split options by ;
|
||||
char opt[200], *p, *np;
|
||||
char opt[300], *p, *np;
|
||||
p = val;
|
||||
|
||||
while (p) {
|
||||
@ -1321,18 +1325,7 @@ void game_set(char *name, char *val) {
|
||||
}
|
||||
}
|
||||
if (strcmp("alternatedolname", opt_name) == 0) {
|
||||
char temp3[40];
|
||||
int i = 0;
|
||||
while (i < 40) {
|
||||
|
||||
if (opt_val[i] == ';')
|
||||
break;
|
||||
|
||||
temp3[i] = opt_val[i];
|
||||
i++;
|
||||
}
|
||||
temp3[i] = '\0';
|
||||
strncpy(game->alternatedolname, temp3, 39);
|
||||
strlcpy(game->alternatedolname, opt_val, sizeof(game->alternatedolname));
|
||||
}
|
||||
}
|
||||
// next opt
|
||||
|
Loading…
Reference in New Issue
Block a user