Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SmiLeYre committed May 21, 2024
2 parents bf4ae45 + 652a380 commit 35b54ff
Show file tree
Hide file tree
Showing 18 changed files with 320 additions and 187 deletions.
Binary file modified auxmos.dll
Binary file not shown.
Binary file modified auxmos.pdb
Binary file not shown.
158 changes: 79 additions & 79 deletions code/__DEFINES/bindings.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,176 +10,176 @@
return __auxmos = "auxmos"

#define AUXMOS (__auxmos || __detect_auxmos())

/datum/controller/subsystem/air/proc/process_turf_equalize_auxtools(remaining)
return LIBCALL(AUXMOS, "byond:equalize_hook_ffi")(src, remaining)

/datum/controller/subsystem/air/proc/process_excited_groups_auxtools(remaining)
return LIBCALL(AUXMOS, "byond:groups_hook_ffi")(src, remaining)

/datum/controller/subsystem/air/proc/process_turfs_auxtools(remaining)
return LIBCALL(AUXMOS, "byond:process_turf_hook_ffi")(src, remaining)

/datum/controller/subsystem/air/proc/finish_turf_processing_auxtools(time_remaining)
return LIBCALL(AUXMOS, "byond:finish_process_turfs_ffi")(time_remaining)

/datum/controller/subsystem/air/proc/thread_running()
return LIBCALL(AUXMOS, "byond:thread_running_hook_ffi")()

/turf/proc/__update_auxtools_turf_adjacency_info()
return LIBCALL(AUXMOS, "byond:hook_infos_ffi")(src)

/turf/proc/update_air_ref(flag)
return LIBCALL(AUXMOS, "byond:hook_register_turf_ffi")(src, flag)

/proc/finalize_gas_refs()
return LIBCALL(AUXMOS, "byond:finalize_gas_refs_ffi")()

/datum/controller/subsystem/air/proc/auxtools_update_reactions()
return LIBCALL(AUXMOS, "byond:update_reactions_ffi")()

/proc/auxtools_atmos_init(gas_data)
return LIBCALL(AUXMOS, "byond:hook_init_ffi")(gas_data)

/proc/_auxtools_register_gas(gas)
return LIBCALL(AUXMOS, "byond:hook_register_gas_ffi")(gas)


/datum/gas_mixture/proc/__auxtools_parse_gas_string(string)
return LIBCALL(AUXMOS, "byond:parse_gas_string_ffi")(src, string)
return call_ext(AUXMOS, "byond:parse_gas_string_ffi")(src, string)

/datum/controller/subsystem/air/proc/get_max_gas_mixes()
return LIBCALL(AUXMOS, "byond:hook_max_gas_mixes_ffi")()
return call_ext(AUXMOS, "byond:hook_max_gas_mixes_ffi")()

/datum/controller/subsystem/air/proc/get_amt_gas_mixes()
return LIBCALL(AUXMOS, "byond:hook_amt_gas_mixes_ffi")()
return call_ext(AUXMOS, "byond:hook_amt_gas_mixes_ffi")()

/proc/equalize_all_gases_in_list(gas_list)
return LIBCALL(AUXMOS, "byond:equalize_all_hook_ffi")(gas_list)
return call_ext(AUXMOS, "byond:equalize_all_hook_ffi")(gas_list)

/datum/gas_mixture/proc/get_oxidation_power(temp)
return LIBCALL(AUXMOS, "byond:oxidation_power_hook_ffi")(src, temp)
return call_ext(AUXMOS, "byond:oxidation_power_hook_ffi")(src, temp)

/datum/gas_mixture/proc/get_fuel_amount(temp)
return LIBCALL(AUXMOS, "byond:fuel_amount_hook_ffi")(src, temp)
return call_ext(AUXMOS, "byond:fuel_amount_hook_ffi")(src, temp)

/datum/gas_mixture/proc/equalize_with(total)
return LIBCALL(AUXMOS, "byond:equalize_with_hook_ffi")(src, total)
return call_ext(AUXMOS, "byond:equalize_with_hook_ffi")(src, total)

