Trees

Let's talk about the issues in converting the SOW engine to handle Waterloo. Ideas, suggestions, feature requests, comments.
Post Reply
El Swanto
Reactions:
Posts: 12
Joined: Tue Oct 12, 2010 12:32 am

Trees

Post by El Swanto »

Regarding multiplayer games, is it possible to prevent the "t" being used to turn off "trees"? Our group would like to try playing WITH trees once in awhile and would like to insure that no one can cheat. E-mail is swantsays@gmail

Thanks
Grog
Reactions:
Posts: 248
Joined: Sat Mar 20, 2010 10:09 pm

Re: Trees

Post by Grog »

I'm pretty sure that you cannot turn off the Tree/foliage button. I understand that it is hard-coded.
Our MP group have had to learn to accept it and trust that nobody takes advantage.
I admit to using it but not to view enemy troops, rather to see the arrow clearer when deploying in Long grass
r59
Reactions:
Posts: 101
Joined: Fri Apr 14, 2017 8:17 pm

Re: Trees

Post by r59 »

Easiest way is perhaps to just "nullify" the code in your process memory that handles any triggered eComToggleTrees.
std:fill'ing from the AI dll, init method.
Would take me no more than 30 seconds.
But it's gray area stuff.
Don't tempt me. https://emojipedia-us.s3.dualstack.us-w ... _1f64f.png[/img_size]
Last edited by r59 on Sun Feb 23, 2020 4:08 am, edited 1 time in total.
Martin James
Reactions:
Posts: 569
Joined: Mon Apr 11, 2011 9:23 pm

Re: Trees

Post by Martin James »

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
r59
Reactions:
Posts: 101
Joined: Fri Apr 14, 2017 8:17 pm

Re: Trees

Post by r59 »

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.
Last edited by r59 on Sun Feb 23, 2020 11:52 pm, edited 1 time in total.
Martin James
Reactions:
Posts: 569
Joined: Mon Apr 11, 2011 9:23 pm

Re: Trees

Post by Martin James »

Many thanks r59.

I don't pretend to understand this stuff, but have alerted someone who does.

Will bend my own efforts towards finding you a safe-house for when Mitra comes for you ;)

Martin J
r59
Reactions:
Posts: 101
Joined: Fri Apr 14, 2017 8:17 pm

Re: Trees

Post by r59 »

I'll take you at your word, then. :whistle:
So in the meantime, please don't lose yourself in the woods.
You wouldn't be the first guy. :lol:
Last edited by r59 on Mon Feb 24, 2020 11:05 pm, edited 1 time in total.
Martin James
Reactions:
Posts: 569
Joined: Mon Apr 11, 2011 9:23 pm

Re: Trees

Post by Martin James »

Hi again r59

Early reports back suggest you may be on to something.

I believe we can therefore upgrade you to a deluxe secret bunker :)

Thanks again

Martin J
Post Reply