comment out imgui stuff for now

This commit is contained in:
CocoSimone
2022-08-11 19:54:03 +02:00
parent 402062920e
commit 2e05e81c53
10 changed files with 40 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
#include <App.hpp>
#include <parallel-rdp/ParallelRDPWrapper.hpp>
#include <nfd.hpp>
void App::Run() {
// Main loop
@@ -7,11 +8,24 @@ void App::Run() {
while (!done) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
ImGui_ImplSDL2_ProcessEvent(&event);
//ImGui_ImplSDL2_ProcessEvent(&event);
if (event.type == SDL_QUIT)
done = true;
if (window.gotClosed(event))
done = true;
if(event.type == SDL_KEYDOWN) {
switch(event.key.keysym.sym) {
case SDLK_o: {
nfdchar_t* outpath;
const nfdu8filteritem_t filter {"Nintendo 64 roms", "n64,z64,v64,N64,Z64,V64"};
nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr);
if(result == NFD_OKAY) {
core.LoadROM(outpath);
NFD_FreePath(outpath);
}
} break;
}
}
}
if(core.initialized)
@@ -19,5 +33,7 @@ void App::Run() {
if(core.initialized) UpdateScreenParallelRdp(window, core.GetVI());
else UpdateScreenParallelRdpNoGame(window);
SDL_Delay(16);
}
}
}

View File

@@ -7,7 +7,7 @@
Window::Window(const n64::Core& core) {
InitSDL();
InitParallelRDP(core.GetRDRAM(), window);
InitImgui();
//InitImgui();
}
[[nodiscard]] bool Window::gotClosed(SDL_Event event) {
@@ -168,22 +168,22 @@ void Window::InitImgui() {
Window::~Window() {
VkResult err = vkDeviceWaitIdle(device);
check_vk_result(err);
ImGui_ImplVulkan_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
//ImGui_ImplVulkan_Shutdown();
//ImGui_ImplSDL2_Shutdown();
//ImGui::DestroyContext();
vkDestroyDescriptorPool(device, descriptorPool, nullptr);
vkDestroyDevice(device, nullptr);
vkDestroyInstance(instance, nullptr);
}
ImDrawData* Window::Present() {
ImGui_ImplVulkan_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();
//ImGui_ImplVulkan_NewFrame();
//ImGui_ImplSDL2_NewFrame(window);
//ImGui::NewFrame();
//
Render();
ImGui::Render();
//ImGui::Render();
return ImGui::GetDrawData();
}

View File

@@ -19,19 +19,18 @@ void Mem::LoadROM(const std::string& filename) {
util::panic("Unable to open {}!", filename);
}
file.seekg(std::ios::end);
file.seekg(0, std::ios::end);
auto size = file.tellg();
auto size_adjusted = util::NextPow2(size);
romMask = size_adjusted - 1;
file.seekg(std::ios::beg);
file.seekg(0, std::ios::beg);
std::vector<u8> rom;
rom.reserve(size_adjusted);
file.read(reinterpret_cast<char*>(rom.data()), size);
cart.resize(size_adjusted);
file.read(reinterpret_cast<char*>(cart.data()), size);
file.close();
util::SwapN64Rom(size, rom.data());
memcpy(dmem, rom.data(), 0x1000);
util::SwapN64Rom(size, cart.data());
memcpy(mmio.rsp.dmem, cart.data(), 0x1000);
}
template <bool tlb>

View File

@@ -27,7 +27,6 @@ private:
friend struct Core;
MMIO mmio;
std::vector<u8> cart, rdram, sram;
u8 dmem[DMEM_SIZE]{}, imem[IMEM_SIZE]{};
u8 pifBootrom[PIF_BOOTROM_SIZE]{};
size_t romMask;
};

View File

@@ -146,7 +146,7 @@ inline size_t NextPow2(size_t num) {
return num + 1;
}
inline auto ReadFileBinary(const std::string& path, u32* buf) {
inline auto ReadFileBinary(const std::string& path, u32** buf) {
std::ifstream file(path, std::ios::binary);
file.unsetf(std::ios::skipws);
if(!file.is_open()) {
@@ -157,8 +157,8 @@ inline auto ReadFileBinary(const std::string& path, u32* buf) {
size_t size = file.tellg();
file.seekg(0, std::ios::beg);
buf = (u32*)calloc(size, 1);
file.read(reinterpret_cast<char*>(buf), size);
*buf = (u32*)calloc(size, 1);
file.read(reinterpret_cast<char*>(*buf), size);
file.close();
return size;
}