Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////
- vsprintf.c
- ////////////
- #ifdef DEBUG
- static char ascii(char s) {
- if(s < 0x20) return '.';
- if(s > 0x7E) return '.';
- return s;
- }
- #endif
- void hexdump(void *d, int len)
- {
- #ifdef DEBUG
- u8 *data;
- int i, off;
- data = (u8*)d;
- for (off=0; off<len; off += 16)
- {
- dbgprintf("%08x ",off);
- for(i=0; i<16; i++)
- if((i+off)>=len)
- dbgprintf(" ");
- else
- dbgprintf("%02x ",data[off+i]);
- dbgprintf(" ");
- for(i=0; i<16; i++)
- if((i+off)>=len) dbgprintf(" ");
- else dbgprintf("%c",ascii(data[off+i]));
- dbgprintf("\n");
- }
- #endif
- }
- /////////////////
- string.c
- //////////////////
- #ifdef DEBUG
- int dbgprintf( const char *fmt, ...)
- {
- if ( (*(vu32*)(HW_EXICTRL) & 1) == 0)
- return 0;
- va_list args;
- char *buffer = (char*)heap_alloc_aligned( 0, 2048, 32 );
- va_start(args, fmt);
- vsprintf(buffer, fmt, args);
- va_end(args);
- GeckoSendBuffer( buffer );
- heap_free( 0, buffer );
- return 1;
- }
- #endif
- ///////////////////////////
- global.h
- //////////////////////////
- //#define DEBUG 1
- #define false 0
- #define true 1
- #define SHARED_PTR ((void *)0x13600000)
- #define SHARED_SIZE (0x18000)
- #ifdef DEBUG
- int dbgprintf( const char *fmt, ...);
- #else
- #define dbgprintf(...)
- #endif
- #define debug_printf dbgprintf
- //////////////////////////
Add Comment
Please, Sign In to add comment