[GTK3] Convert to structured logging
This commit is contained in:
parent
5b60b9654b
commit
38dc547018
2
Makefile
2
Makefile
@ -108,7 +108,7 @@ ifneq ($(findstring gtk3,$(MAKECMDGOALS)),)
|
|||||||
$(error The gtk3 target requires pkg-config)
|
$(error The gtk3 target requires pkg-config)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
GTK3_CFLAGS := $(shell $(PKG_CONFIG) --cflags gio-2.0 gtk+-3.0 epoxy sdl2) -DGTK_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1 -DRESOURCE_PREFIX=\"/io/github/sameboy/\" -DAPP_ID=\"io.github.sameboy\"
|
GTK3_CFLAGS := $(shell $(PKG_CONFIG) --cflags gio-2.0 gtk+-3.0 epoxy sdl2) -DGTK_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1 -DG_LOG_DOMAIN=\"SameBoy\" -DRESOURCE_PREFIX=\"/io/github/sameboy/\" -DAPP_ID=\"io.github.sameboy\"
|
||||||
GTK3_LDFLAGS := $(shell $(PKG_CONFIG) --libs gio-2.0 gtk+-3.0 epoxy sdl2)
|
GTK3_LDFLAGS := $(shell $(PKG_CONFIG) --libs gio-2.0 gtk+-3.0 epoxy sdl2)
|
||||||
|
|
||||||
# TODO: REMOVE DISABLE UNUSED WARNINGS
|
# TODO: REMOVE DISABLE UNUSED WARNINGS
|
||||||
|
85
gtk3/main.c
85
gtk3/main.c
@ -133,7 +133,7 @@ static gint handle_local_options(GApplication *app, GVariantDict *options, gpoin
|
|||||||
guint32 count;
|
guint32 count;
|
||||||
|
|
||||||
if (g_variant_dict_lookup(options, "version", "b", &count)) {
|
if (g_variant_dict_lookup(options, "version", "b", &count)) {
|
||||||
g_print("SameBoy v" xstr(VERSION) "\n");
|
g_message("SameBoy v" xstr(VERSION));
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ static gint handle_local_options(GApplication *app, GVariantDict *options, gpoin
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gui_data->cli_options.model = GB_MODEL_DMG_B;
|
gui_data->cli_options.model = GB_MODEL_DMG_B;
|
||||||
g_printerr("Unsupported revision: %s\nFalling back to DMG-B", model_name);
|
g_warning("Unsupported revision: %s\nFalling back to DMG-B", model_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_str_has_prefix(model_name, "SGB")) {
|
else if (g_str_has_prefix(model_name, "SGB")) {
|
||||||
@ -168,7 +168,7 @@ static gint handle_local_options(GApplication *app, GVariantDict *options, gpoin
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gui_data->cli_options.model = GB_MODEL_SGB2;
|
gui_data->cli_options.model = GB_MODEL_SGB2;
|
||||||
g_printerr("Unsupported revision: %s\nFalling back to SGB2", model_name);
|
g_warning("Unsupported revision: %s\nFalling back to SGB2", model_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_str_has_prefix(model_name, "CGB")) {
|
else if (g_str_has_prefix(model_name, "CGB")) {
|
||||||
@ -180,14 +180,14 @@ static gint handle_local_options(GApplication *app, GVariantDict *options, gpoin
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gui_data->cli_options.model = GB_MODEL_CGB_E;
|
gui_data->cli_options.model = GB_MODEL_CGB_E;
|
||||||
g_printerr("Unsupported revision: %s\nFalling back to CGB-E", model_name);
|
g_warning("Unsupported revision: %s\nFalling back to CGB-E", model_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_str_has_prefix(model_name, "AGB")) {
|
else if (g_str_has_prefix(model_name, "AGB")) {
|
||||||
gui_data->cli_options.model = GB_MODEL_AGB;
|
gui_data->cli_options.model = GB_MODEL_AGB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_printerr("Unknown model: %s\n", model_name);
|
g_warning("Unknown model: %s", model_name);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ void gl_check_realize(GtkWidget *w, gpointer user_data_gptr) {
|
|||||||
GdkGLContext *context = gdk_window_create_gl_context(gdk_window, &error);
|
GdkGLContext *context = gdk_window_create_gl_context(gdk_window, &error);
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
g_printerr("Failed to create context: %s\n", error->message);
|
g_warning("Failed to create context: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
*result = FALSE;
|
*result = FALSE;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ void gl_check_realize(GtkWidget *w, gpointer user_data_gptr) {
|
|||||||
|
|
||||||
gdk_gl_context_clear_current();
|
gdk_gl_context_clear_current();
|
||||||
|
|
||||||
g_print("OpenGL version: %d\n", version);
|
g_debug("OpenGL version: %d", version);
|
||||||
|
|
||||||
*result = version >= 32;
|
*result = version >= 32;
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ void gl_check_realize(GtkWidget *w, gpointer user_data_gptr) {
|
|||||||
|
|
||||||
static gboolean init_controllers() {
|
static gboolean init_controllers() {
|
||||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) < 0) {
|
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) < 0) {
|
||||||
g_print("Failed to initialize game controller support: %s\n", SDL_GetError());
|
g_warning("Failed to initialize game controller support: %s", SDL_GetError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ static gboolean init_controllers() {
|
|||||||
const gint val = SDL_GameControllerAddMappingsFromRW(SDL_RWFromMem((void *)db_data, db_data_size), 1);
|
const gint val = SDL_GameControllerAddMappingsFromRW(SDL_RWFromMem((void *)db_data, db_data_size), 1);
|
||||||
|
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
g_warning("Failed to load controller mappings: %s\n", SDL_GetError());
|
g_warning("Failed to load controller mappings: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bytes_unref(db_f);
|
g_bytes_unref(db_f);
|
||||||
@ -274,7 +274,7 @@ static gboolean init_controllers() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_warning("Could not open gamecontroller %i: %s\n", i, SDL_GetError());
|
g_warning("Could not open gamecontroller %i: %s", i, SDL_GetError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ static gboolean init_audio() {
|
|||||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||||
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
|
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
|
||||||
g_print("Failed to initialize audio: %s\n", SDL_GetError());
|
g_warning("Failed to initialize audio: %s", SDL_GetError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ static gboolean init_audio() {
|
|||||||
|
|
||||||
device_id = SDL_OpenAudioDevice(0, 0, &want_aspec, &have_aspec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_SAMPLES_CHANGE);
|
device_id = SDL_OpenAudioDevice(0, 0, &want_aspec, &have_aspec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_SAMPLES_CHANGE);
|
||||||
|
|
||||||
g_print("Requested Sample Rate: %d Hz\nUsed Sample Rate: %d Hz\n", want_aspec.freq, have_aspec.freq);
|
g_debug("Requested Sample Rate: %d Hz\nUsed Sample Rate: %d Hz", want_aspec.freq, have_aspec.freq);
|
||||||
|
|
||||||
SDL_PauseAudioDevice(device_id, audio_playing? 0 : 1);
|
SDL_PauseAudioDevice(device_id, audio_playing? 0 : 1);
|
||||||
GB_set_sample_rate(&gb, have_aspec.freq);
|
GB_set_sample_rate(&gb, have_aspec.freq);
|
||||||
@ -491,7 +491,7 @@ static void setup_menu(GApplication *app) {
|
|||||||
if (desktop == NULL || g_str_equal(desktop, "")) desktop = (gchar *)gdm_session;
|
if (desktop == NULL || g_str_equal(desktop, "")) desktop = (gchar *)gdm_session;
|
||||||
if (desktop == NULL || g_str_equal(desktop, "")) desktop = (gchar *)desktop_session;
|
if (desktop == NULL || g_str_equal(desktop, "")) desktop = (gchar *)desktop_session;
|
||||||
|
|
||||||
g_print("XDG_CURRENT_DESKTOP: %s\nGDMSESSION: %s\nDESKTOP_SESSION: %s\nChosen value: %s\nShow menu in shell: %d\n", xdg_current_desktop, gdm_session, desktop_session, desktop, show_in_shell);
|
g_debug("XDG_CURRENT_DESKTOP: %s\nGDMSESSION: %s\nDESKTOP_SESSION: %s\nChosen value: %s\nShow menu in shell: %d", xdg_current_desktop, gdm_session, desktop_session, desktop, show_in_shell);
|
||||||
|
|
||||||
if (desktop != NULL && show_in_shell) {
|
if (desktop != NULL && show_in_shell) {
|
||||||
menubar_type = MENUBAR_SHOW_IN_SHELL;
|
menubar_type = MENUBAR_SHOW_IN_SHELL;
|
||||||
@ -514,23 +514,23 @@ static void setup_menu(GApplication *app) {
|
|||||||
|
|
||||||
switch (menubar_type) {
|
switch (menubar_type) {
|
||||||
case MENUBAR_AUTO:
|
case MENUBAR_AUTO:
|
||||||
g_error("Unreachable\n");
|
g_warning("Unreachable");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENUBAR_SHOW_IN_SHELL:
|
case MENUBAR_SHOW_IN_SHELL:
|
||||||
g_print("Showing menu in the shell\n");
|
g_debug("Showing menu in the shell");
|
||||||
gtk_application_set_menubar(GTK_APPLICATION(app), menubar_model);
|
gtk_application_set_menubar(GTK_APPLICATION(app), menubar_model);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENUBAR_SHOW_IN_WINDOW: {
|
case MENUBAR_SHOW_IN_WINDOW: {
|
||||||
g_print("Showing menu in the window\n");
|
g_debug("Showing menu in the window");
|
||||||
GtkMenuBar *menubar = GTK_MENU_BAR(gtk_menu_bar_new_from_model(menubar_model));
|
GtkMenuBar *menubar = GTK_MENU_BAR(gtk_menu_bar_new_from_model(menubar_model));
|
||||||
gtk_box_pack_start(GTK_BOX(main_window_container), GTK_WIDGET(menubar), FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(main_window_container), GTK_WIDGET(menubar), FALSE, FALSE, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MENUBAR_SHOW_HAMBURGER: {
|
case MENUBAR_SHOW_HAMBURGER: {
|
||||||
g_print("Showing hamburger\n");
|
g_debug("Showing hamburger");
|
||||||
// Attach a custom title bar
|
// Attach a custom title bar
|
||||||
GtkWidget *titlebar = builder_get(GTK_WIDGET, "main_header_bar");
|
GtkWidget *titlebar = builder_get(GTK_WIDGET, "main_header_bar");
|
||||||
gtk_header_bar_set_title(GTK_HEADER_BAR(titlebar), gtk_window_get_title(GTK_WINDOW(main_window)));
|
gtk_header_bar_set_title(GTK_HEADER_BAR(titlebar), gtk_window_get_title(GTK_WINDOW(main_window)));
|
||||||
@ -626,7 +626,7 @@ static void startup(GApplication *app, gpointer gui_data_gptr) {
|
|||||||
// in this callback create a GdkGLContext on this window. But instead of running the GTK main loop
|
// in this callback create a GdkGLContext on this window. But instead of running the GTK main loop
|
||||||
// we just realize and destroy the dummy window and compare the context’s version in the realize callback.
|
// we just realize and destroy the dummy window and compare the context’s version in the realize callback.
|
||||||
supports_gl = test_gl_support();
|
supports_gl = test_gl_support();
|
||||||
g_print("OpenGL supported: %s\n", supports_gl? "Yes" : "No");
|
g_debug("OpenGL supported: %s", supports_gl? "Yes" : "No");
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource(RESOURCE_PREFIX "ui/window.ui");
|
builder = gtk_builder_new_from_resource(RESOURCE_PREFIX "ui/window.ui");
|
||||||
gtk_builder_connect_signals(builder, NULL);
|
gtk_builder_connect_signals(builder, NULL);
|
||||||
@ -792,7 +792,7 @@ static void activate(GApplication *app, gpointer gui_data_gptr) {
|
|||||||
|
|
||||||
// This function gets called when the application is closed.
|
// This function gets called when the application is closed.
|
||||||
static void shutdown(GApplication *app, GFile **files, gint n_files, const gchar *hint, gpointer gui_data_gptr) {
|
static void shutdown(GApplication *app, GFile **files, gint n_files, const gchar *hint, gpointer gui_data_gptr) {
|
||||||
g_print("SHUTDOWN\n");
|
g_debug("SHUTDOWN");
|
||||||
|
|
||||||
stop(&gui_data);
|
stop(&gui_data);
|
||||||
while (stopping);
|
while (stopping);
|
||||||
@ -818,7 +818,7 @@ static void open(GApplication *app, GFile **files, gint n_files, const gchar *hi
|
|||||||
GuiData *gui_data = gui_data_gptr;
|
GuiData *gui_data = gui_data_gptr;
|
||||||
|
|
||||||
if (n_files > 1) {
|
if (n_files > 1) {
|
||||||
g_printerr("More than one file specified\n");
|
g_warning("More than one file specified");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,7 +932,7 @@ static void activate_open(GSimpleAction *action, GVariant *parameter, gpointer a
|
|||||||
|
|
||||||
if (res == GTK_RESPONSE_ACCEPT) {
|
if (res == GTK_RESPONSE_ACCEPT) {
|
||||||
// TODO: Emit an event for our emulation loop
|
// TODO: Emit an event for our emulation loop
|
||||||
g_print("%s\n", gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(native)));
|
g_message("%s", gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(native)));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref(native);
|
g_object_unref(native);
|
||||||
@ -1026,10 +1026,10 @@ static void on_quit(GtkWidget *w, gpointer app) {
|
|||||||
static void gl_init(GtkWidget *w) {
|
static void gl_init(GtkWidget *w) {
|
||||||
GtkGLArea *gl_area = GTK_GL_AREA(w);
|
GtkGLArea *gl_area = GTK_GL_AREA(w);
|
||||||
|
|
||||||
g_print("GL_INIT\n");
|
g_debug("GL_INIT");
|
||||||
const char *renderer;
|
const char *renderer;
|
||||||
|
|
||||||
g_print("GL Context: %p\n", gtk_gl_area_get_context(gl_area));
|
g_debug("GL Context: %p", gtk_gl_area_get_context(gl_area));
|
||||||
|
|
||||||
gtk_gl_area_make_current(gl_area);
|
gtk_gl_area_make_current(gl_area);
|
||||||
|
|
||||||
@ -1038,7 +1038,7 @@ static void gl_init(GtkWidget *w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderer = (char *)glGetString(GL_RENDERER);
|
renderer = (char *)glGetString(GL_RENDERER);
|
||||||
g_print("GtkGLArea on %s\n", renderer ? renderer : "Unknown");
|
g_debug("GtkGLArea on %s", renderer ? renderer : "Unknown");
|
||||||
|
|
||||||
if (config.shader == NULL || (!init_shader_with_name(&shader, config.shader) && !init_shader_with_name(&shader, "NearestNeighbor"))) {
|
if (config.shader == NULL || (!init_shader_with_name(&shader, config.shader) && !init_shader_with_name(&shader, "NearestNeighbor"))) {
|
||||||
GError *error = g_error_new_literal(g_quark_from_string("sameboy-gl-error"), 1, "Failed to initialize shaders");
|
GError *error = g_error_new_literal(g_quark_from_string("sameboy-gl-error"), 1, "Failed to initialize shaders");
|
||||||
@ -1053,7 +1053,7 @@ static void gl_init(GtkWidget *w) {
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
if (gtk_gl_area_get_error(gl_area) != NULL) {
|
if (gtk_gl_area_get_error(gl_area) != NULL) {
|
||||||
g_printerr("GtkGLArea: %s\n", gtk_gl_area_get_error(gl_area)->message);
|
g_warning("GtkGLArea: %s", gtk_gl_area_get_error(gl_area)->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
create_fallback_canvas();
|
create_fallback_canvas();
|
||||||
@ -1458,7 +1458,25 @@ static void render_texture(void *pixels, void *previous) {
|
|||||||
glClearColor(0, 0, 0, 1);
|
glClearColor(0, 0, 0, 1);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
render_bitmap_with_shader(&shader, _pixels, previous, GB_get_screen_width(&gb), GB_get_screen_height(&gb), viewport.x, viewport.y, viewport.w, viewport.h);
|
GB_frame_blending_mode_t mode = get_frame_blending_mode();
|
||||||
|
if (!previous) {
|
||||||
|
mode = GB_FRAME_BLENDING_MODE_DISABLED;
|
||||||
|
}
|
||||||
|
else if (mode == GB_FRAME_BLENDING_MODE_ACCURATE) {
|
||||||
|
if (GB_is_sgb(&gb)) {
|
||||||
|
mode = GB_FRAME_BLENDING_MODE_SIMPLE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mode = GB_is_odd_frame(&gb)? GB_FRAME_BLENDING_MODE_ACCURATE_ODD : GB_FRAME_BLENDING_MODE_ACCURATE_EVEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render_bitmap_with_shader(
|
||||||
|
&shader, _pixels, previous,
|
||||||
|
GB_get_screen_width(&gb), GB_get_screen_height(&gb),
|
||||||
|
viewport.x, viewport.y, viewport.w, viewport.h,
|
||||||
|
mode
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_viewport(void) {
|
static void update_viewport(void) {
|
||||||
@ -1858,9 +1876,9 @@ static void load_boot_rom(GuiData *gui_data) {
|
|||||||
gsize boot_rom_size;
|
gsize boot_rom_size;
|
||||||
|
|
||||||
if (gui_data->cli_options.boot_rom_path != NULL) {
|
if (gui_data->cli_options.boot_rom_path != NULL) {
|
||||||
g_print("Trying to load boot ROM from %s\n", gui_data->cli_options.boot_rom_path);
|
g_message("Trying to load boot ROM from %s", gui_data->cli_options.boot_rom_path);
|
||||||
if (GB_load_boot_rom(&gb, gui_data->cli_options.boot_rom_path)) {
|
if (GB_load_boot_rom(&gb, gui_data->cli_options.boot_rom_path)) {
|
||||||
g_printerr("Falling back to boot ROM from config\n");
|
g_warning("Falling back to boot ROM from config");
|
||||||
goto config_boot_rom;
|
goto config_boot_rom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1874,6 +1892,7 @@ static void load_boot_rom(GuiData *gui_data) {
|
|||||||
case GB_MODEL_SGB:
|
case GB_MODEL_SGB:
|
||||||
case GB_MODEL_SGB_PAL:
|
case GB_MODEL_SGB_PAL:
|
||||||
case GB_MODEL_SGB_NO_SFC:
|
case GB_MODEL_SGB_NO_SFC:
|
||||||
|
case GB_MODEL_SGB_PAL_NO_SFC:
|
||||||
boot_rom_name = "sgb_boot.bin";
|
boot_rom_name = "sgb_boot.bin";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1894,11 +1913,11 @@ static void load_boot_rom(GuiData *gui_data) {
|
|||||||
|
|
||||||
if (config.boot_rom_path != NULL && g_strcmp0(config.boot_rom_path, "other") != 0 && g_strcmp0(config.boot_rom_path, "auto") != 0) {
|
if (config.boot_rom_path != NULL && g_strcmp0(config.boot_rom_path, "other") != 0 && g_strcmp0(config.boot_rom_path, "auto") != 0) {
|
||||||
boot_rom_path = g_build_filename(config.boot_rom_path, boot_rom_name, NULL);
|
boot_rom_path = g_build_filename(config.boot_rom_path, boot_rom_name, NULL);
|
||||||
g_print("Trying to load boot ROM from %s\n", boot_rom_path);
|
g_message("Trying to load boot ROM from %s", boot_rom_path);
|
||||||
|
|
||||||
if (GB_load_boot_rom(&gb, boot_rom_path)) {
|
if (GB_load_boot_rom(&gb, boot_rom_path)) {
|
||||||
g_free(boot_rom_path);
|
g_free(boot_rom_path);
|
||||||
g_printerr("Falling back to internal boot ROM\n");
|
g_warning("Falling back to internal boot ROM");
|
||||||
goto internal_boot_rom;
|
goto internal_boot_rom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1910,7 +1929,7 @@ static void load_boot_rom(GuiData *gui_data) {
|
|||||||
g_free(boot_rom_path);
|
g_free(boot_rom_path);
|
||||||
|
|
||||||
if (boot_rom_f == NULL) {
|
if (boot_rom_f == NULL) {
|
||||||
g_printerr("Failed to load internal boot ROM: %s\n", boot_rom_path);
|
g_warning("Failed to load internal boot ROM: %s", boot_rom_path);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -1942,7 +1961,7 @@ static void stop(GuiData *gui_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void reset(GuiData *gui_data) {
|
static void reset(GuiData *gui_data) {
|
||||||
g_print("Reset: %d == %d\n", get_model(), gui_data->prev_model);
|
g_debug("Reset: %d == %d", get_model(), gui_data->prev_model);
|
||||||
GB_model_t current_model = get_model();
|
GB_model_t current_model = get_model();
|
||||||
|
|
||||||
if (gui_data->prev_model == -1 || gui_data->prev_model == current_model) {
|
if (gui_data->prev_model == -1 || gui_data->prev_model == current_model) {
|
||||||
@ -1968,7 +1987,7 @@ static void reset(GuiData *gui_data) {
|
|||||||
char *path = g_file_get_path(gui_data->file);
|
char *path = g_file_get_path(gui_data->file);
|
||||||
|
|
||||||
if (GB_load_rom(&gb, path) != 0) {
|
if (GB_load_rom(&gb, path) != 0) {
|
||||||
g_print("Failed to load ROM: %s", path);
|
g_warning("Failed to load ROM: %s", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(path);
|
g_free(path);
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// used for audio and game controllers
|
// used for audio and game controllers
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
#define G_LOG_USE_STRUCTURED
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <epoxy/gl.h>
|
#include <epoxy/gl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -646,6 +646,7 @@ Maximilian Mader https://github.com/max-m</property>
|
|||||||
<item id="correct_color_curves" translatable="yes">Correct Color Curves</item>
|
<item id="correct_color_curves" translatable="yes">Correct Color Curves</item>
|
||||||
<item id="emulate_hardware" translatable="yes">Emulate Hardware</item>
|
<item id="emulate_hardware" translatable="yes">Emulate Hardware</item>
|
||||||
<item id="preserve_brightness" translatable="yes">Preserve Brightness</item>
|
<item id="preserve_brightness" translatable="yes">Preserve Brightness</item>
|
||||||
|
<item id="reduce_contrast" translatable="yes">Reduce contrast</item>
|
||||||
</items>
|
</items>
|
||||||
<signal name="changed" handler="on_color_correction_changed" swapped="no"/>
|
<signal name="changed" handler="on_color_correction_changed" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
|
@ -4,17 +4,17 @@ static void print_config_error(GError *error) {
|
|||||||
if (error == NULL) return;
|
if (error == NULL) return;
|
||||||
|
|
||||||
if (!g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND) && !g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
|
if (!g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND) && !g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
|
||||||
g_printerr("Config error: %s\n", error->message);
|
g_warning("Config error: %s", error->message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_config(config_t *config) {
|
void _print_config(config_t *config, GLogLevelFlags log_level) {
|
||||||
#define EXPAND_GROUP(group_name, members) \
|
#define EXPAND_GROUP(group_name, members) \
|
||||||
g_print("[%s]\n", #group_name); \
|
g_log(G_LOG_DOMAIN, log_level, "[%s]", #group_name); \
|
||||||
members
|
members
|
||||||
|
|
||||||
#define EXPAND_GROUP_MEMBER(member, key_type, default_value) \
|
#define EXPAND_GROUP_MEMBER(member, key_type, default_value) \
|
||||||
g_print("%s="FORMAT_FOR_KEY_TYPE(key_type)"\n", #member, config->member);
|
g_log(G_LOG_DOMAIN, log_level, "%s="FORMAT_FOR_KEY_TYPE(key_type)"", #member, config->member);
|
||||||
|
|
||||||
EXPAND_CONFIG
|
EXPAND_CONFIG
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ void print_config(config_t *config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load_config_from_key_file(config_t *config, GKeyFile *key_file) {
|
void load_config_from_key_file(config_t *config, GKeyFile *key_file) {
|
||||||
g_print("Loading config from key file\n");
|
g_message("Loading config from key file");
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *group_name;
|
gchar *group_name;
|
||||||
|
|
||||||
@ -42,15 +42,19 @@ void load_config_from_key_file(config_t *config, GKeyFile *key_file) {
|
|||||||
EXPAND_CONFIG
|
EXPAND_CONFIG
|
||||||
|
|
||||||
if (config->rewind_duration > 600) {
|
if (config->rewind_duration > 600) {
|
||||||
g_warning("Setting Emulation.rewind_duration too high might affect performance.\n");
|
g_warning("Setting Emulation.rewind_duration too high might affect performance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef EXPAND_GROUP
|
#undef EXPAND_GROUP
|
||||||
#undef EXPAND_GROUP_MEMBER
|
#undef EXPAND_GROUP_MEMBER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_config(config_t *config) {
|
||||||
|
_print_config(config, G_LOG_LEVEL_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
void save_config_to_key_file(config_t *config, GKeyFile *key_file) {
|
void save_config_to_key_file(config_t *config, GKeyFile *key_file) {
|
||||||
g_print("Saving config to key file\n");
|
g_message("Saving config to key file");
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *group_name;
|
gchar *group_name;
|
||||||
|
|
||||||
@ -67,12 +71,12 @@ void save_config_to_key_file(config_t *config, GKeyFile *key_file) {
|
|||||||
} \
|
} \
|
||||||
else if (g_key_file_has_key(key_file, group_name, #member, &error)) { \
|
else if (g_key_file_has_key(key_file, group_name, #member, &error)) { \
|
||||||
if (error != NULL) { \
|
if (error != NULL) { \
|
||||||
g_printerr("%s\n", error->message); \
|
g_warning("%s", error->message); \
|
||||||
g_clear_error(&error); \
|
g_clear_error(&error); \
|
||||||
} \
|
} \
|
||||||
g_key_file_remove_key(key_file, group_name, #member, &error); \
|
g_key_file_remove_key(key_file, group_name, #member, &error); \
|
||||||
if (error != NULL) { \
|
if (error != NULL) { \
|
||||||
g_printerr("%s\n", error->message); \
|
g_warning("%s", error->message); \
|
||||||
g_clear_error(&error); \
|
g_clear_error(&error); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -136,7 +140,7 @@ void init_settings(gchar *path, GtkWindow *preferences) {
|
|||||||
int load_settings(void) {
|
int load_settings(void) {
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
g_print("Trying to load settings from %s\n", settings_file_path);
|
g_message("Trying to load settings from %s", settings_file_path);
|
||||||
|
|
||||||
if (!g_key_file_load_from_file(key_file, settings_file_path, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error)) {
|
if (!g_key_file_load_from_file(key_file, settings_file_path, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error)) {
|
||||||
if (error->domain == G_FILE_ERROR) {
|
if (error->domain == G_FILE_ERROR) {
|
||||||
@ -150,7 +154,7 @@ int load_settings(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
load_config_from_key_file(&config, key_file);
|
load_config_from_key_file(&config, key_file);
|
||||||
print_config(&config);
|
_print_config(&config, G_LOG_LEVEL_DEBUG);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -158,7 +162,7 @@ int load_settings(void) {
|
|||||||
void save_settings(void) {
|
void save_settings(void) {
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
g_print("Trying to save settings to %s\n", settings_file_path);
|
g_message("Trying to save settings to %s", settings_file_path);
|
||||||
|
|
||||||
save_config_to_key_file(&config, key_file);
|
save_config_to_key_file(&config, key_file);
|
||||||
|
|
||||||
@ -208,7 +212,7 @@ enum menubar_type_t get_show_menubar(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This should not happen
|
// This should not happen
|
||||||
g_warning("Unknown menubar setting: %s\nFalling back to “Auto”\n", config.menubar_override);
|
g_warning("Unknown menubar setting: %s\nFalling back to “Auto”", config.menubar_override);
|
||||||
default_value: return MENUBAR_AUTO;
|
default_value: return MENUBAR_AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,9 +248,12 @@ GB_color_correction_mode_t get_color_correction_mode(void) {
|
|||||||
else if (g_strcmp0(config.color_correction_id, "preserve_brightness") == 0) {
|
else if (g_strcmp0(config.color_correction_id, "preserve_brightness") == 0) {
|
||||||
return GB_COLOR_CORRECTION_PRESERVE_BRIGHTNESS;
|
return GB_COLOR_CORRECTION_PRESERVE_BRIGHTNESS;
|
||||||
}
|
}
|
||||||
|
else if (g_strcmp0(config.color_correction_id, "reduce_contrast") == 0) {
|
||||||
|
return GB_COLOR_CORRECTION_REDUCE_CONTRAST;
|
||||||
|
}
|
||||||
|
|
||||||
// This should not happen
|
// This should not happen
|
||||||
g_warning("Unknown color correction mode: %s\nFalling back to “Emulate Hardware”\n", config.color_correction_id);
|
g_warning("Unknown color correction mode: %s\nFalling back to “Emulate Hardware”", config.color_correction_id);
|
||||||
default_value: return GB_COLOR_CORRECTION_EMULATE_HARDWARE;
|
default_value: return GB_COLOR_CORRECTION_EMULATE_HARDWARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,6 +271,42 @@ void set_color_correction_mode(GB_color_correction_mode_t mode) {
|
|||||||
case GB_COLOR_CORRECTION_PRESERVE_BRIGHTNESS:
|
case GB_COLOR_CORRECTION_PRESERVE_BRIGHTNESS:
|
||||||
config.color_correction_id = "preserve_brightness";
|
config.color_correction_id = "preserve_brightness";
|
||||||
break;
|
break;
|
||||||
|
case GB_COLOR_CORRECTION_REDUCE_CONTRAST:
|
||||||
|
config.color_correction_id = "reduce_contrast";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GB_frame_blending_mode_t get_frame_blending_mode(void) {
|
||||||
|
if (config.frame_blending_mode == NULL) goto default_value;
|
||||||
|
|
||||||
|
if (g_strcmp0(config.frame_blending_mode, "disabled") == 0) {
|
||||||
|
return GB_FRAME_BLENDING_MODE_DISABLED;
|
||||||
|
}
|
||||||
|
else if (g_strcmp0(config.frame_blending_mode, "simple") == 0) {
|
||||||
|
return GB_FRAME_BLENDING_MODE_SIMPLE;
|
||||||
|
}
|
||||||
|
else if (g_strcmp0(config.frame_blending_mode, "accurate") == 0) {
|
||||||
|
return GB_FRAME_BLENDING_MODE_ACCURATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This should not happen
|
||||||
|
g_warning("Unknown frame blending mode: %s\nFalling back to “Disabled”", config.frame_blending_mode);
|
||||||
|
default_value: return GB_FRAME_BLENDING_MODE_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_frame_blending_mode(GB_frame_blending_mode_t mode) {
|
||||||
|
switch (mode) {
|
||||||
|
case GB_FRAME_BLENDING_MODE_DISABLED:
|
||||||
|
config.frame_blending_mode = "disabled";
|
||||||
|
break;
|
||||||
|
case GB_FRAME_BLENDING_MODE_SIMPLE:
|
||||||
|
config.frame_blending_mode = "simple";
|
||||||
|
break;
|
||||||
|
case GB_FRAME_BLENDING_MODE_ACCURATE:
|
||||||
|
case GB_FRAME_BLENDING_MODE_ACCURATE_ODD:
|
||||||
|
config.frame_blending_mode = "accurate";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +324,7 @@ GB_highpass_mode_t get_highpass_mode(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This should not happen
|
// This should not happen
|
||||||
g_warning("Unknown highpass mode: %s\nFalling back to “Accurate”\n", config.high_pass_filter_id);
|
g_warning("Unknown highpass mode: %s\nFalling back to “Accurate”", config.high_pass_filter_id);
|
||||||
default_value: return GB_HIGHPASS_ACCURATE;
|
default_value: return GB_HIGHPASS_ACCURATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +334,7 @@ void set_highpass_mode(GB_highpass_mode_t mode) {
|
|||||||
config.high_pass_filter_id = "disabled";
|
config.high_pass_filter_id = "disabled";
|
||||||
break;
|
break;
|
||||||
case GB_HIGHPASS_MAX:
|
case GB_HIGHPASS_MAX:
|
||||||
g_warning("GB_HIGHPASS_MAX is not a valid highpass mode, falling back to “Accurate”.\n");
|
g_warning("GB_HIGHPASS_MAX is not a valid highpass mode, falling back to “Accurate”.");
|
||||||
case GB_HIGHPASS_ACCURATE:
|
case GB_HIGHPASS_ACCURATE:
|
||||||
config.high_pass_filter_id = "emulate_hardware";
|
config.high_pass_filter_id = "emulate_hardware";
|
||||||
break;
|
break;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <Core/gb.h>
|
#include <Core/gb.h>
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
#include "shader.h"
|
||||||
|
|
||||||
#define SETTINGS_FILE "sameboy-gtk3-settings.ini"
|
#define SETTINGS_FILE "sameboy-gtk3-settings.ini"
|
||||||
|
|
||||||
@ -39,6 +40,7 @@
|
|||||||
EXPAND_GROUP(Video, \
|
EXPAND_GROUP(Video, \
|
||||||
EXPAND_GROUP_MEMBER(shader, string, "NearestNeighbor") \
|
EXPAND_GROUP_MEMBER(shader, string, "NearestNeighbor") \
|
||||||
EXPAND_GROUP_MEMBER(color_correction_id, string, "emulate_hardware") \
|
EXPAND_GROUP_MEMBER(color_correction_id, string, "emulate_hardware") \
|
||||||
|
EXPAND_GROUP_MEMBER(frame_blending_mode, string, "disabled") \
|
||||||
EXPAND_GROUP_MEMBER(keep_aspect_ratio, boolean, true) \
|
EXPAND_GROUP_MEMBER(keep_aspect_ratio, boolean, true) \
|
||||||
EXPAND_GROUP_MEMBER(use_integer_scaling, boolean, true) \
|
EXPAND_GROUP_MEMBER(use_integer_scaling, boolean, true) \
|
||||||
EXPAND_GROUP_MEMBER(menubar_override, string, "auto") \
|
EXPAND_GROUP_MEMBER(menubar_override, string, "auto") \
|
||||||
@ -88,6 +90,9 @@ void set_show_menubar(enum menubar_type_t);
|
|||||||
GB_color_correction_mode_t get_color_correction_mode(void);
|
GB_color_correction_mode_t get_color_correction_mode(void);
|
||||||
void set_color_correction_mode(GB_color_correction_mode_t);
|
void set_color_correction_mode(GB_color_correction_mode_t);
|
||||||
|
|
||||||
|
GB_frame_blending_mode_t get_frame_blending_mode(void);
|
||||||
|
void set_frame_blending_mode(GB_frame_blending_mode_t);
|
||||||
|
|
||||||
GB_highpass_mode_t get_highpass_mode(void);
|
GB_highpass_mode_t get_highpass_mode(void);
|
||||||
void set_highpass_mode(GB_highpass_mode_t);
|
void set_highpass_mode(GB_highpass_mode_t);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ static GLuint create_shader(const char *source, GLenum type)
|
|||||||
if (status == GL_FALSE) {
|
if (status == GL_FALSE) {
|
||||||
GLchar messages[1024];
|
GLchar messages[1024];
|
||||||
glGetShaderInfoLog(shader, sizeof(messages), 0, &messages[0]);
|
glGetShaderInfoLog(shader, sizeof(messages), 0, &messages[0]);
|
||||||
g_printerr("GLSL Shader Error: %s", messages);
|
g_warning("GLSL Shader Error: %s", messages);
|
||||||
}
|
}
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ static GLuint create_program(const char *vsh, const char *fsh)
|
|||||||
if (status == GL_FALSE) {
|
if (status == GL_FALSE) {
|
||||||
GLchar messages[1024];
|
GLchar messages[1024];
|
||||||
glGetProgramInfoLog(program, sizeof(messages), 0, &messages[0]);
|
glGetProgramInfoLog(program, sizeof(messages), 0, &messages[0]);
|
||||||
g_printerr("GLSL Program Error: %s", messages);
|
g_warning("GLSL Program Error: %s", messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete shaders
|
// Delete shaders
|
||||||
@ -78,7 +78,7 @@ bool init_shader_with_name(shader_t *shader, const char *name)
|
|||||||
master_shader_code = g_bytes_get_data(master_shader_f, &master_shader_code_size);
|
master_shader_code = g_bytes_get_data(master_shader_f, &master_shader_code_size);
|
||||||
|
|
||||||
if (!master_shader_f) {
|
if (!master_shader_f) {
|
||||||
g_printerr("Failed to load master shader: %s", error->message);
|
g_warning("Failed to load master shader: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ bool init_shader_with_name(shader_t *shader, const char *name)
|
|||||||
|
|
||||||
GBytes *shader_f = g_resources_lookup_data(shader_path, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
|
GBytes *shader_f = g_resources_lookup_data(shader_path, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
|
||||||
if (!shader_f) {
|
if (!shader_f) {
|
||||||
g_printerr("Failed to load shader \"%s\": %s", shader_path, error->message);
|
g_warning("Failed to load shader \"%s\": %s", shader_path, error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ bool init_shader_with_name(shader_t *shader, const char *name)
|
|||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
shader->previous_texture_uniform = glGetUniformLocation(shader->program, "previous_image");
|
shader->previous_texture_uniform = glGetUniformLocation(shader->program, "previous_image");
|
||||||
|
|
||||||
shader->mix_previous_uniform = glGetUniformLocation(shader->program, "mix_previous");
|
shader->blending_mode_uniform = glGetUniformLocation(shader->program, "frame_blending_mode");
|
||||||
|
|
||||||
// Program
|
// Program
|
||||||
|
|
||||||
@ -170,7 +170,8 @@ bool init_shader_with_name(shader_t *shader, const char *name)
|
|||||||
|
|
||||||
void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,
|
void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,
|
||||||
unsigned source_width, unsigned source_height,
|
unsigned source_width, unsigned source_height,
|
||||||
unsigned x, unsigned y, unsigned w, unsigned h)
|
unsigned x, unsigned y, unsigned w, unsigned h,
|
||||||
|
GB_frame_blending_mode_t blending_mode)
|
||||||
{
|
{
|
||||||
glUseProgram(shader->program);
|
glUseProgram(shader->program);
|
||||||
glUniform2f(shader->origin_uniform, x, y);
|
glUniform2f(shader->origin_uniform, x, y);
|
||||||
@ -179,7 +180,7 @@ void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,
|
|||||||
glBindTexture(GL_TEXTURE_2D, shader->texture);
|
glBindTexture(GL_TEXTURE_2D, shader->texture);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, source_width, source_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, bitmap);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, source_width, source_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, bitmap);
|
||||||
glUniform1i(shader->texture_uniform, 0);
|
glUniform1i(shader->texture_uniform, 0);
|
||||||
glUniform1i(shader->mix_previous_uniform, previous != NULL);
|
glUniform1i(shader->blending_mode_uniform, previous? blending_mode : GB_FRAME_BLENDING_MODE_DISABLED);
|
||||||
if (previous) {
|
if (previous) {
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, shader->previous_texture);
|
glBindTexture(GL_TEXTURE_2D, shader->previous_texture);
|
||||||
|
@ -11,20 +11,27 @@ typedef struct shader_s {
|
|||||||
GLuint origin_uniform;
|
GLuint origin_uniform;
|
||||||
GLuint texture_uniform;
|
GLuint texture_uniform;
|
||||||
GLuint previous_texture_uniform;
|
GLuint previous_texture_uniform;
|
||||||
GLuint mix_previous_uniform;
|
GLuint blending_mode_uniform;
|
||||||
|
|
||||||
GLuint position_attribute;
|
GLuint position_attribute;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
GLuint previous_texture;
|
GLuint previous_texture;
|
||||||
GLuint program;
|
GLuint program;
|
||||||
|
|
||||||
bool compat_mode;
|
|
||||||
} shader_t;
|
} shader_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GB_FRAME_BLENDING_MODE_DISABLED,
|
||||||
|
GB_FRAME_BLENDING_MODE_SIMPLE,
|
||||||
|
GB_FRAME_BLENDING_MODE_ACCURATE,
|
||||||
|
GB_FRAME_BLENDING_MODE_ACCURATE_EVEN = GB_FRAME_BLENDING_MODE_ACCURATE,
|
||||||
|
GB_FRAME_BLENDING_MODE_ACCURATE_ODD,
|
||||||
|
} GB_frame_blending_mode_t;
|
||||||
|
|
||||||
bool init_shader_with_name(shader_t *shader, const char *name);
|
bool init_shader_with_name(shader_t *shader, const char *name);
|
||||||
void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,
|
void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,
|
||||||
unsigned source_width, unsigned source_height,
|
unsigned source_width, unsigned source_height,
|
||||||
unsigned x, unsigned y, unsigned w, unsigned h);
|
unsigned x, unsigned y, unsigned w, unsigned h,
|
||||||
|
GB_frame_blending_mode_t blending_mode);
|
||||||
void free_shader(struct shader_s *shader);
|
void free_shader(struct shader_s *shader);
|
||||||
void free_master_shader(void);
|
void free_master_shader(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user