tidy up some debug stuff.

This commit is contained in:
giantpune 2010-02-15 02:45:18 +00:00
parent e8f5ab07bd
commit b193141eb6
8 changed files with 80 additions and 37 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name> USB Loader GX</name> <name> USB Loader GX</name>
<coder>USB Loader GX Team</coder> <coder>USB Loader GX Team</coder>
<version>1.0 r911</version> <version>1.0 r912</version>
<release_date>201002141632</release_date> <release_date>201002142328</release_date>
<short_description>Loads games from USB-devices</short_description> <short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. <long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

@ -2,11 +2,11 @@
# to use this file rename Make.config.default to Make.config # to use this file rename Make.config.default to Make.config
# or create a new Make.config # or create a new Make.config
# #
# yoy can here add defines # you can here add defines
# #
# in example i have included a switch to diseble # in example i have included a switch to diseble
# the gecko-debug stuff. so also in source gecko.c+gecko.h # the gecko-debug stuff. so also in source gecko.c+gecko.h
# #
# NOTE when add, remove or change a define here then a "make clean" is needed # NOTE when add, remove or change a define here then a "make clean" is needed
# #
CFLAGS += -DNO_DEBUG CFLAGS += -DNO_DEBUG DDEBUG_WBFS

View File

@ -22,6 +22,8 @@
#define MOUNT_SD 1 #define MOUNT_SD 1
#define MOUNT_SDHC 2 #define MOUNT_SDHC 2
#define DEBUG_FAT
/* Disc interfaces */ /* Disc interfaces */
extern const DISC_INTERFACE __io_sdhc; extern const DISC_INTERFACE __io_sdhc;
@ -43,8 +45,9 @@ int fs_ntfs_mount = 0;
sec_t fs_ntfs_sec = 0; sec_t fs_ntfs_sec = 0;
int USBDevice_Init() { int USBDevice_Init() {
gprintf("\nUSBDevice_Init()"); #ifdef DEBUG_FAT
gprintf("\nUSBDevice_Init()");
#endif
//closing all open Files write back the cache and then shutdown em! //closing all open Files write back the cache and then shutdown em!
fatUnmount("USB:/"); fatUnmount("USB:/");
//right now mounts first FAT-partition //right now mounts first FAT-partition
@ -53,19 +56,25 @@ int USBDevice_Init() {
if (!fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) { if (!fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) {
//try now mount with libogc //try now mount with libogc
if (!fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS)) { if (!fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS)) {
gprintf(":-1"); #ifdef DEBUG_FAT
return -1; gprintf(":-1");
#endif
return -1;
} }
} }
fat_usb_mount = 1; fat_usb_mount = 1;
fat_usb_sec = _FAT_startSector; fat_usb_sec = _FAT_startSector;
#ifdef DEBUG_FAT
gprintf(":0"); gprintf(":0");
#endif
return 0; return 0;
} }
void USBDevice_deInit() { void USBDevice_deInit() {
gprintf("\nUSBDevice_deInit()"); #ifdef DEBUG_FAT
gprintf("\nUSBDevice_deInit()");
#endif
//closing all open Files write back the cache and then shutdown em! //closing all open Files write back the cache and then shutdown em!
fatUnmount("USB:/"); fatUnmount("USB:/");
@ -111,29 +120,38 @@ int isInserted(const char *path) {
} }
int SDCard_Init() { int SDCard_Init() {
gprintf("\nSDCard_Init()"); #ifdef DEBUG_FAT
gprintf("\nSDCard_Init()");
#endif
//closing all open Files write back the cache and then shutdown em! //closing all open Files write back the cache and then shutdown em!
fatUnmount("SD:/"); fatUnmount("SD:/");
//right now mounts first FAT-partition //right now mounts first FAT-partition
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS)) { if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS)) {
fat_sd_mount = MOUNT_SD; fat_sd_mount = MOUNT_SD;
fat_sd_sec = _FAT_startSector; fat_sd_sec = _FAT_startSector;
#ifdef DEBUG_FAT
gprintf(":1"); gprintf(":1");
#endif
return 1; return 1;
} }
else if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE)) { else if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE)) {
fat_sd_mount = MOUNT_SDHC; fat_sd_mount = MOUNT_SDHC;
fat_sd_sec = _FAT_startSector; fat_sd_sec = _FAT_startSector;
#ifdef DEBUG_FAT
gprintf(":1"); gprintf(":1");
#endif
return 1; return 1;
} }
#ifdef DEBUG_FAT
gprintf(":-1"); gprintf(":-1");
return -1; #endif
return -1;
} }
void SDCard_deInit() { void SDCard_deInit() {
gprintf("\nSDCard_deInit()"); #ifdef DEBUG_FAT
gprintf("\nSDCard_deInit()");
#endif
//closing all open Files write back the cache and then shutdown em! //closing all open Files write back the cache and then shutdown em!
fatUnmount("SD:/"); fatUnmount("SD:/");

View File

@ -290,7 +290,7 @@ int MainMenu(int menu) {
while (currentMenu != MENU_EXIT) { while (currentMenu != MENU_EXIT) {
bgMusic->SetVolume(Settings.volume); bgMusic->SetVolume(Settings.volume);
gprintf("Current menu: %d\n", currentMenu); // gprintf("Current menu: %d\n", currentMenu);
switch (currentMenu) { switch (currentMenu) {
case MENU_CHECK: case MENU_CHECK:
@ -352,7 +352,7 @@ int MainMenu(int menu) {
if(dbvideo) if(dbvideo)
{ {
InitVideodebug (); InitVideodebug ();
printf("\n\n\n\n\n"); //printf("\n\n\n\n\n");
} }
if (mountMethod==3) if (mountMethod==3)
{ {

View File

@ -136,21 +136,30 @@ if(sd_ok && !external_ehcmodule)
if(!external_ehcmodule) if(!external_ehcmodule)
{ {
#ifdef DEBUG_MLOAD
gprintf("before mload_init\n"); gprintf("before mload_init\n");
#endif
if(mload_init()<0) return -1; if(mload_init()<0) return -1;
gprintf("after mload_init\n"); #ifdef DEBUG_MLOAD
gprintf("after mload_init\n");
#endif
if (IOS_GetRevision() == 4) { if (IOS_GetRevision() == 4) {
gprintf("Loading ehcmodule v4\n"); #ifdef DEBUG_MLOAD
mload_elf((void *) ehcmodule_frag_v4_bin, &my_data_elf); gprintf("Loading ehcmodule v4\n");
#endif
mload_elf((void *) ehcmodule_frag_v4_bin, &my_data_elf);
} else if (IOS_GetRevision() == 65535) { } else if (IOS_GetRevision() == 65535) {
gprintf("Loading ehcmodule v5\n"); #ifdef DEBUG_MLOAD
mload_elf((void *) ehcmodule_frag_v5_bin, &my_data_elf); gprintf("Loading ehcmodule v5\n");
#endif
mload_elf((void *) ehcmodule_frag_v5_bin, &my_data_elf);
} else { } else {
return -2; return -2;
} }
// mload_elf((void *) ehcmodule, &my_data_elf); // mload_elf((void *) ehcmodule, &my_data_elf);
gprintf("before mload_run_thread\n"); #ifdef DEBUG_MLOAD
gprintf("before mload_run_thread\n");
#endif
my_thread_id= mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, my_data_elf.prio); my_thread_id= mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, my_data_elf.prio);
if(my_thread_id<0) return -1; if(my_thread_id<0) return -1;
//if(mload_module(ehcmodule, size_ehcmodule)<0) return -1; //if(mload_module(ehcmodule, size_ehcmodule)<0) return -1;

View File

@ -22,6 +22,7 @@
#include "listfiles.h" #include "listfiles.h"
#define typei 0x00010001 #define typei 0x00010001
#define DEBUG_GAMELIST
struct discHdr * gameList=NULL; struct discHdr * gameList=NULL;
s32 gameSelected=0, gameStart=0; s32 gameSelected=0, gameStart=0;
@ -131,8 +132,9 @@ int GetFullHeaders(struct discHdr **headers, u32 *count)
{ {
if (fullGameList == NULL || fullGameCnt == -1) if (fullGameList == NULL || fullGameCnt == -1)
{ {
gprintf("Retrieving gamelist from WBFS\n"); #ifdef DEBUG_GAMELIST
gprintf("\nRetrieving gamelist from WBFS");
#endif
// Retrieve all stuff from WBFS // Retrieve all stuff from WBFS
u32 cnt; u32 cnt;
@ -161,9 +163,11 @@ int GetFullHeaders(struct discHdr **headers, u32 *count)
fullGameList = buffer; fullGameList = buffer;
fullGameCnt = cnt; fullGameCnt = cnt;
} }
else else{
gprintf("Retrieving gamelist from cache\n"); #ifdef DEBUG_GAMELIST
gprintf("\n\tRetrieving gamelist from cache");
#endif
}
*count = fullGameCnt; *count = fullGameCnt;
if (headers != NULL) if (headers != NULL)
{ {
@ -555,9 +559,9 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
} }
if (!output) if (!output)
return -1; return -1;
#ifdef DEBUG_GAMELIST
gprintf("After retrieval, gamecount: %d\n", cnt); gprintf("\n\tAfter retrieval, gamecount: %d", cnt);
#endif
if (Settings.sort==pcount) { if (Settings.sort==pcount) {
qsort(output, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount); qsort(output, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
} else if (Settings.fave) { } else if (Settings.fave) {

View File

@ -11,6 +11,7 @@
#include "gecko.h" #include "gecko.h"
Wbfs *current = NULL; Wbfs *current = NULL;
#define DEBUG_WBFS
/* WBFS device */ /* WBFS device */
s32 wbfsDev = WBFS_MIN_DEVICE; s32 wbfsDev = WBFS_MIN_DEVICE;
@ -60,15 +61,21 @@ s32 WBFS_OpenPart(u32 part_fs, u32 part_idx, u32 part_lba, u32 part_size, char *
if (part_fs == PART_FS_FAT) { if (part_fs == PART_FS_FAT) {
current = new Wbfs_Fat(wbfsDev, part_lba, part_size); current = new Wbfs_Fat(wbfsDev, part_lba, part_size);
strcpy(wbfs_fs_drive, "USB:"); strcpy(wbfs_fs_drive, "USB:");
gprintf("Created WBFS_Fat instance at lba: %d of size %d\n", part_lba, part_size); #ifdef DEBUG_WBFS
} else if (part_fs == PART_FS_NTFS) { gprintf("\n\tCreated WBFS_Fat instance at lba: %d of size %d", part_lba, part_size);
#endif
} else if (part_fs == PART_FS_NTFS) {
current = new Wbfs_Ntfs(wbfsDev, part_lba, part_size); current = new Wbfs_Ntfs(wbfsDev, part_lba, part_size);
strcpy(wbfs_fs_drive, "NTFS:"); strcpy(wbfs_fs_drive, "NTFS:");
gprintf("Created WBFS_Ntfs instance at lba: %d of size %d\n", part_lba, part_size); #ifdef DEBUG_WBFS
} else { gprintf("\n\tCreated WBFS_Ntfs instance at lba: %d of size %d", part_lba, part_size);
#endif
} else {
current = new Wbfs_Wbfs(wbfsDev, part_lba, part_size); current = new Wbfs_Wbfs(wbfsDev, part_lba, part_size);
gprintf("Created WBFS_Wbfs instance at lba: %d of size %d\n", part_lba, part_size); #ifdef DEBUG_WBFS
} gprintf("\n\tCreated WBFS_Wbfs instance at lba: %d of size %d", part_lba, part_size);
#endif
}
if (current->Open()) if (current->Open())
{ {
delete current; delete current;

View File

@ -123,12 +123,17 @@ s32 Wbfs_Fat::GetHeaders(struct discHdr *outbuf, u32 cnt, u32 len)
if (len > sizeof(struct discHdr)) { if (len > sizeof(struct discHdr)) {
len = sizeof(struct discHdr); len = sizeof(struct discHdr);
} }
gprintf("GetHeaders\n"); #ifdef DEBUG_WBFS
gprintf("\n\tGetHeaders");
#endif
for (i=0; i<cnt && i<fat_hdr_count; i++) { for (i=0; i<cnt && i<fat_hdr_count; i++) {
memcpy(&outbuf[i], &fat_hdr_list[i], len); memcpy(&outbuf[i], &fat_hdr_list[i], len);
} }
SAFE_FREE(fat_hdr_list); SAFE_FREE(fat_hdr_list);
fat_hdr_count = 0; fat_hdr_count = 0;
#ifdef DEBUG_WBFS
gprintf("...ok");
#endif
return 0; return 0;
} }