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