Ported Enderal DLL to CommonLibSSE-NG:

- Cross-runtime build, tested on SE and AE
- Intergrated Flat Map Markers and Stay At The System Page
- Added tons of sanity checks
- Automatically overrides bFreebiesSeen, bInvalidateOlderFiles, and bModManagerMenuEnabled INI values
This commit is contained in:
Eddoursul 2022-07-31 20:55:11 +02:00
parent a9b880e1ee
commit f2150e94ef
468 changed files with 2570 additions and 76919 deletions

BIN
SKSE/Plugins/EnderalSE.dll (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
FlatMapMarkers = true
StayAtSystemPage = true

View File

@ -1,10 +0,0 @@
{
"whiteListedWorldSpaces": [
{
"name": "Vyn, Enderal",
"editorID": "Vyn",
"markerHeight": 100000.156250,
"enabled": true
}
]
}

BIN
SKSE/Plugins/fs.dll (Stored with Git LFS)

Binary file not shown.

BIN
SKSE/Plugins/fs_se.dll (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
source/Enderal DLL/.clang-format (Stored with Git LFS) Normal file

Binary file not shown.

539
source/Enderal DLL/.gitignore vendored Normal file
View File

@ -0,0 +1,539 @@
# Created by https://www.toptal.com/developers/gitignore/api/clion,visualstudio,visualstudiocode,cmake
# Edit at https://www.toptal.com/developers/gitignore?templates=clion,visualstudio,visualstudiocode,cmake
### CLion ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.vscode/
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### CLion Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
### CMake Patch ###
# External projects
*-prefix/
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# Local History for Visual Studio Code
.history/
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# Support for Project snippet scope
!.vscode/*.code-snippets
### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Nuget personal access tokens and Credentials
# nuget.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
# Local History for Visual Studio Code
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
.idea/
*.sln.iml
### VisualStudio Patch ###
# Additional files built by Visual Studio
# End of https://www.toptal.com/developers/gitignore/api/clion,visualstudio,visualstudiocode,cmake
build/
contrib/Distribution/**/*.dll
contrib/Distribution/**/*.pdb
contrib/Distribution/**/*.pex

View File

@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 3.21)
message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
########################################################################################################################
## Define project
########################################################################################################################
project(
EnderalSE
VERSION 1.0.0
DESCRIPTION "Enderal SE DLL"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
include(GNUInstallDirs)
find_path(SIMPLEINI_INCLUDE_DIRS "ConvertUTF.c")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY)
set(sources
src/Main.cpp
src/EventListener.cpp
src/Papyrus.cpp
${CMAKE_CURRENT_BINARY_DIR}/version.rc)
source_group(
TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES
${headers}
${sources})
########################################################################################################################
## Configure target DLL
########################################################################################################################
find_package(CommonLibSSE CONFIG REQUIRED)
add_commonlibsse_plugin(${PROJECT_NAME} SOURCES ${headers} ${sources})
add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}")
target_include_directories(${PROJECT_NAME}
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
$<INSTALL_INTERFACE:src>
${SIMPLEINI_INCLUDE_DIRS}
)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_precompile_headers(${PROJECT_NAME}
PRIVATE
src/PCH.h)
install(TARGETS ${PROJECT_NAME}
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
########################################################################################################################
## Automatic plugin deployment
########################################################################################################################
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/../../SKSE/Plugins/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> "${CMAKE_CURRENT_SOURCE_DIR}/../../SKSE/Plugins/")

View File

