Skip to content

Commit

Permalink
llimit_adjuster_gta3vcsa v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Feb 22, 2014
1 parent 5289a12 commit 3dcec79
Show file tree
Hide file tree
Showing 9 changed files with 773 additions and 83 deletions.
675 changes: 675 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions limit_adjuster_gta3vcsa.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[SALIMITS] // 0x550F10
PtrNodeSingle = 70000
PtrNodeDouble = 9200
EntryInfoNode = 500
Peds = 140
Vehicles = 110
Buildings = 15000
Objects = 3500
Dummys = 9500
ColModel = 10500
Task = 500
Event = 200
PointRoute = 64
PatrolRoute = 32
NodeRoute = 64
TaskAllocator = 16
PedIntelligence = 140
PedAttractors = 64
StaticMatrices=99999

[VCLIMITS] // 0x4C0270
PtrNode = 70000
EntryInfoNode = 3200
Peds = 140
Vehicles = 110
Buildings = 20000
Treadables = 1
Objects = 3500
Dummys = 9500
AudioScriptObj = 192
ColModel = 10500

[GTA3LIMITS] // 0x4A1770
PtrNode = 90000
EntryInfoNode = 25400
Peds = 140
Vehicles = 110
Buildings = 35500
Objects = 9500
Dummys = 22802
53 changes: 49 additions & 4 deletions limit_adjuster_gta3vcsa/CIniReader/IniReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,34 @@
#include "IniReader.h"
#include <iostream>
#include <Windows.h>
using namespace std;

EXTERN_C IMAGE_DOS_HEADER __ImageBase;

CIniReader::CIniReader(char* szFileName)
{
char moduleName[MAX_PATH];
char dllPath[MAX_PATH];
char iniName[MAX_PATH];
char* tempPointer;

GetModuleFileName((HINSTANCE)&__ImageBase, moduleName, MAX_PATH);
tempPointer = strrchr(moduleName, '.');
*tempPointer = '\0';
tempPointer = strrchr(moduleName, '\\');
strncpy(iniName, tempPointer + 1, 255);
strcat(iniName, ".ini");
strncpy(dllPath, moduleName, (tempPointer - moduleName + 1));
dllPath[tempPointer - moduleName + 1] = '\0';
if (szFileName == "")
{
strcat(dllPath, iniName);
} else {
strcat(dllPath, szFileName);
}

memset(m_szFileName, 0x00, 255);
memcpy(m_szFileName, szFileName, strlen(szFileName));
memcpy(m_szFileName, dllPath, strlen(dllPath));
}
int CIniReader::ReadInteger(char* szSection, char* szKey, int iDefaultValue)
{
Expand All @@ -18,17 +41,17 @@ float CIniReader::ReadFloat(char* szSection, char* szKey, float fltDefaultValue)
char szResult[255];
char szDefault[255];
float fltResult;
sprintf(szDefault, "%f",fltDefaultValue);
_snprintf(szDefault, 255, "%f",fltDefaultValue);
GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName);
fltResult = atof(szResult);
fltResult = (float)atof(szResult);
return fltResult;
}
bool CIniReader::ReadBoolean(char* szSection, char* szKey, bool bolDefaultValue)
{
char szResult[255];
char szDefault[255];
bool bolResult;
sprintf(szDefault, "%s", bolDefaultValue? "True" : "False");
_snprintf(szDefault, 255, "%s", bolDefaultValue ? "True" : "False");
GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName);
bolResult = (strcmp(szResult, "True") == 0 ||
strcmp(szResult, "true") == 0) ? true : false;
Expand All @@ -41,4 +64,26 @@ char* CIniReader::ReadString(char* szSection, char* szKey, const char* szDefault
GetPrivateProfileString(szSection, szKey,
szDefaultValue, szResult, 255, m_szFileName);
return szResult;
}
void CIniReader::WriteInteger(char* szSection, char* szKey, int iValue)
{
char szValue[255];
_snprintf(szValue, 255, "%d", iValue);
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}
void CIniReader::WriteFloat(char* szSection, char* szKey, float fltValue)
{
char szValue[255];
_snprintf(szValue, 255, "%f", fltValue);
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}
void CIniReader::WriteBoolean(char* szSection, char* szKey, bool bolValue)
{
char szValue[255];
_snprintf(szValue, 255, "%s", bolValue ? "True" : "False");
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}
void CIniReader::WriteString(char* szSection, char* szKey, char* szValue)
{
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}
4 changes: 4 additions & 0 deletions limit_adjuster_gta3vcsa/CIniReader/IniReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class CIniReader
float ReadFloat(char* szSection, char* szKey, float fltDefaultValue);
bool ReadBoolean(char* szSection, char* szKey, bool bolDefaultValue);
char* ReadString(char* szSection, char* szKey, const char* szDefaultValue);
void WriteInteger(char* szSection, char* szKey, int iValue);
void WriteFloat(char* szSection, char* szKey, float fltValue);
void WriteBoolean(char* szSection, char* szKey, bool bolValue);
void WriteString(char* szSection, char* szKey, char* szValue);
private:
char m_szFileName[255];
};
Expand Down
32 changes: 0 additions & 32 deletions limit_adjuster_gta3vcsa/CIniReader/IniWriter.cpp

This file was deleted.

14 changes: 0 additions & 14 deletions limit_adjuster_gta3vcsa/CIniReader/IniWriter.h

This file was deleted.

25 changes: 0 additions & 25 deletions limit_adjuster_gta3vcsa/CIniReader/Main.cpp

This file was deleted.

9 changes: 2 additions & 7 deletions limit_adjuster_gta3vcsa/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ using namespace std;
int Thread()
{

CIniReader iniReader(".\\limit_adjuster_gta3vcsa.ini");
if((!iniReader.ReadInteger("SALIMITS", "PtrNodeSingle", 0))) {
iniReader = CIniReader::CIniReader(".\\mss\\limit_adjuster_gta3vcsa.ini");
if((!iniReader.ReadInteger("SALIMITS", "PtrNodeSingle", 0))) {
return 0;
}
}
CIniReader iniReader("");

switch(gGameVersion)
{
Expand Down Expand Up @@ -90,6 +84,7 @@ int Thread()
CPatch::SetChar(0x55124D+0x1, iniReader.ReadInteger("SALIMITS", "TaskAllocator", 16));
CPatch::SetInt(0x551282+0x1, iniReader.ReadInteger("SALIMITS", "PedIntelligence", 140));
CPatch::SetChar(0x5512BB+0x1, iniReader.ReadInteger("SALIMITS", "PedAttractors", 64));
CPatch::SetInt(0x54F3A0 + 0x1, iniReader.ReadInteger("SALIMITS", "StaticMatrices", 900));
break;

case GTA_SA_1_1:
Expand Down
4 changes: 3 additions & 1 deletion limit_adjuster_gta3vcsa/limit_adjuster_gta3vcsa.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -20,12 +20,14 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down

0 comments on commit 3dcec79

Please sign in to comment.