gsdx: always NULL terminate resources on Windows

It is done automatically on Linux. Strings are much
better with this NULL char ;)

All credits go to turtleli

v2: increase resize instead of push_back NULL char
This commit is contained in:
Gregory Hainaut 2017-04-09 00:21:19 +02:00
parent ebae8b65f8
commit 38c4f5b6e7
1 changed files with 3 additions and 1 deletions

View File

@ -52,7 +52,9 @@ bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const char* type)
if(!hGlobal) return false;
DWORD size = SizeofResource((HMODULE)s_hModule, hRsrc);
if(!size) return false;
buff.resize(size);
// On Linux resources are always NULL terminated
// Add + 1 on size to do the same for compatibility sake (required by GSDeviceOGL)
buff.resize(size + 1);
memcpy(buff.data(), LockResource(hGlobal), size);
return true;
}