[BSNESv115+] Fix Lag Frames For SGB (#2886)

* better lag detection for sgb. todo: might want to toggle this?

* correct logic and don't fail build this time
This commit is contained in:
CasualPokePlayer 2021-08-01 06:54:59 -07:00 committed by GitHub
parent 7518ce962b
commit 036e349337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 6 deletions

Binary file not shown.

View File

@ -146,7 +146,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
public delegate void snes_video_frame_t(ushort* data, int width, int height, int pitch);
public delegate void snes_input_poll_t();
public delegate short snes_input_state_t(int port, int index, int id);
public delegate void snes_no_lag_t();
public delegate void snes_no_lag_t(bool sgb_poll);
public delegate void snes_audio_sample_t(short left, short right);
public delegate string snes_path_request_t(int slot, string hint, bool required);
public delegate void snes_trace_t(string disassembly, string register_info);

View File

@ -295,10 +295,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
return _controllers.CoreInputState(port, index, id);
}
private void snes_no_lag()
private void snes_no_lag(bool sgbPoll)
{
// gets called whenever there was input polled, aka no lag
IsLagFrame = false;
if (!IsSGB || sgbPoll)
{
IsLagFrame = false;
}
}
private readonly int[] palette = new int[32768];

View File

@ -24,6 +24,7 @@ namespace SameBoy {
static auto joyp_write(GB_gameboy_t*, uint8_t value) -> void {
bool p14 = value & 0x10;
bool p15 = value & 0x20;
if (!p14 || !p15) platform->notify("NOTIFY NO_LAG_SGB");
icd.joypWrite(p14, p15);
}

View File

@ -5,7 +5,7 @@
typedef void (*snes_input_poll_t)(void);
typedef int16_t (*snes_input_state_t)(int port, int index, int id);
typedef void (*snes_no_lag_t)(void);
typedef void (*snes_no_lag_t)(bool sgb_poll);
typedef void (*snes_video_frame_t)(const uint16_t* data, int width, int height, int pitch);
typedef void (*snes_audio_sample_t)(int16_t left, int16_t right);
typedef char* (*snes_path_request_t)(int slot, const char* hint, int required);

View File

@ -444,8 +444,10 @@ auto Program::audioFrame(const double* samples, uint channels) -> void
auto Program::notify(string message) -> void
{
if (message == "NOTIFY NO_LAG");
snesCallbacks.snes_no_lag();
if (message == "NOTIFY NO_LAG")
snesCallbacks.snes_no_lag(false);
else if (message == "NOTIFY NO_LAG_SGB")
snesCallbacks.snes_no_lag(true);
}
auto Program::cpuTrace(vector<string> parts) -> void