Skip to content

Commit

Permalink
Update all the external dependencies.
Browse files Browse the repository at this point in the history
This commit updates `cimgui`, `mjson`, `nfde` and `stb` to the latest release/commit.
  • Loading branch information
Arignir committed Dec 27, 2023
1 parent 518fec6 commit 50e833b
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 51 deletions.
4 changes: 3 additions & 1 deletion external/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

cflags += [
'-DIMGUI_IMPL_API=extern "C" ',
'-DCIMGUI_USE_OPENGL3',
'-DCIMGUI_USE_SDL2',
]

imgui_inc = include_directories(
Expand Down Expand Up @@ -57,7 +59,7 @@ imgui = static_library(
'cimgui/imgui/imgui_tables.cpp',
'cimgui/imgui/imgui_widgets.cpp',
'cimgui/imgui/backends/imgui_impl_opengl3.cpp',
'cimgui/imgui/backends/imgui_impl_sdl.cpp',
'cimgui/imgui/backends/imgui_impl_sdl2.cpp',
include_directories: imgui_inc,
dependencies: imgui_dep,
c_args: cflags,
Expand Down
2 changes: 1 addition & 1 deletion external/mjson
2 changes: 1 addition & 1 deletion external/nfde
13 changes: 1 addition & 12 deletions source/app/sdl/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ app_sdl_video_render_frame(
) {
/* Create the new frame */
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame(app->sdl.window);
ImGui_ImplSDL2_NewFrame();
igNewFrame();

/* Render the ImGui stuff */
Expand Down Expand Up @@ -452,16 +452,5 @@ app_sdl_video_render_frame(
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());

if (app->ui.ioptr->ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
SDL_Window *backup_current_window;
SDL_GLContext backup_current_context;

backup_current_window = SDL_GL_GetCurrentWindow();
backup_current_context = SDL_GL_GetCurrentContext();
igUpdatePlatformWindows();
igRenderPlatformWindowsDefault(NULL,NULL);
SDL_GL_MakeCurrent(backup_current_window, backup_current_context);
}

SDL_GL_SwapWindow(app->sdl.window);
}
5 changes: 2 additions & 3 deletions source/app/windows/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ app_win_game(
};
}

igPushStyleVarVec2(ImGuiStyleVar_WindowPadding, (ImVec2){.x = 0, .y = 0});
igPushStyleVarFloat(ImGuiStyleVar_WindowBorderSize, 0);
igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, (ImVec2){.x = 0, .y = 0});
igPushStyleVar_Float(ImGuiStyleVar_WindowBorderSize, 0);

