Added support for CS:GO on Mac OS X (bug 5459, r=psychonic).
authorScott Ehlert <ds@alliedmods.net>
Sat Aug 25 11:28:52 2012 -0500 (2012-08-25)
changeset 3628d2ab961b0f75
parent 3627 b6e36874284b
child 3629 366f54c75e44
Added support for CS:GO on Mac OS X (bug 5459, r=psychonic).
AMBuildScript
core/logic/AMBuilder
extensions/cstrike/CDetour/detourhelpers.h
extensions/sdktools/CDetour/detourhelpers.h
gamedata/sm-cstrike.games/game.csgo.txt
tools/buildbot/PackageScript
     1.1 --- a/AMBuildScript	Fri Aug 24 01:36:42 2012 -0400
     1.2 +++ b/AMBuildScript	Sat Aug 25 11:28:52 2012 -0500
     1.3 @@ -30,7 +30,7 @@
     1.4  		self.possibleSdks['eye'] =   {'sdk': 'HL2SDK-EYE',      'ext': '2.eye', 'def': '5',
     1.5  		                         'name': 'EYE', 'platform': ['windows']}
     1.6  		self.possibleSdks['csgo'] =  {'sdk': 'HL2SDKCSGO',     'ext': '2.csgo',  'def': '12',
     1.7 -		                         'name': 'CSGO',           'platform': ['windows', 'linux']}
     1.8 +		                         'name': 'CSGO',           'platform': ['windows', 'linux', 'darwin']}
     1.9  		# self.possibleSdks['portal2'] =  {'sdk': 'HL2SDK-PORTAL2',     'ext': '2.portal2',  'def': '11',
    1.10  		#                          'name': 'PORTAL2',           'platform': ['windows']}
    1.11  		
    1.12 @@ -46,13 +46,13 @@
    1.13  									'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
    1.14  									'HL2SDKL4D':     'hl2sdk-l4d',
    1.15  									'HL2SDKL4D2':    'hl2sdk-l4d2',
    1.16 +									'HL2SDKCSGO':    'hl2sdk-csgo',
    1.17  									'MYSQL5':        'mysql-5.0'
    1.18  			}
    1.19  
    1.20  			if AMBuild.target['platform'] != 'darwin':
    1.21  				envvars['HL2SDK'] = 'hl2sdk'
    1.22  				envvars['HL2SDKOB'] = 'hl2sdk-ob'
    1.23 -				envvars['HL2SDKCSGO'] = 'hl2sdk-csgo'
    1.24  
    1.25  			#Dark Messiah is Windows-only
    1.26  			if AMBuild.target['platform'] == 'windows':
    1.27 @@ -195,6 +195,8 @@
    1.28  				if self.vendor == 'clang':
    1.29  					self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
    1.30  			elif AMBuild.target['platform'] == 'darwin':
    1.31 +				self.compiler.AddToListVar('CDEFINES', 'OSX')
    1.32 +				self.compiler.AddToListVar('CDEFINES', '_OSX')
    1.33  				self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
    1.34  				self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
    1.35  				self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')
     2.1 --- a/core/logic/AMBuilder	Fri Aug 24 01:36:42 2012 -0400
     2.2 +++ b/core/logic/AMBuilder	Sat Aug 25 11:28:52 2012 -0500
     2.3 @@ -13,6 +13,7 @@
     2.4  if AMBuild.target['platform'] == 'linux':
     2.5  	compiler['POSTLINKFLAGS'].append('-lpthread')
     2.6  if AMBuild.target['platform'] == 'darwin':
     2.7 +	compiler['CFLAGS'].extend(['-Wno-deprecated-declarations'])
     2.8  	compiler['POSTLINKFLAGS'].extend(['-framework', 'CoreServices'])
     2.9  
    2.10  extension = AMBuild.AddJob('sourcemod.logic')
     3.1 --- a/extensions/cstrike/CDetour/detourhelpers.h	Fri Aug 24 01:36:42 2012 -0400
     3.2 +++ b/extensions/cstrike/CDetour/detourhelpers.h	Sat Aug 25 11:28:52 2012 -0500
     3.3 @@ -34,7 +34,9 @@
     3.4  
     3.5  #if defined PLATFORM_POSIX
     3.6  #include <sys/mman.h>
     3.7 +#ifndef PAGE_SIZE
     3.8  #define	PAGE_SIZE	4096
     3.9 +#endif
    3.10  #define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
    3.11  #define	PAGE_EXECUTE_READWRITE	PROT_READ|PROT_WRITE|PROT_EXEC
    3.12  #endif
     4.1 --- a/extensions/sdktools/CDetour/detourhelpers.h	Fri Aug 24 01:36:42 2012 -0400
     4.2 +++ b/extensions/sdktools/CDetour/detourhelpers.h	Sat Aug 25 11:28:52 2012 -0500
     4.3 @@ -34,7 +34,9 @@
     4.4  
     4.5  #if defined PLATFORM_POSIX
     4.6  #include <sys/mman.h>
     4.7 +#ifndef PAGE_SIZE
     4.8  #define	PAGE_SIZE	4096
     4.9 +#endif
    4.10  #define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
    4.11  #define	PAGE_EXECUTE_READWRITE	PROT_READ|PROT_WRITE|PROT_EXEC
    4.12  #endif
     5.1 --- a/gamedata/sm-cstrike.games/game.csgo.txt	Fri Aug 24 01:36:42 2012 -0400
     5.2 +++ b/gamedata/sm-cstrike.games/game.csgo.txt	Sat Aug 25 11:28:52 2012 -0500
     5.3 @@ -11,7 +11,6 @@
     5.4  
     5.5  "Games"
     5.6  {
     5.7 -	//No mac binary yet so no mac gamedata
     5.8  	"csgo"
     5.9  	{
    5.10  		"Offsets"
    5.11 @@ -21,32 +20,34 @@
    5.12  			{
    5.13  				"windows"		"6"
    5.14  				"linux"			"6"
    5.15 +				"mac"			"6"
    5.16  			}
    5.17  			"WeaponPrice"
    5.18  			{
    5.19  				"windows"		"2700"
    5.20  				"linux"			"2700"
    5.21 +				"mac"			"2700"
    5.22  			}
    5.23  			//Offset into CheckRestartRound
    5.24 -			//Only Windows/Linux for now.
    5.25  			"CTTeamScoreOffset"
    5.26  			{
    5.27  				"windows"	"97"
    5.28  				"linux"		"124"
    5.29 +				"mac"		"150"
    5.30  			}
    5.31  			//Offset into CheckRestartRound
    5.32 -			//Only Windows/Linux for now.
    5.33  			"TTeamScoreOffset"
    5.34  			{
    5.35  				"windows"	"119"
    5.36  				"linux"		"159"
    5.37 +				"mac"		"185"
    5.38  			}
    5.39  			//Offset into IncrementNumMVPs to find MVP count offset from player
    5.40 -			//Only Windows/Linux for now.
    5.41  			"MVPCountOffset"
    5.42  			{
    5.43  				"windows"	"46"
    5.44  				"linux"		"47"
    5.45 +				"mac"		"61"
    5.46  			}
    5.47  		}
    5.48  		"Signatures"
    5.49 @@ -56,42 +57,49 @@
    5.50  				"library"	"server"
    5.51  				"windows"	"\x55\x8B\xEC\x83\xEC\x2A\x56\x8B\xF1\x8B\x0D\x2A\x2A\x2A\x2A\x57\xE8\x2A\x2A\x2A\x2A\x84\xC0\x75"
    5.52  				"linux"		"@_ZN9CCSPlayer12RoundRespawnEv"
    5.53 +				"mac"		"@_ZN9CCSPlayer12RoundRespawnEv"
    5.54  			}
    5.55  			"SwitchTeam"
    5.56  			{
    5.57  				"library"	"server"
    5.58  				"windows"	"\x55\x8B\xEC\x83\xEC\x2A\x56\x57\x8B\x7D\x2A\x57\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x83\xC4"
    5.59  				"linux"		"@_ZN9CCSPlayer10SwitchTeamEi"
    5.60 +				"mac"		"@_ZN9CCSPlayer10SwitchTeamEi"
    5.61  			}
    5.62  			"HandleCommand_Buy_Internal"
    5.63  			{
    5.64  				"library"		"server"
    5.65  				"windows"		"\x55\x8B\xEC\x81\xEC\x2A\x2A\x00\x00\x53\x56\x8B\xF1\x80\xBE\x2A\x2A\x00\x00\x00"
    5.66  				"linux"			"@_ZN9CCSPlayer26HandleCommand_Buy_InternalEPKc"
    5.67 +				"mac"			"@_ZN9CCSPlayer26HandleCommand_Buy_InternalEPKc"
    5.68  			}
    5.69  			"CSWeaponDrop"//Wildcard first 6 bytes for CS:S DM
    5.70  			{
    5.71  				"library"		"server"
    5.72  				"windows"		"\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x53\x56\x8B\x2A\x2A\x32\xDB\x57\x8B\xF9\x85\xF6\x0F\x84"
    5.73  				"linux"			"@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
    5.74 +				"mac"			"@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
    5.75  			}
    5.76  			"TerminateRound"
    5.77  			{
    5.78  				"library"		"server"
    5.79  				"windows"		"\x55\x8B\xEC\x83\xEC\x2A\x53\x8B\x2A\x2A\x56\x57\x33\xFF"
    5.80  				"linux"			"@_ZN12CCSGameRules14TerminateRoundEfi"
    5.81 +				"mac"			"@_ZN12CCSGameRules14TerminateRoundEfi"
    5.82  			}
    5.83  			"GetTranslatedWeaponAlias"
    5.84  			{
    5.85  				"library"		"server"
    5.86  				"windows"		"\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x33\xF6\x8D\x9B\x2A\x2A\x2A\x2A\x8B\x04\xF5\x2A\x2A\x2A\x2A\x57\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x2A\x85\xC0\x74\x2A\x46\x83\xFE\x2A\x72\x2A\x8B\xC7\x5F\x5E\x5D\xC3"
    5.87  				"linux"			"@_Z24GetTranslatedWeaponAliasPKc"
    5.88 +				"mac"			"@_Z24GetTranslatedWeaponAliasPKc"
    5.89  			}
    5.90  			"GetWeaponInfo"
    5.91  			{
    5.92  				"library"		"server"
    5.93  				"windows"		"\x55\x8B\xEC\x8B\x4D\x2A\x33\xC0\x85\xC9\x74"
    5.94  				"linux"			"@_Z13GetWeaponInfo10CSWeaponID"
    5.95 +				"mac"			"@_Z13GetWeaponInfo10CSWeaponID"
    5.96  			}
    5.97  			//In CS:GO this is actually CCSGameRules::CheckRestartRound(void) but to keep same gamedata as cs:s.
    5.98  			"CheckWinLimit"
    5.99 @@ -99,18 +107,21 @@
   5.100  				"library"	"server"
   5.101  				"windows"	"\x55\x8B\xEC\x83\xEC\x2A\x56\x57\x8B\xF9\x8B\x0D\x2A\x2A\x2A\x2A\x81\xF9\x2A\x2A\x2A\x2A\x75\x2A\x8B"
   5.102  				"linux"		"@_ZN12CCSGameRules17CheckRestartRoundEv"
   5.103 +				"mac"		"@_ZN12CCSGameRules17CheckRestartRoundEv"
   5.104  			}
   5.105  			"IncrementNumMVPs"
   5.106  			{
   5.107  				"library"	"server"
   5.108  				"windows"	"\x55\x8B\xEC\xA1\x2A\x2A\x2A\x2A\x8B\x50\x2A\x57\x8B\xF9\xB9\x2A\x2A\x2A\x2A\xFF\xD2\x85\xC0\x74\x2A\x68"
   5.109  				"linux"		"@_ZN9CCSPlayer16IncrementNumMVPsE13CSMvpReason_t"
   5.110 +				"mac"		"@_ZN9CCSPlayer16IncrementNumMVPsE13CSMvpReason_t"
   5.111  			}
   5.112  			"AliasToWeaponID"
   5.113  			{
   5.114  				"library"	"server"
   5.115  				"windows"	"\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x85\xFF\x74\x2A\x33\xF6\x8B\xFF"
   5.116  				"linux"		"@_Z15AliasToWeaponIDPKc"
   5.117 +				"mac"		"@_Z15AliasToWeaponIDPKc"
   5.118  			}
   5.119  		}
   5.120  	}
     6.1 --- a/tools/buildbot/PackageScript	Fri Aug 24 01:36:42 2012 -0400
     6.2 +++ b/tools/buildbot/PackageScript	Sat Aug 25 11:28:52 2012 -0500
     6.3 @@ -228,8 +228,7 @@
     6.4  AddNormalLibrary('dbi.sqlite.ext', 'extensions')
     6.5  
     6.6  AddNormalLibrary('game.cstrike.ext.2.css', 'extensions')
     6.7 -if AMBuild.target['platform'] != 'darwin':
     6.8 -	AddNormalLibrary('game.cstrike.ext.2.csgo', 'extensions')
     6.9 +AddNormalLibrary('game.cstrike.ext.2.csgo', 'extensions')
    6.10  	
    6.11  AddNormalLibrary('game.tf2.ext.2.ep2v', 'extensions')
    6.12  AddNormalLibrary('topmenus.ext', 'extensions')