Skip to content

Commit

Permalink
Merge branch 'master' into fix_testing
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats authored Apr 22, 2024
2 parents 9dc614b + 1f0b616 commit 37b616d
Show file tree
Hide file tree
Showing 2,550 changed files with 34,876 additions and 1,092,861 deletions.
15 changes: 13 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static,readonly
dotnet_separate_import_directive_groups = true
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
Expand Down Expand Up @@ -97,22 +98,32 @@ resharper_apply_on_completion = true
resharper_auto_property_can_be_made_get_only_global_highlighting = none
resharper_auto_property_can_be_made_get_only_local_highlighting = none
resharper_autodetect_indent_settings = true
resharper_blank_lines_around_single_line_auto_property = 1
resharper_braces_for_ifelse = required_for_multiline
resharper_can_use_global_alias = false
resharper_csharp_align_multiline_parameter = true
resharper_csharp_align_multiple_declaration = true
resharper_csharp_empty_block_style = multiline
resharper_csharp_int_align_comments = true
resharper_csharp_int_align_comments = false
resharper_csharp_new_line_before_while = true
resharper_csharp_wrap_after_declaration_lpar = true
resharper_csharp_wrap_after_invocation_lpar = true
resharper_csharp_wrap_arguments_style = chop_if_long
resharper_enforce_line_ending_style = true
resharper_instance_members_qualify_declared_in = this_class, base_class
resharper_int_align = false
resharper_member_can_be_private_global_highlighting = none
resharper_member_can_be_private_local_highlighting = none
resharper_new_line_before_finally = false
resharper_new_line_before_finally = true
resharper_parentheses_non_obvious_operations = none, multiplicative, additive, arithmetic, shift, bitwise_and, bitwise_exclusive_or, bitwise_inclusive_or, bitwise
resharper_parentheses_redundancy_style = remove_if_not_clarifies_precedence
resharper_place_accessorholder_attribute_on_same_line = false
resharper_place_field_attribute_on_same_line = false
resharper_place_simple_initializer_on_single_line = true
resharper_show_autodetect_configure_formatting_tip = false
resharper_space_within_single_line_array_initializer_braces = true
resharper_use_indent_from_vs = false
resharper_wrap_array_initializer_style = chop_if_long

# ReSharper inspection severities
resharper_arrange_missing_parentheses_highlighting = hint
Expand Down
46 changes: 45 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
fetch-depth: 0
- name: Setup MSBuild
uses: microsoft/[email protected]
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100'
- name: Define VERSION
run: |
$env:COMMIT = $env:GITHUB_SHA.Substring(0, 7)
Expand All @@ -42,7 +45,48 @@ jobs:
with:
name: dalamud-artifact
path: bin\Release


