google-code-export / bwapi

Automatically exported from code.google.com/p/bwapi
0 stars 0 forks source link

Speed hack: Skip countdown timer when starting LAN or BNET game (Has patch) #165

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Well ok, not a patch.

Offset is 0x004720C5 on 1.16.1, it's in the middle of an instruction. WHen
looking at the following ASM, the first MOV sets an interface var (I
assume), and the second MOV sets a default value for the start game
countdown timer, in number of frames. If you set this to 0, the wait is
infinite. You should change it from 18 to 1. 

004720B1  |.  8D4400 04     LEA EAX,[EAX+EAX+4]
004720B5      83F8 18       CMP EAX,18
004720B8  |.  C605 FAFB6600 MOV BYTE PTR DS:[66FBFA],5
004720BF      C705 FCFB6600 MOV DWORD PTR DS:[66FBFC],18
004720C9      72 05         JB SHORT 004720D0
004720CB      A3 FCFB6600   MOV DWORD PTR DS:[66FBFC],EAX
004720D0      E8 2B0D0000   CALL 00472E00

void PatchCountdown() {
    int* countdownbyte = (int*)0x004720C5;

    if (*countdownbyte == 0x18) {
        DWORD old_prot = 0;
        DWORD dummy;
        int stat = VirtualProtect(countdownbyte, 1, PAGE_EXECUTE_READWRITE,
&old_prot);
        if (stat) {
            *countdownbyte = 1;
            int stat = VirtualProtect(countdownbyte, 1, old_prot, &dummy);
        }
    }
}

Original issue reported on code.google.com by cbwhiz@gmail.com on 11 Dec 2009 at 9:20

GoogleCodeExporter commented 9 years ago
After testing online, it appears that all members of a game will need this 
enabled.
I'm not 100% sure of this, so a bit more testing is required.

Original comment by cbwhiz@gmail.com on 11 Dec 2009 at 9:59

GoogleCodeExporter commented 9 years ago

Original comment by lowerlo...@gmail.com on 12 Dec 2009 at 3:33

GoogleCodeExporter commented 9 years ago
My first suggestion would be "Play on Single Player".

But if you want to have two AIs compete this way, then I guess it's fine.

Original comment by AHeinerm on 12 Dec 2009 at 4:32

GoogleCodeExporter commented 9 years ago

Original comment by AHeinerm on 12 Dec 2009 at 4:38