pizza: add lag/polling support

This commit is contained in:
nattthebear 2017-06-24 09:38:03 -04:00
parent e81d269fbe
commit 6637e0a53f
6 changed files with 17 additions and 5 deletions

View File

@ -102,7 +102,8 @@ namespace BizHawk.Client.ApiHawk
case "VB":
case "NGP":
case "DNGP":
case "O2":
case "O2":
case "SGB":
return 0; // like I give a shit
default:

View File

@ -21,12 +21,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy
public Pizza(byte[] rom, CoreComm comm)
:base(comm, new Configuration
{
DefaultWidth = 160,
DefaultHeight = 144,
DefaultWidth = 256,
DefaultHeight = 224,
MaxWidth = 256,
MaxHeight = 224,
MaxSamples = 1024,
SystemId = "GB",
SystemId = "SGB",
DefaultFpsNumerator = TICKSPERSECOND,
DefaultFpsDenominator = TICKSPERFRAME
})

View File

@ -29,6 +29,8 @@ char global_cpu_double_speed;
char global_debug;
char global_rumble;
char global_window; // if true, show window
int global_lagged;
void (*global_input_callback)(void);
void global_init()
{
@ -38,5 +40,7 @@ void global_init()
global_sgb = 0;
global_cpu_double_speed = 0;
global_rumble = 0;
global_lagged = 0;
global_input_callback = NULL;
sprintf(global_cart_name, "NOCARTIRDGE");
}

View File

@ -28,6 +28,8 @@ extern char global_sgb;
extern char global_cpu_double_speed;
extern char global_rumble;
extern char global_cart_name[256];
extern int global_lagged;
extern void (*global_input_callback)(void);
/* prototypes */
void global_init();

View File

@ -250,6 +250,9 @@ uint8_t mmu_read(uint16_t a)
/* joypad reading */
case 0xFF00:
global_lagged = 0;
if (global_input_callback)
global_input_callback();
return global_sgb ? sgb_read_ff00(cycles.sampleclock) : input_get_keys(mmu.memory[a]);
/* CGB HDMA transfer */

View File

@ -106,6 +106,7 @@ EXPORT void FrameAdvance(MyFrameInfo *frame)
else
input_set_keys(frame->Keys);
current_vbuff = frame->VideoBuffer;
global_lagged = 1;
uint64_t current = cycles.sampleclock;
uint64_t target = current + 35112 - overflow;
@ -125,6 +126,7 @@ EXPORT void FrameAdvance(MyFrameInfo *frame)
frame->Width = 160;
frame->Height = 144;
}
frame->Lagged = global_lagged;
current_vbuff = NULL;
}
@ -135,7 +137,7 @@ EXPORT int IsCGB(void)
EXPORT void SetInputCallback(void (*callback)(void))
{
// TODO
global_input_callback = callback;
}
EXPORT void GetMemoryAreas(MemoryArea *m)