Fixes and stuff
This commit is contained in:
parent
625461e6ad
commit
5c70ca9011
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
||||
Subproject commit a67323fc1216d955b68c4d87a91fee355adbf6bb
|
||||
Subproject commit 3f1a33e4b468c1bfcd9f56348847df788f55c27b
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit f0c1492ef6a6ad17ef62d49cd671980742729783
|
||||
Subproject commit 4f93098eb35b4868543b73d6023b07cb169c5a3a
|
@ -46,7 +46,7 @@ namespace Assets
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(image->texture->dimensions, iwiHeader->dimensions, 6);
|
||||
std::memcpy(image->texture->dimensions, iwiHeader->dimensions, 6);
|
||||
image->texture->flags = 0;
|
||||
image->texture->mipLevels = 0;
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace Assets
|
||||
|
||||
if (orgEnts)
|
||||
{
|
||||
memcpy(entites, orgEnts, sizeof Game::MapEnts);
|
||||
std::memcpy(entites, orgEnts, sizeof Game::MapEnts);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace Assets
|
||||
}
|
||||
|
||||
// Copy base material to our structure
|
||||
memcpy(material, baseMaterial, sizeof(Game::Material));
|
||||
std::memcpy(material, baseMaterial, sizeof(Game::Material));
|
||||
material->name = builder->GetAllocator()->DuplicateString(name);
|
||||
|
||||
material->textureAtlasRowCount = 1;
|
||||
|
@ -14,7 +14,7 @@ namespace Components
|
||||
|
||||
void Dedicated::InitDedicatedServer()
|
||||
{
|
||||
const char* fastfiles[7] =
|
||||
static const char* fastfiles[7] =
|
||||
{
|
||||
"code_post_gfx_mp",
|
||||
"localized_code_post_gfx_mp",
|
||||
@ -25,7 +25,7 @@ namespace Components
|
||||
"patch_mp"
|
||||
};
|
||||
|
||||
memcpy(reinterpret_cast<void*>(0x66E1CB0), &fastfiles, sizeof(fastfiles));
|
||||
std::memcpy(reinterpret_cast<void*>(0x66E1CB0), &fastfiles, sizeof(fastfiles));
|
||||
Game::R_LoadGraphicsAssets();
|
||||
|
||||
Utils::Hook::Call<void()>(0x4F84C0)();
|
||||
|
@ -11,7 +11,7 @@ namespace Components
|
||||
if (!this->dvar)
|
||||
{
|
||||
// Quick-register the dvar
|
||||
Game::SetConsole(dvarName.data(), "");
|
||||
Game::Dvar_SetStringByName(dvarName.data(), "");
|
||||
this->dvar = Game::Dvar_FindVar(dvarName.data());
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ namespace Components
|
||||
newList->menuCount = menus.size();
|
||||
|
||||
// Copy new menus
|
||||
memcpy(newList->menus, menus.data(), menus.size() * sizeof(Game::menuDef_t *));
|
||||
std::memcpy(newList->menus, menus.data(), menus.size() * sizeof(Game::menuDef_t *));
|
||||
|
||||
Menus::RemoveMenuList(newList->name);
|
||||
Menus::MenuListList[newList->name] = newList;
|
||||
@ -300,7 +300,7 @@ namespace Components
|
||||
newList->menuCount = size;
|
||||
|
||||
// Copy new menus
|
||||
memcpy(newList->menus, menus.data(), size * sizeof(Game::menuDef_t *));
|
||||
std::memcpy(newList->menus, menus.data(), size * sizeof(Game::menuDef_t *));
|
||||
|
||||
Menus::RemoveMenuList(newList->name);
|
||||
Menus::MenuListList[newList->name] = newList;
|
||||
|
@ -44,7 +44,7 @@ namespace Components
|
||||
|
||||
// Allocate new entries
|
||||
Game::StructuredDataEnumEntry* indices = StructuredData::MemAllocator.AllocateArray<Game::StructuredDataEnumEntry>(indexCount);
|
||||
memcpy(indices, dataEnum->indices, sizeof(Game::StructuredDataEnumEntry) * dataEnum->numIndices);
|
||||
std::memcpy(indices, dataEnum->indices, sizeof(Game::StructuredDataEnumEntry) * dataEnum->numIndices);
|
||||
|
||||
for (unsigned int i = 0; i < entries.size(); ++i)
|
||||
{
|
||||
@ -67,7 +67,7 @@ namespace Components
|
||||
// TODO directly shift the data using memmove
|
||||
for (unsigned int j = dataEnum->numIndices + i; j > pos && j < indexCount; j--)
|
||||
{
|
||||
memcpy(&indices[j], &indices[j - 1], sizeof(Game::StructuredDataEnumEntry));
|
||||
std::memcpy(&indices[j], &indices[j - 1], sizeof(Game::StructuredDataEnumEntry));
|
||||
}
|
||||
|
||||
indices[pos].index = i + lastIndex;
|
||||
@ -158,17 +158,17 @@ namespace Components
|
||||
|
||||
// Reallocate the definition
|
||||
Game::StructuredDataDef* newData = StructuredData::MemAllocator.AllocateArray<Game::StructuredDataDef>(data->count + patchDefinitions.size());
|
||||
memcpy(&newData[patchDefinitions.size()], data->data, sizeof Game::StructuredDataDef * data->count);
|
||||
std::memcpy(&newData[patchDefinitions.size()], data->data, sizeof Game::StructuredDataDef * data->count);
|
||||
|
||||
// Prepare the buffers
|
||||
for (unsigned int i = 0; i < patchDefinitions.size(); ++i)
|
||||
{
|
||||
memcpy(&newData[i], data->data, sizeof Game::StructuredDataDef);
|
||||
std::memcpy(&newData[i], data->data, sizeof Game::StructuredDataDef);
|
||||
newData[i].version = (patchDefinitions.size() - i) + 155;
|
||||
|
||||
// Reallocate the enum array
|
||||
Game::StructuredDataEnum* newEnums = StructuredData::MemAllocator.AllocateArray<Game::StructuredDataEnum>(data->data->numEnums);
|
||||
memcpy(newEnums, data->data->enums, sizeof Game::StructuredDataEnum * data->data->numEnums);
|
||||
std::memcpy(newEnums, data->data->enums, sizeof Game::StructuredDataEnum * data->data->numEnums);
|
||||
newData[i].enums = newEnums;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace Components
|
||||
Theatre::BaselineSnapshotMsgOff = *reinterpret_cast<int*>(snapshotMsg + 28) - 7;
|
||||
|
||||
// Copy to our snapshot buffer
|
||||
memcpy(Theatre::BaselineSnapshot, *reinterpret_cast<DWORD**>(snapshotMsg + 8), *reinterpret_cast<DWORD*>(snapshotMsg + 20));
|
||||
std::memcpy(Theatre::BaselineSnapshot, *reinterpret_cast<DWORD**>(snapshotMsg + 8), *reinterpret_cast<DWORD*>(snapshotMsg + 20));
|
||||
}
|
||||
|
||||
void __declspec(naked) Theatre::BaselineStoreStub()
|
||||
|
@ -149,7 +149,7 @@ namespace Game
|
||||
|
||||
SE_Load_t SE_Load = (SE_Load_t)0x502A30;
|
||||
|
||||
SetConsole_t SetConsole = (SetConsole_t)0x44F060;
|
||||
Dvar_SetStringByName_t Dvar_SetStringByName = (Dvar_SetStringByName_t)0x44F060;
|
||||
|
||||
SL_ConvertToString_t SL_ConvertToString = (SL_ConvertToString_t)0x4EC1D0;
|
||||
SL_GetString_t SL_GetString = (SL_GetString_t)0x4CDC10;
|
||||
@ -278,7 +278,7 @@ namespace Game
|
||||
|
||||
const char* UI_LocalizeGameType(const char* gameType)
|
||||
{
|
||||
if (gameType == 0 || *gameType == '\0')
|
||||
if (!gameType || !*gameType)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@ -356,8 +356,8 @@ namespace Game
|
||||
|
||||
void MessageBox(std::string message, std::string title)
|
||||
{
|
||||
SetConsole("com_errorMessage", message.data());
|
||||
SetConsole("com_errorTitle", title.data());
|
||||
Dvar_SetStringByName("com_errorMessage", message.data());
|
||||
Dvar_SetStringByName("com_errorTitle", title.data());
|
||||
Cbuf_AddText(0, "openmenu error_popmenu_lobby");
|
||||
}
|
||||
|
||||
|
@ -344,8 +344,8 @@ namespace Game
|
||||
typedef char* (__cdecl * SE_Load_t)(char* file, int Unk);
|
||||
extern SE_Load_t SE_Load;
|
||||
|
||||
typedef void(__cdecl * SetConsole_t)(const char* cvar, const char* value);
|
||||
extern SetConsole_t SetConsole;
|
||||
typedef void(__cdecl * Dvar_SetStringByName_t)(const char* cvar, const char* value);
|
||||
extern Dvar_SetStringByName_t Dvar_SetStringByName;
|
||||
|
||||
typedef char* (__cdecl * SL_ConvertToString_t)(unsigned short stringValue);
|
||||
extern SL_ConvertToString_t SL_ConvertToString;
|
||||
|
@ -43,7 +43,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
|
||||
}
|
||||
|
||||
DWORD oldProtect;
|
||||
uint8_t* module = reinterpret_cast<uint8_t*>(GetModuleHandle(NULL));
|
||||
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(NULL));
|
||||
VirtualProtect(module, 0x6C73000, PAGE_EXECUTE_READWRITE, &oldProtect); // Unprotect the entire process
|
||||
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
|
||||
|
||||
|
@ -24,6 +24,8 @@ Assert_Size(long long, 8);
|
||||
Assert_Size(unsigned long long, 8);
|
||||
Assert_Size(int64_t, 8);
|
||||
Assert_Size(uint64_t, 8);
|
||||
Assert_Size(std::int64_t, 8);
|
||||
Assert_Size(std::uint64_t, 8);
|
||||
|
||||
// 32 bit integers
|
||||
Assert_Size(__int32, 4);
|
||||
@ -32,6 +34,8 @@ Assert_Size(int, 4);
|
||||
Assert_Size(unsigned int, 4);
|
||||
Assert_Size(int32_t, 4);
|
||||
Assert_Size(uint32_t, 4);
|
||||
Assert_Size(std::int32_t, 4);
|
||||
Assert_Size(std::uint32_t, 4);
|
||||
|
||||
// 16 bit integers
|
||||
Assert_Size(__int16, 2);
|
||||
@ -40,15 +44,19 @@ Assert_Size(short, 2);
|
||||
Assert_Size(unsigned short, 2);
|
||||
Assert_Size(int16_t, 2);
|
||||
Assert_Size(uint16_t, 2);
|
||||
Assert_Size(std::int16_t, 2);
|
||||
Assert_Size(std::uint16_t, 2);
|
||||
|
||||
// 8 bit integers
|
||||
Assert_Size(bool, 1);
|
||||
Assert_Size(__int8, 1);
|
||||
Assert_Size(unsigned __int8, 1);
|
||||
Assert_Size(char, 1);
|
||||
Assert_Size(unsigned char, 1);
|
||||
Assert_Size(int8_t, 1);
|
||||
Assert_Size(uint8_t, 1);
|
||||
Assert_Size(bool, 1);
|
||||
Assert_Size(std::int8_t, 1);
|
||||
Assert_Size(std::uint8_t, 1);
|
||||
|
||||
// Ensure pointers are 4 bytes in size (32-bit)
|
||||
static_assert(sizeof(intptr_t) == 4 && sizeof(void*) == 4 && sizeof(size_t) == 4, "This doesn't seem to be a 32-bit environment!");
|
||||
|
@ -147,7 +147,7 @@ namespace Utils
|
||||
Hook::Installed = true;
|
||||
|
||||
if (unprotect) VirtualProtect(Hook::Place, sizeof(Hook::Buffer), PAGE_EXECUTE_READWRITE, &this->Protection);
|
||||
memcpy(Hook::Buffer, Hook::Place, sizeof(Hook::Buffer));
|
||||
std::memcpy(Hook::Buffer, Hook::Place, sizeof(Hook::Buffer));
|
||||
|
||||
char* code = static_cast<char*>(Hook::Place);
|
||||
|
||||
@ -186,7 +186,7 @@ namespace Utils
|
||||
|
||||
if(unprotect) VirtualProtect(Hook::Place, sizeof(Hook::Buffer), PAGE_EXECUTE_READWRITE, &this->Protection);
|
||||
|
||||
memcpy(Hook::Place, Hook::Buffer, sizeof(Hook::Buffer));
|
||||
std::memcpy(Hook::Place, Hook::Buffer, sizeof(Hook::Buffer));
|
||||
|
||||
if (unprotect) VirtualProtect(Hook::Place, sizeof(Hook::Buffer), Hook::Protection, &this->Protection);
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace Utils
|
||||
char* Memory::DuplicateString(std::string string)
|
||||
{
|
||||
char* newString = Memory::AllocateArray<char>(string.size() + 1);
|
||||
memcpy(newString, string.data(), string.size());
|
||||
std::memcpy(newString, string.data(), string.size());
|
||||
return newString;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user