Implemented Emulation Pause handling - Fixes #414

This commit is contained in:
Dimitris Panokostas 2019-02-07 23:38:38 +01:00
parent d5eac98723
commit 6a4f55fa77
3 changed files with 51 additions and 3 deletions

View file

@ -1467,6 +1467,23 @@ int filesys_eject (int nr)
}
static uae_u32 heartbeat;
static int heartbeat_count, heartbeat_count_cont;
static int heartbeat_task;
bool filesys_heartbeat(void)
{
return heartbeat_count_cont > 0;
}
// This uses filesystem process to reduce resource usage
void setsystime(void)
{
if (!currprefs.tod_hack || !rtarea_bank.baseaddr)
return;
heartbeat = get_long_host(rtarea_bank.baseaddr + RTAREA_HEARTBEAT);
heartbeat_task = 1;
heartbeat_count = 10;
}
static uae_u32 REGPARAM2 debugger_helper(TrapContext *ctx)
{

View file

@ -282,6 +282,8 @@ extern void inputdevice_acquire (int allmode);
extern void inputdevice_unacquire (void);
extern void inputdevice_unacquire(bool emulationactive, int inputmask);
extern void pausemode(int mode);
extern void inputdevice_add_inputcode(int code, int state, const TCHAR *);
extern void inputdevice_handle_inputcode (void);
@ -289,6 +291,8 @@ extern void inputdevice_tablet_strobe (void);
extern uae_u64 input_getqualifiers (void);
extern void setsystime(void);
#define JSEM_MODE_DEFAULT 0
#define JSEM_MODE_WHEELMOUSE 1
#define JSEM_MODE_MOUSE 2

View file

@ -97,6 +97,8 @@ static const int *joyinputs[MAX_JPORTS];
static int input_acquired;
static int autopause;
static int handle_input_event (int nr, int state, int max, int autofire);
static struct inputdevice_functions idev[IDTYPE_MAX];
@ -2642,9 +2644,6 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
// screenshot(1, 1);
// }
// break;
case AKS_TOGGLEWINDOWEDFULLSCREEN:
toggle_fullscreen();
break;
#ifdef ACTION_REPLAY
case AKS_FREEZEBUTTON:
action_replay_freeze();
@ -2702,6 +2701,14 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
case AKS_EFLOPPY3:
disk_eject(3);
break;
case AKS_PAUSE:
pausemode(newstate > 0 ? 1 : newstate);
break;
case AKS_SINGLESTEP:
if (pause_emulation)
pausemode(0);
autopause = 1;
break;
case AKS_VOLDOWN:
sound_volume(newstate <= 0 ? -1 : 1);
break;
@ -2717,6 +2724,9 @@ static bool inputdevice_handle_inputcode2(int code, int state, const TCHAR *s)
case AKS_HARDRESET:
uae_reset(1, 1);
break;
case AKS_TOGGLEWINDOWEDFULLSCREEN:
toggle_fullscreen();
break;
case AKS_MOUSEMAP_PORT0_LEFT:
(changed_prefs.jports[0].mousemap) ^= 1 << 0;
inputdevice_updateconfig(&changed_prefs, &currprefs);
@ -3071,6 +3081,13 @@ static void inputdevice_checkconfig (void)
void inputdevice_vsync (void)
{
if (autopause > 0 && pause_emulation == 0) {
autopause--;
if (!autopause) {
pausemode(1);
}
}
input_frame++;
mouseupdate (0, true);
@ -6115,6 +6132,16 @@ int getmousestate (int joy)
return mice[joy].enabled;
}
void pausemode(int mode)
{
if (mode < 0)
pause_emulation = pause_emulation ? 0 : 9;
else
pause_emulation = mode;
set_config_changed();
setsystime();
}
int jsem_isjoy (int port, const struct uae_prefs *p)
{
int v = JSEM_DECODEVAL (port, p);