vm::gvar: add array support

This commit is contained in:
Nekotekina
2019-09-15 00:15:28 +03:00
parent 2b8890b193
commit 584174d371
3 changed files with 9 additions and 6 deletions
+1
View File
@@ -2,6 +2,7 @@
#include "Emu/System.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/lv2/sys_lwmutex.h"
#include "Emu/Cell/lv2/sys_prx.h"
#include "sysPrxForUser.h"
+4 -4
View File
@@ -56,7 +56,7 @@ struct ppu_static_function
struct ppu_static_variable
{
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
u32 size;
u32 align;
@@ -150,10 +150,10 @@ public:
auto& info = access_static_variable(module, vnid);
info.name = name;
info.var = reinterpret_cast<vm::gvar<void>*>(Var);
info.var = reinterpret_cast<vm::gvar<char>*>(Var);
info.init = [] {};
info.size = sizeof(typename gvar::type);
info.align = alignof(typename gvar::type);
info.size = gvar::alloc_size;
info.align = gvar::alloc_align;
info.type = typeid(*Var).name();
info.flags = 0;
info.addr = 0;
+4 -2
View File
@@ -148,9 +148,11 @@ namespace vm
}
// Global HLE variable
template <typename T>
struct gvar : ptr<T>
template <typename T, uint Count = 1>
struct gvar final : ptr<T>
{
static constexpr u32 alloc_size{sizeof(T) * Count};
static constexpr u32 alloc_align{alignof(T)};
};
} // namespace ps3_
} // namespace vm