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

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r911</version>
<release_date>201002141632</release_date>
<version>1.0 r912</version>
<release_date>201002142328</release_date>
<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.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

@ -2,11 +2,11 @@
# to use this file rename Make.config.default to 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
# 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
#
CFLAGS += -DNO_DEBUG
CFLAGS += -DNO_DEBUG DDEBUG_WBFS

@ -22,6 +22,8 @@
#define MOUNT_SD 1
#define MOUNT_SDHC 2
#define DEBUG_FAT
/* Disc interfaces */
extern const DISC_INTERFACE __io_sdhc;
@ -43,8 +45,9 @@ int fs_ntfs_mount = 0;
sec_t fs_ntfs_sec = 0;
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!
fatUnmount("USB:/");
//right now mounts first FAT-partition
@ -53,19 +56,25 @@ int USBDevice_Init() {
if (!fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) {
//try now mount with libogc
if (!fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS)) {
gprintf(":-1");
return -1;
#ifdef DEBUG_FAT
gprintf(":-1");
#endif
return -1;
}
}
fat_usb_mount = 1;
fat_usb_sec = _FAT_startSector;
#ifdef DEBUG_FAT
gprintf(":0");
#endif
return 0;
}
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!
fatUnmount("USB:/");
@ -111,29 +120,38 @@ int isInserted(const char *path) {
}
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!
fatUnmount("SD:/");
//right now mounts first FAT-partition
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS)) {
fat_sd_mount = MOUNT_SD;
fat_sd_sec = _FAT_startSector;
#ifdef DEBUG_FAT
gprintf(":1");
#endif
return 1;
}
else if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE)) {
fat_sd_mount = MOUNT_SDHC;
fat_sd_sec = _FAT_startSector;
#ifdef DEBUG_FAT
gprintf(":1");
#endif
return 1;
}
#ifdef DEBUG_FAT
gprintf(":-1");
return -1;
#endif
return -1;
}
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!
fatUnmount("SD:/");

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

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

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

@ -11,6 +11,7 @@
#include "gecko.h"
Wbfs *current = NULL;
#define DEBUG_WBFS
/* WBFS 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) {
current = new Wbfs_Fat(wbfsDev, part_lba, part_size);
strcpy(wbfs_fs_drive, "USB:");
gprintf("Created WBFS_Fat instance at lba: %d of size %d\n", part_lba, part_size);
} else if (part_fs == PART_FS_NTFS) {
#ifdef DEBUG_WBFS
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);
strcpy(wbfs_fs_drive, "NTFS:");
gprintf("Created WBFS_Ntfs instance at lba: %d of size %d\n", part_lba, part_size);
} else {
#ifdef DEBUG_WBFS
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);
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())
{
delete current;

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