/datum/gas_mixture/proc/transfer_ratio_to(other, ratio)
return LIBCALL(AUXMOS, "byond:transfer_ratio_hook_ffi")(src, other, ratio)
return call_ext(AUXMOS, "byond:transfer_ratio_hook_ffi")(src, other, ratio)

/datum/gas_mixture/proc/transfer_to(other, moles)
return LIBCALL(AUXMOS, "byond:transfer_hook_ffi")(src, other, moles)
return call_ext(AUXMOS, "byond:transfer_hook_ffi")(src, other, moles)

/datum/gas_mixture/proc/adjust_heat(temp)
return LIBCALL(AUXMOS, "byond:adjust_heat_hook_ffi")(src, temp)
return call_ext(AUXMOS, "byond:adjust_heat_hook_ffi")(src, temp)

/datum/gas_mixture/proc/react(holder)
return LIBCALL(AUXMOS, "byond:react_hook_ffi")(src, holder)
return call_ext(AUXMOS, "byond:react_hook_ffi")(src, holder)

/datum/gas_mixture/proc/compare(other)
return LIBCALL(AUXMOS, "byond:compare_hook_ffi")(src, other)
return call_ext(AUXMOS, "byond:compare_hook_ffi")(src, other)

/datum/gas_mixture/proc/clear()
return LIBCALL(AUXMOS, "byond:clear_hook_ffi")(src)
return call_ext(AUXMOS, "byond:clear_hook_ffi")(src)

/datum/gas_mixture/proc/mark_immutable()
return LIBCALL(AUXMOS, "byond:mark_immutable_hook_ffi")(src)
return call_ext(AUXMOS, "byond:mark_immutable_hook_ffi")(src)

/datum/gas_mixture/proc/scrub_into(into, ratio_v, gas_list)
return LIBCALL(AUXMOS, "byond:scrub_into_hook_ffi")(src, into, ratio_v, gas_list)
return call_ext(AUXMOS, "byond:scrub_into_hook_ffi")(src, into, ratio_v, gas_list)

/datum/gas_mixture/proc/get_by_flag(flag_val)
return LIBCALL(AUXMOS, "byond:get_by_flag_hook_ffi")(src, flag_val)
return call_ext(AUXMOS, "byond:get_by_flag_hook_ffi")(src, flag_val)

/datum/gas_mixture/proc/__remove_by_flag(into, flag_val, amount_val)
return LIBCALL(AUXMOS, "byond:remove_by_flag_hook_ffi")(src, into, flag_val, amount_val)
return call_ext(AUXMOS, "byond:remove_by_flag_hook_ffi")(src, into, flag_val, amount_val)

/datum/gas_mixture/proc/divide(num_val)
return LIBCALL(AUXMOS, "byond:divide_hook_ffi")(src, num_val)
return call_ext(AUXMOS, "byond:divide_hook_ffi")(src, num_val)

/datum/gas_mixture/proc/multiply(num_val)
return LIBCALL(AUXMOS, "byond:multiply_hook_ffi")(src, num_val)
return call_ext(AUXMOS, "byond:multiply_hook_ffi")(src, num_val)

/datum/gas_mixture/proc/subtract(num_val)
return LIBCALL(AUXMOS, "byond:subtract_hook_ffi")(src, num_val)
return call_ext(AUXMOS, "byond:subtract_hook_ffi")(src, num_val)

/datum/gas_mixture/proc/add(num_val)
return LIBCALL(AUXMOS, "byond:add_hook_ffi")(src, num_val)
return call_ext(AUXMOS, "byond:add_hook_ffi")(src, num_val)

/datum/gas_mixture/proc/adjust_multi(...)
var/list/args_copy = args.Copy()
args_copy.Insert(1, src)
return LIBCALL(AUXMOS, "byond:adjust_multi_hook_ffi")(arglist(args_copy))
return call_ext(AUXMOS, "byond:adjust_multi_hook_ffi")(arglist(args_copy))

/datum/gas_mixture/proc/adjust_moles_temp(id_val, num_val, temp_val)
return LIBCALL(AUXMOS, "byond:adjust_moles_temp_hook_ffi")(src, id_val, num_val, temp_val)
return call_ext(AUXMOS, "byond:adjust_moles_temp_hook_ffi")(src, id_val, num_val, temp_val)

/datum/gas_mixture/proc/adjust_moles(id_val, num_val)
return LIBCALL(AUXMOS, "byond:adjust_moles_hook_ffi")(src, id_val, num_val)
return call_ext(AUXMOS, "byond:adjust_moles_hook_ffi")(src, id_val, num_val)

/datum/gas_mixture/proc/set_moles(gas_id, amt_val)
return LIBCALL(AUXMOS, "byond:set_moles_hook_ffi")(src, gas_id, amt_val)
return call_ext(AUXMOS, "byond:set_moles_hook_ffi")(src, gas_id, amt_val)

/datum/gas_mixture/proc/get_moles(gas_id)
return LIBCALL(AUXMOS, "byond:get_moles_hook_ffi")(src, gas_id)
return call_ext(AUXMOS, "byond:get_moles_hook_ffi")(src, gas_id)

/datum/gas_mixture/proc/set_volume(vol_arg)
return LIBCALL(AUXMOS, "byond:set_volume_hook_ffi")(src, vol_arg)
return call_ext(AUXMOS, "byond:set_volume_hook_ffi")(src, vol_arg)

/datum/gas_mixture/proc/partial_heat_capacity(gas_id)
return LIBCALL(AUXMOS, "byond:partial_heat_capacity_ffi")(src, gas_id)
return call_ext(AUXMOS, "byond:partial_heat_capacity_ffi")(src, gas_id)

/datum/gas_mixture/proc/set_temperature(arg_temp)
return LIBCALL(AUXMOS, "byond:set_temperature_hook_ffi")(src, arg_temp)
return call_ext(AUXMOS, "byond:set_temperature_hook_ffi")(src, arg_temp)

/datum/gas_mixture/proc/get_gases()
return LIBCALL(AUXMOS, "byond:get_gases_hook_ffi")(src)
return call_ext(AUXMOS, "byond:get_gases_hook_ffi")(src)

/datum/gas_mixture/proc/temperature_share(...)
var/list/args_copy = args.Copy()
args_copy.Insert(1, src)
return LIBCALL(AUXMOS, "byond:temperature_share_hook_ffi")(arglist(args_copy))
return call_ext(AUXMOS, "byond:temperature_share_hook_ffi")(arglist(args_copy))

/datum/gas_mixture/proc/copy_from(giver)
return LIBCALL(AUXMOS, "byond:copy_from_hook_ffi")(src, giver)
return call_ext(AUXMOS, "byond:copy_from_hook_ffi")(src, giver)

/datum/gas_mixture/proc/__remove(into, amount_arg)
return LIBCALL(AUXMOS, "byond:remove_hook_ffi")(src, into, amount_arg)
return call_ext(AUXMOS, "byond:remove_hook_ffi")(src, into, amount_arg)

/datum/gas_mixture/proc/__remove_ratio(into, ratio_arg)
return LIBCALL(AUXMOS, "byond:remove_ratio_hook_ffi")(src, into, ratio_arg)
return call_ext(AUXMOS, "byond:remove_ratio_hook_ffi")(src, into, ratio_arg)

/datum/gas_mixture/proc/merge(giver)
return LIBCALL(AUXMOS, "byond:merge_hook_ffi")(src, giver)
return call_ext(AUXMOS, "byond:merge_hook_ffi")(src, giver)

/datum/gas_mixture/proc/thermal_energy()
return LIBCALL(AUXMOS, "byond:thermal_energy_hook_ffi")(src)
return call_ext(AUXMOS, "byond:thermal_energy_hook_ffi")(src)

