Skip to content

Commit

Permalink
Introduced CLEO5 Mod Loader plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDMC committed Jun 7, 2024
1 parent e8c6e53 commit 2d4acea
Show file tree
Hide file tree
Showing 24 changed files with 1,492 additions and 165 deletions.
3 changes: 3 additions & 0 deletions CLEO5.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
<ClCompile Include="source\CGameMenu.cpp" />
<ClCompile Include="source\CGameVersionManager.cpp" />
<ClCompile Include="source\CleoBase.cpp" />
<ClCompile Include="source\CModLoaderSystem.cpp" />
<ClCompile Include="source\CModuleSystem.cpp" />
<ClCompile Include="source\CPluginSystem.cpp" />
<ClCompile Include="source\crc32.cpp" />
<ClCompile Include="source\CScriptEngine.cpp" />
<ClCompile Include="source\dllmain.cpp" />
Expand Down Expand Up @@ -82,6 +84,7 @@
<ClInclude Include="source\CGameMenu.h" />
<ClInclude Include="source\CGameVersionManager.h" />
<ClInclude Include="source\CleoBase.h" />
<ClInclude Include="source\CModLoaderSystem.h" />
<ClInclude Include="source\CModuleSystem.h" />
<ClInclude Include="source\CPluginSystem.h" />
<ClInclude Include="source\crc32.h" />
Expand Down
27 changes: 15 additions & 12 deletions CLEO5.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@
<ClCompile Include="source\CScriptEngine.cpp">
<Filter>source\core</Filter>
</ClCompile>
<ClCompile Include="source\CSoundSystem.cpp">
<Filter>source\extensions</Filter>
</ClCompile>
<ClCompile Include="source\CTextManager.cpp">
<Filter>source\game_sa</Filter>
</ClCompile>
<ClCompile Include="source\CDebug.cpp">
<Filter>source\utils</Filter>
</ClCompile>
Expand All @@ -108,6 +102,18 @@
<ClCompile Include="$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\CTheScripts.cpp">
<Filter>plugin_sdk</Filter>
</ClCompile>
<ClCompile Include="source\CModLoaderSystem.cpp">
<Filter>source\extensions</Filter>
</ClCompile>
<ClCompile Include="source\CPluginSystem.cpp">
<Filter>source\extensions</Filter>
</ClCompile>
<ClCompile Include="$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\CModelInfo.cpp">
<Filter>plugin_sdk</Filter>
</ClCompile>
<ClCompile Include="$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\CCheat.cpp">
<Filter>plugin_sdk</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\stdafx.h">
Expand Down Expand Up @@ -149,12 +155,6 @@
<ClInclude Include="source\CScriptEngine.h">
<Filter>source\core</Filter>
</ClInclude>
<ClInclude Include="source\CSoundSystem.h">
<Filter>source\extensions</Filter>
</ClInclude>
<ClInclude Include="source\CTextManager.h">
<Filter>source\game_sa</Filter>
</ClInclude>
<ClInclude Include="source\CDebug.h">
<Filter>source\utils</Filter>
</ClInclude>
Expand All @@ -176,6 +176,9 @@
<ClInclude Include="source\OpcodeInfoDatabase.h">
<Filter>source\utils</Filter>
</ClInclude>
<ClInclude Include="source\CModLoaderSystem.h">
<Filter>source\extensions</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="source\cleo.def">
Expand Down
8 changes: 4 additions & 4 deletions cleo_plugins/Text/CTextManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ namespace CLEO
{
try
{
std::ifstream stream(list.paths[i]);
std::ifstream stream(list.strings[i]);
auto result = ParseFxtFile(stream);
TRACE("Added %d new FXT entries from file %s", result, list.paths[i]);
TRACE("Added %d new FXT entries from file %s", result, list.strings[i]);
}
catch (std::exception& ex)
{
LOG_WARNING(0, "Loading of FXT file '%s' failed: \n%s", list.paths[i], ex.what());
LOG_WARNING(0, "Loading of FXT file '%s' failed: \n%s", list.strings[i], ex.what());
}
}
CLEO::CLEO_ListDirectoryFree(list);
CLEO::CLEO_StringListFree(list);
}

void CTextManager::Clear()
Expand Down
7 changes: 4 additions & 3 deletions cleo_sdk/CLEO.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,12 @@ DWORD WINAPI CLEO_GetScriptTextureById(CRunningScript* thread, int id); // ret R

DWORD WINAPI CLEO_GetInternalAudioStream(CRunningScript* thread, DWORD stream); // arg CAudioStream *

struct StringList { DWORD count; char** strings; };
void WINAPI CLEO_StringListFree(StringList list); // releases resources used by StringList container

