mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-25 02:31:49 +01:00
Adding minimal set of changes to the savestate procedures to ensure full re-record sync
This commit is contained in:
parent
25a90c634d
commit
4002e2e302
@ -40,13 +40,7 @@
|
|||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "gamepad.h"
|
#include "gamepad.h"
|
||||||
|
|
||||||
static struct
|
struct gamepad_t gamepad[MAX_DEVICES];
|
||||||
{
|
|
||||||
uint8 State;
|
|
||||||
uint8 Counter;
|
|
||||||
uint8 Timeout;
|
|
||||||
uint32 Latency;
|
|
||||||
} gamepad[MAX_DEVICES];
|
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
@ -56,7 +50,6 @@ static struct
|
|||||||
|
|
||||||
static uint8 latch;
|
static uint8 latch;
|
||||||
|
|
||||||
|
|
||||||
void gamepad_reset(int port)
|
void gamepad_reset(int port)
|
||||||
{
|
{
|
||||||
/* default state (Gouketsuji Ichizoku / Power Instinct, Samurai Spirits / Samurai Shodown) */
|
/* default state (Gouketsuji Ichizoku / Power Instinct, Samurai Spirits / Samurai Shodown) */
|
||||||
|
@ -40,6 +40,16 @@
|
|||||||
#ifndef _GAMEPAD_H_
|
#ifndef _GAMEPAD_H_
|
||||||
#define _GAMEPAD_H_
|
#define _GAMEPAD_H_
|
||||||
|
|
||||||
|
struct gamepad_t
|
||||||
|
{
|
||||||
|
uint8 State;
|
||||||
|
uint8 Counter;
|
||||||
|
uint8 Timeout;
|
||||||
|
uint32 Latency;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct gamepad_t gamepad[MAX_DEVICES];
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern void gamepad_reset(int port);
|
extern void gamepad_reset(int port);
|
||||||
extern void gamepad_refresh(int port);
|
extern void gamepad_refresh(int port);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "membnk.h"
|
#include "membnk.h"
|
||||||
#include "io_ctrl.h"
|
#include "io_ctrl.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "gamepad.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "psg.h"
|
#include "psg.h"
|
||||||
#include "ym2413.h"
|
#include "ym2413.h"
|
||||||
|
16
core/state.c
16
core/state.c
@ -71,6 +71,9 @@ int state_load(unsigned char *state)
|
|||||||
zbank_memory_map[i].write = zbank_write_vdp;
|
zbank_memory_map[i].write = zbank_write_vdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SYSTEM */
|
||||||
|
load_param(&pause_b, sizeof(pause_b));
|
||||||
|
|
||||||
/* GENESIS */
|
/* GENESIS */
|
||||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
@ -109,6 +112,9 @@ int state_load(unsigned char *state)
|
|||||||
io_reg[0] = 0x80 | (region_code >> 1);
|
io_reg[0] = 0x80 | (region_code >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CONTROLLERS */
|
||||||
|
load_param(gamepad, sizeof(gamepad));
|
||||||
|
|
||||||
/* VDP */
|
/* VDP */
|
||||||
bufferptr += vdp_context_load(&state[bufferptr]);
|
bufferptr += vdp_context_load(&state[bufferptr]);
|
||||||
|
|
||||||
@ -152,6 +158,7 @@ int state_load(unsigned char *state)
|
|||||||
load_param(&m68k.cycles, sizeof(m68k.cycles));
|
load_param(&m68k.cycles, sizeof(m68k.cycles));
|
||||||
load_param(&m68k.int_level, sizeof(m68k.int_level));
|
load_param(&m68k.int_level, sizeof(m68k.int_level));
|
||||||
load_param(&m68k.stopped, sizeof(m68k.stopped));
|
load_param(&m68k.stopped, sizeof(m68k.stopped));
|
||||||
|
load_param(&m68k.refresh_cycles, sizeof(m68k.refresh_cycles));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Z80 */
|
/* Z80 */
|
||||||
@ -200,6 +207,9 @@ int state_save(unsigned char *state)
|
|||||||
memcpy(version,STATE_VERSION,16);
|
memcpy(version,STATE_VERSION,16);
|
||||||
save_param(version, 16);
|
save_param(version, 16);
|
||||||
|
|
||||||
|
/* SYSTEM */
|
||||||
|
save_param(&pause_b, sizeof(pause_b));
|
||||||
|
|
||||||
/* GENESIS */
|
/* GENESIS */
|
||||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
@ -215,7 +225,10 @@ int state_save(unsigned char *state)
|
|||||||
|
|
||||||
/* IO */
|
/* IO */
|
||||||
save_param(io_reg, sizeof(io_reg));
|
save_param(io_reg, sizeof(io_reg));
|
||||||
|
|
||||||
|
/* CONTROLLERS */
|
||||||
|
save_param(gamepad, sizeof(gamepad));
|
||||||
|
|
||||||
/* VDP */
|
/* VDP */
|
||||||
bufferptr += vdp_context_save(&state[bufferptr]);
|
bufferptr += vdp_context_save(&state[bufferptr]);
|
||||||
|
|
||||||
@ -251,6 +264,7 @@ int state_save(unsigned char *state)
|
|||||||
save_param(&m68k.cycles, sizeof(m68k.cycles));
|
save_param(&m68k.cycles, sizeof(m68k.cycles));
|
||||||
save_param(&m68k.int_level, sizeof(m68k.int_level));
|
save_param(&m68k.int_level, sizeof(m68k.int_level));
|
||||||
save_param(&m68k.stopped, sizeof(m68k.stopped));
|
save_param(&m68k.stopped, sizeof(m68k.stopped));
|
||||||
|
save_param(&m68k.refresh_cycles, sizeof(m68k.refresh_cycles));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Z80 */
|
/* Z80 */
|
||||||
|
@ -51,7 +51,7 @@ uint8 system_bios;
|
|||||||
uint32 system_clock;
|
uint32 system_clock;
|
||||||
int16 SVP_cycles = 800;
|
int16 SVP_cycles = 800;
|
||||||
|
|
||||||
static uint8 pause_b;
|
uint8 pause_b;
|
||||||
static EQSTATE eq[2];
|
static EQSTATE eq[2];
|
||||||
static int16 llp,rrp;
|
static int16 llp,rrp;
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ extern int16 SVP_cycles;
|
|||||||
extern uint8 system_hw;
|
extern uint8 system_hw;
|
||||||
extern uint8 system_bios;
|
extern uint8 system_bios;
|
||||||
extern uint32 system_clock;
|
extern uint32 system_clock;
|
||||||
|
extern uint8 pause_b;
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern int audio_init(int samplerate, double framerate);
|
extern int audio_init(int samplerate, double framerate);
|
||||||
|
Loading…
Reference in New Issue
Block a user