Skip to content

Commit

Permalink
Merge pull request #10 from alandtse/master
Browse files Browse the repository at this point in the history
Fix VR LoadDoorPrompt for left hand
  • Loading branch information
powerof3 authored Dec 17, 2023
2 parents 850f80f + 3b163b5 commit 9aadece
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 89 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Run clang-format
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-12 -style=file -i
- name: Run clang-format
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i

- name: Glob files
run: python ${{ github.workspace }}/ProjectGen.py
- name: Glob files
run: python ${{ github.workspace }}/ProjectGen.py

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: maintenance
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: maintenance
110 changes: 52 additions & 58 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@ cmake_minimum_required(VERSION 3.20)
set(NAME "po3_Tweaks" CACHE STRING "")
set(VERSION 1.8.1 CACHE STRING "")
set(AE_VERSION 1)
set(VR_VERSION 1)
set(VR_VERSION 2)

# ---- Options ----

option(COPY_BUILD "Copy the build output to the Skyrim directory." TRUE)
option(BUILD_SKYRIMVR "Build for Skyrim VR" OFF)
option(BUILD_SKYRIMAE "Build for Skyrim AE" OFF)

# ---- Cache build vars ----

macro(set_from_environment VARIABLE)
if (NOT DEFINED ${VARIABLE} AND DEFINED ENV{${VARIABLE}})
if(NOT DEFINED ${VARIABLE} AND DEFINED ENV{${VARIABLE}})
set(${VARIABLE} $ENV{${VARIABLE}})
endif ()
endif()
endmacro()

macro(find_commonlib_path)
if (CommonLibName AND NOT ${CommonLibName} STREQUAL "")
if(CommonLibName AND NOT ${CommonLibName} STREQUAL "")
# Check extern
find_path(CommonLibPath
include/REL/Relocation.h
PATHS external/${CommonLibName}
include/REL/Relocation.h
PATHS external/${CommonLibName}
extern/${CommonLibName})
if (${CommonLibPath} STREQUAL "CommonLibPath-NOTFOUND")
#Check path

if(${CommonLibPath} STREQUAL "CommonLibPath-NOTFOUND")
# Check path
set_from_environment(${CommonLibName}Path)
set(CommonLibPath ${${CommonLibName}Path})
endif()
endif()
endmacro()

set_from_environment(VCPKG_ROOT)

if(BUILD_SKYRIMAE)
add_compile_definitions(SKYRIM_AE)
add_compile_definitions(SKYRIM_SUPPORT_AE)
Expand All @@ -56,27 +56,27 @@ else()
set(SkyrimPath ${Skyrim64Path})
set(SkyrimVersion "Skyrim SSE")
endif()

find_commonlib_path()
message(
STATUS
"Building ${NAME} ${VERSION} for ${SkyrimVersion} at ${SkyrimPath} with ${CommonLibName} at ${CommonLibPath}."
)

if (DEFINED VCPKG_ROOT)
if(DEFINED VCPKG_ROOT)
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
else ()
else()
message(
WARNING
"Variable VCPKG_ROOT is not set. Continuing without vcpkg."
)
endif ()
endif()

set(Boost_USE_STATIC_RUNTIME OFF CACHE BOOL "")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "")

# ---- Project ----

project(
${NAME}
VERSION ${VERSION}
Expand All @@ -96,38 +96,35 @@ configure_file(
)

# ---- Include guards ----

if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif()

# ---- Globals ----

add_compile_definitions(
SKSE_SUPPORT_XBYAK
)

if (MSVC)
if (NOT ${CMAKE_GENERATOR} STREQUAL "Ninja")
if(MSVC)
if(NOT ${CMAKE_GENERATOR} STREQUAL "Ninja")
add_compile_options(
/MP # Build with Multiple Processes
/MP # Build with Multiple Processes
)
endif ()
endif ()
endif()
endif()

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF)

set(Boost_USE_STATIC_LIBS ON)

# ---- Dependencies ----

