Compare commits
1 commit
master
...
feat/updat
Author | SHA1 | Date | |
---|---|---|---|
56333dd432 |
2 changed files with 16 additions and 10 deletions
|
@ -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;
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue