Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into improve-debugscri…
Browse files Browse the repository at this point in the history
…pt-syntax
  • Loading branch information
Fernando-A-Rocha committed Jun 22, 2024
2 parents 161a51d + 6397654 commit fd7c205
Show file tree
Hide file tree
Showing 232 changed files with 7,790 additions and 4,769 deletions.
29 changes: 13 additions & 16 deletions Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,19 @@ void CCore::UpdateRecentlyPlayed()
CCore::GetSingleton().SaveConfig();
}

void CCore::OnPostColorFilterRender()
{
if (!CGraphics::GetSingleton().HasLine3DPostFXQueueItems() && !CGraphics::GetSingleton().HasPrimitive3DPostFXQueueItems())
return;

CGraphics::GetSingleton().EnteringMTARenderZone();

CGraphics::GetSingleton().DrawPrimitive3DPostFXQueue();
CGraphics::GetSingleton().DrawLine3DPostFXQueue();

CGraphics::GetSingleton().LeavingMTARenderZone();
}

void CCore::ApplyCoreInitSettings()
{
#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) // Windows Vista
Expand Down Expand Up @@ -2010,22 +2023,6 @@ void CCore::OnPreFxRender()
//
void CCore::OnPreHUDRender()
{
IDirect3DDevice9* pDevice = CGraphics::GetSingleton().GetDevice();

if (CGraphics::GetSingleton().HasLine3DPostFXQueueItems() || CGraphics::GetSingleton().HasPrimitive3DPostFXQueueItems())
{
/*
Although MTA render zones are expensive, we should use them twice in the bounds of the function
because some of render states from PostFX drain to the 2D part of the frame.
*/
CGraphics::GetSingleton().EnteringMTARenderZone();

CGraphics::GetSingleton().DrawPrimitive3DPostFXQueue();
CGraphics::GetSingleton().DrawLine3DPostFXQueue();

CGraphics::GetSingleton().LeavingMTARenderZone();
}

CGraphics::GetSingleton().EnteringMTARenderZone();

// Maybe capture screen and other stuff
Expand Down
2 changes: 2 additions & 0 deletions Client/core/CCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
const SString& GetLastConnectedServerName() const { return m_strLastConnectedServerName; }
void SetLastConnectedServerName(const SString& strServerName) { m_strLastConnectedServerName = strServerName; }

void OnPostColorFilterRender() override;

private:
void ApplyCoreInitSettings();

Expand Down
2 changes: 1 addition & 1 deletion Client/core/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project "Client Core"
"../sdk",
"../../vendor/tinygettext",
"../../vendor/zlib",
"../../vendor/jpeg-9e",
"../../vendor/jpeg-9f",
"../../vendor/pthreads/include",
"../../vendor/sparsehash/src/",
"../../vendor/detours/4.0.1/src",
Expand Down
14 changes: 0 additions & 14 deletions Client/mods/deathmatch/CClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
g_pCore->GetCommands()->Add("shownametags", _("shows the nametags"), COMMAND_ShowNametags);
g_pCore->GetCommands()->Add("showchat", _("shows the chatbox"), COMMAND_ShowChat);
g_pCore->GetCommands()->Add("shownetstat", _("shows the network statistics"), COMMAND_ShowNetstat);
g_pCore->GetCommands()->Add("\x64\x61\x72\x6B\x73\x31\x64\x33", "", COMMAND_Eaeg);

// Key commands (registered as 'mod commands', can be disabled)
g_pCore->GetCommands()->Add("chatbox", _("open the chat input"), COMMAND_ChatBox, true, true);
Expand Down Expand Up @@ -96,9 +95,6 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
g_pCore->GetCommands()->Add("showsync", "show sync data", COMMAND_ShowSyncData);
// g_pCore->GetCommands ()->Add ( "dumpall", "dump internals (comment)", COMMAND_DumpPlayers );
#endif
#ifdef MTA_DEBUG
g_pCore->GetCommands()->Add("foo", "debug command for devs", COMMAND_Foo);
#endif

// Debug commands
#if defined(MTA_DEBUG) || defined(MTA_BETA)
Expand All @@ -116,19 +112,9 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
pCore->GetCommands()->Add("setmimic", "enables player mimics (amount)", COMMAND_SetMimic);
pCore->GetCommands()->Add("setmimiclag", "enables player mimic lag (amount)", COMMAND_SetMimicLag);
pCore->GetCommands()->Add("paintballs", "enables paintball mode", COMMAND_Paintballs);
pCore->GetCommands()->Add("breakpoint", "inserts breakpoint", COMMAND_Breakpoint);
pCore->GetCommands()->Add("giveweapon", "gives the player a weapon (id)", COMMAND_GiveWeapon);
pCore->GetCommands()->Add("showrpcs", "shows the remote prodecure calls", COMMAND_ShowRPCs);
pCore->GetCommands()->Add("showinterpolation", "shows information about the interpolation", COMMAND_ShowInterpolation);

pCore->GetCommands()->Add("watch", "enables wpm watch mode", COMMAND_Watch);
pCore->GetCommands()->Add("modules", "enables wpm module", COMMAND_Modules);

pCore->GetCommands()->Add("debug", "debug function 1", COMMAND_Debug);
pCore->GetCommands()->Add("debug2", "debug function 2", COMMAND_Debug2);
pCore->GetCommands()->Add("debug3", "debug function 3", COMMAND_Debug3);
pCore->GetCommands()->Add("debug4", "debug function 4", COMMAND_Debug4);
pCore->GetCommands()->Add("timestep", "timestep", COMMAND_TimeStep);
#endif

// Got any arguments?
Expand Down
171 changes: 0 additions & 171 deletions Client/mods/deathmatch/ClientCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ void COMMAND_ShowNetstat(const char* szCmdLine)
g_pClientGame->ShowNetstat(iCmd);
}

void COMMAND_Eaeg(const char* szCmdLine)
{
g_pClientGame->ShowEaeg(true);
}

void COMMAND_EnterPassenger(const char* szCmdLine)
{
// HACK: we don't want them to enter a vehicle if they're in cursor mode
Expand Down Expand Up @@ -790,15 +785,6 @@ void COMMAND_ShowSyncing(const char* szCmdLine)

#endif

#ifdef MTA_DEBUG

void COMMAND_Foo(const char* szCmdLine)
{
g_pClientGame->m_Foo.Test(szCmdLine);
}

#endif

#if defined(MTA_DEBUG) || defined(MTA_DEBUG_COMMANDS)
void COMMAND_ShowWepdata(const char* szCmdLine)
{
Expand Down Expand Up @@ -842,19 +828,6 @@ void COMMAND_Paintballs(const char* szCmdLine)
g_pClientGame->SetDoPaintballs(atoi(szCmdLine) == 1);
}

void COMMAND_Breakpoint(const char* szCmdLine)
{
if (!(szCmdLine && szCmdLine[0]))
return;
_asm
{
int 3
}
// Make our main pointer easily accessable
// Added by slush: You're a lazy ass if you use this.
g_pClientGame;
}

void COMMAND_GiveWeapon(const char* szCmdLine)
{
if (!(szCmdLine && szCmdLine[0]))
Expand Down Expand Up @@ -891,150 +864,6 @@ void COMMAND_ShowInterpolation(const char*)
g_pClientGame->ShowInterpolation(!g_pClientGame->IsShowingInterpolation());
}

void COMMAND_Watch(const char* szCmdLine)
{
// Note: This code might be a little unsafe if the detouring done by the DLL happens to be done
// exactly on a call to WriteProcessMemory even though the chance is small.
// adds a hook to a process and watches for WPMs to this one
DWORD dwProcessIDs[250];
DWORD pBytesReturned = 0;
unsigned int uiListSize = 50;
if (EnumProcesses(dwProcessIDs, 250 * sizeof(DWORD), &pBytesReturned))
{
for (unsigned int i = 0; i < pBytesReturned / sizeof(DWORD); i++)
{
// Open the process
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, dwProcessIDs[i]);
if (hProcess)
{
HMODULE pModule;
DWORD cbNeeded;
if (EnumProcessModules(hProcess, &pModule, sizeof(HMODULE), &cbNeeded))
{
char szModuleName[500];
if (GetModuleFileNameEx(hProcess, pModule, szModuleName, 500))
{
if (stricmp(szModuleName + strlen(szModuleName) - strlen(szCmdLine), szCmdLine) == 0)
{
g_pCore->GetConsole()->Printf("Attaching to %s with process id %d...", szModuleName, hProcess);
RemoteLoadLibrary(hProcess, "C:/Program Files/Rockstar Games/GTA San Andreas/mta/wpmhookdll.dll");
CloseHandle(hProcess);
return;
}
}
}

// Close the process
CloseHandle(hProcess);
}
}
}
}

void COMMAND_Modules(const char* szCmdLine)
{
// Get the base address of the requested module
// Take a snapshot of all modules in the specified process.
HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
if (hModuleSnap != INVALID_HANDLE_VALUE)
{
// Set the size of the structure before using it.
MODULEENTRY32 ModuleEntry;
ModuleEntry.dwSize = sizeof(MODULEENTRY32);

// Retrieve information about the first module,
// and exit if unsuccessful
if (Module32First(hModuleSnap, &ModuleEntry))
{
// Create a file
FILE* pFile = fopen("modules.txt", "w+");
if (pFile)
{
// Now walk the module list of the process,
// and display information about each module
do
{
// Print it
fprintf(pFile,
"** MODULE **\n"
"Name: %s\n"
"Base: 0x%p\n"
"Size: 0x%x\n"
"\n",
ModuleEntry.szModule, ModuleEntry.modBaseAddr, ModuleEntry.modBaseSize);
} while (Module32Next(hModuleSnap, &ModuleEntry));

// Close it
fclose(pFile);
}
}

// Close the snapshot object
CloseHandle(hModuleSnap);
}
}

#include <CClientCorona.h>
CClientPickup* pPickupTest = NULL;
CClientCorona* pCoronaTest = NULL;
CVehicle* debugTrain = NULL;
CClientPlayer* pRonkert = NULL;
CObject* obj = NULL;

void COMMAND_Debug(const char* szCmdLine)
{
__debugbreak();

return;
}

#include "CVehicleNames.h"

CVehicle* aaa = NULL;
CVehicle* bbb = NULL;

CMatrix* save = NULL;
float fTest = 0;

#include <crtdbg.h>
void COMMAND_Debug2(const char* szCmdLine)
{
g_pGame->GetAudioEngine()->StopRadio();
}

CClientPed* pTest = NULL;
CClientVehicle *v, *vnew;

void COMMAND_Debug3(const char* szCmdLine)
{
_asm
{
pushad
mov ecx, 0x8CB6F8
mov eax, 0x4E7F80
call eax
popad
}
g_pGame->GetAudioEngine()->StopRadio();
g_pGame->GetAudioEngine()->StartRadio(1);
return;
}

CVector origin22;
CObject* o;

void COMMAND_Debug4(const char* szCmdLine)
{
g_pCore->GetConsole()->Printf("debug4");
g_pClientGame->StartPlayback();
return;
}

void COMMAND_TimeStep(const char* szCmdLine)
{
g_pCore->GetConsole()->Printf("TimeStep: %f", *(float*)0xB7CB5C); // CTimer::ms_fTimeStep
}

#endif

void COMMAND_ShowCollision(const char* szCmdLine)
Expand Down
17 changes: 0 additions & 17 deletions Client/mods/deathmatch/ClientCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHand

void COMMAND_Help(const char* szCmdLine);
void COMMAND_Disconnect(const char* szCmdLine);
void COMMAND_FrameSkip(const char* szCmdLine);
void COMMAND_ShowNametags(const char* szCmdLine);
void COMMAND_ShowChat(const char* szCmdLine);
void COMMAND_ShowNetstat(const char* szCmdLine);
void COMMAND_Eaeg(const char* szCmdLine);
void COMMAND_EnterPassenger(const char* szCmdLine);
void COMMAND_RadioNext(const char* szCmdLine);
void COMMAND_RadioPrevious(const char* szCmdLine);
void COMMAND_DriveBy(const char* szCmdLine);
void COMMAND_RadarMap(const char* szCmdLine);
void COMMAND_RadarZoomIn(const char* szCmdLine);
void COMMAND_RadarZoomOut(const char* szCmdLine);
Expand Down Expand Up @@ -53,10 +50,6 @@ void COMMAND_ShowSyncData(const char* szCmdLine);
void COMMAND_ShowSyncing(const char* szCmdLine);
#endif

#ifdef MTA_DEBUG
void COMMAND_Foo(const char* szCmdLine);
#endif

#ifdef MTA_WEPSYNCDBG
void COMMAND_ShowWepdata(const char* szCmdLine);
#endif
Expand All @@ -68,19 +61,9 @@ void COMMAND_ShowPlayer(const char* szCmdLine);
void COMMAND_SetMimic(const char* szCmdLine);
void COMMAND_SetMimicLag(const char* szCmdLine);
void COMMAND_Paintballs(const char* szCmdLine);
void COMMAND_Breakpoint(const char* szCmdLine);
void COMMAND_GiveWeapon(const char* szCmdLine);
void COMMAND_ShowRPCs(const char* szCmdLine);
void COMMAND_ShowInterpolation(const char* szCmdLine);

void COMMAND_Watch(const char* szCmdLine);
void COMMAND_Modules(const char* szCmdLine);

void COMMAND_Debug(const char* szCmdLine);
void COMMAND_Debug2(const char* szCmdLine);
void COMMAND_Debug3(const char* szCmdLine);
void COMMAND_Debug4(const char* szCmdLine);
void COMMAND_TimeStep(const char* szCmdLine);
#endif

// Commands enabled when development mode in on
Expand Down
Loading

0 comments on commit fd7c205

Please sign in to comment.