[GTK3] Add vram_viewer_clear()
This commit is contained in:
parent
f74b1cd3d9
commit
6a15ff582e
13
gtk3/main.c
13
gtk3/main.c
@ -1716,18 +1716,7 @@ static void close_rom(void) {
|
||||
gtk_gl_area_queue_render(gui_data.gl_area);
|
||||
}
|
||||
|
||||
// Clear the VRAM viewer
|
||||
// g_mutex_lock(&gui_data.tileset_buffer_mutex);
|
||||
// memset(gui_data.tileset_buffer, 0, sizeof gui_data.tileset_buffer);
|
||||
// g_mutex_unlock(&gui_data.tileset_buffer_mutex);
|
||||
|
||||
// g_mutex_lock(&gui_data.tilemap_buffer_mutex);
|
||||
// memset(gui_data.tilemap_buffer, 0, sizeof gui_data.tilemap_buffer);
|
||||
// g_mutex_unlock(&gui_data.tilemap_buffer_mutex);
|
||||
|
||||
gtk_stack_set_visible_child_name(builder_get(GTK_STACK, "vram_viewer_stack"), "vram_viewer_tileset");
|
||||
gtk_tree_view_set_model(builder_get(GTK_TREE_VIEW, "vram_viewer_sprites"), NULL);
|
||||
gtk_tree_view_set_model(builder_get(GTK_TREE_VIEW, "vram_viewer_palettes"), NULL);
|
||||
vram_viewer_clear(gui_data.vram_viewer);
|
||||
|
||||
// Redraw the VRAM viewer
|
||||
gtk_widget_queue_draw(GTK_WIDGET(gui_data.vram_viewer));
|
||||
|
@ -375,7 +375,7 @@ static gboolean update_sprite_list(VramViewerWindow *window) {
|
||||
GtkListStore *store;
|
||||
|
||||
if (!model) {
|
||||
g_autoptr(GtkListStore) new_store = gtk_list_store_new(7,
|
||||
GtkListStore *new_store = gtk_list_store_new(7,
|
||||
GDK_TYPE_PIXBUF, // Preview image
|
||||
G_TYPE_STRING, // X position
|
||||
G_TYPE_STRING, // Y position
|
||||
@ -477,7 +477,7 @@ static gboolean update_palettes(VramViewerWindow *window) {
|
||||
GtkListStore *store;
|
||||
|
||||
if (!model) {
|
||||
g_autoptr(GtkListStore) new_store = gtk_list_store_new(9,
|
||||
GtkListStore *new_store = gtk_list_store_new(9,
|
||||
G_TYPE_STRING, // Name
|
||||
|
||||
G_TYPE_STRING, // Color 0 string
|
||||
@ -613,4 +613,17 @@ void vram_viewer_update(VramViewerWindow *window, GB_gameboy_t *gb) {
|
||||
|
||||
g_idle_add((GSourceFunc) update_palettes, window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vram_viewer_clear(VramViewerWindow *window) {
|
||||
g_idle_remove_by_data(window);
|
||||
|
||||
memset(window->tilemap_buffer, 0, tilemap_buffer_length * sizeof(uint32_t));
|
||||
memset(window->tileset_buffer, 0, tileset_buffer_length * sizeof(uint32_t));
|
||||
|
||||
g_autoptr(GtkTreeModel) sprites_model = gtk_tree_view_get_model(window->sprites);
|
||||
if (sprites_model) gtk_list_store_clear(GTK_LIST_STORE(sprites_model));
|
||||
|
||||
g_autoptr(GtkTreeModel) palettes_model = gtk_tree_view_get_model(window->palettes);
|
||||
if (palettes_model) gtk_list_store_clear(GTK_LIST_STORE(palettes_model));
|
||||
}
|
||||
|
@ -26,5 +26,6 @@ uint32_t *vram_viewer_get_tileset_buffer(VramViewerWindow *window);
|
||||
uint32_t *vram_viewer_get_tilemap_buffer(VramViewerWindow *window);
|
||||
|
||||
void vram_viewer_update(VramViewerWindow *window, GB_gameboy_t *gb);
|
||||
void vram_viewer_clear(VramViewerWindow *window);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user