Skip to content

Commit

Permalink
only call it once
Browse files Browse the repository at this point in the history
  • Loading branch information
jupyterkat committed Dec 1, 2023
1 parent cae88ab commit ebe8c97
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
62 changes: 32 additions & 30 deletions bindings.dm
Original file line number Diff line number Diff line change
@@ -1,17 +1,46 @@
#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)

/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)

Expand Down Expand Up @@ -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")()

8 changes: 5 additions & 3 deletions crates/byondapi-binds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit ebe8c97

Please sign in to comment.