// Should be always used when working with files. Provides ModLoader compatibility
void WINAPI CLEO_ResolvePath(CRunningScript* thread, char* inOutPath, DWORD pathMaxLen); // convert to absolute (file system) path
struct DirectoryList{ DWORD count; char** paths; };
DirectoryList WINAPI CLEO_ListDirectory(CRunningScript* thread, const char* path, const char* filePattern = nullptr, BOOL listDirs = TRUE, BOOL listFiles = TRUE); // thread can be null, filePattern can contain single '*' wildcard. After use CLEO_ListDirectoryFree must be called on returned DirectoryList to free allocated resources
void WINAPI CLEO_ListDirectoryFree(DirectoryList list); // releases resources allocated by CLEO_ListDirectory
StringList WINAPI CLEO_ListDirectory(CRunningScript* thread, const char* path, const char* filePattern = nullptr, BOOL listDirs = TRUE, BOOL listFiles = TRUE); // thread can be null, filePattern can contain single '*' wildcard. After use CLEO_ListDirectoryFree must be called on returned DirectoryList to free allocated resources

void WINAPI CLEO_Log(eLogLevel level, const char* msg); // add message to log

Expand Down
25 changes: 25 additions & 0 deletions modloader_plugin/CLEO_ModLoader_Plugin.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CLEO_ModLoader_Plugin", "CLEO_ModLoader_Plugin.vcxproj", "{E04BB51D-A37D-491E-BAA0-D95D0D5C1563}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E04BB51D-A37D-491E-BAA0-D95D0D5C1563}.Debug|x86.ActiveCfg = Debug|Win32
{E04BB51D-A37D-491E-BAA0-D95D0D5C1563}.Debug|x86.Build.0 = Debug|Win32
{E04BB51D-A37D-491E-BAA0-D95D0D5C1563}.Release|x86.ActiveCfg = Release|Win32
{E04BB51D-A37D-491E-BAA0-D95D0D5C1563}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {27E214E3-AE89-40E1-9B76-0C5C9DB3452C}
EndGlobalSection
EndGlobal
189 changes: 189 additions & 0 deletions modloader_plugin/CLEO_ModLoader_Plugin.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="source\CLEO_ModLoader_Provider.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="source\main.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\cleo_sdk\CLEO.h" />
<ClInclude Include="source\CLEO_ModLoader_Provider.h" />
<ClInclude Include="source\modloader\modloader.h" />
<ClInclude Include="source\modloader\modloader.hpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{e04bb51d-a37d-491e-baa0-d95d0d5c1563}</ProjectGuid>
<RootNamespace>modloaderplugin</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>CLEO_CLEO_ModLoader_Plugin</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(ProjectDir)source\;$(IncludePath)</IncludePath>
<TargetName>CLEO5_Provider</TargetName>
<OutDir>$(SolutionDir).output\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir).output\.obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(ProjectDir)source\;$(IncludePath)</IncludePath>
<TargetName>CLEO5_Provider</TargetName>
<OutDir>$(SolutionDir).output\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir).output\.obj\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;MODLOADERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PostBuildEvent>
<Command>if defined GTA_SA_DIR (
taskkill /IM gta_sa.exe /F /FI "STATUS eq RUNNING"
xcopy /Y "$(OutDir)$(TargetName).dll" "$(GTA_SA_DIR)\modloader\.data\plugins\"
xcopy /Y "$(OutDir)$(TargetName).pdb" "$(GTA_SA_DIR)\modloader\.data\plugins\"
)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;MODLOADERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PostBuildEvent>
<Command>if defined GTA_SA_DIR (
taskkill /IM gta_sa.exe /F /FI "STATUS eq RUNNING"
xcopy /Y "$(OutDir)$(TargetName).dll" "$(GTA_SA_DIR)\modloader\.data\plugins\"
xcopy /Y "$(OutDir)$(TargetName).pdb" "$(GTA_SA_DIR)\modloader\.data\plugins\"
)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;MODLOADERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;MODLOADERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
27 changes: 27 additions & 0 deletions modloader_plugin/CLEO_ModLoader_Plugin.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="source\CLEO_ModLoader_Provider.cpp" />
<ClCompile Include="source\main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\CLEO_ModLoader_Provider.h" />
<ClInclude Include="source\modloader\modloader.h">
<Filter>modloader</Filter>
</ClInclude>
<ClInclude Include="source\modloader\modloader.hpp">
<Filter>modloader</Filter>
</ClInclude>
<ClInclude Include="..\cleo_sdk\CLEO.h">
<Filter>cleo_sdk</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="modloader">
<UniqueIdentifier>{e1cecf56-63d9-4199-abc0-3bc243c35ae5}</UniqueIdentifier>
</Filter>
<Filter Include="cleo_sdk">
<UniqueIdentifier>{a91999b6-8f46-4d7d-bfde-64d0090de057}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
Loading

0 comments on commit 2d4acea

Please sign in to comment.