n64: screw things up some more. use a semaphore to handle stoppage in r4300 interrupt. blah. it's faster
This commit is contained in:
parent
415d749be9
commit
147c77c124
|
@ -360,22 +360,26 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
VICallback m64pVICallback;
|
||||
public void FrameComplete()
|
||||
{
|
||||
uint s = (uint)AudGetAudioRate();
|
||||
if (s != m64pSamplingRate)
|
||||
if (resampler != null)
|
||||
{
|
||||
m64pSamplingRate = s;
|
||||
resampler.ChangeRate(s, 44100, s, 44100);
|
||||
//Console.WriteLine("N64 ARate Change {0}", s);
|
||||
}
|
||||
// the way i've fubared up the core, a first framecomplete callback happens in init, before everything is set up
|
||||
uint s = (uint)AudGetAudioRate();
|
||||
if (s != m64pSamplingRate)
|
||||
{
|
||||
m64pSamplingRate = s;
|
||||
resampler.ChangeRate(s, 44100, s, 44100);
|
||||
//Console.WriteLine("N64 ARate Change {0}", s);
|
||||
}
|
||||
|
||||
int m64pAudioBufferSize = AudGetBufferSize();
|
||||
if (m64pAudioBuffer.Length < m64pAudioBufferSize)
|
||||
m64pAudioBuffer = new short[m64pAudioBufferSize];
|
||||
int m64pAudioBufferSize = AudGetBufferSize();
|
||||
if (m64pAudioBuffer.Length < m64pAudioBufferSize)
|
||||
m64pAudioBuffer = new short[m64pAudioBufferSize];
|
||||
|
||||
if (m64pAudioBufferSize > 0)
|
||||
{
|
||||
AudReadAudioBuffer(m64pAudioBuffer);
|
||||
resampler.EnqueueSamples(m64pAudioBuffer, m64pAudioBufferSize / 2);
|
||||
if (m64pAudioBufferSize > 0)
|
||||
{
|
||||
AudReadAudioBuffer(m64pAudioBuffer);
|
||||
resampler.EnqueueSamples(m64pAudioBuffer, m64pAudioBufferSize / 2);
|
||||
}
|
||||
}
|
||||
m64pFrameComplete = true;
|
||||
}
|
||||
|
@ -487,10 +491,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
m64pEmulator.Start();
|
||||
|
||||
int state = -1;
|
||||
/*
|
||||
do
|
||||
{
|
||||
m64pCoreDoCommandRefInt(m64p_command.M64CMD_CORE_STATE_QUERY, 1, ref state);
|
||||
} while (state != (int)m64p_emu_state.M64EMU_PAUSED);
|
||||
*/
|
||||
m64pFrameComplete = false;
|
||||
while (!m64pFrameComplete) { }
|
||||
|
||||
|
||||
m64pSamplingRate = (uint)AudGetAudioRate();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -289,11 +289,13 @@ static void main_set_speedlimiter(int enable)
|
|||
|
||||
static int main_is_paused(void)
|
||||
{
|
||||
return (g_EmulatorRunning && rompause);
|
||||
return (g_EmulatorRunning);// && rompause);
|
||||
}
|
||||
|
||||
void main_toggle_pause(void)
|
||||
{
|
||||
MessageBox(NULL, "This wasn't supposed to happen!", "Call Spooky", 0);
|
||||
/*
|
||||
if (!g_EmulatorRunning)
|
||||
return;
|
||||
|
||||
|
@ -321,12 +323,14 @@ void main_toggle_pause(void)
|
|||
|
||||
rompause = !rompause;
|
||||
l_FrameAdvance = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
void main_advance_one(void)
|
||||
{
|
||||
l_FrameAdvance = 1;
|
||||
rompause = 0;
|
||||
//rompause = 0;
|
||||
ReleaseSemaphore(rompausesem, 1, NULL);
|
||||
StateChanged(M64CORE_EMU_STATE, M64EMU_RUNNING);
|
||||
}
|
||||
|
||||
|
@ -413,8 +417,8 @@ m64p_error main_core_state_query(m64p_core_param param, int *rval)
|
|||
case M64CORE_EMU_STATE:
|
||||
if (!g_EmulatorRunning)
|
||||
*rval = M64EMU_STOPPED;
|
||||
else if (rompause)
|
||||
*rval = M64EMU_PAUSED;
|
||||
//else if (rompause)
|
||||
// *rval = M64EMU_PAUSED;
|
||||
else
|
||||
*rval = M64EMU_RUNNING;
|
||||
break;
|
||||
|
@ -667,14 +671,14 @@ void new_vi(void)
|
|||
double VILimitMilliseconds = 1000.0 / ROM_PARAMS.vilimit;
|
||||
double AdjustedLimit = VILimitMilliseconds * 100.0 / l_SpeedFactor; // adjust for selected emulator speed
|
||||
int time;
|
||||
|
||||
|
||||
start_section(IDLE_SECTION);
|
||||
VI_Counter++;
|
||||
|
||||
#ifdef DBG
|
||||
if(g_DebuggerActive) DebuggerCallback(DEBUG_UI_VI, 0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
if(LastFPSTime == 0)
|
||||
{
|
||||
LastFPSTime = CounterTime = SDL_GetTicks();
|
||||
|
@ -703,12 +707,13 @@ void new_vi(void)
|
|||
}
|
||||
|
||||
LastFPSTime = CurrentFPSTime ;
|
||||
*/
|
||||
end_section(IDLE_SECTION);
|
||||
if (g_VICallback != NULL)
|
||||
(*g_VICallback)();
|
||||
|
||||
if (l_FrameAdvance) {
|
||||
rompause = 1;
|
||||
//rompause = 1;
|
||||
l_FrameAdvance = 0;
|
||||
StateChanged(M64CORE_EMU_STATE, M64EMU_PAUSED);
|
||||
}
|
||||
|
@ -838,12 +843,13 @@ void main_stop(void)
|
|||
osd_delete_message(l_msgVol);
|
||||
l_msgVol = NULL;
|
||||
}
|
||||
if (rompause)
|
||||
{
|
||||
rompause = 0;
|
||||
stop = 1;
|
||||
//if (rompause)
|
||||
//{
|
||||
// rompause = 0;
|
||||
ReleaseSemaphore(rompausesem, 1, NULL);
|
||||
StateChanged(M64CORE_EMU_STATE, M64EMU_RUNNING);
|
||||
}
|
||||
stop = 1;
|
||||
//}
|
||||
#ifdef DBG
|
||||
if(g_DebuggerActive)
|
||||
{
|
||||
|
|
|
@ -388,21 +388,23 @@ void gen_interupt(void)
|
|||
refresh_stat();
|
||||
|
||||
// if paused, poll for input events
|
||||
if(rompause)
|
||||
{
|
||||
//if(rompause)
|
||||
//{
|
||||
osd_render(); // draw Paused message in case gfx.updateScreen didn't do it
|
||||
VidExt_GL_SwapBuffers();
|
||||
while(rompause)
|
||||
{
|
||||
SDL_Delay(10);
|
||||
// while(rompause)
|
||||
// {
|
||||
//SDL_Delay(10);
|
||||
|
||||
SDL_PumpEvents();
|
||||
#ifdef WITH_LIRC
|
||||
lircCheckInput();
|
||||
#endif //WITH_LIRC
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
new_vi();
|
||||
WaitForSingleObject(rompausesem, INFINITE);
|
||||
if (vi_register.vi_v_sync == 0) vi_register.vi_delay = 500000;
|
||||
else vi_register.vi_delay = ((vi_register.vi_v_sync + 1)*1500);
|
||||
next_vi += vi_register.vi_delay;
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
|
||||
unsigned int r4300emu = 0;
|
||||
int no_compiled_jump = 0;
|
||||
int llbit, rompause;
|
||||
int llbit; //, rompause;
|
||||
HANDLE rompausesem;
|
||||
#if NEW_DYNAREC != NEW_DYNAREC_ARM
|
||||
int stop;
|
||||
long long int reg[32], hi, lo;
|
||||
|
@ -985,7 +986,8 @@ void r4300_execute(void)
|
|||
debug_count = 0;
|
||||
delay_slot=0;
|
||||
stop = 0;
|
||||
rompause = 1;
|
||||
//rompause = 1;
|
||||
rompausesem = CreateSemaphore(NULL, 0, 1, NULL);
|
||||
|
||||
/* clear instruction counters */
|
||||
#if defined(COUNT_INSTR)
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#ifndef R4300_H
|
||||
#define R4300_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
|
||||
#include "recomp.h"
|
||||
#include "memory/tlb.h"
|
||||
|
||||
|
@ -29,7 +32,8 @@ extern precomp_instr *PC;
|
|||
|
||||
extern precomp_block *blocks[0x100000], *actual;
|
||||
|
||||
extern int stop, llbit, rompause;
|
||||
extern int stop, llbit; //, rompause;
|
||||
extern HANDLE rompausesem;
|
||||
extern long long int reg[32], hi, lo;
|
||||
extern long long int local_rs;
|
||||
extern unsigned int reg_cop0[32];
|
||||
|
|
Loading…
Reference in New Issue