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

@ -8,6 +8,7 @@
#include <lcd.h>
#include <cpu.h>
#include <cart.h>
#include <state.h>
#include <SDL.h>
#include <SDL_ttf.h>
@ -24,10 +25,12 @@ SDL_Renderer *sdlDebugRenderer;
SDL_Texture *sdlDebugTexture;
SDL_Surface *debugScreen;
TTF_Font *sans;
save_state *state;
static int scale = 4;
void ui_init(){
state = malloc(sizeof(*state));
SDL_Init(SDL_INIT_VIDEO);
printf("SDL INIT\n");
TTF_Init();
@ -334,6 +337,22 @@ void ui_on_key(bool down, u32 key_code) {
printf("PPU Debug Disabled\n");
}
}
if(key_code == SDLK_r && down == true) {
emu_stop();
emu_reset();
emu_start();
}
if(key_code == SDLK_s && down == true) {
emu_stop();
state_save(state);
emu_start();
}
if(key_code == SDLK_l && down == true) {
emu_stop();
emu_reset();
state_load(state);
emu_start();
}
switch(key_code){
case SDLK_z: gamepad_get_state()->b = down; break;
case SDLK_x: gamepad_get_state()->a = down; break;