Merge progress, still lots to do and to continue up the change
parent
37a4b2a103
commit
17a2c81b28
@ -0,0 +1,105 @@
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: false
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: CaseSensitive
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
StatementMacros:
|
||||
- META_Object
|
||||
- META_StateAttribute
|
||||
- META_Node
|
@ -0,0 +1,18 @@
|
||||
Checks: >
|
||||
-*,
|
||||
boost-*,
|
||||
portability-*,
|
||||
clang-analyzer-*,
|
||||
-clang-analyzer-optin*,
|
||||
-clang-analyzer-cplusplus.NewDeleteLeaks,
|
||||
-clang-analyzer-core.CallAndMessage,
|
||||
-modernize-avoid-bind
|
||||
WarningsAsErrors: >
|
||||
-*,
|
||||
boost-*,
|
||||
portability-*,
|
||||
clang-analyzer-*,
|
||||
-clang-analyzer-optin*,
|
||||
-clang-analyzer-cplusplus.NewDeleteLeaks,
|
||||
-clang-analyzer-core.CallAndMessage
|
||||
HeaderFilterRegex: '^(apps|components)'
|
@ -0,0 +1,19 @@
|
||||
# This file lists revisions meant to be ignored by `git blame`.
|
||||
# Pass `--ignore-revs-file .git-blame-ignore-revs` to `git blame` to make your life easier.
|
||||
|
||||
# Author: Alexei Kotov <alexdobrohotov@yandex.ru>
|
||||
# Date: Fri Sep 2 02:52:49 2022 +0000
|
||||
# Reformat NIF record type mapping
|
||||
8df0587793a07ec556dc9cb575cd2af4204c456b
|
||||
|
||||
# Author: AnyOldName3 <krizdjali@gmail.com>
|
||||
# Date: Fri Sep 16 00:53:24 2022 +0100
|
||||
# Renormalise line endings
|
||||
84f8a6848a8b05502d7618ca7af8cca74f2c3bae
|
||||
|
||||
# Author: clang-format-bot <bot@clang-format>
|
||||
# Date: 9/22/2022 9:26:05 PM
|
||||
# Apply clang-format to code base
|
||||
ddb0522bbf2aa8aa7c9e139ff7395fb8ed6a841f
|
||||
|
||||
88ec8a95231341e7962b85716510d414e9f0c424
|
@ -0,0 +1,80 @@
|
||||
name: CMake
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
|
||||
jobs:
|
||||
Ubuntu:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Add OpenMW PPA Dependencies
|
||||
run: sudo add-apt-repository ppa:openmw/openmw; sudo apt-get update
|
||||
|
||||
- name: Install Building Dependencies
|
||||
run: sudo CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic
|
||||
|
||||
- name: Prime ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ matrix.os }}-${{ env.BUILD_TYPE }}
|
||||
max-size: 1000M
|
||||
|
||||
- name: Configure
|
||||
run: cmake . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENMW_USE_SYSTEM_RECASTNAVIGATION=1 -DUSE_SYSTEM_TINYXML=1 -DBUILD_UNITTESTS=1 -DCMAKE_INSTALL_PREFIX=install
|
||||
|
||||
- name: Build
|
||||
run: make -j3
|
||||
|
||||
- name: Test
|
||||
run: ./openmw_test_suite
|
||||
|
||||
# - name: Install
|
||||
# shell: bash
|
||||
# run: cmake --install .
|
||||
|
||||
# - name: Create Artifact
|
||||
# shell: bash
|
||||
# working-directory: install
|
||||
# run: |
|
||||
# ls -laR
|
||||
# 7z a ../build_artifact.7z .
|
||||
|
||||
# - name: Upload Artifact
|
||||
# uses: actions/upload-artifact@v1
|
||||
# with:
|
||||
# path: ./build_artifact.7z
|
||||
# name: build_artifact.7z
|
||||
|
||||
MacOS:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Building Dependencies
|
||||
run: CI/before_install.osx.sh
|
||||
|
||||
- name: Prime ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ matrix.os }}-${{ env.BUILD_TYPE }}
|
||||
max-size: 1000M
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
rm -fr build # remove the build directory
|
||||
CI/before_script.osx.sh
|
||||
- name: Build
|
||||
run: |
|
||||
cd build
|
||||
make -j $(sysctl -n hw.logicalcpu) package
|
@ -0,0 +1,8 @@
|
||||
1471
|
||||
1450
|
||||
1420
|
||||
1314
|
||||
1216
|
||||
1172
|
||||
1160
|
||||
1051
|
@ -1,100 +0,0 @@
|
||||
language: cpp
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- coverity_scan
|
||||
- /openmw-.*$/
|
||||
- /^[0-9]+\.[0-9]+\.[0-9]+.*$/
|
||||
env:
|
||||
global:
|
||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||
# via the "travis encrypt" command using the project repo's public key
|
||||
- secure: "1QK0yVyoOB+gf2I7XzvhXu9w/5lq4stBXIwJbVCTjz4Q4XVHCosURaW1MAgKzMrPnbFEwjyn5uQ8BwsvvfkuN1AZD0YXITgc7gyI+J1wQ/p/ljxRxglakU6WEgsTs2J5z9UmGac4YTXg+quK7YP3rv+zuGim2I2rhzImejyzp0Ym3kRCnNcy+SGBsiRaevRJMe00Ch8zGAbEhduQGeSoS6W0rcu02DNlQKiq5NktWsXR+TWWWVfIeIlQR/lbPsCd0pdxMaMv2QCY0rVbwrYxWJwr/Qe45dAdWp+8/C3PbXpeMSGxlLa33nJNX4Lf/djxbjm8KWk6edaXPajrjR/0iwcpwq0jg2Jt6XfEdnJt35F1gpXlc04sxStjG45uloOKCFYT0wdhIO1Lq+hDP54wypQl+JInd5qC001O7pwhVxO36EgKWqo8HD+BqGDBwsNj2engy9Qcp3wO6G0rLBPB3CrZsk9wrHVv5cSiQSLMhId3Xviu3ZI2qEDA+kgTvxrKrsnMj4bILVCyG5Ka2Mj22wIDW9e8oIab9oTdujax3DTN1GkD6QuOAGzwDsNwGASsgfoeZ+FUhgM75RlBWGMilgkmnF7EJ0oAXLEpjtABnEr2d4qHv+y08kOuTDBLB9ExzCIj024dYYYNLZrqPKx0ncHuCMG2QNj2aJAJEZtj1rQ="
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:openmw/openmw'
|
||||
- ubuntu-toolchain-r-test
|
||||
packages: [
|
||||
# Dev
|
||||
cmake, clang-tools-7, gcc-8, g++-8, ccache,
|
||||
# Boost
|
||||
libboost-filesystem-dev, libboost-iostreams-dev, libboost-program-options-dev, libboost-system-dev,
|
||||
# FFmpeg
|
||||
libavcodec-dev, libavformat-dev, libavutil-dev, libswresample-dev, libswscale-dev,
|
||||
# Audio, Video and Misc. deps
|
||||
libsdl2-dev, libqt5opengl5-dev, libopenal-dev, libunshield-dev, libtinyxml-dev, liblz4-dev,
|
||||
# The other ones from OpenMW ppa
|
||||
libbullet-dev, libopenscenegraph-3.4-dev, libmygui-dev,
|
||||
# tes3mp stuff
|
||||
libboost-dev, libqt5opengl5-dev, libluajit-5.1-dev
|
||||
]
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "TES3MP/openmw-tes3mp"
|
||||
description: "<Your project description here>"
|
||||
branch_pattern: coverity_scan
|
||||
notification_email: koncord@tes3mp.com
|
||||
build_command_prepend: "cov-configure --comptype gcc --compiler gcc-8 --template; cmake . -DBUILD_UNITTESTS=FALSE -DBUILD_OPENCS=FALSE -DBUILD_BSATOOL=FALSE -DBUILD_ESMTOOL=FALSE -DBUILD_MWINIIMPORTER=FALSE -DBUILD_LAUNCHER=FALSE"
|
||||
build_command: "make VERBOSE=1 -j3"
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env:
|
||||
- ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7 "
|
||||
- MATRIX_CC="CC=clang-7 && CXX=clang++-7"
|
||||
compiler: clang
|
||||
sudo: required
|
||||
dist: bionic
|
||||
- os: linux
|
||||
env:
|
||||
- MATRIX_CC="CC=gcc-8 && CXX=g++-8"
|
||||
sudo: required
|
||||
dist: bionic
|
||||
- os: linux
|
||||
env:
|
||||
- MATRIX_CC="CC=clang-7 && CXX=clang++-7"
|
||||
sudo: required
|
||||
dist: bionic
|
||||
allow_failures:
|
||||
- env:
|
||||
- MATRIX_CC="CC=clang-7 && CXX=clang++-7"
|
||||
- env:
|
||||
- ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7 "
|
||||
- MATRIX_CC="CC=clang-7 && CXX=clang++-7"
|
||||
|
||||
before_install:
|
||||
- ./CI/before_install.${TRAVIS_OS_NAME}.sh
|
||||
before_script:
|
||||
- ccache -z
|
||||
- ./CI/before_script.${TRAVIS_OS_NAME}.sh
|
||||
script:
|
||||
- cd ./build
|
||||
- ${ANALYZE} make -j3; fi
|
||||
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi
|
||||
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ../CI/check_package.osx.sh; fi
|
||||
- if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TESTS_ONLY}" ]; then ./openmw_test_suite; fi
|
||||
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi
|
||||
- cd "${TRAVIS_BUILD_DIR}"
|
||||
- ccache -s
|
||||
#deploy:
|
||||
# provider: script
|
||||
# script: ./CI/deploy.osx.sh
|
||||
# skip_cleanup: true
|
||||
# on:
|
||||
# branch: master
|
||||
# condition: "$TRAVIS_EVENT_TYPE = cron && $TRAVIS_OS_NAME = osx"
|
||||
# repo: TES3MP/openmw-tes3mp
|
||||
#notifications:
|
||||
# email:
|
||||
# recipients:
|
||||
# - corrmage+travis-ci@gmail.com
|
||||
# on_success: change
|
||||
# on_failure: always
|
||||
# irc:
|
||||
# channels:
|
||||
# - "chat.freenode.net#openmw"
|
||||
# on_success: change
|
||||
# on_failure: always
|
||||
# use_notice: true
|
@ -1,53 +0,0 @@
|
||||
*** PLEASE PUT YOUR ISSUE DESCRIPTION FOR DUMMIES HERE FOR REVIEW ***
|
||||
|
||||
- I'm just a placeholder description (#1337)
|
||||
- I'm also just a placeholder description, but I'm a more recent one (#42)
|
||||
|
||||
***
|
||||
|
||||
0.47.0
|
||||
------
|
||||
|
||||
The OpenMW team is proud to announce the release of version 0.47.0! Grab it from our Downloads Page for all operating systems. ***short summary: XXX ***
|
||||
|
||||
Check out the release video (***add link***) and the OpenMW-CS release video (***add link***) by the ***add flattering adjective*** Atahualpa, and see below for the full list of changes.
|
||||
|
||||
Known Issues:
|
||||
- To use generic Linux binaries, Qt4 and libpng12 must be installed on your system
|
||||
- On macOS, launching OpenMW from OpenMW-CS requires OpenMW.app and OpenMW-CS.app to be siblings
|
||||
|
||||
New Features:
|
||||
- Dialogue to split item stacks now displays the name of the trapped soul for stacks of soul gems (#5362)
|
||||
- Basics of Collada animations are now supported via osgAnimation plugin (#5456)
|
||||
|
||||
New Editor Features:
|
||||
- Instance selection modes are now implemented (centred cube, corner-dragged cube, sphere) with four user-configurable actions (select only, add to selection, remove from selection, invert selection) (#3171)
|
||||
|
||||
Bug Fixes:
|
||||
- NiParticleColorModifier in NIF files is now properly handled which solves issues regarding particle effects, e.g., smoke and fire (#1952, #3676)
|
||||
- Targetting non-unique actors in scripts is now supported (#2311)
|
||||
- Guards no longer ignore attacks of invisible players but rather initiate dialogue and flee if the player resists being arrested (#4774)
|
||||
- Changing the dialogue window without closing it no longer clears the dialogue history in order to allow, e.g., emulation of three-way dialogue via ForceGreeting (#5358)
|
||||
- Scripts which try to start a non-existent global script now skip that step and continue execution instead of breaking (#5364)
|
||||
- Selecting already equipped spells or magic items via hotkey no longer triggers the equip sound to play (#5367)
|
||||
- 'Scale' argument in levelled creature lists is now taken into account when spawning creatures from such lists (#5369)
|
||||
- Morrowind legacy madness: Using a key on a trapped door/container now only disarms the trap if the door/container is locked (#5370)
|
||||
|
||||
Editor Bug Fixes:
|
||||
- Deleted and moved objects within a cell are now saved properly (#832)
|
||||
- Disabled record sorting in Topic and Journal Info tables, implemented drag-move for records (#4357)
|
||||
- Topic and Journal Info records can now be cloned with a different parent Topic/Journal Id (#4363)
|
||||
- Verifier no longer checks for alleged 'race' entries in clothing body parts (#5400)
|
||||
- Cell borders are now properly redrawn when undoing/redoing terrain changes (#5473)
|
||||
- Loading mods now keeps the master index (#5675)
|
||||
- Flicker and crashing on XFCE4 fixed (#5703)
|
||||
- Collada models render properly in the Editor (#5713)
|
||||
- Terrain-selection grid is now properly updated when undoing/redoing terrain changes (#6022)
|
||||
- Tool outline and select/edit actions in "Terrain land editing" mode now ignore references (#6023)
|
||||
- Primary-select and secondary-select actions in "Terrain land editing" mode now behave like in "Instance editing" mode (#6024)
|
||||
- Using the circle brush to select terrain in the "Terrain land editing" mode no longer selects vertices outside the circle (#6035)
|
||||
- Vertices at the NW and SE corners of a cell can now also be selected in "Terrain land editing" mode if the adjacent cells aren't loaded yet (#6036)
|
||||
|
||||
Miscellaneous:
|
||||
- Prevent save-game bloating by using an appropriate fog texture format (#5108)
|
||||
- Ensure that 'Enchantment autocalc" flag is treated as flag in OpenMW-CS and in our esm tools (#5363)
|
@ -0,0 +1,52 @@
|
||||
if (-Not (Test-Path CMakeCache.txt))
|
||||
{
|
||||
Write-Error "This script must be run from the build directory."
|
||||
}
|
||||
|
||||
if (-Not (Test-Path .cmake\api\v1\reply))
|
||||
{
|
||||
New-Item -Type File -Force .cmake\api\v1\query\codemodel-v2
|
||||
cmake .
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Push-Location .cmake\api\v1\reply
|
||||
|
||||
$index = Get-Content -Raw index-*.json | ConvertFrom-Json
|
||||
|
||||
$codemodel = Get-Content -Raw $index.reply."codemodel-v2".jsonFile | ConvertFrom-Json
|
||||
|
||||
$targets = @()
|
||||
$codemodel.configurations | ForEach-Object {
|
||||
$_.targets | ForEach-Object {
|
||||
$target = Get-Content -Raw $_.jsonFile | ConvertFrom-Json
|
||||
if ($target.type -eq "EXECUTABLE" -or $target.type -eq "SHARED_LIBRARY")
|
||||
{
|
||||
$targets += $target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$artifacts = @()
|
||||
$targets | ForEach-Object {
|
||||
$_.artifacts | ForEach-Object {
|
||||
$artifacts += $_.path
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if (-not (Test-Path symstore-venv))
|
||||
{
|
||||
python -m venv symstore-venv
|
||||
}
|
||||
if (-not (Test-Path symstore-venv\Scripts\symstore.exe))
|
||||
{
|
||||
symstore-venv\Scripts\pip install symstore==0.3.3
|
||||
}
|
||||
$artifacts = $artifacts | Where-Object { Test-Path $_ }
|
||||
symstore-venv\Scripts\symstore --compress .\SymStore @artifacts
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/android/openmw-android-deps-20201129.zip -o ~/openmw-android-deps.zip
|
||||
unzip -o ~/openmw-android-deps -d /usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr > /dev/null
|
||||
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/android/openmw-android-deps-20211114.zip -o ~/openmw-android-deps.zip
|
||||
unzip -o ~/openmw-android-deps -d /android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr > /dev/null
|
||||
|
@ -1,22 +1,39 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
# workaround python issue on travis
|
||||
[ -z "${TRAVIS}" ] && HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall --ignore-dependencies python@3.8 || true
|
||||
[ -z "${TRAVIS}" ] && HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall --ignore-dependencies python@3.9 || true
|
||||
[ -z "${TRAVIS}" ] && HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall --ignore-dependencies qt@6 || true
|
||||
export HOMEBREW_NO_EMOJI=1
|
||||
|
||||
brew uninstall --ignore-dependencies python@3.8 || true
|
||||
brew uninstall --ignore-dependencies python@3.9 || true
|
||||
brew uninstall --ignore-dependencies qt@5 || true
|
||||
brew uninstall --ignore-dependencies jpeg || true
|
||||
|
||||
brew tap --repair
|
||||
brew update --quiet
|
||||
|
||||
# Some of these tools can come from places other than brew, so check before installing
|
||||
brew reinstall xquartz fontconfig freetype harfbuzz brotli
|
||||
|
||||
# Fix: can't open file: @loader_path/libbrotlicommon.1.dylib (No such file or directory)
|
||||
BREW_LIB_PATH="$(brew --prefix)/lib"
|
||||
install_name_tool -change "@loader_path/libbrotlicommon.1.dylib" "${BREW_LIB_PATH}/libbrotlicommon.1.dylib" ${BREW_LIB_PATH}/libbrotlidec.1.dylib
|
||||
install_name_tool -change "@loader_path/libbrotlicommon.1.dylib" "${BREW_LIB_PATH}/libbrotlicommon.1.dylib" ${BREW_LIB_PATH}/libbrotlienc.1.dylib
|
||||
|
||||
command -v ccache >/dev/null 2>&1 || brew install ccache
|
||||
command -v cmake >/dev/null 2>&1 || brew install cmake
|
||||
command -v qmake >/dev/null 2>&1 || brew install qt@5
|
||||
export PATH="/usr/local/opt/qt@5/bin:$PATH" # needed to use qmake in none default path as qt now points to qt6
|
||||
command -v qmake >/dev/null 2>&1 || brew install qt@6
|
||||
|
||||
# Install deps
|
||||
brew install icu4c yaml-cpp sqlite
|
||||
|
||||
ccache --version
|
||||
cmake --version
|
||||
qmake --version
|
||||
|
||||
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20210617.zip -o ~/openmw-deps.zip
|
||||
unzip -o ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null
|
||||
if [[ "${MACOS_AMD64}" ]]; then
|
||||
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20221113.zip -o ~/openmw-deps.zip
|
||||
else
|
||||
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20230223_arm64.zip -o ~/openmw-deps.zip
|
||||
fi
|
||||
|
||||
unzip -o ~/openmw-deps.zip -d /tmp > /dev/null
|
||||
|
||||
# additional libraries
|
||||
[ -z "${TRAVIS}" ] && HOMEBREW_NO_AUTO_UPDATE=1 brew install fontconfig
|
@ -1,17 +0,0 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
git clone -b release-1.10.0 https://github.com/google/googletest.git
|
||||
cd googletest
|
||||
mkdir build
|
||||
cd build
|
||||
cmake \
|
||||
-D CMAKE_C_COMPILER="${CC}" \
|
||||
-D CMAKE_CXX_COMPILER="${CXX}" \
|
||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_BUILD_TYPE="${CONFIGURATION}" \
|
||||
-D CMAKE_INSTALL_PREFIX="${GOOGLETEST_DIR}" \
|
||||
-G "${GENERATOR}" \
|
||||
..
|
||||
cmake --build . --config "${CONFIGURATION}" -- -j $(nproc)
|
||||
cmake --install . --config "${CONFIGURATION}"
|
@ -0,0 +1,8 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
set -o pipefail
|
||||
|
||||
CLANG_FORMAT="${CLANG_FORMAT:-clang-format}"
|
||||
git ls-files -- ':(exclude)extern/' '*.cpp' '*.hpp' '*.h' |
|
||||
xargs -I '{}' -P $(nproc) bash -ec "\"${CLANG_FORMAT:?}\" --dry-run -Werror \"\${0:?}\" &> /dev/null || \"${CLANG_FORMAT:?}\" \"\${0:?}\" | git diff --color=always --no-index \"\${0:?}\" -" '{}' ||
|
||||
( echo "clang-format differences detected"; exit -1 )
|
@ -0,0 +1,6 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
git ls-files -- ':(exclude)extern/' 'CMakeLists.txt' '*.cmake' |
|
||||
xargs grep -P '^\s*\t' &&
|
||||
( echo 'CMake files contain leading tab character. Use only spaces for indentation'; exit -1 )
|
||||
exit 0
|
@ -0,0 +1,7 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
git ls-files -- ':(exclude)extern/' '*.cpp' '*.hpp' '*.h' |
|
||||
grep -vP '/[a-z0-9]+\.(cpp|hpp|h)$' |
|
||||
grep -vFf CI/file_name_exceptions.txt &&
|
||||
( echo 'File names do not follow the naming convention, see https://wiki.openmw.org/index.php?title=Naming_Conventions#Files'; exit -1 )
|
||||
exit 0
|
@ -0,0 +1,48 @@
|
||||
apps/openmw/android_main.cpp
|
||||
apps/openmw/mwsound/efx-presets.h
|
||||
apps/openmw/mwsound/ffmpeg_decoder.cpp
|
||||
apps/openmw/mwsound/ffmpeg_decoder.hpp
|
||||
apps/openmw/mwsound/openal_output.cpp
|
||||
apps/openmw/mwsound/openal_output.hpp
|
||||
apps/openmw/mwsound/sound_buffer.cpp
|
||||
apps/openmw/mwsound/sound_buffer.hpp
|
||||
apps/openmw/mwsound/sound_decoder.hpp
|
||||
apps/openmw/mwsound/sound_output.hpp
|
||||
apps/openmw_test_suite/esm/test_fixed_string.cpp
|
||||
apps/openmw_test_suite/files/conversion_tests.cpp
|
||||
apps/openmw_test_suite/lua/test_async.cpp
|
||||
apps/openmw_test_suite/lua/test_configuration.cpp
|
||||
apps/openmw_test_suite/lua/test_l10n.cpp
|
||||
apps/openmw_test_suite/lua/test_lua.cpp
|
||||
apps/openmw_test_suite/lua/test_scriptscontainer.cpp
|
||||
apps/openmw_test_suite/lua/test_serialization.cpp
|
||||
apps/openmw_test_suite/lua/test_storage.cpp
|
||||
apps/openmw_test_suite/lua/test_ui_content.cpp
|
||||
apps/openmw_test_suite/lua/test_utilpackage.cpp
|
||||
apps/openmw_test_suite/misc/test_endianness.cpp
|
||||
apps/openmw_test_suite/misc/test_resourcehelpers.cpp
|
||||
apps/openmw_test_suite/misc/test_stringops.cpp
|
||||
apps/openmw_test_suite/mwdialogue/test_keywordsearch.cpp
|
||||
apps/openmw_test_suite/mwscript/test_scripts.cpp
|
||||
apps/openmw_test_suite/mwscript/test_utils.hpp
|
||||
apps/openmw_test_suite/mwworld/test_store.cpp
|
||||
apps/openmw_test_suite/openmw_test_suite.cpp
|
||||
apps/openmw_test_suite/testing_util.hpp
|
||||
components/bsa/bsa_file.cpp
|
||||
components/bsa/bsa_file.hpp
|
||||
components/crashcatcher/windows_crashcatcher.cpp
|
||||
components/crashcatcher/windows_crashcatcher.hpp
|
||||
components/crashcatcher/windows_crashmonitor.cpp
|
||||
components/crashcatcher/windows_crashmonitor.hpp
|
||||
components/crashcatcher/windows_crashshm.hpp
|
||||
components/fx/lexer_types.hpp
|
||||
components/fx/parse_constants.hpp
|
||||
components/platform/file.posix.cpp
|
||||
components/platform/file.stdio.cpp
|
||||
components/platform/file.win32.cpp
|
||||
components/sdlutil/gl4es_init.cpp
|
||||
components/sdlutil/gl4es_init.h
|
||||
components/to_utf8/gen_iconv.cpp
|
||||
components/to_utf8/tables_gen.hpp
|
||||
components/to_utf8/to_utf8.cpp
|
||||
components/to_utf8/to_utf8.hpp
|
@ -0,0 +1,200 @@
|
||||
---
|
||||
app-id: org.openmw.OpenMW.devel
|
||||
runtime: org.kde.Platform
|
||||
runtime-version: '5.15-21.08'
|
||||
sdk: org.kde.Sdk
|
||||
command: openmw-launcher
|
||||
rename-appdata-file: openmw.appdata.xml
|
||||
finish-args:
|
||||
- "--share=ipc"
|
||||
- "--socket=x11"
|
||||
- "--device=all"
|
||||
- "--filesystem=host"
|
||||
- "--socket=pulseaudio"
|
||||
build-options:
|
||||
cflags: "-O2 -g"
|
||||
cxxflags: "-O2 -g"
|
||||
cleanup:
|
||||
- "/include"
|
||||
- "/lib/pkgconfig"
|
||||
- "/lib/cmake"
|
||||
- "/share/pkgconfig"
|
||||
- "/share/aclocal"
|
||||
- "/share/doc"
|
||||
- "/man"
|
||||
- "/share/man"
|
||||
- "/share/gtk-doc"
|
||||
- "/share/vala"
|
||||
- "*.la"
|
||||
- "*.a"
|
||||
|
||||
modules:
|
||||
- name: boost
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- ./bootstrap.sh --prefix=/app --with-libraries=filesystem,iostreams,program_options,system
|
||||
- ./b2 headers
|
||||
- ./b2 install
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz
|
||||
sha256: aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
|
||||
|
||||
- name: collada-dom
|
||||
buildsystem: cmake-ninja
|
||||
config-opts:
|
||||
- "-DOPT_COLLADA14=1"
|
||||
- "-DOPT_COLLADA15=0"
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/rdiankov/collada-dom/archive/c1e20b7d6ff806237030fe82f126cb86d661f063.zip
|
||||
sha256: 6c51cd068c7d6760b587391884942caaac8a515d138535041e42d00d3e5c9152
|
||||
|
||||
- name: ffmpeg
|
||||
config-opts:
|
||||
- "--disable-static"
|
||||
- "--enable-shared"
|
||||
- "--disable-programs"
|
||||
- "--disable-doc"
|
||||
- "--disable-avdevice"
|
||||
- "--disable-avfilter"
|
||||
- "--disable-postproc"
|
||||
|
||||
- "--disable-encoders"
|
||||
- "--disable-muxers"
|
||||
- "--disable-protocols"
|
||||
- "--disable-indevs"
|
||||
- "--disable-devices"
|
||||
- "--disable-filters"
|
||||
sources:
|
||||
- type: archive
|
||||
url: http://ffmpeg.org/releases/ffmpeg-4.3.2.tar.xz
|
||||
sha256: 46e4e64f1dd0233cbc0934b9f1c0da676008cad34725113fb7f802cfa84ccddb
|
||||
cleanup:
|
||||
- "/share/ffmpeg"
|
||||
|
||||
- name: openscenegraph
|
||||
buildsystem: cmake-ninja
|
||||
config-opts:
|
||||
- "-DBUILD_OSG_PLUGINS_BY_DEFAULT=0"
|
||||
- "-DBUILD_OSG_PLUGIN_OSG=1"
|
||||
- "-DBUILD_OSG_PLUGIN_DDS=1"
|
||||
- "-DBUILD_OSG_PLUGIN_DAE=1"
|
||||
- "-DBUILD_OSG_PLUGIN_TGA=1"
|
||||
- "-DBUILD_OSG_PLUGIN_BMP=1"
|
||||
- "-DBUILD_OSG_PLUGIN_JPEG=1"
|
||||
- "-DBUILD_OSG_PLUGIN_PNG=1"
|
||||
- "-DBUILD_OSG_DEPRECATED_SERIALIZERS=0"
|
||||
- "-DBUILD_OSG_APPLICATIONS=0"
|
||||
- "-DCMAKE_BUILD_TYPE=Release"
|
||||
build-options:
|
||||
env:
|
||||
COLLADA_DIR: /app/include/collada-dom2.5
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/openmw/osg/archive/76e061739610bc9a3420a59e7c9395e742ce2f97.zip
|
||||
sha256: fa1100362eae260192819d65d90b29ec0b88fdf80e30cee677730b7a0d68637e
|
||||
|
||||
- name: bullet
|
||||
# The cmake + ninja buildsystem doesn't install the required binaries correctly
|
||||
buildsystem: cmake
|
||||
config-opts:
|
||||
- "-DBUILD_BULLET2_DEMOS=0"
|
||||
- "-DBUILD_BULLET3=0"
|
||||
- "-DBUILD_CPU_DEMOS=0"
|
||||
- "-DBUILD_EXTRAS=0"
|
||||
- "-DBUILD_OPENGL3_DEMOS=0"
|
||||
- "-DBUILD_UNIT_TESTS=0"
|
||||
- "-DCMAKE_BUILD_TYPE=Release"
|
||||
- "-DUSE_GLUT=0"
|
||||
- "-DUSE_GRAPHICAL_BENCHMARK=0"
|
||||
- "-DUSE_DOUBLE_PRECISION=on"
|
||||
- "-DBULLET2_MULTITHREADING=on"
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/bulletphysics/bullet3/archive/93be7e644024e92df13b454a4a0b0fcd02b21b10.zip
|
||||
sha256: 82968fbf20a92c51bc71ac9ee8f6381ecf3420c7cbb881ffb7bb633fa13b27f9
|
||||
|
||||
- name: mygui
|
||||
buildsystem: cmake-ninja
|
||||
config-opts:
|
||||
- "-DCMAKE_BUILD_TYPE=Release"
|
||||
- "-DMYGUI_RENDERSYSTEM=1"
|
||||
- "-DMYGUI_BUILD_DEMOS=0"
|
||||
- "-DMYGUI_BUILD_TOOLS=0"
|
||||
- "-DMYGUI_BUILD_PLUGINS=0"
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.1.tar.gz
|
||||
sha256: bdf730bdeb4ad89e6b8223967db01aa5274d2b93adc2c0d6aa4842faeed4de1a
|
||||
|
||||
- name: libunshield
|
||||
buildsystem: cmake-ninja
|
||||
config-opts:
|
||||
- "-DCMAKE_BUILD_TYPE=Release"
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/twogood/unshield/archive/1.4.3.tar.gz
|
||||
sha256: aa8c978dc0eb1158d266eaddcd1852d6d71620ddfc82807fe4bf2e19022b7bab
|
||||
|
||||
- name: lz4
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- "make lib"
|
||||
- "PREFIX=/app make install"
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/lz4/lz4/archive/refs/tags/v1.9.3.tar.gz
|
||||
sha256: 030644df4611007ff7dc962d981f390361e6c97a34e5cbc393ddfbe019ffe2c1
|
||||
|
||||
- name: recastnavigation
|
||||
buildsystem: cmake-ninja
|
||||
config-opts:
|
||||
- "-DCMAKE_BUILD_TYPE=Release"
|
||||
- "-DRECASTNAVIGATION_DEMO=no"
|
||||
- "-DRECASTNAVIGATION_TESTS=no"
|
||||
- "-DRECASTNAVIGATION_EXAMPLES=no"
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/recastnavigation/recastnavigation/archive/c5cbd53024c8a9d8d097a4371215e3342d2fdc87.zip
|
||||
sha256: 53dacfd7bead4d3b0c9a04a648caed3e7c3900e0aba765c15dee26b50f6103c6
|
||||
|
||||
- name: yaml-cpp
|
||||
buildsystem: cmake-ninja
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.7.0.zip
|
||||
sha256: 4d5e664a7fb2d7445fc548cc8c0e1aa7b1a496540eb382d137e2cc263e6d3ef5
|
||||
|
||||
- name: LuaJIT
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- make install PREFIX=/app
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/LuaJIT/LuaJIT/archive/refs/tags/v2.0.5.zip
|
||||
sha256: 2adbe397a5b6b8ab22fa8396507ce852a2495db50e50734b3daa1ffcadd9eeb4
|
||||
|
||||
- name: openmw
|
||||
builddir: true
|
||||
buildsystem: cmake-ninja
|
||||
config-opts:
|
||||
- "-DBUILD_BSATOOL=no"
|
||||
- "-DBUILD_ESMTOOL=no"
|
||||
- "-DCMAKE_BUILD_TYPE=Release"
|
||||
- "-DICONDIR=/app/share/icons"
|
||||
- "-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=yes"
|
||||
sources:
|
||||
- type: dir
|
||||
path: ..
|
||||
- type: shell
|
||||
commands:
|
||||
- "sed -i 's:/wiki:/old-wiki:' ./files/openmw.appdata.xml"
|
||||
- "sed -i 's:>org.openmw.launcher.desktop<:>org.openmw.OpenMW.devel.desktop<:' ./files/openmw.appdata.xml"
|
||||
- "sed -i 's:Icon=openmw:Icon=org.openmw.OpenMW.devel.png:' ./files/org.openmw.launcher.desktop"
|
||||
- "sed -i 's:Icon=openmw-cs:Icon=org.openmw.OpenMW.OpenCS.devel.png:' ./files/org.openmw.cs.desktop"
|
||||
post-install:
|
||||
- "mv /app/share/applications/org.openmw.launcher.desktop /app/share/applications/org.openmw.OpenMW.devel.desktop"
|
||||
- "mv /app/share/applications/org.openmw.cs.desktop /app/share/applications/org.openmw.OpenMW.OpenCS.devel.desktop"
|
||||
- "mv /app/share/icons/openmw.png /app/share/icons/org.openmw.OpenMW.devel.png"
|
||||
- "mv /app/share/icons/openmw-cs.png /app/share/icons/org.openmw.OpenMW.OpenCS.devel.png"
|
@ -0,0 +1,10 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
git clone --depth=1 https://gitlab.com/OpenMW/example-suite.git
|
||||
|
||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24x60' \
|
||||
scripts/integration_tests.py --omw build/install/bin/openmw --workdir integration_tests_output example-suite/
|
||||
|
||||
ls integration_tests_output/*.osg_stats.log | while read v; do
|
||||
scripts/osg_stats.py --stats '.*' --regexp_match < "${v}"
|
||||
done
|
@ -0,0 +1,12 @@
|
||||
docs/source/install_luadocumentor_in_docker.sh
|
||||
PATH=$PATH:~/luarocks/bin
|
||||
|
||||
pushd .
|
||||
echo "Install Teal Cyan"
|
||||
git clone https://github.com/teal-language/cyan.git --depth 1
|
||||
cd cyan
|
||||
luarocks make cyan-dev-1.rockspec
|
||||
popd
|
||||
|
||||
scripts/generate_teal_declarations.sh ./teal_declarations
|
||||
zip teal_declarations.zip -r teal_declarations
|
@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
SRC="${PWD:?}"
|
||||
VERSION=$(git rev-parse HEAD)
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
cmake \
|
||||
-G Ninja \
|
||||
-D CMAKE_C_COMPILER=gcc \
|
||||
-D CMAKE_CXX_COMPILER=g++ \
|
||||
-D USE_SYSTEM_TINYXML=ON \
|
||||
-D OPENMW_USE_SYSTEM_RECASTNAVIGATION=ON \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D CMAKE_C_FLAGS_RELEASE='-DNDEBUG -E -w' \
|
||||
-D CMAKE_CXX_FLAGS_RELEASE='-DNDEBUG -E -w' \
|
||||
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-D BUILD_BENCHMARKS=ON \
|
||||
-D BUILD_BSATOOL=ON \
|
||||
-D BUILD_BULLETOBJECTTOOL=ON \
|
||||
-D BUILD_ESMTOOL=ON \
|
||||
-D BUILD_ESSIMPORTER=ON \
|
||||
-D BUILD_LAUNCHER=ON \
|
||||
-D BUILD_LAUNCHER_TESTS=ON \
|
||||
-D BUILD_MWINIIMPORTER=ON \
|
||||
-D BUILD_NAVMESHTOOL=ON \
|
||||
-D BUILD_NIFTEST=ON \
|
||||
-D BUILD_OPENCS=ON \
|
||||
-D BUILD_OPENCS_TESTS=ON \
|
||||
-D BUILD_OPENMW=ON \
|
||||
-D BUILD_UNITTESTS=ON \
|
||||
-D BUILD_WIZARD=ON \
|
||||
"${SRC}"
|
||||
cmake --build . --parallel
|
||||
|
||||
cd ..
|
||||
|
||||
scripts/preprocessed_file_size_stats.py --remove_prefix "${SRC}/" build > "${VERSION:?}.json"
|
||||
ls -al "${VERSION:?}.json"
|
||||
|
||||
if [[ "${GENERATE_ONLY}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git remote add target "${CI_MERGE_REQUEST_PROJECT_URL:-https://gitlab.com/OpenMW/openmw.git}"
|
||||
|
||||
TARGET_BRANCH="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-master}"
|
||||
|
||||
git fetch target "${TARGET_BRANCH:?}"
|
||||
|
||||
if [[ "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" ]]; then
|
||||
git remote add source "${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}"
|
||||
git fetch --unshallow source "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
|
||||
elif [[ "${CI_COMMIT_BRANCH}" ]]; then
|
||||
git fetch origin "${CI_COMMIT_BRANCH:?}"
|
||||
else
|
||||
git fetch origin
|
||||
fi
|
||||
|
||||
BASE_VERSION=$(git merge-base "target/${TARGET_BRANCH:?}" "${VERSION:?}")
|
||||
|
||||
# Save and use scripts from this commit because they may be absent or different in the base version
|
||||
cp scripts/preprocessed_file_size_stats.py scripts/preprocessed_file_size_stats.bak.py
|
||||
cp CI/ubuntu_gcc_preprocess.sh CI/ubuntu_gcc_preprocess.bak.sh
|
||||
git checkout "${BASE_VERSION:?}"
|
||||
mv scripts/preprocessed_file_size_stats.bak.py scripts/preprocessed_file_size_stats.py
|
||||
mv CI/ubuntu_gcc_preprocess.bak.sh CI/ubuntu_gcc_preprocess.sh
|
||||
env GENERATE_ONLY=1 CI/ubuntu_gcc_preprocess.sh
|
||||
git checkout --force "${VERSION:?}"
|
||||
|
||||
scripts/preprocessed_file_size_stats_diff.py "${BASE_VERSION:?}.json" "${VERSION:?}.json"
|
@ -1,27 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
set(BENCHMARK_ENABLE_TESTING OFF)
|
||||
set(BENCHMARK_ENABLE_INSTALL OFF)
|
||||
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
|
||||
|
||||
set(SAVED_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
string(REPLACE "-Wsuggest-override" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "-Wundef" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(benchmark
|
||||
URL https://github.com/google/benchmark/archive/refs/tags/v1.5.2.zip
|
||||
URL_HASH MD5=49395b757a7c4656d70f1328d93efd00
|
||||
SOURCE_DIR fetched/benchmark
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(benchmark)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${SAVED_CMAKE_CXX_FLAGS}")
|
||||
|
||||
openmw_add_executable(openmw_detournavigator_navmeshtilescache_benchmark detournavigator/navmeshtilescache.cpp)
|
||||
target_compile_features(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE cxx_std_17)
|
||||
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark benchmark::benchmark components)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(OPENMW_USE_SYSTEM_BENCHMARK)
|
||||
find_package(benchmark REQUIRED)
|
||||
endif()
|
||||
|
||||
add_subdirectory(detournavigator)
|
||||
add_subdirectory(esm)
|
||||
add_subdirectory(settings)
|
||||
|
@ -0,0 +1,15 @@
|
||||
openmw_add_executable(openmw_detournavigator_navmeshtilescache_benchmark navmeshtilescache.cpp)
|
||||
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark benchmark::benchmark components)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE <algorithm>)
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE --coverage)
|
||||
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark gcov)
|
||||
endif()
|
@ -0,0 +1,15 @@
|
||||
openmw_add_executable(openmw_esm_refid_benchmark benchrefid.cpp)
|
||||
target_link_libraries(openmw_esm_refid_benchmark benchmark::benchmark components)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(openmw_esm_refid_benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(openmw_esm_refid_benchmark PRIVATE <algorithm>)
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw_esm_refid_benchmark PRIVATE --coverage)
|
||||
target_link_libraries(openmw_esm_refid_benchmark gcov)
|
||||
endif()
|
@ -0,0 +1,249 @@
|
||||
#include <benchmark/benchmark.h>
|
||||
|
||||
#include "components/esm/refid.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <random>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr std::size_t refIdsCount = 64 * 1024;
|
||||
|
||||
template <class Random>
|
||||
std::string generateText(std::size_t size, Random& random)
|
||||
{
|
||||
std::uniform_int_distribution<int> distribution('A', 'z');
|
||||
std::string result;
|
||||
result.reserve(size);
|
||||
std::generate_n(std::back_inserter(result), size, [&] { return distribution(random); });
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Random>
|
||||
std::vector<ESM::RefId> generateStringRefIds(std::size_t size, Random& random)
|
||||
{
|
||||
std::vector<ESM::RefId> result;
|
||||
result.reserve(refIdsCount);
|
||||
std::generate_n(
|
||||
std::back_inserter(result), refIdsCount, [&] { return ESM::StringRefId(generateText(size, random)); });
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Serialize>
|
||||
std::vector<std::string> generateSerializedRefIds(const std::vector<ESM::RefId>& generated, Serialize&& serialize)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
result.reserve(generated.size());
|
||||
for (ESM::RefId refId : generated)
|
||||
result.push_back(serialize(refId));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Random, class Serialize>
|
||||
std::vector<std::string> generateSerializedStringRefIds(std::size_t size, Random& random, Serialize&& serialize)
|
||||
{
|
||||
return generateSerializedRefIds(generateStringRefIds(size, random), serialize);
|
||||
}
|
||||
|
||||
template <class Random>
|
||||
std::vector<ESM::RefId> generateIndexRefIds(Random& random)
|
||||
{
|
||||
std::vector<ESM::RefId> result;
|
||||
result.reserve(refIdsCount);
|
||||
std::uniform_int_distribution<std::uint32_t> distribution(0, std::numeric_limits<std::uint32_t>::max());
|
||||
std::generate_n(std::back_inserter(result), refIdsCount,
|
||||
[&] { return ESM::IndexRefId(ESM::REC_ARMO, distribution(random)); });
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Random, class Serialize>
|
||||
std::vector<std::string> generateSerializedIndexRefIds(Random& random, Serialize&& serialize)
|
||||
{
|
||||
return generateSerializedRefIds(generateIndexRefIds(random), serialize);
|
||||
}
|
||||
|
||||
template <class Random>
|
||||
std::vector<ESM::RefId> generateGeneratedRefIds(Random& random)
|
||||
{
|
||||
std::vector<ESM::RefId> result;
|
||||
result.reserve(refIdsCount);
|
||||
std::uniform_int_distribution<std::uint64_t> distribution(0, std::numeric_limits<std::uint64_t>::max());
|
||||
std::generate_n(
|
||||
std::back_inserter(result), refIdsCount, [&] { return ESM::GeneratedRefId(distribution(random)); });
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Random, class Serialize>
|
||||
std::vector<std::string> generateSerializedGeneratedRefIds(Random& random, Serialize&& serialize)
|
||||
{
|
||||
return generateSerializedRefIds(generateGeneratedRefIds(random), serialize);
|
||||
}
|
||||
|
||||
template <class Random>
|
||||
std::vector<ESM::RefId> generateESM3ExteriorCellRefIds(Random& random)
|
||||
{
|
||||
std::vector<ESM::RefId> result;
|
||||
result.reserve(refIdsCount);
|
||||
std::uniform_int_distribution<std::int32_t> distribution(-100, 100);
|
||||
std::generate_n(std::back_inserter(result), refIdsCount,
|
||||
[&] { return ESM::ESM3ExteriorCellRefId(distribution(random), distribution(random)); });
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Random, class Serialize>
|
||||
std::vector<std::string> generateSerializedESM3ExteriorCellRefIds(Random& random, Serialize&& serialize)
|
||||
{
|
||||
return generateSerializedRefIds(generateESM3ExteriorCellRefIds(random), serialize);
|
||||
}
|
||||
|
||||
void serializeRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<ESM::RefId> refIds = generateStringRefIds(state.range(0), random);
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(refIds[i].serialize());
|
||||
if (++i >= refIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<std::string> serializedRefIds
|
||||
= generateSerializedStringRefIds(state.range(0), random, [](ESM::RefId v) { return v.serialize(); });
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(ESM::RefId::deserialize(serializedRefIds[i]));
|
||||
if (++i >= serializedRefIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void serializeTextStringRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<ESM::RefId> refIds = generateStringRefIds(state.range(0), random);
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(refIds[i].serializeText());
|
||||
if (++i >= refIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeTextStringRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<std::string> serializedRefIds
|
||||
= generateSerializedStringRefIds(state.range(0), random, [](ESM::RefId v) { return v.serializeText(); });
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(ESM::RefId::deserializeText(serializedRefIds[i]));
|
||||
if (++i >= serializedRefIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void serializeTextGeneratedRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<ESM::RefId> refIds = generateGeneratedRefIds(random);
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(refIds[i].serializeText());
|
||||
if (++i >= refIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeTextGeneratedRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<std::string> serializedRefIds
|
||||
= generateSerializedGeneratedRefIds(random, [](ESM::RefId v) { return v.serializeText(); });
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(ESM::RefId::deserializeText(serializedRefIds[i]));
|
||||
if (++i >= serializedRefIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void serializeTextIndexRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<ESM::RefId> refIds = generateIndexRefIds(random);
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(refIds[i].serializeText());
|
||||
if (++i >= refIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeTextIndexRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<std::string> serializedRefIds
|
||||
= generateSerializedIndexRefIds(random, [](ESM::RefId v) { return v.serializeText(); });
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(ESM::RefId::deserializeText(serializedRefIds[i]));
|
||||
if (++i >= serializedRefIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void serializeTextESM3ExteriorCellRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<ESM::RefId> refIds = generateESM3ExteriorCellRefIds(random);
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(refIds[i].serializeText());
|
||||
if (++i >= refIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeTextESM3ExteriorCellRefId(benchmark::State& state)
|
||||
{
|
||||
std::minstd_rand random;
|
||||
std::vector<std::string> serializedRefIds
|
||||
= generateSerializedESM3ExteriorCellRefIds(random, [](ESM::RefId v) { return v.serializeText(); });
|
||||
std::size_t i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(ESM::RefId::deserializeText(serializedRefIds[i]));
|
||||
if (++i >= serializedRefIds.size())
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(serializeRefId)->RangeMultiplier(4)->Range(8, 64);
|
||||
BENCHMARK(deserializeRefId)->RangeMultiplier(4)->Range(8, 64);
|
||||
BENCHMARK(serializeTextStringRefId)->RangeMultiplier(4)->Range(8, 64);
|
||||
BENCHMARK(deserializeTextStringRefId)->RangeMultiplier(4)->Range(8, 64);
|
||||
BENCHMARK(serializeTextGeneratedRefId);
|
||||
BENCHMARK(deserializeTextGeneratedRefId);
|
||||
BENCHMARK(serializeTextIndexRefId);
|
||||
BENCHMARK(deserializeTextIndexRefId);
|
||||
BENCHMARK(serializeTextESM3ExteriorCellRefId);
|
||||
BENCHMARK(deserializeTextESM3ExteriorCellRefId);
|
||||
|
||||
BENCHMARK_MAIN();
|
@ -0,0 +1,18 @@
|
||||
openmw_add_executable(openmw_settings_access_benchmark access.cpp)
|
||||
target_link_libraries(openmw_settings_access_benchmark benchmark::benchmark components)
|
||||
|
||||
target_compile_definitions(openmw_settings_access_benchmark
|
||||
PRIVATE OPENMW_PROJECT_SOURCE_DIR=u8"${PROJECT_SOURCE_DIR}")
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(openmw_settings_access_benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(openmw_settings_access_benchmark PRIVATE <algorithm>)
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw_settings_access_benchmark PRIVATE --coverage)
|
||||
target_link_libraries(openmw_settings_access_benchmark gcov)
|
||||
endif()
|
@ -0,0 +1,162 @@
|
||||
#include <benchmark/benchmark.h>
|
||||
|
||||
#include "components/misc/strings/conversion.hpp"
|
||||
#include "components/settings/parser.hpp"
|
||||
#include "components/settings/settings.hpp"
|
||||
#include "components/settings/values.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
void settingsManager(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::Manager::getFloat("sky blending start", "Fog"));
|
||||
}
|
||||
}
|
||||
|
||||
void settingsManager2(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::Manager::getFloat("near clip", "Camera"));
|
||||
benchmark::DoNotOptimize(Settings::Manager::getBool("transparent postpass", "Post Processing"));
|
||||
}
|
||||
}
|
||||
|
||||
void settingsManager3(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::Manager::getFloat("near clip", "Camera"));
|
||||
benchmark::DoNotOptimize(Settings::Manager::getBool("transparent postpass", "Post Processing"));
|
||||
benchmark::DoNotOptimize(Settings::Manager::getInt("reflection detail", "Water"));
|
||||
}
|
||||
}
|
||||
|
||||
void localStatic(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
static const float v = Settings::Manager::getFloat("sky blending start", "Fog");
|
||||
benchmark::DoNotOptimize(v);
|
||||
}
|
||||
}
|
||||
|
||||
void localStatic2(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
static const float v1 = Settings::Manager::getFloat("near clip", "Camera");
|
||||
static const bool v2 = Settings::Manager::getBool("transparent postpass", "Post Processing");
|
||||
benchmark::DoNotOptimize(v1);
|
||||
benchmark::DoNotOptimize(v2);
|
||||
}
|
||||
}
|
||||
|
||||
void localStatic3(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
static const float v1 = Settings::Manager::getFloat("near clip", "Camera");
|
||||
static const bool v2 = Settings::Manager::getBool("transparent postpass", "Post Processing");
|
||||
static const int v3 = Settings::Manager::getInt("reflection detail", "Water");
|
||||
benchmark::DoNotOptimize(v1);
|
||||
benchmark::DoNotOptimize(v2);
|
||||
benchmark::DoNotOptimize(v3);
|
||||
}
|
||||
}
|
||||
|
||||
void settingsStorage(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::fog().mSkyBlendingStart.get());
|
||||
}
|
||||
}
|
||||
|
||||
void settingsStorage2(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::postProcessing().mTransparentPostpass.get());
|
||||
benchmark::DoNotOptimize(Settings::camera().mNearClip.get());
|
||||
}
|
||||
}
|
||||
|
||||
void settingsStorage3(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::postProcessing().mTransparentPostpass.get());
|
||||
benchmark::DoNotOptimize(Settings::camera().mNearClip.get());
|
||||
benchmark::DoNotOptimize(Settings::water().mReflectionDetail.get());
|
||||
}
|
||||
}
|
||||
|
||||
void settingsStorageGet(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::get<float>("Fog", "sky blending start"));
|
||||
}
|
||||
}
|
||||
|
||||
void settingsStorageGet2(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::get<bool>("Post Processing", "transparent postpass"));
|
||||
benchmark::DoNotOptimize(Settings::get<float>("Camera", "near clip"));
|
||||
}
|
||||
}
|
||||
|
||||
void settingsStorageGet3(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize(Settings::get<bool>("Post Processing", "transparent postpass"));
|
||||
benchmark::DoNotOptimize(Settings::get<float>("Camera", "near clip"));
|
||||
benchmark::DoNotOptimize(Settings::get<int>("Water", "reflection detail"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(settingsManager);
|
||||
BENCHMARK(localStatic);
|
||||
BENCHMARK(settingsStorage);
|
||||
BENCHMARK(settingsStorageGet);
|
||||
|
||||
BENCHMARK(settingsManager2);
|
||||
BENCHMARK(localStatic2);
|
||||
BENCHMARK(settingsStorage2);
|
||||
BENCHMARK(settingsStorageGet2);
|
||||
|
||||
BENCHMARK(settingsManager3);
|
||||
BENCHMARK(localStatic3);
|
||||
BENCHMARK(settingsStorage3);
|
||||
BENCHMARK(settingsStorageGet3);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
const std::filesystem::path settingsDefaultPath = std::filesystem::path{ OPENMW_PROJECT_SOURCE_DIR } / "files"
|
||||
/ Misc::StringUtils::stringToU8String("settings-default.cfg");
|
||||
|
||||
Settings::SettingsFileParser parser;
|
||||
parser.loadSettingsFile(settingsDefaultPath, Settings::Manager::mDefaultSettings);
|
||||
|
||||
Settings::StaticValues::initDefaults();
|
||||
|
||||
Settings::Manager::mUserSettings = Settings::Manager::mDefaultSettings;
|
||||
Settings::Manager::mUserSettings.erase({ "Camera", "near clip" });
|
||||
Settings::Manager::mUserSettings.erase({ "Post Processing", "transparent postpass" });
|
||||
Settings::Manager::mUserSettings.erase({ "Water", "reflection detail" });
|
||||
|
||||
Settings::StaticValues::init();
|
||||
|
||||
benchmark::Initialize(&argc, argv);
|
||||
benchmark::RunSpecifiedBenchmarks();
|
||||
benchmark::Shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,20 +1,27 @@
|
||||
set(BSATOOL
|
||||
bsatool.cpp
|
||||
bsatool.cpp
|
||||
)
|
||||
source_group(apps\\bsatool FILES ${BSATOOL})
|
||||
|
||||
# Main executable
|
||||
openmw_add_executable(bsatool
|
||||
${BSATOOL}
|
||||
${BSATOOL}
|
||||
)
|
||||
|
||||
target_link_libraries(bsatool
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
components
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
components
|
||||
)
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
add_definitions (--coverage)
|
||||
target_link_libraries(bsatool gcov)
|
||||
target_compile_options(bsatool PRIVATE --coverage)
|
||||
target_link_libraries(bsatool gcov)
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(bsatool PRIVATE
|
||||
<filesystem>
|
||||
<fstream>
|
||||
<vector>
|
||||
)
|
||||
endif()
|
||||
|
@ -0,0 +1,27 @@
|
||||
set(BULLETMESHTOOL
|
||||
main.cpp
|
||||
)
|
||||
source_group(apps\\bulletobjecttool FILES ${BULLETMESHTOOL})
|
||||
|
||||
openmw_add_executable(openmw-bulletobjecttool ${BULLETMESHTOOL})
|
||||
|
||||
target_link_libraries(openmw-bulletobjecttool
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
components
|
||||
)
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw-bulletobjecttool PRIVATE --coverage)
|
||||
target_link_libraries(openmw-bulletobjecttool gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
install(TARGETS openmw-bulletobjecttool RUNTIME DESTINATION ".")
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(openmw-bulletobjecttool PRIVATE
|
||||
<string>
|
||||
<vector>
|
||||
)
|
||||
endif()
|
@ -0,0 +1,206 @@
|
||||
#include <components/debug/debugging.hpp>
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/esm/defs.hpp>
|
||||
#include <components/esm3/loadcell.hpp>
|
||||
#include <components/esm3/readerscache.hpp>
|
||||
#include <components/esmloader/esmdata.hpp>
|
||||
#include <components/esmloader/load.hpp>
|
||||
#include <components/fallback/fallback.hpp>
|
||||
#include <components/fallback/validate.hpp>
|
||||
#include <components/files/collections.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/files/multidircollection.hpp>
|
||||
#include <components/misc/strings/conversion.hpp>
|
||||
#include <components/platform/platform.hpp>
|
||||
#include <components/resource/bulletshape.hpp>
|
||||
#include <components/resource/bulletshapemanager.hpp>
|
||||
#include <components/resource/foreachbulletobject.hpp>
|
||||
#include <components/resource/imagemanager.hpp>
|
||||
#include <components/resource/niffilemanager.hpp>
|
||||
#include <components/resource/scenemanager.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/to_utf8/to_utf8.hpp>
|
||||
#include <components/version/version.hpp>
|
||||
#include <components/vfs/manager.hpp>
|
||||
#include <components/vfs/registerarchives.hpp>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <charconv>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace bpo = boost::program_options;
|
||||
|
||||
using StringsVector = std::vector<std::string>;
|
||||
|
||||
constexpr std::string_view applicationName = "BulletObjectTool";
|
||||
|
||||
bpo::options_description makeOptionsDescription()
|
||||
{
|
||||
using Fallback::FallbackMap;
|
||||
|
||||
bpo::options_description result;
|
||||
auto addOption = result.add_options();
|
||||
addOption("help", "print help message");
|
||||
|
||||
addOption("version", "print version information and quit");
|
||||
|
||||
addOption("data",
|
||||
bpo::value<Files::MaybeQuotedPathContainer>()
|
||||
->default_value(Files::MaybeQuotedPathContainer(), "data")
|
||||
->multitoken()
|
||||
->composing(),
|
||||
"set data directories (later directories have higher priority)");
|
||||
|
||||
addOption("data-local",
|
||||
bpo::value<Files::MaybeQuotedPathContainer::value_type>()->default_value(
|
||||
Files::MaybeQuotedPathContainer::value_type(), ""),
|
||||
"set local data directory (highest priority)");
|
||||
|
||||
addOption("fallback-archive",
|
||||
bpo::value<StringsVector>()->default_value(StringsVector(), "fallback-archive")->multitoken()->composing(),
|
||||
"set fallback BSA archives (later archives have higher priority)");
|
||||
|
||||
addOption("resources",
|
||||
bpo::value<Files::MaybeQuotedPath>()->default_value(Files::MaybeQuotedPath(), "resources"),
|
||||
"set resources directory");
|
||||
|
||||
addOption("content", bpo::value<StringsVector>()->default_value(StringsVector(), "")->multitoken()->composing(),
|
||||
"content file(s): esm/esp, or omwgame/omwaddon/omwscripts");
|
||||
|
||||
addOption("encoding", bpo::value<std::string>()->default_value("win1252"),
|
||||
"Character encoding used in OpenMW game messages:\n"
|
||||
"\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, "
|
||||
"Croatian, Serbian (Latin script), Romanian and Albanian languages\n"
|
||||
"\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n"
|
||||
"\n\twin1252 - Western European (Latin) alphabet, used by default");
|
||||
|
||||
addOption("fallback", bpo::value<FallbackMap>()->default_value(FallbackMap(), "")->multitoken()->composing(),
|
||||
"fallback values");
|
||||
|
||||
Files::ConfigurationManager::addCommonOptions(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct WriteArray
|
||||
{
|
||||
const float (&mValue)[3];
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& stream, const WriteArray& value)
|
||||
{
|
||||
for (std::size_t i = 0; i < 2; ++i)
|
||||
stream << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.mValue[i] << ", ";
|
||||
return stream << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.mValue[2];
|
||||
}
|
||||
};
|
||||
|
||||
int runBulletObjectTool(int argc, char* argv[])
|
||||
{
|
||||
Platform::init();
|
||||
|
||||
bpo::options_description desc = makeOptionsDescription();
|
||||
|
||||
bpo::parsed_options options = bpo::command_line_parser(argc, argv).options(desc).allow_unregistered().run();
|
||||
bpo::variables_map variables;
|
||||
|
||||
bpo::store(options, variables);
|
||||
bpo::notify(variables);
|
||||
|
||||
if (variables.find("help") != variables.end())
|
||||
{
|
||||
getRawStdout() << desc << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Files::ConfigurationManager config;
|
||||
config.readConfiguration(variables, desc);
|
||||
|
||||
setupLogging(config.getLogPath(), applicationName);
|
||||
|
||||
const std::string encoding(variables["encoding"].as<std::string>());
|
||||
Log(Debug::Info) << ToUTF8::encodingUsingMessage(encoding);
|
||||
ToUTF8::Utf8Encoder encoder(ToUTF8::calculateEncoding(encoding));
|
||||
|
||||
Files::PathContainer dataDirs(asPathContainer(variables["data"].as<Files::MaybeQuotedPathContainer>()));
|
||||
|
||||
auto local = variables["data-local"].as<Files::MaybeQuotedPathContainer::value_type>();
|
||||
if (!local.empty())
|
||||
dataDirs.push_back(std::move(local));
|
||||
|
||||
config.filterOutNonExistingPaths(dataDirs);
|
||||
|
||||
const auto resDir = variables["resources"].as<Files::MaybeQuotedPath>();
|
||||
const auto v = Version::getOpenmwVersion(resDir);
|
||||
Log(Debug::Info) << v.describe();
|
||||
dataDirs.insert(dataDirs.begin(), resDir / "vfs");
|
||||
const auto fileCollections = Files::Collections(dataDirs);
|
||||
const auto archives = variables["fallback-archive"].as<StringsVector>();
|
||||
const auto contentFiles = variables["content"].as<StringsVector>();
|
||||
|
||||
Fallback::Map::init(variables["fallback"].as<Fallback::FallbackMap>().mMap);
|
||||
|
||||
VFS::Manager vfs;
|
||||
|
||||
VFS::registerArchives(&vfs, fileCollections, archives, true);
|
||||
|
||||
Settings::Manager::load(config);
|
||||
|
||||
ESM::ReadersCache readers;
|
||||
EsmLoader::Query query;
|
||||
query.mLoadActivators = true;
|
||||
query.mLoadCells = true;
|
||||
query.mLoadContainers = true;
|
||||
query.mLoadDoors = true;
|
||||
query.mLoadGameSettings = true;
|
||||
query.mLoadLands = true;
|
||||
query.mLoadStatics = true;
|
||||
const EsmLoader::EsmData esmData
|
||||
= EsmLoader::loadEsmData(query, contentFiles, fileCollections, readers, &encoder);
|
||||
|
||||
Resource::ImageManager imageManager(&vfs);
|
||||
Resource::NifFileManager nifFileManager(&vfs);
|
||||
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager);
|
||||
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager);
|
||||
|
||||
Resource::forEachBulletObject(
|
||||
readers, vfs, bulletShapeManager, esmData, [](const ESM::Cell& cell, const Resource::BulletObject& object) {
|
||||
Log(Debug::Verbose) << "Found bullet object in " << (cell.isExterior() ? "exterior" : "interior")
|
||||
<< " cell \"" << cell.getDescription() << "\":"
|
||||
<< " fileName=\"" << object.mShape->mFileName << '"'
|
||||
<< " fileHash=" << Misc::StringUtils::toHex(object.mShape->mFileHash)
|
||||
<< " collisionShape=" << std::boolalpha
|
||||
<< (object.mShape->mCollisionShape == nullptr)
|
||||
<< " avoidCollisionShape=" << std::boolalpha
|
||||
<< (object.mShape->mAvoidCollisionShape == nullptr) << " position=("
|
||||
<< WriteArray{ object.mPosition.pos } << ')' << " rotation=("
|
||||
<< WriteArray{ object.mPosition.rot } << ')'
|
||||
<< " scale=" << std::setprecision(std::numeric_limits<float>::max_exponent10)
|
||||
<< object.mScale;
|
||||
});
|
||||
|
||||
Log(Debug::Info) << "Done";
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return wrapApplication(runBulletObjectTool, argc, argv, applicationName);
|
||||
}
|
@ -1,23 +1,34 @@
|
||||
set(ESMTOOL
|
||||
esmtool.cpp
|
||||
labels.hpp
|
||||
labels.cpp
|
||||
record.hpp
|
||||
record.cpp
|
||||
esmtool.cpp
|
||||
labels.hpp
|
||||
labels.cpp
|
||||
record.hpp
|
||||
record.cpp
|
||||
arguments.hpp
|
||||
tes4.hpp
|
||||
tes4.cpp
|
||||
)
|
||||
source_group(apps\\esmtool FILES ${ESMTOOL})
|
||||
|
||||
# Main executable
|
||||
openmw_add_executable(esmtool
|
||||
${ESMTOOL}
|
||||
${ESMTOOL}
|
||||
)
|
||||
|
||||
target_link_libraries(esmtool
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
components
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
components
|
||||
)
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
add_definitions (--coverage)
|
||||
target_link_libraries(esmtool gcov)
|
||||
target_compile_options(esmtool PRIVATE --coverage)
|
||||
target_link_libraries(esmtool gcov)
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(esmtool PRIVATE
|
||||
<fstream>
|
||||
<string>
|
||||
<vector>
|
||||
)
|
||||
endif()
|
||||
|
@ -0,0 +1,29 @@
|
||||
#ifndef OPENMW_ESMTOOL_ARGUMENTS_H
|
||||
#define OPENMW_ESMTOOL_ARGUMENTS_H
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include <components/esm/format.hpp>
|
||||
|
||||
namespace EsmTool
|
||||
{
|
||||
struct Arguments
|
||||
{
|
||||
std::optional<ESM::Format> mRawFormat;
|
||||
bool quiet_given = false;
|
||||
bool loadcells_given = false;
|
||||
bool plain_given = false;
|
||||
|
||||
std::string mode;
|
||||
std::string encoding;
|
||||
std::filesystem::path filename;
|
||||
std::filesystem::path outname;
|
||||
|
||||
std::vector<std::string> types;
|
||||
std::string name;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,564 @@
|
||||
#include "tes4.hpp"
|
||||
#include "arguments.hpp"
|
||||
#include "labels.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
#include <components/esm/esmcommon.hpp>
|
||||
#include <components/esm/typetraits.hpp>
|
||||
#include <components/esm4/reader.hpp>
|
||||
#include <components/esm4/readerutils.hpp>
|
||||
#include <components/esm4/records.hpp>
|
||||
#include <components/esm4/typetraits.hpp>
|
||||
#include <components/to_utf8/to_utf8.hpp>
|
||||
|
||||
namespace EsmTool
|
||||
{
|
||||
namespace
|
||||
{
|
||||
struct Params
|
||||
{
|
||||
const bool mQuite;
|
||||
|
||||
explicit Params(const Arguments& info)
|
||||
: mQuite(info.quiet_given || info.mode == "clone")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
std::string toString(ESM4::GroupType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ESM4::Grp_RecordType:
|
||||
return "RecordType";
|
||||
case ESM4::Grp_WorldChild:
|
||||
return "WorldChild";
|
||||
case ESM4::Grp_InteriorCell:
|
||||
return "InteriorCell";
|
||||
case ESM4::Grp_InteriorSubCell:
|
||||
return "InteriorSubCell";
|
||||
case ESM4::Grp_ExteriorCell:
|
||||
return "ExteriorCell";
|
||||
case ESM4::Grp_ExteriorSubCell:
|
||||
return "ExteriorSubCell";
|
||||
case ESM4::Grp_CellChild:
|
||||
return "CellChild";
|
||||
case ESM4::Grp_TopicChild:
|
||||
return "TopicChild";
|
||||
case ESM4::Grp_CellPersistentChild:
|
||||
return "CellPersistentChild";
|
||||
case ESM4::Grp_CellTemporaryChild:
|
||||
return "CellTemporaryChild";
|
||||
case ESM4::Grp_CellVisibleDistChild:
|
||||
return "CellVisibleDistChild";
|
||||
}
|
||||
|
||||
return "Unknown (" + std::to_string(type) + ")";
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct WriteArray
|
||||
{
|
||||
std::string_view mPrefix;
|
||||
const T& mValue;
|
||||
|
||||
explicit WriteArray(std::string_view prefix, const T& value)
|
||||
: mPrefix(prefix)
|
||||
, mValue(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct WriteData
|
||||
{
|
||||
const T& mValue;
|
||||
|
||||
explicit WriteData(const T& value)
|
||||
: mValue(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& stream, const WriteArray<T>& write)
|
||||
{
|
||||
for (const auto& value : write.mValue)
|
||||
stream << write.mPrefix << value;
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& stream, const WriteData<T>& /*write*/)
|
||||
{
|
||||
return stream << " ?";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const WriteData<ESM4::GameSetting::Data>& write)
|
||||
{
|
||||
std::visit([&](const auto& v) { stream << v; }, write.mValue);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void readTypedRecord(const Params& params, ESM4::Reader& reader)
|
||||
{
|
||||
reader.getRecordData();
|
||||
|
||||
T value;
|
||||
value.load(reader);
|
||||
|
||||
if (params.mQuite)
|
||||
return;
|
||||
|
||||
std::cout << "\n Record: " << ESM::NAME(reader.hdr().record.typeId).toStringView();
|
||||
if constexpr (ESM4::hasFormId<T>)
|
||||
std::cout << "\n FormId: 0x" << ESM4::formIdToString(value.mFormId);
|
||||
if constexpr (ESM::hasId<T>)
|
||||
{
|
||||
if constexpr (std::is_same_v<decltype(value.mId), ESM4::FormId>)
|
||||
std::cout << "\n FormId: 0x" << ESM4::formIdToString(value.mId);
|
||||
else
|
||||
std::cout << "\n Id: " << value.mId;
|
||||
}
|
||||
if constexpr (ESM4::hasFlags<T>)
|
||||
std::cout << "\n Record flags: " << recordFlags(value.mFlags);
|
||||
if constexpr (ESM4::hasParentFormId<T>)
|
||||
std::cout << "\n ParentFormId: 0x" << ESM4::formIdToString(value.mParentFormId);
|
||||
if constexpr (ESM4::hasParent<T>)
|
||||
std::cout << "\n Parent: " << value.mParent;
|
||||
if constexpr (ESM4::hasEditorId<T>)
|
||||
std::cout << "\n EditorId: " << value.mEditorId;
|
||||
if constexpr (ESM::hasModel<T>)
|
||||
std::cout << "\n Model: " << value.mModel;
|
||||
if constexpr (ESM4::hasNif<T>)
|
||||
std::cout << "\n Nif:" << WriteArray("\n - ", value.mNif);
|
||||
if constexpr (ESM4::hasKf<T>)
|
||||
std::cout << "\n Kf:" << WriteArray("\n - ", value.mKf);
|
||||
if constexpr (ESM4::hasType<T>)
|
||||
std::cout << "\n Type: " << value.mType;
|
||||
if constexpr (ESM4::hasValue<T>)
|
||||
std::cout << "\n Value: " << value.mValue;
|
||||
if constexpr (ESM4::hasData<T>)
|
||||
std::cout << "\n Data: " << WriteData(value.mData);
|
||||
std::cout << '\n';
|
||||
}
|
||||
|
||||
bool readRecord(const Params& params, ESM4::Reader& reader)
|
||||
{
|
||||
switch (static_cast<ESM4::RecordTypes>(reader.hdr().record.typeId))
|
||||
{
|
||||
case ESM4::REC_AACT:
|
||||
break;
|
||||
case ESM4::REC_ACHR:
|
||||
readTypedRecord<ESM4::ActorCharacter>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ACRE:
|
||||
readTypedRecord<ESM4::ActorCreature>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ACTI:
|
||||
readTypedRecord<ESM4::Activator>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ADDN:
|
||||
break;
|
||||
case ESM4::REC_ALCH:
|
||||
readTypedRecord<ESM4::Potion>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ALOC:
|
||||
readTypedRecord<ESM4::MediaLocationController>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_AMMO:
|
||||
readTypedRecord<ESM4::Ammunition>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ANIO:
|
||||
readTypedRecord<ESM4::AnimObject>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_APPA:
|
||||
readTypedRecord<ESM4::Apparatus>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ARMA:
|
||||
readTypedRecord<ESM4::ArmorAddon>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ARMO:
|
||||
readTypedRecord<ESM4::Armor>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ARTO:
|
||||
break;
|
||||
case ESM4::REC_ASPC:
|
||||
readTypedRecord<ESM4::AcousticSpace>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_ASTP:
|
||||
break;
|
||||
case ESM4::REC_AVIF:
|
||||
break;
|
||||
case ESM4::REC_BOOK:
|
||||
readTypedRecord<ESM4::Book>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_BPTD:
|
||||
readTypedRecord<ESM4::BodyPartData>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_CAMS:
|
||||
break;
|
||||
case ESM4::REC_CCRD:
|
||||
break;
|
||||
case ESM4::REC_CELL:
|
||||
readTypedRecord<ESM4::Cell>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_CLAS:
|
||||
readTypedRecord<ESM4::Class>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_CLFM:
|
||||
readTypedRecord<ESM4::Colour>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_CLMT:
|
||||
break;
|
||||
case ESM4::REC_CLOT:
|
||||
readTypedRecord<ESM4::Clothing>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_CMNY:
|
||||
break;
|
||||
case ESM4::REC_COBJ:
|
||||
break;
|
||||
case ESM4::REC_COLL:
|
||||
break;
|
||||
case ESM4::REC_CONT:
|
||||
readTypedRecord<ESM4::Container>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_CPTH:
|
||||
break;
|
||||
case ESM4::REC_CREA:
|
||||
readTypedRecord<ESM4::Creature>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_CSTY:
|
||||
break;
|
||||
case ESM4::REC_DEBR:
|
||||
break;
|
||||
case ESM4::REC_DIAL:
|
||||
readTypedRecord<ESM4::Dialogue>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_DLBR:
|
||||
break;
|
||||
case ESM4::REC_DLVW:
|
||||
break;
|
||||
case ESM4::REC_DOBJ:
|
||||
readTypedRecord<ESM4::DefaultObj>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_DOOR:
|
||||
readTypedRecord<ESM4::Door>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_DUAL:
|
||||
break;
|
||||
case ESM4::REC_ECZN:
|
||||
break;
|
||||
case ESM4::REC_EFSH:
|
||||
break;
|
||||
case ESM4::REC_ENCH:
|
||||
break;
|
||||
case ESM4::REC_EQUP:
|
||||
break;
|
||||
case ESM4::REC_EXPL:
|
||||
break;
|
||||
case ESM4::REC_EYES:
|
||||
readTypedRecord<ESM4::Eyes>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_FACT:
|
||||
break;
|
||||
case ESM4::REC_FLOR:
|
||||
readTypedRecord<ESM4::Flora>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_FLST:
|
||||
readTypedRecord<ESM4::FormIdList>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_FSTP:
|
||||
break;
|
||||
case ESM4::REC_FSTS:
|
||||
break;
|
||||
case ESM4::REC_FURN:
|
||||
readTypedRecord<ESM4::Furniture>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_GLOB:
|
||||
readTypedRecord<ESM4::GlobalVariable>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_GMST:
|
||||
readTypedRecord<ESM4::GameSetting>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_GRAS:
|
||||
readTypedRecord<ESM4::Grass>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_GRUP:
|
||||
break;
|
||||
case ESM4::REC_HAIR:
|
||||
readTypedRecord<ESM4::Hair>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_HAZD:
|
||||
break;
|
||||
case ESM4::REC_HDPT:
|
||||
readTypedRecord<ESM4::HeadPart>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_IDLE:
|
||||
// FIXME: ESM4::IdleAnimation::load does not work with Oblivion.esm
|
||||
// readTypedRecord<ESM4::IdleAnimation>(params, reader);
|
||||
return true;
|
||||
break;
|
||||
case ESM4::REC_IDLM:
|
||||
readTypedRecord<ESM4::IdleMarker>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_IMAD:
|
||||
break;
|
||||
case ESM4::REC_IMGS:
|
||||
break;
|
||||
case ESM4::REC_IMOD:
|
||||
readTypedRecord<ESM4::ItemMod>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_INFO:
|
||||
readTypedRecord<ESM4::DialogInfo>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_INGR:
|
||||
readTypedRecord<ESM4::Ingredient>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_IPCT:
|
||||
break;
|
||||
case ESM4::REC_IPDS:
|
||||
break;
|
||||
case ESM4::REC_KEYM:
|
||||
readTypedRecord<ESM4::Key>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_KYWD:
|
||||
break;
|
||||
case ESM4::REC_LAND:
|
||||
readTypedRecord<ESM4::Land>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_LCRT:
|
||||
break;
|
||||
case ESM4::REC_LCTN:
|
||||
break;
|
||||
case ESM4::REC_LGTM:
|
||||
readTypedRecord<ESM4::LightingTemplate>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_LIGH:
|
||||
readTypedRecord<ESM4::Light>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_LSCR:
|
||||
break;
|
||||
case ESM4::REC_LTEX:
|
||||
readTypedRecord<ESM4::LandTexture>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_LVLC:
|
||||
readTypedRecord<ESM4::LevelledCreature>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_LVLI:
|
||||
readTypedRecord<ESM4::LevelledItem>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_LVLN:
|
||||
readTypedRecord<ESM4::LevelledNpc>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_LVSP:
|
||||
break;
|
||||
case ESM4::REC_MATO:
|
||||
readTypedRecord<ESM4::Material>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_MATT:
|
||||
break;
|
||||
case ESM4::REC_MESG:
|
||||
break;
|
||||
case ESM4::REC_MGEF:
|
||||
break;
|
||||
case ESM4::REC_MISC:
|
||||
readTypedRecord<ESM4::MiscItem>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_MOVT:
|
||||
break;
|
||||
case ESM4::REC_MSET:
|
||||
readTypedRecord<ESM4::MediaSet>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_MSTT:
|
||||
readTypedRecord<ESM4::MovableStatic>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_MUSC:
|
||||
readTypedRecord<ESM4::Music>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_MUST:
|
||||
break;
|
||||
case ESM4::REC_NAVI:
|
||||
readTypedRecord<ESM4::Navigation>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_NAVM:
|
||||
readTypedRecord<ESM4::NavMesh>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_NOTE:
|
||||
readTypedRecord<ESM4::Note>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_NPC_:
|
||||
readTypedRecord<ESM4::Npc>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_OTFT:
|
||||
readTypedRecord<ESM4::Outfit>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_PACK:
|
||||
readTypedRecord<ESM4::AIPackage>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_PERK:
|
||||
break;
|
||||
case ESM4::REC_PGRD:
|
||||
readTypedRecord<ESM4::Pathgrid>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_PGRE:
|
||||
readTypedRecord<ESM4::PlacedGrenade>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_PHZD:
|
||||
break;
|
||||
case ESM4::REC_PROJ:
|
||||
break;
|
||||
case ESM4::REC_PWAT:
|
||||
readTypedRecord<ESM4::PlaceableWater>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_QUST:
|
||||
readTypedRecord<ESM4::Quest>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_RACE:
|
||||
readTypedRecord<ESM4::Race>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_REFR:
|
||||
readTypedRecord<ESM4::Reference>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_REGN:
|
||||
readTypedRecord<ESM4::Region>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_RELA:
|
||||
break;
|
||||
case ESM4::REC_REVB:
|
||||
break;
|
||||
case ESM4::REC_RFCT:
|
||||
break;
|
||||
case ESM4::REC_ROAD:
|
||||
readTypedRecord<ESM4::Road>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SBSP:
|
||||
readTypedRecord<ESM4::SubSpace>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SCEN:
|
||||
break;
|
||||
case ESM4::REC_SCOL:
|
||||
readTypedRecord<ESM4::StaticCollection>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SCPT:
|
||||
readTypedRecord<ESM4::Script>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SCRL:
|
||||
readTypedRecord<ESM4::Scroll>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SGST:
|
||||
readTypedRecord<ESM4::SigilStone>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SHOU:
|
||||
break;
|
||||
case ESM4::REC_SLGM:
|
||||
readTypedRecord<ESM4::SoulGem>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SMBN:
|
||||
break;
|
||||
case ESM4::REC_SMEN:
|
||||
break;
|
||||
case ESM4::REC_SMQN:
|
||||
break;
|
||||
case ESM4::REC_SNCT:
|
||||
break;
|
||||
case ESM4::REC_SNDR:
|
||||
readTypedRecord<ESM4::SoundReference>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SOPM:
|
||||
break;
|
||||
case ESM4::REC_SOUN:
|
||||
readTypedRecord<ESM4::Sound>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_SPEL:
|
||||
break;
|
||||
case ESM4::REC_SPGD:
|
||||
break;
|
||||
case ESM4::REC_STAT:
|
||||
readTypedRecord<ESM4::Static>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_TACT:
|
||||
readTypedRecord<ESM4::TalkingActivator>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_TERM:
|
||||
readTypedRecord<ESM4::Terminal>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_TES4:
|
||||
readTypedRecord<ESM4::Header>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_TREE:
|
||||
readTypedRecord<ESM4::Tree>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_TXST:
|
||||
readTypedRecord<ESM4::TextureSet>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_VTYP:
|
||||
break;
|
||||
case ESM4::REC_WATR:
|
||||
break;
|
||||
case ESM4::REC_WEAP:
|
||||
readTypedRecord<ESM4::Weapon>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_WOOP:
|
||||
break;
|
||||
case ESM4::REC_WRLD:
|
||||
readTypedRecord<ESM4::World>(params, reader);
|
||||
return true;
|
||||
case ESM4::REC_WTHR:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!params.mQuite)
|
||||
std::cout << "\n Unsupported record: " << ESM::NAME(reader.hdr().record.typeId).toStringView() << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int loadTes4(const Arguments& info, std::unique_ptr<std::ifstream>&& stream)
|
||||
{
|
||||
std::cout << "Loading TES4 file: " << info.filename << '\n';
|
||||
|
||||
try
|
||||
{
|
||||
const ToUTF8::StatelessUtf8Encoder encoder(ToUTF8::calculateEncoding(info.encoding));
|
||||
ESM4::Reader reader(std::move(stream), info.filename, nullptr, &encoder, true);
|
||||
const Params params(info);
|
||||
|
||||
if (!params.mQuite)
|
||||
{
|
||||
std::cout << "Author: " << reader.getAuthor() << '\n'
|
||||
<< "Description: " << reader.getDesc() << '\n'
|
||||
<< "File format version: " << reader.esmVersion() << '\n';
|
||||
|
||||
if (const std::vector<ESM::MasterData>& masterData = reader.getGameFiles(); !masterData.empty())
|
||||
{
|
||||
std::cout << "Masters:" << '\n';
|
||||
for (const auto& master : masterData)
|
||||
std::cout << " " << master.name << ", " << master.size << " bytes\n";
|
||||
}
|
||||
}
|
||||
|
||||
auto visitorRec = [¶ms](ESM4::Reader& reader) { return readRecord(params, reader); };
|
||||
auto visitorGroup = [¶ms](ESM4::Reader& reader) {
|
||||
if (params.mQuite)
|
||||
return;
|
||||
auto groupType = static_cast<ESM4::GroupType>(reader.hdr().group.type);
|
||||
std::cout << "\nGroup: " << toString(groupType) << " "
|
||||
<< ESM::NAME(reader.hdr().group.typeId).toStringView() << '\n';
|
||||
};
|
||||
ESM4::ReaderUtils::readAll(reader, visitorRec, visitorGroup);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cout << "\nERROR:\n\n " << e.what() << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#ifndef OPENMW_ESMTOOL_TES4_H
|
||||
#define OPENMW_ESMTOOL_TES4_H
|
||||
|
||||
#include <fstream>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
|
||||
namespace EsmTool
|
||||
{
|
||||
struct Arguments;
|
||||
|
||||
int loadTes4(const Arguments& info, std::unique_ptr<std::ifstream>&& stream);
|
||||
}
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,135 +0,0 @@
|
||||
#include "importacdt.hpp"
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
|
||||
#include <components/esm/cellref.hpp>
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
void ActorData::load(ESM::ESMReader &esm)
|
||||
{
|
||||
if (esm.isNextSub("ACTN"))
|
||||
{
|
||||
/*
|
||||
Activation flags:
|
||||
ActivationFlag_UseEnabled = 1
|
||||
ActivationFlag_OnActivate = 2
|
||||
ActivationFlag_OnDeath = 10h
|
||||
ActivationFlag_OnKnockout = 20h
|
||||
ActivationFlag_OnMurder = 40h
|
||||
ActivationFlag_DoorOpening = 100h
|
||||
ActivationFlag_DoorClosing = 200h
|
||||
ActivationFlag_DoorJammedOpening = 400h
|
||||
ActivationFlag_DoorJammedClosing = 800h
|
||||
*/
|
||||
esm.skipHSub();
|
||||
}
|
||||
|
||||
if (esm.isNextSub("STPR"))
|
||||
esm.skipHSub();
|
||||
|
||||
if (esm.isNextSub("MNAM"))
|
||||
esm.skipHSub();
|
||||
|
||||
bool isDeleted = false;
|
||||
ESM::CellRef::loadData(esm, isDeleted);
|
||||
|
||||
mHasACDT = false;
|
||||
if (esm.isNextSub("ACDT"))
|
||||
{
|
||||
mHasACDT = true;
|
||||
esm.getHT(mACDT);
|
||||
}
|
||||
|
||||
mHasACSC = false;
|
||||
if (esm.isNextSub("ACSC"))
|
||||
{
|
||||
mHasACSC = true;
|
||||
esm.getHT(mACSC);
|
||||
}
|
||||
|
||||
if (esm.isNextSub("ACSL"))
|
||||
esm.skipHSubSize(112);
|
||||
|
||||
if (esm.isNextSub("CSTN"))
|
||||
esm.skipHSub(); // "PlayerSaveGame", link to some object?
|
||||
|
||||
if (esm.isNextSub("LSTN"))
|
||||
esm.skipHSub(); // "PlayerSaveGame", link to some object?
|
||||
|
||||
// unsure at which point between LSTN and TGTN
|
||||
if (esm.isNextSub("CSHN"))
|
||||
esm.skipHSub(); // "PlayerSaveGame", link to some object?
|
||||
|
||||
// unsure if before or after CSTN/LSTN
|
||||
if (esm.isNextSub("LSHN"))
|
||||
esm.skipHSub(); // "PlayerSaveGame", link to some object?
|
||||
|
||||
while (esm.isNextSub("TGTN"))
|
||||
esm.skipHSub(); // "PlayerSaveGame", link to some object?
|
||||
|
||||
while (esm.isNextSub("FGTN"))
|
||||
esm.getHString(); // fight target?
|
||||
|
||||
// unsure at which point between TGTN and CRED
|
||||
if (esm.isNextSub("AADT"))
|
||||
{
|
||||
// occurred when a creature was in the middle of its attack, 44 bytes
|
||||
esm.skipHSub();
|
||||
}
|
||||
|
||||
// unsure at which point between FGTN and CHRD
|
||||
if (esm.isNextSub("PWPC"))
|
||||
esm.skipHSub();
|
||||
if (esm.isNextSub("PWPS"))
|
||||
esm.skipHSub();
|
||||
|
||||
if (esm.isNextSub("WNAM"))
|
||||
{
|
||||
std::string id = esm.getHString();
|
||||
|
||||
if (esm.isNextSub("XNAM"))
|
||||
mSelectedEnchantItem = esm.getHString();
|
||||
else
|
||||
mSelectedSpell = id;
|
||||
|
||||
if (esm.isNextSub("YNAM"))
|
||||
esm.skipHSub(); // 4 byte, 0
|
||||
}
|
||||
|
||||
while (esm.isNextSub("APUD"))
|
||||
{
|
||||
// used power
|
||||
esm.getSubHeader();
|
||||
std::string id = esm.getString(32);
|
||||
(void)id;
|
||||
// timestamp can't be used: this is the total hours passed, calculated by
|
||||
// timestamp = 24 * (365 * year + cumulativeDays[month] + day)
|
||||
// unfortunately cumulativeDays[month] is not clearly defined,
|
||||
// in the (non-MCP) vanilla version the first month was missing, but MCP added it.
|
||||
double timestamp;
|
||||
esm.getT(timestamp);
|
||||
}
|
||||
|
||||
// FIXME: not all actors have this, add flag
|
||||
if (esm.isNextSub("CHRD")) // npc only
|
||||
esm.getHExact(mSkills, 27*2*sizeof(int));
|
||||
|
||||
if (esm.isNextSub("CRED")) // creature only
|
||||
esm.getHExact(mCombatStats, 3*2*sizeof(int));
|
||||
|
||||
mSCRI.load(esm);
|
||||
|
||||
if (esm.isNextSub("ND3D"))
|
||||
esm.skipHSub();
|
||||
|
||||
mHasANIS = false;
|
||||
if (esm.isNextSub("ANIS"))
|
||||
{
|
||||
mHasANIS = true;
|
||||
esm.getHT(mANIS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +1,29 @@
|
||||
#include "importgame.hpp"
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
#include <components/esm3/esmreader.hpp>
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
void GAME::load(ESM::ESMReader &esm)
|
||||
{
|
||||
esm.getSubNameIs("GMDT");
|
||||
esm.getSubHeader();
|
||||
if (esm.getSubSize() == 92)
|
||||
{
|
||||
esm.getExact(&mGMDT, 92);
|
||||
mGMDT.mSecundaPhase = 0;
|
||||
}
|
||||
else if (esm.getSubSize() == 96)
|
||||
void GAME::load(ESM::ESMReader& esm)
|
||||
{
|
||||
esm.getT(mGMDT);
|
||||
}
|
||||
else
|
||||
esm.fail("unexpected subrecord size for GAME.GMDT");
|
||||
esm.getSubNameIs("GMDT");
|
||||
esm.getSubHeader();
|
||||
if (esm.getSubSize() == 92)
|
||||
{
|
||||
esm.getExact(&mGMDT, 92);
|
||||
mGMDT.mSecundaPhase = 0;
|
||||
}
|
||||
else if (esm.getSubSize() == 96)
|
||||
{
|
||||
esm.getT(mGMDT);
|
||||
}
|
||||
else
|
||||
esm.fail("unexpected subrecord size for GAME.GMDT");
|
||||
|
||||
mGMDT.mWeatherTransition &= (0x000000ff);
|
||||
mGMDT.mSecundaPhase &= (0x000000ff);
|
||||
mGMDT.mMasserPhase &= (0x000000ff);
|
||||
}
|
||||
mGMDT.mWeatherTransition &= (0x000000ff);
|
||||
mGMDT.mSecundaPhase &= (0x000000ff);
|
||||
mGMDT.mMasserPhase &= (0x000000ff);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
#include "importproj.h"
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
#include <components/esm3/esmreader.hpp>
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
void ESSImport::PROJ::load(ESM::ESMReader& esm)
|
||||
{
|
||||
while (esm.isNextSub("PNAM"))
|
||||
void ESSImport::PROJ::load(ESM::ESMReader& esm)
|
||||
{
|
||||
PNAM pnam;
|
||||
esm.getHT(pnam);
|
||||
mProjectiles.push_back(pnam);
|
||||
while (esm.isNextSub("PNAM"))
|
||||
{
|
||||
PNAM pnam;
|
||||
esm.getHT(pnam);
|
||||
mProjectiles.push_back(pnam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue