diff --git a/.ci/pipelines/set-pr-pipelines.yml b/.ci/pipelines/set-pr-pipelines.yml index 792faad..0a707dd 100644 --- a/.ci/pipelines/set-pr-pipelines.yml +++ b/.ci/pipelines/set-pr-pipelines.yml @@ -73,7 +73,7 @@ jobs: - across: - var: pr values: ((.:prs)) - set_pipeline: ((repo))-pr + set_pipeline: dt-p2p file: repo/.ci/pipelines/pr.yml vars: pr: ((.:pr)) diff --git a/.renovaterc b/.renovaterc index b36f3b4..4a2fbf4 100644 --- a/.renovaterc +++ b/.renovaterc @@ -7,5 +7,9 @@ ":rebaseStalePrs" ], "prConcurrentLimit": 10, - "branchPrefix": "renovate/" + "branchPrefix": "renovate/", + "baseBranches": [ + "$default", + "/^release\\/.*/" + ] } diff --git a/Cargo.lock b/Cargo.lock index 8ea5eb8..c562033 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,7 +64,7 @@ dependencies = [ ] [[package]] -name = "dt-plugin-template" +name = "dt-p2p" version = "0.1.0" dependencies = [ "bindgen", diff --git a/Cargo.toml b/Cargo.toml index 36d3a21..88db7c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "dt-plugin-template" +name = "dt-p2p" version = "0.1.0" -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/Dockerfile b/Dockerfile index 1a5a968..7a15a5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ # https://jake-shadle.github.io/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_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 @@ -26,7 +27,7 @@ RUN set -eux; \ FROM rust:slim-bullseye AS final -ARG LLVM_VERSION=18 +ARG LLVM_VERSION=20 ENV KEYRINGS=/usr/local/share/keyrings ADD https://apt.llvm.org/llvm-snapshot.gpg.key /root/llvm-snapshot.gpg.key diff --git a/Justfile b/Justfile index 4825633..c7a088b 100644 --- a/Justfile +++ b/Justfile @@ -1,7 +1,5 @@ fly_target := "main" - -image: - docker build -t dt-plugin-builder . +game_dir := env("local_game_dir") build: docker run \ @@ -9,16 +7,21 @@ build: -t \ --user "$(id -u):$(id -g)" \ -v ./:/src/plugin \ - dt-plugin-builder \ + registry.sclu1034.dev/rust-xwin-ci \ 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: fly -t {{fly_target}} set-pipeline \ - --pipeline dt-plugin-template-pr \ + --pipeline dt-p2p \ --config .ci/pipelines/set-pr-pipelines.yml \ -v forgejo_url=https://git.sclu1034.dev \ -v forgejo_api_key=${FORGEJO_API_KEY} \ -v registry_user=${REGISTRY_USER} \ -v registry_password=${REGISTRY_PASSWORD} \ -v owner=bitsquid_dt \ - -v repo=dt-plugin-template + -v repo=p2p diff --git a/src/lib.rs b/src/lib.rs index 9cdc2b7..8188952 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -use std::ffi::{c_char, CString}; +use std::ffi::{CString, c_char}; use std::sync::OnceLock; mod plugin; @@ -7,22 +7,21 @@ mod stingray_sdk; use plugin::Plugin; use stingray_sdk::{GetApiFunction, PluginApi, PluginApiID}; -// TODO: Change these /// The name that the plugin is registered to the engine as. /// 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. -pub const MODULE_NAME: &str = "DTPluginTemplate"; +pub const MODULE_NAME: &str = "PTP"; static PLUGIN: OnceLock = OnceLock::new(); -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn get_name() -> *const c_char { let s = CString::new(PLUGIN_NAME).expect("Failed to create CString from plugin name"); s.as_ptr() } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn setup_game(get_engine_api: GetApiFunction) { let plugin = Plugin::new(get_engine_api); plugin.setup_game(); @@ -31,7 +30,7 @@ pub extern "C" fn setup_game(get_engine_api: GetApiFunction) { .expect("Failed to initalize global plugin object."); } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn shutdown_game() { // Safety: The engine ensures that `setup_game` was called before this, so `PLUGIN` has been // initialized. @@ -39,7 +38,7 @@ pub extern "C" fn shutdown_game() { plugin.shutdown_game(); } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn update_game(dt: f32) { // Safety: The engine ensures that `setup_game` was called before this, so `PLUGIN` has been // initialized. @@ -47,7 +46,7 @@ pub extern "C" fn update_game(dt: f32) { plugin.update_game(dt); } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn get_plugin_api(id: PluginApiID) -> *mut PluginApi { if id == PluginApiID::PLUGIN_API_ID { let api = PluginApi {