From b193141eb615b50b35ff22bc15f847eb2dc77b50 Mon Sep 17 00:00:00 2001 From: giantpune Date: Mon, 15 Feb 2010 02:45:18 +0000 Subject: [PATCH] tidy up some debug stuff. --- HBC/META.XML | 4 ++-- Make.config.default | 4 ++-- source/fatmounter.c | 36 ++++++++++++++++++++++-------- source/menu.cpp | 4 ++-- source/mload/mload_modules.c | 23 +++++++++++++------ source/usbloader/getentries.cpp | 20 ++++++++++------- source/usbloader/wbfs.cpp | 19 +++++++++++----- source/usbloader/wbfs/wbfs_fat.cpp | 7 +++++- 8 files changed, 80 insertions(+), 37 deletions(-) diff --git a/HBC/META.XML b/HBC/META.XML index 7c5be6b1..ab965e73 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 1.0 r911 - 201002141632 + 1.0 r912 + 201002142328 Loads games from USB-devices 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. diff --git a/Make.config.default b/Make.config.default index e7df03ac..1a10dbf2 100644 --- a/Make.config.default +++ b/Make.config.default @@ -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 diff --git a/source/fatmounter.c b/source/fatmounter.c index a9fb0754..c886262d 100644 --- a/source/fatmounter.c +++ b/source/fatmounter.c @@ -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:/"); diff --git a/source/menu.cpp b/source/menu.cpp index 5f19330d..215bf1b8 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -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) { diff --git a/source/mload/mload_modules.c b/source/mload/mload_modules.c index 78f84690..c3346241 100644 --- a/source/mload/mload_modules.c +++ b/source/mload/mload_modules.c @@ -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; diff --git a/source/usbloader/getentries.cpp b/source/usbloader/getentries.cpp index 094544e5..e19c83de 100644 --- a/source/usbloader/getentries.cpp +++ b/source/usbloader/getentries.cpp @@ -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) { diff --git a/source/usbloader/wbfs.cpp b/source/usbloader/wbfs.cpp index 926dbbd5..1a7932d9 100644 --- a/source/usbloader/wbfs.cpp +++ b/source/usbloader/wbfs.cpp @@ -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; diff --git a/source/usbloader/wbfs/wbfs_fat.cpp b/source/usbloader/wbfs/wbfs_fat.cpp index 087bb567..5c9663f1 100644 --- a/source/usbloader/wbfs/wbfs_fat.cpp +++ b/source/usbloader/wbfs/wbfs_fat.cpp @@ -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