mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2025-01-19 14:20:50 +00:00
Lower Zone allocation to default (50kB)
This commit is contained in:
parent
68590119ac
commit
0d7ca4ea05
1 changed files with 20 additions and 17 deletions
|
@ -20,11 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// Z_zone.c
|
||||
|
||||
#include "quakedef.h"
|
||||
#ifdef SLIM
|
||||
#define DYNAMIC_SIZE 0x100000//0xc000 Crow_Bar. UP for PSP
|
||||
#else
|
||||
#define DYNAMIC_SIZE 0x40000
|
||||
#endif
|
||||
|
||||
// motolegacy -- who the fuck needs a 250kB zone block?? what?? restoring to 50kB.
|
||||
#define DYNAMIC_SIZE 0xc000
|
||||
|
||||
#define ZONEID 0x1d4a11
|
||||
#define MINFRAGMENT 64
|
||||
|
@ -672,6 +670,7 @@ typedef struct
|
|||
{
|
||||
int sentinal;
|
||||
int size; // including sizeof(hunk_t), -1 = not allocated
|
||||
char name[8];
|
||||
} hunk_t;
|
||||
|
||||
byte *hunk_base;
|
||||
|
@ -700,7 +699,7 @@ void Hunk_Check (void)
|
|||
{
|
||||
if (h->sentinal != HUNK_SENTINAL)
|
||||
Sys_Error ("Hunk_Check: trahsed sentinal");
|
||||
if (h->size < 8 || h->size + (byte *)h - hunk_base > hunk_size)
|
||||
if (h->size < 16 || h->size + (byte *)h - hunk_base > hunk_size)
|
||||
Sys_Error ("Hunk_Check: bad size");
|
||||
h = (hunk_t *)((byte *)h+h->size);
|
||||
}
|
||||
|
@ -716,7 +715,7 @@ Otherwise, allocations with the same name will be totaled up before printing.
|
|||
*/
|
||||
void Hunk_Print (qboolean all)
|
||||
{
|
||||
/*
|
||||
|
||||
hunk_t *h, *next, *endlow, *starthigh, *endhigh;
|
||||
int count, sum;
|
||||
int totalblocks;
|
||||
|
@ -790,7 +789,7 @@ void Hunk_Print (qboolean all)
|
|||
}
|
||||
|
||||
Con_Printf ("-------------------------\n");
|
||||
Con_Printf ("%8i total blocks\n", totalblocks);*/
|
||||
Con_Printf ("%8i total blocks\n", totalblocks);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -809,7 +808,7 @@ void *Hunk_AllocName (int size, char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
size = sizeof(hunk_t) + ((size+7)&~7);
|
||||
size = sizeof(hunk_t) + ((size+15)&~15);
|
||||
|
||||
if (hunk_size - hunk_low_used - hunk_high_used < size)
|
||||
{
|
||||
|
@ -827,7 +826,7 @@ void *Hunk_AllocName (int size, char *name)
|
|||
|
||||
h->size = size;
|
||||
h->sentinal = HUNK_SENTINAL;
|
||||
//Q_strncpy (h->name, name, 8);
|
||||
Q_strncpy (h->name, name, 8);
|
||||
|
||||
return (void *)(h+1);
|
||||
}
|
||||
|
@ -914,7 +913,7 @@ void *Hunk_HighAllocName (int size, char *name)
|
|||
memset (h, 0, size);
|
||||
h->size = size;
|
||||
h->sentinal = HUNK_SENTINAL;
|
||||
//Q_strncpy (h->name, name, 8);
|
||||
Q_strncpy (h->name, name, 8);
|
||||
|
||||
return (void *)(h+1);
|
||||
}
|
||||
|
@ -960,6 +959,7 @@ typedef struct cache_system_s
|
|||
{
|
||||
int size; // including this header
|
||||
cache_user_t *user;
|
||||
char name[16];
|
||||
struct cache_system_s *prev, *next;
|
||||
struct cache_system_s *lru_prev, *lru_next; // for LRU flushing
|
||||
} cache_system_t;
|
||||
|
@ -985,7 +985,7 @@ void Cache_Move ( cache_system_t *c)
|
|||
|
||||
Q_memcpy ( new+1, c+1, c->size - sizeof(cache_system_t) );
|
||||
new->user = c->user;
|
||||
//Q_memcpy (new->name, c->name, sizeof(new->name));
|
||||
Q_memcpy (new->name, c->name, sizeof(new->name));
|
||||
Cache_Free (c->user);
|
||||
new->user->data = (void *)(new+1);
|
||||
}
|
||||
|
@ -1172,12 +1172,13 @@ Cache_Print
|
|||
*/
|
||||
void Cache_Print (void)
|
||||
{
|
||||
/*cache_system_t *cd;
|
||||
cache_system_t *cd;
|
||||
|
||||
Con_Printf("\n===\nCache System Dump\n===\n");
|
||||
for (cd = cache_head.next ; cd != &cache_head ; cd = cd->next)
|
||||
{
|
||||
Con_Printf ("%8i : %s\n", cd->size, cd->name);
|
||||
}*/
|
||||
Con_Printf("* NAME: %s | SIZE: %.2fkB", cd->name, (float)(cd->size/1024));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1287,15 +1288,17 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name)
|
|||
cs = Cache_TryAlloc (size, false);
|
||||
if (cs)
|
||||
{
|
||||
//strncpy (cs->name, name, sizeof(cs->name)-1);
|
||||
strncpy (cs->name, name, sizeof(cs->name)-1);
|
||||
c->data = (void *)(cs+1);
|
||||
cs->user = c;
|
||||
break;
|
||||
}
|
||||
|
||||
// free the least recently used cahedat
|
||||
if (cache_head.lru_prev == &cache_head)
|
||||
if (cache_head.lru_prev == &cache_head) {
|
||||
Cache_Print();
|
||||
Sys_Error ("Cache_Alloc: out of memory");
|
||||
}
|
||||
// not enough memory at all
|
||||
Cache_Free ( cache_head.lru_prev->user );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue