wire up reset button for tic80 and make biz_time_rm tick post frame

This commit is contained in:
CasualPokePlayer 2022-06-16 15:56:34 -07:00
parent cb3bd6af72
commit 170ea47464
4 changed files with 13 additions and 2 deletions

Binary file not shown.

View File

@ -117,6 +117,7 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
{ {
public long Time; public long Time;
public bool Crop; public bool Crop;
public bool Reset;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]

View File

@ -111,6 +111,8 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
ret.CategoryLabels[name] = "Keyboard"; ret.CategoryLabels[name] = "Keyboard";
} }
ret.BoolButtons.Add("Reset");
return ret.MakeImmutable(); return ret.MakeImmutable();
} }
@ -199,7 +201,8 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
return new LibTIC80.FrameInfo return new LibTIC80.FrameInfo
{ {
Time = GetRtcTime(!DeterministicEmulation), Time = GetRtcTime(!DeterministicEmulation),
Crop = _settings.Crop Crop = _settings.Crop,
Reset = controller.IsPressed("Reset"),
}; };
} }
} }

View File

@ -66,6 +66,7 @@ typedef struct
FrameInfo b; FrameInfo b;
u64 time; u64 time;
bool crop; bool crop;
bool reset;
} MyFrameInfo; } MyFrameInfo;
bool lagged; bool lagged;
@ -73,9 +74,13 @@ void (*inputcb)() = 0;
ECL_EXPORT void FrameAdvance(MyFrameInfo* f) ECL_EXPORT void FrameAdvance(MyFrameInfo* f)
{ {
if (f->reset)
{
tic_api_reset((tic_mem*)tic);
}
lagged = true; lagged = true;
biz_time = f->time; biz_time = f->time;
biz_clock_rm = (biz_clock_rm + 1) % 60;
tic80_tick(tic, biz_inputs); tic80_tick(tic, biz_inputs);
tic80_sound(tic); tic80_sound(tic);
@ -111,6 +116,8 @@ ECL_EXPORT void FrameAdvance(MyFrameInfo* f)
f->b.Height = height; f->b.Height = height;
f->b.Lagged = lagged; f->b.Lagged = lagged;
biz_clock_rm = (biz_clock_rm + 1) % 60;
} }
ECL_EXPORT void SetInputCallback(void (*callback)()) ECL_EXPORT void SetInputCallback(void (*callback)())