@ -0,0 +1,252 @@
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "base",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_FLAGS": "$env{COMMONLIBSSE_COMPILER} $env{COMMONLIBSSE_PLATFORM} $env{COMMONLIBSSE_TEXT}"
}
},
{
"name": "vcpkg",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_TRIPLET": "x64-windows-skse",
"VCPKG_HOST_TRIPLET": "x64-windows-skse",
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/cmake",
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
}
},
{
"name": "win32",
"hidden": true,
"environment": {
"COMMONLIBSSE_PLATFORM": "-DWIN32_LEAN_AND_MEAN -DNOMINMAX"
}
},
{
"name": "win32-unicode",
"hidden": true,
"inherits": "win32",
"environment": {
"COMMONLIBSSE_TEXT": "-DUNICODE -D_UNICODE"
}
},
{
"name": "x64",
"hidden": true,
"architecture": {
"value": "x64",
"strategy": "external"
}
},
{
"name": "msvc",
"hidden": true,
"environment": {
"COMMONLIBSSE_COMPILER": "/permissive- /Zc:preprocessor /EHsc $penv{CXXFLAGS}"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-msvc-x64",
"enableMicrosoftCodeAnalysis": true,
"enableClangTidyCodeAnalysis": true
}
}
},
{
"name": "clang-cl",
"hidden": true,
"cacheVariables": {
"CMAKE_C_COMPILER": "clang-cl",
"CMAKE_CXX_COMPILER": "clang-cl"
},
"environment": {
"COMMONLIBSSE_COMPILER": "/permissive- /EHsc -Wno-overloaded-virtual -Wno-delete-non-abstract-non-virtual-dtor -D__cpp_lib_char8_t -D__cpp_consteval -D__cpp_lib_format $penv{CXXFLAGS}"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-clang-x64",
"enableMicrosoftCodeAnalysis": true,
"enableClangTidyCodeAnalysis": true
}
}
},
{
"name": "build-tests",
"displayName": "Build Tests",
"hidden": true,
"description": "Include test suites in the build.",
"cacheVariables": {
"BUILD_TESTS": {
"type": "STRING",
"value": "ON"
}
}
},
{
"name": "build-release-msvc",
"inherits": [
"base",
"vcpkg",
"win32-unicode",
"x64",
"build-tests",
"msvc"
],
"displayName": "Release",
"description": "Optimized release build.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/release-msvc",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Release"
}
}
},
{
"name": "build-debug-msvc",
"inherits": [
"base",
"vcpkg",
"win32-unicode",
"x64",
"build-tests",
"msvc"
],
"displayName": "Debug",
"description": "Debug build for testing.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/debug-msvc",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Debug"
}
}
},
{
"name": "build-debug-clang-cl",
"inherits": [
"base",
"vcpkg",
"win32-unicode",
"x64",
"build-tests",
"clang-cl"
],
"displayName": "Debug",
"description": "Debug build for testing.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/debug-clang",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Debug"
}
}
},
{
"name": "build-release-clang-cl",
"inherits": [
"base",
"vcpkg",
"win32-unicode",
"x64",
"build-tests",
"clang-cl"
],
"displayName": "Release",
"description": "Optimized release build.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/release-clang",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Release"
}
}
}
],
"buildPresets": [
{
"name": "release-msvc",
"displayName": "Release (MSVC)",
"configurePreset": "build-release-msvc",
"description": "Optimized release build."
},
{
"name": "debug-msvc",
"displayName": "Debug (MSVC)",
"configurePreset": "build-debug-msvc",
"description": "Debug build for testing."
},
{
"name": "release-clang-cl",
"displayName": "Release (Clang)",
"configurePreset": "build-release-clang-cl",
"description": "Optimized release build."
},
{
"name": "debug-clang-cl",
"displayName": "Debug (Clang)",
"configurePreset": "build-debug-clang-cl",
"description": "Debug build for testing."
}
],
"testPresets": [
{
"name": "tests-all",
"displayName": "All Tests",
"configurePreset": "build-debug-msvc",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": false
}
},
{
"name": "tests-unit",
"displayName": "Unit Tests",
"description": "Runs tests that do not require any Skyrim module loaded into the process.",
"inherits": "tests-all",
"filter": {
"exclude": {
"label": "[integration],[e2e]"
}
}
},
{
"name": "tests-integration",
"displayName": "Integration Tests",
"description": "Runs tests that interact with a Skyrim module at rest (do not require the Skyrim module to have run any main function).",
"inherits": "tests-all",
"filter": {
"include": {
"label": "[integration]"
}
}
},
{
"name": "tests-e2e",
"displayName": "End-to-End Tests",
"description": "Runs test that depend on a fully running Skyrim engine in the process.",
"inherits": "tests-all",
"filter": {
"include": {
"label": "[e2e]"
}
}
}
]
}

BIN
source/Enderal DLL/cmake/version.rc.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
source/Enderal DLL/cmake/x64-windows-skse.cmake (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,13 +1,60 @@
#pragma once
#include "skse64/GameForms.h"
static bool bMessageShown = false;
inline bool HasInvalidCells()
static std::unordered_set<std::string> aModNames;
inline void NotifyInvalidForm(const RE::TESForm* form)
{
if (!form) {
if (!bMessageShown) {
bMessageShown = true;
RE::DebugMessageBox("Some of the installed mods are incompatible with Enderal.");
}
return;
}
if (!bMessageShown) {
bMessageShown = true;
RE::DebugMessageBox(std::format("{} is incompatible with Enderal.\nCheck console for the list of flagged mods.", form->GetFile()->fileName).c_str());
RE::ConsoleLog::GetSingleton()->Print("Some of the installed mods are incompatible! This list is not exhaustive, always use xEdit to verify mod compatibility.");
}
if (!aModNames.contains(form->GetFile()->fileName)) {
aModNames.insert(form->GetFile()->fileName);
RE::ConsoleLog::GetSingleton()->Print(std::format("{} is incompatible", form->GetFile()->fileName).c_str());
}
}
inline void CheckWorldspaces()
{
auto* form = RE::TESForm::LookupByID(0x3C); // Tamriel
if (form) {
RE::TESWorldSpace* world = form->As<RE::TESWorldSpace>();
if (!world || std::string(world->editorID) != "MQP01Home") {
NotifyInvalidForm(form);
}
} else {
if (!bMessageShown) {
bMessageShown = true;
RE::ConsoleLog::GetSingleton()->Print("Some of the installed mods are incompatible! This list is not exhaustive, always use xEdit to verify mod compatibility.");
RE::DebugMessageBox("Some of the installed mods are incompatible with Enderal.");
}
}
form = RE::TESForm::LookupByID(0x16BB4); // RiftenWorld
RE::TESWorldSpace* world = form ? form->As<RE::TESWorldSpace>() : nullptr;
if (world) {
NotifyInvalidForm(form);
}
}
inline void CheckSkyrimCells()
{
// FormIDs of all Skyrim cells.
// 9 of them are commented out, because they are cells in Enderal as well.
UInt32 formids[582] = {
uint32_t formids[582] = {
0x0004B8FB,
0x000352C7,
0x000161E7,
@ -600,13 +647,452 @@ inline bool HasInvalidCells()
0x00027D1C
};
bool result = false;
for (int i = 0; i < 582; i++) {
if ((TESObjectCELL*)LookupFormByID(formids[i])) {
_MESSAGE("Detected invalid cell: %#08x", formids[i]);
result = true;
const auto* form = RE::TESForm::LookupByID(formids[i]);
if (form && form->Is(RE::FormType::Cell)) {
logger::warn("Detected invalid cell: {:08X}", formids[i]);
NotifyInvalidForm(form);
}
}
return result;
//memset(formids, 0, sizeof(formids));
}
inline void CheckEnderalCells()
{
// FormIDs of all Enderal cells.
uint32_t formids[415] = {
0x0014DB0F,
0x00114BBB,
0x00108AC3,
0x00106863,
0x000E67E3,
0x000DCBA3,
0x000A1E3B,
0x0008320B,
0x0006A8AF,
0x00050B67,
0x00043DEF,
0x0003E737,
0x000E4961,
0x00030F8D,
0x0014F6B7,
0x001080EB,
0x0008613B,
0x0010E671,
0x000ED971,
0x000EB581,
0x000C0E35,
0x00055DB5,
0x0012F42F,
0x000905FF,
0x00069C6B,
0x00012C3B,
0x000DABCD,
0x00081299,
0x0005C971,
0x0004D5B1,
0x000E2CAB,
0x0005530B,
0x000299C7,
0x0007F65B,
0x0007336F,
0x0005BCD3,
0x0013FB45,
0x0011C4DD,
0x000A5F1D,
0x00072B95,
0x00069C9D,
0x00149B58,
0x0012DAE8,
0x000E4960,
0x000B5264,
0x0009B710,
0x000ED97A,
0x000C0E3E,
0x0009FD56,
0x00024BCE,
0x000C0E34,
0x0008783C,
0x000528F8,
0x00033494,
0x00009900,
0x000EA95A,
0x000C566E,
0x0004145E,
0x00015282,
0x000FE108,
0x0007FBF0,
0x000098EC,
0x0011DC6A,
0x00102DF2,
0x00074AF2,
0x0005530A,
0x000299C6,
0x00010A84,
0x0014B5A2,
0x0007F65A,
0x0007336E,
0x0006C032,
0x00030FAA,
0x0012EF4C,
0x0011C4DC,
0x000A5F1C,
0x00096D50,
0x0004BC88,
0x00046ECC,
0x00130C29,
0x00070799,
0x00149B57,
0x000E495F,
0x000A5C4B,
0x00074547,
0x00004E77,
0x000ED979,
0x000C0E3D,
0x0009FD55,
0x00024BCD,
0x001461D7,
0x0008783B,
0x000528F7,
0x00033493,
0x000D9B6D,
0x000C566D,
0x0007FA69,
0x0004145D,
0x000375C5,
0x00032999,
0x000D8E1B,
0x000D89CF,
0x0006FECF,
0x001344F5,
0x00127E21,
0x0011DC69,
0x00102DF1,
0x000CBEA5,
0x00074AF1,
0x00033B19,
0x00000025,
0x0011847B,
0x0006E4F3,
0x000169D3,
0x00089B95,
0x000028B1,
0x000A5F1B,
0x00083213,
0x00069C9B,
0x00130C28,
0x000E495E,
0x0009B70E,
0x00147F2C,
0x00117890,
0x000ED978,
0x000C0E3C,
0x00055DBC,
0x00024BCC,
0x0008783A,
0x000250D6,
0x00127538,
0x000D9B6C,
0x000813CC,
0x00045A48,
0x00021634,
0x00014B78,
0x0011B1DE,
0x0006FECE,
0x000399AA,
0x000098EA,
0x00127E20,
0x0011DC68,
0x00102DF0,
0x000CBEA4,
0x000A5894,
0x00067288,
0x0011847A,
0x0006E4F2,
0x00089B94,
0x0007336C,
0x0004C26C,
0x00083212,
0x0003C4DE,
0x00128CCF,
0x000D340F,
0x000E495D,
0x000A82F5,
0x000405A1,
0x00147F2B,
0x0013D0F3,
0x000ED977,
0x000D24BF,
0x000C0E3B,
0x00055DBB,
0x0009710D,
0x00015671,
0x00098553,
0x000813CB,
0x0015295D,
0x0012AB15,
0x00085A75,
0x0006FECD,
0x000399A9,
0x000098E9,
0x00127E1F,
0x0011DC67,
0x000A5893,
0x000848D7,
0x0007075B,
0x00067287,
0x001130E1,
0x0010FF45,
0x0010A829,
0x000DD775,
0x000CEB85,
0x000CD6D1,
0x0006E4F1,
0x000DEDAF,
0x000A19FF,
0x00089B93,
0x0004C26B,
0x0002BA7F,
0x000BCB8D,
0x00083211,
0x0004B25D,
0x001503AA,
0x0013F5BE,
0x0013B612,
0x00128CCE,
0x000CAFA2,
0x000E495C,
0x0009B70C,
0x00020AFC,
0x0010D1C2,
0x000ED976,
0x000D24BE,
0x000C0E3A,
0x000AECC6,
0x00055DBA,
0x00009906,
0x001514BC,
0x0009855C,
0x0009710C,
0x00090988,
0x0006C768,
0x00036A14,
0x000098FC,
0x000E041A,
0x000D9B6A,
0x00082432,
0x0015295C,
0x0012AB14,
0x0010BBC4,
0x00085A74,
0x0006FECC,
0x000098E8,
0x0014E5BE,
0x00127E1E,
0x001152E6,
0x000848D6,
0x001130E0,
0x000CEB84,
0x0007D400,
0x00076E70,
0x0006E4F0,
0x000EFFE6,
0x000DEDAE,
0x000E1A2C,
0x000CC974,
0x000BCB8C,
0x00083210,
0x00128CCD,
0x00119B01,
0x000CAFA1,
0x000A9EB9,
0x00078625,
0x000E495B,
0x000DE74F,
0x000B525F,
0x0009B70B,
0x00020AFB,
0x0000990F,
0x00143B31,
0x0010D1C1,
0x000ED975,
0x000D74D1,
0x000D24BD,
0x000AECC5,
0x0008D791,
0x00055DB9,
0x00009905,
0x00133E07,
0x0011267B,
0x000C6677,
0x0009855B,
0x0009710B,
0x00090987,
0x00143479,
0x0011F9C5,
0x000D9B69,
0x0015295B,
0x00102947,
0x000C3913,
0x00089123,
0x00085A73,
0x0006FECB,
0x0013CA25,
0x00129141,
0x00127E1D,
0x000848D5,
0x00056A11,
0x0013CF2F,
0x001130DF,
0x000CEB83,
0x0008E957,
0x0007D3FF,
0x00079F43,
0x0006E4EF,
0x000DEDAD,
0x00086739,
0x000BCB8B,
0x0008320F,
0x00144954,
0x000A9EB8,
0x0007EB50,
0x0001CB58,
0x000E495A,
0x000DE74E,
0x000B525E,
0x00004382,
0x00143B30,
0x000ED974,
0x000D24BC,
0x000C0E38,
0x000AECC4,
0x0005A728,
0x00055DB8,
0x00022904,
0x00009904,
0x00133E06,
0x0012E492,
0x000C6676,
0x0009855A,
0x0009710A,
0x00069C6E,
0x00019C50,
0x0015295A,
0x0012AB12,
0x0006FECA,
0x000098E6,
0x000FF034,
0x000EB818,
0x000C91B4,
0x0009B228,
0x000848D4,
0x001130DE,
0x00100C4A,
0x000CEB82,
0x0007D3FE,
0x0006E4EE,
0x0001A01A,
0x0011F744,
0x000DEDAC,
0x00086738,
0x0007BC20,
0x000ACECE,
0x0008320E,
0x00081CF6,
0x00048F32,
0x0003E73A,
0x00011046,
0x000A9EB7,
0x000780AB,
0x000E4959,
0x000B525D,
0x00045101,
0x001461DB,
0x00107EEF,
0x000ED973,
0x000C0E37,
0x000AECC3,
0x0005A727,
0x00055DB7,
0x00034D97,
0x00009903,
0x001514B9,
0x0012E491,
0x00103F39,
0x000C5671,
0x0005AE7F,
0x000A2635,
0x0006FEC9,
0x0003D825,
0x000FF033,
0x000EB817,
0x0009B227,
0x001315A1,
0x00127515,
0x001130DD,
0x00100C49,
0x000DD771,
0x000A51E1,
0x0007A7D9,
0x0012511B,
0x0011C4DF,
0x000F524F,
0x000DEDAB,
0x000ACECD,
0x0008320D,
0x00081CF5,
0x00048F31,
0x0003E739,
0x0013584E,
0x00030F8E,
0x0013EB88,
0x000E77D4,
0x000E4958,
0x0012A552,
0x0010E672,
0x000C0E36,
0x0007284E,
0x001514B8,
0x00136C80,
0x0012E490,
0x000C5670,
0x001421B6,
0x000E040C,
0x00098D14,
0x0005530C,
0x00043A94,
0x000FF032,
0x0009B226,
0x001130DC,
0x000A51E0,
0x0008AD90,
0x0013FB46,
0x001346CE,
0x0011C4DE,
0x000DEDAA,
0x0007B89A,
0x00130C2C,
0x00106864,
0x000DCBA4,
0x000A1E3C,
0x0008320C
};
for (int i = 0; i < 415; i++) {
const auto* form = RE::TESForm::LookupByID(formids[i]);
if (!form) {
if (!bMessageShown) {
bMessageShown = true;
RE::DebugMessageBox("Some of the installed mods are incompatible with Enderal.\nCheck console for the list of flagged mods.");
}
} else if (!form->Is(RE::FormType::Cell)) {
logger::warn("Detected invalid cell: {:08X}", formids[i]);
NotifyInvalidForm(form);
}
}
//memset(formids, 0, sizeof(formids));
aModNames.clear();
}

View File

@ -0,0 +1,64 @@
#include "EventListener.h"
#include "Util.h"
auto EventListener::GetSingleton() -> EventListener*
{
static EventListener singleton{};
return std::addressof(singleton);
}
void EventListener::Install()
{
RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink<RE::TESContainerChangedEvent>(EventListener::GetSingleton());
RE::UI::GetSingleton()->AddEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
}
auto EventListener::ProcessEvent(
const SKSE::ModCallbackEvent* a_event,
RE::BSTEventSource<SKSE::ModCallbackEvent>* a_eventSource)
-> RE::BSEventNotifyControl
{
//
return RE::BSEventNotifyControl::kContinue;
}
auto EventListener::ProcessEvent(
const RE::TESContainerChangedEvent* a_event,
RE::BSTEventSource<RE::TESContainerChangedEvent>* a_eventSource)
-> RE::BSEventNotifyControl
{
//
return RE::BSEventNotifyControl::kContinue;
}
auto EventListener::ProcessEvent(
const RE::MenuOpenCloseEvent* a_event,
RE::BSTEventSource<RE::MenuOpenCloseEvent>* a_eventSource)
-> RE::BSEventNotifyControl
{
if (a_event->menuName == "ContainerMenu") {
#ifdef _DEBUG
SKSE::log::info("MenuOpenCloseEvent");
#endif
bool bOpening = a_event->opening;
//
}
return RE::BSEventNotifyControl::kContinue;
}
auto EventListener::ProcessEvent(
const RE::TESActivateEvent* a_event,
RE::BSTEventSource<RE::TESActivateEvent>* a_eventSource)
-> RE::BSEventNotifyControl
{
//
return RE::BSEventNotifyControl::kContinue;
}

View File

@ -0,0 +1,42 @@
#pragma once
class EventListener :
public RE::BSTEventSink<SKSE::ModCallbackEvent>,
public RE::BSTEventSink<RE::TESContainerChangedEvent>,
public RE::BSTEventSink<RE::MenuOpenCloseEvent>,
public RE::BSTEventSink<RE::TESActivateEvent>
{
public:
~EventListener() = default;
EventListener(const EventListener&) = delete;
EventListener& operator=(const EventListener&) = delete;
EventListener& operator=(EventListener&&) = delete;
static auto GetSingleton() -> EventListener*;
static void Install();
auto ProcessEvent(
const RE::TESContainerChangedEvent* a_event,
RE::BSTEventSource<RE::TESContainerChangedEvent>* a_eventSource)
-> RE::BSEventNotifyControl override;
auto ProcessEvent(
const RE::MenuOpenCloseEvent* a_event,
RE::BSTEventSource<RE::MenuOpenCloseEvent>* a_eventSource)
-> RE::BSEventNotifyControl override;
auto ProcessEvent(
const SKSE::ModCallbackEvent* a_event,
RE::BSTEventSource<SKSE::ModCallbackEvent>* a_eventSource)
-> RE::BSEventNotifyControl override;
auto ProcessEvent(
const RE::TESActivateEvent* a_event,
RE::BSTEventSource<RE::TESActivateEvent>* a_eventSource)
-> RE::BSEventNotifyControl override;
private:
EventListener() = default;
};

View File

@ -0,0 +1,20 @@
#pragma once
#include "Util.h"
// Based on Ryan McKenzie's Flat Map Markers
namespace FlatMapMarkers
{
inline void Hook_WorldPtToScreenPt3(RE::NiCamera* a_camera, RE::NiPoint3& a_in, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance)
{
a_in.z = 100000.156250;
RE::NiCamera::WorldPtToScreenPt3(a_camera->GetRuntimeData().worldToCam, a_camera->GetRuntimeData2().port, a_in, a_xOut, a_yOut, a_zOut, a_zeroTolerance);
}
inline void Install()
{
REL::Relocation<std::uintptr_t> offset{ RELOCATION_ID(52224, 53111), IsSE() ? 0x22F : 0x21F };
auto& trampoline = SKSE::GetTrampoline();
trampoline.write_call<5>(offset.address(), &Hook_WorldPtToScreenPt3);
}
}