/datum/gas_mixture/proc/return_volume()
return LIBCALL(AUXMOS, "byond:return_volume_hook_ffi")(src)
return call_ext(AUXMOS, "byond:return_volume_hook_ffi")(src)

/datum/gas_mixture/proc/return_temperature()
return LIBCALL(AUXMOS, "byond:return_temperature_hook_ffi")(src)
return call_ext(AUXMOS, "byond:return_temperature_hook_ffi")(src)

/datum/gas_mixture/proc/return_pressure()
return LIBCALL(AUXMOS, "byond:return_pressure_hook_ffi")(src)
return call_ext(AUXMOS, "byond:return_pressure_hook_ffi")(src)

/datum/gas_mixture/proc/total_moles()
return LIBCALL(AUXMOS, "byond:total_moles_hook_ffi")(src)
return call_ext(AUXMOS, "byond:total_moles_hook_ffi")(src)

/datum/gas_mixture/proc/set_min_heat_capacity(arg_min)
return LIBCALL(AUXMOS, "byond:min_heat_cap_hook_ffi")(src, arg_min)
return call_ext(AUXMOS, "byond:min_heat_cap_hook_ffi")(src, arg_min)

/datum/gas_mixture/proc/heat_capacity()
return LIBCALL(AUXMOS, "byond:heat_cap_hook_ffi")(src)
return call_ext(AUXMOS, "byond:heat_cap_hook_ffi")(src)

/datum/gas_mixture/proc/__gasmixture_unregister()
return LIBCALL(AUXMOS, "byond:unregister_gasmixture_hook_ffi")(src)
return call_ext(AUXMOS, "byond:unregister_gasmixture_hook_ffi")(src)

/datum/gas_mixture/proc/__gasmixture_register()
return LIBCALL(AUXMOS, "byond:register_gasmixture_hook_ffi")(src)
return call_ext(AUXMOS, "byond:register_gasmixture_hook_ffi")(src)

/proc/process_atmos_callbacks(remaining)
return LIBCALL(AUXMOS, "byond:atmos_callback_handle_ffi")(remaining)
return call_ext(AUXMOS, "byond:atmos_callback_handle_ffi")(remaining)

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

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

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

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

1 change: 1 addition & 0 deletions code/__DEFINES/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
#define ui_borg_language_menu "CENTER+4:21,SOUTH+1:5"
#define ui_borg_pda_send "CENTER+5:21,SOUTH:5" // To the right of the alert panel
#define ui_borg_pda_log "CENTER+6:21,SOUTH:5"
#define ui_borg_movi "CENTER+7:21,SOUTH:5"
#define ui_borg_sensor "CENTER-6:16, SOUTH:5" //LEGACY
#define ui_borg_thrusters "CENTER-5:16, SOUTH:5" //LEGACY

Expand Down
60 changes: 60 additions & 0 deletions code/__DEFINES/rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,66 @@
#define rustg_http_request_async(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_async")(method, url, body, headers, options)
#define rustg_http_check_request(req_id) RUSTG_CALL(RUST_G, "http_check_request")(req_id)

