lynx: lag indicator
This commit is contained in:
parent
d9258cc4b9
commit
6e1932c8bd
|
@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
public static extern void Reset(IntPtr s);
|
public static extern void Reset(IntPtr s);
|
||||||
|
|
||||||
[DllImport(dllname, CallingConvention = cc)]
|
[DllImport(dllname, CallingConvention = cc)]
|
||||||
public static extern void Advance(IntPtr s, Buttons buttons, int[] vbuff, short[] sbuff, ref int sbuffsize);
|
public static extern bool Advance(IntPtr s, Buttons buttons, int[] vbuff, short[] sbuff, ref int sbuffsize);
|
||||||
|
|
||||||
[DllImport(dllname, CallingConvention = cc)]
|
[DllImport(dllname, CallingConvention = cc)]
|
||||||
public static extern bool GetSaveRamPtr(IntPtr s, out int size, out IntPtr data);
|
public static extern bool GetSaveRamPtr(IntPtr s, out int size, out IntPtr data);
|
||||||
|
|
|
@ -111,8 +111,10 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
LibLynx.Reset(Core);
|
LibLynx.Reset(Core);
|
||||||
|
|
||||||
int samples = soundbuff.Length;
|
int samples = soundbuff.Length;
|
||||||
LibLynx.Advance(Core, GetButtons(), videobuff, soundbuff, ref samples);
|
IsLagFrame = LibLynx.Advance(Core, GetButtons(), videobuff, soundbuff, ref samples);
|
||||||
numsamp = samples / 2; // sound provider wants number of sample pairs
|
numsamp = samples / 2; // sound provider wants number of sample pairs
|
||||||
|
if (IsLagFrame)
|
||||||
|
LagCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Frame { get; private set; }
|
public int Frame { get; private set; }
|
||||||
|
|
|
@ -32,9 +32,9 @@ EXPORT void Reset(CSystem *s)
|
||||||
s->Reset();
|
s->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void Advance(CSystem *s, int buttons, uint32 *vbuff, int16 *sbuff, int *sbuffsize)
|
EXPORT int Advance(CSystem *s, int buttons, uint32 *vbuff, int16 *sbuff, int *sbuffsize)
|
||||||
{
|
{
|
||||||
s->Advance(buttons, vbuff, sbuff, *sbuffsize);
|
return s->Advance(buttons, vbuff, sbuff, *sbuffsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT int GetSaveRamPtr(CSystem *s, int *size, uint8 **data)
|
EXPORT int GetSaveRamPtr(CSystem *s, int *size, uint8 **data)
|
||||||
|
|
|
@ -2076,6 +2076,7 @@ uint8 CSusie::Peek(uint32 addr)
|
||||||
retval= Modified.Byte;
|
retval= Modified.Byte;
|
||||||
}
|
}
|
||||||
// TRACE_SUSIE2("Peek(JOYSTICK)=$%02x at PC=$%04x",retval,mSystem.mCpu->GetPC());
|
// TRACE_SUSIE2("Peek(JOYSTICK)=$%02x at PC=$%04x",retval,mSystem.mCpu->GetPC());
|
||||||
|
lagged = false;
|
||||||
return retval;
|
return retval;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2083,6 +2084,7 @@ uint8 CSusie::Peek(uint32 addr)
|
||||||
case (SWITCHES&0xff):
|
case (SWITCHES&0xff):
|
||||||
retval=mSWITCHES.Byte;
|
retval=mSWITCHES.Byte;
|
||||||
// TRACE_SUSIE2("Peek(SWITCHES)=$%02x at PC=$%04x",retval,mSystem.mCpu->GetPC());
|
// TRACE_SUSIE2("Peek(SWITCHES)=$%02x at PC=$%04x",retval,mSystem.mCpu->GetPC());
|
||||||
|
lagged = false;
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
// Cartridge reading ports
|
// Cartridge reading ports
|
||||||
|
|
|
@ -324,9 +324,10 @@ class CSusie : public CLynxBase
|
||||||
uint32 ObjectSize(void) {return SUSIE_SIZE;};
|
uint32 ObjectSize(void) {return SUSIE_SIZE;};
|
||||||
|
|
||||||
void SetButtonData(uint32 data) {mJOYSTICK.Byte=(uint8)data;mSWITCHES.Byte=(uint8)(data>>8);};
|
void SetButtonData(uint32 data) {mJOYSTICK.Byte=(uint8)data;mSWITCHES.Byte=(uint8)(data>>8);};
|
||||||
uint32 GetButtonData(void) {return mJOYSTICK.Byte+(mSWITCHES.Byte<<8);};
|
// uint32 GetButtonData(void) {return mJOYSTICK.Byte+(mSWITCHES.Byte<<8);};
|
||||||
|
|
||||||
uint32 PaintSprites(void);
|
uint32 PaintSprites(void);
|
||||||
|
bool lagged; // set to false whenever joystick/switches are read
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoMathDivide(void);
|
void DoMathDivide(void);
|
||||||
|
|
|
@ -153,12 +153,13 @@ static int Load(MDFNFILE *fp)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CSystem::Advance(int buttons, uint32 *vbuff, int16 *sbuff, int &sbuffsize)
|
bool CSystem::Advance(int buttons, uint32 *vbuff, int16 *sbuff, int &sbuffsize)
|
||||||
{
|
{
|
||||||
// this check needs to occur at least once every 250 million cycles or better
|
// this check needs to occur at least once every 250 million cycles or better
|
||||||
mMikie->CheckWrap();
|
mMikie->CheckWrap();
|
||||||
|
|
||||||
SetButtonData(buttons);
|
SetButtonData(buttons);
|
||||||
|
mSusie->lagged = true;
|
||||||
|
|
||||||
uint32 start = gSystemCycleCount;
|
uint32 start = gSystemCycleCount;
|
||||||
|
|
||||||
|
@ -183,6 +184,8 @@ void CSystem::Advance(int buttons, uint32 *vbuff, int16 *sbuff, int &sbuffsize)
|
||||||
|
|
||||||
mMikie->mikbuf.end_frame((gSystemCycleCount - start) >> 2);
|
mMikie->mikbuf.end_frame((gSystemCycleCount - start) >> 2);
|
||||||
sbuffsize = mMikie->mikbuf.read_samples(sbuff, sbuffsize);
|
sbuffsize = mMikie->mikbuf.read_samples(sbuff, sbuffsize);
|
||||||
|
|
||||||
|
return mSusie->lagged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Advance(int buttons, uint32 *vbuff, int16 *sbuff, int &sbuffsize);
|
bool Advance(int buttons, uint32 *vbuff, int16 *sbuff, int &sbuffsize);
|
||||||
bool GetSaveRamPtr(int &size, uint8 *&data) { return mCart->GetSaveRamPtr(size, data); }
|
bool GetSaveRamPtr(int &size, uint8 *&data) { return mCart->GetSaveRamPtr(size, data); }
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -192,7 +192,7 @@ public:
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
void SetButtonData(uint32 data) {mSusie->SetButtonData(data);};
|
void SetButtonData(uint32 data) {mSusie->SetButtonData(data);};
|
||||||
uint32 GetButtonData() {return mSusie->GetButtonData();};
|
// uint32 GetButtonData() {return mSusie->GetButtonData();};
|
||||||
uint8* GetRamPointer() {return mRam->GetRamPointer();};
|
uint8* GetRamPointer() {return mRam->GetRamPointer();};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue