Skip to content

Commit

Permalink
w
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuxyz00 committed Jan 30, 2025
1 parent f704bbb commit 6d7b7ed
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 35 deletions.
4 changes: 2 additions & 2 deletions CasioEmuMsvc/Gui/AddressWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AddressWindow : public UIWindow {
}

void RenderCore() override {
ImGui::Text("%s", "AddressWindow.Header"_lc);
ImGui::TextUnformatted("AddressWindow.Header"_lc);
ImGui::Separator();

RenderAddressTable();
Expand Down Expand Up @@ -65,7 +65,7 @@ class AddressWindow : public UIWindow {
}

void RenderAddAddressControls() {
ImGui::Text("%s", "AddressWindow.Add"_lc);
ImGui::TextUnformatted("AddressWindow.Add"_lc);

ImGui::InputScalar("Address", ImGuiDataType_U32, &newAddress, 0, 0, "%x");
// ImGui::InputScalar("Value", ImGuiDataType_U8, &newValue);
Expand Down
4 changes: 2 additions & 2 deletions CasioEmuMsvc/Gui/CallAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct CallAnalysis : public UIWindow {
for (auto& func : funcs) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("%s", lookup_symbol(func.first).c_str());
ImGui::TextUnformatted(lookup_symbol(func.first).c_str());
ImGui::TableNextColumn();
ImGui::Text("%d", (int)func.second.size());
ImGui::TableNextColumn();
Expand Down Expand Up @@ -155,7 +155,7 @@ struct CallAnalysis : public UIWindow {
funcs.clear();
}
ImGui::Separator();
ImGui::Text("%s", "CallAnalysis.Filters"_lc);
ImGui::TextUnformatted("CallAnalysis.Filters"_lc);
ImGui::Checkbox("CallAnalysis.CalleeFilter"_lc,
&check_callee);
ImGui::SameLine();
Expand Down
4 changes: 2 additions & 2 deletions CasioEmuMsvc/Gui/CodeViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void CodeViewer::RenderCore() {
int w = ImGui::CalcTextSize("F").x;
if (!is_loaded) {
ImGui::SetCursorPos(ImVec2(w * 2, h * 5));
ImGui::Text("%s", "CodeViewer.Loading"_lc);
ImGui::TextUnformatted("CodeViewer.Loading"_lc);
return;
}
ImVec2 sz;
Expand Down Expand Up @@ -338,7 +338,7 @@ void CodeViewer::RenderCore() {
ImGui::EndChild();
ImGui::SameLine();
ImGui::Separator();
ImGui::Text("%s", "CodeViewer.Goto"_lc);
ImGui::TextUnformatted("CodeViewer.Goto"_lc);
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::CalcTextSize("000000").x);
ImGui::InputText("##input", adrbuf, 8);
Expand Down
6 changes: 3 additions & 3 deletions CasioEmuMsvc/Gui/Injector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void Injector::RenderInjectorTab(InjectorData& inj, int index, bool& show_info,
return false;
};

ImGui::Text("%s", "Rop.InjectAddr"_lc);
ImGui::TextUnformatted("Rop.InjectAddr"_lc);
ImGui::SameLine();
ImGui::SetNextItemWidth(80);
ImGui::InputText(("##addr" + std::to_string(index)).c_str(), inj.addr, 10);
Expand Down Expand Up @@ -252,7 +252,7 @@ void Injector::RenderCore() {

if (ImGui::BeginTabBar("Rop.TabBar"_lc)) {
if (ImGui::BeginTabItem("Rop.XAnMode"_lc)) {
ImGui::Text("%s", "Rop.InputSize"_lc);
ImGui::TextUnformatted("Rop.InputSize"_lc);
ImGui::SameLine();
ImGui::SetNextItemWidth(80);
ImGui::InputText("##off", buf, 9);
Expand Down Expand Up @@ -336,7 +336,7 @@ void Injector::RenderCore() {
}

if (ImGui::BeginPopupModal("Rop.InfoPopup"_lc, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("%s", info_msg.c_str());
ImGui::TextUnformatted(info_msg.c_str());
if (ImGui::Button("Button.Positive"_lc)) {
show_info = false;
ImGui::CloseCurrentPopup();
Expand Down
4 changes: 2 additions & 2 deletions CasioEmuMsvc/Gui/LabelViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "stringhelper.h"

void LabelViewer::RenderCore() {
ImGui::Text("%s", "Label.GeneralHeader"_lc);
ImGui::TextUnformatted("Label.GeneralHeader"_lc);
ImGui::Separator();
auto labels = casioemu::GetCommonMemLabels(m_emu->hardware_id);
std::sort(labels.begin(), labels.end());
Expand All @@ -27,7 +27,7 @@ void LabelViewer::RenderCore() {
ImGui::TextUnformatted(desc.c_str());
ImGui::Separator();
}
ImGui::Text("%s", "Label.SfrsHeader"_lc);
ImGui::TextUnformatted("Label.SfrsHeader"_lc);
ImGui::Separator();
auto regs = me_mmu->GetRegions();
std::sort(regs.begin(), regs.end(), [](casioemu::MMURegion* a, casioemu::MMURegion* b) { return a->base < b->base; });
Expand Down
2 changes: 1 addition & 1 deletion CasioEmuMsvc/Gui/MemBreakPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void MemBreakPoint::DrawContent() {
if (ImGui::BeginPopupContextItem()) {
selected = i;

ImGui::Text("%s", "MemBP.BPType"_lc);
ImGui::TextUnformatted("MemBP.BPType"_lc);
if (ImGui::Button("HexEditors.ContextMenu.MonitorRead"_lc)) {
target_addr = i;
data.enableWrite = 0;
Expand Down
24 changes: 16 additions & 8 deletions CasioEmuMsvc/Gui/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,34 @@ struct ThemeSettings {
bool isDarkMode = true;
char language[30] = "";
float scale = 1.0f;

void Write(std::ostream& stm) const {
Binary::Write(stm, isDarkMode);
stm.write(language, sizeof(language));
Binary::Write(stm, scale);
}

void Read(std::istream& stm) {
Binary::Read(stm, isDarkMode);
stm.read(language, sizeof(language));
Binary::Read(stm, scale);
}
};

static ThemeSettings g_settings;

void SaveThemeSettings() {
std::ofstream file("./theme.txt");
std::ofstream file("./theme.bin", std::ios::binary);
if (file.is_open()) {
file << g_settings.isDarkMode << std::endl;
file << g_settings.language << std::endl;
file << g_settings.scale << std::endl;
Binary::Write(file, g_settings);
file.close();
}
}

void LoadThemeSettings() {
std::ifstream file("./theme.txt");
std::ifstream file("./theme.bin", std::ios::binary);
if (file.is_open()) {
file >> g_settings.isDarkMode;
file >> g_settings.language;
file >> g_settings.scale;
Binary::Read(file, g_settings);
file.close();

if (g_settings.isDarkMode) {
Expand Down
4 changes: 3 additions & 1 deletion CasioEmuMsvc/Gui/Theme.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include <Ui.hpp>
#include "Binary.h"

UIWindow* MakeThemeWindow();

void SaveThemeSettings();
void LoadThemeSettings();
void LoadThemeSettings();
6 changes: 3 additions & 3 deletions CasioEmuMsvc/Gui/VariableWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ void VariableWindow::RenderCore() {
static bool showhex = false;
static bool showimg_auto = true;
static bool showimg_f = false;
ImGui::Text("%s", "VarWindow.Variable"_lc);
ImGui::TextUnformatted("VarWindow.Variable"_lc);
ImGui::SameLine(90);
ImGui::Text("%s", "VarWindow.ReP"_lc);
ImGui::TextUnformatted("VarWindow.ReP"_lc);
bool is_in_im = (*(base_addr + casioemu::GetModeOffset(m_emu->hardware_id)) & 0xFF) == 0xC4;
bool s_im = showimg_f ? 1 : (showimg_auto ? is_in_im : 0);
if (s_im) {
ImGui::SameLine(320);
ImGui::Text("%s", "VarWindow.ImP"_lc);
ImGui::TextUnformatted("VarWindow.ImP"_lc);
}
for (const auto& v : vars) {
if (is_in_im && !strcmp(v.Name, "PreAns"))
Expand Down
2 changes: 1 addition & 1 deletion CasioEmuMsvc/Gui/WatchWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void WatchWindow::RenderCore() {
}
ImGui::EndChild();
ImGui::BeginChild("##stack_view");
ImGui::Text("%s", "WatchWindow.StackMemViewRange"_lc);
ImGui::TextUnformatted("WatchWindow.StackMemViewRange"_lc);
ImGui::SameLine();
ImGui::SliderInt("##range", &range, 64, 2048);
uint16_t offset = chipset.cpu.reg_sp & 0xffff;
Expand Down
20 changes: 10 additions & 10 deletions CasioEmuMsvc/StartupUi/StartupUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,31 +239,31 @@ class ModelEditor : public UIWindow {
}
ImGui::SetCursorPos({400, y});
if (ImGui::BeginChild("Model Info")) {
ImGui::Text("%s", "ModelEditor.Name"_lc);
ImGui::TextUnformatted("ModelEditor.Name"_lc);
if (ImGui::InputText("##name", name, 260)) {
mi.model_name = name;
}
ImGui::Text("%s", "ModelEditor.InterfacePath"_lc);
ImGui::TextUnformatted("ModelEditor.InterfacePath"_lc);
if (ImGui::InputText("##path1", path1, 260)) {
mi.interface_path = path1;
}
ImGui::Text("%s", "ModelEditor.RomPath"_lc);
ImGui::TextUnformatted("ModelEditor.RomPath"_lc);
if (ImGui::InputText("##path2", path2, 260)) {
mi.rom_path = path2;
}
ImGui::Text("%s", "ModelEditor.FlashDumpPath"_lc);
ImGui::TextUnformatted("ModelEditor.FlashDumpPath"_lc);
if (ImGui::InputText("##path3", path3, 260)) {
mi.flash_path = path3;
}
ImGui::Text("%s", "ModelEditor.CsrMask"_lc);
ImGui::TextUnformatted("ModelEditor.CsrMask"_lc);
if (ImGui::SliderInt("##a", &v, 0, 15, "0x%X")) {
mi.csr_mask = v;
}
ImGui::Text("%s", "ModelEditor.PdValue"_lc);
ImGui::TextUnformatted("ModelEditor.PdValue"_lc);
if (ImGui::SliderInt("##q", &k, 0, 15, "0x%X")) {
mi.pd_value = k;
}
ImGui::Text("%s", "ModelEditor.HardwareType"_lc);
ImGui::TextUnformatted("ModelEditor.HardwareType"_lc);
ImGui::SetNextItemWidth(80);
if (ImGui::BeginCombo("##cb", items[mi.hardware_id])) {
for (int n = 0; n < IM_ARRAYSIZE(items); n++) {
Expand Down Expand Up @@ -601,7 +601,7 @@ namespace casioemu {
#endif

if (ImGui::BeginPopupModal("StartupUI.EnterPassword"_lc, NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("%s", "StartupUI.PasswordPopupHint"_lc);
ImGui::TextUnformatted("StartupUI.PasswordPopupHint"_lc);

#ifdef __ANDROID__
float inputWidth = ImGui::GetContentRegionAvail().x - padding * 2;
Expand Down Expand Up @@ -665,9 +665,9 @@ namespace casioemu {
return;
}

ImGui::Text("%s", "StartupUI.ChooseModelHint"_lc);
ImGui::TextUnformatted("StartupUI.ChooseModelHint"_lc);
ImGui::Separator();
ImGui::Text("%s", "StartupUI.RecentlyUsed"_lc);
ImGui::TextUnformatted("StartupUI.RecentlyUsed"_lc);

if (ImGui::BeginTable("Recently", 4, pretty_table | ImGuiTableFlags_ScrollY, ImVec2(0, tableHeight))) {
RenderHeaders();
Expand Down

0 comments on commit 6d7b7ed

Please sign in to comment.