Merge branch 'master' into sdl_gui

This commit is contained in:
Lior Halphon 2017-12-22 22:26:16 +02:00
commit 3f9d62ceee
3 changed files with 15 additions and 7 deletions

View File

@ -279,7 +279,7 @@ uint32_t GB_convert_rgb15(GB_gameboy_t *gb, uint16_t color)
void GB_palette_changed(GB_gameboy_t *gb, bool background_palette, uint8_t index)
{
if (!gb->rgb_encode_callback) return;
if (!gb->rgb_encode_callback || !gb->is_cgb) return;
uint8_t *palette_data = background_palette? gb->background_palettes_data : gb->sprite_palettes_data;
uint16_t color = palette_data[index & ~1] | (palette_data[index | 1] << 8);
@ -289,9 +289,11 @@ void GB_palette_changed(GB_gameboy_t *gb, bool background_palette, uint8_t index
void GB_set_color_correction_mode(GB_gameboy_t *gb, GB_color_correction_mode_t mode)
{
gb->color_correction_mode = mode;
for (unsigned i = 0; i < 32; i++) {
GB_palette_changed(gb, false, i * 2);
GB_palette_changed(gb, true, i * 2);
if (gb->is_cgb) {
for (unsigned i = 0; i < 32; i++) {
GB_palette_changed(gb, false, i * 2);
GB_palette_changed(gb, true, i * 2);
}
}
}

View File

@ -303,6 +303,11 @@ int GB_load_state_from_buffer(GB_gameboy_t *gb, const uint8_t *buffer, size_t le
gb->rumble_callback(gb, gb->rumble_state);
}
for (unsigned i = 0; i < 32; i++) {
GB_palette_changed(gb, false, i * 2);
GB_palette_changed(gb, true, i * 2);
}
return 0;
}

View File

@ -1064,7 +1064,7 @@ static void ld_a_da16(GB_gameboy_t *gb, uint8_t opcode)
static void di(GB_gameboy_t *gb, uint8_t opcode)
{
/* DI is NOT delayed, not even on a CGB. Mooneye's di_timing-GS test fails on a CGB
for different reasons.*/
for different reasons. */
GB_advance_cycles(gb, 4);
gb->ime = false;
}
@ -1073,8 +1073,9 @@ static void ei(GB_gameboy_t *gb, uint8_t opcode)
{
/* ei is actually "disable interrupts for one instruction, then enable them". */
GB_advance_cycles(gb, 4);
gb->ime = false;
gb->ime_toggle = true;
if (!gb->ime && !gb->ime_toggle) {
gb->ime_toggle = true;
}
}
static void ld_hl_sp_r8(GB_gameboy_t *gb, uint8_t opcode)