[GTK3] Handle VRAM viewer tilemap and -set options
This commit is contained in:
parent
6090bbf384
commit
d75a261663
61
gtk3/main.c
61
gtk3/main.c
@ -1015,15 +1015,60 @@ static void vblank(GB_gameboy_t *gb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vram_viewer_visible) {
|
if (vram_viewer_visible) {
|
||||||
// TODO: Only update what is needed
|
const gchar *active = gtk_stack_get_visible_child_name(builder_get(GTK_STACK, "vram_viewer_stack"));
|
||||||
GB_draw_tileset(gb, tileset_buffer, GB_PALETTE_NONE, 0);
|
|
||||||
GB_draw_tilemap(gb, tilemap_buffer, GB_PALETTE_AUTO, 0, GB_MAP_AUTO, GB_TILESET_AUTO);
|
|
||||||
|
|
||||||
scrollRect = (Rect){
|
if (g_strcmp0("vram_viewer_tileset", active) == 0) {
|
||||||
GB_read_memory(gb, 0xFF00 | GB_IO_SCX),
|
const gchar *palette_id = gtk_combo_box_get_active_id(builder_get(GTK_COMBO_BOX, "vram_viewer_tileset_palette_selector"));
|
||||||
GB_read_memory(gb, 0xFF00 | GB_IO_SCY),
|
|
||||||
160, 144
|
GB_palette_type_t palette_type = g_str_has_prefix(palette_id, "bg")? GB_PALETTE_BACKGROUND : GB_PALETTE_OAM;
|
||||||
};
|
uint8_t palette_index = g_ascii_digit_value(palette_id[palette_type == GB_PALETTE_OAM ? 3 : 2]);
|
||||||
|
|
||||||
|
GB_draw_tileset(gb, tileset_buffer,
|
||||||
|
palette_type,
|
||||||
|
palette_index
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (g_strcmp0("vram_viewer_tilemap", active) == 0) {
|
||||||
|
const gchar *palette_id = gtk_combo_box_get_active_id(builder_get(GTK_COMBO_BOX, "vram_viewer_tilemap_palette_selector"));
|
||||||
|
uint8_t palette_index = 0;
|
||||||
|
GB_palette_type_t palette_type = GB_PALETTE_AUTO;
|
||||||
|
|
||||||
|
if (g_strcmp0("auto", palette_id) != 0) {
|
||||||
|
palette_type = g_str_has_prefix(palette_id, "bg")? GB_PALETTE_BACKGROUND : GB_PALETTE_OAM;
|
||||||
|
palette_index = g_ascii_digit_value(palette_id[palette_type == GB_PALETTE_OAM ? 3 : 2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
GB_map_type_t map_type = GB_MAP_AUTO;
|
||||||
|
const gchar *map_type_id = gtk_combo_box_get_active_id(builder_get(GTK_COMBO_BOX, "vram_viewer_tilemap_tilemap_selector"));
|
||||||
|
if (g_strcmp0("auto", map_type_id) != 0) {
|
||||||
|
map_type = (g_strcmp0("9800", map_type_id) == 0)? GB_MAP_9800 : GB_MAP_9C00;
|
||||||
|
}
|
||||||
|
|
||||||
|
GB_tileset_type_t tileset_type = GB_TILESET_AUTO;
|
||||||
|
const gchar *tileset_type_id = gtk_combo_box_get_active_id(builder_get(GTK_COMBO_BOX, "vram_viewer_tilemap_tileset_selector"));
|
||||||
|
if (g_strcmp0("auto", tileset_type_id) != 0) {
|
||||||
|
tileset_type = (g_strcmp0("8800", tileset_type_id) == 0)? GB_TILESET_8800 : GB_TILESET_8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
GB_draw_tilemap(gb, tilemap_buffer,
|
||||||
|
palette_type,
|
||||||
|
palette_index,
|
||||||
|
map_type,
|
||||||
|
tileset_type
|
||||||
|
);
|
||||||
|
|
||||||
|
scrollRect = (Rect){
|
||||||
|
GB_read_memory(gb, 0xFF00 | GB_IO_SCX),
|
||||||
|
GB_read_memory(gb, 0xFF00 | GB_IO_SCY),
|
||||||
|
160, 144
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if (g_strcmp0("vram_viewer_sprites", active) == 0) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (g_strcmp0("vram_viewer_palettes", active) == 0) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Queue a redraw of the VRAM viewer
|
// Queue a redraw of the VRAM viewer
|
||||||
gtk_widget_queue_draw(GTK_WIDGET(vram_viewer));
|
gtk_widget_queue_draw(GTK_WIDGET(vram_viewer));
|
||||||
|
@ -1203,7 +1203,6 @@ Maximilian Mader https://github.com/max-m</property>
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="active">0</property>
|
<property name="active">0</property>
|
||||||
<property name="tearoff_title" translatable="yes">fgngfn</property>
|
|
||||||
<property name="active_id">bg0</property>
|
<property name="active_id">bg0</property>
|
||||||
<items>
|
<items>
|
||||||
<item id="bg0" translatable="yes">Background Palette 0</item>
|
<item id="bg0" translatable="yes">Background Palette 0</item>
|
||||||
@ -1289,7 +1288,7 @@ Maximilian Mader https://github.com/max-m</property>
|
|||||||
<property name="margin_right">6</property>
|
<property name="margin_right">6</property>
|
||||||
<property name="spacing">3</property>
|
<property name="spacing">3</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBoxText">
|
<object class="GtkComboBoxText" id="vram_viewer_tilemap_palette_selector">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="active">0</property>
|
<property name="active">0</property>
|
||||||
@ -1323,7 +1322,7 @@ Maximilian Mader https://github.com/max-m</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBoxText">
|
<object class="GtkComboBoxText" id="vram_viewer_tilemap_tilemap_selector">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="active">0</property>
|
<property name="active">0</property>
|
||||||
@ -1373,7 +1372,7 @@ Maximilian Mader https://github.com/max-m</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBoxText">
|
<object class="GtkComboBoxText" id="vram_viewer_tilemap_tileset_selector">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="active">0</property>
|
<property name="active">0</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user