X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_hc.c;h=388133eb966e69414612db00c7d881de2863a454;hb=a565be31ce92d6168ae6983042da75b0b683e52b;hp=8a75121be64804f6ee84e86072a48e21cc76757d;hpb=40f6a462ab3580c79bc91e86da49fa5ed37a853c;p=16.git diff --git a/src/lib/16_hc.c b/src/lib/16_hc.c index 8a75121b..388133eb 100755 --- a/src/lib/16_hc.c +++ b/src/lib/16_hc.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * Copyright (C) 2012-2019 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -52,10 +52,10 @@ long HC_Newfarcoreleft() #endif //from: https://stackoverflow.com/questions/14386856/c-check-available-ram -void __near* HC_LargestFreeBlock(size_t __far* Size) +void NPTR* HC_LargestFreeBlock(size_t* Size) { size_t s0, s1; - void __near* p; + void NPTR* p; s0 = ~(size_t)0 ^ (~(size_t)0 >> 1); while (s0 && (p = _nmalloc(s0)) == NULL) @@ -117,7 +117,7 @@ size_t HC_coreleft(void) } //far version of above -void __far* HC_LargestFarFreeBlock(dword __far* Size) +void __far* HC_LargestFarFreeBlock(dword* Size) { dword s0, s1; void __far* p; @@ -340,14 +340,14 @@ size_t HC_GetFreeSize(void) } */ -void HCL_HeapWalking (struct _heapinfo __far*h_info, hc_use_t __far*hu, unsigned nearfarswitch) +void HCL_HeapWalking (struct _heapinfo *h_info, hc_use_t *hu, unsigned nearfarswitch) { hu->h_free=0; hu->h_total=0; hu->h_used=0; h_info->_pentry = NULL; for(;;) { - if(nearfarswitch==0) hu->heap_status = _nheapwalk( (struct _heapinfo *)h_info ); - else if(nearfarswitch==1) hu->heap_status = _fheapwalk( (struct _heapinfo *)h_info ); + if(nearfarswitch==0) hu->heap_status = _nheapwalk( h_info ); + else if(nearfarswitch==1) hu->heap_status = _fheapwalk( h_info ); if( hu->heap_status != _HEAPOK ) break; if((h_info->_useflag == _USEDENTRY ? "USED" : "FREE")=="FREE") hu->h_free += h_info->_size; if((h_info->_useflag == _USEDENTRY ? "USED" : "FREE")=="USED") hu->h_used += h_info->_size; @@ -438,7 +438,7 @@ void HC_heapdump(global_game_variables_t *gvar) nh_info._pentry = NULL; nh_free=0; nh_total=0; nh_used=0; for(;;) { - heap_status = _nheapwalk( (struct _heapinfo *)&nh_info ); + heap_status = _nheapwalk( &nh_info ); if( heap_status != _HEAPOK ) break; strcpy(scratch," "); strcat(scratch,(nh_info._useflag == _USEDENTRY ? "USED" : "FREE")); strcat(scratch," block at "); sprintf(str, "%Fp", nh_info._pentry); //ultoa((dword)nh_info._pentry,str,16); @@ -459,7 +459,7 @@ nh_info._pentry, nh_info._size );*/ fh_info._pentry = NULL; fh_free=0; fh_total=0; fh_used=0; for(;;) { - heap_status = _fheapwalk( (struct _heapinfo *)&fh_info ); + heap_status = _fheapwalk( &fh_info ); if( heap_status != _HEAPOK ) break; strcpy(scratch," "); strcat(scratch,(fh_info._useflag == _USEDENTRY ? "USED" : "FREE")); strcat(scratch," block at "); sprintf(str, "%Fp", fh_info._pentry); //ultoa((dword)fh_info._pentry,str,16); @@ -481,8 +481,10 @@ fh_info._pentry, fh_info._size );*/ printmeminfoline(scratch, "Near", nh_total, nh_used, nh_free); printmeminfoline(scratch, "Far", fh_total, fh_used, fh_free); strcat(scratch,"---------------- -------- -------- --------\n"); +#if defined(__LARGE__) || defined(__COMPACT__) || defined(__HUGE__) strcat(scratch,"HC_coreleft = "); ultoa((dword)HC_coreleft(),str,10); strcat(scratch,str); strcat(scratch,"\n"); strcat(scratch,"HC_farcoreleft = "); ultoa((dword)HC_farcoreleft(),str,10); strcat(scratch,str); strcat(scratch,"\n"); +#endif //-- strcat(scratch,"HC_Newfarcoreleft = "); ultoa((dword)HC_Newfarcoreleft(),str,10); strcat(scratch,str); strcat(scratch,"\n"); //-- strcat(scratch,"HC_GetFreeSize = "); ultoa((dword)HC_GetFreeSize(),str,10); strcat(scratch,str); strcat(scratch,"\n"); //00 strcat(scratch,"HC_GetNearFreeSize = "); ultoa((dword)HC_GetNearFreeSize(),str,10); strcat(scratch,str); strcat(scratch,"\n");