mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-16 23:40:24 +00:00
vm::gvar: add array support
This commit is contained in:
parent
2b8890b193
commit
584174d371
3 changed files with 9 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Emu/Cell/PPUModule.h"
|
#include "Emu/Cell/PPUModule.h"
|
||||||
|
|
||||||
|
#include "Emu/Cell/lv2/sys_lwmutex.h"
|
||||||
#include "Emu/Cell/lv2/sys_prx.h"
|
#include "Emu/Cell/lv2/sys_prx.h"
|
||||||
#include "sysPrxForUser.h"
|
#include "sysPrxForUser.h"
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct ppu_static_function
|
||||||
struct ppu_static_variable
|
struct ppu_static_variable
|
||||||
{
|
{
|
||||||
const char* name;
|
const char* name;
|
||||||
vm::gvar<void>* var; // Pointer to variable address storage
|
vm::gvar<char>* var; // Pointer to variable address storage
|
||||||
void(*init)(); // Variable initialization function
|
void(*init)(); // Variable initialization function
|
||||||
u32 size;
|
u32 size;
|
||||||
u32 align;
|
u32 align;
|
||||||
|
@ -150,10 +150,10 @@ public:
|
||||||
auto& info = access_static_variable(module, vnid);
|
auto& info = access_static_variable(module, vnid);
|
||||||
|
|
||||||
info.name = name;
|
info.name = name;
|
||||||
info.var = reinterpret_cast<vm::gvar<void>*>(Var);
|
info.var = reinterpret_cast<vm::gvar<char>*>(Var);
|
||||||
info.init = [] {};
|
info.init = [] {};
|
||||||
info.size = sizeof(typename gvar::type);
|
info.size = gvar::alloc_size;
|
||||||
info.align = alignof(typename gvar::type);
|
info.align = gvar::alloc_align;
|
||||||
info.type = typeid(*Var).name();
|
info.type = typeid(*Var).name();
|
||||||
info.flags = 0;
|
info.flags = 0;
|
||||||
info.addr = 0;
|
info.addr = 0;
|
||||||
|
|
|
@ -148,9 +148,11 @@ namespace vm
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global HLE variable
|
// Global HLE variable
|
||||||
template <typename T>
|
template <typename T, uint Count = 1>
|
||||||
struct gvar : ptr<T>
|
struct gvar final : ptr<T>
|
||||||
{
|
{
|
||||||
|
static constexpr u32 alloc_size{sizeof(T) * Count};
|
||||||
|
static constexpr u32 alloc_align{alignof(T)};
|
||||||
};
|
};
|
||||||
} // namespace ps3_
|
} // namespace ps3_
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue