diff --git a/emulator/Common.h b/emulator/Common.h
index c47a0c0..3f4fd6f 100644
--- a/emulator/Common.h
+++ b/emulator/Common.h
@@ -12,18 +12,6 @@ UKNCBTL. If not, see . */
#pragma once
-//////////////////////////////////////////////////////////////////////
-
-#ifdef _DEBUG
-#define APP_VERSION_STRING "DEBUG"
-#define APP_REVISION 0
-#elif !defined(PRODUCT)
-#define APP_VERSION_STRING "RELEASE"
-#define APP_REVISION 0
-#else
-#include "Version.h"
-#endif
-
//////////////////////////////////////////////////////////////////////
// Assertions checking - MFC-like ASSERT macro
diff --git a/emulator/ConsoleView.cpp b/emulator/ConsoleView.cpp
index 6406cd5..920aa92 100644
--- a/emulator/ConsoleView.cpp
+++ b/emulator/ConsoleView.cpp
@@ -35,7 +35,7 @@ void ConsoleView_DoConsoleCommand();
void ConsoleView_Init()
{
- ConsoleView_Print("UKNCBTL emulator TODO version information.");
+ ConsoleView_Print("UKNCBTL ImGui version " APP_VERSION_STRING);
ConsoleView_Print("Use 'h' command to show help.");
ConsoleView_Print("");
}
diff --git a/emulator/DebugViews.cpp b/emulator/DebugViews.cpp
index ee09b27..443b4d4 100644
--- a/emulator/DebugViews.cpp
+++ b/emulator/DebugViews.cpp
@@ -144,7 +144,7 @@ void Breakpoints_ImGuiWidget()
if (isDeleteHovered)
{
- ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), ICON_FA_MINUS_CIRCLE);
+ ImGui::TextColored(g_colorBreak, ICON_FA_MINUS_CIRCLE);
ImGui::SameLine();
}
diff --git a/emulator/DisasmView.cpp b/emulator/DisasmView.cpp
index 2b3a957..119e0b3 100644
--- a/emulator/DisasmView.cpp
+++ b/emulator/DisasmView.cpp
@@ -90,7 +90,7 @@ void Disasm_DrawForRunningEmulator()
int index = 5;
ImGui::SetCursorPosX(xPosCurrentSign);
- ImGui::TextColored(ImVec4(0.0f, 0.67f, 0.0f, 1.0f), ICON_FA_PLAY);
+ ImGui::TextColored(g_colorPlay, ICON_FA_PLAY);
ImGui::SameLine(0.0f, 0.0f);
ImGui::SetCursorPosX(xPosAddress);
ImGui::Text("%06o ", address);
@@ -106,7 +106,7 @@ void Disasm_DrawForRunningEmulator()
void DisasmView_DrawJump(ImDrawList* draw_list, ImVec2 lineMin, int delta, float cyLine)
{
- ImU32 col = ImGui::ColorConvertFloat4ToU32(ImVec4(0.5f, 0.7f, 1.0f, 0.67f));
+ ImU32 col = ImGui::ColorConvertFloat4ToU32(g_colorJumpLine);
int dist = abs(delta);
if (dist < 2) dist = 2;
@@ -165,8 +165,8 @@ void Disasm_DrawForStoppedEmulator(CProcessor* pProc)
if (isBreakpoint || isBreakpointHovered)
{
ImVec4 colorBreak = isBreakpoint
- ? (isBreakpointHovered ? ImVec4(1.0f, 0.0f, 0.0f, 1.0f) : ImVec4(0.67f, 0.0f, 0.0f, 1.0f))
- : ImVec4(0.25f, 0.25f, 0.25f, 1.0f);
+ ? (isBreakpointHovered ? g_colorDisabledRed : g_colorBreak)
+ : ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled);
ImGui::TextColored(colorBreak, ICON_FA_CIRCLE);
ImGui::SameLine(0.0f, 0.0f);
@@ -176,13 +176,16 @@ void Disasm_DrawForStoppedEmulator(CProcessor* pProc)
if (address == proccurrent)
{
ImGui::SetCursorPosX(xPosCurrentSign);
- ImGui::TextColored(ImVec4(0.0f, 0.67f, 0.0f, 1.0f), ICON_FA_PLAY);
+ ImGui::TextColored(g_colorPlay, ICON_FA_PLAY);
ImGui::SameLine(0.0f, 0.0f);
}
+
+ int memorytype = m_DisasmAddrType[index];
+ ImVec4 colorAddr = (memorytype == ADDRTYPE_ROM) ? g_colorDisabledBlue : ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled);
ImGui::SetCursorPosX(xPosAddress);
- ImGui::Text("%06o ", address);
+ ImGui::TextColored(colorAddr, "%06o ", address);
ImGui::SameLine();
- ImGui::Text("%06o ", m_DisasmMemory[index]);
+ ImGui::TextDisabled("%06o ", m_DisasmMemory[index]);
ImGui::SameLine();
if (address >= disasmfrom && length == 0)
@@ -208,12 +211,12 @@ void Disasm_DrawForStoppedEmulator(CProcessor* pProc)
if (*m_strDisasmHint == 0) // we don't have the jump hint
{
Disasm_GetInstructionHint(m_DisasmMemory + index, pProc, pMemCtl, m_strDisasmHint, m_strDisasmHint2);
- ImGui::Text("%S", m_strDisasmHint);
+ ImGui::TextDisabled("%S", m_strDisasmHint);
ImGui::SameLine(0.0f, 0.0f);
}
else // we have jump hint
{
- ImVec4 color = m_okDisasmJumpPredict ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
+ ImVec4 color = m_okDisasmJumpPredict ? g_colorDisabledGreen : g_colorDisabledRed;
ImGui::TextColored(color, "%S", m_strDisasmHint);
ImGui::SameLine(0.0f, 0.0f);
}
@@ -221,7 +224,7 @@ void Disasm_DrawForStoppedEmulator(CProcessor* pProc)
if (address == proccurrent + 2 && *m_strDisasmHint2 != 0)
{
ImGui::SetCursorPosX(xPosHints);
- ImGui::Text("%S", m_strDisasmHint2);
+ ImGui::TextDisabled("%S", m_strDisasmHint2);
ImGui::SameLine(0.0f, 0.0f);
}
}
diff --git a/emulator/Main.h b/emulator/Main.h
index 6f83bac..69f674c 100644
--- a/emulator/Main.h
+++ b/emulator/Main.h
@@ -10,7 +10,11 @@ UKNCBTL. If not, see . */
#pragma once
-//#include "res/Resource.h"
+#ifdef _DEBUG
+#define APP_VERSION_STRING "DEBUG"
+#else
+#include "Version.h"
+#endif
//////////////////////////////////////////////////////////////////////
@@ -31,6 +35,14 @@ extern bool g_okVsyncSwitchable;
extern uint32_t* m_bits; // Screen buffer
extern ImTextureID g_ScreenTextureID;
+// Derived colors based and calculated using the current style
+extern ImVec4 g_colorPlay; // Play sign in Disasm window
+extern ImVec4 g_colorBreak; // Breakpoint
+extern ImVec4 g_colorJumpLine; // Jump arrow
+extern ImVec4 g_colorDisabledRed; // Disabled color shifted to red
+extern ImVec4 g_colorDisabledGreen; // Disabled color shifted to green
+extern ImVec4 g_colorDisabledBlue; // Disabled color shifted to blue
+
//////////////////////////////////////////////////////////////////////
// Main Window
diff --git a/emulator/MainWindow.cpp b/emulator/MainWindow.cpp
index 446a137..77f15de 100644
--- a/emulator/MainWindow.cpp
+++ b/emulator/MainWindow.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
+#include "imgui/imgui_internal.h"
#include "Main.h"
#include "Emulator.h"
#include "emubase/Emubase.h"
@@ -15,6 +16,14 @@ bool show_demo_window = false;
bool open_settings_popup = false;
bool open_about_popup = false;
+// Derived colors based and calculated using the current style
+ImVec4 g_colorPlay; // Play sign in Disasm window
+ImVec4 g_colorBreak; // Breakpoint
+ImVec4 g_colorJumpLine; // Jump arrow
+ImVec4 g_colorDisabledRed; // Disabled color shifted to red
+ImVec4 g_colorDisabledGreen; // Disabled color shifted to green
+ImVec4 g_colorDisabledBlue; // Disabled color shifted to blue
+
//////////////////////////////////////////////////////////////////////
@@ -88,6 +97,14 @@ void MainWindow_SetColorSheme(int scheme)
case 1: ImGui::StyleColorsLight(); break;
case 2: ImGui::StyleColorsClassic(); break;
}
+
+ // Calculate derived colors
+ g_colorPlay = ImLerp(ImGui::GetStyleColorVec4(ImGuiCol_Text), ImVec4(0.0f, 0.67f, 0.0f, 1.0f), 0.67f);
+ g_colorBreak = ImLerp(ImGui::GetStyleColorVec4(ImGuiCol_Text), ImVec4(1.0f, 0.0f, 0.0f, 1.0f), 0.67f);
+ g_colorJumpLine = ImLerp(ImGui::GetStyleColorVec4(ImGuiCol_Text), ImVec4(0.5f, 0.7f, 1.0f, 0.67f), 0.67f);
+ g_colorDisabledRed = ImLerp(ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled), ImVec4(1.0f, 0.0f, 0.0f, 1.0f), 0.33f);
+ g_colorDisabledGreen = ImLerp(ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled), ImVec4(0.0f, 1.0f, 0.0f, 1.0f), 0.33f);
+ g_colorDisabledBlue = ImLerp(ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled), ImVec4(0.0f, 0.0f, 1.0f, 1.0f), 0.33f);
}
void ImGuiMainMenu()
@@ -106,24 +123,6 @@ void ImGuiMainMenu()
//ImGui::MenuItem("Quit");//TODO
ImGui::EndMenu();
}
- if (ImGui::BeginMenu("View"))
- {
- int viewmode = Settings_GetScreenViewMode();
- bool checkedRGB = viewmode == 0;
- ImGui::BeginDisabled(checkedRGB);
- if (ImGui::MenuItem("RGB Screen", nullptr, &checkedRGB)) MainWindow_DoScreenViewMode(RGBScreen);
- ImGui::EndDisabled();
- bool checkedGRB = viewmode == 1;
- ImGui::BeginDisabled(checkedGRB);
- if (ImGui::MenuItem("GRB Screen", nullptr, &checkedGRB)) MainWindow_DoScreenViewMode(GRBScreen);
- ImGui::EndDisabled();
- bool checkedGray = viewmode == 2;
- ImGui::BeginDisabled(checkedGray);
- if (ImGui::MenuItem("Grayscale Screen", nullptr, &checkedGray)) MainWindow_DoScreenViewMode(GrayScreen);
- ImGui::EndDisabled();
-
- ImGui::EndMenu();
- }
if (ImGui::BeginMenu("Emulator"))
{
if (!g_okEmulatorRunning)
@@ -147,6 +146,12 @@ void ImGuiMainMenu()
ImGui::Separator();
+ bool sound = Settings_GetSound();
+ if (ImGui::MenuItem("Sound", nullptr, &sound))
+ MainWindow_DoEmulatorSound(sound);
+
+ ImGui::Separator();
+
WORD speed = Settings_GetRealSpeed();
bool checked25 = speed == 0x7ffe;
ImGui::BeginDisabled(checked25);
@@ -171,6 +176,101 @@ void ImGuiMainMenu()
ImGui::EndMenu();
}
+ if (ImGui::BeginMenu("Configuration"))
+ {
+ for (int floppyslot = 0; floppyslot < 4; floppyslot++)
+ {
+ char bufname[64];
+ if (g_pBoard->IsFloppyImageAttached(floppyslot))
+ {
+ sprintf(bufname, "FDD %d: " ICON_FA_EJECT " Eject###MenuFloppyEject%d", floppyslot, floppyslot);
+ if (ImGui::MenuItem(bufname))
+ MainWindow_DoFloppyImageEject(floppyslot);
+ ImGui::SameLine();
+
+ TCHAR buffilepath[MAX_PATH];
+ Settings_GetFloppyFilePath(floppyslot, buffilepath);
+ LPCTSTR lpFileName = GetFileNameFromFilePath(buffilepath);
+ ImGui::Text("%S", lpFileName);
+ }
+ else
+ {
+ sprintf(bufname, "FDD %d: Select...###MenuFloppySelect%d", floppyslot, floppyslot);
+ if (ImGui::MenuItem(bufname))
+ MainWindow_DoFloppyImageSelect(floppyslot);
+ }
+ }
+
+ ImGui::Separator();
+
+ for (int cartslot = 1; cartslot <= 2; cartslot++)
+ {
+ char bufname[64];
+ if (g_pBoard->IsROMCartridgeLoaded(cartslot))
+ {
+ sprintf(bufname, "Cart %d: " ICON_FA_EJECT " Eject###MenuCartEject%d", cartslot, cartslot);
+ if (ImGui::MenuItem(bufname))
+ MainWindow_DoCartridgeEject(cartslot);
+ ImGui::SameLine();
+
+ TCHAR buffilepath[MAX_PATH];
+ Settings_GetCartridgeFilePath(cartslot, buffilepath);
+ LPCTSTR lpFileName = GetFileNameFromFilePath(buffilepath);
+ ImGui::Text("%S", lpFileName);
+ }
+ else
+ {
+ sprintf(bufname, "Cart %d: Select...###MenuCartSelect%d", cartslot, cartslot);
+ if (ImGui::MenuItem(bufname))
+ MainWindow_DoCartridgeSelect(cartslot);
+ }
+ if (g_pBoard->IsROMCartridgeLoaded(cartslot))
+ {
+ if (g_pBoard->IsHardImageAttached(cartslot))
+ {
+ sprintf(bufname, " " ICON_FA_HDD " HDD: " ICON_FA_EJECT " Eject###MenuHardEject%d", cartslot);
+ if (ImGui::MenuItem(bufname))
+ MainWindow_DoHardImageEject(cartslot);
+ ImGui::SameLine();
+
+ TCHAR buffilepath[MAX_PATH];
+ Settings_GetHardFilePath(cartslot, buffilepath);
+ LPCTSTR lpFileName = GetFileNameFromFilePath(buffilepath);
+ ImGui::Text("%S", lpFileName);
+ }
+ else
+ {
+ sprintf(bufname, " " ICON_FA_HDD " HDD: Select... ###MenuHardSelect%d", cartslot);
+ if (ImGui::MenuItem(bufname))
+ MainWindow_DoHardImageSelect(cartslot);
+ }
+ }
+ else
+ {
+ ImGui::TextDisabled(" " ICON_FA_HDD " HDD");
+ }
+ }
+
+ ImGui::EndMenu();
+ }
+ if (ImGui::BeginMenu("Video"))
+ {
+ int viewmode = Settings_GetScreenViewMode();
+ bool checkedRGB = viewmode == 0;
+ ImGui::BeginDisabled(checkedRGB);
+ if (ImGui::MenuItem("RGB Screen", nullptr, &checkedRGB)) MainWindow_DoScreenViewMode(RGBScreen);
+ ImGui::EndDisabled();
+ bool checkedGRB = viewmode == 1;
+ ImGui::BeginDisabled(checkedGRB);
+ if (ImGui::MenuItem("GRB Screen", nullptr, &checkedGRB)) MainWindow_DoScreenViewMode(GRBScreen);
+ ImGui::EndDisabled();
+ bool checkedGray = viewmode == 2;
+ ImGui::BeginDisabled(checkedGray);
+ if (ImGui::MenuItem("Grayscale Screen", nullptr, &checkedGray)) MainWindow_DoScreenViewMode(GrayScreen);
+ ImGui::EndDisabled();
+
+ ImGui::EndMenu();
+ }
if (ImGui::BeginMenu("Debug"))
{
ImGui::BeginDisabled(g_okEmulatorRunning);
@@ -260,7 +360,7 @@ void ImGuiAboutPopup()
{
if (ImGui::BeginPopupModal("about_popup", nullptr, ImGuiWindowFlags_AlwaysAutoResize))
{
- ImGui::Text("UKNCBTL ImGui version");
+ ImGui::Text("UKNCBTL ImGui version " APP_VERSION_STRING);
ImGui::TextLinkOpenURL("Source code", "https://github.com/nzeemin/ukncbtl-imgui");
ImGui::Spacing();