mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
SysConf: Use vectors instead of raw pointers
This commit is contained in:
@ -45,23 +45,23 @@ struct SSysConfHeader
|
||||
|
||||
struct SSysConfEntry
|
||||
{
|
||||
u16 offset;
|
||||
u16 offset = 0;
|
||||
SysconfType type;
|
||||
u8 nameLength;
|
||||
char name[32];
|
||||
u16 dataLength;
|
||||
u8* data;
|
||||
u8 nameLength = 0;
|
||||
char name[32] = {};
|
||||
u16 dataLength = 0;
|
||||
std::vector<u8> data;
|
||||
|
||||
template <class T>
|
||||
T GetData()
|
||||
{
|
||||
return *(T*)data;
|
||||
return *(T*)data.data();
|
||||
}
|
||||
bool GetArrayData(u8* dest, u16 destSize)
|
||||
{
|
||||
if (dest && destSize >= dataLength)
|
||||
{
|
||||
memcpy(dest, data, dataLength);
|
||||
memcpy(dest, data.data(), dataLength);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -70,7 +70,7 @@ struct SSysConfEntry
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
memcpy(data, buffer, std::min<u16>(bufferSize, dataLength));
|
||||
memcpy(data.data(), buffer, std::min<u16>(bufferSize, dataLength));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -169,7 +169,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
*(T*)index->data = newValue;
|
||||
*(T*)index->data.data() = newValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user