generated from Ryan-rsm-McKenzie/ExamplePlugin-CommonLibSSE
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
621 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: ershin | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: ershin | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
polar: # Replace with a single Polar username | ||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
name: Build variant | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
GIT_BRANCH: | ||
type: string | ||
GIT_COMMON_LIB_BRANCH: | ||
type: string | ||
CMAKE_PROJECT_DIR: | ||
type: string | ||
required: true | ||
CMAKE_CONFIG_PRESET: | ||
type: string | ||
required: true | ||
CMAKE_BUILD_PRESET: | ||
type: string | ||
required: true | ||
CMAKE_CONFIG: | ||
type: string | ||
required: true | ||
BINARY_DIR: | ||
type: string | ||
required: true | ||
BINARY_NAME: | ||
type: string | ||
required: true | ||
BINARY_NAME_VAR: | ||
type: string | ||
required: true | ||
BINARY_VERSION: | ||
type: string | ||
required: true | ||
BINARY_VERSION_VAR: | ||
type: string | ||
required: true | ||
TARGET_DIR: | ||
type: string | ||
required: true | ||
VARIANT: | ||
type: string | ||
required: true | ||
VCPKG_COMMIT_ID: | ||
type: string | ||
required: true | ||
secrets: | ||
GIT_SSH_KEY: | ||
required: false | ||
outputs: | ||
ARTIFACT_NAME: | ||
value: ${{ jobs.build.outputs.ARTIFACT_NAME }} | ||
PRODUCT_NAME: | ||
value: ${{ jobs.build.outputs.PRODUCT_NAME }} | ||
PRODUCT_VERSION: | ||
value: ${{ jobs.build.outputs.PRODUCT_VERSION }} | ||
BINARY_NAME: | ||
value: ${{ jobs.build.outputs.BINARY_NAME }} | ||
|
||
env: | ||
COMMON_LIB_SSE_NAME: CommonLibSSE | ||
COMMON_LIB_VR_NAME: CommonLibVR | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
outputs: | ||
ARTIFACT_NAME: ${{ steps.export.outputs.ARTIFACT_NAME }} | ||
BINARY_NAME: ${{ steps.export.outputs.BINARY_NAME }} | ||
PRODUCT_NAME: ${{ steps.export.outputs.PRODUCT_NAME }} | ||
PRODUCT_VERSION: ${{ steps.export.outputs.PRODUCT_VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.GIT_BRANCH }} | ||
ssh-key: ${{ secrets.GIT_SSH_KEY }} | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- name: Use CommonLib 1.6.353 | ||
if: inputs.GIT_COMMON_LIB_BRANCH != '' | ||
shell: pwsh | ||
run: | | ||
$CLibSSEName = git submodule | Select-String -Pattern ${{ env.COMMON_LIB_SSE_NAME }} | %{[string]$_} | %{$_.Split(" ")[2]} | ||
If ([string]::IsNullOrEmpty($CLibSSEName)) { return } | ||
cd "$CLibSSEName" | ||
git fetch | ||
git checkout ${{inputs.GIT_COMMON_LIB_BRANCH}} | ||
- name: Restore artifacts, or setup vcpkg (do not install any package) | ||
uses: lukka/run-vcpkg@v11 | ||
id: runvcpkg | ||
with: | ||
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' | ||
vcpkgGitCommitId: '${{ inputs.VCPKG_COMMIT_ID }}' | ||
vcpkgJsonGlob: './${{inputs.CMAKE_PROJECT_DIR}}/vcpkg.json' | ||
|
||
- name: Configure CMake | ||
shell: pwsh | ||
run: cmake --preset ${{inputs.CMAKE_CONFIG_PRESET}} | ||
|
||
- name: Run CMake with build config | ||
if: inputs.CMAKE_BUILD_PRESET != '' | ||
shell: pwsh | ||
run: cmake --build --preset ${{inputs.CMAKE_BUILD_PRESET}} | ||
|
||
- name: Run CMake | ||
if: inputs.CMAKE_BUILD_PRESET == '' | ||
shell: pwsh | ||
run: cmake --build ${{inputs.BINARY_DIR}} --config ${{inputs.CMAKE_CONFIG}} | ||
|
||
- id: export | ||
shell: pwsh | ||
run: | | ||
$PRODUCT_NAME = If (![string]::IsNullOrEmpty("${{inputs.BINARY_NAME}}")) {"${{inputs.BINARY_NAME}}"} Else { cmake -L -N ${{inputs.BINARY_DIR}} | grep "${{inputs.BINARY_NAME_VAR}}" | %{$_ -replace "${{inputs.BINARY_NAME_VAR}}:STRING=",""} } | ||
$PRODUCT_VERSION = If (![string]::IsNullOrEmpty("${{inputs.BINARY_VERSION}}")) {"${{inputs.BINARY_VERSION}}"} Else { cmake -L -N ${{inputs.BINARY_DIR}} | grep "^${{inputs.BINARY_VERSION_VAR}}" | %{$_ -replace "${{inputs.BINARY_VERSION_VAR}}:STRING=",""} } | ||
$PRODUCTS_DIR = "${{inputs.TARGET_DIR}}/${{inputs.CMAKE_PROJECT_DIR}}/${{inputs.CMAKE_CONFIG}}" | ||
$BINARY_NAME = "$PRODUCT_NAME.dll" | ||
$BINARY_PATH = "$PRODUCTS_DIR/$BINARY_NAME" | ||
$PDB_NAME = "$PRODUCT_NAME.pdb" | ||
$PDB_PATH = "$PRODUCTS_DIR/$PDB_NAME" | ||
$MARKETING_SUFFIX = "${{inputs.VARIANT}}".ToUpper() | ||
$BUILD_TYPE = "${{inputs.CMAKE_CONFIG}}" | ||
$ARTIFACT_NAME = "$PRODUCT_NAME $MARKETING_SUFFIX $BUILD_TYPE" | ||
echo "PRODUCT_NAME=$PRODUCT_NAME" >> $Env:GITHUB_OUTPUT | ||
echo "PRODUCT_VERSION=$PRODUCT_VERSION" >> $Env:GITHUB_OUTPUT | ||
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $Env:GITHUB_OUTPUT | ||
echo "BINARY_PATH=$BINARY_PATH" >> $Env:GITHUB_OUTPUT | ||
echo "BINARY_NAME=$BINARY_NAME" >> $Env:GITHUB_OUTPUT | ||
echo "PDB_PATH=$PDB_PATH" >> $Env:GITHUB_OUTPUT | ||
echo "PDB_NAME=$PDB_NAME" >> $Env:GITHUB_OUTPUT | ||
echo "Built $BINARY_NAME ✅" | ||
echo "Location: $BINARY_PATH" | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.export.outputs.ARTIFACT_NAME }} | ||
if-no-files-found: error | ||
path: | | ||
${{ steps.export.outputs.BINARY_PATH }} | ||
${{ steps.export.outputs.PDB_PATH }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: '**' | ||
tags: '*' | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
run: | ||
uses: ./.github/workflows/build-variant.yml | ||
with: | ||
CMAKE_PROJECT_DIR: '' | ||
CMAKE_CONFIG_PRESET: "github-actions" | ||
CMAKE_BUILD_PRESET: '' | ||
CMAKE_CONFIG: "Release" | ||
BINARY_DIR: "build" | ||
BINARY_NAME: '' | ||
BINARY_NAME_VAR: "NAME" | ||
BINARY_VERSION: '' | ||
BINARY_VERSION_VAR: "VERSION" | ||
TARGET_DIR: "build/src" | ||
VARIANT: "ng" | ||
VCPKG_COMMIT_ID: "a7d99a5c3cd1456af023051d025a5643a2d6e79c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[submodule "extern/GreenSock-AS2"] | ||
path = extern/GreenSock-AS2 | ||
url = https://github.com/greensock/GreenSock-AS2 | ||
[submodule "extern/CommonLibSSE"] | ||
path = extern/CommonLibSSE | ||
url = https://github.com/alandtse/CommonLibVR.git | ||
branch = ng |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "APIManager.h" | ||
|
||
#include "DirectionalMovementHandler.h" | ||
|
||
void APIs::RequestAPIs() | ||
{ | ||
if (!DodgeFramework) { | ||
DodgeFramework = reinterpret_cast<DODGEFRAMEWORK_API::IVDodgeFramework1*>(DODGEFRAMEWORK_API::RequestPluginAPI(DODGEFRAMEWORK_API::InterfaceVersion::V1)); | ||
if (DodgeFramework) { | ||
logger::info("Obtained Dodge Framework API - {0:x}", reinterpret_cast<uintptr_t>(DodgeFramework)); | ||
} else { | ||
logger::warn("Failed to obtain Dodge Framework API"); | ||
} | ||
} | ||
|
||
if (!SmoothCam) { | ||
if (!SmoothCamAPI::RegisterInterfaceLoaderCallback(SKSE::GetMessagingInterface(), | ||
[](void* interfaceInstance, SmoothCamAPI::InterfaceVersion interfaceVersion) { | ||
if (interfaceVersion == SmoothCamAPI::InterfaceVersion::V3) { | ||
SmoothCam = reinterpret_cast<SmoothCamAPI::IVSmoothCam3*>(interfaceInstance); | ||
logger::info("Obtained SmoothCamAPI"); | ||
} else { | ||
logger::error("Unable to acquire requested SmoothCamAPI interface version"); | ||
} | ||
})) { | ||
logger::warn("SmoothCamAPI::RegisterInterfaceLoaderCallback reported an error"); | ||
} | ||
|
||
if (!SmoothCamAPI::RequestInterface( | ||
SKSE::GetMessagingInterface(), | ||
SmoothCamAPI::InterfaceVersion::V3)) { | ||
logger::warn("SmoothCamAPI::RequestInterface reported an error"); | ||
} | ||
} | ||
|
||
if (!TrueHUD) { | ||
TrueHUD = reinterpret_cast<TRUEHUD_API::IVTrueHUD3*>(TRUEHUD_API::RequestPluginAPI(TRUEHUD_API::InterfaceVersion::V3)); | ||
if (TrueHUD) { | ||
logger::info("Obtained TrueHUD API - {0:x}", reinterpret_cast<uintptr_t>(TrueHUD)); | ||
} else { | ||
logger::warn("Failed to obtain TrueHUD API"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include "API/DodgeFrameworkAPI.h" | ||
#include "API/SmoothCamAPI.h" | ||
#include "API/TrueHUDAPI.h" | ||
|
||
struct APIs | ||
{ | ||
static inline SmoothCamAPI::IVSmoothCam3* SmoothCam = nullptr; | ||
static inline DODGEFRAMEWORK_API::IVDodgeFramework1* DodgeFramework = nullptr; | ||
static inline TRUEHUD_API::IVTrueHUD3* TrueHUD = nullptr; | ||
|
||
static void RequestAPIs(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
|
||
/* | ||
* For modders: Copy this file into your own project if you wish to use this API | ||
*/ | ||
namespace DODGEFRAMEWORK_API | ||
{ | ||
constexpr const auto DodgeFrameworkPluginName = "DodgeFramework"; | ||
|
||
// Available Dodge Framework interface versions | ||
enum class InterfaceVersion : uint8_t | ||
{ | ||
V1 | ||
}; | ||
|
||
// Dodge Framework's modder interface | ||
class IVDodgeFramework1 | ||
{ | ||
public: | ||
// just a stub, API is WIP | ||
}; | ||
|
||
typedef void* (*_RequestPluginAPI)(const InterfaceVersion interfaceVersion); | ||
|
||
/// <summary> | ||
/// Request the Dodge Framework API interface. | ||
/// Recommended: Send your request when you need to use the API and cache the pointer. SKSEMessagingInterface::kMessage_PostLoad seems to be unreliable for some users for unknown reasons. | ||
/// </summary> | ||
/// <param name="a_interfaceVersion">The interface version to request</param> | ||
/// <returns>The pointer to the API singleton, or nullptr if request failed</returns> | ||
[[nodiscard]] inline void* RequestPluginAPI(const InterfaceVersion a_interfaceVersion = InterfaceVersion::V1) | ||
{ | ||
auto pluginHandle = GetModuleHandleA("DodgeFramework.dll"); | ||
_RequestPluginAPI requestAPIFunction = (_RequestPluginAPI)GetProcAddress(pluginHandle, "RequestPluginAPI"); | ||
if (requestAPIFunction) { | ||
return requestAPIFunction(a_interfaceVersion); | ||
} | ||
return nullptr; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.