Compare commits

..

13 Commits

Author SHA1 Message Date
paring 81ad517e67
chore: update skyhook 2023-05-28 19:04:48 +09:00
paring 81d08b4e2d
feat: is running function 2023-05-28 17:25:39 +09:00
paring ada7cae22f
chore: update skyhook 2023-05-28 14:03:25 +09:00
paring 8453fe0ab2
chore: update skyhook 2023-05-26 23:55:57 +09:00
paring 39c6b23a24
chore: update skyhook 2023-04-03 17:59:29 +09:00
paring 90b18e8792
chore: update skyhook 2023-04-03 15:32:29 +09:00
paring 8b697f382a
fix: crate type 2023-03-28 19:25:36 +09:00
paring 4e0d4007fe
fix: syntax error 2022-12-08 00:14:20 +09:00
paring cb2df46a79
feat: use chrono NaiveDateTime 2022-12-08 00:13:13 +09:00
paring d93311a4fb
fix: use two numbers to send current time 2022-12-08 00:12:52 +09:00
CrackThrough 663da66138 chore: remove unused import 2022-12-07 23:55:03 +09:00
CrackThrough b068616d44 chore: update submodule 2022-12-07 23:53:09 +09:00
paring c13b65c3ba feat: use chrono NaiveDateTime 2022-12-01 17:14:47 +09:00
3 changed files with 14 additions and 10 deletions

View File

@ -4,8 +4,9 @@ version = "0.1.0"
edition = "2021"
[dependencies]
chrono = "0.4.23"
skyhook = { path = "./vendor/skyhook/skyhook" }
[lib]
name = "skyhook"
crate-type = ["dylib"]
crate-type = ["cdylib"]

View File

@ -1,9 +1,11 @@
use std::{
ffi::{c_char, CString},
ptr::null,
time::{SystemTime, UNIX_EPOCH},
};
use chrono::NaiveDateTime;
extern crate chrono;
extern crate skyhook;
#[repr(C)]
@ -14,7 +16,7 @@ pub enum NativeEventType {
#[repr(C)]
pub struct NativeEvent {
pub time_sec: u64,
pub time_sec: i64,
pub time_nsec: u32,
pub event_type: NativeEventType,
pub vkey: u16,
@ -31,12 +33,8 @@ fn send_callback(ev: NativeEvent) {
}
}
fn get_time(time: SystemTime) -> (u64, u32) {
let dur = time
.duration_since(UNIX_EPOCH)
.expect("Unable to calculate duration");
(dur.as_secs(), dur.subsec_nanos())
fn get_time(time: NaiveDateTime) -> (i64, u32) {
(time.timestamp(), time.timestamp_subsec_nanos())
}
#[no_mangle]
@ -82,3 +80,8 @@ pub extern "C" fn stop_hook() -> *const c_char {
null()
}
#[no_mangle]
pub extern "C" fn hook_is_running() -> bool {
skyhook::is_running()
}

2
vendor/skyhook vendored

@ -1 +1 @@
Subproject commit 530166d47103698a2613e42b47f8c89a91c2363b
Subproject commit ebf908ad35cfcb9b2af3b027fcff6c859e3c1d6f