keep fixing parallel-rdp stuff
This commit is contained in:
BIN
external/frag.spv
vendored
Normal file
BIN
external/frag.spv
vendored
Normal file
Binary file not shown.
7
external/parallel-rdp/CMakeLists.txt
vendored
7
external/parallel-rdp/CMakeLists.txt
vendored
@@ -55,13 +55,18 @@ target_include_directories(parallel-rdp PUBLIC
|
|||||||
parallel-rdp-standalone/vulkan
|
parallel-rdp-standalone/vulkan
|
||||||
parallel-rdp-standalone/vulkan-headers/include
|
parallel-rdp-standalone/vulkan-headers/include
|
||||||
parallel-rdp-standalone/util
|
parallel-rdp-standalone/util
|
||||||
../../src/cores
|
../../src/n64
|
||||||
|
../../src/n64/core/
|
||||||
|
../../src/n64/core/cpu/
|
||||||
|
../../src/n64/core/cpu/registers
|
||||||
parallel-rdp-standalone
|
parallel-rdp-standalone
|
||||||
..
|
..
|
||||||
../../src/frontend
|
../../src/frontend
|
||||||
|
../../src
|
||||||
../imgui
|
../imgui
|
||||||
../imgui/imgui
|
../imgui/imgui
|
||||||
../imgui/imgui/backends
|
../imgui/imgui/backends
|
||||||
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
14
external/parallel-rdp/ParallelRDPWrapper.cpp
vendored
14
external/parallel-rdp/ParallelRDPWrapper.cpp
vendored
@@ -1,5 +1,5 @@
|
|||||||
#include <parallel-rdp/ParallelRDPWrapper.hpp>
|
#include <ParallelRDPWrapper.hpp>
|
||||||
#include <n64/core/RDP.hpp>
|
#include <core/RDP.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <rdp_device.hpp>
|
#include <rdp_device.hpp>
|
||||||
#include <util.hpp>
|
#include <util.hpp>
|
||||||
@@ -115,7 +115,7 @@ WSI* LoadWSIPlatform(Vulkan::WSIPlatform* wsi_platform, std::unique_ptr<Parallel
|
|||||||
wsi->set_backbuffer_srgb(false);
|
wsi->set_backbuffer_srgb(false);
|
||||||
wsi->set_platform(wsi_platform);
|
wsi->set_platform(wsi_platform);
|
||||||
Context::SystemHandles handles;
|
Context::SystemHandles handles;
|
||||||
if (!wsi->init_context_from_platform(1, handles)) {
|
if (!wsi->init_simple(1, handles)) {
|
||||||
util::panic("Failed to initialize WSI!");
|
util::panic("Failed to initialize WSI!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,11 +139,11 @@ void LoadParallelRDP(const u8* rdram) {
|
|||||||
fragLayout.sets[0].fp_mask = 1;
|
fragLayout.sets[0].fp_mask = 1;
|
||||||
fragLayout.sets[0].array_size[0] = 1;
|
fragLayout.sets[0].array_size[0] = 1;
|
||||||
|
|
||||||
u32* fullscreenQuadVert = nullptr, *fullscreenQuadFrag = nullptr;
|
u32* fullscreenQuadVert, *fullscreenQuadFrag;
|
||||||
util::ReadFileBinary("external/vert.spv", fullscreenQuadVert);
|
auto sizeVert = util::ReadFileBinary("external/vert.spv", fullscreenQuadVert);
|
||||||
util::ReadFileBinary("external/frag.spv", fullscreenQuadFrag);
|
auto sizeFrag = util::ReadFileBinary("external/frag.spv", fullscreenQuadFrag);
|
||||||
|
|
||||||
fullscreen_quad_program = wsi->get_device().request_program(fullscreenQuadVert, sizeof(fullscreenQuadVert), fullscreenQuadFrag, sizeof(fullscreenQuadFrag), &vertLayout, &fragLayout);
|
fullscreen_quad_program = wsi->get_device().request_program(fullscreenQuadVert, sizeVert, fullscreenQuadFrag, sizeFrag, &vertLayout, &fragLayout);
|
||||||
|
|
||||||
auto aligned_rdram = reinterpret_cast<uintptr_t>(rdram);
|
auto aligned_rdram = reinterpret_cast<uintptr_t>(rdram);
|
||||||
uintptr_t offset = 0;
|
uintptr_t offset = 0;
|
||||||
|
|||||||
2
external/parallel-rdp/ParallelRDPWrapper.hpp
vendored
2
external/parallel-rdp/ParallelRDPWrapper.hpp
vendored
@@ -2,7 +2,7 @@
|
|||||||
#include <Core.hpp>
|
#include <Core.hpp>
|
||||||
#include <wsi.hpp>
|
#include <wsi.hpp>
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <n64/core/mmio/VI.hpp>
|
#include <core/mmio/VI.hpp>
|
||||||
|
|
||||||
struct Window;
|
struct Window;
|
||||||
static SDL_Window* window;
|
static SDL_Window* window;
|
||||||
|
|||||||
BIN
external/vert.spv
vendored
Normal file
BIN
external/vert.spv
vendored
Normal file
Binary file not shown.
@@ -6,7 +6,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED true)
|
|||||||
add_subdirectory(n64)
|
add_subdirectory(n64)
|
||||||
add_subdirectory(frontend)
|
add_subdirectory(frontend)
|
||||||
|
|
||||||
|
find_package(fmt REQUIRED)
|
||||||
|
|
||||||
add_executable(natsukashii main.cpp)
|
add_executable(natsukashii main.cpp)
|
||||||
|
|
||||||
target_link_libraries(natsukashii PUBLIC frontend n64)
|
target_link_libraries(natsukashii PUBLIC frontend n64 fmt)
|
||||||
target_include_directories(natsukashii PUBLIC . ../external)
|
target_include_directories(natsukashii PUBLIC . ../external)
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ void App::Run() {
|
|||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(core->initialized)
|
if(core.initialized)
|
||||||
core->Run();
|
core.Run();
|
||||||
if(core->system == System::Nintendo64) {
|
|
||||||
if(core->initialized) UpdateScreenParallelRdp(window, dynamic_cast<n64::Core*>(core.get())->GetVI());
|
if(core.initialized) UpdateScreenParallelRdp(window, core.GetVI());
|
||||||
else UpdateScreenParallelRdpNoGame(window);
|
else UpdateScreenParallelRdpNoGame(window);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <BaseCore.hpp>
|
#include <Core.hpp>
|
||||||
#include <imgui/Window.hpp>
|
#include <imgui/Window.hpp>
|
||||||
|
|
||||||
struct App {
|
struct App {
|
||||||
App() : window(core) {};
|
App() : window(core) {};
|
||||||
void Run();
|
void Run();
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<BaseCore> core;
|
n64::Core core;
|
||||||
Window window;
|
Window window;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,11 +9,14 @@ add_library(frontend
|
|||||||
|
|
||||||
target_include_directories(frontend PUBLIC
|
target_include_directories(frontend PUBLIC
|
||||||
.
|
.
|
||||||
|
..
|
||||||
../../external
|
../../external
|
||||||
../../external/parallel-rdp
|
../../external/parallel-rdp
|
||||||
../../external/parallel-rdp/parallel-rdp-standalone/vulkan
|
../../external/parallel-rdp/parallel-rdp-standalone/vulkan
|
||||||
../../external/parallel-rdp/parallel-rdp-standalone/util
|
../../external/parallel-rdp/parallel-rdp-standalone/util
|
||||||
../../external/parallel-rdp/parallel-rdp-standalone/volk
|
../../external/parallel-rdp/parallel-rdp-standalone/volk
|
||||||
../cores
|
../n64
|
||||||
../cores/n64)
|
../n64/core
|
||||||
|
../n64/core/cpu
|
||||||
|
../n64/core/cpu/registers)
|
||||||
target_link_libraries(frontend PUBLIC frontend-imgui)
|
target_link_libraries(frontend PUBLIC frontend-imgui)
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ add_library(frontend-imgui
|
|||||||
|
|
||||||
target_include_directories(frontend-imgui PUBLIC
|
target_include_directories(frontend-imgui PUBLIC
|
||||||
.
|
.
|
||||||
|
../..
|
||||||
../../n64
|
../../n64
|
||||||
|
../../n64/core
|
||||||
|
../../n64/core/cpu
|
||||||
|
../../n64/core/cpu/registers
|
||||||
../../../external
|
../../../external
|
||||||
../../../external/parallel-rdp/parallel-rdp-standalone/vulkan
|
../../../external/parallel-rdp/parallel-rdp-standalone/vulkan
|
||||||
../../../external/parallel-rdp/parallel-rdp-standalone/util
|
../../../external/parallel-rdp/parallel-rdp-standalone/util
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <parallel-rdp/ParallelRDPWrapper.hpp>
|
#include <parallel-rdp/ParallelRDPWrapper.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
Window::Window(n64::Core& core) {
|
Window::Window(const n64::Core& core) {
|
||||||
InitSDL();
|
InitSDL();
|
||||||
InitParallelRDP(core.GetRDRAM());
|
InitParallelRDP(core.GetRDRAM());
|
||||||
InitImgui();
|
InitImgui();
|
||||||
@@ -191,9 +191,7 @@ void Window::Render() {
|
|||||||
const nfdu8filteritem_t filter {"Nintendo 64 roms", "n64,z64,v64,N64,Z64,V64"};
|
const nfdu8filteritem_t filter {"Nintendo 64 roms", "n64,z64,v64,N64,Z64,V64"};
|
||||||
nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr);
|
nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr);
|
||||||
if(result == NFD_OKAY) {
|
if(result == NFD_OKAY) {
|
||||||
core = std::make_shared<n64::Core>(outpath);
|
core.LoadROM(outpath);
|
||||||
core->initialized = true;
|
|
||||||
core->system = System::Nintendo64;
|
|
||||||
NFD_FreePath(outpath);
|
NFD_FreePath(outpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct Window {
|
struct Window {
|
||||||
explicit Window(n64::Core& core);
|
explicit Window(const n64::Core& core);
|
||||||
~Window();
|
~Window();
|
||||||
ImDrawData* Present();
|
ImDrawData* Present();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <frontend/App.hpp>
|
#include <frontend/App.hpp>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
App app;
|
App* app = new App;
|
||||||
app.Run();
|
app->Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
#include <SDL2/SDL_events.h>
|
#include <SDL2/SDL_events.h>
|
||||||
|
|
||||||
namespace n64 {
|
namespace n64 {
|
||||||
Core::Core(const std::string& rom) {
|
void Core::LoadROM(const std::string& rom) {
|
||||||
mem.LoadROM(rom);
|
mem.LoadROM(rom);
|
||||||
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Run() {
|
void Core::Run() {
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
namespace n64 {
|
namespace n64 {
|
||||||
struct Core {
|
struct Core {
|
||||||
~Core() = default;
|
~Core() = default;
|
||||||
explicit Core(const std::string&);
|
Core() = default;
|
||||||
|
void LoadROM(const std::string&);
|
||||||
void Run();
|
void Run();
|
||||||
void PollInputs(u32);
|
void PollInputs(u32);
|
||||||
VI& GetVI() { return mem.mmio.vi; }
|
VI& GetVI() { return mem.mmio.vi; }
|
||||||
const u8* GetRDRAM() { return mem.rdram.data(); }
|
const u8* GetRDRAM() const { return mem.rdram.data(); }
|
||||||
|
bool initialized = false;
|
||||||
private:
|
private:
|
||||||
Mem mem;
|
Mem mem;
|
||||||
Cpu cpu;
|
Cpu cpu;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <n64/core/cpu/Registers.hpp>
|
#include <Registers.hpp>
|
||||||
#include <n64/core/Mem.hpp>
|
#include <Mem.hpp>
|
||||||
|
|
||||||
namespace n64 {
|
namespace n64 {
|
||||||
struct Cpu {
|
struct Cpu {
|
||||||
|
|||||||
@@ -13,5 +13,9 @@ add_library(cpu
|
|||||||
registers/cop1instructions.cpp
|
registers/cop1instructions.cpp
|
||||||
instructions.cpp)
|
instructions.cpp)
|
||||||
|
|
||||||
target_include_directories(cpu PUBLIC registers . .. ../../
|
target_include_directories(cpu PUBLIC registers
|
||||||
../../../../../external ../../../)
|
. ..
|
||||||
|
../../../../external
|
||||||
|
../../../../src
|
||||||
|
../../
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <n64/core/cpu/registers/Cop0.hpp>
|
#include <Cop0.hpp>
|
||||||
#include <n64/core/cpu/registers/Cop1.hpp>
|
#include <Cop1.hpp>
|
||||||
|
|
||||||
namespace n64 {
|
namespace n64 {
|
||||||
struct Registers {
|
struct Registers {
|
||||||
|
|||||||
19
src/util.hpp
19
src/util.hpp
@@ -4,6 +4,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <portable_endian_bswap.h>
|
#include <portable_endian_bswap.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
enum MessageType : u8 {
|
enum MessageType : u8 {
|
||||||
@@ -145,20 +146,20 @@ inline size_t NextPow2(size_t num) {
|
|||||||
return num + 1;
|
return num + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ReadFileBinary(const std::string& path, void* buf) {
|
inline auto ReadFileBinary(const std::string& path, u32* buf) {
|
||||||
std::ifstream file("external/vert.spv", std::ios::binary);
|
std::ifstream file(path, std::ios::binary);
|
||||||
file.unsetf(std::ios::skipws);
|
file.unsetf(std::ios::skipws);
|
||||||
if(!file.is_open()) {
|
if(!file.is_open()) {
|
||||||
util::panic("Could not load file!\n");
|
util::panic("Could not load file!\n");
|
||||||
}
|
}
|
||||||
file.seekg(std::ios::end);
|
|
||||||
auto size = file.tellg();
|
|
||||||
file.seekg(std::ios::beg);
|
|
||||||
if(buf)
|
|
||||||
free(buf);
|
|
||||||
|
|
||||||
buf = calloc(size, 1);
|
file.seekg(0, std::ios::end);
|
||||||
file.read((char*)buf, size);
|
size_t size = file.tellg();
|
||||||
|
file.seekg(0, std::ios::beg);
|
||||||
|
|
||||||
|
buf = (u32*)calloc(size, 1);
|
||||||
|
file.read(reinterpret_cast<char*>(buf), size);
|
||||||
file.close();
|
file.close();
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user