generated from bitsquid_dt/dt-plugin-template
Rename plugin from template
All checks were successful
build Build for the target platform
All checks were successful
build Build for the target platform
This commit is contained in:
parent
6e9663fe49
commit
f905afb2b2
7 changed files with 28 additions and 21 deletions
|
@ -73,7 +73,7 @@ jobs:
|
||||||
- across:
|
- across:
|
||||||
- var: pr
|
- var: pr
|
||||||
values: ((.:prs))
|
values: ((.:prs))
|
||||||
set_pipeline: ((repo))-pr
|
set_pipeline: dt-p2p
|
||||||
file: repo/.ci/pipelines/pr.yml
|
file: repo/.ci/pipelines/pr.yml
|
||||||
vars:
|
vars:
|
||||||
pr: ((.:pr))
|
pr: ((.:pr))
|
||||||
|
|
|
@ -7,5 +7,9 @@
|
||||||
":rebaseStalePrs"
|
":rebaseStalePrs"
|
||||||
],
|
],
|
||||||
"prConcurrentLimit": 10,
|
"prConcurrentLimit": 10,
|
||||||
"branchPrefix": "renovate/"
|
"branchPrefix": "renovate/",
|
||||||
|
"baseBranches": [
|
||||||
|
"$default",
|
||||||
|
"/^release\\/.*/"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -64,7 +64,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dt-plugin-template"
|
name = "dt-p2p"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "dt-plugin-template"
|
name = "dt-p2p"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# https://jake-shadle.github.io/xwin/
|
# https://jake-shadle.github.io/xwin/
|
||||||
FROM debian:bullseye-slim AS xwin
|
FROM debian:bullseye-slim AS xwin
|
||||||
|
|
||||||
|
# renovate: datasource=github-tags depName=xwin packageName=Jake-Shadle/xwin
|
||||||
ARG XWIN_VERSION=0.5.2
|
ARG XWIN_VERSION=0.5.2
|
||||||
ARG XWIN_PREFIX="xwin-$XWIN_VERSION-x86_64-unknown-linux-musl"
|
ARG XWIN_PREFIX="xwin-$XWIN_VERSION-x86_64-unknown-linux-musl"
|
||||||
ADD https://github.com/Jake-Shadle/xwin/releases/download/$XWIN_VERSION/$XWIN_PREFIX.tar.gz /root/$XWIN_PREFIX.tar.gz
|
ADD https://github.com/Jake-Shadle/xwin/releases/download/$XWIN_VERSION/$XWIN_PREFIX.tar.gz /root/$XWIN_PREFIX.tar.gz
|
||||||
|
@ -26,7 +27,7 @@ RUN set -eux; \
|
||||||
|
|
||||||
FROM rust:slim-bullseye AS final
|
FROM rust:slim-bullseye AS final
|
||||||
|
|
||||||
ARG LLVM_VERSION=18
|
ARG LLVM_VERSION=20
|
||||||
ENV KEYRINGS=/usr/local/share/keyrings
|
ENV KEYRINGS=/usr/local/share/keyrings
|
||||||
|
|
||||||
ADD https://apt.llvm.org/llvm-snapshot.gpg.key /root/llvm-snapshot.gpg.key
|
ADD https://apt.llvm.org/llvm-snapshot.gpg.key /root/llvm-snapshot.gpg.key
|
||||||
|
|
15
Justfile
15
Justfile
|
@ -1,7 +1,5 @@
|
||||||
fly_target := "main"
|
fly_target := "main"
|
||||||
|
game_dir := env("local_game_dir")
|
||||||
image:
|
|
||||||
docker build -t dt-plugin-builder .
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker run \
|
docker run \
|
||||||
|
@ -9,16 +7,21 @@ build:
|
||||||
-t \
|
-t \
|
||||||
--user "$(id -u):$(id -g)" \
|
--user "$(id -u):$(id -g)" \
|
||||||
-v ./:/src/plugin \
|
-v ./:/src/plugin \
|
||||||
dt-plugin-builder \
|
registry.sclu1034.dev/rust-xwin-ci \
|
||||||
cargo build -Zbuild-std --target x86_64-pc-windows-msvc
|
cargo build -Zbuild-std --target x86_64-pc-windows-msvc
|
||||||
|
cp target/x86_64-pc-windows-msvc/debug/dt_p2p.dll "{{game_dir}}/binaries/plugins/dt_p2p_pluginw64_release.dll"
|
||||||
|
|
||||||
|
log:
|
||||||
|
#!/bin/sh
|
||||||
|
exec bat "$log_dir/$(\ls $log_dir | tail -1)"
|
||||||
|
|
||||||
set-base-pipeline:
|
set-base-pipeline:
|
||||||
fly -t {{fly_target}} set-pipeline \
|
fly -t {{fly_target}} set-pipeline \
|
||||||
--pipeline dt-plugin-template-pr \
|
--pipeline dt-p2p \
|
||||||
--config .ci/pipelines/set-pr-pipelines.yml \
|
--config .ci/pipelines/set-pr-pipelines.yml \
|
||||||
-v forgejo_url=https://git.sclu1034.dev \
|
-v forgejo_url=https://git.sclu1034.dev \
|
||||||
-v forgejo_api_key=${FORGEJO_API_KEY} \
|
-v forgejo_api_key=${FORGEJO_API_KEY} \
|
||||||
-v registry_user=${REGISTRY_USER} \
|
-v registry_user=${REGISTRY_USER} \
|
||||||
-v registry_password=${REGISTRY_PASSWORD} \
|
-v registry_password=${REGISTRY_PASSWORD} \
|
||||||
-v owner=bitsquid_dt \
|
-v owner=bitsquid_dt \
|
||||||
-v repo=dt-plugin-template
|
-v repo=p2p
|
||||||
|
|
17
src/lib.rs
17
src/lib.rs
|
@ -1,4 +1,4 @@
|
||||||
use std::ffi::{c_char, CString};
|
use std::ffi::{CString, c_char};
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
mod plugin;
|
mod plugin;
|
||||||
|
@ -7,22 +7,21 @@ mod stingray_sdk;
|
||||||
use plugin::Plugin;
|
use plugin::Plugin;
|
||||||
use stingray_sdk::{GetApiFunction, PluginApi, PluginApiID};
|
use stingray_sdk::{GetApiFunction, PluginApi, PluginApiID};
|
||||||
|
|
||||||
// TODO: Change these
|
|
||||||
/// The name that the plugin is registered to the engine as.
|
/// The name that the plugin is registered to the engine as.
|
||||||
/// Must be unique across all plugins.
|
/// Must be unique across all plugins.
|
||||||
pub const PLUGIN_NAME: &str = "dt-plugin-template";
|
pub const PLUGIN_NAME: &str = "dt-p2p";
|
||||||
/// The module that Lua functions are assigned to.
|
/// The module that Lua functions are assigned to.
|
||||||
pub const MODULE_NAME: &str = "DTPluginTemplate";
|
pub const MODULE_NAME: &str = "PTP";
|
||||||
|
|
||||||
static PLUGIN: OnceLock<Plugin> = OnceLock::new();
|
static PLUGIN: OnceLock<Plugin> = OnceLock::new();
|
||||||
|
|
||||||
#[no_mangle]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn get_name() -> *const c_char {
|
pub extern "C" fn get_name() -> *const c_char {
|
||||||
let s = CString::new(PLUGIN_NAME).expect("Failed to create CString from plugin name");
|
let s = CString::new(PLUGIN_NAME).expect("Failed to create CString from plugin name");
|
||||||
s.as_ptr()
|
s.as_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn setup_game(get_engine_api: GetApiFunction) {
|
pub extern "C" fn setup_game(get_engine_api: GetApiFunction) {
|
||||||
let plugin = Plugin::new(get_engine_api);
|
let plugin = Plugin::new(get_engine_api);
|
||||||
plugin.setup_game();
|
plugin.setup_game();
|
||||||
|
@ -31,7 +30,7 @@ pub extern "C" fn setup_game(get_engine_api: GetApiFunction) {
|
||||||
.expect("Failed to initalize global plugin object.");
|
.expect("Failed to initalize global plugin object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn shutdown_game() {
|
pub extern "C" fn shutdown_game() {
|
||||||
// Safety: The engine ensures that `setup_game` was called before this, so `PLUGIN` has been
|
// Safety: The engine ensures that `setup_game` was called before this, so `PLUGIN` has been
|
||||||
// initialized.
|
// initialized.
|
||||||
|
@ -39,7 +38,7 @@ pub extern "C" fn shutdown_game() {
|
||||||
plugin.shutdown_game();
|
plugin.shutdown_game();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn update_game(dt: f32) {
|
pub extern "C" fn update_game(dt: f32) {
|
||||||
// Safety: The engine ensures that `setup_game` was called before this, so `PLUGIN` has been
|
// Safety: The engine ensures that `setup_game` was called before this, so `PLUGIN` has been
|
||||||
// initialized.
|
// initialized.
|
||||||
|
@ -47,7 +46,7 @@ pub extern "C" fn update_game(dt: f32) {
|
||||||
plugin.update_game(dt);
|
plugin.update_game(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn get_plugin_api(id: PluginApiID) -> *mut PluginApi {
|
pub extern "C" fn get_plugin_api(id: PluginApiID) -> *mut PluginApi {
|
||||||
if id == PluginApiID::PLUGIN_API_ID {
|
if id == PluginApiID::PLUGIN_API_ID {
|
||||||
let api = PluginApi {
|
let api = PluginApi {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue