mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-28 03:31:49 +01:00
add code for usb gecko debugging
This commit is contained in:
parent
03f068e49e
commit
c9f4238e99
@ -39,6 +39,10 @@
|
|||||||
#include "gamesettings.h"
|
#include "gamesettings.h"
|
||||||
#include "wiiusbsupport.h"
|
#include "wiiusbsupport.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern void __exception_setreload(int t);
|
||||||
|
}
|
||||||
|
|
||||||
extern int emulating;
|
extern int emulating;
|
||||||
void StopColorizing();
|
void StopColorizing();
|
||||||
void gbSetPalette(u32 RRGGBB[]);
|
void gbSetPalette(u32 RRGGBB[]);
|
||||||
@ -200,6 +204,60 @@ static void CreateAppPath(char origpath[])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* USB Gecko Debugging
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
static bool gecko = false;
|
||||||
|
static mutex_t gecko_mutex = 0;
|
||||||
|
|
||||||
|
static ssize_t __out_write(struct _reent *r, int fd, const char *ptr, size_t len)
|
||||||
|
{
|
||||||
|
u32 level;
|
||||||
|
|
||||||
|
if (!ptr || len <= 0 || !gecko)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
LWP_MutexLock(gecko_mutex);
|
||||||
|
level = IRQ_Disable();
|
||||||
|
usb_sendbuffer(1, ptr, len);
|
||||||
|
IRQ_Restore(level);
|
||||||
|
LWP_MutexUnlock(gecko_mutex);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
const devoptab_t gecko_out = {
|
||||||
|
"stdout", // device name
|
||||||
|
0, // size of file structure
|
||||||
|
NULL, // device open
|
||||||
|
NULL, // device close
|
||||||
|
__out_write,// device write
|
||||||
|
NULL, // device read
|
||||||
|
NULL, // device seek
|
||||||
|
NULL, // device fstat
|
||||||
|
NULL, // device stat
|
||||||
|
NULL, // device link
|
||||||
|
NULL, // device unlink
|
||||||
|
NULL, // device chdir
|
||||||
|
NULL, // device rename
|
||||||
|
NULL, // device mkdir
|
||||||
|
0, // dirStateSize
|
||||||
|
NULL, // device diropen_r
|
||||||
|
NULL, // device dirreset_r
|
||||||
|
NULL, // device dirnext_r
|
||||||
|
NULL, // device dirclose_r
|
||||||
|
NULL // device statvfs_r
|
||||||
|
};
|
||||||
|
|
||||||
|
static void USBGeckoOutput()
|
||||||
|
{
|
||||||
|
LWP_MutexInit(&gecko_mutex, false);
|
||||||
|
gecko = usb_isgeckoalive(1);
|
||||||
|
|
||||||
|
devoptab_list[STD_OUT] = &gecko_out;
|
||||||
|
devoptab_list[STD_ERR] = &gecko_out;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* main
|
* main
|
||||||
*
|
*
|
||||||
@ -207,6 +265,9 @@ static void CreateAppPath(char origpath[])
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
//USBGeckoOutput(); // uncomment to enable USB gecko output
|
||||||
|
__exception_setreload(8);
|
||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
ipl_set_config(6); // disable Qoob modchip
|
ipl_set_config(6); // disable Qoob modchip
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user