mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 20:56:53 +01:00
*Fixed settings loading on boot up
*Added better wait loop for HDD spin up *Changed almost all default config paths which are set when no config exists to be set to where the actual config file is saved (either /apps/usbloader_gx/ or /config/) *Changed to startup and load a cios right away before loading settings. You need to have at least one non stub cios 249, 222 or 250 to start the loader now *Fixed 30 secs timer on HDD spin wait *Updated libfat to new libogc version
This commit is contained in:
parent
2c1228fa37
commit
9da497419c
@ -47,10 +47,13 @@ bool SetupDefaultFont(const char *path)
|
||||
{
|
||||
bool result = false;
|
||||
FILE *pfile = NULL;
|
||||
char FontPath[300];
|
||||
|
||||
ClearFontData();
|
||||
|
||||
if (path) pfile = fopen(path, "rb");
|
||||
snprintf(FontPath, sizeof(FontPath), "%sfont.ttf", path);
|
||||
|
||||
pfile = fopen(FontPath, "rb");
|
||||
|
||||
if (pfile)
|
||||
{
|
||||
|
@ -51,10 +51,20 @@ int USBDevice_Init()
|
||||
USBDevice_deInit();
|
||||
//right now mounts first FAT-partition
|
||||
|
||||
//usbstorage.startup is actually not needed since it's done in libfat
|
||||
//let's still do it before mount and wait a bit for slow ass hdds before reading from them
|
||||
__io_usbstorage2.startup();
|
||||
usleep(200000);
|
||||
bool started = false;
|
||||
int retries = 10;
|
||||
|
||||
// wait 0.5 sec for the USB to spin up...stupid slow ass HDD
|
||||
do
|
||||
{
|
||||
started = (!__io_usbstorage2.startup() || !__io_usbstorage2.isInserted());
|
||||
usleep(50000);
|
||||
--retries;
|
||||
}
|
||||
while(!started && retries > 0);
|
||||
|
||||
if(!started)
|
||||
return -1;
|
||||
|
||||
if (fatMount("USB", &__io_usbstorage2, 0, CACHE, SECTORS))
|
||||
{
|
||||
@ -62,18 +72,32 @@ int USBDevice_Init()
|
||||
return (fat_usb_mount = 1);
|
||||
}
|
||||
|
||||
__io_usbstorage.startup();
|
||||
usleep(200000);
|
||||
|
||||
if(fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS))
|
||||
{
|
||||
fat_usb_sec = _FAT_startSector;
|
||||
return (fat_usb_mount = 1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
__io_usbstorage.shutdown();
|
||||
int USBDevice_Init_Loop()
|
||||
{
|
||||
time_t starttime = time(0);
|
||||
time_t timenow = starttime;
|
||||
int ret = -1;
|
||||
bool printStart = true;
|
||||
|
||||
return -1;
|
||||
while(timenow-starttime < 30 && ret < 0)
|
||||
{
|
||||
ret = USBDevice_Init();
|
||||
if(ret < 0)
|
||||
{
|
||||
if(printStart)
|
||||
{
|
||||
printf("failed\n");
|
||||
printf("\tWaiting for slow HDD...\n");
|
||||
printStart = false;
|
||||
}
|
||||
printf("%i ", (int) (timenow-starttime+1));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void USBDevice_deInit()
|
||||
@ -81,7 +105,6 @@ void USBDevice_deInit()
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("USB:/");
|
||||
//only shutdown libogc usb and not the cios one
|
||||
__io_usbstorage.shutdown();
|
||||
__io_usbstorage2.shutdown();
|
||||
|
||||
fat_usb_mount = 0;
|
||||
@ -100,11 +123,7 @@ int WBFSDevice_Init(u32 sector)
|
||||
|
||||
fat_wbfs_mount = 1;
|
||||
fat_wbfs_sec = _FAT_startSector;
|
||||
if (sector && fat_wbfs_sec != sector)
|
||||
{
|
||||
// This is an error situation...actually, but is ignored in Config loader also
|
||||
// Should ask Oggzee about it...
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -168,13 +187,9 @@ s32 MountNTFS(u32 sector)
|
||||
if (wbfsDev == WBFS_DEVICE_USB)
|
||||
{
|
||||
ret = ntfsMount("NTFS", &__io_usbstorage2, sector, CACHE, SECTORS, NTFS_SHOW_HIDDEN_FILES | NTFS_RECOVER);
|
||||
if (!ret)
|
||||
{
|
||||
ret = ntfsMount("NTFS", &__io_usbstorage, sector, CACHE, SECTORS, NTFS_SHOW_HIDDEN_FILES | NTFS_RECOVER);
|
||||
if (!ret)
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else if (wbfsDev == WBFS_DEVICE_SDHC)
|
||||
{
|
||||
if (sdhc_mode_sd == 0)
|
||||
|
@ -16,6 +16,7 @@ extern int fat_wbfs_mount;
|
||||
extern sec_t fat_wbfs_sec;
|
||||
|
||||
int USBDevice_Init();
|
||||
int USBDevice_Init_Loop(); //! Wait's for the drive before mounting it, only used on bootup
|
||||
void USBDevice_deInit();
|
||||
int WBFSDevice_Init(u32 sector);
|
||||
void WBFSDevice_deInit();
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include <malloc.h>
|
||||
|
||||
/* init-globals */
|
||||
bool geckoinit = false;
|
||||
bool textVideoInit = false;
|
||||
static bool geckoinit = false;
|
||||
|
||||
#ifndef NO_DEBUG
|
||||
#include <stdarg.h>
|
||||
@ -37,6 +36,7 @@ bool InitGecko()
|
||||
{
|
||||
usb_flush(EXI_CHANNEL_1);
|
||||
CON_EnableGecko(1, true);
|
||||
geckoinit = true;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
|
@ -30,9 +30,9 @@
|
||||
#define _COMMON_H
|
||||
|
||||
#define BYTES_PER_READ 512
|
||||
#include <fat.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <fat.h>
|
||||
|
||||
// When compiling for NDS, make sure NDS is defined
|
||||
#ifndef NDS
|
||||
|
@ -439,16 +439,13 @@ bool _FAT_directory_getVolumeLabel (PARTITION* partition, char *label) {
|
||||
end = false;
|
||||
//this entry should be among the first 3 entries in the root directory table, if not, then system can have trouble displaying the right volume label
|
||||
while(!end) {
|
||||
if (_FAT_directory_incrementDirEntryPosition (partition, &entryEnd, false) == false) {
|
||||
end = true;
|
||||
}
|
||||
|
||||
if(!_FAT_cache_readPartialSector (partition->cache, entryData,
|
||||
_FAT_fat_clusterToSector(partition, entryEnd.cluster) + entryEnd.sector,
|
||||
entryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE))
|
||||
{ //error reading
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entryData[DIR_ENTRY_attributes] == ATTRIB_VOL && entryData[0] != DIR_ENTRY_FREE) {
|
||||
for (i = 0; i < 11; i++) {
|
||||
label[i] = entryData[DIR_ENTRY_name + i];
|
||||
@ -457,6 +454,10 @@ bool _FAT_directory_getVolumeLabel (PARTITION* partition, char *label) {
|
||||
} else if (entryData[0] == DIR_ENTRY_LAST) {
|
||||
end = true;
|
||||
}
|
||||
|
||||
if (_FAT_directory_incrementDirEntryPosition (partition, &entryEnd, false) == false) {
|
||||
end = true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ bool _FAT_cache_readSectors(CACHE *cache,sec_t sector,sec_t numSectors,void *buf
|
||||
sec_t sec;
|
||||
sec_t secs_to_read;
|
||||
CACHE_ENTRY *entry;
|
||||
uint8_t *dest = buffer;
|
||||
uint8_t *dest = (uint8_t *)buffer;
|
||||
|
||||
while(numSectors>0) {
|
||||
entry = _FAT_cache_getPage(cache,sector);
|
||||
@ -264,7 +264,7 @@ bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, sec_t
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifndef GEKKO
|
||||
static CACHE_ENTRY* _FAT_cache_findPage(CACHE *cache, sec_t sector, sec_t count) {
|
||||
|
||||
unsigned int i;
|
||||
@ -291,22 +291,27 @@ static CACHE_ENTRY* _FAT_cache_findPage(CACHE *cache, sec_t sector, sec_t count)
|
||||
|
||||
return entry;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, const void* buffer)
|
||||
{
|
||||
sec_t sec;
|
||||
sec_t secs_to_write;
|
||||
CACHE_ENTRY* entry;
|
||||
const uint8_t *src = buffer;
|
||||
const uint8_t *src = (const uint8_t *)buffer;
|
||||
|
||||
while(numSectors>0)
|
||||
{
|
||||
#ifdef GEKKO
|
||||
entry = _FAT_cache_getPage(cache,sector);
|
||||
if(entry==NULL) return false;
|
||||
#else
|
||||
entry = _FAT_cache_findPage(cache,sector,numSectors);
|
||||
|
||||
if(entry!=NULL) {
|
||||
if(entry==NULL)
|
||||
return _FAT_disc_writeSectors(cache->disc,sector,numSectors,src);
|
||||
|
||||
if ( entry->sector > sector) {
|
||||
|
||||
secs_to_write = entry->sector - sector;
|
||||
|
||||
_FAT_disc_writeSectors(cache->disc,sector,secs_to_write,src);
|
||||
@ -314,10 +319,9 @@ bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, cons
|
||||
sector += secs_to_write;
|
||||
numSectors -= secs_to_write;
|
||||
}
|
||||
|
||||
#endif
|
||||
sec = sector - entry->sector;
|
||||
secs_to_write = entry->count - sec;
|
||||
|
||||
if(secs_to_write>numSectors) secs_to_write = numSectors;
|
||||
|
||||
memcpy(entry->cache + (sec*BYTES_PER_READ),src,(secs_to_write*BYTES_PER_READ));
|
||||
@ -327,11 +331,6 @@ bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, cons
|
||||
numSectors -= secs_to_write;
|
||||
|
||||
entry->dirty = true;
|
||||
|
||||
} else {
|
||||
_FAT_disc_writeSectors(cache->disc,sector,numSectors,src);
|
||||
numSectors=0;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -654,10 +654,9 @@ ssize_t _FAT_write_r (struct _reent *r, int fd, const char *ptr, size_t len) {
|
||||
_FAT_lock(&partition->lock);
|
||||
|
||||
// Only write up to the maximum file size, taking into account wrap-around of ints
|
||||
if (remain + file->filesize > FILE_MAX_SIZE || len + file->filesize < file->filesize) {
|
||||
if (len + file->filesize > FILE_MAX_SIZE || len + file->filesize < file->filesize) {
|
||||
len = FILE_MAX_SIZE - file->filesize;
|
||||
}
|
||||
remain = len;
|
||||
|
||||
// Short circuit cases where len is 0 (or less)
|
||||
if (len <= 0) {
|
||||
@ -665,6 +664,8 @@ ssize_t _FAT_write_r (struct _reent *r, int fd, const char *ptr, size_t len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
remain = len;
|
||||
|
||||
// Get a new cluster for the start of the file if required
|
||||
if (file->startCluster == CLUSTER_FREE) {
|
||||
tempNextCluster = _FAT_fat_linkFreeCluster (partition, CLUSTER_FREE);
|
||||
@ -1130,6 +1131,7 @@ int _FAT_fsync_r (struct _reent *r, int fd) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
typedef int (*_frag_append_t)(void *ff, u32 offset, u32 sector, u32 count);
|
||||
|
||||
int _FAT_get_fragments (const char *path, _frag_append_t append_fragment, void *callback_data)
|
||||
|
@ -69,31 +69,31 @@ struct _FILE_STRUCT {
|
||||
|
||||
typedef struct _FILE_STRUCT FILE_STRUCT;
|
||||
|
||||
extern int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
|
||||
int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
|
||||
|
||||
extern int _FAT_close_r (struct _reent *r, int fd);
|
||||
int _FAT_close_r (struct _reent *r, int fd);
|
||||
|
||||
extern ssize_t _FAT_write_r (struct _reent *r,int fd, const char *ptr, size_t len);
|
||||
ssize_t _FAT_write_r (struct _reent *r,int fd, const char *ptr, size_t len);
|
||||
|
||||
extern ssize_t _FAT_read_r (struct _reent *r, int fd, char *ptr, size_t len);
|
||||
ssize_t _FAT_read_r (struct _reent *r, int fd, char *ptr, size_t len);
|
||||
|
||||
extern off_t _FAT_seek_r (struct _reent *r, int fd, off_t pos, int dir);
|
||||
off_t _FAT_seek_r (struct _reent *r, int fd, off_t pos, int dir);
|
||||
|
||||
extern int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st);
|
||||
int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st);
|
||||
|
||||
extern int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st);
|
||||
int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st);
|
||||
|
||||
extern int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink);
|
||||
int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink);
|
||||
|
||||
extern int _FAT_unlink_r (struct _reent *r, const char *name);
|
||||
int _FAT_unlink_r (struct _reent *r, const char *name);
|
||||
|
||||
extern int _FAT_chdir_r (struct _reent *r, const char *name);
|
||||
int _FAT_chdir_r (struct _reent *r, const char *name);
|
||||
|
||||
extern int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName);
|
||||
int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName);
|
||||
|
||||
extern int _FAT_ftruncate_r (struct _reent *r, int fd, off_t len);
|
||||
int _FAT_ftruncate_r (struct _reent *r, int fd, off_t len);
|
||||
|
||||
extern int _FAT_fsync_r (struct _reent *r, int fd);
|
||||
int _FAT_fsync_r (struct _reent *r, int fd);
|
||||
|
||||
/*
|
||||
Synchronizes the file data to disc.
|
||||
|
@ -246,7 +246,7 @@ uint32_t _FAT_fat_linkFreeCluster(PARTITION* partition, uint32_t cluster) {
|
||||
}
|
||||
partition->fat.firstFree = firstFree;
|
||||
|
||||
if ((cluster >= CLUSTER_FIRST) && (cluster < lastCluster))
|
||||
if ((cluster >= CLUSTER_FIRST) && (cluster <= lastCluster))
|
||||
{
|
||||
// Update the linked from FAT entry
|
||||
_FAT_fat_writeFatEntry (partition, cluster, firstFree);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <sys/iosupport.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "partition.h"
|
||||
@ -61,7 +62,9 @@ static const devoptab_t dotab_fat = {
|
||||
_FAT_statvfs_r,
|
||||
_FAT_ftruncate_r,
|
||||
_FAT_fsync_r,
|
||||
NULL /* Device data */
|
||||
NULL, /* Device data */
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
bool fatMount (const char* name, const DISC_INTERFACE* interface, sec_t startSector, uint32_t cacheSize, uint32_t SectorsPerPage) {
|
||||
@ -69,7 +72,7 @@ bool fatMount (const char* name, const DISC_INTERFACE* interface, sec_t startSec
|
||||
devoptab_t* devops;
|
||||
char* nameCopy;
|
||||
|
||||
if(!name || !interface)
|
||||
if(!name || strlen(name) > 8 || !interface)
|
||||
return false;
|
||||
|
||||
if(!interface->startup())
|
||||
@ -78,6 +81,11 @@ bool fatMount (const char* name, const DISC_INTERFACE* interface, sec_t startSec
|
||||
if(!interface->isInserted())
|
||||
return false;
|
||||
|
||||
char devname[10];
|
||||
sprintf(devname, "%s:", name);
|
||||
if(FindDevice(devname) >= 0)
|
||||
return true;
|
||||
|
||||
devops = _FAT_mem_allocate (sizeof(devoptab_t) + strlen(name) + 1);
|
||||
if (!devops) {
|
||||
return false;
|
||||
@ -220,11 +228,11 @@ void fatGetVolumeLabel (const char* name, char *label) {
|
||||
|
||||
for(i=0;buf[i]!='\0' && buf[i]!=':';i++);
|
||||
if (!devops || strncasecmp(buf,devops->name,i)) {
|
||||
free(buf);
|
||||
_FAT_mem_free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
_FAT_mem_free(buf);
|
||||
|
||||
// Perform a quick check to make sure we're dealing with a libfat controlled device
|
||||
if (devops->open_r != dotab_fat.open_r) {
|
||||
|
@ -31,8 +31,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef USE_LWP_LOCK
|
||||
|
||||
static inline void _FAT_lock_init(mutex_t *mutex)
|
||||
{
|
||||
LWP_MutexInit(mutex, false);
|
||||
@ -53,35 +51,6 @@ static inline void _FAT_unlock(mutex_t *mutex)
|
||||
LWP_MutexUnlock(*mutex);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// We still need a blank lock type
|
||||
#ifndef mutex_t
|
||||
typedef int mutex_t;
|
||||
#endif
|
||||
|
||||
static inline void _FAT_lock_init(mutex_t *mutex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void _FAT_lock_deinit(mutex_t *mutex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void _FAT_lock(mutex_t *mutex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void _FAT_unlock(mutex_t *mutex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // USE_LWP_LOCK
|
||||
|
||||
|
||||
#endif // _LOCK_H
|
||||
|
||||
|
@ -935,8 +935,6 @@ class GuiKeyboard: public GuiWindow
|
||||
GuiImageData * keyMediumOver;
|
||||
GuiImageData * keyLarge;
|
||||
GuiImageData * keyLargeOver;
|
||||
GuiSound * keySoundOver;
|
||||
GuiSound * keySoundClick;
|
||||
GuiTrigger * trigA;
|
||||
GuiTrigger * trigB;
|
||||
};
|
||||
|
@ -166,8 +166,8 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
//keyBack->SetImage(keyBackImg);
|
||||
//keyBack->SetImageOver(keyBackOverImg);
|
||||
keyBack->SetLabel(keyBackText);
|
||||
//keyBack->SetSoundOver(keySoundOver);
|
||||
//keyBack->SetSoundClick(keySoundClick);
|
||||
//keyBack->SetSoundOver(btnSoundOver);
|
||||
//keyBack->SetSoundClick(btnSoundClick);
|
||||
//keyBack->SetTrigger(trigA);
|
||||
keyBack->SetTrigger(trigB);
|
||||
if (mode > 1)
|
||||
@ -194,13 +194,13 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
{ 0, 0, 0, 0xff});
|
||||
}
|
||||
keyClear = new GuiButton(keyClearImg, keyClearOverImg, 0, 3, (10 * 42 + 40) + eurocheck, 4 * 42 + 120, trigA,
|
||||
keySoundOver, keySoundClick, 1);
|
||||
btnSoundOver, btnSoundClick, 1);
|
||||
//keyClear = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||
//keyClear->SetImage(keyClearImg);
|
||||
//keyClear->SetImageOver(keyClearOverImg);
|
||||
keyClear->SetLabel(keyClearText);
|
||||
//keyClear->SetSoundOver(keySoundOver);
|
||||
//keyClear->SetSoundClick(keySoundClick);
|
||||
//keyClear->SetSoundOver(btnSoundOver);
|
||||
//keyClear->SetSoundClick(btnSoundClick);
|
||||
//keyClear->SetTrigger(trigA);
|
||||
//keyClear->SetPosition((10*42+40)+eurocheck, 4*42+120);//(10*42+40, 0*42+80);
|
||||
//keyClear->SetEffectGrow();
|
||||
@ -210,14 +210,14 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
keyAltOverImg = new GuiImage(keyMediumOver);
|
||||
keyAltText = new GuiText("Alt Gr", 20, ( GXColor )
|
||||
{ 0, 0, 0, 0xff});
|
||||
keyAlt = new GuiButton(keyAltImg, keyAltOverImg, 0, 3, 84 + eurocheck, 4 * 42 + 120, trigA, keySoundOver,
|
||||
keySoundClick, 1);
|
||||
keyAlt = new GuiButton(keyAltImg, keyAltOverImg, 0, 3, 84 + eurocheck, 4 * 42 + 120, trigA, btnSoundOver,
|
||||
btnSoundClick, 1);
|
||||
//keyAlt = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||
//keyAlt->SetImage(keyAltImg);
|
||||
//keyAlt->SetImageOver(keyAltOverImg);
|
||||
keyAlt->SetLabel(keyAltText);
|
||||
//keyAlt->SetSoundOver(keySoundOver);
|
||||
//keyAlt->SetSoundClick(keySoundClick);
|
||||
//keyAlt->SetSoundOver(btnSoundOver);
|
||||
//keyAlt->SetSoundClick(btnSoundClick);
|
||||
//keyAlt->SetTrigger(trigA);
|
||||
//keyAlt->SetPosition(84+eurocheck, 4*42+120);//(10*42+40, 4*42+120);
|
||||
//keyAlt->SetEffectGrow();
|
||||
@ -231,13 +231,13 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
keyAlt2Text = new GuiText("Accent", 20, ( GXColor )
|
||||
{ 0, 0, 0, 0xff});
|
||||
keyAlt2 = new GuiButton(keyAlt2Img, keyAlt2OverImg, 0, 3, (8 * 42 + 40) + eurocheck, 4 * 42 + 120, trigA,
|
||||
keySoundOver, keySoundClick, 1);
|
||||
btnSoundOver, btnSoundClick, 1);
|
||||
//keyAlt2 = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||
//keyAlt2->SetImage(keyAlt2Img);
|
||||
//keyAlt2->SetImageOver(keyAlt2OverImg);
|
||||
keyAlt2->SetLabel(keyAlt2Text);
|
||||
//keyAlt2->SetSoundOver(keySoundOver);
|
||||
//keyAlt2->SetSoundClick(keySoundClick);
|
||||
//keyAlt2->SetSoundOver(btnSoundOver);
|
||||
//keyAlt2->SetSoundClick(btnSoundClick);
|
||||
//keyAlt2->SetTrigger(trigA);
|
||||
//keyAlt2->SetPosition((8*42+40)+eurocheck, 4*42+120);//(10*42+40, 4*42+120);
|
||||
//keyAlt2->SetEffectGrow();
|
||||
@ -250,14 +250,14 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
keyCapsOverImg = new GuiImage(keyMediumOver);
|
||||
keyCapsText = new GuiText("Caps", 20, ( GXColor )
|
||||
{ 0, 0, 0, 0xff});
|
||||
keyCaps = new GuiButton(keyCapsImg, keyCapsOverImg, 0, 3, 0 + eurocheck, 2 * 42 + 120, trigA, keySoundOver,
|
||||
keySoundClick, 1);
|
||||
keyCaps = new GuiButton(keyCapsImg, keyCapsOverImg, 0, 3, 0 + eurocheck, 2 * 42 + 120, trigA, btnSoundOver,
|
||||
btnSoundClick, 1);
|
||||
//keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||
//keyCaps->SetImage(keyCapsImg);
|
||||
//keyCaps->SetImageOver(keyCapsOverImg);
|
||||
keyCaps->SetLabel(keyCapsText);
|
||||
//keyCaps->SetSoundOver(keySoundOver);
|
||||
//keyCaps->SetSoundClick(keySoundClick);
|
||||
//keyCaps->SetSoundOver(btnSoundOver);
|
||||
//keyCaps->SetSoundClick(btnSoundClick);
|
||||
//keyCaps->SetTrigger(trigA);
|
||||
//keyCaps->SetPosition(0+eurocheck, 2*42+120);//(0, 2*42+80);
|
||||
//keyCaps->SetEffectGrow();
|
||||
@ -267,14 +267,14 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
keyShiftOverImg = new GuiImage(keyMediumOver);
|
||||
keyShiftText = new GuiText("Shift", 20, ( GXColor )
|
||||
{ 0, 0, 0, 0xff});
|
||||
keyShift = new GuiButton(keyShiftImg, keyShiftOverImg, 0, 3, 21 + eurocheck, 3 * 42 + 120, trigA, keySoundOver,
|
||||
keySoundClick, 1);
|
||||
keyShift = new GuiButton(keyShiftImg, keyShiftOverImg, 0, 3, 21 + eurocheck, 3 * 42 + 120, trigA, btnSoundOver,
|
||||
btnSoundClick, 1);
|
||||
//keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||
//keyShift->SetImage(keyShiftImg);
|
||||
//keyShift->SetImageOver(keyShiftOverImg);
|
||||
keyShift->SetLabel(keyShiftText);
|
||||
//keyShift->SetSoundOver(keySoundOver);
|
||||
//keyShift->SetSoundClick(keySoundClick);
|
||||
//keyShift->SetSoundOver(btnSoundOver);
|
||||
//keyShift->SetSoundClick(btnSoundClick);
|
||||
//keyShift->SetTrigger(trigA);
|
||||
//keyShift->SetPosition(21+eurocheck, 3*42+120);//(21, 3*42+80);
|
||||
//keyShift->SetEffectGrow();
|
||||
@ -282,13 +282,13 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
|
||||
keySpaceImg = new GuiImage(keyLarge);
|
||||
keySpaceOverImg = new GuiImage(keyLargeOver);
|
||||
keySpace = new GuiButton(keySpaceImg, keySpaceOverImg, 2, 3, 0 + eurocheck, 4 * 42 + 120, trigA, keySoundOver,
|
||||
keySoundClick, 1);
|
||||
keySpace = new GuiButton(keySpaceImg, keySpaceOverImg, 2, 3, 0 + eurocheck, 4 * 42 + 120, trigA, btnSoundOver,
|
||||
btnSoundClick, 1);
|
||||
//keySpace = new GuiButton(keyLarge->GetWidth(), keyLarge->GetHeight());
|
||||
//keySpace->SetImage(keySpaceImg);
|
||||
//keySpace->SetImageOver(keySpaceOverImg);
|
||||
//keySpace->SetSoundOver(keySoundOver);
|
||||
//keySpace->SetSoundClick(keySoundClick);
|
||||
//keySpace->SetSoundOver(btnSoundOver);
|
||||
//keySpace->SetSoundClick(btnSoundClick);
|
||||
//keySpace->SetTrigger(trigA);
|
||||
//keySpace->SetPosition(0+eurocheck, 4*42+120);//(0, 4*42+80);
|
||||
//keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
@ -310,12 +310,12 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
||||
keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
||||
keyTxt[i][j]->SetPosition(0, -10);
|
||||
keyBtn[i][j] = new GuiButton(keyImg[i][j], keyImgOver[i][j], 0, 3, (j * 42 + 21 * i + 40) + eurocheck,
|
||||
i * 42 + 120, trigA, keySoundOver, keySoundClick, 1);
|
||||
i * 42 + 120, trigA, btnSoundOver, btnSoundClick, 1);
|
||||
//keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight());
|
||||
//keyBtn[i][j]->SetImage(keyImg[i][j]);
|
||||
//keyBtn[i][j]->SetImageOver(keyImgOver[i][j]);
|
||||
//keyBtn[i][j]->SetSoundOver(keySoundOver);
|
||||
//keyBtn[i][j]->SetSoundClick(keySoundClick);
|
||||
//keyBtn[i][j]->SetSoundOver(btnSoundOver);
|
||||
//keyBtn[i][j]->SetSoundClick(btnSoundClick);
|
||||
//keyBtn[i][j]->SetTrigger(trigA);
|
||||
keyBtn[i][j]->SetLabel(keyTxt[i][j]);
|
||||
//keyBtn[i][j]->SetPosition((j*42+21*i+40)+eurocheck, i*42+120);//SetPosition(j*42+21*i+40, i*42+80);
|
||||
|
@ -6,7 +6,6 @@
|
||||
* libwiigui
|
||||
* Tantric 2009
|
||||
***************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -33,6 +32,9 @@
|
||||
#include "input.h"
|
||||
#include "filelist.h"
|
||||
#include "FileOperations/fileops.h"
|
||||
#include "settings/CGameSettings.h"
|
||||
#include "settings/CGameStatistics.h"
|
||||
#include "themes/CTheme.h"
|
||||
#include "main.h"
|
||||
#include "fatmounter.h"
|
||||
#include "sys.h"
|
||||
@ -48,44 +50,29 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern void __exception_setreload(int t);
|
||||
void __exception_setreload(int t);
|
||||
}
|
||||
|
||||
extern bool geckoinit;
|
||||
|
||||
PartList partitions;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
MEM2_init(48);
|
||||
setlocale(LC_ALL, "en.UTF-8");
|
||||
geckoinit = InitGecko();
|
||||
InitVideo();
|
||||
InitGecko();
|
||||
__exception_setreload(20);
|
||||
|
||||
printf("\tStarting up\n");
|
||||
NandTitles.Get();
|
||||
|
||||
//Let's use libogc sd/usb for config loading
|
||||
printf("\tInitialize sd card\n");
|
||||
SDCard_Init();
|
||||
printf("\tInitialize usb device\n");
|
||||
USBDevice_Init();
|
||||
|
||||
gettextCleanUp();
|
||||
printf("\tLoading configuration...");
|
||||
Settings.Load();
|
||||
VIDEO_SetWidescreen(Settings.widescreen);
|
||||
printf("done\n");
|
||||
|
||||
// Let's load the cIOS now
|
||||
// Let's try loading some cIOS
|
||||
if (IosLoader::LoadAppCios() < 0)
|
||||
{
|
||||
printf("\n\tWARNING!\n");
|
||||
printf("\tUSB Loader GX needs unstubbed cIOS 222 v4+ or 249 v9+\n\n");
|
||||
|
||||
printf(
|
||||
"\tWe cannot determine the versions on your system,\n\tsince you have no patched ios 36 or 236 installed.\n");
|
||||
printf("\tWe cannot determine the versions on your system,\n\tsince you have no patched ios 36 or 236 installed.\n");
|
||||
printf("\tTherefor, if loading of USB Loader GX fails, you\n\tprobably have installed the 4.2 update,\n");
|
||||
printf("\tand you should go figure out how to get some cios action going on\n\tin your Wii.\n");
|
||||
|
||||
@ -93,8 +80,36 @@ int main(int argc, char *argv[])
|
||||
sleep(10);
|
||||
Sys_BackToLoader();
|
||||
}
|
||||
|
||||
//Let's use libogc sd/usb for config loading
|
||||
printf("\tInitialize sd card...%s\n", SDCard_Init() < 0 ? "failed" : "done");
|
||||
printf("\tInitialize usb device...%s\n", USBDevice_Init_Loop() < 0 ? "failed" : "done");
|
||||
|
||||
//Load configurations
|
||||
printf("\tLoading config...%s\n", Settings.Load() ? "done" : "failed");
|
||||
printf("\tLoading language...%s\n", Settings.LoadLanguage(Settings.language_path, CONSOLE_DEFAULT) ? "done" : "failed");
|
||||
printf("\tLoading game settings...%s\n", GameSettings.Load(Settings.ConfigPath) ? "done" : "failed");
|
||||
printf("\tLoading game statistics...%s\n", GameStatistics.Load(Settings.ConfigPath) ? "done" : "failed");
|
||||
printf("\tLoading theme...%s\n", Theme.Load(Settings.theme_path) ? "done" : "failed (using default)");
|
||||
printf("\tLoading font system...%s\n", SetupDefaultFont(Settings.theme_path) ? "done" : "failed (using default)");
|
||||
|
||||
VIDEO_SetWidescreen(Settings.widescreen);
|
||||
|
||||
if(Settings.cios != IOS_GetVersion())
|
||||
{
|
||||
// Unmount fat before reloading IOS.
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
|
||||
// Loading now the cios setup in the settings
|
||||
IosLoader::LoadAppCios();
|
||||
printf("\tLoaded cIOS = %u (Rev %u)\n", IOS_GetVersion(), IOS_GetRevision());
|
||||
|
||||
// Remount devices after reloading IOS.
|
||||
SDCard_Init();
|
||||
USBDevice_Init_Loop();
|
||||
}
|
||||
|
||||
//if a ID was passed via args copy it and try to boot it after the partition is mounted
|
||||
//its not really a headless mode. more like hairless.
|
||||
if (argc > 1 && argv[1])
|
||||
@ -108,11 +123,6 @@ int main(int argc, char *argv[])
|
||||
SetupPads();
|
||||
InitAudio();
|
||||
|
||||
char *fontPath = NULL;
|
||||
asprintf(&fontPath, "%sfont.ttf", Settings.theme_path);
|
||||
SetupDefaultFont(fontPath);
|
||||
free(fontPath);
|
||||
|
||||
MainMenu(MENU_DISCLIST);
|
||||
return 0;
|
||||
}
|
||||
|
@ -285,22 +285,16 @@ int MainMenu(int menu)
|
||||
|
||||
ResumeGui();
|
||||
|
||||
gprintf("Vor bgm\n");
|
||||
bgMusic = new GuiBGM(bg_music_ogg, bg_music_ogg_size, Settings.volume);
|
||||
gprintf("new bgm\n");
|
||||
bgMusic->SetLoop(Settings.musicloopmode); //loop music
|
||||
gprintf("SetLoop\n");
|
||||
bgMusic->Load(Settings.ogg_path);
|
||||
gprintf("Load\n");
|
||||
bgMusic->Play();
|
||||
gprintf("Nach bgm\n");
|
||||
|
||||
MountGamePartition();
|
||||
|
||||
while (currentMenu != MENU_EXIT)
|
||||
{
|
||||
bgMusic->SetVolume(Settings.volume);
|
||||
// gprintf("Current menu: %d\n", currentMenu);
|
||||
|
||||
switch (currentMenu)
|
||||
{
|
||||
|
@ -1724,7 +1724,7 @@ int GameWindowPrompt()
|
||||
***************************************************************************/
|
||||
int DiscWait(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, int IsDeviceWait)
|
||||
{
|
||||
int i = 30, ret = 0;
|
||||
int ret = 0;
|
||||
u32 cover = 0;
|
||||
|
||||
GuiWindow promptWindow(472, 320);
|
||||
@ -1823,18 +1823,20 @@ int DiscWait(const char *title, const char *msg, const char *btn1Label, const ch
|
||||
|
||||
if (IsDeviceWait)
|
||||
{
|
||||
while (i >= 0)
|
||||
time_t starttime = time(0);
|
||||
time_t timenow = starttime;
|
||||
do
|
||||
{
|
||||
VIDEO_WaitVSync();
|
||||
timerTxt.SetTextf("%u %s", i, tr( "seconds left" ));
|
||||
USBDevice_deInit();
|
||||
USBDevice_Init();
|
||||
gprintf("%i\n", (int) (timenow-starttime));
|
||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||
if (ret >= 0) break;
|
||||
|
||||
i--;
|
||||
sleep(1);
|
||||
timerTxt.SetTextf("%i %s", (int) (30-(timenow-starttime)), tr( "seconds left" ));
|
||||
USBDevice_deInit();
|
||||
USBDevice_Init();
|
||||
timenow = time(0);
|
||||
}
|
||||
while (timenow-starttime < 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ CSettings::CSettings()
|
||||
{
|
||||
CONF_Init();
|
||||
strcpy(BootDevice, "SD:");
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
|
||||
this->SetDefault();
|
||||
}
|
||||
|
||||
@ -48,20 +49,19 @@ CSettings::~CSettings()
|
||||
|
||||
void CSettings::SetDefault()
|
||||
{
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice);
|
||||
snprintf(covers_path, sizeof(covers_path), "%s/images/", BootDevice);
|
||||
snprintf(covers2d_path, sizeof(covers2d_path), "%s/images/2D/", BootDevice);
|
||||
snprintf(disc_path, sizeof(disc_path), "%s/images/disc/", BootDevice);
|
||||
snprintf(titlestxt_path, sizeof(titlestxt_path), "%s/config/", BootDevice);
|
||||
snprintf(languagefiles_path, sizeof(languagefiles_path), "%s/config/language/", BootDevice);
|
||||
snprintf(covers_path, sizeof(covers_path), "%simages/", ConfigPath);
|
||||
snprintf(covers2d_path, sizeof(covers2d_path), "%simages/2D/", ConfigPath);
|
||||
snprintf(disc_path, sizeof(disc_path), "%simages/disc/", ConfigPath);
|
||||
snprintf(titlestxt_path, sizeof(titlestxt_path), "%s", ConfigPath);
|
||||
snprintf(languagefiles_path, sizeof(languagefiles_path), "%slanguage/", ConfigPath);
|
||||
snprintf(update_path, sizeof(update_path), "%s/apps/usbloader_gx/", BootDevice);
|
||||
snprintf(theme_downloadpath, sizeof(theme_downloadpath), "%s/config/themes/", BootDevice);
|
||||
snprintf(theme_downloadpath, sizeof(theme_downloadpath), "%sthemes/", ConfigPath);
|
||||
snprintf(homebrewapps_path, sizeof(homebrewapps_path), "%s/apps/", BootDevice);
|
||||
snprintf(Cheatcodespath, sizeof(Cheatcodespath), "%s/codes/", BootDevice);
|
||||
snprintf(TxtCheatcodespath, sizeof(TxtCheatcodespath), "%s/txtcodes/", BootDevice);
|
||||
snprintf(BcaCodepath, sizeof(BcaCodepath), "%s/bca/", BootDevice);
|
||||
snprintf(WipCodepath, sizeof(WipCodepath), "%s/wip/", BootDevice);
|
||||
snprintf(theme_path, sizeof(theme_path), "%s/theme/", BootDevice);
|
||||
snprintf(Cheatcodespath, sizeof(Cheatcodespath), "%scodes/", ConfigPath);
|
||||
snprintf(TxtCheatcodespath, sizeof(TxtCheatcodespath), "%stxtcodes/", ConfigPath);
|
||||
snprintf(BcaCodepath, sizeof(BcaCodepath), "%sbca/", ConfigPath);
|
||||
snprintf(WipCodepath, sizeof(WipCodepath), "%swip/", ConfigPath);
|
||||
snprintf(theme_path, sizeof(theme_path), "%stheme/", ConfigPath);
|
||||
snprintf(dolpath, sizeof(dolpath), "%s/", BootDevice);
|
||||
strcpy(language_path, "");
|
||||
strcpy(ogg_path, "");
|
||||
@ -132,16 +132,10 @@ bool CSettings::Load()
|
||||
FindConfig();
|
||||
//! Reset default path variables to the right device
|
||||
SetDefault();
|
||||
//! Set up the default path in the classes
|
||||
//! in case the config file does not exist yet
|
||||
char tempPath[100];
|
||||
snprintf(tempPath, sizeof(tempPath), "%s/config/", BootDevice);
|
||||
GameStatistics.Load(tempPath);
|
||||
GameSettings.Load(tempPath);
|
||||
|
||||
char line[1024];
|
||||
char filepath[300];
|
||||
snprintf(filepath, sizeof(filepath), "%s", ConfigPath);
|
||||
snprintf(filepath, sizeof(filepath), "%sGXGlobal.cfg", ConfigPath);
|
||||
|
||||
file = fopen(filepath, "r");
|
||||
if (!file) return false;
|
||||
@ -154,17 +148,6 @@ bool CSettings::Load()
|
||||
}
|
||||
fclose(file);
|
||||
|
||||
//!The following needs to be moved later
|
||||
char GameSetPath[200];
|
||||
snprintf(GameSetPath, sizeof(GameSetPath), ConfigPath);
|
||||
char * ptr = strrchr(GameSetPath, '/');
|
||||
if(ptr) ptr[1] = 0;
|
||||
|
||||
GameStatistics.Load(GameSetPath);
|
||||
GameSettings.Load(GameSetPath);
|
||||
Theme.Load(theme_path);
|
||||
this->LoadLanguage(this->language_path);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@ -182,19 +165,12 @@ bool CSettings::Save()
|
||||
{
|
||||
if (!FindConfig()) return false;
|
||||
|
||||
char filedest[100];
|
||||
snprintf(filedest, sizeof(filedest), "%s", ConfigPath);
|
||||
char filedest[300];
|
||||
snprintf(filedest, sizeof(filedest), "%sGXGlobal.cfg", ConfigPath);
|
||||
|
||||
char * tmppath = strrchr(filedest, '/');
|
||||
if (tmppath)
|
||||
{
|
||||
tmppath++;
|
||||
tmppath[0] = '\0';
|
||||
}
|
||||
if(!CreateSubfolder(ConfigPath)) return false;
|
||||
|
||||
if(!CreateSubfolder(filedest)) return false;
|
||||
|
||||
file = fopen(ConfigPath, "w");
|
||||
file = fopen(filedest, "w");
|
||||
if (!file) return false;
|
||||
|
||||
fprintf(file, "# USB Loader global settings file\n");
|
||||
@ -572,17 +548,20 @@ bool CSettings::SetSetting(char *name, char *value)
|
||||
bool CSettings::FindConfig()
|
||||
{
|
||||
bool found = false;
|
||||
char CheckPath[300];
|
||||
strcpy(BootDevice, "SD:");
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (i == 1) strcpy(BootDevice, "USB:");
|
||||
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice);
|
||||
if ((found = CheckFile(ConfigPath))) break;
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
|
||||
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
|
||||
if ((found = CheckFile(CheckPath))) break;
|
||||
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice);
|
||||
if ((found = CheckFile(ConfigPath))) break;
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
|
||||
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
|
||||
if ((found = CheckFile(CheckPath))) break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
@ -596,9 +575,8 @@ bool CSettings::FindConfig()
|
||||
if (!found)
|
||||
{
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
|
||||
CreateSubfolder(ConfigPath);
|
||||
strcat(ConfigPath, "GXGlobal.cfg");
|
||||
testFp = fopen(ConfigPath, "wb");
|
||||
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
|
||||
testFp = fopen(CheckPath, "wb");
|
||||
found = (testFp != NULL);
|
||||
fclose(testFp);
|
||||
}
|
||||
@ -606,8 +584,8 @@ bool CSettings::FindConfig()
|
||||
{
|
||||
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
|
||||
CreateSubfolder(ConfigPath);
|
||||
strcat(ConfigPath, "GXGlobal.cfg");
|
||||
testFp = fopen(ConfigPath, "wb");
|
||||
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
|
||||
testFp = fopen(CheckPath, "wb");
|
||||
found = (testFp != NULL);
|
||||
fclose(testFp);
|
||||
}
|
||||
@ -716,7 +694,7 @@ bool CSettings::LoadLanguage(const char *path, int language)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if (language >= 0 || !path)
|
||||
if (language >= 0 || !path || strlen(path) == 0)
|
||||
{
|
||||
if (language < 0) return false;
|
||||
|
||||
@ -785,7 +763,11 @@ bool CSettings::LoadLanguage(const char *path, int language)
|
||||
}
|
||||
|
||||
ret = gettextLoadLanguage(filepath);
|
||||
if (ret) strncpy(language_path, filepath, sizeof(language_path));
|
||||
if (ret)
|
||||
{
|
||||
strncpy(language_path, filepath, sizeof(language_path));
|
||||
strcpy(db_language, GetLangCode(language_path));
|
||||
}
|
||||
}
|
||||
else if (strlen(path) < 3)
|
||||
{
|
||||
@ -799,7 +781,6 @@ bool CSettings::LoadLanguage(const char *path, int language)
|
||||
strncpy(language_path, path, sizeof(language_path));
|
||||
strcpy(db_language, GetLangCode(language_path));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -46,6 +46,7 @@ CustomPathsSM::CustomPathsSM()
|
||||
Options->SetName(Idx++, tr("Theme Download Path"));
|
||||
Options->SetName(Idx++, tr("BCA Codes Path"));
|
||||
Options->SetName(Idx++, tr("WIP Patches Path"));
|
||||
Options->SetName(Idx++, tr("Languagefiles Path"));
|
||||
|
||||
SetOptionValues();
|
||||
}
|
||||
@ -92,6 +93,9 @@ void CustomPathsSM::SetOptionValues()
|
||||
|
||||
//! Settings: WIP Patches Path
|
||||
Options->SetValue(Idx++, Settings.WipCodepath);
|
||||
|
||||
//! Settings: Languagefiles Path
|
||||
Options->SetValue(Idx++, Settings.languagefiles_path);
|
||||
}
|
||||
|
||||
int CustomPathsSM::GetMenuInternal()
|
||||
@ -215,6 +219,13 @@ int CustomPathsSM::GetMenuInternal()
|
||||
ChangePath(Settings.WipCodepath, sizeof(Settings.WipCodepath));
|
||||
}
|
||||
|
||||
//! Settings: Languagefiles Path
|
||||
else if (ret == ++Idx)
|
||||
{
|
||||
titleTxt->SetText(tr( "Languagefiles Path" ));
|
||||
ChangePath(Settings.languagefiles_path, sizeof(Settings.languagefiles_path));
|
||||
}
|
||||
|
||||
//! Global set back of the titleTxt after a change
|
||||
titleTxt->SetText(tr( "Custom Paths" ));
|
||||
SetOptionValues();
|
||||
|
@ -44,17 +44,20 @@ bool IosLoader::IsWaninkokoIOS(s32 ios)
|
||||
*/
|
||||
s32 IosLoader::LoadAppCios()
|
||||
{
|
||||
u32 activeCios = IOS_GetVersion();
|
||||
s32 ret = -1;
|
||||
|
||||
// We have what we need
|
||||
if((int) activeCios == Settings.cios)
|
||||
return 0;
|
||||
|
||||
// Unmount fat before reloading IOS.
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
__io_usbstorage.shutdown(); // libogc usb
|
||||
__io_usbstorage2.shutdown(); // cios usb
|
||||
USB_Deinitialize(); // main usb handle
|
||||
__io_usbstorage.shutdown();
|
||||
USB_Deinitialize();
|
||||
|
||||
u32 ciosLoadPriority[] = { 250, 249, 222, Settings.cios }; // Descending.
|
||||
u32 activeCios = IOS_GetVersion();
|
||||
u32 ciosLoadPriority[] = { 250, 222, 249, Settings.cios }; // Descending.
|
||||
|
||||
|
||||
for (u8 i = (sizeof(ciosLoadPriority)/sizeof(ciosLoadPriority[0]))-1; i >= 0; i--)
|
||||
@ -75,11 +78,6 @@ s32 IosLoader::LoadAppCios()
|
||||
}
|
||||
}
|
||||
|
||||
// Remount devices after reloading IOS.
|
||||
SDCard_Init();
|
||||
USBDevice_Init();
|
||||
Disc_Init();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user