Can I tempt you please, r59?
I do think it would be a good option for the host to have in MP, although I assume it could only be done in Waterloo, not GB.
Martin J
I'm not sure if it's worth taking the risk, Martin.
Hopefully I'll be granted a safe line to beat in hasty retreat, if things will go bad. :huh:
Ciao R59
I don't think is a great idea teach how to use a hex editor in order to change the exe code on the game forum, also if is for correct a problem. This is a commercial product with a contract with a distributor.
Please, in order to avoid any form of problem don't post them in absence of any Norb or Jim communication.
Davide
These were the latest instructions (7 months old) set by the forum moderation.
Ok, this is not hex editing physical files.
It's your running memory and you are never going to change the original exe (it undergoes many modifications on its own before being runnable too).
It's roughly comparable to setting a game variable's from the AI DLL after all, under the hood.
*In theory* this should avoid triggering any ballistic missile alert here (fingers crossed). :dry:
But, as I said before, it's still a gray area, nevertheless.
Use at your own risk and preferably not within a Steam installation.
I cannot test or compile it now, but might give an idea to anybody interested.
SowInit is another place where you can do this (but not restoring the original bytes).
Code: Select all
static std::uint8_t g_old_code[28];
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
if (CXUtil::IsMulti()) {
DWORD old_protect, dummy_protect;
auto start_addr = reinterpret_cast<std::uint8_t *>(0x0050E155);
if (VirtualProtect(start_addr, 28, PAGE_EXECUTE_READWRITE, &old_protect) != FALSE) {
if (*start_addr != UINT_C(0x90)) {
memcpy(g_old_code, start_addr, 28);
memset(start_addr, 0x90, 28);
FlushInstructionCache(GetCurrentProcess(), start_addr, 28);
}
VirtualProtect(start_addr, 28, old_protect, &dummy_protect);
}
}
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
if (CXUtil::IsMulti()) {
DWORD old_protect, dummy_protect;
auto start_addr = reinterpret_cast<std::uint8_t *>(0x0050E155);
if (VirtualProtect(start_addr, 28, PAGE_EXECUTE_READWRITE, &old_protect) != FALSE) {
if (*start_addr == UINT_C(0x90)) {
memcpy(start_addr, g_old_code, 28);
FlushInstructionCache(GetCurrentProcess(), start_addr, 28);
}
VirtualProtect(start_addr, 28, old_protect, &dummy_protect);
}
}
break;
}
return TRUE;
}
Have a nice Sunday.