Files
Cesarus85--mjolnir-vr/source/cache/physical_memory_map.c
T
Jonas VolmanandClaude Opus 5.5 9a376181f5 Port: grow the game state and object pools for 128 players
The Xbox game state (0x345000 bytes at 0x80061000) ends exactly where the
map-linked tag cache begins and has 948 bytes free, so a 128-player
session cannot even allocate its player datums. The native builds now
place a 16 MB game state (CPU 0xFC0000, GPU 0x40000) at 0x81A00000, above
the tag cache and below everything the Xbox memory window hands out
top-down, and grow the pools that scale with the number of players:

- objects: 2048 -> 8192 headers, 1 MB -> 8 MB pool; the garbage limits
  keep January's proportions (5/10/20 % of the pool, 2.5/5/10 % of the
  headers, 75/50/30 active garbage objects per 16 players)
- cluster partition reference lists 2048 -> 8192 (collideable and
  noncollideable objects, lights); a full list drops objects out of
  rendering, collision and sphere queries
- effects 256 -> 2048, effect locations 512 -> 4096
- particles 1024 -> 8192 (render_particles' visible list, filled without
  a bound check, follows), particle systems 64 -> 256, their particles
  512 -> 4096
- contrails 256 -> 1024, contrail points 1024 -> 8192
  (MAXIMUM_CONTRAIL_POINTS stays the pool size for the same reason)
- lights 896 -> 4096, object looping sounds 1024 -> 4096
- cached object render states and rendered objects 256 -> 1024
- script object-list references 128 -> 1024, objects one explosion can
  damage 64 -> 256

The values live in port/linux/include/halo_port_capacity.h, included by
halo_port_limits.h. With 128 player datums the CPU part holds 14,256,908
bytes (2,258,164 free). Saved games and cores grow to 16 MB. Every change
is under HALO_LINUX; the MSVC objects are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 10:18:07 -07:00

168 lines
5.2 KiB
C

