refactoring

This commit is contained in:
georgemoralis 2023-08-02 13:51:10 +03:00
parent 13ff3588fd
commit 7773e11c2d
5 changed files with 31 additions and 28 deletions

View File

@ -36,8 +36,8 @@ add_executable(shadps4
src/Core/PS4/Linker.h src/Core/PS4/Linker.h
src/Lib/Threads.cpp src/Lib/Threads.cpp
src/Lib/Threads.h src/Lib/Threads.h
src/Core/PS4/HLE/Kernel/Objects/PhysicalMemory.h src/Core/PS4/HLE/Kernel/Objects/physical_memory.h
src/Core/PS4/HLE/Kernel/Objects/PhysicalMemory.cpp src/Core/PS4/HLE/Kernel/Objects/physical_memory.cpp
"src/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Util/StringUtil.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceVideoOut.cpp" "src/Core/PS4/HLE/LibSceVideoOut.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/Debug.h" "src/Core/PS4/HLE/Kernel/MemoryManagement.cpp" "src/Core/PS4/HLE/Kernel/MemoryManagement.h" "src/Core/PS4/HLE/Kernel/MemMngCodes.h" "src/Util/StringUtil.cpp") "src/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Util/StringUtil.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceVideoOut.cpp" "src/Core/PS4/HLE/LibSceVideoOut.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/Debug.h" "src/Core/PS4/HLE/Kernel/MemoryManagement.cpp" "src/Core/PS4/HLE/Kernel/MemoryManagement.h" "src/Core/PS4/HLE/Kernel/MemMngCodes.h" "src/Util/StringUtil.cpp")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)

View File

@ -1,12 +1,14 @@
#include "MemoryManagement.h" #include "MemoryManagement.h"
#include <bit>
#include "../../../../Debug.h" #include "../../../../Debug.h"
#include "../../../../Util/Log.h" #include "../../../../Util/Log.h"
#include "../Libs.h"
#include "../ErrorCodes.h"
#include "MemMngCodes.h"
#include <bit>
#include "../../../../Util/Singleton.h" #include "../../../../Util/Singleton.h"
#include "Objects/PhysicalMemory.h" #include "../ErrorCodes.h"
#include "../Libs.h"
#include "MemMngCodes.h"
#include "Objects/physical_memory.h"
namespace HLE::Libs::LibKernel::MemoryManagement { namespace HLE::Libs::LibKernel::MemoryManagement {
@ -20,7 +22,6 @@ u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
} }
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len, u64 alignment, int memoryType, s64* physAddrOut) { int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len, u64 alignment, int memoryType, s64* physAddrOut) {
PRINT_FUNCTION_NAME(); PRINT_FUNCTION_NAME();
if (searchStart < 0 || searchEnd <= searchStart) { if (searchStart < 0 || searchEnd <= searchStart) {

View File

@ -1,4 +1,4 @@
#include "PhysicalMemory.h" #include "physical_memory.h"
namespace HLE::Kernel::Objects { namespace HLE::Kernel::Objects {
@ -33,4 +33,4 @@ bool PhysicalMemory::Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignmen
return false; return false;
} }
} } // namespace HLE::Kernel::Objects

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include "../../../../../types.h" #include "../../../../../types.h"
namespace HLE::Kernel::Objects { namespace HLE::Kernel::Objects {
@ -13,11 +14,12 @@ class PhysicalMemory {
}; };
PhysicalMemory() {} PhysicalMemory() {}
virtual ~PhysicalMemory() {} virtual ~PhysicalMemory() {}
public: public:
bool Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignment, u64* physAddrOut, int memoryType); bool Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignment, u64* physAddrOut, int memoryType);
private: private:
std::vector<AllocatedBlock> m_allocatedBlocks; std::vector<AllocatedBlock> m_allocatedBlocks;
}; };
} // namespace HLE::Kernel::Objects
}

View File

@ -5,7 +5,7 @@
#include "../../../Util/Log.h" #include "../../../Util/Log.h"
#include "Kernel/MemoryManagement.h" #include "Kernel/MemoryManagement.h"
#include "../../../Util/Singleton.h" #include "../../../Util/Singleton.h"
#include "Kernel/Objects/PhysicalMemory.h" #include "Kernel/Objects/physical_memory.h"
namespace HLE::Libs::LibKernel { namespace HLE::Libs::LibKernel {