Skip to content

Commit

Permalink
Merge Simplify game build handling + ros fix (mr-370)
Browse files Browse the repository at this point in the history
This reverts commit 8986403.
  • Loading branch information
prikolium-cfx committed Aug 6, 2024
1 parent 8dcaedd commit ecd511b
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 544 deletions.
45 changes: 0 additions & 45 deletions code/client/launcher/StdInc.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,51 +103,6 @@ bool CheckFileOutdatedWithUI(const wchar_t* fileName, const std::vector<std::arr
#define LAUNCHER_PERSONALITY_GAME
#endif

#ifdef LAUNCHER_PERSONALITY_GAME_MTL
#define LAUNCHER_PERSONALITY_GAME
#endif

// game personality aliases
#ifdef GTA_FIVE
#ifdef LAUNCHER_PERSONALITY_GAME_1604
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2060)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2189)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2372)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2545)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2612)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2699)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2802)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_2944)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_3095)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_3258)
#define LAUNCHER_PERSONALITY_GAME
#endif
#elif defined(IS_RDR3)
#ifdef LAUNCHER_PERSONALITY_GAME_1311
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_1355)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_1436)
#define LAUNCHER_PERSONALITY_GAME
#elif defined(LAUNCHER_PERSONALITY_GAME_1491)
#define LAUNCHER_PERSONALITY_GAME
#endif
#elif defined(GTA_NY)
#ifdef LAUNCHER_PERSONALITY_GAME_43
#define LAUNCHER_PERSONALITY_GAME
#endif
#endif

struct TenUIBase
{
virtual ~TenUIBase() = default;
Expand Down
111 changes: 46 additions & 65 deletions code/client/launcher/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if not gameDumpsRoot or not os.isdir(gameDumpsRoot) then
gameDumpsRoot = "C:\\f"
end

local gameBuilds = require("../../premake5_builds")

local delayDLLs = {
}

Expand Down Expand Up @@ -51,33 +53,48 @@ local function isLauncherPersonality(name)
end

-- is game host?
local function isGamePersonality(name)
if _OPTIONS['game'] ~= 'five' and _OPTIONS['game'] ~= 'rdr3' and _OPTIONS['game'] ~= 'ny' then
return isLauncherPersonality(name)
local function isGamePersonality(name, strict)
if strict == nil then
strict = false
end

if name == 'game_mtl' then
return true
if _OPTIONS['game'] ~= 'five' and _OPTIONS['game'] ~= 'rdr3' and _OPTIONS['game'] ~= 'ny' and strict == false then
return isLauncherPersonality(name)
end

if name == 'game_1604' or name == 'game_2060' or name == 'game_2189' or name == 'game_2372' or name == 'game_2545' or name == 'game_2612' or name == 'game_2699' or name == 'game_2802' or name == 'game_2944' or name == 'game_3095' or name == 'game_3258' then
return true
end

if name == 'game_1311' or name == 'game_1355' or name == 'game_1436' or name == 'game_1491' then
return true
end

if name == 'game_43' then
if name == 'game_mtl' then
return true
end

if isLauncherPersonality(name) then
if isLauncherPersonality(name) and strict == false then
filter { "configurations:Debug" }
return true
end

return false
return gameBuilds[_OPTIONS['game']][name] ~= nil
end

local function getGameBuild(name)
if name == 'game_mtl' then
return 'mtl'
end
return gameBuilds[_OPTIONS['game']][name]
end

local function getGameDump(name, gameBuild)
local gameDump

if _OPTIONS['game'] == 'five' then
gameDump = ("%s\\GTA5_%s_dump.exe"):format(gameDumpsRoot, gameBuild)
elseif _OPTIONS['game'] == 'rdr3' then
gameDump = ("%s\\RDR2_%s_dump.exe"):format(gameDumpsRoot, gameBuild)
end

if name == 'game_mtl' then
gameDump = ("%s\\Launcher.exe"):format(gameDumpsRoot)
end

return gameDump
end

local function launcherpersonality_inner(name)
Expand Down Expand Up @@ -146,38 +163,8 @@ local function launcherpersonality_inner(name)
end

if isGamePersonality(name) then
local gameBuild
local gameDump

if _OPTIONS['game'] == 'five' then
gameBuild = '1604'

if name == 'game_3258' then gameBuild = '3258_0' end
if name == 'game_3095' then gameBuild = '3095_0' end
if name == 'game_2944' then gameBuild = '2944_0' end
if name == 'game_2802' then gameBuild = '2802_0' end
if name == 'game_2699' then gameBuild = '2699_0' end
if name == 'game_2612' then gameBuild = '2612_1' end
if name == 'game_2545' then gameBuild = '2545_0' end
if name == 'game_2372' then gameBuild = '2372_0' end
if name == 'game_2189' then gameBuild = '2189_0' end
if name == 'game_2060' then gameBuild = '2060_2' end

gameDump = ("%s\\GTA5_%s_dump.exe"):format(gameDumpsRoot, gameBuild)
elseif _OPTIONS['game'] == 'rdr3' then
gameBuild = '1311'

if name == 'game_1355' then gameBuild = '1355_18' end
if name == 'game_1436' then gameBuild = '1436_31' end
if name == 'game_1491' then gameBuild = '1491_50' end

gameDump = ("%s\\RDR2_%s.exe"):format(gameDumpsRoot, gameBuild)
end

if name == 'game_mtl' then
gameDump = ("%s\\Launcher.exe"):format(gameDumpsRoot)
gameBuild = 'mtl'
end
local gameBuild = getGameBuild(name)
local gameDump = getGameDump(name, gameBuild)

if gameDump then
postbuildcommands {
Expand Down Expand Up @@ -242,6 +229,10 @@ local function launcherpersonality_inner(name)

linkoptions "/IGNORE:4254 /LARGEADDRESSAWARE" -- 4254 is the section type warning we tend to get

if isGamePersonality(name, true) then
defines("LAUNCHER_PERSONALITY_GAME")
end

if isGamePersonality(name) then
-- VS14 linker behavior change causes the usual workaround to no longer work, use an undocumented linker switch instead
-- note that pragma linker directives ignore these (among other juicy arguments like /WBRDDLL, /WBRDTESTENCRYPT and other
Expand Down Expand Up @@ -282,27 +273,17 @@ end
launcherpersonality 'main'
launcherpersonality 'chrome'

local builds = gameBuilds[_OPTIONS["game"]]
if builds ~= nil then
for key, _ in pairs(builds) do
launcherpersonality(key)
end
end

if _OPTIONS['game'] == 'five' then
launcherpersonality 'game_1604'
launcherpersonality 'game_2060'
launcherpersonality 'game_2189'
launcherpersonality 'game_2372'
launcherpersonality 'game_2545'
launcherpersonality 'game_2612'
launcherpersonality 'game_2699'
launcherpersonality 'game_2802'
launcherpersonality 'game_2944'
launcherpersonality 'game_3095'
launcherpersonality 'game_3258'
launcherpersonality 'game_mtl'
elseif _OPTIONS['game'] == 'rdr3' then
launcherpersonality 'game_1311'
launcherpersonality 'game_1355'
launcherpersonality 'game_1436'
launcherpersonality 'game_1491'
launcherpersonality 'game_mtl'
elseif _OPTIONS['game'] == 'ny' then
launcherpersonality 'game_43'
end

group 'subprocess'
Expand Down
46 changes: 0 additions & 46 deletions code/client/shared/CrossBuildRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,6 @@
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/wstringize.hpp>

#ifdef GTA_FIVE
#define GAME_BUILDS \
(3258) \
(3095) \
(2944) \
(2802) \
(2699) \
(2612) \
(2545) \
(2372) \
(2189) \
(2060) \
(1604)
#elif defined(IS_RDR3)
#define GAME_BUILDS \
(1491) \
(1436) \
(1355) \
(1311)
#elif defined(GTA_NY)
#define GAME_BUILDS \
(43)
#else
#define GAME_BUILDS \
(0)
#endif

namespace xbr
{
//
Expand Down Expand Up @@ -136,25 +109,6 @@ inline std::string_view GetCurrentGameBuildString()
#endif
}

#define EXPAND2(_, __, x) \
inline bool BOOST_PP_CAT(Is, x)() \
{ \
static bool retval; \
static bool inited = false; \
\
if (!inited) \
{ \
retval = xbr::GetGameBuild() == x; \
inited = true; \
} \
\
return retval; \
}

BOOST_PP_SEQ_FOR_EACH(EXPAND2, , GAME_BUILDS)

#undef EXPAND2

namespace xbr
{
template<int Build>
Expand Down
14 changes: 7 additions & 7 deletions code/components/rage-scripting-five/src/TableBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,31 +192,31 @@ static void DoMapping()
}
}

if (Is1604())
if (xbr::IsGameBuild<1604>())
{
assert(maxVersion == 19);
}
else if (Is2060())
else if (xbr::IsGameBuild<2060>())
{
assert(maxVersion == 22);
}
else if (Is2189())
else if (xbr::IsGameBuild<2189>())
{
assert(maxVersion == 23);
}
else if (Is2372())
else if (xbr::IsGameBuild<2372>())
{
assert(maxVersion == 24);
}
else if (Is2545() || Is2612() || Is2699())
else if (xbr::IsGameBuild<2545>() || xbr::IsGameBuild<2612>() || xbr::IsGameBuild<2699>())
{
assert(maxVersion == 25);
}
else if (Is2802())
else if (xbr::IsGameBuild<2802>())
{
assert(maxVersion == 26);
}
else if (Is2944() || Is3095() || Is3258())
else if (xbr::IsGameBuildOrGreater<2944>())
{
assert(maxVersion == 27);
}
Expand Down
Loading

0 comments on commit ecd511b

Please sign in to comment.