Remove memory editor

This commit is contained in:
CocoSimone
2022-10-18 12:22:17 +02:00
parent 7305aff4ed
commit 6a42a212c4
23 changed files with 64 additions and 223 deletions

View File

@@ -1,8 +1,6 @@
#include <Window.hpp>
#include <util.hpp>
#include <nfd.hpp>
#include <Core.hpp>
#include <utility>
#include <Audio.hpp>
#include <nlohmann/json.hpp>
#include <filesystem>
@@ -49,18 +47,6 @@ static void check_vk_result(VkResult err) {
}
}
inline ImU8 readHandler(const ImU8* core_, size_t offset) {
auto* core = reinterpret_cast<n64::Core*>(const_cast<ImU8*>(core_));
auto& mem = core->mem;
return mem.Read8<false, false>(core->cpu.regs, offset, core->cpu.regs.oldPC);
}
inline void writeHandler(ImU8* core_, size_t offset, ImU8 value) {
auto* core = reinterpret_cast<n64::Core*>(const_cast<ImU8*>(core_));
auto& mem = core->mem;
mem.Write8<false, false>(core->cpu.regs, offset, value, core->cpu.regs.oldPC);
}
void Window::InitImgui(const n64::Core& core) {
VkResult err;
@@ -135,10 +121,6 @@ void Window::InitImgui(const n64::Core& core) {
ImGui_ImplVulkan_CreateFontsTexture(commandBuffer);
SubmitRequestedVkCommandBuffer();
}
memoryEditor.ReadFn = readHandler;
memoryEditor.WriteFn = writeHandler;
memoryEditor.Cols = 32;
}
Window::~Window() {
@@ -187,6 +169,7 @@ void Window::Render(n64::Core& core) {
ImGui::PushFont(uiFont);
u32 ticks = SDL_GetTicks();
static u32 lastFrame = 0;
if(!core.pause && lastFrame < ticks - 1000) {
lastFrame = ticks;
windowTitle += fmt::format(" | {:02d} In-Game FPS", core.mem.mmio.vi.swaps);
@@ -195,13 +178,7 @@ void Window::Render(n64::Core& core) {
windowTitle = shadowWindowTitle;
}
static bool showSettings = false;
static bool showMemEditor = false;
bool showMainMenuBar = windowID == SDL_GetWindowID(SDL_GetMouseFocus());
if(showMemEditor) {
ImGui::PushFont(codeFont);
memoryEditor.DrawWindow("Memory viewer", &core, 0x80000000);
ImGui::PopFont();
}
if(showMainMenuBar) {
ImGui::BeginMainMenuBar();
if (ImGui::BeginMenu("File")) {
@@ -250,7 +227,6 @@ void Window::Render(n64::Core& core) {
if (ImGui::MenuItem("Settings")) {
showSettings = true;
}
ImGui::Checkbox("Show memory editor", &showMemEditor);
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();

View File

@@ -3,7 +3,6 @@
#include <imgui.h>
#include <imgui_impl_sdl.h>
#include <imgui_impl_vulkan.h>
#include <imgui_memory_editor.h>
#include <SDL.h>
#include <Core.hpp>
#include <vector>
@@ -14,16 +13,15 @@ struct Window {
ImDrawData* Present(n64::Core& core);
[[nodiscard]] bool gotClosed(SDL_Event event);
ImFont *uiFont, *codeFont;
u32 windowID;
ImFont *uiFont{}, *codeFont{};
u32 windowID{};
float volumeL = 0.5, volumeR = 0.5;
void LoadROM(n64::Core& core, const std::string& path);
private:
bool lockVolume = true;
SDL_Window* window;
SDL_Window* window{};
std::string windowTitle;
std::string shadowWindowTitle;
u32 lastFrame = 0;
void InitSDL();
void InitImgui(const n64::Core& core);
void Render(n64::Core& core);
@@ -36,8 +34,5 @@ private:
VkDescriptorPool descriptorPool{};
VkAllocationCallbacks* allocator{};
MemoryEditor memoryEditor;
u32 minImageCount = 2;
bool rebuildSwapchain = false;
};