mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-15 09:40:05 +00:00
Set total memory size according to sdkver
This commit is contained in:
parent
c0eb4965f2
commit
2ea061b9c7
@ -395,8 +395,6 @@ public:
|
||||
u32 v1, v2;
|
||||
};
|
||||
attr_t attr[500]{};
|
||||
|
||||
lv2_memory_container container;
|
||||
atomic_t<u32> frame_num;
|
||||
};
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "Emu/Cell/PPUAnalyser.h"
|
||||
|
||||
#include "Emu/Cell/lv2/sys_prx.h"
|
||||
#include "Emu/Cell/lv2/sys_memory.h"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
@ -1497,6 +1498,36 @@ void ppu_load_exec(const ppu_exec_object& elf)
|
||||
ppu->gpr[1] -= Emu.data.size();
|
||||
}
|
||||
|
||||
// Initialize memory stats (according to sdk version)
|
||||
// TODO: This is probably wrong with vsh.self
|
||||
u32 mem_size;
|
||||
if (sdk_version > 0x0021FFFF)
|
||||
{
|
||||
mem_size = 0xD500000;
|
||||
}
|
||||
else if (sdk_version > 0x00192FFF)
|
||||
{
|
||||
mem_size = 0xD300000;
|
||||
}
|
||||
else if (sdk_version > 0x0018FFFF)
|
||||
{
|
||||
mem_size = 0xD100000;
|
||||
}
|
||||
else if (sdk_version > 0x0017FFFF)
|
||||
{
|
||||
mem_size = 0xD000000;
|
||||
}
|
||||
else if (sdk_version > 0x00154FFF)
|
||||
{
|
||||
mem_size = 0xCC00000;
|
||||
}
|
||||
else
|
||||
{
|
||||
mem_size = 0xC800000;
|
||||
}
|
||||
|
||||
fxm::make_always<lv2_memory_container>(mem_size);
|
||||
|
||||
ppu->cmd_push({ppu_cmd::initialize, 0});
|
||||
|
||||
// TODO: adjust for liblv2 loading option
|
||||
|
@ -37,7 +37,7 @@ error_code sys_memory_allocate(u32 size, u64 flags, vm::ptr<u32> alloc_addr)
|
||||
}
|
||||
|
||||
// Get "default" memory container
|
||||
const auto dct = fxm::get_always<lv2_memory_container>();
|
||||
const auto dct = fxm::get<lv2_memory_container>();
|
||||
|
||||
// Try to get "physical memory"
|
||||
if (!dct->take(size))
|
||||
@ -151,7 +151,7 @@ error_code sys_memory_free(u32 addr)
|
||||
}
|
||||
|
||||
// Return "physical memory" to the default container
|
||||
fxm::get_always<lv2_memory_container>()->used -= shm.second->size();
|
||||
fxm::get<lv2_memory_container>()->used -= shm.second->size();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -209,7 +209,7 @@ error_code sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info)
|
||||
sys_memory.warning("sys_memory_get_user_memory_size(mem_info=*0x%x)", mem_info);
|
||||
|
||||
// Get "default" memory container
|
||||
const auto dct = fxm::get_always<lv2_memory_container>();
|
||||
const auto dct = fxm::get<lv2_memory_container>();
|
||||
|
||||
mem_info->total_user_memory = dct->size;
|
||||
mem_info->available_user_memory = dct->size - dct->used;
|
||||
@ -235,7 +235,7 @@ error_code sys_memory_container_create(vm::ptr<u32> cid, u32 size)
|
||||
return CELL_ENOMEM;
|
||||
}
|
||||
|
||||
const auto dct = fxm::get_always<lv2_memory_container>();
|
||||
const auto dct = fxm::get<lv2_memory_container>();
|
||||
|
||||
// Try to obtain "physical memory" from the default container
|
||||
if (!dct->take(size))
|
||||
|
@ -50,14 +50,9 @@ struct lv2_memory_container
|
||||
static const u32 id_step = 0x1;
|
||||
static const u32 id_count = 16;
|
||||
|
||||
// This is purposely set lower to fake the size of the OS
|
||||
// Todo: This could change with requested sdk
|
||||
const u32 size = 0xEC00000; // Amount of "physical" memory in this container
|
||||
|
||||
const u32 size; // Amount of "physical" memory in this container
|
||||
atomic_t<u32> used{}; // Amount of "physical" memory currently used
|
||||
|
||||
lv2_memory_container() = default;
|
||||
|
||||
lv2_memory_container(u32 size)
|
||||
: size(size)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ error_code sys_mmapper_allocate_shared_memory(u64 unk, u32 size, u64 flags, vm::
|
||||
}
|
||||
|
||||
// Get "default" memory container
|
||||
const auto dct = fxm::get_always<lv2_memory_container>();
|
||||
const auto dct = fxm::get<lv2_memory_container>();
|
||||
|
||||
if (!dct->take(size))
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ void kernel_explorer::Update()
|
||||
{
|
||||
m_tree->clear();
|
||||
|
||||
const auto dct = fxm::get_always<lv2_memory_container>();
|
||||
const auto dct = fxm::get<lv2_memory_container>();
|
||||
|
||||
if (!dct)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user