Update engine plugin version #11
2 changed files with 16 additions and 10 deletions
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
// `Option::unwrap` still generates several instructions in
|
||||
// optimized code.
|
||||
let f = unsafe { f.unwrap_unchecked() };
|
||||
|
||||
unsafe { f(id as u32) }
|
||||
unsafe {
|
||||
// `Option::unwrap` still generates several instructions in
|
||||
// optimized code.
|
||||
let f = f.unwrap_unchecked();
|
||||
f(id as u32)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LoggingApi {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue