mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-12 09:48:30 +12:00
Fix non-trivial uses of writePODVector
This commit is contained in:
parent
35f6e67903
commit
b8a83ab448
3 changed files with 78 additions and 6 deletions
|
@ -156,13 +156,26 @@ namespace coreinit
|
||||||
void MemoryMapping_Save(MemStreamWriter& s)
|
void MemoryMapping_Save(MemStreamWriter& s)
|
||||||
{
|
{
|
||||||
s.writeSection("coreinit_MemoryMapping ");
|
s.writeSection("coreinit_MemoryMapping ");
|
||||||
s.writePODVector(s_allocatedVirtMemory);
|
s.writeBE<uint32>(s_allocatedVirtMemory.size());
|
||||||
|
for (auto i : s_allocatedVirtMemory)
|
||||||
|
{
|
||||||
|
s.writeBE(i.virtualAddress);
|
||||||
|
s.writeBE(i.size);
|
||||||
|
s.writeBE(i.alignment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapping_Restore(MemStreamReader& s)
|
void MemoryMapping_Restore(MemStreamReader& s)
|
||||||
{
|
{
|
||||||
s.readSection("coreinit_MemoryMapping ");
|
s.readSection("coreinit_MemoryMapping ");
|
||||||
s.readPODVector(s_allocatedVirtMemory);
|
s.readPODVector(s_allocatedVirtMemory);
|
||||||
|
uint32 s_allocatedVirtMemorySize = s.readBE<uint32>();
|
||||||
|
s_allocatedVirtMemory.clear();
|
||||||
|
s_allocatedVirtMemory.reserve(s_allocatedVirtMemorySize);
|
||||||
|
for (sint32 i = 0; i < s_allocatedVirtMemorySize; i++)
|
||||||
|
{
|
||||||
|
s_allocatedVirtMemory.push_back(OSVirtMemoryEntry(s.readBE<MPTR>(), s.readBE<uint32>(), s.readBE<uint32>()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeMemoryMapping()
|
void InitializeMemoryMapping()
|
||||||
|
|
|
@ -36,7 +36,6 @@ namespace nn
|
||||||
|
|
||||||
struct AOCCacheEntry
|
struct AOCCacheEntry
|
||||||
{
|
{
|
||||||
AOCCacheEntry() {};
|
|
||||||
AOCCacheEntry(uint64 titleId) : aocTitleId(titleId) {};
|
AOCCacheEntry(uint64 titleId) : aocTitleId(titleId) {};
|
||||||
|
|
||||||
uint64 aocTitleId;
|
uint64 aocTitleId;
|
||||||
|
@ -153,14 +152,24 @@ namespace nn
|
||||||
void save(MemStreamWriter& s)
|
void save(MemStreamWriter& s)
|
||||||
{
|
{
|
||||||
s.writeSection("nn_aoc");
|
s.writeSection("nn_aoc");
|
||||||
s.writePODVector(sAocCache);
|
s.writeBE<uint32>(sAocCache.size());
|
||||||
|
for (auto i : sAocCache)
|
||||||
|
{
|
||||||
|
s.writeBE(i.aocTitleId);
|
||||||
|
}
|
||||||
s.writeBool(sAocCacheGenerated);
|
s.writeBool(sAocCacheGenerated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void restore(MemStreamReader& s)
|
void restore(MemStreamReader& s)
|
||||||
{
|
{
|
||||||
s.readSection("nn_aoc");
|
s.readSection("nn_aoc");
|
||||||
s.readPODVector(sAocCache);
|
uint32 sAocCacheSize = s.readBE<uint32>();
|
||||||
|
sAocCache.clear();
|
||||||
|
sAocCache.reserve(sAocCacheSize);
|
||||||
|
for (sint32 i = 0; i < sAocCacheSize; i++)
|
||||||
|
{
|
||||||
|
sAocCache.emplace_back(s.readBE<uint64>());
|
||||||
|
}
|
||||||
s.readBool(sAocCacheGenerated);
|
s.readBool(sAocCacheGenerated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2161,6 +2161,45 @@ namespace nsysnet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void MemStreamWriter::writeBE(const nsysnet::NSSLInternalState_t& v)
|
||||||
|
{
|
||||||
|
writeBool(v.destroyed);
|
||||||
|
writeBE(v.sslVersion);
|
||||||
|
writeBE(v.clientPKI);
|
||||||
|
|
||||||
|
writeBE<uint32>(v.serverPKIs.size());
|
||||||
|
for (auto i : v.serverPKIs)
|
||||||
|
writeBE<uint32>(i);
|
||||||
|
|
||||||
|
writeBE<uint32>(v.serverCustomPKIs.size());
|
||||||
|
for (auto i : v.serverCustomPKIs)
|
||||||
|
writePODVector(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void MemStreamReader::readBE(nsysnet::NSSLInternalState_t& v)
|
||||||
|
{
|
||||||
|
readBool(v.destroyed);
|
||||||
|
readBE(v.sslVersion);
|
||||||
|
readBE(v.clientPKI);
|
||||||
|
|
||||||
|
uint32 serverPKIsSize = readBE<uint32>();
|
||||||
|
v.serverPKIs.clear();
|
||||||
|
for (uint32 i = 0; i < serverPKIsSize; i++)
|
||||||
|
v.serverPKIs.insert(readBE<uint32>());
|
||||||
|
|
||||||
|
uint32 serverCustomPKIsSize = readBE<uint32>();
|
||||||
|
v.serverCustomPKIs.clear();
|
||||||
|
v.serverCustomPKIs.resize(serverCustomPKIsSize);
|
||||||
|
for (uint32 i = 0; i < serverCustomPKIsSize; i++)
|
||||||
|
{
|
||||||
|
std::vector<uint8> pki;
|
||||||
|
readPODVector(pki);
|
||||||
|
v.serverCustomPKIs.push_back(pki);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void nsysnet_save(MemStreamWriter& s)
|
void nsysnet_save(MemStreamWriter& s)
|
||||||
{
|
{
|
||||||
s.writeSection("nsysnet");
|
s.writeSection("nsysnet");
|
||||||
|
@ -2169,7 +2208,9 @@ void nsysnet_save(MemStreamWriter& s)
|
||||||
s.writeMPTR(_staticHostentName);
|
s.writeMPTR(_staticHostentName);
|
||||||
s.writeMPTR(_staticHostentPtrList);
|
s.writeMPTR(_staticHostentPtrList);
|
||||||
s.writeMPTR(_staticHostentEntries);
|
s.writeMPTR(_staticHostentEntries);
|
||||||
s.writePODVector(nsysnet::g_nsslInternalStates);
|
s.writeBE<uint32>(nsysnet::g_nsslInternalStates.size());
|
||||||
|
for (auto i : nsysnet::g_nsslInternalStates)
|
||||||
|
s.writeBE(i);
|
||||||
s.writeBool(sockLibReady);
|
s.writeBool(sockLibReady);
|
||||||
s.writeData(virtualSocketTable, sizeof(virtualSocket_t) * WU_SOCKET_LIMIT);
|
s.writeData(virtualSocketTable, sizeof(virtualSocket_t) * WU_SOCKET_LIMIT);
|
||||||
}
|
}
|
||||||
|
@ -2182,7 +2223,15 @@ void nsysnet_restore(MemStreamReader& s)
|
||||||
s.readMPTR(_staticHostentName);
|
s.readMPTR(_staticHostentName);
|
||||||
s.readMPTR(_staticHostentPtrList);
|
s.readMPTR(_staticHostentPtrList);
|
||||||
s.readMPTR(_staticHostentEntries);
|
s.readMPTR(_staticHostentEntries);
|
||||||
s.readPODVector(nsysnet::g_nsslInternalStates);
|
uint32 g_nsslInternalStatesSize = s.readBE<uint32>();
|
||||||
|
nsysnet::g_nsslInternalStates.clear();
|
||||||
|
nsysnet::g_nsslInternalStates.resize(g_nsslInternalStatesSize);
|
||||||
|
for (uint32 i = 0; i < g_nsslInternalStatesSize; i++)
|
||||||
|
{
|
||||||
|
nsysnet::NSSLInternalState_t t;
|
||||||
|
s.readBE(t);
|
||||||
|
nsysnet::g_nsslInternalStates.push_back(t);
|
||||||
|
}
|
||||||
s.readBool(sockLibReady);
|
s.readBool(sockLibReady);
|
||||||
s.readData(virtualSocketTable, sizeof(virtualSocket_t) * WU_SOCKET_LIMIT);
|
s.readData(virtualSocketTable, sizeof(virtualSocket_t) * WU_SOCKET_LIMIT);
|
||||||
}
|
}
|
||||||
|
@ -2247,3 +2296,4 @@ void nsysnet_load()
|
||||||
osLib_addFunction("nsysnet", "NSSLExportInternalServerCertificate", nsysnet::export_NSSLExportInternalServerCertificate);
|
osLib_addFunction("nsysnet", "NSSLExportInternalServerCertificate", nsysnet::export_NSSLExportInternalServerCertificate);
|
||||||
osLib_addFunction("nsysnet", "NSSLExportInternalClientCertificate", nsysnet::export_NSSLExportInternalClientCertificate);
|
osLib_addFunction("nsysnet", "NSSLExportInternalClientCertificate", nsysnet::export_NSSLExportInternalClientCertificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue