mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
CCommandLine additions
This commit is contained in:
parent
ef454ac126
commit
479adc4b85
9
r5dev/public/include/icommandline.h
Normal file
9
r5dev/public/include/icommandline.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef ICOMMANDLINE_H
|
||||
#define ICOMMANDLINE_H
|
||||
|
||||
class ICommandLine
|
||||
{
|
||||
void* __vftable /*VFT*/;
|
||||
};
|
||||
|
||||
#endif // ICOMMANDLINE_H
|
@ -8,6 +8,24 @@
|
||||
#include "tier0/commandline.h"
|
||||
#include "tier1/cvar.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
CCommandLine::CCommandLine(void)
|
||||
{
|
||||
m_pszCmdLine = NULL;
|
||||
m_nParmCount = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
CCommandLine::~CCommandLine(void)
|
||||
{
|
||||
CleanUpParms();
|
||||
delete[] m_pszCmdLine;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Create a command line from the passed in string
|
||||
// Note that if you pass in a @filename, then the routine will read settings
|
||||
@ -126,8 +144,18 @@ void CCommandLine::SetParm(int nIndex, char const* pParm)
|
||||
CallVFunc<void>(index, this, nIndex, pParm);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
CCommandLine* g_pCmdLine = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// Individual command line arguments
|
||||
//-----------------------------------------------------------------------------
|
||||
void CCommandLine::CleanUpParms(void)
|
||||
{
|
||||
for (int i = 0; i < m_nParmCount; ++i)
|
||||
{
|
||||
delete[] m_ppParms[i];
|
||||
m_ppParms[i] = NULL;
|
||||
}
|
||||
m_nParmCount = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Instance singleton and expose interface to rest of code
|
||||
@ -136,3 +164,6 @@ CCommandLine* CommandLine(void)
|
||||
{
|
||||
return g_pCmdLine;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
CCommandLine* g_pCmdLine = nullptr;
|
@ -4,21 +4,30 @@
|
||||
class CCommandLine : public ICommandLine // VTABLE @0x141369C78 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
public:
|
||||
CCommandLine(void);
|
||||
~CCommandLine(void);
|
||||
|
||||
void CreateCmdLine(const char* pszCommandline);
|
||||
void CreateCmdLine(int argc, char** argv);
|
||||
void CreatePool(void* pMem);
|
||||
|
||||
const char* GetCmdLine(void);
|
||||
|
||||
const char* CheckParm(const char* psz, const char** ppszValue = NULL);
|
||||
void RemoveParm(const char* pszParm);
|
||||
void AppendParm(const char* pszParm, const char* pszValues);
|
||||
|
||||
const char* ParmValue(const char* psz, const char* pDefaultVal = NULL);
|
||||
int ParmValue(const char* psz, int nDefaultVal);
|
||||
float ParmValue(const char* psz, float flDefaultVal);
|
||||
|
||||
int ParmCount(void);
|
||||
int FindParm(const char* psz);
|
||||
const char* GetParm(int nIndex);
|
||||
void SetParm(int nIndex, char const* pParm);
|
||||
|
||||
void CleanUpParms(void);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
@ -27,7 +36,7 @@ private:
|
||||
};
|
||||
|
||||
char* m_pszCmdLine;
|
||||
char m_Pad[0x18];
|
||||
char m_Pad[0x18]; // <-- thread/mutex stuff.
|
||||
int m_nParmCount;
|
||||
char* m_ppParms[MAX_PARAMETERS];
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user