File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -318,37 +318,23 @@ void D2DXContext::CheckMajorGameState()
318318
319319 _majorGameState = MajorGameState::Menus;
320320
321- if (_gameHelper->ScreenOpenMode () == 3 )
321+ if (_gameHelper->IsInGame () )
322322 {
323323 _majorGameState = MajorGameState::InGame;
324+ AttachLateDetours (_gameHelper.get (), this );
324325 }
325326 else
326327 {
327328 for (int32_t i = 0 ; i < batchCount; ++i)
328329 {
329330 const Batch& batch = _batches.items [i];
331+ const int32_t y0 = _vertices.items [batch.GetStartVertex ()].GetY ();
330332
331- if ((GameAddress) batch.GetGameAddress () == GameAddress::DrawFloor )
333+ if (batch.GetHash () == 0x4bea7b80 && y0 >= 550 )
332334 {
333- _majorGameState = MajorGameState::InGame;
334- AttachLateDetours (_gameHelper.get (), this );
335+ _majorGameState = MajorGameState::TitleScreen;
335336 break ;
336- }
337- }
338-
339- if (_majorGameState == MajorGameState::Menus)
340- {
341- for (int32_t i = 0 ; i < batchCount; ++i)
342- {
343- const Batch& batch = _batches.items [i];
344- const int32_t y0 = _vertices.items [batch.GetStartVertex ()].GetY ();
345-
346- if (batch.GetHash () == 0x4bea7b80 && y0 >= 550 )
347- {
348- _majorGameState = MajorGameState::TitleScreen;
349- break ;
350- }
351- }
337+ }
352338 }
353339 }
354340}
Original file line number Diff line number Diff line change @@ -986,3 +986,24 @@ bool GameHelper::IsGameMenuOpen() const
986986 return false ;
987987 }
988988}
989+
990+ bool GameHelper::IsInGame () const
991+ {
992+ auto playerUnit = GetPlayerUnit ();
993+
994+ switch (_version)
995+ {
996+ case GameVersion::Lod109d:
997+ return *((uint32_t *)((uint32_t )_hD2ClientDll + 0x1109FC )) != 0 && playerUnit != 0 && playerUnit->u .v109 .path != 0 ;
998+ case GameVersion::Lod112:
999+ return *((uint32_t *)((uint32_t )_hD2ClientDll + 0x11BCC4 )) != 0 && playerUnit != 0 && playerUnit->u .v112 .path != 0 ;
1000+ case GameVersion::Lod113c:
1001+ return *((uint32_t *)((uint32_t )_hD2ClientDll + 0xF8C9C )) != 0 && playerUnit != 0 && playerUnit->u .v112 .path != 0 ;
1002+ case GameVersion::Lod113d:
1003+ return *((uint32_t *)((uint32_t )_hD2ClientDll + 0xF79E0 )) != 0 && playerUnit != 0 && playerUnit->u .v112 .path != 0 ;
1004+ case GameVersion::Lod114d:
1005+ return *((uint32_t *)((uint32_t )_hGameExe + 0x3A27C0 )) != 0 && playerUnit != 0 && playerUnit->u .v112 .path != 0 ;
1006+ default :
1007+ return false ;
1008+ }
1009+ }
Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ namespace d2dx
7373 virtual int32_t GetCurrentAct () const override ;
7474
7575 virtual bool IsGameMenuOpen () const override ;
76+
77+ virtual bool IsInGame () const override ;
7678
7779 private:
7880 GameVersion GetGameVersion ();
Original file line number Diff line number Diff line change @@ -97,5 +97,7 @@ namespace d2dx
9797 virtual int32_t GetCurrentAct () const = 0;
9898
9999 virtual bool IsGameMenuOpen () const = 0;
100+
101+ virtual bool IsInGame () const = 0;
100102 };
101103}
Original file line number Diff line number Diff line change 88 <LocalDebuggerDebuggerType >NativeOnly</LocalDebuggerDebuggerType >
99 </PropertyGroup >
1010 <PropertyGroup Condition =" '$(Configuration)|$(Platform)'=='Release|Win32'" >
11- <LocalDebuggerCommand >C:\games\Diablo II\Game .exe</LocalDebuggerCommand >
11+ <LocalDebuggerCommand >C:\games\Diablo II\game .exe</LocalDebuggerCommand >
1212 <DebuggerFlavor >WindowsLocalDebugger</DebuggerFlavor >
13- <LocalDebuggerCommandArguments >-3dfx -ns -w -dxtestmop - dxnoclipcursor</LocalDebuggerCommandArguments >
13+ <LocalDebuggerCommandArguments >-3dfx -ns -w -dxnoclipcursor</LocalDebuggerCommandArguments >
1414 <LocalDebuggerWorkingDirectory >C:\games\Diablo II\</LocalDebuggerWorkingDirectory >
1515 <LocalDebuggerDebuggerType >NativeOnly</LocalDebuggerDebuggerType >
1616 </PropertyGroup >
You can’t perform that action at this time.
0 commit comments