Fix openpopup issue, make JIT selectable
This commit is contained in:
@@ -17,8 +17,6 @@ bool AudioSettings::render() {
|
||||
|
||||
modified = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if(ImGui::SliderFloat("Volume L", &volumeL, 0.f, 100.f, "%.2f")) {
|
||||
Options::GetInstance().SetValue("audio", "volumeL", volumeL / 100.f);
|
||||
@@ -30,8 +28,6 @@ bool AudioSettings::render() {
|
||||
modified = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginDisabled(lockChannels);
|
||||
if(ImGui::SliderFloat("Volume R", &volumeR, 0.f, 100.f, "%.2f")) {
|
||||
Options::GetInstance().SetValue("audio", "volumeR", volumeR / 100.f);
|
||||
|
||||
@@ -19,10 +19,7 @@ bool CPUSettings::render() {
|
||||
|
||||
const char* combo_preview_value = items[selectedCpuTypeIndex];
|
||||
if (ImGui::BeginCombo("CPU Type", combo_preview_value)) {
|
||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++) {
|
||||
if(n == 1) // make JIT non-selectable but visible for now.
|
||||
ImGui::BeginDisabled(true);
|
||||
|
||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++) {
|
||||
const bool is_selected = (selectedCpuTypeIndex == n);
|
||||
if (ImGui::Selectable(items[n], is_selected)) {
|
||||
selectedCpuTypeIndex = n;
|
||||
@@ -32,9 +29,6 @@ bool CPUSettings::render() {
|
||||
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
||||
if (is_selected)
|
||||
ImGui::SetItemDefaultFocus();
|
||||
|
||||
if(n == 1) // make JIT non-selectable but visible for now.
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
@@ -43,7 +37,7 @@ bool CPUSettings::render() {
|
||||
if(selectedCpuTypeIndex == 0) {
|
||||
Options::GetInstance().SetValue<std::string>("cpu", "type", "interpreter");
|
||||
} else {
|
||||
Util::panic("JIT should not be selectable??");
|
||||
Options::GetInstance().SetValue<std::string>("cpu", "type", "jit");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -179,34 +179,47 @@ void KaizenGui::RenderUI() {
|
||||
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if(ImGui::MenuItem("Settings")) {
|
||||
settingsWindow.render();
|
||||
if(ImGui::MenuItem("Options")) {
|
||||
settingsWindow.isOpen = true;
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if(ImGui::BeginMenu("Help")) {
|
||||
if(ImGui::MenuItem("About")) {
|
||||
ImGui::OpenPopup("About Kaizen");
|
||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||
|
||||
if (ImGui::BeginPopupModal("About Kaizen", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
ImGui::Text("Kaizen is a Nintendo 64 emulator that strives");
|
||||
ImGui::Text("to offer a friendly user experience and compatibility.");
|
||||
ImGui::Text("Kaizen is licensed under the BSD 3-clause license.");
|
||||
ImGui::Text("Nintendo 64 is a registered trademark of Nintendo Co., Ltd.");
|
||||
if(ImGui::Button("OK")) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
aboutOpen = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
if(settingsWindow.isOpen) {
|
||||
ImGui::OpenPopup("Settings", ImGuiPopupFlags_None);
|
||||
}
|
||||
|
||||
if(aboutOpen) {
|
||||
ImGui::OpenPopup("About Kaizen");
|
||||
}
|
||||
|
||||
settingsWindow.render();
|
||||
|
||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||
|
||||
if (ImGui::BeginPopupModal("About Kaizen", &aboutOpen, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
ImGui::Text("Kaizen is a Nintendo 64 emulator that strives");
|
||||
ImGui::Text("to offer a friendly user experience and compatibility.");
|
||||
ImGui::Text("Kaizen is licensed under the BSD 3-clause license.");
|
||||
ImGui::Text("Nintendo 64 is a registered trademark of Nintendo Co., Ltd.");
|
||||
if(ImGui::Button("OK")) {
|
||||
aboutOpen = false;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if(ImGui::BeginMainStatusBar()) {
|
||||
ImGui::Text("FPS: %.2f", ImGui::GetIO().Framerate);
|
||||
ImGui::EndMainStatusBar();
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
void LoadTAS(const std::string &path) const noexcept;
|
||||
void LoadROM(const std::string &path) noexcept;
|
||||
private:
|
||||
bool aboutOpen = false;
|
||||
bool quit = false;
|
||||
std::function<void()> emuExitFunc;
|
||||
void FileDialog();
|
||||
|
||||
@@ -8,17 +8,12 @@
|
||||
std::string savePath;
|
||||
|
||||
bool SettingsWindow::render() {
|
||||
ImGui::OpenPopup("Settings", ImGuiPopupFlags_None);
|
||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||
|
||||
if(ImGui::BeginPopupModal("Settings")) {
|
||||
if(ImGui::BeginPopupModal("Settings", &isOpen)) {
|
||||
if(ImGui::BeginTabBar("SettingsTabBar")) {
|
||||
if(ImGui::BeginTabItem("General")) {
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::InputText("Save Path", (char*)savesPath.c_str(), savesPath.length());
|
||||
ImGui::EndDisabled();
|
||||
ImGui::SameLine();
|
||||
if(ImGui::Button("Pick...")) {
|
||||
NFD::Guard guard;
|
||||
NFD::UniquePath outPath;
|
||||
@@ -33,6 +28,10 @@ bool SettingsWindow::render() {
|
||||
applyEnabled = true;
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::InputText("Save Path", (char*)savesPath.c_str(), savesPath.length());
|
||||
ImGui::EndDisabled();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
@@ -65,6 +64,7 @@ bool SettingsWindow::render() {
|
||||
ImGui::SameLine();
|
||||
|
||||
if(ImGui::Button("Cancel")) {
|
||||
isOpen = false;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
|
||||
@@ -10,6 +10,7 @@ class SettingsWindow final {
|
||||
std::string savesPath;
|
||||
bool applyEnabled = false;
|
||||
public:
|
||||
bool isOpen = false;
|
||||
bool render();
|
||||
SettingsWindow() = default;
|
||||
[[nodiscard]] float getVolumeL() const { return audioSettings.volumeL / 100.f; }
|
||||
|
||||
Reference in New Issue
Block a user