check_api_compat:
name: "Check API Compatibility"
if: ${{ github.event_name == 'pull_request' }}
needs: build
runs-on: windows-latest
steps:
- name: "Install .NET SDK"
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7
- name: "Install ApiCompat"
run: |
dotnet tool install -g Microsoft.DotNet.ApiCompat.Tool
- name: "Download Proposed Artifacts"
uses: actions/download-artifact@v2
with:
name: dalamud-artifact
path: .\right
- name: "Download Live (Stg) Artifacts"
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "left"
- name: "Verify Compatibility"
run: |
$FILES_TO_VALIDATE = "Dalamud.dll","FFXIVClientStructs.dll","Lumina.dll","Lumina.Excel.dll"
$retcode = 0
foreach ($file in $FILES_TO_VALIDATE) {
$testout = ""
Write-Output "::group::=== API COMPATIBILITY CHECK: ${file} ==="
apicompat -l "left\${file}" -r "right\${file}" | Tee-Object -Variable testout
Write-Output "::endgroup::"
if ($testout -ne "APICompat ran successfully without finding any breaking changes.") {
Write-Output "::error::${file} did not pass. Please review it for problems."
$retcode = 1
}
}
exit $retcode
deploy_stg:
name: Deploy dalamud-distrib staging
if: ${{ github.repository_owner == 'goatcorp' && github.event_name == 'push' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rollup.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Rollup changes to next version
on:
# push:
# branches:
# - master
push:
branches:
- master
workflow_dispatch:

jobs:
Expand All @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
branches:
- v9
- new_im_hooks

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
url = https://github.com/goatcorp/ImGuiScene
[submodule "lib/FFXIVClientStructs"]
path = lib/FFXIVClientStructs
url = https://github.com/aers/FFXIVClientStructs.git
url = https://github.com/aers/FFXIVClientStructs
[submodule "lib/Nomade040-nmd"]
path = lib/Nomade040-nmd
url = https://github.com/Nomade040/nmd.git
Expand Down
20 changes: 18 additions & 2 deletions Dalamud.Boot/Dalamud.Boot.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<IntDir>obj\$(Configuration)\</IntDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<UseDebugLibraries>true</UseDebugLibraries>
<LibraryPath>$(SolutionDir)bin\lib\$(Configuration)\libMinHook\;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
Expand All @@ -55,7 +58,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>Version.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\lib\CoreCLR;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
Expand All @@ -70,6 +73,7 @@
<Link>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
<ModuleDefinitionFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">module.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
Expand All @@ -83,9 +87,13 @@
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">module.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
<ItemGroup>
<Content Include="..\lib\CoreCLR\nethost\nethost.dll">
<Link>nethost.dll</Link>
Expand Down Expand Up @@ -129,6 +137,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ntdll.cpp" />
<ClCompile Include="unicode.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
Expand Down Expand Up @@ -168,6 +177,7 @@
<ClInclude Include="DalamudStartInfo.h" />
<ClInclude Include="hooks.h" />
<ClInclude Include="logging.h" />
<ClInclude Include="ntdll.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="unicode.h" />
<ClInclude Include="utils.h" />
Expand All @@ -181,8 +191,14 @@
<ItemGroup>
<Image Include="dalamud.ico" />
</ItemGroup>
<ItemGroup>
<MASM Include="rewrite_entrypoint_thunks.asm" />
</ItemGroup>
<ItemGroup>
<None Include="module.def" />
</ItemGroup>
<Target Name="RemoveExtraFiles" AfterTargets="PostBuildEvent">
<Delete Files="$(OutDir)$(TargetName).lib" />
<Delete Files="$(OutDir)$(TargetName).exp" />
</Target>
</Project>
</Project>
16 changes: 16 additions & 0 deletions Dalamud.Boot/Dalamud.Boot.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<ClCompile Include="DalamudStartInfo.cpp">
<Filter>Dalamud.Boot DLL</Filter>
</ClCompile>
<ClCompile Include="ntdll.cpp">
<Filter>Dalamud.Boot DLL</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\lib\CoreCLR\CoreCLR.h">
Expand Down Expand Up @@ -140,11 +143,24 @@
</ClInclude>
<ClInclude Include="resource.h" />
<ClInclude Include="crashhandler_shared.h" />
<ClInclude Include="ntdll.h">
<Filter>Dalamud.Boot DLL</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Dalamud.Boot.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="dalamud.ico" />
</ItemGroup>
<ItemGroup>
<MASM Include="rewrite_entrypoint_thunks.asm">
<Filter>Dalamud.Boot DLL</Filter>
</MASM>
</ItemGroup>
<ItemGroup>
<None Include="module.def">
<Filter>Dalamud.Boot DLL</Filter>
</None>
</ItemGroup>
</Project>
23 changes: 21 additions & 2 deletions Dalamud.Boot/DalamudStartInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,37 @@ void from_json(const nlohmann::json& json, DalamudStartInfo::ClientLanguage& val
}
}

void from_json(const nlohmann::json& json, DalamudStartInfo::LoadMethod& value) {
if (json.is_number_integer()) {
value = static_cast<DalamudStartInfo::LoadMethod>(json.get<int>());

}
else if (json.is_string()) {
const auto langstr = unicode::convert<std::string>(json.get<std::string>(), &unicode::lower);
if (langstr == "entrypoint")
value = DalamudStartInfo::LoadMethod::Entrypoint;
else if (langstr == "inject")
value = DalamudStartInfo::LoadMethod::DllInject;
}
}

void from_json(const nlohmann::json& json, DalamudStartInfo& config) {
if (!json.is_object())
return;

config.DalamudLoadMethod = json.value("LoadMethod", config.DalamudLoadMethod);
config.WorkingDirectory = json.value("WorkingDirectory", config.WorkingDirectory);
config.ConfigurationPath = json.value("ConfigurationPath", config.ConfigurationPath);
config.LogPath = json.value("LogPath", config.LogPath);
config.LogName = json.value("LogName", config.LogName);
config.PluginDirectory = json.value("PluginDirectory", config.PluginDirectory);
config.DefaultPluginDirectory = json.value("DefaultPluginDirectory", config.DefaultPluginDirectory);
config.AssetDirectory = json.value("AssetDirectory", config.AssetDirectory);
config.Language = json.value("Language", config.Language);
config.GameVersion = json.value("GameVersion", config.GameVersion);
config.DelayInitializeMs = json.value("DelayInitializeMs", config.DelayInitializeMs);
config.TroubleshootingPackData = json.value("TroubleshootingPackData", std::string{});
config.DelayInitializeMs = json.value("DelayInitializeMs", config.DelayInitializeMs);
config.NoLoadPlugins = json.value("NoLoadPlugins", config.NoLoadPlugins);
config.NoLoadThirdPartyPlugins = json.value("NoLoadThirdPartyPlugins", config.NoLoadThirdPartyPlugins);

config.BootLogPath = json.value("BootLogPath", config.BootLogPath);
config.BootShowConsole = json.value("BootShowConsole", config.BootShowConsole);
Expand All @@ -103,6 +121,7 @@ void from_json(const nlohmann::json& json, DalamudStartInfo& config) {
}

config.CrashHandlerShow = json.value("CrashHandlerShow", config.CrashHandlerShow);
config.NoExceptionHandlers = json.value("NoExceptionHandlers", config.NoExceptionHandlers);
}

void DalamudStartInfo::from_envvars() {
Expand Down
15 changes: 13 additions & 2 deletions Dalamud.Boot/DalamudStartInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,25 @@ struct DalamudStartInfo {
};
friend void from_json(const nlohmann::json&, ClientLanguage&);

enum class LoadMethod : int {
Entrypoint,
DllInject,
};
friend void from_json(const nlohmann::json&, LoadMethod&);

LoadMethod DalamudLoadMethod = LoadMethod::Entrypoint;
std::string WorkingDirectory;
std::string ConfigurationPath;
std::string LogPath;
std::string LogName;
std::string PluginDirectory;
std::string DefaultPluginDirectory;
std::string AssetDirectory;
ClientLanguage Language = ClientLanguage::English;
std::string GameVersion;
int DelayInitializeMs = 0;
std::string TroubleshootingPackData;
int DelayInitializeMs = 0;
bool NoLoadPlugins;
bool NoLoadThirdPartyPlugins;

std::string BootLogPath;
bool BootShowConsole = false;
Expand All @@ -49,6 +59,7 @@ struct DalamudStartInfo {
std::set<std::string> BootUnhookDlls{};

bool CrashHandlerShow = false;
bool NoExceptionHandlers = false;

friend void from_json(const nlohmann::json&, DalamudStartInfo&);
void from_envvars();
Expand Down
1 change: 1 addition & 0 deletions Dalamud.Boot/crashhandler_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct exception_info
CONTEXT ContextRecord;
uint64_t nLifetime;
HANDLE hThreadHandle;
HANDLE hEventHandle;
DWORD dwStackTraceLength;
DWORD dwTroubleshootingPackDataLength;
};
14 changes: 7 additions & 7 deletions Dalamud.Boot/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
HMODULE g_hModule;
HINSTANCE g_hGameInstance = GetModuleHandleW(nullptr);

DWORD WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
HRESULT WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
g_startInfo.from_envvars();

std::string jsonParseError;
Expand Down Expand Up @@ -114,7 +114,7 @@ DWORD WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
logging::I("Calling InitializeClrAndGetEntryPoint");

void* entrypoint_vfn;
int result = InitializeClrAndGetEntryPoint(
const auto result = InitializeClrAndGetEntryPoint(
g_hModule,
g_startInfo.BootEnableEtw,
runtimeconfig_path,
Expand All @@ -124,7 +124,7 @@ DWORD WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
L"Dalamud.EntryPoint+InitDelegate, Dalamud",
&entrypoint_vfn);

if (result != 0)
if (FAILED(result))
return result;

using custom_component_entry_point_fn = void (CORECLR_DELEGATE_CALLTYPE*)(LPVOID, HANDLE);
Expand All @@ -133,8 +133,8 @@ DWORD WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
// ============================== VEH ======================================== //

logging::I("Initializing VEH...");
if (utils::is_running_on_wine()) {
logging::I("=> VEH was disabled, running on wine");
if (g_startInfo.NoExceptionHandlers) {
logging::W("=> Exception handlers are disabled from DalamudStartInfo.");
} else if (g_startInfo.BootVehEnabled) {
if (veh::add_handler(g_startInfo.BootVehFull, g_startInfo.WorkingDirectory))
logging::I("=> Done!");
Expand All @@ -156,10 +156,10 @@ DWORD WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
entrypoint_fn(lpParam, hMainThreadContinue);
logging::I("Done!");

return 0;
return S_OK;
}

DllExport DWORD WINAPI Initialize(LPVOID lpParam) {
extern "C" DWORD WINAPI Initialize(LPVOID lpParam) {
return InitializeImpl(lpParam, CreateEvent(nullptr, TRUE, FALSE, nullptr));
}

Expand Down
Loading

0 comments on commit 37b616d

Please sign in to comment.