Skip to content
Permalink
Browse files

Updates for 1.29 patch.

  • Loading branch information...
uakfdotb committed Apr 16, 2018
1 parent 976c8bf commit b51a152959ff39a0b2f0f9dc39e703997a6a7710
Showing with 91 additions and 53 deletions.
  1. +9 −0 README.md
  2. +8 −10 default.cfg
  3. +63 −36 ghost/bncsutilinterface.cpp
  4. +1 −1 ghost/bncsutilinterface.h
  5. +1 −1 ghost/bnet.cpp
  6. +9 −5 ghost/ghost.cpp
@@ -10,6 +10,15 @@ GHost++ is no longer actively maintained. Nevertheless, GHost++ remains widely u

If you are looking for a simple bot to host games from a server, consider [Aura](https://github.com/Josko/aura-bot/), an actively maintained fork of GHost++ with a greatly modernized core but with many features stripped out.

1.29 Note
---------

For 1.29, put `Warcraft III.exe` in the `bot_war3path`. You may name it `Warcraft III.exe` or `warcraft.exe`.

`war3.exe`, `game.dll`, and `storm.dll` are no longer needed.

Also, use `War3x.mpq` instead of `War3Patch.mpq`. (Actually, it is recommended that you extract common.j and blizzard.j yourself and put them in `bot_mapcfgpath`, since the new MPQ file is very large. Make sure to also exclude War3x.mpq from `bot_war3path` so that the host bot does not attempt to read the archive.)

Compilation
-----------

@@ -91,16 +91,14 @@ bot_replaypath = replays

### the Warcraft 3 version to save replays as

replay_war3version = 26
replay_war3version = 29

### the Warcraft 3 build number to save replays as (this is specific to each Warcraft 3 version)
### patch 1.23: war3version 23, buildnumber 6058
### patch 1.24: war3version 24, buildnumber 6059
### patch 1.24b: war3version 24, buildnumber 6059
### patch 1.25: war3version 25, buildnumber 6059
### patch 1.26: war3version 26, buildnumber 6059
### patch 1.23: war3version 23, buildnumber 6058
### patch 1.24 through 1.28: war3version 2X, buildnumber 6059
### patch 1.29: war3version 29, buildnumber 6060

replay_buildnumber = 6059
replay_buildnumber = 6060

### the bot's virtual host name as it appears in the game lobby
### colour codes are defined by the sequence "|cFF" followed by a six character hexadecimal colour in RRGGBB format (e.g. 0000FF for pure blue)
@@ -305,7 +303,7 @@ admingame_map =

### the Warcraft 3 version to use when broadcasting LAN games

lan_war3version = 26
lan_war3version = 29

### the UDP broadcast target
### if this value is blank the bot will try to broadcast LAN games on the default interface which is chosen by your operating system
@@ -447,7 +445,7 @@ bnet_bnlswardencookie = 1
### you will need to edit this section of the config file if you're connecting to a PVPGN server
### your PVPGN server operator will tell you what to put here

bnet_custom_war3version = 26
bnet_custom_war3version = 29
bnet_custom_exeversion =
bnet_custom_exeversionhash =
bnet_custom_passwordhashtype =
@@ -491,7 +489,7 @@ bnet_custom_pvpgnrealmname = PvPGN Realm
# bnet3_holdfriends = 1
# bnet3_holdclan = 1
# bnet3_publiccommands = 1
# bnet3_custom_war3version = 26
# bnet3_custom_war3version = 29
# bnet3_custom_exeversion = 184 0 22 1
# bnet3_custom_exeversionhash = 219 152 153 144
# bnet3_custom_passwordhashtype = pvpgn
@@ -48,59 +48,86 @@ void CBNCSUtilInterface :: Reset( string userName, string userPassword )
m_NLS = new NLS( userName, userPassword );
}

