Skip to content

Commit

Permalink
Merge pull request #595 from RinLovesYou/alpha-development
Browse files Browse the repository at this point in the history
Fix missing Close Button icalls
  • Loading branch information
RinLovesYou authored Dec 29, 2023
2 parents c00d487 + b646041 commit 1d4f38f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
16 changes: 13 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 7 additions & 14 deletions MelonLoader/BootstrapInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,7 @@ internal static void SetDefaultConsoleTitleWithGameName([MarshalAs(UnmanagedType

Console.Title = versionStr;
}

#if !NET6_0
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void EnableCloseButton(IntPtr mainWindow);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void DisableCloseButton(IntPtr mainWindow);

[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void NativeHookAttach(IntPtr target, IntPtr detour);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void NativeHookDetach(IntPtr target, IntPtr detour);
#else


private const int MF_BYCOMMAND = 0x00000000;

private const int MF_ENABLED = 0x00000000;
Expand All @@ -63,7 +51,12 @@ public static void DisableCloseButton(IntPtr mainWindow)
EnableMenuItem(GetSystemMenu(mainWindow, 0), SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
}


#if !NET6_0
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void NativeHookAttach(IntPtr target, IntPtr detour);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void NativeHookDetach(IntPtr target, IntPtr detour);
#else
public static void NativeHookAttach(IntPtr target, IntPtr detour)
{
//SanityCheckDetour is able to wrap and fix the bad method in a delegate where possible, so we pass the detour by ref.
Expand Down
2 changes: 1 addition & 1 deletion Proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ctor = "0.1.26"
ctor = "0.2.6"
msgbox = "0.7.0"
lazy_static = "1.4.0"
thiserror = "*"
Expand Down

0 comments on commit 1d4f38f

Please sign in to comment.