Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
thelink2012 committed Apr 23, 2017
2 parents eab7b11 + c731ec5 commit 3aa368b
Show file tree
Hide file tree
Showing 40 changed files with 299 additions and 57 deletions.
79 changes: 79 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
CLEO 4 Change Log

4.3.22
* Now creates cleo, cleo/cleo_saves and cleo/cleo_text folders on startup if they do not exist
* Fix to issue with 0AE9 not returning result

4.3.21
* Fix to issue with 0AB1 in missions not storing mission locals

4.3.20
* Fixed issue with 0AB1 passing incorrect variable scope in missions
* Updated SDK version

4.3.17
* Fixed potential future problem with 0AB0 which used methods with undefined behaviour
* Fixed incorrect method used for 0AB7

4.3.16
* Fixed bugs with CLEO saves when saved scripts ended
* Prevented crashing when invalid audiostream handles are used

4.3.15
* Improvemed compatibility fix for opcodes 0AE1, 0AE2 and 0AE3 with incorrect find_next usage

4.3.14
* Fixed 0AAA only returning custom scripts
* Fixed many things which use the 'SCM Block' or 'Mission Local Storage' space
* Fixed parameters being passed to script local storage instead of mission local storage through 0A94
* Fixed potential problems with iteration through the script queues (may cause rare and hard to trace bugs)

4.3.13
* Fixed crashing when starting a new game after a game has already started with CLEO scripts installed
* Possibly fixed other issues with starting a game with CLEO scripts installed

4.3.12
* Fixed string parameter skipping in 'SkipOpcodeParams' used by CLEO plugins
* 0AC8 now returns a NULL value to the output var if allocation failed (as it did before 4.3a)
* 0AC9 now checks the memory was allocated by 0AC8 before attempting to free it
* FXT references are now case insensitive (as they were before 4.3a)
* File operations now check the input handle isn't null (as it seems was the way before 4.3a)
* 'Loaded mission' status now reset on new/loaded game (as it was before 4.3a)
* Scripts no longer load prematurely (like before 4.3a)
* Resolved conflicts with other menu hooks such as 'HUME'
* Other minor tweaks

4.3.11
* Fixed crash with 0ADA in scripts beginning with an opcode ending in '00'

4.3.10
* Improvements to opcodes 0AE1, 0AE2 and 0AE3 - now loops around the pool even when the 'find_next' flag isn't used correctly
* Fixed 0AD2 not returning peds targetted with the mouse, while targetting with a pad worked

4.3.09
* Will now be able to start a CLEO mission after recently finishing a standard mission
* Will no longer error & terminate when scripts fail to open and instead simply log the error
* Will no longer terminate on warnings
* No longer includes paths in automatically generated script names (e.g. cleo\dir\demo.cs is now named 'demo.cs' and not 'dir\dem')
* Improved handling of script load errors

