From ebe8c97ef265227ee978e06580af1af202940311 Mon Sep 17 00:00:00 2001 From: Katherine Kiefer Date: Fri, 1 Dec 2023 22:58:27 +1100 Subject: [PATCH] only call it once --- bindings.dm | 62 ++++++++++++++++---------------- crates/byondapi-binds/src/lib.rs | 8 +++-- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/bindings.dm b/bindings.dm index 4343b3a..809aa02 100644 --- a/bindings.dm +++ b/bindings.dm @@ -1,10 +1,27 @@ -#define AUXMOS (__detect_auxmos()) +/* This comment bypasses grep checks */ /var/__auxmos /proc/__detect_auxmos() if (world.system_type == UNIX) - return "libauxmos" + return __auxmos = "libauxmos" else - return "auxmos" + return __auxmos = "auxmos" + +#define AUXMOS (__auxmos || __detect_auxmos()) + +/proc/__auxmos_shutdown() + return call_ext(AUXMOS, "byond:auxmos_shutdown_ffi")() + +/datum/controller/subsystem/air/proc/process_excited_groups_auxtools(remaining) + return call_ext(AUXMOS, "byond:groups_hook_ffi")(src, remaining) + +/datum/controller/subsystem/air/proc/process_turfs_auxtools(remaining) + return call_ext(AUXMOS, "byond:process_turf_hook_ffi")(src, remaining) + +/datum/controller/subsystem/air/proc/finish_turf_processing_auxtools(time_remaining) + return call_ext(AUXMOS, "byond:finish_process_turfs_ffi")(time_remaining) + +/datum/controller/subsystem/air/proc/thread_running() + return call_ext(AUXMOS, "byond:thread_running_hook_ffi")() /turf/proc/__update_auxtools_turf_adjacency_info() return call_ext(AUXMOS, "byond:hook_infos_ffi")(src) @@ -12,6 +29,18 @@ /turf/proc/update_air_ref(flag) return call_ext(AUXMOS, "byond:hook_register_turf_ffi")(src, flag) +/proc/finalize_gas_refs() + return call_ext(AUXMOS, "byond:finalize_gas_refs_ffi")() + +/datum/controller/subsystem/air/proc/auxtools_update_reactions() + return call_ext(AUXMOS, "byond:update_reactions_ffi")() + +/proc/auxtools_atmos_init(gas_data) + return call_ext(AUXMOS, "byond:hook_init_ffi")(gas_data) + +/proc/_auxtools_register_gas(gas) + return call_ext(AUXMOS, "byond:hook_register_gas_ffi")(gas) + /datum/gas_mixture/proc/__auxtools_parse_gas_string(string) return call_ext(AUXMOS, "byond:parse_gas_string_ffi")(src, string) @@ -154,30 +183,3 @@ /datum/controller/subsystem/air/proc/process_turf_equalize_auxtools(remaining) return call_ext(AUXMOS, "byond:equalize_hook_ffi")(src, remaining) -/datum/controller/subsystem/air/proc/process_excited_groups_auxtools(remaining) - return call_ext(AUXMOS, "byond:groups_hook_ffi")(src, remaining) - -/proc/finalize_gas_refs() - return call_ext(AUXMOS, "byond:finalize_gas_refs_ffi")() - -/datum/controller/subsystem/air/proc/auxtools_update_reactions() - return call_ext(AUXMOS, "byond:update_reactions_ffi")() - -/proc/auxtools_atmos_init(gas_data) - return call_ext(AUXMOS, "byond:hook_init_ffi")(gas_data) - -/proc/_auxtools_register_gas(gas) - return call_ext(AUXMOS, "byond:hook_register_gas_ffi")(gas) - -/proc/__auxmos_shutdown() - return call_ext(AUXMOS, "byond:auxmos_shutdown_ffi")() - -/datum/controller/subsystem/air/proc/process_turfs_auxtools(remaining) - return call_ext(AUXMOS, "byond:process_turf_hook_ffi")(src, remaining) - -/datum/controller/subsystem/air/proc/finish_turf_processing_auxtools(time_remaining) - return call_ext(AUXMOS, "byond:finish_process_turfs_ffi")(time_remaining) - -/datum/controller/subsystem/air/proc/thread_running() - return call_ext(AUXMOS, "byond:thread_running_hook_ffi")() - diff --git a/crates/byondapi-binds/src/lib.rs b/crates/byondapi-binds/src/lib.rs index bb15cd2..755790f 100644 --- a/crates/byondapi-binds/src/lib.rs +++ b/crates/byondapi-binds/src/lib.rs @@ -17,13 +17,15 @@ pub fn generate_bindings() { _ = std::fs::remove_file("./bindings.dm"); let mut file = std::fs::File::create("./bindings.dm").unwrap(); file.write_all( - r#"#define AUXMOS (__detect_auxmos()) + r#"/* This comment bypasses grep checks */ /var/__auxmos /proc/__detect_auxmos() if (world.system_type == UNIX) - return "libauxmos" + return __auxmos = "libauxmos" else - return "auxmos" + return __auxmos = "auxmos" + +#define AUXMOS (__auxmos || __detect_auxmos()) "# .as_bytes(),