mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-02 02:01:31 +00:00
- implemented the automap serializer.
Also optimized the base64 encoder to avoid creating endless memory copies, thanks to using std::string which is a really poor container for this kind of stuff when workig with larger blocks of data.
This commit is contained in:
parent
809f8b5d4b
commit
e8452a79e8
8 changed files with 115 additions and 46 deletions
|
@ -54,6 +54,7 @@
|
|||
#include "engineerrors.h"
|
||||
#include "textures.h"
|
||||
#include "texturemanager.h"
|
||||
#include "base64.h"
|
||||
|
||||
extern DObject *WP_NOCHANGE;
|
||||
bool save_full = false; // for testing. Should be removed afterward.
|
||||
|
@ -771,6 +772,31 @@ error:
|
|||
return buff;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FSerializer &FSerializer::SerializeMemory(const char *key, void* mem, size_t length)
|
||||
{
|
||||
if (isWriting())
|
||||
{
|
||||
auto array = base64_encode((const uint8_t*)mem, length);
|
||||
AddString(key, (const char*)array.Data());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto cp = GetString(key);
|
||||
if (key)
|
||||
{
|
||||
base64_decode(mem, length, cp);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue