mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Set the correct datatype for what was originally 'm_bSplitScreenConnect'
Bool is a char on this platform, and UINT8_MAX is 0xff (255), yet we set this char to 256 causing arithmetic overflow. Looking at the assembly of the game, this really is a uint16_t, and gets set to 256 in CHostState::Init, parsed to State_NewGame as 256 before the lowbyte is being reset to 0.
This commit is contained in:
parent
34a06147d7
commit
b1e1765124
@ -172,7 +172,7 @@ FORCEINLINE void CHostState::Init(void)
|
||||
m_levelName[0] = 0;
|
||||
m_landMarkName[0] = 0;
|
||||
m_mapGroupName[0] = 0;
|
||||
m_bSplitScreenConnect = 256; // Is this actually 'm_bSplitScreenConnect'? (assembly sets this value, other 3 bytes are padded which makes this operation valid still).
|
||||
m_nSplitScreenPlayers = 256;
|
||||
m_vecLocation.Init();
|
||||
m_angLocation.Init();
|
||||
m_iCurrentState = HostStates_t::HS_NEW_GAME;
|
||||
@ -321,8 +321,8 @@ FORCEINLINE void CHostState::GameShutDown(void)
|
||||
FORCEINLINE void CHostState::State_NewGame(void)
|
||||
{
|
||||
LARGE_INTEGER time{};
|
||||
|
||||
m_bSplitScreenConnect = false;
|
||||
uint16_t nSplitScreenPlayers = m_nSplitScreenPlayers;
|
||||
m_nSplitScreenPlayers = 0;
|
||||
#ifndef CLIENT_DLL
|
||||
if (!g_pServerGameClients) // Init Game if it ain't valid.
|
||||
{
|
||||
@ -332,7 +332,7 @@ FORCEINLINE void CHostState::State_NewGame(void)
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if (!CModelLoader__Map_IsValid(g_pModelLoader, m_levelName) // Check if map is valid and if we can start a new game.
|
||||
|| !Host_NewGame(m_levelName, nullptr, m_bBackgroundLevel, m_bSplitScreenConnect, time) || !g_pServerGameClients)
|
||||
|| !Host_NewGame(m_levelName, nullptr, m_bBackgroundLevel, nSplitScreenPlayers, time) || !g_pServerGameClients)
|
||||
{
|
||||
Error(eDLL_T::ENGINE, false, "%s - Error: Map not valid\n", "CHostState::State_NewGame");
|
||||
#ifndef DEDICATED
|
||||
|
@ -45,9 +45,7 @@ public:
|
||||
bool m_bRememberLocation; //0x0265
|
||||
bool m_bBackgroundLevel; //0x0266
|
||||
bool m_bWaitingForConnection; //0x0267
|
||||
bool m_bSplitScreenConnect; //0x0268
|
||||
bool m_bGameHasShutDownAndFlushedMemory; //0x0269
|
||||
bool m_bWorkshopMapDownloadPending; //0x026A
|
||||
uint16_t m_nSplitScreenPlayers; //0x0268
|
||||
};
|
||||
|
||||
/* ==== CHOSTSTATE ====================================================================================================================================================== */
|
||||
|
Loading…
x
Reference in New Issue
Block a user