Full savestating to memory
This commit is contained in:
19
lib/ui.c
19
lib/ui.c
@ -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;
|
||||
|
Reference in New Issue
Block a user