Skip to content

Commit 0bafb93

Browse files
committed
Move plthook extensions to the library
1 parent a5ef8e5 commit 0bafb93

3 files changed

Lines changed: 4 additions & 67 deletions

File tree

build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
.dependencies = .{
1111
.plthook = .{
12-
.url = "git+https://github.com/mpfaff/plthook.git#cb4878d2f044b4f186722fcf6a56cfe05c59625c",
13-
.hash = "plthook-0.0.0-91TxxbqTAQAstLurLpV4xMjVWpGrapoCs3bh_zNt6VQa",
12+
.url = "git+https://github.com/mpfaff/plthook.git#e0921e4ccf1b44df0e7528466332d0559a87ad05",
13+
.hash = "plthook-0.0.0-91TxxWOcAQCmaDBDPxs8sBPoJcl2DEkQ4oRYP5pd4p4L",
1414
},
1515
},
1616

src/hooks.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const alloc = root.alloc;
66
const util = root.util;
77

88
const plthook = @import("plthook");
9-
const plthook_ext = @import("nix/plthook_ext.zig");
109
const iatHook = if (builtin.os.tag == .windows) @import("windows/iat_hook.zig").iatHook;
1110

1211
const nix = if (builtin.os.tag != .windows) @import("nix/hooks.zig");
@@ -105,7 +104,7 @@ fn tryPltHook(hook: *plthook.c.plthook_t, funcname: [:0]const u8, funcaddr: *any
105104
}
106105

107106
pub fn installHooksNix() callconv(.c) void {
108-
const hook = plthook_ext.plthook_open_by_filename("UnityPlayer") catch |e| {
107+
const hook = plthook.openByFilename(comptime "UnityPlayer" ++ builtin.os.tag.dynamicLibSuffix()) catch |e| {
109108
const s: [*:0]const u8 = switch (e) {
110109
error.FileNotFound => "FileNotFound",
111110
else => plthook.c.plthook_error(),
@@ -136,7 +135,7 @@ pub fn installHooksNix() callconv(.c) void {
136135
if (plthook.c.plthook_replace(hook, "mono_jit_init_version", @constCast(&bootstrap.init_mono), null) != 0) {
137136
root.logger.err("Failed to hook mono_jit_init_version. Error: {s}", .{plthook.c.plthook_error()});
138137
} else {
139-
const mono_handle = plthook_ext.macos.plthook_handle_by_filename("libmono");
138+
const mono_handle = plthook.system.handleByFilename(comptime "libmono" ++ builtin.os.tag.dynamicLibSuffix());
140139
if (mono_handle) |handle| {
141140
runtimes.mono.load(handle);
142141
}

src/nix/plthook_ext.zig

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)