Full savestating to memory

This commit is contained in:
2025-05-23 15:49:26 -06:00
parent e9d5b359d0
commit b86d550812
23 changed files with 378 additions and 56 deletions

View File

@ -84,4 +84,19 @@ void ppu_vram_write(u16 address, u8 value){
u8 ppu_vram_read(u16 address){
return ctx.vram[address - 0x8000];
}
void ppu_save_state(ppu_state* state) {
state->ctx = ctx;
state->ctx.line_sprites = NULL;
state->ctx.line_sprite_count = 0;
state->ctx.pfc.pixel_fifo.size = 0;
state->ctx.pfc.pixel_fifo.head = 0;
state->ctx.pfc.pixel_fifo.tail = 0;
}
void ppu_load_state(const ppu_state* state) {
free(ctx.video_buffer);
ctx = state->ctx;
ctx.video_buffer = malloc(YRES * XRES * sizeof(u32));
}