From 361c1319328308341d00a8c6dacc28e6096dd041 Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Sun, 4 May 2008 13:51:57 -0700 Subject: Removed most references to PSX, Saturn and E3 Demo. --- src/mem3dc.c | 268 +---------------------------------------------------------- 1 file changed, 4 insertions(+), 264 deletions(-) (limited to 'src/mem3dc.c') diff --git a/src/mem3dc.c b/src/mem3dc.c index d0da027..0a3152b 100644 --- a/src/mem3dc.c +++ b/src/mem3dc.c @@ -46,13 +46,9 @@ #include "ourasert.h" -#if PSX || Saturn - #define MAXMALLOCS 600 -#else - #define MAXMALLOCS 2500000 - /* assertion fires if max exceeded */ - /* changed to 1000000 by DHM 7/4/98; was 70001 */ -#endif +#define MAXMALLOCS 2500000 + /* assertion fires if max exceeded */ + /* changed to 1000000 by DHM 7/4/98; was 70001 */ #define MALLOC_FILL_VALUE 0x21 #define FREE_FILL_VALUE 0x89 @@ -113,15 +109,7 @@ extern int textprint(const char* string, ...); extern void ExitSystem(void); extern void WaitForReturn(void); -/* textprint on psx impacts frame rate massively if not -used just for error messages, so it is often turned off. -Hence the use of textprint2 below */ - -#if PSX -#define textprint2 printf -#else #define textprint2 textprint -#endif /* function declarations */ #if COPY_FILENAME @@ -173,148 +161,6 @@ void record_free(void *ptr, char const * string, unsigned long lineno) return; } -#if PSX || Saturn - -#if COPY_FILENAME -static int AdjustMallocRecord(unsigned long addr, long size, char string[], unsigned long lineno) -#else -static int AdjustMallocRecord(unsigned long addr, long size, char const * string, unsigned long lineno) -#endif - -{ - - int i=0; - char *ptr = (char *)addr; - static int no_record_init = 1; - MALLOC_RECORD *recordPtr = MallocRecord; - - if(no_record_init) - { - InitMallocRecords(); - no_record_init = 0; - } - - - if(size==FREEING_MEMORY) /* must be freeing memory */ - { - GLOBALASSERT(addr); /* ensure not null addr */ - - while(iaddr==addr) - { - TotalMallocNum--; - - size = recordPtr->size; - - while (size--) - { - *ptr++ = FREE_FILL_VALUE; - } - #ifdef OVERRUN_SIZE - { - char const * overrun_ptr = overrun_code; - int ov_cnt = OVERRUN_SIZE(recordPtr->size); - do /* a memcmp - dunno if its supported on all platforms */ - { - if (!*overrun_ptr) overrun_ptr = overrun_code; /* repeat */ - if (*overrun_ptr++ != *ptr++) - { - textprint2("\nOut of Bounds!\n%lu bytes allocated to %p\nat %s, line %lu\n", recordPtr->size,(void *)recordPtr->addr,recordPtr->filename,recordPtr->linenum); - GLOBALASSERT(!"OUT OF BOUNDS detected in FREE"); - } - } - while (--ov_cnt); - } - #endif - - recordPtr->addr = 0; - TotalMemAllocated -= recordPtr->size; - recordPtr->size = 0; - #if COPY_FILENAME - recordPtr->filename[0] = 0; - #else - recordPtr->filename = ""; - #endif - recordPtr->linenum = 0; - break; /* exit while loop */ - } - i++; - recordPtr++; - } - - if(i>=MAXMALLOCS) - { - textprint2("\n\n\n\nFree Error! %s, line %d\n", string, (int)lineno); - GLOBALASSERT(0); - return(0); - } - - } - - else /* must be mallocing memory */ - { - TotalMallocNum++; - GLOBALASSERT(TotalMallocNumaddr == addr) - { - GLOBALASSERT(0); - } - i++; - recordPtr++; - } - i = 0; - recordPtr = MallocRecord; - while(iaddr==0) - { - recordPtr->addr = addr; - recordPtr->size = size; - TotalMemAllocated += size; - #if COPY_FILENAME - strcpy(recordPtr->filename, string); - #else - recordPtr->filename = string; - #endif - recordPtr->linenum = lineno; - while (size--) - { - *ptr++ = MALLOC_FILL_VALUE; - } - #ifdef OVERRUN_SIZE - { - char const * overrun_ptr = overrun_code; - int ov_cnt = OVERRUN_SIZE(recordPtr->size); - do /* a memcpy */ - { - if (!*overrun_ptr) overrun_ptr = overrun_code; /* repeat */ - *ptr++ = *overrun_ptr++; - } - while (--ov_cnt); - } - #endif - break; /* exit while loop */ - } - i++; - recordPtr++; - } - - GLOBALASSERT(iaddr + recordPtr->size; - int ov_cnt = OVERRUN_SIZE(recordPtr->size); - do /* a memcmp - dunno if its supported on all platforms */ - { - if (!*overrun_ptr) overrun_ptr = overrun_code; /* repeat */ - if (*overrun_ptr++ != *ptr++) - { - sprintf(stringbuf,"\nOut of Bounds!\n%lu bytes allocated to %p\nat %s, line %lu\n", recordPtr->size,(void *)recordPtr->addr,recordPtr->filename,recordPtr->linenum); - PCwrite(fd,stringbuf,strlen(stringbuf)); - break; - } - } - while (--ov_cnt); - } - } - - PCclose(fd); - - - } - - #endif - } #endif -- cgit v1.3