2
Fork 0

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.
This commit is contained in:
Lucas Schwiderski 2025-04-22 15:44:23 +02:00
parent 71551b8ddb
commit 56333dd432
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8
2 changed files with 16 additions and 10 deletions

View file

@ -1,5 +1,5 @@
#pragma once #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 // available sources at: https://github.com/AutodeskGames/stingray-plugin
// From // From
// https://github.com/thewhitegoatcb/rawray/blob/master/rawray/PluginApi128.h // https://github.com/thewhitegoatcb/rawray/blob/master/rawray/PluginApi128.h
@ -59,7 +59,7 @@ enum PluginApiID {
CAMERA_API_ID = 38, CAMERA_API_ID = 38,
END_OF_ENGINE_RESERVED_RANGE = 65535, 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 provide your own API in your plugin, we suggest using a hash of the API's
name as ID. */ name as ID. */
}; };
@ -69,7 +69,7 @@ typedef void *(*GetApiFunction)(unsigned api);
struct PluginApi { struct PluginApi {
#ifdef __cplusplus #ifdef __cplusplus
uint32_t version = 65; uint32_t version = 69;
uint32_t flags = 3; // lua plugin uint32_t flags = 3; // lua plugin
#else #else
uint32_t version; uint32_t version;

View file

@ -19,11 +19,16 @@ pub use bindings::GetApiFunction;
pub use bindings::PluginApi; pub use bindings::PluginApi;
pub use bindings::PluginApiID; 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 { impl std::default::Default for PluginApi {
fn default() -> Self { fn default() -> Self {
Self { Self {
version: 65, version: STINGRAY_PLUGIN_VERSION,
flags: 3, flags: STINGRAY_PLUGIN_FLAGS,
setup_game: None, setup_game: None,
update_game: None, update_game: None,
shutdown_game: None, shutdown_game: None,
@ -53,11 +58,12 @@ fn get_engine_api(f: GetApiFunction, id: PluginApiID) -> *mut c_void {
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
fn get_engine_api(f: GetApiFunction, id: PluginApiID) -> *mut c_void { fn get_engine_api(f: GetApiFunction, id: PluginApiID) -> *mut c_void {
unsafe {
// `Option::unwrap` still generates several instructions in // `Option::unwrap` still generates several instructions in
// optimized code. // optimized code.
let f = unsafe { f.unwrap_unchecked() }; let f = f.unwrap_unchecked();
f(id as u32)
unsafe { f(id as u32) } }
} }
pub struct LoggingApi { pub struct LoggingApi {