if (DEFINED CommonLibPath AND NOT ${CommonLibPath} STREQUAL "" AND IS_DIRECTORY ${CommonLibPath})
if(DEFINED CommonLibPath AND NOT ${CommonLibPath} STREQUAL "" AND IS_DIRECTORY ${CommonLibPath})
add_subdirectory(${CommonLibPath} ${CommonLibName})
else ()
else()
message(
FATAL_ERROR
"Variable ${CommonLibName}Path is not set."
Expand All @@ -138,27 +135,25 @@ find_package(unordered_dense CONFIG REQUIRED)
find_path(CLIB_UTIL_INCLUDE_DIRS "ClibUtil/utils.hpp")

# ---- Add source files ----

include(cmake/headerlist.cmake)
include(cmake/sourcelist.cmake)

source_group(
TREE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
FILES
${headers}
${sources}
${headers}
${sources}
)

source_group(
TREE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
FILES
${CMAKE_CURRENT_BINARY_DIR}/include/Version.h
${CMAKE_CURRENT_BINARY_DIR}/include/Version.h
)

# ---- Create DLL ----

add_library(
${PROJECT_NAME}
SHARED
Expand All @@ -173,75 +168,74 @@ add_library(
target_compile_features(
${PROJECT_NAME}
PRIVATE
cxx_std_23
cxx_std_23
)

target_compile_definitions(
${PROJECT_NAME}
PRIVATE
_UNICODE
_UNICODE
)

target_include_directories(
${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CLIB_UTIL_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CLIB_UTIL_INCLUDE_DIRS}
)

target_link_libraries(
${PROJECT_NAME}
PRIVATE
${CommonLibName}::${CommonLibName}
unordered_dense::unordered_dense
${CommonLibName}::${CommonLibName}
unordered_dense::unordered_dense
)

target_precompile_headers(
${PROJECT_NAME}
PRIVATE
src/PCH.h
src/PCH.h
)

if (MSVC)
if(MSVC)
target_compile_options(
${PROJECT_NAME}
PRIVATE
/sdl # Enable Additional Security Checks
/utf-8 # Set Source and Executable character sets to UTF-8
/Zi # Debug Information Format
/sdl # Enable Additional Security Checks
/utf-8 # Set Source and Executable character sets to UTF-8
/Zi # Debug Information Format

/permissive- # Standards conformance
/Zc:preprocessor # Enable preprocessor conformance mode
/permissive- # Standards conformance
/Zc:preprocessor # Enable preprocessor conformance mode

/wd4200 # nonstandard extension used : zero-sized array in struct/union
/wd4200 # nonstandard extension used : zero-sized array in struct/union

"$<$<CONFIG:DEBUG>:>"
"$<$<CONFIG:RELEASE>:/Zc:inline;/JMC-;/Ob3>"
"$<$<CONFIG:DEBUG>:>"
"$<$<CONFIG:RELEASE>:/Zc:inline;/JMC-;/Ob3>"
)

target_link_options(
${PROJECT_NAME}
PRIVATE
"$<$<CONFIG:DEBUG>:/INCREMENTAL;/OPT:NOREF;/OPT:NOICF>"
"$<$<CONFIG:RELEASE>:/INCREMENTAL:NO;/OPT:REF;/OPT:ICF;/DEBUG:FULL>"
"$<$<CONFIG:DEBUG>:/INCREMENTAL;/OPT:NOREF;/OPT:NOICF>"
"$<$<CONFIG:RELEASE>:/INCREMENTAL:NO;/OPT:REF;/OPT:ICF;/DEBUG:FULL>"
)
endif ()
endif()

# ---- Post build ----

if (COPY_BUILD)
if (DEFINED SkyrimPath)
if(COPY_BUILD)
if(DEFINED SkyrimPath)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> ${SkyrimPath}/SKSE/Plugins/
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PDB_FILE:${PROJECT_NAME}> ${SkyrimPath}/SKSE/Plugins/
)
else ()
else()
message(

Check warning on line 236 in CMakeLists.txt

View workflow job for this annotation

GitHub Actions / run / se / build

Variable is not defined. Skipping post-build copy command.

Check warning on line 236 in CMakeLists.txt

View workflow job for this annotation

GitHub Actions / run / ae / build

Variable is not defined. Skipping post-build copy command.
WARNING
"Variable ${SkyrimPath} is not defined. Skipping post-build copy command."
)
endif ()
endif ()
endif()
endif()
2 changes: 1 addition & 1 deletion extern/CommonLibVR
Submodule CommonLibVR updated 1446 files
4 changes: 2 additions & 2 deletions src/Fixes/AttachLightHitEffectCrash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Fixes::AttachLightHitEffectCrash
if (a_hitEffect->GetAttached()) {
auto root = a_hitEffect->GetAttachRoot();
if (const auto attachLightObj = root ?
root->GetObjectByName(RE::FixedStrings::GetSingleton()->attachLight) : //crash here because no null check
nullptr) {
root->GetObjectByName(RE::FixedStrings::GetSingleton()->attachLight) : //crash here because no null check
nullptr) {
root = attachLightObj;
}
if (root && root != a_this->attachRoot) {
Expand Down
4 changes: 2 additions & 2 deletions src/Fixes/BreathingSounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace Fixes::BreathingSounds
EventResult ProcessEvent(const RE::TESCellAttachDetachEvent* a_event, RE::BSTEventSource<RE::TESCellAttachDetachEvent>*) override
{
const auto actor = a_event && a_event->reference ?
a_event->reference->As<RE::Actor>() :
nullptr;
a_event->reference->As<RE::Actor>() :
nullptr;

if (actor) {
if (const auto awakeSound = actor->extraList.GetByType<RE::ExtraCreatureAwakeSound>()) {
Expand Down
8 changes: 4 additions & 4 deletions src/Fixes/ReapplySpellsOnLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace Fixes::ReapplyAddedSpells
auto* actor = stl::adjust_pointer<RE::Character>(a_list, -0x70);

if (auto* caster = actor && !actor->IsPlayerRef() && !actor->addedSpells.empty() ?
actor->GetMagicCaster(RE::MagicSystem::CastingSource::kInstant) :
nullptr) {
actor->GetMagicCaster(RE::MagicSystem::CastingSource::kInstant) :
nullptr) {
RE::PermanentMagicFunctor applier{ caster, actor };

if (Compatibility::ScrambledBugs::attachHitEffectArt) {
Expand Down Expand Up @@ -91,8 +91,8 @@ namespace Fixes::ReapplyNoDeathDispelSpells
auto* node = func(a_actor, a_backgroundLoading);

if (auto* caster = node && !a_actor->IsPlayerRef() && a_actor->IsDead() ?
a_actor->GetMagicCaster(RE::MagicSystem::CastingSource::kInstant) :
nullptr) {
a_actor->GetMagicCaster(RE::MagicSystem::CastingSource::kInstant) :
nullptr) {
RE::PermanentMagicFunctor applier{ caster, a_actor };

if (Compatibility::ScrambledBugs::attachHitEffectArt) {
Expand Down
4 changes: 2 additions & 2 deletions src/Tweaks.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ namespace Tweaks
auto result = func(a_this, a_controller);
if (result) {
const auto target = a_controller->handleCount ?
a_controller->cachedTarget :
a_controller->targetHandle.get();
a_controller->cachedTarget :
a_controller->targetHandle.get();

return target && RE::CombatMagicCaster::CheckTargetValid(a_controller, target.get(), a_this);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Tweaks/FactionStealing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace Tweaks::FactionStealing
{
const auto favorCost = GetFavorCost(a_playerBase, a_npc);
return favorCost > 1 ?
a_cost <= favorCost :
false;
a_cost <= favorCost :
false;
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/Tweaks/GrabbingIsStealing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace Tweaks::GrabbingIsStealing
EventResult ProcessEvent(const RE::TESGrabReleaseEvent* a_event, RE::BSTEventSource<RE::TESGrabReleaseEvent>*) override
{
const auto ref = a_event && a_event->grabbed ?
a_event->ref :
RE::TESObjectREFRPtr();
a_event->ref :
RE::TESObjectREFRPtr();

const auto player = RE::PlayerCharacter::GetSingleton();

Expand Down
Loading

0 comments on commit 9aadece

Please sign in to comment.