4.3b
=========
* Added support for steam (gta_sa.exe v3) executables
* Added 'legacy' script modes. Scripts with the extension .cs3 will be treated as CLEO 3 scripts and opened in legacy mode.
0A99 CHANGE_DIRECTORY can now correctly change to the program directory
0A9A OPEN_FILE now uses legacy mode when using an integer mode parameter for compatibility of CLEO file handles and SA file handles
Note that you should really not pass CLEO file handles to game functions. However, this legacy mode now ensures that the handles are compatible.
Other file functions have also been updated ensuring that game file handles are passed to relevant game functions.
It is recommended to not rely on passing files to game functions and instead use CLEO's in-built file functions in future.
0AD1 CALL now accepts string input, which is passed as a string pointer following string convention
CALL now does not initialise local storage to 0 when in CLEO 3 legacy mode
0AD4 SCAN_STRING now returns a condition result
0AE6 FIND_FIRST_FILE now accepts string array output
0AE3 FIND_ALL_RANDOM_OBJECTS_IN_SPHERE now ensures no fading objects are returned and returns -1 instead of 0 on failure
0AE2 FIND_ALL_RANDOM_CARS_IN_SPHERE now ensures no script vehicles or fading vehicle are returned and returns -1 instead of 0 on failure
0AE1 FIND_ALL_RANDOM_CHARS_IN_SPHERE now ensures no script characters or fading characters are returned and returns -1 instead of 0 on failure
0ADF ADD_TEXT_LABEL now updates existing text labels if they already exist
0AD6 IS_END_OF_FILE_REACHED now returns true if a file error occured
0AD2 GET_CHAR_PLAYER_IS_TARGETING now returns -1 instead of 0 when no target is found
0AB5 STORE_CLOSEST_ENTITIES now ensures no script entities or fading entities are returned and ensures the player ped is not returned
5 changes: 4 additions & 1 deletion CLEO4.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CLEO", "CLEO4.vcxproj", "{8091E84C-E97A-4BC0-AC4C-9FFF6B8EB6D7}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CLEO", "CLEO4\CLEO4.vcxproj", "{8091E84C-E97A-4BC0-AC4C-9FFF6B8EB6D7}"
ProjectSection(ProjectDependencies) = postProject
{32FCF424-D919-4F50-A4FC-177CF89B4A6D} = {32FCF424-D919-4F50-A4FC-177CF89B4A6D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GTASA", "..\GTASA\GTASA.vcxproj", "{32FCF424-D919-4F50-A4FC-177CF89B4A6D}"
EndProject
Expand Down
File renamed without changes.
File renamed without changes.
37 changes: 22 additions & 15 deletions CCustomOpcodeSystem.cpp → CLEO4/CCustomOpcodeSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,21 +811,23 @@ namespace CLEO
prevScmFunctionId(reinterpret_cast<CCustomScript*>(thread)->GetScmFunction()), retnAddress(thread->GetBytePointer())
{
auto cs = reinterpret_cast<CCustomScript*>(thread);
auto locals = cs->IsMission()? missionLocals : cs->LocalVar;
std::copy(locals, locals + 32, savedTls);

auto scope = cs->IsMission() ? missionLocals : cs->LocalVar;
std::copy(scope, scope + 32, savedTls);

SCRIPT_VAR fill_val; fill_val.dwParam = 0;

// CLEO 3 didnt initialise local storage, so dont do it if we're processing a CLEO 3 script in case the storage is used
if(cs->IsCustom() && cs->GetCompatibility() >= CLEO_VER_4_MIN)
std::fill(locals, locals + 32, fill_val); // fill with zeros
std::fill(scope, scope + 32, fill_val); // fill with zeros

cs->SetScmFunction(thisScmFunctionId = allocationPlace);
}

void Return(CRunningScript *thread)
{
auto cs = reinterpret_cast<CCustomScript*>(thread);
std::copy(savedTls, savedTls + 32, cs->IsMission()? missionLocals : cs->LocalVar);
std::copy(savedTls, savedTls + 32, cs->IsMission() ? missionLocals : cs->LocalVar);
cs->SetIp(retnAddress);
cs->SetScmFunction(prevScmFunctionId);
}
Expand Down Expand Up @@ -1549,20 +1551,20 @@ namespace CLEO
DWORD key;
*thread >> key;
SHORT state = GetKeyState(key);
SetScriptCondResult(thread, GetKeyState(key) & 0x8000);
SetScriptCondResult(thread, (GetKeyState(key) & 0x8000) != 0);
return OR_CONTINUE;
}

