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:
lustar.mii 2009-09-18 08:28:31 +00:00
parent 75a4d33e4f
commit 370a332fcc
18 changed files with 1845 additions and 1741 deletions

View File

@ -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

View File

@ -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"));
}

View File

@ -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);

View File

@ -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;

View File

@ -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,22 +93,26 @@ 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);
@ -115,7 +121,8 @@ static struct dicontext* __dvd_getcontext(dvdcallbacklow 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;
@ -131,7 +138,8 @@ 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;
@ -147,7 +155,8 @@ 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;
@ -162,7 +171,8 @@ 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;
@ -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;
@ -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;
@ -241,7 +253,8 @@ 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;
@ -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;
@ -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;
@ -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;
@ -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;
@ -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;
@ -360,7 +378,8 @@ s32 bwDVD_LowOffset(u64 offset,dvdcallbacklow cb) {
return ret;
}
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb) {
s32 bwDVD_LowPrepareCoverRegister(dvdcallbacklow cb)
{
s32 ret;
struct dicontext *ctx;
struct dicommand *cmd;
@ -377,7 +396,8 @@ 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;
@ -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;
@ -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;
@ -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;
@ -469,7 +492,8 @@ s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb) {
return ret;
}
s32 bwDVD_LowResetNotify() {
s32 bwDVD_LowResetNotify()
{
s32 ret;
struct dicontext *ctx;
struct dicommand *cmd;
@ -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;
@ -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;
@ -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;
@ -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;
@ -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;

View File

@ -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;

View File

@ -23,7 +23,8 @@
#define __FST_H__
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
//u32 do_fst(u32 fstlocation);

View File

@ -146,13 +146,16 @@ 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:
@ -282,12 +285,14 @@ 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) {
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);
@ -300,12 +305,14 @@ 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){
@ -316,12 +323,14 @@ 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) {
@ -332,12 +341,14 @@ 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) {
while(addr_start < addr_end)
{
if(memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
vipatch((u32)addr_start, len);
}

View File

@ -22,7 +22,8 @@
#ifndef __PATCHCODE_H__
#define __PATCHCODE_H__
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
// Globals
u32 hooktype;

View File

@ -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;
}

View File

@ -10,5 +10,6 @@
int DiscBrowse(struct discHdr * header);
int autoSelectDol(const char *id);
int autoSelectDolMenu(const char *id);
#endif

View File

@ -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

View File

@ -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