/*
PHYSICAL_MEMORY_MAP.C
symbols in this file:
001AD660 00f0:
_physical_memory_allocate (0000)
001AD750 00a0:
_physical_memory_verify (0000)
001AD7F0 0040:
_physical_memory_free (0000)
001AD830 0010:
_physical_memory_get_game_state_base_address (0000)
001AD840 0010:
_physical_memory_get_tag_cache_base_address (0000)
001AD850 0010:
_physical_memory_get_texture_cache_base_address (0000)
001AD860 0010:
_physical_memory_get_sound_cache_base_address (0000)
002A76A0 0035:
??_C@_0DF@JIMKNOMI@physical_memory_map_globals?4soun@ (0000)
002A76D8 0037:
??_C@_0DH@HFDEEEDC@physical_memory_map_globals?4text@ (0000)
002A7710 005a:
??_C@_0FK@BLCIEIND@?$CIunsigned?5long?$CJphysical_memory_m@ (0000)
002A7770 005c:
??_C@_0FM@EHFFGLDK@?$CIunsigned?5long?$CJphysical_memory_m@ (0000)
002A77CC 002b:
??_C@_0CL@BKHLOEEB@c?3?2halo?2SOURCE?2cache?2physical_me@ (0000)
002A77F8 001e:
??_C@_0BO@DKDCAKMK@page_status?5?$DN?$DN?5PAGE_READWRITE?$AA@ (0000)
004D1074 0010:
_physical_memory_map_globals (0000)
*/
/* ---------- headers */
#include "cseries.h"
#include "cseries_windows.h"
#include "cache/physical_memory_map.h"
/* ---------- constants */
#ifdef HALO_LINUX
/* the native builds' larger game state, placed above the tag cache
(halo_port_capacity.h); the verified part is the CPU part, as on the Xbox */
#define GAME_STATE_BASE_ADDRESS HALO_PORT_GAME_STATE_BASE_ADDRESS
#define GAME_STATE_SIZE HALO_PORT_GAME_STATE_SIZE
#define GAME_STATE_VERIFY_SIZE HALO_PORT_GAME_STATE_CPU_SIZE
#else
#define GAME_STATE_BASE_ADDRESS 0x80061000
#define GAME_STATE_SIZE 0x345000
#define GAME_STATE_VERIFY_SIZE 0x305000
#endif
#define TAG_CACHE_BASE_ADDRESS 0x803A6000
#define TAG_CACHE_SIZE 0x1600000
#define TEXTURE_CACHE_SIZE 0x1600000
#define SOUND_CACHE_SIZE 0x400000
/* ---------- macros */
/* ---------- structures */
struct physical_memory_map_globals
{
void *game_state_base_address;
void *tag_cache_base_address;
void *texture_cache_base_address;
void *sound_cache_base_address;
};
/* ---------- prototypes */
/* ---------- globals */
static struct physical_memory_map_globals physical_memory_map_globals;
/* ---------- public code */
void physical_memory_allocate(
void)
{
physical_memory_map_globals.game_state_base_address = XPhysicalAlloc(GAME_STATE_SIZE, GAME_STATE_BASE_ADDRESS & 0x7FFFFFFF, 0, PAGE_READWRITE);
#line 46 "c:\\halo\\SOURCE\\cache\\physical_memory_map.c"
match_assert(__FILE__, __LINE__, (unsigned long)physical_memory_map_globals.game_state_base_address==GAME_STATE_BASE_ADDRESS);
physical_memory_map_globals.tag_cache_base_address = XPhysicalAlloc(TAG_CACHE_SIZE, TAG_CACHE_BASE_ADDRESS & 0x7FFFFFFF, 0, PAGE_READWRITE);
#line 50 "c:\\halo\\SOURCE\\cache\\physical_memory_map.c"
match_assert(__FILE__, __LINE__, (unsigned long)physical_memory_map_globals.tag_cache_base_address==TAG_CACHE_BASE_ADDRESS);
physical_memory_map_globals.texture_cache_base_address = XPhysicalAlloc(TEXTURE_CACHE_SIZE, -1, 0, PAGE_READWRITE | PAGE_WRITECOMBINE);
#line 55 "c:\\halo\\SOURCE\\cache\\physical_memory_map.c"
match_assert(__FILE__, __LINE__, physical_memory_map_globals.texture_cache_base_address);
physical_memory_map_globals.sound_cache_base_address = XPhysicalAlloc(SOUND_CACHE_SIZE, -1, 0, PAGE_READWRITE);
#line 58 "c:\\halo\\SOURCE\\cache\\physical_memory_map.c"
match_assert(__FILE__, __LINE__, physical_memory_map_globals.sound_cache_base_address);
return;
}
void physical_memory_verify(
void)
{
byte *address;
unsigned long page_status;
for (address = physical_memory_map_globals.tag_cache_base_address;
address < (byte *)physical_memory_map_globals.tag_cache_base_address + TAG_CACHE_SIZE;
address += 0x1000)
{
page_status = XQueryMemoryProtect(address);
#line 77 "c:\\halo\\SOURCE\\cache\\physical_memory_map.c"
match_assert(__FILE__, __LINE__, page_status == PAGE_READWRITE);
}
for (address = physical_memory_map_globals.game_state_base_address;
address < (byte *)physical_memory_map_globals.game_state_base_address + GAME_STATE_VERIFY_SIZE;
address += 0x1000)
{
page_status = XQueryMemoryProtect(address);
#line 86 "c:\\halo\\SOURCE\\cache\\physical_memory_map.c"
match_assert(__FILE__, __LINE__, page_status == PAGE_READWRITE);
}
return;
}
void physical_memory_free(
void)
{
if (physical_memory_map_globals.game_state_base_address)
XPhysicalFree(physical_memory_map_globals.game_state_base_address);
if (physical_memory_map_globals.tag_cache_base_address)
XPhysicalFree(physical_memory_map_globals.tag_cache_base_address);
if (physical_memory_map_globals.texture_cache_base_address)
XPhysicalFree(physical_memory_map_globals.texture_cache_base_address);
if (physical_memory_map_globals.sound_cache_base_address)
XPhysicalFree(physical_memory_map_globals.sound_cache_base_address);
return;
}
void *physical_memory_get_game_state_base_address(
void)
{
return physical_memory_map_globals.game_state_base_address;
}
void *physical_memory_get_tag_cache_base_address(
void)
{
return physical_memory_map_globals.tag_cache_base_address;
}
void *physical_memory_get_texture_cache_base_address(
void)
{
return physical_memory_map_globals.texture_cache_base_address;
}
void *physical_memory_get_sound_cache_base_address(
void)
{
return physical_memory_map_globals.sound_cache_base_address;
}
/* ---------- private code */