Files
Aurora.3/code/__DEFINES/rust_bapi.dm
DreamySkrell a78701f553 BAPI - spacemandmm dmm reading (#19118)
More bapi work, docs, etc.


The actual changes seen from DM side, is that all maps are parsed and
checked by spacemandmm. It does not really add much safety for us, as
everyone uses strongdmm anyways (which uses spacemandmm), but I will
need to do that anyways in future work.

The bapi call is on every map in the maploader, so if it does not work,
if it crashes or panics or whatever, we'll see it immediately (cause the
maps don't load). It should work fine, though, unless the setup is
wrong. I wrote more about safety and other things in readme text file in
rust/bapi dir.


So, yeah. The point of this PR is to do something meaningful with bapi,
and see if the whole workflow and setup and everything works correctly,
before doing any further work in future PRs.

---------

Co-authored-by: DreamySkrell <>
Co-authored-by: AuroraBuildBot <action@github.com>
2024-05-23 19:23:38 +00:00

46 lines
1.8 KiB
Plaintext

// ------------------------------------------- .dll/.so detection
/// Global var set to bapi .dll/.so location.
/* This comment bypasses grep checks */ /var/__bapi
/// Look for .dll/.so in the build location first, then in `.`, then in standard places.
/proc/__detect_bapi()
if(world.system_type == UNIX)
#ifdef CIBUILDING
// CI override, use libbapi_ci.so if possible.
if(fexists("./tools/ci/libbapi_ci.so"))
return __bapi = "tools/ci/libbapi_ci.so"
#endif
// First check if it's built in the usual place.
if(fexists("./rust/bapi/target/i686-unknown-linux-gnu/release/libbapi.so"))
return __bapi = "./rust/bapi/target/i686-unknown-linux-gnu/release/libbapi.so"
// Then check in the current directory.
if(fexists("./libbapi.so"))
return __bapi = "./libbapi.so"
// And elsewhere.
return __bapi = "libbapi.so"
else
// First check if it's built in the usual place when working on it locally.
if(fexists("./rust/bapi/target/i686-pc-windows-msvc/release/bapi.dll"))
return __bapi = "./rust/bapi/target/i686-pc-windows-msvc/release/bapi.dll"
// Also check the debug location if compiled without optimizations.
if(fexists("./rust/bapi/target/i686-pc-windows-msvc/debug/bapi.dll"))
return __bapi = "./rust/bapi/target/i686-pc-windows-msvc/debug/bapi.dll"
// Then check in the current directory.
if(fexists("./bapi.dll"))
return __bapi = "./bapi.dll"
// And elsewhere.
return __bapi = "bapi.dll"
#define BAPI (__bapi || __detect_bapi())
#define BAPI_CALL(func, args...) call_ext(BAPI, "byond:[#func]")(args)
// ------------------------------------------- bapi functions callable from dm
// Should only call functions ending with `_ffi`.
#define bapi_read_dmm_file(arg) BAPI_CALL(read_dmm_file_ffi, arg)
// ------------------------------------------- fin