From 6729e5eadd70cf414c7129f32fe5a14532f5f399 Mon Sep 17 00:00:00 2001 From: Matthew McConnell Date: Tue, 21 Feb 2017 13:49:23 +0000 Subject: [PATCH] 64 bit update 64 bit update with a few addition logging output --- build.bat | 13 +++--- ...xileServer_system_lootManager_dropItem.sqf | 4 +- src/ExileLootDrop.sln | 30 +++++++++----- src/ExileLootDrop/DllEntry.cs | 25 ++++++++++-- src/ExileLootDrop/ExileLootDrop.csproj | 36 +++++++++++++++++ src/ExileLootDrop/Loot.cs | 3 +- .../ExileLootDropTester.csproj | 40 +++++++++++++++++++ 7 files changed, 129 insertions(+), 22 deletions(-) diff --git a/build.bat b/build.bat index c2f86a7..d7aa39d 100644 --- a/build.bat +++ b/build.bat @@ -4,11 +4,14 @@ set MAKEPBO="C:\Program Files (x86)\Mikero\DePboTools\bin\MakePbo.exe" rd /s /q @ExileLootDrop mkdir @ExileLootDrop\addons -%MSBUILD% src\ExileLootDrop.sln /property:Configuration=release /target:Rebuild /verbosity:normal /nologo -copy src\ExileLootDrop\bin\Release\ExileLootDrop.dll @ExileLootDrop -copy src\ExileLootDrop\bin\Release\ExileLootDrop.cfg @ExileLootDrop -copy src\ExileLootDrop\bin\Release\ExileLootDrop.ini @ExileLootDrop -copy src\ExileLootDropTester\bin\Release\ExileLootDropTester.exe @ExileLootDrop +%MSBUILD% src\ExileLootDrop.sln /property:Configuration=release /property:Platform=x86 /target:Rebuild /verbosity:normal /nologo +copy src\ExileLootDrop\bin\x86\Release\ExileLootDrop.dll @ExileLootDrop\ExileLootDrop.dll +copy src\ExileLootDropTester\bin\x86\Release\ExileLootDropTester.exe @ExileLootDrop + +%MSBUILD% src\ExileLootDrop.sln /property:Configuration=release /property:Platform=x64 /target:Rebuild /verbosity:normal /nologo +copy src\ExileLootDrop\bin\x64\Release\ExileLootDrop.dll @ExileLootDrop\ExileLootDrop_x64.dll +copy src\ExileLootDrop\bin\x64\Release\ExileLootDrop.cfg @ExileLootDrop +copy src\ExileLootDrop\bin\x64\Release\ExileLootDrop.ini @ExileLootDrop copy LICENSE.txt @ExileLootDrop copy README.md @ExileLootDrop diff --git a/sqf/ExileServer_system_lootManager_dropItem.sqf b/sqf/ExileServer_system_lootManager_dropItem.sqf index d63b251..fda6f16 100644 --- a/sqf/ExileServer_system_lootManager_dropItem.sqf +++ b/sqf/ExileServer_system_lootManager_dropItem.sqf @@ -27,8 +27,8 @@ _input params [ ]; private _packet = format['%1|%2', _table, _amount]; private _response = 'ExileLootDrop' callExtension _packet; -if (_response == 'ERROR') exitWith { - diag_log format['ExileLootDrop: Extension return error. Check logs! - %1', _packet]; +if ((_response select [0, 5]) == 'ERROR') exitWith { + diag_log format['ExileLootDrop: Extension return error. Check logs! - %1 - %2', _packet, _response]; "" }; private _return = if (_amount > 1) then { diff --git a/src/ExileLootDrop.sln b/src/ExileLootDrop.sln index 0063550..791af84 100644 --- a/src/ExileLootDrop.sln +++ b/src/ExileLootDrop.sln @@ -9,18 +9,28 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExileLootDropTester", "Exil EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Release|Any CPU.Build.0 = Release|Any CPU - {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Release|Any CPU.Build.0 = Release|Any CPU + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Debug|x64.ActiveCfg = Release|x86 + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Debug|x64.Build.0 = Release|x86 + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Debug|x86.ActiveCfg = Debug|x86 + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Debug|x86.Build.0 = Debug|x86 + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Release|x64.ActiveCfg = Release|x64 + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Release|x64.Build.0 = Release|x64 + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Release|x86.ActiveCfg = Release|x86 + {F3DEC0AD-F490-4761-84A5-E51240FA3D91}.Release|x86.Build.0 = Release|x86 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Debug|x64.ActiveCfg = Release|x86 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Debug|x64.Build.0 = Release|x86 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Debug|x86.ActiveCfg = Debug|x86 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Debug|x86.Build.0 = Debug|x86 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Release|x64.ActiveCfg = Release|x64 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Release|x64.Build.0 = Release|x64 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Release|x86.ActiveCfg = Release|x86 + {D4C0452C-055B-4773-920B-D9C7A70EB9D6}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ExileLootDrop/DllEntry.cs b/src/ExileLootDrop/DllEntry.cs index 2834890..ffb1f26 100644 --- a/src/ExileLootDrop/DllEntry.cs +++ b/src/ExileLootDrop/DllEntry.cs @@ -11,10 +11,10 @@ namespace ExileLootDrop public class DllEntry { /// - /// Entry point method for ARMA + /// Entry point method for ARMA 32 bit /// [DllExport("_RVExtension@12", CallingConvention = CallingConvention.Winapi)] - public static void RvExtension(StringBuilder output, int outputSize, [MarshalAs(UnmanagedType.LPStr)] string function) + public static void RvExtension32(StringBuilder output, int outputSize, [MarshalAs(UnmanagedType.LPStr)] string function) { try { @@ -24,8 +24,25 @@ namespace ExileLootDrop { Logger.Log(Logger.Level.Error, "Uncaught Exception!"); Logger.Log(ex); - output.Append("ERROR"); - } + output.Append($"ERROR - {function} - {ex.Message}"); + } + } + /// + /// Entry point method for ARMA 64 bit + /// + [DllExport("RVExtension", CallingConvention = CallingConvention.Winapi)] + public static void RvExtension64(StringBuilder output, int outputSize, [MarshalAs(UnmanagedType.LPStr)] string function) + { + try + { + output.Append(Loot.Invoke(function)); + } + catch (Exception ex) + { + Logger.Log(Logger.Level.Error, "Uncaught Exception!"); + Logger.Log(ex); + output.Append($"ERROR - {function} - {ex.Message}"); + } } } } diff --git a/src/ExileLootDrop/ExileLootDrop.csproj b/src/ExileLootDrop/ExileLootDrop.csproj index 1286c06..b4f9bfe 100644 --- a/src/ExileLootDrop/ExileLootDrop.csproj +++ b/src/ExileLootDrop/ExileLootDrop.csproj @@ -31,6 +31,42 @@ 4 x86 + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + ..\packages\UnmanagedExports.1.2.7\lib\net\RGiesecke.DllExport.Metadata.dll diff --git a/src/ExileLootDrop/Loot.cs b/src/ExileLootDrop/Loot.cs index 35b19f3..89c2383 100644 --- a/src/ExileLootDrop/Loot.cs +++ b/src/ExileLootDrop/Loot.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Text.RegularExpressions; namespace ExileLootDrop { @@ -64,7 +65,7 @@ namespace ExileLootDrop { var assembly = Assembly.GetExecutingAssembly(); var assemblyName = Path.GetFileNameWithoutExtension(assembly.Location); - var iniPath = Path.Combine(BasePath, $"{assemblyName}.ini"); + var iniPath = Path.Combine(BasePath, $"{Regex.Replace(assemblyName, @"_x64$", string.Empty)}.ini"); if (!File.Exists(iniPath)) throw new LootException($"{assemblyName}.ini was not found"); diff --git a/src/ExileLootDropTester/ExileLootDropTester.csproj b/src/ExileLootDropTester/ExileLootDropTester.csproj index 6372319..4e832e8 100644 --- a/src/ExileLootDropTester/ExileLootDropTester.csproj +++ b/src/ExileLootDropTester/ExileLootDropTester.csproj @@ -32,6 +32,46 @@ prompt 4 + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true +