Allow hiding background/object "layers" (#422)
This commit is contained in:
parent
f78fac12c2
commit
c1ae129ed4
@ -1043,6 +1043,13 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
else if ([anItem action] == @selector(toggleCheats:)) {
|
else if ([anItem action] == @selector(toggleCheats:)) {
|
||||||
[(NSMenuItem*)anItem setState:GB_cheats_enabled(&gb)];
|
[(NSMenuItem*)anItem setState:GB_cheats_enabled(&gb)];
|
||||||
}
|
}
|
||||||
|
else if ([anItem action] == @selector(toggleDisplayBackground:)) {
|
||||||
|
[(NSMenuItem*)anItem setState:!GB_is_background_rendering_disabled(&gb)];
|
||||||
|
}
|
||||||
|
else if ([anItem action] == @selector(toggleDisplayObjects:)) {
|
||||||
|
[(NSMenuItem*)anItem setState:!GB_is_object_rendering_disabled(&gb)];
|
||||||
|
}
|
||||||
|
|
||||||
return [super validateUserInterfaceItem:anItem];
|
return [super validateUserInterfaceItem:anItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2307,4 +2314,14 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
[self.osdView displayText:@"Screenshot copied"];
|
[self.osdView displayText:@"Screenshot copied"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)toggleDisplayBackground:(id)sender
|
||||||
|
{
|
||||||
|
GB_set_background_rendering_disabled(&gb, !GB_is_background_rendering_disabled(&gb));
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)toggleDisplayObjects:(id)sender
|
||||||
|
{
|
||||||
|
GB_set_object_rendering_disabled(&gb, !GB_is_object_rendering_disabled(&gb));
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -456,6 +456,19 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
<menuItem isSeparatorItem="YES" id="M6n-8G-LZS"/>
|
<menuItem isSeparatorItem="YES" id="M6n-8G-LZS"/>
|
||||||
|
<menuItem title="Show Background and Window" state="on" id="yfD-Qd-zoz">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="toggleDisplayBackground:" target="-1" id="p5b-1n-SPR"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Show Objects" state="on" id="OWx-a0-vQk">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="toggleDisplayObjects:" target="-1" id="8ie-ey-739"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="afI-BR-65k"/>
|
||||||
<menuItem title="Show Memory" id="UIa-n7-LSa">
|
<menuItem title="Show Memory" id="UIa-n7-LSa">
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<connections>
|
<connections>
|
||||||
|
@ -522,8 +522,8 @@ static uint8_t data_for_tile_sel_glitch(GB_gameboy_t *gb, bool *should_use, bool
|
|||||||
|
|
||||||
static void render_pixel_if_possible(GB_gameboy_t *gb)
|
static void render_pixel_if_possible(GB_gameboy_t *gb)
|
||||||
{
|
{
|
||||||
GB_fifo_item_t *fifo_item = NULL;
|
const GB_fifo_item_t *fifo_item = NULL;
|
||||||
GB_fifo_item_t *oam_fifo_item = NULL;
|
const GB_fifo_item_t *oam_fifo_item = NULL;
|
||||||
bool draw_oam = false;
|
bool draw_oam = false;
|
||||||
bool bg_enabled = true, bg_priority = false;
|
bool bg_enabled = true, bg_priority = false;
|
||||||
|
|
||||||
@ -533,7 +533,7 @@ static void render_pixel_if_possible(GB_gameboy_t *gb)
|
|||||||
|
|
||||||
if (fifo_size(&gb->oam_fifo)) {
|
if (fifo_size(&gb->oam_fifo)) {
|
||||||
oam_fifo_item = fifo_pop(&gb->oam_fifo);
|
oam_fifo_item = fifo_pop(&gb->oam_fifo);
|
||||||
if (oam_fifo_item->pixel && (gb->io_registers[GB_IO_LCDC] & 2)) {
|
if (oam_fifo_item->pixel && (gb->io_registers[GB_IO_LCDC] & 2) && unlikely(!gb->objects_disabled)) {
|
||||||
draw_oam = true;
|
draw_oam = true;
|
||||||
bg_priority |= oam_fifo_item->bg_priority;
|
bg_priority |= oam_fifo_item->bg_priority;
|
||||||
}
|
}
|
||||||
@ -559,6 +559,12 @@ static void render_pixel_if_possible(GB_gameboy_t *gb)
|
|||||||
bg_enabled = false;
|
bg_enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlikely(gb->background_disabled)) {
|
||||||
|
bg_enabled = false;
|
||||||
|
static const GB_fifo_item_t empty_item = {0,};
|
||||||
|
fifo_item = &empty_item;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t icd_pixel = 0;
|
uint8_t icd_pixel = 0;
|
||||||
uint32_t *dest = NULL;
|
uint32_t *dest = NULL;
|
||||||
@ -1624,3 +1630,24 @@ bool GB_is_odd_frame(GB_gameboy_t *gb)
|
|||||||
{
|
{
|
||||||
return gb->is_odd_frame;
|
return gb->is_odd_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GB_set_object_rendering_disabled(GB_gameboy_t *gb, bool disabled)
|
||||||
|
{
|
||||||
|
gb->objects_disabled = disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GB_set_background_rendering_disabled(GB_gameboy_t *gb, bool disabled)
|
||||||
|
{
|
||||||
|
gb->background_disabled = disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GB_is_object_rendering_disabled(GB_gameboy_t *gb)
|
||||||
|
{
|
||||||
|
return gb->objects_disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GB_is_background_rendering_disabled(GB_gameboy_t *gb)
|
||||||
|
{
|
||||||
|
return gb->background_disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -61,4 +61,11 @@ uint32_t GB_convert_rgb15(GB_gameboy_t *gb, uint16_t color, bool for_border);
|
|||||||
void GB_set_color_correction_mode(GB_gameboy_t *gb, GB_color_correction_mode_t mode);
|
void GB_set_color_correction_mode(GB_gameboy_t *gb, GB_color_correction_mode_t mode);
|
||||||
void GB_set_light_temperature(GB_gameboy_t *gb, double temperature);
|
void GB_set_light_temperature(GB_gameboy_t *gb, double temperature);
|
||||||
bool GB_is_odd_frame(GB_gameboy_t *gb);
|
bool GB_is_odd_frame(GB_gameboy_t *gb);
|
||||||
|
|
||||||
|
void GB_set_object_rendering_disabled(GB_gameboy_t *gb, bool disabled);
|
||||||
|
void GB_set_background_rendering_disabled(GB_gameboy_t *gb, bool disabled);
|
||||||
|
bool GB_is_object_rendering_disabled(GB_gameboy_t *gb);
|
||||||
|
bool GB_is_background_rendering_disabled(GB_gameboy_t *gb);
|
||||||
|
|
||||||
|
|
||||||
#endif /* display_h */
|
#endif /* display_h */
|
||||||
|
@ -630,6 +630,8 @@ struct GB_gameboy_internal_s {
|
|||||||
GB_sgb_border_t borrowed_border;
|
GB_sgb_border_t borrowed_border;
|
||||||
bool tried_loading_sgb_border;
|
bool tried_loading_sgb_border;
|
||||||
bool has_sgb_border;
|
bool has_sgb_border;
|
||||||
|
bool objects_disabled;
|
||||||
|
bool background_disabled;
|
||||||
|
|
||||||
/* Timing */
|
/* Timing */
|
||||||
uint64_t last_sync;
|
uint64_t last_sync;
|
||||||
|
Loading…
Reference in New Issue
Block a user