/// Generates a spritesheet at: [file_path][spritesheet_name]_[size_id].png
/// The resulting spritesheet arranges icons in a random order, with the position being denoted in the "sprites" return value.
/// All icons have the same y coordinate, and their x coordinate is equal to `icon_width * position`.
///
/// hash_icons is a boolean (0 or 1), and determines if the generator will spend time creating hashes for the output field dmi_hashes.
/// These hashes can be heplful for 'smart' caching (see rustg_iconforge_cache_valid), but require extra computation.
///
/// Spritesheet will contain all sprites listed within "sprites".
/// "sprites" format:
/// list(
/// "sprite_name" = list( // <--- this list is a [SPRITE_OBJECT]
/// icon_file = 'icons/path_to/an_icon.dmi',
/// icon_state = "some_icon_state",
/// dir = SOUTH,
/// frame = 1,
/// transform = list([TRANSFORM_OBJECT], ...)
/// ),
/// ...,
/// )
/// TRANSFORM_OBJECT format:
/// list("type" = RUSTG_ICONFORGE_BLEND_COLOR, "color" = "#ff0000", "blend_mode" = ICON_MULTIPLY)
/// list("type" = RUSTG_ICONFORGE_BLEND_ICON, "icon" = [SPRITE_OBJECT], "blend_mode" = ICON_OVERLAY)
/// list("type" = RUSTG_ICONFORGE_SCALE, "width" = 32, "height" = 32)
/// list("type" = RUSTG_ICONFORGE_CROP, "x1" = 1, "y1" = 1, "x2" = 32, "y2" = 32) // (BYOND icons index from 1,1 to the upper bound, inclusive)
///
/// Returns a SpritesheetResult as JSON, containing fields:
/// list(
/// "sizes" = list("32x32", "64x64", ...),
/// "sprites" = list("sprite_name" = list("size_id" = "32x32", "position" = 0), ...),
/// "dmi_hashes" = list("icons/path_to/an_icon.dmi" = "d6325c5b4304fb03", ...),
/// "sprites_hash" = "a2015e5ff403fb5c", // This is the xxh64 hash of the INPUT field "sprites".
/// "error" = "[A string, empty if there were no errors.]"
/// )
/// In the case of an unrecoverable panic from within Rust, this function ONLY returns a string containing the error.
#define rustg_iconforge_generate(file_path, spritesheet_name, sprites, hash_icons) RUSTG_CALL(RUST_G, "iconforge_generate")(file_path, spritesheet_name, sprites, "[hash_icons]")
/// Returns a job_id for use with rustg_iconforge_check()
#define rustg_iconforge_generate_async(file_path, spritesheet_name, sprites, hash_icons) RUSTG_CALL(RUST_G, "iconforge_generate_async")(file_path, spritesheet_name, sprites, "[hash_icons]")
/// Returns the status of an async job_id, or its result if it is completed. See RUSTG_JOB DEFINEs.
#define rustg_iconforge_check(job_id) RUSTG_CALL(RUST_G, "iconforge_check")("[job_id]")
/// Clears all cached DMIs and images, freeing up memory.
/// This should be used after spritesheets are done being generated.
#define rustg_iconforge_cleanup RUSTG_CALL(RUST_G, "iconforge_cleanup")
/// Takes in a set of hashes, generate inputs, and DMI filepaths, and compares them to determine cache validity.
/// input_hash: xxh64 hash of "sprites" from the cache.
/// dmi_hashes: xxh64 hashes of the DMIs in a spritesheet, given by `rustg_iconforge_generate` with `hash_icons` enabled. From the cache.
/// sprites: The new input that will be passed to rustg_iconforge_generate().
/// Returns a CacheResult with the following structure: list(
/// "result": "1" (if cache is valid) or "0" (if cache is invalid)
/// "fail_reason": "" (emtpy string if valid, otherwise a string containing the invalidation reason or an error with ERROR: prefixed.)
/// )
/// In the case of an unrecoverable panic from within Rust, this function ONLY returns a string containing the error.
#define rustg_iconforge_cache_valid(input_hash, dmi_hashes, sprites) RUSTG_CALL(RUST_G, "iconforge_cache_valid")(input_hash, dmi_hashes, sprites)
/// Returns a job_id for use with rustg_iconforge_check()
#define rustg_iconforge_cache_valid_async(input_hash, dmi_hashes, sprites) RUSTG_CALL(RUST_G, "iconforge_cache_valid_async")(input_hash, dmi_hashes, sprites)

#define RUSTG_ICONFORGE_BLEND_COLOR "BlendColor"
#define RUSTG_ICONFORGE_BLEND_ICON "BlendIcon"
#define RUSTG_ICONFORGE_CROP "Crop"
#define RUSTG_ICONFORGE_SCALE "Scale"

#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"
Expand Down
Loading

0 comments on commit 35b54ff

Please sign in to comment.