*Fixed crash on UPDATE

*Added Custom CheatCodes Path (both USB and SD)
This commit is contained in:
dimok321 2009-06-10 11:27:19 +00:00
parent e18b154156
commit d2c1f83821
8 changed files with 75 additions and 43 deletions

View File

@ -2288,7 +2288,7 @@ ProgressUpdateWindow()
{
char revtxt[10];
char rev_txt[14];
sprintf(rev_txt, "%s:/rev.txt", bootDevice);
sprintf(rev_txt, "%srev.txt", Settings.update_path);
pfile = fopen(rev_txt, "w");
fwrite(file.data,1,file.size,pfile);
fclose(pfile);

View File

@ -1170,7 +1170,7 @@ int MenuSettings()
options2.SetName(2, "%s", LANGUAGE.ThemePath);
options2.SetName(3, "%s", LANGUAGE.Titlestxtpath);
options2.SetName(4, "%s", LANGUAGE.Updatepath);
options2.SetName(5, NULL);
options2.SetName(5, "%s", LANGUAGE.Cheatcodespath);
options2.SetName(6, NULL);
options2.SetName(7, NULL);
options2.SetName(8, NULL);
@ -1195,6 +1195,7 @@ int MenuSettings()
options2.SetValue(2, "%s", CFG.theme_path);
options2.SetValue(3, "%s", Settings.titlestxt_path);
options2.SetValue(4, "%s", Settings.update_path);
options2.SetValue(5, "%s", Settings.Cheatcodespath);
if(backBtn.GetState() == STATE_CLICKED)
{
@ -1399,6 +1400,28 @@ int MenuSettings()
else
WindowPrompt(0,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
break;
case 5:
if ( Settings.godmode == 1)
{
w.Remove(&optionBrowser2);
w.Remove(&backBtn);
char entered[43] = "";
strncpy(entered, Settings.Cheatcodespath, sizeof(entered));
int result = OnScreenKeyboard(entered,43,0);
w.Append(&optionBrowser2);
w.Append(&backBtn);
if ( result == 1 )
{
int len = (strlen(entered)-1);
if(entered[len] !='/')
strncat (entered, "/", 1);
strncpy(Settings.Cheatcodespath, entered, sizeof(Settings.Cheatcodespath));
WindowPrompt(LANGUAGE.Cheatcodespathchanged,0,LANGUAGE.ok,0,0,0);
}
}
else
WindowPrompt(0,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
break;
}
}
/** If not godmode don't let him inside **/

View File

@ -240,6 +240,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
snprintf(Settings.languagefiles_path, sizeof(Settings.languagefiles_path), "%s/config/language/", bootDevice);
snprintf(Settings.oggload_path, sizeof(Settings.oggload_path), "%s/config/backgroundmusic/", bootDevice);
snprintf(Settings.update_path, sizeof(Settings.update_path), "%s/apps/usbloader_gx/", bootDevice);
snprintf(Settings.Cheatcodespath, sizeof(Settings.Cheatcodespath), "%s/codes/", bootDevice);
sprintf(Settings.ogg_path, "notset");
//all alignments are left top here
@ -497,6 +498,10 @@ void path_set(char *name, char *val)
strcopy(Settings.update_path, val, sizeof(Settings.update_path));
return;
}
if (strcmp(name, "Cheatcodespath") == 0) {
strcopy(Settings.Cheatcodespath, val, sizeof(Settings.Cheatcodespath));
return;
}
if (strcmp(name, "oggload_path") == 0) {
strcopy(Settings.oggload_path, val, sizeof(Settings.oggload_path));
return;
@ -1210,6 +1215,7 @@ bool cfg_save_global()// save global settings
fprintf(f, "wiilight = %d\n ", Settings.wiilight);
fprintf(f, "gameDisplay = %d\n ", Settings.gameDisplay);
fprintf(f, "update_path = %s\n ", Settings.update_path);
fprintf(f, "Cheatcodespath = %s\n ", Settings.Cheatcodespath);
fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings);
fclose(f);
return true;

View File

@ -328,6 +328,7 @@ struct SSettings {
char oggload_path[100];
char ogg_path[150];
char update_path[150];
char Cheatcodespath[100];
};
void CFG_LoadGlobal(void);

View File

@ -150,11 +150,11 @@ int USBDevice_Init()
//closing all open Files write back the cache and then shutdown em!
fatUnmount("USB:/");
//right now mounts first FAT-partition
if (fatMount("USB", &__io_usbstorage, GetFATPartition(&__io_usbstorage), CACHE, SECTORS)) {
//try first mount with libogc
if (fatMount("USB", &__io_wiiums, GetFATPartition(&__io_wiiums), CACHE, SECTORS)) {
//try first mount with cIOS
return 1;
} else if (fatMount("USB", &__io_wiiums, GetFATPartition(&__io_wiiums), CACHE, SECTORS)) {
//try now mount with cIOS
} else if (fatMount("USB", &__io_usbstorage, GetFATPartition(&__io_usbstorage), CACHE, SECTORS)) {
//try now mount with libogc
return 1;
}
return -1;

View File

@ -26,53 +26,41 @@
#include <gccore.h>
#include <malloc.h>
#include <sys/unistd.h>
#include <fat.h>
#include <sdcard/wiisd_io.h>
#include "ogc/ipc.h"
#include "fst.h"
#include "dvd_broadway.h"
#include "wpad.h"
#include "cfg.h"
#include "fatmounter.h"
extern struct SSettings Settings;
#define FSTDIRTYPE 1
#define FSTFILETYPE 0
#define ENTRYSIZE 0xC
#define FILEDIR "SD:/codes"
#define MAX_FILENAME_LEN 128
static vu32 dvddone = 0;
// Real basic
u32 do_sd_code(char *filename)
{
FILE *fp;
u8 *filebuff;
u32 filesize;
u32 ret;
char filepath[128];
ret = fatMountSimple("SD", &__io_wiisd);
if (!ret) {
return 0;
}
char filepath[150];
fflush(stdout);
sprintf(filepath, FILEDIR "/%s", filename);
filepath[16] = 0x2E;
filepath[17] = 0x67;
filepath[18] = 0x63;
filepath[19] = 0x74;
filepath[20] = 0;
//printf("filename %s\n",filepath);
SDCard_Init();
USBDevice_Init();
sprintf(filepath, "%s%s", Settings.Cheatcodespath, filename);
filepath[strlen(Settings.Cheatcodespath)+6] = 0x2E;
filepath[strlen(Settings.Cheatcodespath)+7] = 0x67;
filepath[strlen(Settings.Cheatcodespath)+8] = 0x63;
filepath[strlen(Settings.Cheatcodespath)+9] = 0x74;
filepath[strlen(Settings.Cheatcodespath)+10] = 0;
fp = fopen(filepath, "rb");
if (!fp) {
fatUnmount("SD:/");
USBDevice_deInit();
SDCard_deInit();
return 0;
}
@ -84,6 +72,8 @@ u32 do_sd_code(char *filename)
if(filebuff == 0){
fclose(fp);
sleep(2);
USBDevice_deInit();
SDCard_deInit();
return 0;
}
@ -91,19 +81,19 @@ u32 do_sd_code(char *filename)
if(ret != filesize){
free(filebuff);
fclose(fp);
fatUnmount("SD:/");
USBDevice_deInit();
SDCard_deInit();
return 0;
}
memcpy((void*)0x800027E8,filebuff,filesize);
*(vu8*)0x80001807 = 0x01;
memcpy((void*)0x800027E8,filebuff,filesize);
*(vu8*)0x80001807 = 0x01;
free(filebuff);
fclose(fp);
fatUnmount("SD:/");
USBDevice_deInit();
SDCard_deInit();
return 1;
}

View File

@ -68,6 +68,8 @@ snprintf(LANGUAGE.CoverDownload, sizeof(LANGUAGE.CoverDownload), "Cover Download
snprintf(LANGUAGE.CoverPath, sizeof(LANGUAGE.CoverPath), "Cover Path");
snprintf(LANGUAGE.CoverpathChanged, sizeof(LANGUAGE.CoverpathChanged), "Coverpath Changed");
snprintf(LANGUAGE.Coverpathchange, sizeof(LANGUAGE.Coverpathchange), "Coverpath change");
snprintf(LANGUAGE.Cheatcodespathchanged, sizeof(LANGUAGE.Cheatcodespathchanged), "Cheatcodes Path changed");
snprintf(LANGUAGE.Cheatcodespath, sizeof(LANGUAGE.Cheatcodespath), "Cheatcodes Path");
snprintf(LANGUAGE.count, sizeof(LANGUAGE.count), "Play Count");
snprintf(LANGUAGE.Credits, sizeof(LANGUAGE.Credits), "Credits");
snprintf(LANGUAGE.Custompaths, sizeof(LANGUAGE.Custompaths), "Custom Paths");
@ -437,6 +439,14 @@ void language_set(char *name, char *val)
strcopy(LANGUAGE.Coverpathchange, val, sizeof(LANGUAGE.Coverpathchange));
return;
}
if (strcmp(name, "Cheatcodespath") == 0) {
strcopy(LANGUAGE.Cheatcodespath, val, sizeof(LANGUAGE.Cheatcodespath));
return;
}
if (strcmp(name, "Cheatcodespathchanged") == 0) {
strcopy(LANGUAGE.Cheatcodespathchanged, val, sizeof(LANGUAGE.Cheatcodespathchanged));
return;
}
if (strcmp(name, "Credits") == 0) {
strcopy(LANGUAGE.Credits, val, sizeof(LANGUAGE.Credits));
return;

View File

@ -10,7 +10,7 @@ extern "C"
#endif
struct LANGUAGE
{
{
char released[15];
char publishedby[25];
char developedby[25];
@ -27,8 +27,8 @@ struct LANGUAGE
char november[15];
char december[15];
char wififeatures[20];
char t3Covers[50];
char addToFavorite[50];
char all[30];
@ -67,6 +67,8 @@ struct LANGUAGE
char CoverPath[50];
char CoverpathChanged[50];
char Coverpathchange[50];
char Cheatcodespathchanged[80];
char Cheatcodespath[80];
char count[20];
char Credits[30];
char Custompaths[60];