Skip to content

Commit 599234d

Browse files
committed
Applied source code semantic modification.
Removed unusable function.
1 parent 08060fc commit 599234d

File tree

13 files changed

+33
-26
lines changed

13 files changed

+33
-26
lines changed

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Resource.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ int CLuaFunctionDefs::LoadString( lua_State* luaVM )
427427
const char* cpInBuffer = strInput;
428428
uint uiInSize = strInput.length();
429429

430-
// Decrypt if required
430+
// Deobfuscate if required
431431
const char* cpBuffer;
432432
uint uiSize;
433-
if ( !g_pNet->DecryptScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/loadstring" ) )
433+
if ( !g_pNet->DeobfuscateScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/loadstring" ) )
434434
{
435435
SString strMessage( "argument 1 is invalid. Please re-compile at http://luac.mtasa.com/", 0 );
436436
argStream.SetCustomError( strMessage );
@@ -500,10 +500,10 @@ int CLuaFunctionDefs::Load( lua_State* luaVM )
500500
const char* cpInBuffer = strInput;
501501
uint uiInSize = strInput.length();
502502

503-
// Decrypt if required
503+
// Deobfuscate if required
504504
const char* cpBuffer;
505505
uint uiSize;
506-
if ( !g_pNet->DecryptScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/load" ) )
506+
if ( !g_pNet->DeobfuscateScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/load" ) )
507507
{
508508
SString strMessage( "argument 2 is invalid. Please re-compile at http://luac.mtasa.com/", 0 );
509509
argStream.SetCustomError( strMessage );

MTA10/mods/shared_logic/lua/CLuaMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,10 +2005,10 @@ bool CLuaMain::LoadScriptFromBuffer ( const char* cpInBuffer, unsigned int uiInS
20052005
{
20062006
SString strNiceFilename = ConformResourcePath( szFileName );
20072007

2008-
// Decrypt if required
2008+
// Deobfuscate if required
20092009
const char* cpBuffer;
20102010
uint uiSize;
2011-
if ( !g_pNet->DecryptScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, strNiceFilename ) )
2011+
if ( !g_pNet->DeobfuscateScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, strNiceFilename ) )
20122012
{
20132013
SString strMessage( "%s is invalid. Please re-compile at http://luac.mtasa.com/", *strNiceFilename );
20142014
g_pClientGame->GetScriptDebugging()->LogError ( m_luaVM, "Loading script failed: %s", *strMessage );

MTA10/sdk/net/CNet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class CNet
128128
virtual bool ValidateBinaryFileName ( const char* szFilename ) = 0;
129129
virtual CBinaryFileInterface* AllocateBinaryFile ( void ) = 0;
130130
virtual bool EncryptDumpfile ( const char* szClearPathFilename, const char* szEncryptedPathFilename ) = 0;
131-
virtual bool DecryptScript ( const char* cpInBuffer, uint uiInSize, const char** pcpOutBuffer, uint* puiOutSize, const char* szScriptName ) = 0;
131+
virtual bool DeobfuscateScript ( const char* cpInBuffer, uint uiInSize, const char** pcpOutBuffer, uint* puiOutSize, const char* szScriptName ) = 0;
132132
virtual void PostCrash ( void ) = 0;
133133
virtual int SendTo ( SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen ) = 0;
134134
};

MTA10_Server/mods/deathmatch/logic/CResourceChecker.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ void CResourceChecker::CheckLuaFileForIssues ( const string& strPath, const stri
400400
if ( strFileContents.length () == 0 )
401401
return;
402402

403-
// Update decrypt version requirements, and do no more checking if encrypted
404-
if ( CheckLuaDecryptRequirements( strFileContents, strFileName, strResourceName, bClientScript ) )
403+
// Update deobfuscate version requirements, and do no more checking if obfuscated
404+
if ( CheckLuaDeobfuscateRequirements( strFileContents, strFileName, strResourceName, bClientScript ) )
405405
return;
406406

407407
// Check if a compiled script
@@ -446,12 +446,12 @@ void CResourceChecker::CheckLuaFileForIssues ( const string& strPath, const stri
446446

447447
///////////////////////////////////////////////////////////////
448448
//
449-
// CResourceChecker::CheckLuaDecryptRequirements
449+
// CResourceChecker::CheckLuaDeobfuscateRequirements
450450
//
451-
// Updates version requirements and returns true if encrypted
451+
// Updates version requirements and returns true if obfuscated
452452
//
453453
///////////////////////////////////////////////////////////////
454-
bool CResourceChecker::CheckLuaDecryptRequirements ( const string& strFileContents, const string& strFileName, const string& strResourceName, bool bClientScript )
454+
bool CResourceChecker::CheckLuaDeobfuscateRequirements ( const string& strFileContents, const string& strFileName, const string& strResourceName, bool bClientScript )
455455
{
456456
// Get embedded version requirements
457457
SScriptInfo scriptInfo;
@@ -495,7 +495,7 @@ bool CResourceChecker::CheckLuaDecryptRequirements ( const string& strFileConten
495495
m_strReqServerReason = strFileName;
496496
}
497497

498-
return IsLuaEncryptedScript( strFileContents.c_str(), strFileContents.length() );
498+
return IsLuaObfuscatedScript( strFileContents.c_str(), strFileContents.length() );
499499
}
500500

501501

MTA10_Server/mods/deathmatch/logic/CResourceChecker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class CResourceChecker
5858
void CheckMetaFileForIssues ( const string& strPath, const string& strFileName, const string& strResourceName );
5959
void CheckMetaSourceForIssues ( CXMLNode* pRootNode, const string& strFileName, const string& strResourceName, ECheckerModeType checkerMode, bool* pbOutHasChanged = NULL );
6060
void CheckLuaFileForIssues ( const string& strPath, const string& strFileName, const string& strResourceName, bool bClientScript );
61-
bool CheckLuaDecryptRequirements ( const string& strFileContents, const string& strFileName, const string& strResourceName, bool bClientScript );
61+
bool CheckLuaDeobfuscateRequirements ( const string& strFileContents, const string& strFileName, const string& strResourceName, bool bClientScript );
6262
void CheckLuaSourceForIssues ( string strLuaSource, const string& strFileName, const string& strResourceName, bool bClientScript, bool bCompiledScript, ECheckerModeType checkerMode, string* pstrOutResult = NULL );
6363
long FindLuaIdentifier ( const char* szLuaSource, long* plOutLength, long* plLineNumber );
6464
bool UpgradeLuaFunctionName ( const string& strFunctionName, bool bClientScript, string& strOutUpgraded );

MTA10_Server/mods/deathmatch/logic/lua/CLuaMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ bool CLuaMain::LoadScriptFromBuffer ( const char* cpInBuffer, unsigned int uiInS
297297
{
298298
SString strNiceFilename = ConformResourcePath( szFileName );
299299

300-
// Decrypt if required
300+
// Deobfuscate if required
301301
const char* cpBuffer;
302302
uint uiSize;
303-
if ( !g_pRealNetServer->DecryptScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, strNiceFilename ) )
303+
if ( !g_pRealNetServer->DeobfuscateScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, strNiceFilename ) )
304304
{
305305
SString strMessage( "%s is invalid. Please re-compile at http://luac.mtasa.com/", *strNiceFilename );
306306
g_pGame->GetScriptDebugging()->LogError ( m_luaVM, "Loading script failed: %s", *strMessage );

MTA10_Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,10 +1295,10 @@ int CLuaResourceDefs::LoadString( lua_State* luaVM )
12951295
const char* cpInBuffer = strInput;
12961296
uint uiInSize = strInput.length();
12971297

1298-
// Decrypt if required
1298+
// Deobfuscate if required
12991299
const char* cpBuffer;
13001300
uint uiSize;
1301-
if ( !g_pRealNetServer->DecryptScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/loadstring" ) )
1301+
if ( !g_pRealNetServer->DeobfuscateScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/loadstring" ) )
13021302
{
13031303
SString strMessage( "argument 1 is invalid. Please re-compile at http://luac.mtasa.com/", 0 );
13041304
argStream.SetCustomError( strMessage );
@@ -1368,10 +1368,10 @@ int CLuaResourceDefs::Load( lua_State* luaVM )
13681368
const char* cpInBuffer = strInput;
13691369
uint uiInSize = strInput.length();
13701370

1371-
// Decrypt if required
1371+
// Deobfuscate if required
13721372
const char* cpBuffer;
13731373
uint uiSize;
1374-
if ( !g_pRealNetServer->DecryptScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/load" ) )
1374+
if ( !g_pRealNetServer->DeobfuscateScript( cpInBuffer, uiInSize, &cpBuffer, &uiSize, m_pResourceManager->GetResourceName( luaVM ) + "/load" ) )
13751375
{
13761376
SString strMessage( "argument 2 is invalid. Please re-compile at http://luac.mtasa.com/", 0 );
13771377
argStream.SetCustomError( strMessage );

MTA10_Server/sdk/net/CNetServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class CNetServer
144144
virtual bool EncryptDumpfile ( const char* szClearPathFilename, const char* szEncryptedPathFilename ) { return false; }
145145
virtual bool ValidateHttpCacheFileName ( const char* szFilename ) { return false; }
146146
virtual bool GetScriptInfo ( const char* cpInBuffer, uint uiInSize, SScriptInfo* pOutInfo ) { return false; }
147-
virtual bool DecryptScript ( const char* cpInBuffer, uint uiInSize, const char** pcpOutBuffer, uint* puiOutSize, const char* szScriptName ) { return false; }
147+
virtual bool DeobfuscateScript ( const char* cpInBuffer, uint uiInSize, const char** pcpOutBuffer, uint* puiOutSize, const char* szScriptName ) { return false; }
148148
virtual bool GetPlayerPacketUsageStats ( uchar* packetIdList, uint uiNumPacketIds, SPlayerPacketUsage* pOutStats, uint uiTopCount ) { return false; }
149149
virtual const char* GetLogOutput ( void ) { return NULL; }
150150
virtual bool IsValidSocket ( const NetServerPlayerID& playerID ) { assert( 0 ); return false; }

Shared/sdk/SharedUtil.Misc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ namespace SharedUtil
215215

216216
// Buffer identification
217217
bool IsLuaCompiledScript( const void* pData, uint uiLength );
218-
bool IsLuaEncryptedScript( const void* pData, uint uiLength );
218+
bool IsLuaObfuscatedScript( const void* pData, uint uiLength );
219219

220220
//
221221
// Some templates

Shared/sdk/SharedUtil.Misc.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,8 +1335,8 @@ bool SharedUtil::IsLuaCompiledScript( const void* pData, uint uiLength )
13351335
return ( uiLength > 0 && pCharData[0] == 0x1B ); // Do the same check as what the Lua parser does
13361336
}
13371337

1338-
// Check for encypted script
1339-
bool SharedUtil::IsLuaEncryptedScript( const void* pData, uint uiLength )
1338+
// Check for obfuscated script
1339+
bool SharedUtil::IsLuaObfuscatedScript( const void* pData, uint uiLength )
13401340
{
13411341
const uchar* pCharData = (const uchar*)pData;
13421342
return ( uiLength > 0 && pCharData[0] == 0x1C ); // Look for our special marker

0 commit comments

Comments
 (0)