Got replay working

Doesn't work across app runs, unlike handmade the crux here is raylib. Even if we did raylibs features ourselves there would still be an issue of restoring the gpu memory state. So in order to have replays work across app runs is proper state serialization.

I'll leave that for later and focus on the next core features.
This commit is contained in:
2024-02-08 16:05:15 -05:00
parent 9b4ceeffda
commit 84d9675a27
7 changed files with 231 additions and 44 deletions

View File

@ -62,7 +62,9 @@ setup_memory :: proc () -> VMemChunk
// Setup the static arena for the entire application
{
result := virtual.arena_init_static( & sectr_live, sectr.memory_chunk_size, sectr.memory_chunk_size )
base_address : rawptr = transmute( rawptr) u64(Terabyte * 2)
result := arena_init_static( & sectr_live, base_address, sectr.memory_chunk_size, sectr.memory_chunk_size )
if result != runtime.Allocator_Error.None
{
// TODO(Ed) : Setup a proper logging interface
@ -86,7 +88,12 @@ setup_memory :: proc () -> VMemChunk
os. exit( -1 )
// TODO(Ed) : Figure out the error code enums..
}
file_resize( snapshot_file, sectr.memory_chunk_size )
file_info, stat_code := os.stat( path_snapshot )
{
if file_info.size != sectr.memory_chunk_size {
file_resize( snapshot_file, sectr.memory_chunk_size )
}
}
map_error : virtual.Map_File_Error
sectr_snapshot, map_error = virtual.map_file_from_file_descriptor( uintptr(snapshot_file), { virtual.Map_File_Flag.Read, virtual.Map_File_Flag.Write } )