Skip to content

Commit

Permalink
Added support for running emulator without --rom cmdline argument. Pr…
Browse files Browse the repository at this point in the history
…ompts for rom image.
  • Loading branch information
visrealm committed Sep 2, 2023
1 parent fa629a4 commit b4aa1e6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
branch = docking
[submodule "emulator/thirdparty/ImGui-Addons"]
path = emulator/thirdparty/ImGui-Addons
url = https://github.com/gallickgunner/ImGui-Addons.git
url = https://github.com/visrealm/ImGui-Addons.git
[submodule "emulator/modules/65c22"]
path = emulator/modules/65c22
url = https://github.com/visrealm/vrEmu6522.git
Binary file modified emulator/bin/Hbc56Emu.exe
Binary file not shown.
6 changes: 3 additions & 3 deletions emulator/bin/imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ Collapsed=0
DockId=0x00000010,1

[Window][LCD (12864B)]
Pos=765,275
Size=603,315
Pos=765,201
Size=603,140
Collapsed=0
DockId=0x0000000C,1
DockId=0x0000000C,2

[Window][Source]
Pos=765,201
Expand Down
14 changes: 8 additions & 6 deletions emulator/src/hbc56emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ static imgui_addons::ImGuiFileBrowser file_dialog; // As a class member or globa
extern "C" {
#endif

bool fileOpen = false;



/* Function: hbc56Reset
* --------------------
Expand Down Expand Up @@ -571,8 +574,6 @@ static void doRender()
ImGui::PushStyleColor(ImGuiCol_TableHeaderBg, ImVec4(0.1f, 0.1f, 0.1f, 1.0f));
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);

bool fileOpen = false;

if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("File"))
Expand Down Expand Up @@ -646,7 +647,7 @@ static void doRender()
#if !__EMSCRIPTEN__
if (fileOpen) ImGui::OpenPopup("Open File");

if (file_dialog.showFileDialog("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ImVec2(700, 310), ".o"))
if (file_dialog.showFileDialog("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ImVec2(700, 310), ".o", &fileOpen))
{
loadRom(file_dialog.selected_path.c_str());
}
Expand Down Expand Up @@ -1212,11 +1213,12 @@ int main(int argc, char* argv[])
//SDLCommonLogUsage(state, argv[0], options);

#ifndef __EMSCRIPTEN__
SDL_snprintf(tempBuffer, sizeof(tempBuffer), "No HBC-56 ROM file.\n\nUse --rom <romfile>");
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Troy's HBC-56 Emulator", tempBuffer, NULL);
fileOpen = true;
//SDL_snprintf(tempBuffer, sizeof(tempBuffer), "No HBC-56 ROM file.\n\nUse --rom <romfile>");
//SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Troy's HBC-56 Emulator", tempBuffer, NULL);
#endif

return 2;
//return 2;
}

/* randomise */
Expand Down
2 changes: 1 addition & 1 deletion emulator/thirdparty/ImGui-Addons
2 changes: 1 addition & 1 deletion tools/acme

0 comments on commit b4aa1e6

Please sign in to comment.