2
Fork 0

Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
56333dd432
Update engine plugin version
All checks were successful
lint/clippy Check for common mistakes and opportunities for code improvement
build Build for the target platform
This is tracking the latest version of Warhammer 40,000 Darktide.
Other games will likely need a different version.
2025-04-22 15:44:23 +02:00
2 changed files with 16 additions and 10 deletions

View file

@ -1,5 +1,5 @@
#pragma once
// This is manually updated and minified PluginApi based on the publicly
// This is a manually updated and minified PluginApi based on the publicly
// available sources at: https://github.com/AutodeskGames/stingray-plugin
// From
// https://github.com/thewhitegoatcb/rawray/blob/master/rawray/PluginApi128.h
@ -59,7 +59,7 @@ enum PluginApiID {
CAMERA_API_ID = 38,
END_OF_ENGINE_RESERVED_RANGE = 65535,
/* API IDs in the range 0--65535 are reserved by the engine. If you want to
/* API IDs in the range 0-65535 are reserved by the engine. If you want to
provide your own API in your plugin, we suggest using a hash of the API's
name as ID. */
};
@ -69,7 +69,7 @@ typedef void *(*GetApiFunction)(unsigned api);
struct PluginApi {
#ifdef __cplusplus
uint32_t version = 65;
uint32_t version = 69;
uint32_t flags = 3; // lua plugin
#else
uint32_t version;

View file

@ -19,11 +19,16 @@ pub use bindings::GetApiFunction;
pub use bindings::PluginApi;
pub use bindings::PluginApiID;
// The API version. This must match with the game you're building the plugin for.
const STINGRAY_PLUGIN_VERSION: u32 = 69;
// A set of bitflags. The value `3` is known to work for Lua plugins.
const STINGRAY_PLUGIN_FLAGS: u32 = 3;
impl std::default::Default for PluginApi {
fn default() -> Self {
Self {
version: 65,
flags: 3,
version: STINGRAY_PLUGIN_VERSION,
flags: STINGRAY_PLUGIN_FLAGS,
setup_game: None,
update_game: None,
shutdown_game: None,
@ -53,11 +58,12 @@ fn get_engine_api(f: GetApiFunction, id: PluginApiID) -> *mut c_void {
#[cfg(not(debug_assertions))]
fn get_engine_api(f: GetApiFunction, id: PluginApiID) -> *mut c_void {
unsafe {
// `Option::unwrap` still generates several instructions in
// optimized code.
let f = unsafe { f.unwrap_unchecked() };
unsafe { f(id as u32) }
let f = f.unwrap_unchecked();
f(id as u32)
}
}
pub struct LoggingApi {