Skip to content

Commit

Permalink
Merge pull request #252 from vapopescu/feature_fix_dll_injection
Browse files Browse the repository at this point in the history
Fix DLL injection
  • Loading branch information
34736384 authored Dec 16, 2023
2 parents db7bf00 + 0915e23 commit 25581ef
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,7 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

# Program files
fps_config.json
6 changes: 0 additions & 6 deletions unlockfps_clr.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Debug|x64.ActiveCfg = Debug|x64
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Debug|x64.Build.0 = Debug|x64
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Debug|x86.ActiveCfg = Debug|Win32
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Debug|x86.Build.0 = Debug|Win32
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Release|x64.ActiveCfg = Release|x64
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Release|x64.Build.0 = Release|x64
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Release|x86.ActiveCfg = Release|Win32
{A44A2C76-9D37-4D59-9020-AE1A0006C3A1}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 0 additions & 2 deletions unlockfps_clr/MainForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ namespace unlockfpsclr
if (!Unmanaged::SetupData())
continue;

Managed::InjectDLLs(settings->DllList);

while (!worker->CancellationPending)
{
Unmanaged::ApplyFPS(settings->FPSTarget, settings->UsePowerSave);
Expand Down
9 changes: 9 additions & 0 deletions unlockfps_clr/Managed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,14 @@ bool Managed::StartGame(Settings^ settings)
Marshal::FreeHGlobal(static_cast<IntPtr>(nativeCommandLine));
Marshal::FreeHGlobal(static_cast<IntPtr>(nativeGamePath));

// Wait for a process with the target name to spawn
while (!(Unmanaged::GetPID("GenshinImpact.exe") || Unmanaged::GetPID("YuanShen.exe")))
{
Sleep(1);
}

// Inject DLLs right after launch
Managed::InjectDLLs(settings->DllList);

return result;
}
4 changes: 2 additions & 2 deletions unlockfps_clr/unlockfps_clr.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<BufferSecurityCheck>false</BufferSecurityCheck>
Expand All @@ -108,7 +108,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<BufferSecurityCheck>false</BufferSecurityCheck>
Expand Down

0 comments on commit 25581ef

Please sign in to comment.