diff --git a/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp b/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp index 5d23effed..f07c85e72 100644 --- a/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp +++ b/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp @@ -266,7 +266,7 @@ private: if (position < header->size) { header->commands[position] = static_cast(CommandId::Nop) | - ((header->size - position - 1) << 32); + ((header->size - position + cmdSize) << 32); } position = 0; diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index b0f3e921b..b8271d9ec 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -684,7 +684,7 @@ static std::filesystem::path getSelfDir() { return std::filesystem::path(path).parent_path(); } -static bool isRpsxGpuPid(int pid) { +static bool isRpcsxGpuPid(int pid) { if (pid <= 0 || ::kill(pid, 0) != 0) { return false; } @@ -702,15 +702,15 @@ static bool isRpsxGpuPid(int pid) { std::printf("filename is '%s'\n", std::filesystem::path(path).filename().c_str()); - return std::filesystem::path(path).filename() == "rpcsx-gpu"; + return std::filesystem::path(path).filename().string().starts_with("rpcsx-gpu"); } -static void runRpsxGpu() { +static void runRpcsxGpu() { const char *cmdBufferName = "/rpcsx-gpu-cmds"; amdgpu::bridge::BridgeHeader *bridgeHeader = amdgpu::bridge::openShmCommandBuffer(cmdBufferName); if (bridgeHeader != nullptr && bridgeHeader->pullerPid > 0 && - isRpsxGpuPid(bridgeHeader->pullerPid)) { + isRpcsxGpuPid(bridgeHeader->pullerPid)) { bridgeHeader->pusherPid = ::getpid(); g_gpuPid = bridgeHeader->pullerPid; rx::bridge.header = bridgeHeader; @@ -1749,7 +1749,7 @@ int main(int argc, const char *argv[]) { // pthread_setname_np(pthread_self(), "10.MAINTHREAD"); rx::vm::initialize(initProcess->pid); - runRpsxGpu(); + runRpcsxGpu(); if (enableAudio) { orbis::g_context.audioOut = orbis::knew(); diff --git a/rx/include/rx/MemoryTable.hpp b/rx/include/rx/MemoryTable.hpp index 83cd67a4d..11a345957 100644 --- a/rx/include/rx/MemoryTable.hpp +++ b/rx/include/rx/MemoryTable.hpp @@ -262,14 +262,18 @@ public: iterator lowerBound(std::uint64_t address) { auto it = mAreas.lower_bound(address); - if (it == mAreas.end() || it->second.first != Kind::X) { + if (it == mAreas.end()) { return it; } if (it->first == address) { - ++it; + if (it->second.first == Kind::X) { + ++it; + } } else { - --it; + if (it->second.first != Kind::O) { + --it; + } } return it;