GBHawk; more minor cleanups

This commit is contained in:
alyosha-tas 2020-03-31 17:58:25 -04:00
parent ea085255c1
commit 5f24392b41
3 changed files with 49 additions and 85 deletions

View File

@ -58,7 +58,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkNew
_islag = true;
do_frame(controller);
_islag = do_frame(controller);
if (_islag)
{
@ -68,11 +68,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkNew
return true;
}
public void do_frame(IController controller)
public bool do_frame(IController controller)
{
LibGBHawk.GB_frame_advance(GB_Pntr, _controllerDeck.ReadPort1(controller),
_controllerDeck.ReadAccX1(controller),
_controllerDeck.ReadAccY1(controller), true, true);
return LibGBHawk.GB_frame_advance(GB_Pntr, _controllerDeck.ReadPort1(controller),
_controllerDeck.ReadAccX1(controller),
_controllerDeck.ReadAccY1(controller), true, true);
}
public void do_single_step()

View File

@ -231,6 +231,11 @@ namespace GBHawk
saver = int_array_saver(vidbuffer, saver, 160 * 144);
saver = int_array_saver(frame_buffer, saver, 160 * 144);
if (Cart_RAM_Length != 0)
{
saver = byte_array_saver(Cart_RAM, saver, Cart_RAM_Length);
}
return saver;
}
@ -287,6 +292,11 @@ namespace GBHawk
loader = int_array_loader(vidbuffer, loader, 160 * 144);
loader = int_array_loader(frame_buffer, loader, 160 * 144);
if (Cart_RAM_Length != 0)
{
loader = byte_array_loader(Cart_RAM, loader, Cart_RAM_Length);
}
return loader;
}

View File

@ -20,9 +20,6 @@ namespace GBHawk
MemoryManager* mem_ctrl;
// not stated
int temp_tile;
// pointers not stated
bool* FlagI = nullptr;
bool* in_vblank = nullptr;
@ -183,52 +180,34 @@ namespace GBHawk
uint8_t HDMA_ctrl() { return (uint8_t)(((HDMA_active ? 0 : 1) << 7) | ((HDMA_length >> 4) - 1)); }
virtual uint8_t ReadReg(uint32_t addr)
virtual uint8_t ReadReg(uint32_t addr) { return 0; }
virtual void WriteReg(uint32_t addr, uint8_t value) { }
virtual void tick() { }
virtual void latch_delay() { }
virtual void render(uint32_t render_cycle) { }
virtual void process_sprite() { }
virtual void OAM_scan(uint32_t OAM_cycle) { }
virtual void Reset() { }
virtual void reorder_and_assemble_sprites() { }
uint8_t BG_PAL_read()
{
return 0;
}
virtual void WriteReg(uint32_t addr, uint8_t value)
{
}
virtual void tick()
{
}
// might be needed, not sure yet
virtual void latch_delay()
{
}
virtual void render(uint32_t render_cycle)
{
}
virtual void process_sprite()
{
}
virtual void OAM_scan(uint32_t OAM_cycle)
{
}
virtual void Reset()
{
}
// order sprites according to x coordinate
// note that for sprites of equal x coordinate, priority goes to first on the list
virtual void reorder_and_assemble_sprites()
{
if (VRAM_access_read)
{
return BG_bytes[BG_bytes_index];
}
else
{
return 0xFF;
}
}
void color_compute_BG()
@ -887,7 +866,6 @@ namespace GBHawk
STAT &= 0xFC;
// also the LCD doesn't turn on right away
// also, the LCD does not enter mode 2 on scanline 0 when first turned on
no_scan = true;
cycle = 8;
@ -1306,7 +1284,7 @@ namespace GBHawk
}
// based on sprite priority and pixel values, pick a final pixel color
_vidbuffer[LY * 160 + pixel_counter] = (uint32_t)color_palette[pixel];
_vidbuffer[LY * 160 + pixel_counter] = color_palette[pixel];
pixel_counter++;
@ -1935,18 +1913,6 @@ namespace GBHawk
return ret;
}
uint8_t BG_PAL_read()
{
if (VRAM_access_read)
{
return BG_bytes[BG_bytes_index];
}
else
{
return 0xFF;
}
}
void WriteReg(uint32_t addr, uint8_t value)
{
switch (addr)
@ -2716,11 +2682,11 @@ namespace GBHawk
// based on sprite priority and pixel values, pick a final pixel color
if (use_sprite)
{
_vidbuffer[LY * 160 + pixel_counter] = (int)OBJ_palette[pal_num * 4 + s_pixel];
_vidbuffer[LY * 160 + pixel_counter] = OBJ_palette[pal_num * 4 + s_pixel];
}
else
{
_vidbuffer[LY * 160 + pixel_counter] = (int)BG_palette[pal_num * 4 + pixel];
_vidbuffer[LY * 160 + pixel_counter] = BG_palette[pal_num * 4 + pixel];
}
pixel_counter++;
@ -3405,18 +3371,6 @@ namespace GBHawk
return ret;
}
uint8_t BG_PAL_read()
{
if (VRAM_access_read)
{
return BG_bytes[BG_bytes_index];
}
else
{
return 0xFF;
}
}
void WriteReg(uint32_t addr, uint8_t value)
{
switch (addr)
@ -4209,22 +4163,22 @@ namespace GBHawk
{
if (use_sprite)
{
_vidbuffer[LY * 160 + pixel_counter] = (uint32_t)OBJ_palette[pal_num * 4 + s_pixel];
_vidbuffer[LY * 160 + pixel_counter] = OBJ_palette[pal_num * 4 + s_pixel];
}
else
{
_vidbuffer[LY * 160 + pixel_counter] = (uint32_t)BG_palette[pal_num * 4 + pixel];
_vidbuffer[LY * 160 + pixel_counter] = BG_palette[pal_num * 4 + pixel];
}
}
else
{
if (use_sprite)
{
_vidbuffer[LY * 160 + pixel_counter] = (uint32_t)OBJ_palette[pal_num * 4 + pixel];
_vidbuffer[LY * 160 + pixel_counter] = OBJ_palette[pal_num * 4 + pixel];
}
else
{
_vidbuffer[LY * 160 + pixel_counter] = (uint32_t)BG_palette[pixel];
_vidbuffer[LY * 160 + pixel_counter] = BG_palette[pixel];
}
}