mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-27 22:03:20 +00:00
chore: Make shadps4 REUSE compliant
This commit is contained in:
parent
6f4c6ae0bb
commit
584b7d2b15
124 changed files with 659 additions and 1891 deletions
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2016 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#include <core/hle/libraries/libkernel/time_management.h>
|
||||
#include "controller.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "Emulator/Host/controller.h"
|
||||
#include "core/hle/libraries/libkernel/time_management.h"
|
||||
|
||||
namespace Emulator::Host::Controller {
|
||||
|
||||
GameController::GameController() {
|
||||
m_states_num = 0;
|
||||
m_last_state = State();
|
||||
}
|
||||
|
||||
void GameController::readState(State* state, bool* isConnected, int* connectedCount) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
|
||||
|
@ -51,4 +56,4 @@ void GameController::checKButton(int id, u32 button, bool isPressed) {
|
|||
addState(state);
|
||||
}
|
||||
|
||||
} // namespace Emulator::Host::Controller
|
||||
} // namespace Emulator::Host::Controller
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include "common/types.h"
|
||||
|
||||
|
@ -30,4 +34,4 @@ private:
|
|||
State m_states[MAX_STATES];
|
||||
};
|
||||
|
||||
} // namespace Emulator::Host::Controller
|
||||
} // namespace Emulator::Host::Controller
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "GUI/ElfViewer.h"
|
||||
#include "core/loader/elf.h"
|
||||
#include "imgui.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Core::Loader {
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#include "config.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <fmt/core.h>
|
||||
#include <toml.hpp>
|
||||
#include "config.h"
|
||||
|
||||
namespace Config {
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include "common/types.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include "common/disassembler.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Zydis/Zydis.h>
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
#include "discord.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include "common/discord.h"
|
||||
|
||||
void Discord::RPC::init() {
|
||||
namespace Discord {
|
||||
|
||||
void RPC::init() {
|
||||
DiscordEventHandlers handlers{};
|
||||
Discord_Initialize("1139939140494971051", &handlers, 1, nullptr);
|
||||
|
||||
|
@ -11,7 +15,7 @@ void Discord::RPC::init() {
|
|||
enabled = true;
|
||||
}
|
||||
|
||||
void Discord::RPC::update(Discord::RPCStatus status, const std::string& game) {
|
||||
void RPC::update(Discord::RPCStatus status, const std::string& game) {
|
||||
DiscordRichPresence rpc{};
|
||||
|
||||
if (status == Discord::RPCStatus::Playing) {
|
||||
|
@ -28,10 +32,12 @@ void Discord::RPC::update(Discord::RPCStatus status, const std::string& game) {
|
|||
Discord_UpdatePresence(&rpc);
|
||||
}
|
||||
|
||||
void Discord::RPC::stop() {
|
||||
void RPC::stop() {
|
||||
if (enabled) {
|
||||
enabled = false;
|
||||
Discord_ClearPresence();
|
||||
Discord_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Discord
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -5,7 +8,11 @@
|
|||
#include <discord_rpc.h>
|
||||
|
||||
namespace Discord {
|
||||
enum class RPCStatus { Idling, Playing };
|
||||
|
||||
enum class RPCStatus {
|
||||
Idling,
|
||||
Playing,
|
||||
};
|
||||
|
||||
class RPC {
|
||||
std::uint64_t startTimestamp;
|
||||
|
@ -16,4 +23,5 @@ public:
|
|||
void update(RPCStatus status, const std::string& title);
|
||||
void stop();
|
||||
};
|
||||
|
||||
} // namespace Discord
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/fs_file.h"
|
||||
|
||||
namespace Common::FS {
|
||||
|
@ -32,7 +35,7 @@ bool File::close() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool File::write(std::span<const u08> data) {
|
||||
bool File::write(std::span<const u8> data) {
|
||||
return isOpen() && std::fwrite(data.data(), 1, data.size(), m_file) == data.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <bit>
|
||||
|
@ -27,7 +30,7 @@ public:
|
|||
bool open(const std::string& path, OpenMode mode = OpenMode::Read);
|
||||
bool close();
|
||||
bool read(void* data, u64 size) const;
|
||||
bool write(std::span<const u08> data);
|
||||
bool write(std::span<const u8> data);
|
||||
bool seek(s64 offset, SeekMode mode);
|
||||
u64 getFileSize();
|
||||
u64 tell() const;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include "io_file.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/io_file.h"
|
||||
|
||||
// #include "helpers.hpp"
|
||||
|
||||
|
@ -135,4 +138,4 @@ bool IOFile::setSize(std::uint64_t size) {
|
|||
#endif
|
||||
fflush(handle);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
|
@ -39,4 +42,4 @@ public:
|
|||
|
||||
// Sets the size of the file to "size" and returns whether it succeeded or not
|
||||
bool setSize(std::uint64_t size);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <vector>
|
||||
#include <Util/config.h>
|
||||
#include <spdlog/common.h>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
@ -8,7 +11,7 @@ using s16 = std::int16_t;
|
|||
using s32 = std::int32_t;
|
||||
using s64 = std::int64_t;
|
||||
|
||||
using u08 = std::uint8_t;
|
||||
using u8 = std::uint8_t;
|
||||
using u16 = std::uint16_t;
|
||||
using u32 = std::uint32_t;
|
||||
using u64 = std::uint64_t;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <atomic>
|
||||
#include <xxh3.h>
|
||||
#include "gpu_memory.h"
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "core/PS4/GPU/gpu_memory.h"
|
||||
|
||||
void* GPU::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
void* todo /*CommandBuffer?*/, u64 virtual_addr, u64 size,
|
||||
|
@ -24,7 +26,7 @@ void GPU::memorySetAllocArea(u64 virtual_addr, u64 size) {
|
|||
gpumemory->m_heaps.push_back(h);
|
||||
}
|
||||
|
||||
u64 GPU::calculate_hash(const u08* buf, u64 size) {
|
||||
u64 GPU::calculate_hash(const u8* buf, u64 size) {
|
||||
return (size > 0 && buf != nullptr ? XXH3_64bits(buf, size) : 0);
|
||||
}
|
||||
|
||||
|
@ -108,7 +110,7 @@ void* GPU::GPUMemory::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::Graphi
|
|||
for (int h = 0; h < virtual_addr_num; h++) {
|
||||
if (info.check_hash) {
|
||||
objInfo.hash[h] =
|
||||
GPU::calculate_hash(reinterpret_cast<const u08*>(virtual_addr[h]), size[h]);
|
||||
GPU::calculate_hash(reinterpret_cast<const u8*>(virtual_addr[h]), size[h]);
|
||||
} else {
|
||||
objInfo.hash[h] = 0;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include <core/PS4/HLE/Graphics/graphics_ctx.h>
|
||||
#include "common/types.h"
|
||||
#include "core/PS4/HLE/Graphics/graphics_ctx.h"
|
||||
|
||||
namespace GPU {
|
||||
|
||||
|
@ -84,8 +87,8 @@ void memorySetAllocArea(u64 virtual_addr, u64 size);
|
|||
void* memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
/*CommandBuffer* buffer*/ void* todo, u64 virtual_addr, u64 size,
|
||||
const GPUObject& info);
|
||||
u64 calculate_hash(const u08* buf, u64 size);
|
||||
u64 calculate_hash(const u8* buf, u64 size);
|
||||
bool vulkanAllocateMemory(HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
HLE::Libs::Graphics::VulkanMemory* mem);
|
||||
void flushGarlic(HLE::Libs::Graphics::GraphicCtx* ctx);
|
||||
} // namespace GPU
|
||||
} // namespace GPU
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <mutex>
|
||||
#include "common/singleton.h"
|
||||
#include "tile_manager.h"
|
||||
#include "core/PS4/GPU/tile_manager.h"
|
||||
|
||||
namespace GPU {
|
||||
|
||||
|
@ -160,15 +163,15 @@ void convertTileToLinear(void* dst, const void* src, u32 width, u32 height, bool
|
|||
for (; x + 1 < width; x += 2) {
|
||||
auto tiled_offset = t.getTiledOffs(x, y, is_neo);
|
||||
|
||||
*reinterpret_cast<u64*>(static_cast<u08*>(dst) + linear_offset) =
|
||||
*reinterpret_cast<const u64*>(static_cast<const u08*>(src) + tiled_offset);
|
||||
*reinterpret_cast<u64*>(static_cast<u8*>(dst) + linear_offset) =
|
||||
*reinterpret_cast<const u64*>(static_cast<const u8*>(src) + tiled_offset);
|
||||
linear_offset += 8;
|
||||
}
|
||||
if (x < width) {
|
||||
auto tiled_offset = t.getTiledOffs(x, y, is_neo);
|
||||
|
||||
*reinterpret_cast<u32*>(static_cast<u08*>(dst) + linear_offset) =
|
||||
*reinterpret_cast<const u32*>(static_cast<const u08*>(src) + tiled_offset);
|
||||
*reinterpret_cast<u32*>(static_cast<u8*>(dst) + linear_offset) =
|
||||
*reinterpret_cast<const u32*>(static_cast<const u8*>(src) + tiled_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
@ -5,4 +8,5 @@
|
|||
namespace GPU {
|
||||
|
||||
void convertTileToLinear(void* dst, const void* src, u32 width, u32 height, bool neo);
|
||||
}
|
||||
|
||||
} // namespace GPU
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "video_out_buffer.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/log.h"
|
||||
|
||||
#include <vulkan_util.h>
|
||||
#include "common/debug.h"
|
||||
#include "tile_manager.h"
|
||||
#include "common/log.h"
|
||||
#include "core/PS4/GPU/tile_manager.h"
|
||||
#include "core/PS4/GPU/video_out_buffer.h"
|
||||
#include "vulkan_util.h"
|
||||
|
||||
constexpr bool log_file_videoOutBuffer = true; // disable it to disable logging
|
||||
|
||||
|
@ -22,7 +23,7 @@ static void update_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params,
|
|||
vk_obj->layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
if (tiled) {
|
||||
std::vector<u08> tempbuff(*size);
|
||||
std::vector<u8> tempbuff(*size);
|
||||
GPU::convertTileToLinear(tempbuff.data(), reinterpret_cast<void*>(*virtual_addr), width,
|
||||
height, neo);
|
||||
Graphics::Vulkan::vulkanFillImage(
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
#include "gpu_memory.h"
|
||||
#include "core/PS4/GPU/gpu_memory.h"
|
||||
|
||||
namespace GPU {
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "core/PS4/HLE/Graphics/Objects/video_out_ctx.h"
|
||||
#include "core/hle/libraries/libkernel/time_management.h"
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <core/PS4/HLE/Graphics/graphics_ctx.h>
|
||||
#include <core/PS4/HLE/Graphics/video_out.h>
|
||||
#include <emulator.h>
|
||||
#include "core/PS4/HLE/Graphics/graphics_ctx.h"
|
||||
#include "core/PS4/HLE/Graphics/video_out.h"
|
||||
#include "emulator.h"
|
||||
|
||||
using namespace HLE::Libs::Graphics::VideoOut;
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include "common/singleton.h"
|
||||
#include "core/PS4/HLE/Graphics/graphics_render.h"
|
||||
#include "emulator.h"
|
||||
#include "graphics_render.h"
|
||||
|
||||
static thread_local GPU::CommandPool g_command_pool;
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include "graphics_ctx.h"
|
||||
#include "core/PS4/HLE/Graphics/graphics_ctx.h"
|
||||
|
||||
namespace GPU {
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <magic_enum.hpp>
|
||||
|
@ -8,6 +11,7 @@
|
|||
#include "common/singleton.h"
|
||||
#include "core/PS4/GPU/gpu_memory.h"
|
||||
#include "core/PS4/GPU/video_out_buffer.h"
|
||||
#include "core/PS4/HLE/Graphics/graphics_render.h"
|
||||
#include "core/PS4/HLE/Graphics/video_out.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
|
@ -15,7 +19,6 @@
|
|||
#include "core/hle/libraries/libuserservice/usr_mng_codes.h"
|
||||
#include "core/loader/symbols_resolver.h"
|
||||
#include "emulator.h"
|
||||
#include "graphics_render.h"
|
||||
|
||||
namespace HLE::Libs::Graphics::VideoOut {
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
@ -92,8 +95,8 @@ struct SceVideoOutVblankStatus {
|
|||
u64 processTime = 0;
|
||||
u64 tsc = 0;
|
||||
u64 reserved[1] = {0};
|
||||
u08 flags = 0;
|
||||
u08 pad1[7] = {};
|
||||
u8 flags = 0;
|
||||
u8 pad1[7] = {};
|
||||
};
|
||||
|
||||
struct VideoOutBufferSetInternal {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstring>
|
||||
#include "common/types.h"
|
||||
#include "core/aerolib/aerolib.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// generated using ps4_names2stubs.py
|
||||
|
||||
STUB("++DO8Y1JaYU", sceAvSettingDebugSetProcessAttribute)
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/log.h"
|
||||
#include "core/aerolib/aerolib.h"
|
||||
#include "core/aerolib/stubs.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "fs.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
#include "core/file_sys/fs.h"
|
||||
|
||||
namespace Core::FileSys {
|
||||
|
||||
|
@ -88,4 +90,4 @@ File* HandleTable::getFile(const std::string& host_name) {
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace Core::FileSys
|
||||
} // namespace Core::FileSys
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <common/io_file.h>
|
||||
#include "common/fs_file.h"
|
||||
#include "common/io_file.h"
|
||||
|
||||
namespace Core::FileSys {
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
// posix error codes
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "core/hle/kernel/Objects/event_queue.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <condition_variable>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/kernel/Objects/physical_memory.h"
|
||||
|
||||
namespace Core::Kernel {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "common/types.h"
|
||||
#include "core/PS4/GPU/gpu_memory.h"
|
||||
#include "core/virtual_memory.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "Util/config.h"
|
||||
#include "common/log.h"
|
||||
#include "core/hle/kernel/cpu_management.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/kernel/Objects/event_queue.h"
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <bit>
|
||||
#include <core/PS4/GPU/gpu_memory.h>
|
||||
#include <core/virtual_memory.h>
|
||||
#include <magic_enum.hpp>
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/PS4/GPU/gpu_memory.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
#include "core/hle/kernel/Objects/physical_memory.h"
|
||||
#include "core/hle/kernel/memory_management.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
#include "core/virtual_memory.h"
|
||||
|
||||
namespace Core::Kernel {
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstdlib>
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Core::Loader {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "libc_cxa.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "core/hle/libraries/libc/libc_cxa.h"
|
||||
|
||||
// adapted from
|
||||
// https://opensource.apple.com/source/libcppabi/libcppabi-14/src/cxa_guard.cxx.auto.html
|
||||
|
@ -57,23 +59,23 @@ __attribute__((noinline)) static pthread_mutex_t* guard_mutex() {
|
|||
|
||||
// helper functions for getting/setting flags in guard_object
|
||||
static bool initializerHasRun(u64* guard_object) {
|
||||
return (*((u08*)guard_object) != 0);
|
||||
return (*((u8*)guard_object) != 0);
|
||||
}
|
||||
|
||||
static void setInitializerHasRun(u64* guard_object) {
|
||||
*((u08*)guard_object) = 1;
|
||||
*((u8*)guard_object) = 1;
|
||||
}
|
||||
|
||||
static bool inUse(u64* guard_object) {
|
||||
return (((u08*)guard_object)[1] != 0);
|
||||
return (((u8*)guard_object)[1] != 0);
|
||||
}
|
||||
|
||||
static void setInUse(u64* guard_object) {
|
||||
((u08*)guard_object)[1] = 1;
|
||||
((u8*)guard_object)[1] = 1;
|
||||
}
|
||||
|
||||
static void setNotInUse(u64* guard_object) {
|
||||
((u08*)guard_object)[1] = 0;
|
||||
((u8*)guard_object)[1] = 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#define _TIMESPEC_DEFINED
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cmath>
|
||||
#include "core/hle/libraries/libc/libc_math.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "core/hle/libraries/libc/libc_stdio.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstdlib>
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstring>
|
||||
#include "core/hle/libraries/libc/libc_string.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2014-2018 Marco Paland (info@paland.com)
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// \author (c) Marco Paland (info@paland.com)
|
||||
// 2014-2018, PALANDesign Hannover, Germany
|
||||
|
@ -609,7 +612,7 @@ static inline int _vsnprintf(out_fct_type out, char* buffer, const char* format,
|
|||
// (unsigned short int)va.next<unsigned int>(cpu, mem) : va.next<unsigned
|
||||
// int>(cpu, mem);
|
||||
const unsigned int value =
|
||||
(flags & FLAGS_CHAR) ? static_cast<u08>(vaArgInteger(va_list))
|
||||
(flags & FLAGS_CHAR) ? static_cast<u8>(vaArgInteger(va_list))
|
||||
: (flags & FLAGS_SHORT) ? static_cast<u16>(vaArgInteger(va_list))
|
||||
: static_cast<u32>(vaArgInteger(va_list));
|
||||
idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <xmmintrin.h>
|
||||
#include "common/types.h"
|
||||
|
||||
|
@ -50,7 +53,7 @@ struct VaCtx {
|
|||
|
||||
template <class T, uint32_t Size>
|
||||
T vaArgRegSaveAreaGp(VaList* l) {
|
||||
auto* addr = reinterpret_cast<T*>(static_cast<u08*>(l->reg_save_area) + l->gp_offset);
|
||||
auto* addr = reinterpret_cast<T*>(static_cast<u8*>(l->reg_save_area) + l->gp_offset);
|
||||
l->gp_offset += Size;
|
||||
return *addr;
|
||||
}
|
||||
|
@ -64,7 +67,7 @@ T vaArgOverflowArgArea(VaList* l) {
|
|||
|
||||
template <class T, uint32_t Size>
|
||||
T vaArgRegSaveAreaFp(VaList* l) {
|
||||
auto* addr = reinterpret_cast<T*>(static_cast<u08*>(l->reg_save_area) + l->fp_offset);
|
||||
auto* addr = reinterpret_cast<T*>(static_cast<u8*>(l->reg_save_area) + l->fp_offset);
|
||||
l->fp_offset += Size;
|
||||
return *addr;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#include <common/singleton.h>
|
||||
#include <core/file_sys/fs.h>
|
||||
#include <core/hle/error_codes.h>
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
#include "core/hle/libraries/libkernel/file_system.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "core/hle/libraries/libkernel/libkernel.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
|
@ -8,6 +9,8 @@
|
|||
#include "core/hle/kernel/event_queues.h"
|
||||
#include "core/hle/kernel/memory_management.h"
|
||||
#include "core/hle/libraries/libkernel/file_system.h"
|
||||
#include "core/hle/libraries/libkernel/libkernel.h"
|
||||
#include "core/hle/libraries/libkernel/thread_management.h"
|
||||
#include "core/hle/libraries/libkernel/time_management.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
#include "core/loader/elf.h"
|
||||
|
@ -18,7 +21,6 @@
|
|||
#else
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include "thread_management.h"
|
||||
|
||||
namespace Core::Libraries::LibKernel {
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "core/hle/libraries/libkernel/thread_management.h"
|
||||
|
||||
#include <core/hle/libraries/libs.h>
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
#include "core/hle/libraries/libkernel/thread_management.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
|
||||
namespace Core::Libraries::LibKernel {
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#define _TIMESPEC_DEFINED
|
||||
|
||||
#include <string>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
|
@ -32,14 +34,14 @@ using ScePthreadCondattr = PthreadCondAttrInternal*;
|
|||
using pthreadEntryFunc = PS4_SYSV_ABI void* (*)(void*);
|
||||
|
||||
struct PthreadInternal {
|
||||
u08 reserved[4096];
|
||||
u8 reserved[4096];
|
||||
std::string name;
|
||||
pthread_t pth;
|
||||
ScePthreadAttr attr;
|
||||
};
|
||||
|
||||
struct PthreadAttrInternal {
|
||||
u08 reserved[64];
|
||||
u8 reserved[64];
|
||||
u64 affinity;
|
||||
size_t guard_size;
|
||||
int policy;
|
||||
|
@ -48,25 +50,25 @@ struct PthreadAttrInternal {
|
|||
};
|
||||
|
||||
struct PthreadMutexInternal {
|
||||
u08 reserved[256];
|
||||
u8 reserved[256];
|
||||
std::string name;
|
||||
pthread_mutex_t pth_mutex;
|
||||
};
|
||||
|
||||
struct PthreadMutexattrInternal {
|
||||
u08 reserved[64];
|
||||
u8 reserved[64];
|
||||
pthread_mutexattr_t pth_mutex_attr;
|
||||
int pprotocol;
|
||||
};
|
||||
|
||||
struct PthreadCondInternal {
|
||||
u08 reserved[256];
|
||||
u8 reserved[256];
|
||||
std::string name;
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
|
||||
struct PthreadCondAttrInternal {
|
||||
u08 reserved[64];
|
||||
u8 reserved[64];
|
||||
pthread_condattr_t cond_attr;
|
||||
};
|
||||
|
||||
|
@ -132,4 +134,4 @@ int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex);
|
|||
int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond);
|
||||
|
||||
void pthreadSymbolsRegister(Loader::SymbolsResolver* sym);
|
||||
} // namespace Core::Libraries::LibKernel
|
||||
} // namespace Core::Libraries::LibKernel
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/native_clock.h"
|
||||
#include "core/hle/libraries/libkernel/time_management.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "Emulator/Host/controller.h"
|
||||
#include "common/log.h"
|
||||
#include "common/singleton.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
@ -26,17 +29,17 @@ enum ScePadButton : u32 {
|
|||
};
|
||||
|
||||
struct ScePadOpenParam {
|
||||
u08 reserve[8];
|
||||
u8 reserve[8];
|
||||
};
|
||||
|
||||
struct ScePadAnalogStick {
|
||||
u08 x;
|
||||
u08 y;
|
||||
u8 x;
|
||||
u8 y;
|
||||
};
|
||||
struct ScePadAnalogButtons {
|
||||
u08 l2;
|
||||
u08 r2;
|
||||
u08 padding[2];
|
||||
u8 l2;
|
||||
u8 r2;
|
||||
u8 padding[2];
|
||||
};
|
||||
|
||||
struct SceFQuaternion {
|
||||
|
@ -50,24 +53,24 @@ struct SceFVector3 {
|
|||
struct ScePadTouch {
|
||||
u16 x;
|
||||
u16 y;
|
||||
u08 id;
|
||||
u08 reserve[3];
|
||||
u8 id;
|
||||
u8 reserve[3];
|
||||
};
|
||||
|
||||
constexpr int SCE_PAD_MAX_TOUCH_NUM = 2;
|
||||
|
||||
typedef struct ScePadTouchData {
|
||||
u08 touchNum;
|
||||
u08 reserve[3];
|
||||
u8 touchNum;
|
||||
u8 reserve[3];
|
||||
u32 reserve1;
|
||||
ScePadTouch touch[SCE_PAD_MAX_TOUCH_NUM];
|
||||
} ScePadTouchData;
|
||||
|
||||
struct ScePadExtensionUnitData {
|
||||
u32 extensionUnitId;
|
||||
u08 reserve[1];
|
||||
u08 dataLength;
|
||||
u08 data[10];
|
||||
u8 reserve[1];
|
||||
u8 dataLength;
|
||||
u8 data[10];
|
||||
};
|
||||
|
||||
struct ScePadData {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/PS4/HLE/Graphics/video_out.h"
|
||||
#include "core/hle/libraries/libc/libc.h"
|
||||
#include "core/hle/libraries/libkernel/libkernel.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/loader/elf.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/log.h"
|
||||
#include "core/PS4/GPU/gpu_memory.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "core/hle/libraries/libsystemservice/system_service.h"
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/log.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
#include "core/hle/libraries/libsystemservice/system_service.h"
|
||||
|
||||
namespace Core::Libraries::LibSystemService {
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
@ -15,7 +18,7 @@ struct SceSystemServiceStatus {
|
|||
bool isCpuMode7CpuNormal;
|
||||
bool isGameLiveStreamingOnAir;
|
||||
bool isOutOfVrPlayArea;
|
||||
u08 reserved[];
|
||||
u8 reserved[];
|
||||
};
|
||||
|
||||
s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen();
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/log.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
// constants
|
||||
|
||||
constexpr int SCE_USER_SERVICE_MAX_LOGIN_USERS = 4; // max users logged in at once
|
||||
constexpr int SCE_USER_SERVICE_MAX_LOGIN_USERS = 4; // Max users logged in at once
|
||||
constexpr int SCE_USER_SERVICE_MAX_USER_NAME_LENGTH = 16; // Max length for user name
|
||||
|
||||
constexpr int SCE_USER_SERVICE_USER_ID_INVALID = -1; // invalid user ID
|
||||
constexpr int SCE_USER_SERVICE_USER_ID_SYSTEM = 255; // generic id for device
|
||||
constexpr int SCE_USER_SERVICE_USER_ID_INVALID = -1; // Invalid user ID
|
||||
constexpr int SCE_USER_SERVICE_USER_ID_SYSTEM = 255; // Generic id for device
|
||||
constexpr int SCE_USER_SERVICE_USER_ID_EVERYONE =
|
||||
254; // generic id for user (mostly used in common dialogs)
|
||||
254; // Generic id for user (mostly used in common dialogs)
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <Zydis/Zydis.h>
|
||||
#include <fmt/core.h>
|
||||
#include "common/log.h"
|
||||
|
@ -531,7 +534,7 @@ static void relocate(u32 idx, elf_relocation* rel, Module* m, bool isJmpRel) {
|
|||
u64 rel_base_virtual_addr = m->base_virtual_addr;
|
||||
u64 rel_virtual_addr = m->base_virtual_addr + rel->rel_offset;
|
||||
bool rel_isResolved = false;
|
||||
u08 rel_sym_type = 0;
|
||||
u8 rel_sym_type = 0;
|
||||
std::string rel_name;
|
||||
|
||||
switch (type) {
|
||||
|
@ -605,16 +608,15 @@ static void relocate(u32 idx, elf_relocation* rel, Module* m, bool isJmpRel) {
|
|||
void Linker::Relocate(Module* m) {
|
||||
u32 idx = 0;
|
||||
for (auto* rel = m->dynamic_info.relocation_table;
|
||||
reinterpret_cast<u08*>(rel) < reinterpret_cast<u08*>(m->dynamic_info.relocation_table) +
|
||||
m->dynamic_info.relocation_table_size;
|
||||
reinterpret_cast<u8*>(rel) < reinterpret_cast<u8*>(m->dynamic_info.relocation_table) +
|
||||
m->dynamic_info.relocation_table_size;
|
||||
rel++, idx++) {
|
||||
relocate(idx, rel, m, false);
|
||||
}
|
||||
idx = 0;
|
||||
for (auto* rel = m->dynamic_info.jmp_relocation_table;
|
||||
reinterpret_cast<u08*>(rel) <
|
||||
reinterpret_cast<u08*>(m->dynamic_info.jmp_relocation_table) +
|
||||
m->dynamic_info.jmp_relocation_table_size;
|
||||
reinterpret_cast<u8*>(rel) < reinterpret_cast<u8*>(m->dynamic_info.jmp_relocation_table) +
|
||||
m->dynamic_info.jmp_relocation_table_size;
|
||||
rel++, idx++) {
|
||||
relocate(idx, rel, m, true);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
|
@ -22,8 +25,8 @@ struct ModuleInfo {
|
|||
u64 value;
|
||||
struct {
|
||||
u32 name_offset;
|
||||
u08 version_minor;
|
||||
u08 version_major;
|
||||
u8 version_minor;
|
||||
u8 version_major;
|
||||
u16 id;
|
||||
};
|
||||
};
|
||||
|
@ -98,8 +101,8 @@ struct Module {
|
|||
|
||||
Linker* linker = nullptr;
|
||||
|
||||
std::vector<u08> m_dynamic;
|
||||
std::vector<u08> m_dynamic_data;
|
||||
std::vector<u8> m_dynamic;
|
||||
std::vector<u8> m_dynamic_data;
|
||||
DynamicModuleInfo dynamic_info{};
|
||||
|
||||
Loader::SymbolsResolver export_sym;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cinttypes>
|
||||
|
@ -12,12 +15,12 @@ struct self_header {
|
|||
static const u32 signature = 0x1D3D154Fu;
|
||||
|
||||
u32 magic;
|
||||
u08 version;
|
||||
u08 mode;
|
||||
u08 endian; // 1 is little endian
|
||||
u08 attributes;
|
||||
u08 category;
|
||||
u08 program_type;
|
||||
u8 version;
|
||||
u8 mode;
|
||||
u8 endian; // 1 is little endian
|
||||
u8 attributes;
|
||||
u8 category;
|
||||
u8 program_type;
|
||||
u16 padding1;
|
||||
u16 header_size;
|
||||
u16 meta_size;
|
||||
|
@ -59,21 +62,21 @@ struct self_segment_header {
|
|||
u64 memory_size;
|
||||
};
|
||||
|
||||
constexpr u08 EI_MAG0 = 0; /* e_ident[] indexes */
|
||||
constexpr u08 EI_MAG1 = 1;
|
||||
constexpr u08 EI_MAG2 = 2;
|
||||
constexpr u08 EI_MAG3 = 3;
|
||||
constexpr u08 EI_CLASS = 4;
|
||||
constexpr u08 EI_DATA = 5;
|
||||
constexpr u08 EI_VERSION = 6;
|
||||
constexpr u08 EI_OSABI = 7;
|
||||
constexpr u08 EI_ABIVERSION = 8;
|
||||
constexpr u8 EI_MAG0 = 0; /* e_ident[] indexes */
|
||||
constexpr u8 EI_MAG1 = 1;
|
||||
constexpr u8 EI_MAG2 = 2;
|
||||
constexpr u8 EI_MAG3 = 3;
|
||||
constexpr u8 EI_CLASS = 4;
|
||||
constexpr u8 EI_DATA = 5;
|
||||
constexpr u8 EI_VERSION = 6;
|
||||
constexpr u8 EI_OSABI = 7;
|
||||
constexpr u8 EI_ABIVERSION = 8;
|
||||
|
||||
// Magic number
|
||||
constexpr u08 ELFMAG0 = 0x7F;
|
||||
constexpr u08 ELFMAG1 = 'E';
|
||||
constexpr u08 ELFMAG2 = 'L';
|
||||
constexpr u08 ELFMAG3 = 'F';
|
||||
constexpr u8 ELFMAG0 = 0x7F;
|
||||
constexpr u8 ELFMAG1 = 'E';
|
||||
constexpr u8 ELFMAG2 = 'L';
|
||||
constexpr u8 ELFMAG3 = 'F';
|
||||
|
||||
typedef enum : u16 {
|
||||
ET_NONE = 0x0,
|
||||
|
@ -183,27 +186,27 @@ typedef enum : u16 {
|
|||
|
||||
typedef enum : u32 { EV_NONE = 0x0, EV_CURRENT = 0x1 } e_version_es;
|
||||
|
||||
typedef enum : u08 {
|
||||
typedef enum : u8 {
|
||||
ELF_CLASS_NONE = 0x0,
|
||||
ELF_CLASS_32 = 0x1,
|
||||
ELF_CLASS_64 = 0x2,
|
||||
ELF_CLASS_NUM = 0x3
|
||||
} ident_class_es;
|
||||
|
||||
typedef enum : u08 {
|
||||
typedef enum : u8 {
|
||||
ELF_DATA_NONE = 0x0,
|
||||
ELF_DATA_2LSB = 0x1,
|
||||
ELF_DATA_2MSB = 0x2,
|
||||
ELF_DATA_NUM = 0x3
|
||||
} ident_endian_es;
|
||||
|
||||
typedef enum : u08 {
|
||||
typedef enum : u8 {
|
||||
ELF_VERSION_NONE = 0x0,
|
||||
ELF_VERSION_CURRENT = 0x1,
|
||||
ELF_VERSION_NUM = 0x2
|
||||
} ident_version_es;
|
||||
|
||||
typedef enum : u08 {
|
||||
typedef enum : u8 {
|
||||
ELF_OSABI_NONE = 0x0, /* No extensions or unspecified */
|
||||
ELF_OSABI_HPUX = 0x1, /* Hewlett-Packard HP-UX */
|
||||
ELF_OSABI_NETBSD = 0x2, /* NetBSD */
|
||||
|
@ -223,7 +226,7 @@ typedef enum : u08 {
|
|||
ELF_OSABI_STANDALONE = 0xFF /* Standalone (embedded applications) */
|
||||
} ident_osabi_es;
|
||||
|
||||
typedef enum : u08 {
|
||||
typedef enum : u8 {
|
||||
ELF_ABI_VERSION_AMDGPU_HSA_V2 = 0x0,
|
||||
ELF_ABI_VERSION_AMDGPU_HSA_V3 = 0x1,
|
||||
ELF_ABI_VERSION_AMDGPU_HSA_V4 = 0x2,
|
||||
|
@ -231,13 +234,13 @@ typedef enum : u08 {
|
|||
} ident_abiversion_es;
|
||||
|
||||
struct elf_ident {
|
||||
u08 magic[4];
|
||||
u8 magic[4];
|
||||
ident_class_es ei_class;
|
||||
ident_endian_es ei_data;
|
||||
ident_version_es ei_version;
|
||||
ident_osabi_es ei_osabi;
|
||||
ident_abiversion_es ei_abiversion;
|
||||
u08 pad[6];
|
||||
u8 pad[6];
|
||||
};
|
||||
|
||||
struct elf_header {
|
||||
|
@ -339,7 +342,7 @@ struct elf_program_id_header {
|
|||
program_type_es program_type;
|
||||
u64 appver;
|
||||
u64 firmver;
|
||||
u08 digest[32];
|
||||
u8 digest[32];
|
||||
};
|
||||
|
||||
constexpr s64 DT_NULL = 0;
|
||||
|
@ -387,43 +390,43 @@ struct elf_dynamic {
|
|||
} d_un;
|
||||
};
|
||||
|
||||
constexpr u08 STB_LOCAL = 0;
|
||||
constexpr u08 STB_GLOBAL = 1;
|
||||
constexpr u08 STB_WEAK = 2;
|
||||
constexpr u8 STB_LOCAL = 0;
|
||||
constexpr u8 STB_GLOBAL = 1;
|
||||
constexpr u8 STB_WEAK = 2;
|
||||
|
||||
constexpr u08 STT_NOTYPE = 0;
|
||||
constexpr u08 STT_OBJECT = 1;
|
||||
constexpr u08 STT_FUN = 2;
|
||||
constexpr u08 STT_SECTION = 3;
|
||||
constexpr u08 STT_FILE = 4;
|
||||
constexpr u08 STT_COMMON = 5;
|
||||
constexpr u08 STT_TLS = 6;
|
||||
constexpr u08 STT_LOOS = 10;
|
||||
constexpr u08 STT_SCE = 11; // module_start/module_stop
|
||||
constexpr u08 STT_HIOS = 12;
|
||||
constexpr u08 STT_LOPRO = 13;
|
||||
constexpr u08 STT_SPARC_REGISTER = 13;
|
||||
constexpr u08 STT_HIPROC = 15;
|
||||
constexpr u8 STT_NOTYPE = 0;
|
||||
constexpr u8 STT_OBJECT = 1;
|
||||
constexpr u8 STT_FUN = 2;
|
||||
constexpr u8 STT_SECTION = 3;
|
||||
constexpr u8 STT_FILE = 4;
|
||||
constexpr u8 STT_COMMON = 5;
|
||||
constexpr u8 STT_TLS = 6;
|
||||
constexpr u8 STT_LOOS = 10;
|
||||
constexpr u8 STT_SCE = 11; // module_start/module_stop
|
||||
constexpr u8 STT_HIOS = 12;
|
||||
constexpr u8 STT_LOPRO = 13;
|
||||
constexpr u8 STT_SPARC_REGISTER = 13;
|
||||
constexpr u8 STT_HIPROC = 15;
|
||||
|
||||
constexpr u08 STV_DEFAULT = 0;
|
||||
constexpr u08 STV_INTERNAL = 1;
|
||||
constexpr u08 STV_HIDDEN = 2;
|
||||
constexpr u08 STV_PROTECTED = 3;
|
||||
constexpr u8 STV_DEFAULT = 0;
|
||||
constexpr u8 STV_INTERNAL = 1;
|
||||
constexpr u8 STV_HIDDEN = 2;
|
||||
constexpr u8 STV_PROTECTED = 3;
|
||||
|
||||
struct elf_symbol {
|
||||
u08 GetBind() const {
|
||||
u8 GetBind() const {
|
||||
return st_info >> 4u;
|
||||
}
|
||||
u08 GetType() const {
|
||||
u8 GetType() const {
|
||||
return st_info & 0xfu;
|
||||
}
|
||||
u08 GetVisibility() const {
|
||||
u8 GetVisibility() const {
|
||||
return st_other & 3u;
|
||||
}
|
||||
|
||||
u32 st_name;
|
||||
u08 st_info;
|
||||
u08 st_other;
|
||||
u8 st_info;
|
||||
u8 st_other;
|
||||
u16 st_shndx;
|
||||
u64 st_value;
|
||||
u64 st_size;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/log.h"
|
||||
#include "common/types.h"
|
||||
#include "core/loader/symbols_resolver.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
@ -18,8 +21,8 @@ struct SymbolRes {
|
|||
std::string library;
|
||||
u16 library_version;
|
||||
std::string module;
|
||||
u08 module_version_major;
|
||||
u08 module_version_minor;
|
||||
u8 module_version_major;
|
||||
u8 module_version_minor;
|
||||
u32 type;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/virtual_memory.h"
|
||||
|
||||
#include "common/log.h"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
constexpr u64 SYSTEM_RESERVED = 0x800000000u;
|
||||
|
@ -40,4 +44,4 @@ inline bool containsExecuteMode(MemoryMode mode) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace VirtualMemory
|
||||
} // namespace VirtualMemory
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <vulkan_util.h>
|
||||
#include "Emulator/Host/controller.h"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SDL.h>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <Zydis/Zydis.h>
|
||||
#include <fmt/core.h>
|
||||
|
|
|
@ -1,201 +0,0 @@
|
|||
#include <atomic>
|
||||
#include <xxh3.h>
|
||||
#include "gpu_memory.h"
|
||||
|
||||
#include "common/singleton.h"
|
||||
|
||||
void* GPU::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
void* todo /*CommandBuffer?*/, u64 virtual_addr, u64 size,
|
||||
const GPUObject& info) {
|
||||
auto* gpumemory = Common::Singleton<GPUMemory>::Instance();
|
||||
|
||||
return gpumemory->memoryCreateObj(submit_id, ctx, nullptr, &virtual_addr, &size, 1, info);
|
||||
}
|
||||
|
||||
void GPU::memorySetAllocArea(u64 virtual_addr, u64 size) {
|
||||
auto* gpumemory = Common::Singleton<GPUMemory>::Instance();
|
||||
|
||||
std::scoped_lock lock{gpumemory->m_mutex};
|
||||
|
||||
MemoryHeap h;
|
||||
h.allocated_virtual_addr = virtual_addr;
|
||||
h.allocated_size = size;
|
||||
|
||||
gpumemory->m_heaps.push_back(h);
|
||||
}
|
||||
|
||||
u64 GPU::calculate_hash(const u08* buf, u64 size) {
|
||||
return (size > 0 && buf != nullptr ? XXH3_64bits(buf, size) : 0);
|
||||
}
|
||||
|
||||
bool GPU::vulkanAllocateMemory(HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
HLE::Libs::Graphics::VulkanMemory* mem) {
|
||||
static std::atomic_uint64_t unique_id = 0;
|
||||
|
||||
VkPhysicalDeviceMemoryProperties memory_properties{};
|
||||
vkGetPhysicalDeviceMemoryProperties(ctx->m_physical_device, &memory_properties);
|
||||
|
||||
u32 index = 0;
|
||||
for (; index < memory_properties.memoryTypeCount; index++) {
|
||||
if ((mem->requirements.memoryTypeBits & (static_cast<uint32_t>(1) << index)) != 0 &&
|
||||
(memory_properties.memoryTypes[index].propertyFlags & mem->property) == mem->property) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mem->type = index;
|
||||
mem->offset = 0;
|
||||
|
||||
VkMemoryAllocateInfo alloc_info{};
|
||||
alloc_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
||||
alloc_info.pNext = nullptr;
|
||||
alloc_info.allocationSize = mem->requirements.size;
|
||||
alloc_info.memoryTypeIndex = index;
|
||||
|
||||
mem->unique_id = ++unique_id;
|
||||
|
||||
auto result = vkAllocateMemory(ctx->m_device, &alloc_info, nullptr, &mem->memory);
|
||||
|
||||
if (result == VK_SUCCESS) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void GPU::flushGarlic(HLE::Libs::Graphics::GraphicCtx* ctx) {
|
||||
auto* gpumemory = Common::Singleton<GPUMemory>::Instance();
|
||||
gpumemory->flushAllHeaps(ctx);
|
||||
}
|
||||
|
||||
int GPU::GPUMemory::getHeapId(u64 virtual_addr, u64 size) {
|
||||
int index = 0;
|
||||
for (const auto& heap : m_heaps) {
|
||||
if ((virtual_addr >= heap.allocated_virtual_addr &&
|
||||
virtual_addr < heap.allocated_virtual_addr + heap.allocated_size) ||
|
||||
((virtual_addr + size - 1) >= heap.allocated_virtual_addr &&
|
||||
(virtual_addr + size - 1) < heap.allocated_virtual_addr + heap.allocated_size)) {
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void* GPU::GPUMemory::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
void* todo, const u64* virtual_addr, const u64* size,
|
||||
int virtual_addr_num, const GPUObject& info) {
|
||||
auto* gpumemory = Common::Singleton<GPUMemory>::Instance();
|
||||
|
||||
std::scoped_lock lock{gpumemory->m_mutex};
|
||||
|
||||
int heap_id = gpumemory->getHeapId(virtual_addr[0], size[0]);
|
||||
|
||||
if (heap_id < 0) {
|
||||
return nullptr;
|
||||
}
|
||||
auto& heap = m_heaps[heap_id];
|
||||
|
||||
ObjInfo objInfo = {};
|
||||
|
||||
// Copy parameters from info to obj
|
||||
for (int i = 0; i < 8; i++) {
|
||||
objInfo.obj_params[i] = info.obj_params[i];
|
||||
}
|
||||
|
||||
objInfo.gpu_object.objectType = info.objectType;
|
||||
objInfo.gpu_object.obj = nullptr;
|
||||
|
||||
for (int h = 0; h < virtual_addr_num; h++) {
|
||||
if (info.check_hash) {
|
||||
objInfo.hash[h] =
|
||||
GPU::calculate_hash(reinterpret_cast<const u08*>(virtual_addr[h]), size[h]);
|
||||
} else {
|
||||
objInfo.hash[h] = 0;
|
||||
}
|
||||
}
|
||||
objInfo.submit_id = submit_id;
|
||||
objInfo.check_hash = info.check_hash;
|
||||
|
||||
objInfo.gpu_object.obj = info.getCreateFunc()(ctx, objInfo.obj_params, virtual_addr, size,
|
||||
virtual_addr_num, &objInfo.mem);
|
||||
|
||||
objInfo.update_func = info.getUpdateFunc();
|
||||
int index = static_cast<int>(heap.objects.size());
|
||||
|
||||
HeapObject hobj{};
|
||||
hobj.block = createHeapBlock(virtual_addr, size, virtual_addr_num, heap_id, index);
|
||||
hobj.info = objInfo;
|
||||
hobj.free = false;
|
||||
heap.objects.push_back(hobj);
|
||||
|
||||
return objInfo.gpu_object.obj;
|
||||
}
|
||||
|
||||
GPU::HeapBlock GPU::GPUMemory::createHeapBlock(const u64* virtual_addr, const u64* size,
|
||||
int virtual_addr_num, int heap_id, int obj_id) {
|
||||
auto& heap = m_heaps[heap_id];
|
||||
|
||||
GPU::HeapBlock heapBlock{};
|
||||
heapBlock.virtual_addr_num = virtual_addr_num;
|
||||
for (int vi = 0; vi < virtual_addr_num; vi++) {
|
||||
heapBlock.virtual_addr[vi] = virtual_addr[vi];
|
||||
heapBlock.size[vi] = size[vi];
|
||||
}
|
||||
return heapBlock;
|
||||
}
|
||||
|
||||
void GPU::GPUMemory::update(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx, int heap_id,
|
||||
int obj_id) {
|
||||
auto& heap = m_heaps[heap_id];
|
||||
|
||||
auto& heapObj = heap.objects[obj_id];
|
||||
auto& objInfo = heapObj.info;
|
||||
bool need_update = false;
|
||||
|
||||
if (submit_id > objInfo.submit_id) {
|
||||
uint64_t hash[3] = {};
|
||||
|
||||
for (int i = 0; i < heapObj.block.virtual_addr_num; i++) {
|
||||
if (objInfo.check_hash) {
|
||||
hash[i] = GPU::calculate_hash(
|
||||
reinterpret_cast<const uint8_t*>(heapObj.block.virtual_addr[i]),
|
||||
heapObj.block.size[i]);
|
||||
} else {
|
||||
hash[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < heapObj.block.virtual_addr_num; i++) {
|
||||
if (objInfo.hash[i] != hash[i]) {
|
||||
need_update = true;
|
||||
objInfo.hash[i] = hash[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (submit_id != UINT64_MAX) {
|
||||
objInfo.submit_id = submit_id;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_update) {
|
||||
objInfo.update_func(ctx, objInfo.obj_params, objInfo.gpu_object.obj,
|
||||
heapObj.block.virtual_addr, heapObj.block.size,
|
||||
heapObj.block.virtual_addr_num);
|
||||
}
|
||||
}
|
||||
|
||||
void GPU::GPUMemory::flushAllHeaps(HLE::Libs::Graphics::GraphicCtx* ctx) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
|
||||
int heap_id = 0;
|
||||
for (auto& heap : m_heaps) {
|
||||
int index = 0;
|
||||
for (auto& heapObj : heap.objects) {
|
||||
if (!heapObj.free) {
|
||||
update(UINT64_MAX, ctx, heap_id, index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
heap_id++;
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include "common/types.h"
|
||||
|
||||
namespace VideoCore {
|
||||
|
||||
class GPUObject;
|
||||
|
||||
enum class MemoryMode : u32 {
|
||||
NoAccess = 0,
|
||||
Read = 1,
|
||||
Write = 2,
|
||||
ReadWrite = 3,
|
||||
};
|
||||
|
||||
enum class MemoryObjectType : u64 {
|
||||
Invalid,
|
||||
VideoOutBuffer,
|
||||
};
|
||||
|
||||
struct GpuMemoryObject {
|
||||
MemoryObjectType object_type = MemoryObjectType::Invalid;
|
||||
void* obj = nullptr;
|
||||
};
|
||||
|
||||
struct HeapBlock {
|
||||
std::array<u64, 3> virtual_address{};
|
||||
std::array<u64, 3> size{};
|
||||
u32 virtual_addr_num = 0;
|
||||
};
|
||||
|
||||
class GPUObject {
|
||||
public:
|
||||
GPUObject() = default;
|
||||
virtual ~GPUObject() = default;
|
||||
u64 obj_params[8] = {};
|
||||
bool check_hash = false;
|
||||
bool isReadOnly = false;
|
||||
MemoryObjectType objectType = MemoryObjectType::Invalid;
|
||||
};
|
||||
|
||||
struct ObjInfo {
|
||||
std::array<u64, 8> obj_params{};
|
||||
GpuMemoryObject gpu_object;
|
||||
std::array<u64, 3> hash{};
|
||||
u64 submit_id = 0;
|
||||
bool check_hash = false;
|
||||
};
|
||||
|
||||
struct HeapObject {
|
||||
HeapBlock block;
|
||||
ObjInfo info;
|
||||
bool free = true;
|
||||
};
|
||||
struct MemoryHeap {
|
||||
u64 allocated_virtual_addr = 0;
|
||||
u64 allocated_size = 0;
|
||||
std::vector<HeapObject> objects;
|
||||
};
|
||||
|
||||
class GPUMemory {
|
||||
public:
|
||||
GPUMemory() {}
|
||||
virtual ~GPUMemory() {}
|
||||
int getHeapId(u64 vaddr, u64 size);
|
||||
void* memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
/*CommandBuffer* buffer*/ void* todo, const u64* virtual_addr,
|
||||
const u64* size, int virtual_addr_num, const GPUObject& info);
|
||||
HeapBlock createHeapBlock(const u64* virtual_addr, const u64* size, int virtual_addr_num,
|
||||
int heap_id, int obj_id);
|
||||
void update(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx, int heap_id, int obj_id);
|
||||
void flushAllHeaps(HLE::Libs::Graphics::GraphicCtx* ctx);
|
||||
|
||||
private:
|
||||
std::mutex m_mutex;
|
||||
std::vector<MemoryHeap> m_heaps;
|
||||
};
|
||||
|
||||
void memorySetAllocArea(u64 virtual_addr, u64 size);
|
||||
void* memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
/*CommandBuffer* buffer*/ void* todo, u64 virtual_addr, u64 size,
|
||||
const GPUObject& info);
|
||||
u64 calculate_hash(const u08* buf, u64 size);
|
||||
bool vulkanAllocateMemory(HLE::Libs::Graphics::GraphicCtx* ctx,
|
||||
HLE::Libs::Graphics::VulkanMemory* mem);
|
||||
void flushGarlic(HLE::Libs::Graphics::GraphicCtx* ctx);
|
||||
|
||||
} // namespace VideoCore
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue