Archival snapshot of the Virtual World Entertainment Tesla cockpit software, 1994-1996: MUNGA engine and L4 pod layer source (Borland C++ 5.0), BT/RP game code, and game content (models, audio, maps, gauges, Division renderer data). Includes third-party libraries: Division dVS/DPL graphics, HMI SOS audio, WATTCP networking. Files are preserved byte-for-byte (.gitattributes disables all line-ending conversion). README.md documents the layout, target hardware, and toolchain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
122 lines
2.3 KiB
C++
122 lines
2.3 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// Heap.h -- This file contains the definition for the Base HEAP
|
|
// Manager Class. The Base HEAP manager creates,
|
|
// manages and destroys block of memory using Win32
|
|
// virtual memory calls.
|
|
//
|
|
// Honor Bound -- FASA Interactive Technologies
|
|
//
|
|
// Copyright (c) 1995 FASA Interactive Technologies
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#if !defined(HEAP_HPP)
|
|
# define HEAP_HPP
|
|
|
|
#if !defined(STYLE_HPP)
|
|
#include <style.hpp>
|
|
#endif
|
|
|
|
# if !defined(MEMREG_HPP)
|
|
# include <memreg.hpp>
|
|
# endif
|
|
|
|
struct HeapBlock;
|
|
struct HeapFreeBlock;
|
|
|
|
class UserHeap SIGNATURED
|
|
{
|
|
protected:
|
|
char
|
|
*bigHeap;
|
|
const char
|
|
*heapName;
|
|
HeapBlock
|
|
*heapStart,
|
|
*firstNearBlock;
|
|
size_t
|
|
heapSize,
|
|
lowestTotalHeapLeft;
|
|
size_t
|
|
allocateCount,
|
|
releaseCount;
|
|
|
|
protected:
|
|
void
|
|
Relink(HeapBlock *newBlock);
|
|
void
|
|
Unlink(HeapBlock *oldBlock);
|
|
void
|
|
Sort(HeapBlock *sortBlock);
|
|
void
|
|
MergeWithLower(HeapBlock *block);
|
|
|
|
public:
|
|
UserHeap(
|
|
const char* heap_name,
|
|
size_t mem_size
|
|
);
|
|
~UserHeap();
|
|
|
|
size_t
|
|
GetTotalHeapLeft();
|
|
size_t
|
|
GetBiggestHeapLeft();
|
|
size_t
|
|
GetLowestTotalHeapLeft()
|
|
{return lowestTotalHeapLeft;}
|
|
size_t
|
|
GetHeapUsed()
|
|
{return heapSize - GetTotalHeapLeft();}
|
|
size_t
|
|
GetMostHeapUsed()
|
|
{return heapSize - lowestTotalHeapLeft;}
|
|
|
|
Logical
|
|
TestHeap(
|
|
Logical print_it = False,
|
|
Logical skip_allocated = False,
|
|
Logical skip_free = False
|
|
);
|
|
|
|
void*
|
|
Allocate(size_t mem_size);
|
|
void
|
|
Release(void *where);
|
|
void
|
|
ReleaseAll();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Global memory allocation
|
|
//
|
|
protected:
|
|
static LWord
|
|
HeapMark;
|
|
Logical
|
|
mainHeap;
|
|
|
|
public:
|
|
static UserHeap
|
|
MainStorage;
|
|
|
|
static size_t
|
|
GetMainHeapInitialSize();
|
|
|
|
friend void*
|
|
operator new(size_t mem_size);
|
|
friend void*
|
|
operator new(size_t mem_size, void* where);
|
|
friend void
|
|
operator delete(void *mem_block);
|
|
};
|
|
|
|
void*
|
|
Get_Caller(int levels);
|
|
|
|
#endif
|
|
|