]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_hc.c
updating copy left. i am super fuckin busy with school, and trying to get life back...
[16.git] / src / lib / 16_hc.c
index 8a75121be64804f6ee84e86072a48e21cc76757d..388133eb966e69414612db00c7d881de2863a454 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ * Copyright (C) 2012-2019 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
  *\r
  * This file is part of Project 16.\r
  *\r
@@ -52,10 +52,10 @@ long HC_Newfarcoreleft()
 #endif\r
 \r
 //from: https://stackoverflow.com/questions/14386856/c-check-available-ram\r
-void __near* HC_LargestFreeBlock(size_t __far* Size)\r
+void NPTR* HC_LargestFreeBlock(size_t* Size)\r
 {\r
        size_t s0, s1;\r
-       void __near* p;\r
+       void NPTR* p;\r
 \r
        s0 = ~(size_t)0 ^ (~(size_t)0 >> 1);\r
        while (s0 && (p = _nmalloc(s0)) == NULL)\r
@@ -117,7 +117,7 @@ size_t HC_coreleft(void)
 }\r
 \r
 //far version of above\r
-void __far* HC_LargestFarFreeBlock(dword __far* Size)\r
+void __far* HC_LargestFarFreeBlock(dword* Size)\r
 {\r
        dword s0, s1;\r
        void __far* p;\r
@@ -340,14 +340,14 @@ size_t HC_GetFreeSize(void)
 }\r
 */\r
 \r
-void HCL_HeapWalking (struct _heapinfo __far*h_info, hc_use_t __far*hu, unsigned nearfarswitch)\r
+void HCL_HeapWalking (struct _heapinfo *h_info, hc_use_t *hu, unsigned nearfarswitch)\r
 {\r
        hu->h_free=0; hu->h_total=0; hu->h_used=0;\r
 \r
        h_info->_pentry = NULL;\r
        for(;;) {\r
-               if(nearfarswitch==0) hu->heap_status = _nheapwalk( (struct _heapinfo *)h_info );\r
-               else if(nearfarswitch==1) hu->heap_status = _fheapwalk( (struct _heapinfo *)h_info );\r
+               if(nearfarswitch==0) hu->heap_status = _nheapwalk( h_info );\r
+               else if(nearfarswitch==1) hu->heap_status = _fheapwalk( h_info );\r
                if( hu->heap_status != _HEAPOK ) break;\r
                if((h_info->_useflag == _USEDENTRY ? "USED" : "FREE")=="FREE") hu->h_free += h_info->_size;\r
                if((h_info->_useflag == _USEDENTRY ? "USED" : "FREE")=="USED") hu->h_used += h_info->_size;\r
@@ -438,7 +438,7 @@ void HC_heapdump(global_game_variables_t *gvar)
        nh_info._pentry = NULL;\r
        nh_free=0; nh_total=0; nh_used=0;\r
        for(;;) {\r
-               heap_status = _nheapwalk( (struct _heapinfo *)&nh_info );\r
+               heap_status = _nheapwalk( &nh_info );\r
                if( heap_status != _HEAPOK ) break;\r
                strcpy(scratch,"  "); strcat(scratch,(nh_info._useflag == _USEDENTRY ? "USED" : "FREE")); strcat(scratch," block at ");\r
                sprintf(str, "%Fp", nh_info._pentry); //ultoa((dword)nh_info._pentry,str,16);\r
@@ -459,7 +459,7 @@ nh_info._pentry, nh_info._size );*/
        fh_info._pentry = NULL;\r
        fh_free=0; fh_total=0; fh_used=0;\r
        for(;;) {\r
-               heap_status = _fheapwalk( (struct _heapinfo *)&fh_info );\r
+               heap_status = _fheapwalk( &fh_info );\r
                if( heap_status != _HEAPOK ) break;\r
                strcpy(scratch,"  "); strcat(scratch,(fh_info._useflag == _USEDENTRY ? "USED" : "FREE")); strcat(scratch," block at ");\r
                sprintf(str, "%Fp", fh_info._pentry); //ultoa((dword)fh_info._pentry,str,16);\r
@@ -481,8 +481,10 @@ fh_info._pentry, fh_info._size );*/
        printmeminfoline(scratch, "Near", nh_total, nh_used, nh_free);\r
        printmeminfoline(scratch, "Far", fh_total, fh_used, fh_free);\r
        strcat(scratch,"----------------  --------   --------   --------\n");\r
+#if defined(__LARGE__) || defined(__COMPACT__) || defined(__HUGE__)\r
        strcat(scratch,"HC_coreleft = ");                       ultoa((dword)HC_coreleft(),str,10);                     strcat(scratch,str);    strcat(scratch,"\n");\r
        strcat(scratch,"HC_farcoreleft = ");                    ultoa((dword)HC_farcoreleft(),str,10);          strcat(scratch,str);    strcat(scratch,"\n");\r
+#endif\r
 //--   strcat(scratch,"HC_Newfarcoreleft = ");         ultoa((dword)HC_Newfarcoreleft(),str,10);               strcat(scratch,str);    strcat(scratch,"\n");\r
 //--   strcat(scratch,"HC_GetFreeSize = ");            ultoa((dword)HC_GetFreeSize(),str,10);          strcat(scratch,str);    strcat(scratch,"\n");\r
 //00   strcat(scratch,"HC_GetNearFreeSize = ");        ultoa((dword)HC_GetNearFreeSize(),str,10);      strcat(scratch,str);    strcat(scratch,"\n");\r