bool CBNCSUtilInterface :: HELP_SID_AUTH_CHECK( bool TFT, string war3Path, string keyROC, string keyTFT, string valueStringFormula, string mpqFileName, BYTEARRAY clientToken, BYTEARRAY serverToken )
bool CBNCSUtilInterface :: HELP_SID_AUTH_CHECK( bool TFT, uint32_t war3Version, string war3Path, string keyROC, string keyTFT, string valueStringFormula, string mpqFileName, BYTEARRAY clientToken, BYTEARRAY serverToken )
{
// set m_EXEVersion, m_EXEVersionHash, m_EXEInfo, m_InfoROC, m_InfoTFT

string FileWar3EXE = war3Path + "war3.exe";
string FileStormDLL = war3Path + "Storm.dll";
string FileWar3EXE = war3Path + "Warcraft III.exe";

if( !UTIL_FileExists( FileStormDLL ) )
FileStormDLL = war3Path + "storm.dll";
if( !UTIL_FileExists( FileWar3EXE ) )
FileWar3EXE = war3Path + "warcraft.exe";

string FileGameDLL = war3Path + "game.dll";
bool ExistsWar3EXE = UTIL_FileExists( FileWar3EXE );
bool ExistsStormDLL = UTIL_FileExists( FileStormDLL );
bool ExistsGameDLL = UTIL_FileExists( FileGameDLL );
bool MissingFile = false;

if( ExistsWar3EXE && ExistsStormDLL && ExistsGameDLL )
if( !UTIL_FileExists( FileWar3EXE ) )
{
// todotodo: check getExeInfo return value to ensure 1024 bytes was enough

char buf[1024];
uint32_t EXEVersion;
getExeInfo( FileWar3EXE.c_str( ), (char *)&buf, 1024, (uint32_t *)&EXEVersion, BNCSUTIL_PLATFORM_X86 );
m_EXEInfo = buf;
m_EXEVersion = UTIL_CreateByteArray( EXEVersion, false );
unsigned long EXEVersionHash;
checkRevisionFlat( valueStringFormula.c_str( ), FileWar3EXE.c_str( ), FileStormDLL.c_str( ), FileGameDLL.c_str( ), extractMPQNumber( mpqFileName.c_str( ) ), (unsigned long *)&EXEVersionHash );
m_EXEVersionHash = UTIL_CreateByteArray( (uint32_t) EXEVersionHash, false );
m_KeyInfoROC = CreateKeyInfo( keyROC, UTIL_ByteArrayToUInt32( clientToken, false ), UTIL_ByteArrayToUInt32( serverToken, false ) );
CONSOLE_Print( "[BNCSUI] unable to open [" + FileWar3EXE + "]" );
MissingFile = true;
}

string FileStormDLL, FileGameDLL;

if( war3Version <= 28 )
{
FileStormDLL = war3Path + "Storm.dll";

if( !UTIL_FileExists( FileStormDLL ) )
FileStormDLL = war3Path + "storm.dll";

if( TFT )
m_KeyInfoTFT = CreateKeyInfo( keyTFT, UTIL_ByteArrayToUInt32( clientToken, false ), UTIL_ByteArrayToUInt32( serverToken, false ) );
FileGameDLL = war3Path + "game.dll";

if( m_KeyInfoROC.size( ) == 36 && ( !TFT || m_KeyInfoTFT.size( ) == 36 ) )
return true;
else
if( !UTIL_FileExists( FileStormDLL ) )
{
if( m_KeyInfoROC.size( ) != 36 )
CONSOLE_Print( "[BNCSUI] unable to create ROC key info - invalid ROC key" );
CONSOLE_Print( "[BNCSUI] unable to open [" + FileStormDLL + "]" );
MissingFile = true;
}

if( TFT && m_KeyInfoTFT.size( ) != 36 )
CONSOLE_Print( "[BNCSUI] unable to create TFT key info - invalid TFT key" );
if( !UTIL_FileExists( FileGameDLL ) )
{
CONSOLE_Print( "[BNCSUI] unable to open [" + FileGameDLL + "]" );
MissingFile = true;
}
}

if( MissingFile )
return false;

// todotodo: check getExeInfo return value to ensure 1024 bytes was enough

char buf[1024];
uint32_t EXEVersion;
getExeInfo( FileWar3EXE.c_str( ), (char *)&buf, 1024, (uint32_t *)&EXEVersion, BNCSUTIL_PLATFORM_X86 );
m_EXEInfo = buf;
m_EXEVersion = UTIL_CreateByteArray( EXEVersion, false );
unsigned long EXEVersionHash;

// for war3version <= 28, we use war3.exe, storm.dll, and game.dll
// for war3version == 29, we use Warcraft III.exe only
if( war3Version <= 28 )
{
checkRevisionFlat( valueStringFormula.c_str( ), FileWar3EXE.c_str( ), FileStormDLL.c_str( ), FileGameDLL.c_str( ), extractMPQNumber( mpqFileName.c_str( ) ), (unsigned long *)&EXEVersionHash );
}
else
{
if( !ExistsWar3EXE )
CONSOLE_Print( "[BNCSUI] unable to open [" + FileWar3EXE + "]" );
const char* files[] = { FileWar3EXE.c_str( ) };
checkRevision( valueStringFormula.c_str( ), files, 1, extractMPQNumber( mpqFileName.c_str( ) ), (unsigned long *)&EXEVersionHash );
}

if( !ExistsStormDLL )
CONSOLE_Print( "[BNCSUI] unable to open [" + FileStormDLL + "]" );
m_EXEVersionHash = UTIL_CreateByteArray( (uint32_t) EXEVersionHash, false );
m_KeyInfoROC = CreateKeyInfo( keyROC, UTIL_ByteArrayToUInt32( clientToken, false ), UTIL_ByteArrayToUInt32( serverToken, false ) );

if( !ExistsGameDLL )
CONSOLE_Print( "[BNCSUI] unable to open [" + FileGameDLL + "]" );
if( TFT )
m_KeyInfoTFT = CreateKeyInfo( keyTFT, UTIL_ByteArrayToUInt32( clientToken, false ), UTIL_ByteArrayToUInt32( serverToken, false ) );

if( m_KeyInfoROC.size( ) == 36 && ( !TFT || m_KeyInfoTFT.size( ) == 36 ) )
return true;
else
{
if( m_KeyInfoROC.size( ) != 36 )
CONSOLE_Print( "[BNCSUI] unable to create ROC key info - invalid ROC key" );

if( TFT && m_KeyInfoTFT.size( ) != 36 )
CONSOLE_Print( "[BNCSUI] unable to create TFT key info - invalid TFT key" );
}

return false;
@@ -56,7 +56,7 @@ class CBNCSUtilInterface

void Reset( string userName, string userPassword );

bool HELP_SID_AUTH_CHECK( bool TFT, string war3Path, string keyROC, string keyTFT, string valueStringFormula, string mpqFileName, BYTEARRAY clientToken, BYTEARRAY serverToken );
bool HELP_SID_AUTH_CHECK( bool TFT, uint32_t war3Version, string war3Path, string keyROC, string keyTFT, string valueStringFormula, string mpqFileName, BYTEARRAY clientToken, BYTEARRAY serverToken );
bool HELP_SID_AUTH_ACCOUNTLOGON( );
bool HELP_SID_AUTH_ACCOUNTLOGONPROOF( BYTEARRAY salt, BYTEARRAY serverKey );
bool HELP_PvPGNPasswordHash( string userPassword );
@@ -789,7 +789,7 @@ void CBNET :: ProcessPackets( )
case CBNETProtocol :: SID_AUTH_INFO:
if( m_Protocol->RECEIVE_SID_AUTH_INFO( Packet->GetData( ) ) )
{
if( m_BNCSUtil->HELP_SID_AUTH_CHECK( m_GHost->m_TFT, m_GHost->m_Warcraft3Path, m_CDKeyROC, m_CDKeyTFT, m_Protocol->GetValueStringFormulaString( ), m_Protocol->GetIX86VerFileNameString( ), m_Protocol->GetClientToken( ), m_Protocol->GetServerToken( ) ) )
if( m_BNCSUtil->HELP_SID_AUTH_CHECK( m_GHost->m_TFT, m_War3Version, m_GHost->m_Warcraft3Path, m_CDKeyROC, m_CDKeyTFT, m_Protocol->GetValueStringFormulaString( ), m_Protocol->GetIX86VerFileNameString( ), m_Protocol->GetClientToken( ), m_Protocol->GetServerToken( ) ) )
{
// override the exe information generated by bncsutil if specified in the config file
// apparently this is useful for pvpgn users
@@ -517,9 +517,9 @@ CGHost :: CGHost( CConfig *CFG )
m_AdminGamePort = CFG->GetInt( "admingame_port", 6113 );
m_AdminGamePassword = CFG->GetString( "admingame_password", string( ) );
m_AdminGameMap = CFG->GetString( "admingame_map", string( ) );
m_LANWar3Version = CFG->GetInt( "lan_war3version", 26 );
m_ReplayWar3Version = CFG->GetInt( "replay_war3version", 26 );
m_ReplayBuildNumber = CFG->GetInt( "replay_buildnumber", 6059 );
m_LANWar3Version = CFG->GetInt( "lan_war3version", 29 );
m_ReplayWar3Version = CFG->GetInt( "replay_war3version", 29 );
m_ReplayBuildNumber = CFG->GetInt( "replay_buildnumber", 6060 );
SetConfigs( CFG );

// load the battle.net connections
@@ -569,7 +569,7 @@ CGHost :: CGHost( CConfig *CFG )
string BNLSServer = CFG->GetString( Prefix + "bnlsserver", string( ) );
int BNLSPort = CFG->GetInt( Prefix + "bnlsport", 9367 );
int BNLSWardenCookie = CFG->GetInt( Prefix + "bnlswardencookie", 0 );
unsigned char War3Version = CFG->GetInt( Prefix + "custom_war3version", 26 );
unsigned char War3Version = CFG->GetInt( Prefix + "custom_war3version", 29 );
BYTEARRAY EXEVersion = UTIL_ExtractNumbers( CFG->GetString( Prefix + "custom_exeversion", string( ) ), 4 );
BYTEARRAY EXEVersionHash = UTIL_ExtractNumbers( CFG->GetString( Prefix + "custom_exeversionhash", string( ) ), 4 );
string PasswordHashType = CFG->GetString( Prefix + "custom_passwordhashtype", string( ) );
@@ -1335,7 +1335,11 @@ void CGHost :: SetConfigs( CConfig *CFG )

void CGHost :: ExtractScripts( )
{
string PatchMPQFileName = m_Warcraft3Path + "War3Patch.mpq";
string PatchMPQFileName = m_Warcraft3Path + "War3x.mpq";

if( !UTIL_FileExists( PatchMPQFileName ) )
PatchMPQFileName = m_Warcraft3Path + "War3Patch.mpq";

HANDLE PatchMPQ;

if( SFileOpenArchive( PatchMPQFileName.c_str( ), 0, MPQ_OPEN_FORCE_MPQ_V1, &PatchMPQ ) )

0 comments on commit b51a152

Please sign in to comment.
You can’t perform that action at this time.