//0AB1=-1,call_scm_func %1p%
OpcodeResult __stdcall opcode_0AB1(CRunningScript *thread)
{
DWORD label,
nParams;
int label;
DWORD nParams;

*thread >> label >> nParams;

static SCRIPT_VAR arguments[64];
SCRIPT_VAR * arguments_end = arguments + nParams;
SCRIPT_VAR* arguments_end = &arguments[nParams];

if(nParams)
{
Expand Down Expand Up @@ -1598,7 +1600,8 @@ namespace CLEO
new ScmFunction(thread);

// pass arguments
if(nParams) std::copy(arguments, arguments_end, thread->IsMission() ? missionLocals : thread->GetVarPtr());
if(nParams)
std::copy(arguments, arguments_end, thread->IsMission() ? missionLocals : thread->GetVarPtr());

// jump to label
ThreadJump(thread, label);
Expand Down Expand Up @@ -1699,8 +1702,8 @@ namespace CLEO
{
DWORD hVehicle;
*thread >> hVehicle;
auto id = reinterpret_cast<CVehicleModelInfo*>(Models[GetVehiclePool().AtHandle(hVehicle)->m_wModelIndex - 400])->m_wHandlingIndex;
*thread << Handling->m_aVehicleHandling[id].m_transmissionData.m_nNumberOfGears;
auto id = reinterpret_cast<CVehicleModelInfo*>(Models[GetVehiclePool().AtHandle(hVehicle)->m_wModelIndex])->m_wHandlingIndex;
*thread << Handling->Automobile[id].m_Transmission.ucNumberOfGears;
return OR_CONTINUE;
}

Expand Down Expand Up @@ -2441,7 +2444,9 @@ namespace CLEO
//0AE9=0,pop_float
OpcodeResult __stdcall opcode_0AE9(CRunningScript *thread)
{
_asm fstp opcodeParams[0].fParam
float result;
_asm fstp result
opcodeParams[0].fParam = result;
SetScriptParams(thread, 1);
return OR_CONTINUE;
}
Expand Down Expand Up @@ -2481,8 +2486,10 @@ namespace CLEO
char *format, *result;
*thread >> val;
format = readString(thread);
if (*thread->GetBytePointer() >= 1 && *thread->GetBytePointer() <= 8) *thread >> result;
else result = &GetScriptParamPointer(thread)->cParam;
if (*thread->GetBytePointer() >= 1 && *thread->GetBytePointer() <= 8)
*thread >> result;
else
result = &GetScriptParamPointer(thread)->cParam;
sprintf(result, format, val);
return OR_CONTINUE;
}
Expand Down Expand Up @@ -2670,4 +2677,4 @@ extern "C"
{
return GetScriptParamPointer(thread);
}
}
}
2 changes: 1 addition & 1 deletion CCustomOpcodeSystem.h → CLEO4/CCustomOpcodeSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace CLEO
friend OpcodeResult __stdcall opcode_0AE6(CRunningScript *pScript);
friend OpcodeResult __stdcall opcode_0AE8(CRunningScript *pScript);

public:
std::set<DWORD> m_hFiles;
std::set<HMODULE> m_hNativeLibs;
std::set<HANDLE> m_hFileSearches;
std::set<void *> m_pAllocations;

public:
void FinalizeScriptObjects()
{
// clean up after opcode_0A99
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added CLEO4/CLEO.APS
Binary file not shown.
Binary file renamed CLEO.rc → CLEO4/CLEO.rc
Binary file not shown.
35 changes: 12 additions & 23 deletions CLEO4.vcxproj → CLEO4/CLEO4.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="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="CRTDebug|Win32">
<Configuration>CRTDebug</Configuration>
Expand All @@ -25,21 +25,18 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v100</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CRTDebug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -55,30 +52,20 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<LinkIncremental>true</LinkIncremental>
<TargetExt>.asi</TargetExt>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.asi</TargetExt>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CRTDebug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.asi</TargetExt>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;CLEO4_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\GTASA;..\..\GTASA\rwsdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand All @@ -104,7 +91,7 @@ COPY "$(TargetPath)" "$(LocalDebuggerWorkingDirectory)\$(ProjectName).pdb" /Y</C
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;CLEO4_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\GTASA;..\GTASA\rwsdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\GTASA;..\..\GTASA\rwsdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
</ClCompile>
Expand All @@ -116,7 +103,6 @@ COPY "$(TargetPath)" "$(LocalDebuggerWorkingDirectory)\$(ProjectName).pdb" /Y</C
<ModuleDefinitionFile>cleo.def</ModuleDefinitionFile>
<Version>4.3</Version>
<EnableUAC>false</EnableUAC>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>COPY "$(TargetPath)" "$(LocalDebuggerWorkingDirectory)\$(TargetFileName)" /Y
Expand Down Expand Up @@ -200,17 +186,20 @@ COPY "$(TargetPath)" "$(LocalDebuggerWorkingDirectory)\$(ProjectName).pdb" /Y</C
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\GTASA\GTASA.vcxproj">
<Project>{32fcf424-d919-4f50-a4fc-177cf89b4a6d}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Library Include="bass\bass.lib" />
</ItemGroup>
<ItemGroup>
<None Include="CHANGELOG.txt" />
<None Include="cleo.def" />
<ResourceCompile Include="CLEO.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GTASA\GTASA.vcxproj">
<Project>{32fcf424-d919-4f50-a4fc-177cf89b4a6d}</Project>
</ProjectReference>
<None Include="CHANGELOG.txt" />
<None Include="cleo.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
Loading

0 comments on commit 3aa368b

Please sign in to comment.