WiiFlow_Lite/resources/wiiflow_game_booter/source/gecko.c
fix94.1 8cc82998ac -experiment tinyload failed, back to my libogc booter
(however, I'll keep using that awesome loading bar of it lol)
-fixed this strange click sound on game boot
2012-10-14 17:18:13 +00:00

46 lines
878 B
C

#include <gccore.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <sys/iosupport.h>
#include <stdarg.h>
#include "gecko.h"
/* init-globals */
bool geckoinit = false;
static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len)
{
if(geckoinit && ptr)
{
u32 level;
level = IRQ_Disable();
usb_sendbuffer_safe(1, ptr, len);
IRQ_Restore(level);
}
return len;
}
char gprintfBuffer[256];
void gprintf(const char *format, ...)
{
va_list va;
va_start(va, format);
int len = vsnprintf(gprintfBuffer, 255, format, va);
__out_write(NULL, 0, gprintfBuffer, len);
va_end(va);
}
bool InitGecko()
{
if(geckoinit)
return geckoinit;
u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
if(geckoattached)
{
geckoinit = true;
usb_flush(EXI_CHANNEL_1);
}
return geckoinit;
}