mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-13 22:23:15 +00:00
Emulate libSceGnmDriver's init behavior (#3024)
This time, perform it after the LoadSharedLibraries call, which places it after the various init memory mappings GFD engine titles perform.
This commit is contained in:
parent
1930a2132c
commit
2c78272185
1 changed files with 12 additions and 0 deletions
|
@ -117,6 +117,18 @@ void Linker::Execute(const std::vector<std::string> args) {
|
|||
Common::SetCurrentThreadName("GAME_MainThread");
|
||||
LoadSharedLibraries();
|
||||
|
||||
// Simulate libSceGnmDriver initialization, which maps a chunk of direct memory.
|
||||
// Some games fail without accurately emulating this behavior.
|
||||
s64 phys_addr{};
|
||||
s32 result = Libraries::Kernel::sceKernelAllocateDirectMemory(
|
||||
0, Libraries::Kernel::sceKernelGetDirectMemorySize(), 0x10000, 0x10000, 3, &phys_addr);
|
||||
if (result == 0) {
|
||||
void* addr{reinterpret_cast<void*>(0xfe0000000)};
|
||||
result = Libraries::Kernel::sceKernelMapNamedDirectMemory(
|
||||
&addr, 0x10000, 0x13, 0, phys_addr, 0x10000, "SceGnmDriver");
|
||||
}
|
||||
ASSERT_MSG(result == 0, "Unable to emulate libSceGnmDriver initialization");
|
||||
|
||||
// Start main module.
|
||||
EntryParams params{};
|
||||
params.argc = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue