patching more dummy functions
This commit is contained in:
parent
0ac4032d00
commit
063a689812
|
@ -34,7 +34,7 @@ add_executable(shadps4
|
||||||
src/Core/Memory.h
|
src/Core/Memory.h
|
||||||
src/Core/PS4/Linker.cpp
|
src/Core/PS4/Linker.cpp
|
||||||
src/Core/PS4/Linker.h
|
src/Core/PS4/Linker.h
|
||||||
"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/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")
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "LibC.h"
|
#include "LibC.h"
|
||||||
|
#include "Libs.h"
|
||||||
#include "../Loader/Elf.h"
|
#include "../Loader/Elf.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibC {
|
namespace HLE::Libs::LibC {
|
||||||
|
@ -11,18 +12,8 @@ namespace HLE::Libs::LibC {
|
||||||
//__debugbreak();//if we reach here it will be a great progress :D
|
//__debugbreak();//if we reach here it will be a great progress :D
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibC_RegisterFunc(SymbolsResolver* sym)
|
void LibC_Register(SymbolsResolver* sym)
|
||||||
{
|
{
|
||||||
//TODO this will be convert to macro probably once we decide how will it work and what's the best
|
LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env);
|
||||||
SymbolRes sr {};
|
|
||||||
sr.name = "bzQExy189ZI";
|
|
||||||
sr.library = "libc";
|
|
||||||
sr.library_version = 1;
|
|
||||||
sr.module = "libc";
|
|
||||||
sr.module_version_major = 1;
|
|
||||||
sr.module_version_minor = 1;
|
|
||||||
sr.type = STT_FUN;
|
|
||||||
auto func = reinterpret_cast<u64>(init_env);
|
|
||||||
sym->AddSymbol(sr, func);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
namespace HLE::Libs::LibC {
|
namespace HLE::Libs::LibC {
|
||||||
|
|
||||||
void LibC_RegisterFunc(SymbolsResolver* sym);
|
void LibC_Register(SymbolsResolver* sym);
|
||||||
//functions
|
//functions
|
||||||
static void init_env();
|
static void init_env();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include "../Loader/Elf.h"
|
||||||
|
#include "LibKernel.h"
|
||||||
|
#include "Libs.h"
|
||||||
|
|
||||||
|
namespace HLE::Libs::LibKernel {
|
||||||
|
|
||||||
|
int sceKernelAllocateDirectMemory(off_t searchStart, off_t searchEnd, size_t len, size_t alignment, int memoryType, off_t* physAddrOut) { return 0;//OK
|
||||||
|
}
|
||||||
|
size_t sceKernelGetDirectMemorySize() { return 0;
|
||||||
|
}
|
||||||
|
int32_t sceKernelMapDirectMemory(void** addr, size_t len, int prot, int flags, off_t directMemoryStart, size_t alignment) { return 0;
|
||||||
|
}
|
||||||
|
int32_t sceKernelReleaseDirectMemory(off_t start, size_t len) { return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sceKernelCreateEqueue(/* SceKernelEqueue* eq*/int eq,const char* name)
|
||||||
|
{ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibKernel_Register(SymbolsResolver* sym) {
|
||||||
|
//memory
|
||||||
|
LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, sceKernelAllocateDirectMemory);
|
||||||
|
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetDirectMemorySize);
|
||||||
|
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory);
|
||||||
|
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
|
||||||
|
//equeue
|
||||||
|
LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, sceKernelCreateEqueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "../Loader/SymbolsResolver.h"
|
||||||
|
|
||||||
|
namespace HLE::Libs::LibKernel {
|
||||||
|
|
||||||
|
void LibKernel_Register(SymbolsResolver* sym);
|
||||||
|
// functions
|
||||||
|
int sceKernelAllocateDirectMemory(off_t searchStart, off_t searchEnd, size_t len, size_t alignment, int memoryType, off_t* physAddrOut);
|
||||||
|
size_t sceKernelGetDirectMemorySize();
|
||||||
|
int sceKernelCreateEqueue(/* SceKernelEqueue* eq*/ int eq, const char* name);
|
||||||
|
int32_t sceKernelMapDirectMemory(void** addr, size_t len, int prot, int flags, off_t directMemoryStart, size_t alignment);
|
||||||
|
int32_t sceKernelReleaseDirectMemory(off_t start, size_t len);
|
||||||
|
|
||||||
|
}; // namespace HLE::Libs::LibKernel
|
|
@ -1,10 +1,12 @@
|
||||||
#include "Libs.h"
|
#include "Libs.h"
|
||||||
#include "LibC.h"
|
#include "LibC.h"
|
||||||
|
#include "LibKernel.h"
|
||||||
|
|
||||||
namespace HLE::Libs {
|
namespace HLE::Libs {
|
||||||
|
|
||||||
void Init_HLE_Libs(SymbolsResolver *sym)
|
void Init_HLE_Libs(SymbolsResolver *sym)
|
||||||
{
|
{
|
||||||
LibC::LibC_RegisterFunc(sym);
|
LibC::LibC_Register(sym);
|
||||||
|
LibKernel::LibKernel_Register(sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,21 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../Loader/SymbolsResolver.h"
|
#include "../Loader/SymbolsResolver.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define LIB_FUNCTION(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, function) \
|
||||||
|
{\
|
||||||
|
SymbolRes sr{}; \
|
||||||
|
sr.name = nid; \
|
||||||
|
sr.library = lib; \
|
||||||
|
sr.library_version = libversion;\
|
||||||
|
sr.module = mod;\
|
||||||
|
sr.module_version_major = moduleVersionMajor;\
|
||||||
|
sr.module_version_minor = moduleVersionMinor;\
|
||||||
|
sr.type = STT_FUN;\
|
||||||
|
auto func = reinterpret_cast<u64>(function);\
|
||||||
|
sym->AddSymbol(sr, func);\
|
||||||
|
}
|
||||||
|
|
||||||
namespace HLE::Libs {
|
namespace HLE::Libs {
|
||||||
void Init_HLE_Libs(SymbolsResolver* sym);
|
void Init_HLE_Libs(SymbolsResolver* sym);
|
||||||
}
|
}
|
|
@ -569,7 +569,7 @@ static void relocate(u32 idx, elf_relocation* rel, Module* m, bool isJmpRel) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_INFO_IF(debug_loader, "function not patched!\n");
|
LOG_INFO_IF(debug_loader, "function not patched! {}\n",rel_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "../../../types.h"
|
#include "../../../types.h"
|
||||||
#include "SymbolsResolver.h"
|
#include "SymbolsResolver.h"
|
||||||
|
#include "../../../Util/Log.h"
|
||||||
|
|
||||||
|
|
||||||
void SymbolsResolver::AddSymbol(const SymbolRes& s, u64 virtual_addr)
|
void SymbolsResolver::AddSymbol(const SymbolRes& s, u64 virtual_addr)
|
||||||
|
@ -26,5 +27,6 @@ const SymbolRecord* SymbolsResolver::FindSymbol(const SymbolRes& s) const {
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
LOG_INFO_IF(true, "unresolved! {}\n", name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
Loading…
Reference in New Issue