igSetNextWindowPos((ImVec2){.x = game_pos_x, .y = (float)app->ui.menubar_size.y + game_pos_y}, ImGuiCond_Always, (ImVec2){.x = 0, .y = 0});
igSetNextWindowSize((ImVec2){.x = game_size_x, .y = game_size_y}, ImGuiCond_Always);
Expand All @@ -137,7 +137,6 @@ app_win_game(
NULL,
ImGuiWindowFlags_NoScrollWithMouse
| ImGuiWindowFlags_AlwaysAutoResize
| ImGuiWindowFlags_NoDocking
| ImGuiWindowFlags_NoDecoration
| ImGuiWindowFlags_NoBackground
| ImGuiWindowFlags_NoBringToFrontOnFocus
Expand Down
2 changes: 1 addition & 1 deletion source/app/windows/keybinds.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ app_win_keybinds_editor(
) {
if (app->ui.keybindings_editor.open) {
app->ui.keybindings_editor.open = false;
igOpenPopup("Keybindings Editor", ImGuiPopupFlags_None);
igOpenPopup_Str("Keybindings Editor", ImGuiPopupFlags_None);
}

app->ui.keybindings_editor.visible = false;
Expand Down
60 changes: 30 additions & 30 deletions source/app/windows/menubar.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ app_win_menubar_file(
struct app *app
) {
if (igBeginMenu("File", true)) {
if (igMenuItemBool("Open", NULL, false, true)) {
if (igMenuItem_Bool("Open", NULL, false, true)) {
nfdresult_t result;
nfdchar_t *path;

Expand All @@ -48,7 +48,7 @@ app_win_menubar_file(
uint32_t x;

for (x = 0; x < array_length(app->file.recent_roms) && app->file.recent_roms[x]; ++x) {
if (igMenuItemBool(hs_basename(app->file.recent_roms[x]), NULL, false, true)) {
if (igMenuItem_Bool(hs_basename(app->file.recent_roms[x]), NULL, false, true)) {
char *path;

// app->file.recent_roms[] is modified by `app_emulator_configure()` so we need to copy
Expand All @@ -65,7 +65,7 @@ app_win_menubar_file(
igEndMenu();
}

if (igMenuItemBool("Open BIOS", NULL, false, true)) {
if (igMenuItem_Bool("Open BIOS", NULL, false, true)) {
nfdresult_t result;
nfdchar_t *path;

Expand All @@ -85,7 +85,7 @@ app_win_menubar_file(

igSeparator();

if (igMenuItemBool("Keybindings", NULL, false, true)) {
if (igMenuItem_Bool("Keybindings", NULL, false, true)) {
app->ui.keybindings_editor.open = true;
}

Expand All @@ -99,7 +99,7 @@ app_win_menubar_emulation(
struct app *app
) {
if (igBeginMenu("Emulation", true)) {
if (igMenuItemBool("Skip BIOS", NULL, app->emulation.skip_bios, true)) {
if (igMenuItem_Bool("Skip BIOS", NULL, app->emulation.skip_bios, true)) {
app->emulation.skip_bios ^= 1;
}

Expand All @@ -118,7 +118,7 @@ app_win_menubar_emulation(
char const *bind;

bind = SDL_GetKeyName(app->binds.keyboard[BIND_EMULATOR_SPEED_MAX + x]);
if (igMenuItemBool(speed[x], bind ?: "", app->emulation.speed == x, true)) {
if (igMenuItem_Bool(speed[x], bind ?: "", app->emulation.speed == x, true)) {
app->emulation.unbounded = false;
app->emulation.speed = x;
app_emulator_speed(app, app->emulation.speed);
Expand Down Expand Up @@ -148,7 +148,7 @@ app_win_menubar_emulation(

hs_assert(text);

if (igMenuItemBool(text, NULL, false, true)) {
if (igMenuItem_Bool(text, NULL, false, true)) {
app_emulator_quicksave(app, i);
}

Expand All @@ -172,7 +172,7 @@ app_win_menubar_emulation(

hs_assert(text);

if (igMenuItemBool(text, NULL, false, app->file.qsaves[i].exist && app->file.qsaves[i].mtime)) {
if (igMenuItem_Bool(text, NULL, false, app->file.qsaves[i].exist && app->file.qsaves[i].mtime)) {
app_emulator_quickload(app, i);
}

Expand All @@ -187,14 +187,14 @@ app_win_menubar_emulation(
if (igBeginMenu("Backup Storage", !app->emulation.is_started)) {
uint32_t x;

if (igMenuItemBool("Auto-detect", NULL, app->emulation.backup_storage.autodetect, true)) {
if (igMenuItem_Bool("Auto-detect", NULL, app->emulation.backup_storage.autodetect, true)) {
app->emulation.backup_storage.autodetect ^= 1;
}

igSeparator();

for (x = BACKUP_MIN; x < BACKUP_LEN; ++x) {
if (igMenuItemBool(backup_storage_names[x], NULL, !app->emulation.backup_storage.autodetect && app->emulation.backup_storage.type == x, true)) {
if (igMenuItem_Bool(backup_storage_names[x], NULL, !app->emulation.backup_storage.autodetect && app->emulation.backup_storage.type == x, true)) {
app->emulation.backup_storage.type = x;
app->emulation.backup_storage.autodetect = false;
}
Expand All @@ -209,30 +209,30 @@ app_win_menubar_emulation(
igText("RTC");
igSeparator();

if (igMenuItemBool("Auto-detect", NULL, app->emulation.rtc.autodetect, true)) {
if (igMenuItem_Bool("Auto-detect", NULL, app->emulation.rtc.autodetect, true)) {
app->emulation.rtc.autodetect ^= 1;
}
if (igMenuItemBool("Enable", NULL, app->emulation.rtc.enabled, !app->emulation.rtc.autodetect)) {
if (igMenuItem_Bool("Enable", NULL, app->emulation.rtc.enabled, !app->emulation.rtc.autodetect)) {
app->emulation.rtc.enabled ^= 1;
}
igEndMenu();
}

igSeparator();

if (igMenuItemBool("Pause", NULL, !app->emulation.is_running, app->emulation.is_started)) {
if (igMenuItem_Bool("Pause", NULL, !app->emulation.is_running, app->emulation.is_started)) {
if (app->emulation.is_running) {
app_emulator_pause(app);
} else {
app_emulator_run(app);
}
}

if (igMenuItemBool("Stop", NULL, false, app->emulation.is_started)) {
if (igMenuItem_Bool("Stop", NULL, false, app->emulation.is_started)) {
app_emulator_stop(app);
}

if (igMenuItemBool("Reset", NULL, false, app->emulation.is_started)) {
if (igMenuItem_Bool("Reset", NULL, false, app->emulation.is_started)) {
app_emulator_reset(app);
app_emulator_run(app);
}
Expand Down Expand Up @@ -268,7 +268,7 @@ app_win_menubar_video(
height = max(0, height - app->ui.menubar_size.y);

for (x = 1; x <= 5; ++x) {
if (igMenuItemBool(
if (igMenuItem_Bool(
display_sizes[x - 1],
NULL,
width == GBA_SCREEN_WIDTH * x * app->ui.scale && height == GBA_SCREEN_HEIGHT * x * app->ui.scale,
Expand All @@ -285,7 +285,7 @@ app_win_menubar_video(

/* Aspect Ratio */
if (igBeginMenu("Aspect Ratio", true)) {
if (igMenuItemBool(
if (igMenuItem_Bool(
"Auto resize",
NULL,
app->video.aspect_ratio == ASPECT_RATIO_RESIZE,
Expand All @@ -297,7 +297,7 @@ app_win_menubar_video(
app->ui.win.resize_ratio = min(app->ui.game.width / ((float)GBA_SCREEN_WIDTH * app->ui.scale), app->ui.game.height / ((float)GBA_SCREEN_HEIGHT * app->ui.scale));
}

if (igMenuItemBool(
if (igMenuItem_Bool(
"Black borders",
NULL,
app->video.aspect_ratio == ASPECT_RATIO_BORDERS,
Expand All @@ -306,7 +306,7 @@ app_win_menubar_video(
app->video.aspect_ratio = ASPECT_RATIO_BORDERS;
}

if (igMenuItemBool(
if (igMenuItem_Bool(
"Stretch",
NULL,
app->video.aspect_ratio == ASPECT_RATIO_STRETCH,
Expand All @@ -322,12 +322,12 @@ app_win_menubar_video(

/* Texture Filter */
if (igBeginMenu("Texture Filter", true)) {
if (igMenuItemBool("Nearest", NULL, app->gfx.texture_filter == TEXTURE_FILTER_NEAREST, true)) {
if (igMenuItem_Bool("Nearest", NULL, app->gfx.texture_filter == TEXTURE_FILTER_NEAREST, true)) {
app->gfx.texture_filter = TEXTURE_FILTER_NEAREST;
app_sdl_video_rebuild_pipeline(app);
}

if (igMenuItemBool("Linear", NULL, app->gfx.texture_filter == TEXTURE_FILTER_LINEAR, true)) {
if (igMenuItem_Bool("Linear", NULL, app->gfx.texture_filter == TEXTURE_FILTER_LINEAR, true)) {
app->gfx.texture_filter = TEXTURE_FILTER_LINEAR;
app_sdl_video_rebuild_pipeline(app);
}
Expand All @@ -336,19 +336,19 @@ app_win_menubar_video(
}

/* Color Correction */
if (igMenuItemBool("Color correction", NULL, app->video.color_correction, true)) {
if (igMenuItem_Bool("Color correction", NULL, app->video.color_correction, true)) {
app->video.color_correction ^= 1;
app_sdl_video_rebuild_pipeline(app);
}

/* LCD Effect */
if (igMenuItemBool("LCD Grid Effect", NULL, app->video.lcd_grid, true)) {
if (igMenuItem_Bool("LCD Grid Effect", NULL, app->video.lcd_grid, true)) {
app->video.lcd_grid ^= 1;
app_sdl_video_rebuild_pipeline(app);
}

/* VSync */
if (igMenuItemBool("VSync", NULL, app->video.vsync, true)) {
if (igMenuItem_Bool("VSync", NULL, app->video.vsync, true)) {
app->video.vsync ^= 1;
SDL_GL_SetSwapInterval(app->video.vsync);
}
Expand All @@ -357,7 +357,7 @@ app_win_menubar_video(

/* Take a screenshot */
bind = SDL_GetKeyName(app->binds.keyboard[BIND_EMULATOR_SCREENSHOT]);
if (igMenuItemBool("Screenshot", bind ? bind : "", false, app->emulation.is_started)) {
if (igMenuItem_Bool("Screenshot", bind ? bind : "", false, app->emulation.is_started)) {
app_emulator_screenshot(app);
}

Expand All @@ -374,7 +374,7 @@ app_win_menubar_audio(
float percent;

/* VSync */
if (igMenuItemBool("Mute", NULL, app->audio.mute, true)) {
if (igMenuItem_Bool("Mute", NULL, app->audio.mute, true)) {
app->audio.mute ^= 1;
}

Expand All @@ -387,7 +387,7 @@ app_win_menubar_audio(
igSetNextItemWidth(100.f * app->ui.scale);

percent = app->audio.level * 100.f;
igSliderFloat("", &percent, 0.0f, 100.0f, "%.0f%%", ImGuiSliderFlags_None);
igSliderFloat("##slider_sound_level", &percent, 0.0f, 100.0f, "%.0f%%", ImGuiSliderFlags_None);
app->audio.level = max(0.0f, min(percent / 100.f, 1.f));

igSpacing();
Expand All @@ -408,21 +408,21 @@ app_win_menubar_help(
if (igBeginMenu("Help", true)) {

/* Report Issue */
if (igMenuItemBool("Report Issue", NULL, false, true)) {
if (igMenuItem_Bool("Report Issue", NULL, false, true)) {
hs_open_url("https://github.com/Arignir/Hades/issues/new");
}

igSeparator();

/* About */
if (igMenuItemBool("About", NULL, false, true)) {
if (igMenuItem_Bool("About", NULL, false, true)) {
open_about = true;
}
igEndMenu();
}

if (open_about) {
igOpenPopup("About", ImGuiPopupFlags_None);
igOpenPopup_Str("About", ImGuiPopupFlags_None);
}

// Always center the modal
Expand Down

0 comments on commit 50e833b

Please sign in to comment.