OTClient code is ready to read .spr/.dat file from .exe (any file that is 'read only', you can't load config from .exe, because it must be writeable)
All you need to do is to put .spr file as string inside .exe and pass it to FileStream as buffer:
src/framework/core/filestream.cpp, line 38:
PHP:
FileStream::FileStream(const std::string& name, const std::string& buffer) :
m_name(name),
m_fileHandle(nullptr),
m_pos(0),
m_writeable(false),
m_caching(true)
{
m_data.resize(buffer.length());
memcpy(&m_data[0], &buffer[0], buffer.length());
}
But where can I pass it load .spr from .exe?
in
src/client/spritemanager.cpp, line 50:
PHP:
m_spritesFile = g_resources.openFile(file);
In place of it you must use something like [CODE NOT TESTED!]:
PHP:
std::string sprData = "HERE .SPR FILE CONTENT";
m_spritesFile = FileStreamPtr(new FileStream(file, sprData));
Of course you can't just paste .spr file as string (because it may contains ", ; and 'new line' characters that will end line in C++ before end of file - compiler error), but you can use simple 'base64' encoding which is available in OTClient and in PHP.
(use PHP to encode .spr file to safe C++ string format, copy encoded line to C++ string, compile and it should work!)
I used 'base 64' encoding in my OTClient encryption (because I had to paste files content as strings in C++):
https://otland.net/threads/how-to-encrypt-client-files-just-tips-not-full-working-code.235838/
Short example of base64:
PHP:
Crypt* x = new Crypt(); // load OTClient crypt library
std::string allData = ".spr content encoded to base64 by php"; // looong text with all file .spr content 'encoded' by PHP to base64, PHP function: base64_encode('text')
allData = x->base64Decode(allData); // change it's encoding back to normal .spr file [decode]