diff options
author | Won Star | 2006-04-20 14:55:27 +0000 |
---|---|---|
committer | Won Star | 2006-04-20 14:55:27 +0000 |
commit | 564727be2cb68a758da61a8ebac32f16cb3f8ee3 (patch) | |
tree | b8835cb1b9fd6fa1d99582ad647a0335ee3da50b /backends/gp32 | |
parent | 95c134c9a8c7e5f5dcfff48be9e3bb8a7392cae9 (diff) | |
download | scummvm-rg350-564727be2cb68a758da61a8ebac32f16cb3f8ee3.tar.gz scummvm-rg350-564727be2cb68a758da61a8ebac32f16cb3f8ee3.tar.bz2 scummvm-rg350-564727be2cb68a758da61a8ebac32f16cb3f8ee3.zip |
Add used memory counter.
svn-id: r22061
Diffstat (limited to 'backends/gp32')
-rw-r--r-- | backends/gp32/gp32std.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/backends/gp32/gp32std.cpp b/backends/gp32/gp32std.cpp index e9e24edb65..1c32d1e5bb 100644 --- a/backends/gp32/gp32std.cpp +++ b/backends/gp32/gp32std.cpp @@ -40,7 +40,7 @@ FILE *gp_stdin = NULL; //#define USE_CACHE -#define DEBUG_MAX 4 +#define DEBUG_MAX 5 char debline[DEBUG_MAX][256]; static int debnext = 0; @@ -53,21 +53,22 @@ void _dprintf(const char *s, ...) { vsprintf(buf, s, va); va_end(va); - strcpy(debline[debnext], buf); + strcpy(debline[debnext++], buf); - gp_fillRect(frameBuffer1, 0, 200, 320, 40, 0); + if (debnext == DEBUG_MAX) + debnext = 0; + gp_fillRect(frameBuffer1, 0, 243 - (DEBUG_MAX * 8) - 4, 320, (DEBUG_MAX * 10), 0); - for (deb = debnext + 1, deba = 0; deb < DEBUG_MAX; deb++, deba++) { - gp_textOut(frameBuffer1, 0, 200 + 8 * deba, debline[deb], 0xFFFF); + for (deb = debnext, deba = 0; deb < DEBUG_MAX; deb++, deba++) { + //gp_fillRect(frameBuffer1, 0, (243 - (DEBUG_MAX * 8) - 4) + 8 * deba, 320, 8, 0); + gp_textOut(frameBuffer1, 0, (240 - (DEBUG_MAX * 8) - 4) + 8 * deba, debline[deb], 0xFFFF); } - for (deb = 0; deb <= debnext; deb++, deba++) { - gp_textOut(frameBuffer1, 0, 200 + 8 * deba, debline[deb], 0xFFFF); + for (deb = 0; deb < debnext; deb++, deba++) { + //gp_fillRect(frameBuffer1, 0, (243 - (DEBUG_MAX * 8) - 4) + 8 * deba, 320, 8, 0); + gp_textOut(frameBuffer1, 0, (240 - (DEBUG_MAX * 8) - 4) + 8 * deba, debline[deb], 0xFFFF); } - debnext++; - if (debnext == DEBUG_MAX) - debnext = 0; - gp_delay(600); +// gp_delay(100); } ////////////////// @@ -386,9 +387,25 @@ void gp_free(void *block) { ////////////////////////////////////////////////// // GP32 stuff ////////////////////////////////////////////////// +static char usedMemStr[16]; +int gUsedMem = 0; + void *operator new(size_t size) { // printf("BP:operator new(%d)", size); - return memset(malloc(size), 0xE7, size); + + void *ptr = memset(malloc(size), 0xE7, size); + +#if 0 + // Check free memory. + gUsedMem = ((int)(ptr) + size) - 0xc000000; + + sprintf(usedMemStr, "%8d", gUsedMem); + //TODO: draw softkeyboard + gp_fillRect(frameBuffer1, 0, 0, 64, 12, 0); + gp_textOut(frameBuffer1, 0, 0, usedMemStr, 0xfffff); +#endif + + return ptr; } void operator delete(void *ptr) { @@ -616,7 +633,7 @@ void GPDEBUG(const char *fmt, ...) { } void NP(const char *fmt, ...) { -// return; + return; char s[256]; va_list marker; @@ -629,7 +646,7 @@ void NP(const char *fmt, ...) { } void LP(const char *fmt, ...) { -// return; + return; char s[256]; va_list marker; @@ -642,7 +659,7 @@ void LP(const char *fmt, ...) { } void SP(const char *fmt, ...) { -// return; + return; char s[256]; va_list marker; @@ -655,7 +672,7 @@ void SP(const char *fmt, ...) { } void BP(const char *fmt, ...) { -// return; + return; char s[256]; va_list marker; |