Merge remote-tracking branch 'origin/master' into hsh

This commit is contained in:
Luke Street 2020-09-28 20:14:09 -04:00
commit f4f840cb17
647 changed files with 22984 additions and 10477 deletions

View File

@ -6,7 +6,7 @@ clone_depth: 1
platform:
- x64
build_cloud: APOLLO
build_cloud: AXIODL-BUILDBOT
image: Windows
build:
@ -28,23 +28,23 @@ install:
############################################################################
# Install Ninja
############################################################################
- set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip"
- set NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip
- if not exist ninja.zip appveyor DownloadFile %NINJA_URL% -FileName ninja.zip
- if not exist ninja 7z x ninja.zip -oC:\projects\deps\ninja > nul
############################################################################
# Install a recent CMake
############################################################################
- set CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-win64-x64.zip"
- set CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-win64-x64.zip
- if not exist cmake.zip appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip
- if not exist cmake 7z x cmake.zip -oC:\projects\deps\cmake > nul
############################################################################
# Install custom LLVM
############################################################################
- set LLVM_URL="https://axiodl.com/files/LLVM-9.0.1-win64.exe"
- if not exist llvm.exe appveyor DownloadFile %LLVM_URL% -FileName llvm.exe
- if not exist llvm llvm.exe /S /D=C:\projects\deps\llvm
- set LLVM_URL=https://axiodl.com/files/LLVM-10.0.1-win64.exe
- if not exist LLVM-10.0.1-win64.exe appveyor DownloadFile %LLVM_URL% -FileName LLVM-10.0.1-win64.exe
- if not exist llvm-10.0.1 LLVM-10.0.1-win64.exe /S /D=C:\projects\deps\llvm-10.0.1
before_build:
# Configure ninja
@ -54,13 +54,11 @@ before_build:
- set PATH=C:\projects\deps\cmake\cmake-3.16.4-win64-x64\bin;%PATH%
- cmake --version
# Configure LLVM
- set PATH=C:\projects\deps\llvm\bin;%PATH%
- set PATH=C:\projects\deps\llvm-10.0.1\bin;%PATH%
- llvm-config --version
- clang-cl -v
- set CC=clang-cl -mrtm
- set CXX=clang-cl -mrtm
# Configure VS
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" amd64
# Fetch submodules
- cd %APPVEYOR_BUILD_FOLDER%
- git submodule update --init --recursive
@ -68,7 +66,7 @@ before_build:
build_script:
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DLLVM_ROOT_DIR=C:\projects\deps\llvm -GNinja ..
- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DLLVM_ROOT_DIR=C:\projects\deps\llvm-10.0.1 -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link -DCMAKE_AR=llvm-ar -DCMAKE_RANLIB=llvm-ranlib -GNinja ..
- ninja urde
#notifications:
@ -84,4 +82,4 @@ build_script:
# Uncomment this to debug AppVeyor failures.
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@ -2,6 +2,7 @@
BasedOnStyle: LLVM
ColumnLimit: 120
UseTab: Never
TabWidth: 2
---
Language: Cpp
DerivePointerAlignment: false
@ -9,11 +10,11 @@ PointerAlignment: Left
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
IndentCaseLabels: false
AllowShortBlocksOnASingleLine: true
AllowShortBlocksOnASingleLine: Always
AlignOperands: true
AlignTrailingComments: true
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
AlwaysBreakTemplateDeclarations: Yes
BreakConstructorInitializersBeforeComma: true
AlwaysBreakAfterReturnType: None
AlwaysBreakAfterDefinitionReturnType: None

View File

@ -1 +1 @@
Checks: '*,-misc-unused-parameters,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-convert-member-functions-to-static,-readability-uppercase-literal-suffix,-readability-magic-numbers,-hicpp-uppercase-literal-suffix,-hicpp-signed-bitwise,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-non-private-member-variables-in-classes,-fuchsia-*,-google-runtime-references'
Checks: '*,-misc-unused-parameters,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-convert-member-functions-to-static,-readability-uppercase-literal-suffix,-readability-magic-numbers,-hicpp-uppercase-literal-suffix,-hicpp-signed-bitwise,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-non-private-member-variables-in-classes,-fuchsia-*,-google-runtime-references,-llvmlibc-*'

7
.gitignore vendored
View File

@ -4,7 +4,8 @@ version.h
.DS_Store
*.autosave
docs/*
.idea/dictionaries
.idea/workspace.xml
.idea/misc.xml
.idea/
Editor/platforms/win/urde.rc
.vs/
out/
cmake-build-*/

View File

@ -13,7 +13,6 @@
cmake
-GNinja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DLLVM_ROOT_DIR=/opt/urde-llvm
-DURDE_DLPACKAGE=urde-$CI_PIPELINE_ID-macos-x86_64-$URDE_VECTOR_ISA
-DURDE_VECTOR_ISA=$URDE_VECTOR_ISA
..
@ -72,7 +71,7 @@ build:macos:avx2:
-DURDE_DLPACKAGE=urde-$CI_PIPELINE_ID-linux-x86_64-$URDE_VECTOR_ISA
-DURDE_VECTOR_ISA=$URDE_VECTOR_ISA
..
- ninja urde hecl visigen
- nice -n19 ninja -j8 urde hecl visigen
- cp Binaries/urde $CI_PROJECT_DIR
- strip --strip-debug -o $CI_PROJECT_DIR/urde Binaries/urde
- rm -r $CI_PROJECT_DIR/hecl
@ -113,34 +112,44 @@ build:linux:avx2:
variables:
<<: *build_variables
URDE_VECTOR_ISA: avx2
.build:win32: &win32_definition
stage: build
tags:
- win32
script:
- 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64'
- cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars.txt"
- >
Get-Content "$env:temp\vcvars.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "env:\$($matches[1])" $matches[2]
}
}
- mkdir build
- cd build
- >
cmake
-GNinja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DURDE_DLPACKAGE=urde-%CI_PIPELINE_ID%-win32-x86_64-%URDE_VECTOR_ISA%
-DURDE_VECTOR_ISA=%URDE_VECTOR_ISA%
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
-DURDE_DLPACKAGE="urde-$env:CI_PIPELINE_ID-win32-x86_64-$env:URDE_VECTOR_ISA"
-DURDE_VECTOR_ISA="$env:URDE_VECTOR_ISA"
-DLLVM_ROOT_DIR=C:\projects\deps\llvm
-DCMAKE_C_FLAGS=
-DCMAKE_CXX_FLAGS=
..
- ninja urde hecl visigen
- 'copy Binaries\urde.exe "%CI_PROJECT_DIR%\urde.exe"'
- 'pdbcopy Binaries\urde.pdb "%CI_PROJECT_DIR%\urde.pdb" -p'
- 'copy Binaries\hecl.exe "%CI_PROJECT_DIR%\hecl.exe"'
- 'pdbcopy Binaries\hecl.pdb "%CI_PROJECT_DIR%\hecl.pdb" -p'
- 'copy Binaries\visigen.exe "%CI_PROJECT_DIR%\visigen.exe"'
- 'pdbcopy Binaries\visigen.pdb "%CI_PROJECT_DIR%\visigen.pdb" -p'
- 'copy Binaries\urde.exe "$env:CI_PROJECT_DIR\urde.exe"'
- 'pdbcopy Binaries\urde.pdb "$env:CI_PROJECT_DIR\urde.pdb" -p'
- 'copy Binaries\hecl.exe "$env:CI_PROJECT_DIR\hecl.exe"'
- 'pdbcopy Binaries\hecl.pdb "$env:CI_PROJECT_DIR\hecl.pdb" -p'
- 'copy Binaries\visigen.exe "$env:CI_PROJECT_DIR\visigen.exe"'
- 'pdbcopy Binaries\visigen.pdb "$env:CI_PROJECT_DIR\visigen.pdb" -p'
only:
- release
- dev
artifacts:
name: "urde-%CI_PIPELINE_ID%-win32-x86_64-%URDE_VECTOR_ISA%"
name: "urde-$env:CI_PIPELINE_ID-win32-x86_64-$env:URDE_VECTOR_ISA"
paths:
- urde.exe
- urde.pdb

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="NAMESPACE_BRACE_PLACEMENT" value="5" />
<option name="FUNCTION_BRACE_PLACEMENT" value="5" />
<option name="BLOCK_BRACE_PLACEMENT" value="5" />
<option name="SPACE_WITHIN_TEMPLATE_DOUBLE_GT" value="false" />
<option name="SPACE_BEFORE_POINTER_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_POINTER_IN_DECLARATION" value="true" />
<option name="SPACE_BEFORE_REFERENCE_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
</Objective-C>
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="hpp" />
<pair source="c" header="h" />
</extensions>
</Objective-C-extensions>
<codeStyleSettings language="ObjectiveC">
<option name="BRACE_STYLE" value="5" />
<option name="CLASS_BRACE_STYLE" value="5" />
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

@ -1,35 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />
<option name="INDENT_CLASS_MEMBERS" value="2" />
<option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
<option name="SPACE_WITHIN_TEMPLATE_DOUBLE_GT" value="false" />
<option name="SPACE_BEFORE_POINTER_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_POINTER_IN_DECLARATION" value="true" />
<option name="SPACE_BEFORE_REFERENCE_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
</Objective-C>
<Objective-C-extensions>
<extensions>
<pair source="cpp" header="hpp" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
<clangFormatSettings>
<option name="ENABLED" value="true" />
</clangFormatSettings>
<codeStyleSettings language="ObjectiveC">
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

View File

@ -1,376 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<inspection_tool class="ARCIssues" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AccessorsWereOverridden" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AlwaysNilVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AmdModulesDependencies" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ArgumentSelectionDefectsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ArrayIssues" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="AssociatedTypeMismatch" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BadExpressionStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BibtexDuplicateBibliography" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BibtexDuplicateBibliographystyle" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BibtexDuplicateId" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BibtexMissingBibliographystyle" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BridgeCastIssues" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CallDealloc" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CallerJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CannotResolve" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CheckImageSize" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckNodeTest" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ClangTidyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptArgumentsOutsideFunction" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptFunctionSignatures" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptInfiniteLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptLiteralNotFunction" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptModulesDependencies" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptSillyAssignment" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptSwitchStatementWithNoDefaultBranch" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CoffeeScriptUnusedLocalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CommaExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstExpressionRequired" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ConstantConditionalExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantIfStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstructionIsNotAllowed" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ContinueOrBreakFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssFloatPxLength" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="CssInvalidAtRule" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssInvalidCharsetRule" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssInvalidElement" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssInvalidFunction" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssInvalidHtmlTagReference" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssInvalidImport" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssInvalidMediaFeature" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssInvalidPropertyValue" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssInvalidPseudoSelector" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssMissingComma" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssNegativeValue" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssNoGenericFontName" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssOverwrittenProperties" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssRedundantUnit" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssReplaceWithShorthandSafely" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="CssReplaceWithShorthandUnsafely" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="CssUnitlessNumber" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssUnknownProperty" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssUnknownTarget" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssUnresolvedClass" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssUnresolvedCustomProperty" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssUnusedSymbol" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DeprecatedAPI" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="DeprecatedApi" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DerivedFunctionsReturnTypeMismatch" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="DuplicateAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DuplicateCaseLabelJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DuplicateDeclarations" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="DuplicateSwitchCase" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ES6BindWithArrowFunction" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ES6CheckImport" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ES6ClassMemberInitializationOrder" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ES6ConvertModuleExportToExport" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="ES6ConvertRequireIntoImport" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="ES6ConvertToForOf" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="ES6ConvertVarToLetConst" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ES6MissingAwait" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="ES6ModulesDependencies" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ES6PossiblyAsyncFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ES6ShorthandObjectProperty" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="ES6UnusedImports" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EmptyDeclOrStmtInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EmptyStatementBodyJS" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_reportEmptyBlocks" value="false" />
</inspection_tool>
<inspection_tool class="ExceptionCaughtLocallyJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FallThroughInSwitchStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FieldMustBeInitialized" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="FlowJSConfig" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FlowJSFlagCommentPlacement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FunctionParameterCountMismatch" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="HardwiredNamespacePrefix" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HidesClassScope" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlDeprecatedAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlDeprecatedTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlFormInputWithoutLabel" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlRequiredAltAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlRequiredLangAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlRequiredTitleElement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ImplementationHasNoInterface" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ImplicitTypeConversion" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="IncompatibleMaskJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="IncompatibleTypes" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="IndexZeroUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InfiniteLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InfiniteRecursionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InitializationIssue" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="InitializerIssues" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="InjectedReferences" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="IntegerTypeRequired" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="InterfaceHasNoImplementation" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSAccessibilityCheck" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSAnnotator" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JSArrowFunctionBracesCanBeRemoved" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="JSAssignmentUsedAsCondition" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSBitwiseOperatorUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSCheckFunctionSignatures" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSClosureCompilerSyntax" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSCommentMatchesSignature" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSComparisonWithNaN" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSConsecutiveCommasInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSConstructorReturnsPrimitive" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSDeprecatedSymbols" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSDuplicatedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSEqualityComparisonWithCoercion" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSFileReferences" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSFunctionExpressionToArrowFunction" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="JSIgnoredPromiseFromCall" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSIncompatibleTypesComparison" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSJQueryEfficiency" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSJoinVariableDeclarationAndAssignment" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="JSLastCommaInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSLastCommaInObjectLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSMethodCanBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSMismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSMissingSwitchBranches" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="JSMissingSwitchDefault" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="JSNonASCIINames" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSObjectNullOrUndefined" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSPotentiallyInvalidConstructorUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSPotentiallyInvalidTargetOfIndexedPropertyAccess" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSPotentiallyInvalidUsageOfClassThis" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSPotentiallyInvalidUsageOfThis" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSPrimitiveTypeWrapperUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSRedeclarationOfBlockScope" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JSRedundantSwitchStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSReferencingArgumentsOutsideOfFunction" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JSReferencingMutableVariableFromClosure" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSRemoveUnnecessaryParentheses" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="JSStringConcatenationToES6Template" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="JSSuspiciousNameCombination" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSSwitchVariableDeclarationIssue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSTestFailedLine" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSTypeOfValues" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUndeclaredVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSUndefinedPropertyAssignment" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnfilteredForInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnreachableSwitchBranches" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedExtXType" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedLibraryURL" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnusedAssignment" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnusedGlobalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnusedLocalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSValidateJSDoc" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSValidateTypes" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSXNamespaceValidation" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="Json5StandardCompliance" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JsonSchemaCompliance" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JsonSchemaDeprecation" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JsonSchemaRefReference" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="KeyValueCodingInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LastArgumentMustBeNull" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexAvoidEqnarray" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexCdot" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexCiteBeforePeriod" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexCollapseCite" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexCommandAlreadyDefined" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexDiacriticIJ" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexDiscouragedUseOfDef" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexDuplicateDefinition" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexDuplicateLabel" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexEllipsis" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexEnDash" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexEncloseWithLeftRight" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexEquationReference" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexExtremeInequality" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexFigureNotReferenced" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexFileNotFound" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexGatherEquations" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexGroupedSubSupScript" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexInclusionLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexLabelConvention" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexLineBreak" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexMakeatletter" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexMathOperatorEscape" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexMightBreakTexify" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexMissingImport" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexMissingLabel" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexMultipleIncludes" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexNestedIncludes" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexNoExtension" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexNonBreakingSpace" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexNonMatchingEnvironment" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexNonMatchingIf" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexOverInsteadOfFrac" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexPrimitiveEquation" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexPrimitiveStyle" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexQedHere" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexRedundantEscape" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexRedundantPar" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexSentenceEndWithCapital" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexSpaceAfterAbbreviation" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexTooLargeSection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexTrimWhitespace" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexUnicode" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexUnresolvedReference" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LatexXInsteadOfTimes" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LessResolvedByNameOnly" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="LessUnresolvedMixin" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LessUnresolvedVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoopStatementThatDoesntLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MemberFunctionCanBeStaticInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="MemberVisibility" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="MethodIsLaterInTheScope" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MethodParameterCountMismatch" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="MssqlBuiltinInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MysqlParsingInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NoAttributeForProperty" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NoClassDefinition" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NoDefaultBaseConstructor" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="NoGetterOrSetter" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NodeModulesDependencies" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="NotAssignable" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="NotImplementedMethods" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NotImplementsProtocol" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NotInHierarchyMessage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NotReleasedValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NotVisibleClass" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NpmUsedModulesInstalled" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="OCLegacyObjCLiteralInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCNotLocalizedStringInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCNotReleasedIvarInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedClassInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedInstanceVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedMethodInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedPropertyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ObsoleteNSLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OctalIntegerJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OtherCpp" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="OtherObjC" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="OverriddenAttributeMismatch" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OverriddenTypeMismatch" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PackageJsonMismatchedDependency" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PgSelectFromProcedureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PointerTypeRequired" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="PointlessArithmeticExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PointlessBooleanExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PrivateCategoryShouldBeNearImplementation" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PropertyAndIvarTypeMismatch" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyAsyncCallInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyCompatibilityInspection" enabled="false" level="WARNING" enabled_by_default="false">
<option name="ourVersions">
<value>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="2.7" />
<item index="1" class="java.lang.String" itemvalue="3.6" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyDataclassInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyProtocolInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyRaisingNewStyleClassInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyStubPackagesAdvertiser" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyStubPackagesCompatibilityInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyTestParametrizedInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyTypeHintsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RedundantSuppression" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RedundantTypeConversion" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RegExpUnexpectedAnchor" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ReleasingOfAssignProperties" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ReservedWordUsedAsNameJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ReturnFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SassScssResolvedByNameOnly" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="SassScssUnresolvedMixin" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SassScssUnresolvedPlaceholderSelector" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SassScssUnresolvedVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ScalarTypeRequired" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="SetterForReadonlyProperty" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ShiftOutOfRangeJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SillyAssignmentJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="SqlAddNotNullColumnInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlAggregatesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlAmbiguousColumnInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlAutoIncrementDuplicateInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlCheckUsingColumnsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlConstantConditionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDeprecateTypeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDerivedTableAliasInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDialectInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDropIndexedColumnInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlErrorHandlingInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SqlIdentifierInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlIllegalCursorStateInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlInsertValuesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlJoinWithoutOnInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlNullComparisonInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlRedundantOrderingDirectionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SqlShouldBeInGroupByInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlSideEffectsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlSignatureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlStorageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlTriggerTransitionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlTypeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlUnreachableCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlUnusedSubqueryItemInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlUnusedVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlWithoutWhereInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="StaticnessMismatch" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="StringLocalizationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SuspiciousTypeOfGuard" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TemplateArgumentsIssues" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ThisExpressionReferencesGlobalObjectJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ThrowFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TrivialConditionalJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TrivialIfJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptAbstractClassConstructorCanBeMadeProtected" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptAccessibilityCheck" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptCheckImport" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="TypeScriptConfig" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptFieldCanBeMadeReadonly" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptLibrary" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="TypeScriptMissingAugmentationImport" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="TypeScriptPreferShortImport" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptSuspiciousConstructorParameterAssignment" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptUMDGlobal" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptUnresolvedVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptValidateJSTypes" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="TypeScriptValidateTypes" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="TypescriptExplicitMemberType" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="UnavailableInDeploymentTarget" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryContinueJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnBreakStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnContinueStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLocalVariableJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryReturnJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnreachableCode" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnreachableCodeJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnresolvedCollectionMessage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnresolvedMessage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnterminatedStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UsingZeroAsNil" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="WebpackConfigHighlighting" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="WithStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlDeprecatedElement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XsltDeclarations" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltTemplateInvocation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltUnusedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XsltVariableShadowing" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="YAMLDuplicatedKeys" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="YAMLRecursiveAlias" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="YAMLSchemaDeprecation" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="YAMLSchemaValidation" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="YAMLUnresolvedAlias" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="YAMLUnusedAnchor" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/urde.iml" filepath="$PROJECT_DIR$/.idea/urde.iml" />
</modules>
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python facet">
<configuration sdkName="" />
</facet>
</component>
</module>

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/Editor/locale" vcs="Git" />
<mapping directory="$PROJECT_DIR$/NESEmulator/fixNES" vcs="Git" />
<mapping directory="$PROJECT_DIR$/amuse" vcs="Git" />
<mapping directory="$PROJECT_DIR$/assetnameparser/tinyxml2" vcs="Git" />
<mapping directory="$PROJECT_DIR$/boo2" vcs="Git" />
<mapping directory="$PROJECT_DIR$/boo2/logvisor" vcs="Git" />
<mapping directory="$PROJECT_DIR$/boo2/logvisor/fmt" vcs="Git" />
<mapping directory="$PROJECT_DIR$/discord-rpc" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl-gui" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/athena" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/athena/extern/fmt" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/athena/extern/lzokay" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/libSquish" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/libjpeg-turbo" vcs="Git" />
<mapping directory="$PROJECT_DIR$/jbus" vcs="Git" />
<mapping directory="$PROJECT_DIR$/kabufuda" vcs="Git" />
<mapping directory="$PROJECT_DIR$/nod" vcs="Git" />
<mapping directory="$PROJECT_DIR$/nod/logvisor" vcs="Git" />
<mapping directory="$PROJECT_DIR$/nod/logvisor/fmt" vcs="Git" />
<mapping directory="$PROJECT_DIR$/rapidjson" vcs="Git" />
<mapping directory="$PROJECT_DIR$/rapidjson/thirdparty/gtest" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sanitizers-cmake" vcs="Git" />
<mapping directory="$PROJECT_DIR$/zeus" vcs="Git" />
</component>
</project>

View File

@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
# Allow target_link_libraries with targets in other directories
cmake_policy(SET CMP0079 NEW)
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
@ -88,7 +91,10 @@ if(MSVC)
add_compile_options(
# Disable exceptions
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
$<$<COMPILE_LANGUAGE:CXX>:/EHsc->
# Disable RTTI
$<$<COMPILE_LANGUAGE:CXX>:/GR->
# Enforce various standards compliant behavior.
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
@ -102,6 +108,7 @@ if(MSVC)
# Use latest C++ standard.
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
)
add_compile_definitions(FMT_EXCEPTIONS=0 _HAS_EXCEPTIONS=0)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Flags for MSVC (not clang-cl)
@ -153,6 +160,11 @@ else()
if (HAS_NO_PLT)
add_compile_options(-fno-plt)
endif()
check_cxx_compiler_flag(-fno-asynchronous-unwind-tables HAS_NO_ASYNC_UNWIND_TABLES)
if (HAS_NO_ASYNC_UNWIND_TABLES)
# Binary size reduction
add_compile_options(-fno-asynchronous-unwind-tables)
endif()
if(URDE_MSAN)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++> -fsanitize=memory
@ -160,9 +172,15 @@ else()
endif()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
-Wall -Wno-multichar -Werror=implicit-fallthrough -Wno-unknown-warning-option
-Wno-lto-type-mismatch -Wno-unused-variable -Wno-unused-private-field
-Wall -Wno-multichar -Werror=implicit-fallthrough
-Wno-unused-variable -Wno-unused-result
-Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Werror)
# doesn't work with generator expression in add_compile_options?
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
add_compile_options(-Wno-unknown-warning-option -Wno-unused-private-field)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-Wno-lto-type-mismatch)
endif()
add_compile_definitions(FMT_EXCEPTIONS=0)
if(APPLE)
@ -203,7 +221,7 @@ endif()
if(USE_LD_LLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "LLD")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld -Wl,--build-id=uuid")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
if(USE_LTO)
add_compile_options(-flto=thin)
@ -224,8 +242,8 @@ if(USE_LD_GOLD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
if(USE_LTO)
add_compile_options(-flto=thin)
add_link_options(-flto=thin)
add_compile_options(-flto)
add_link_options(-flto)
message(STATUS "GNU gold linker enabled with LTO.")
else()
message(STATUS "GNU gold linker enabled.")
@ -251,7 +269,7 @@ add_subdirectory(nod)
set(HECL_DLPACKAGE ${URDE_DLPACKAGE})
set(DATA_SPEC_LIBS RetroDataSpec)
set(DATA_SPEC_LIBS RetroDataSpec AssetNameMap)
set(HECL_DATASPEC_DECLS
"/* RetroCommon specs */
namespace DataSpec
@ -326,7 +344,7 @@ add_subdirectory(visigen)
add_dependencies(hecl visigen)
if (NOT WINDOWS_STORE AND NOT NX)
find_package(Qt5Widgets)
find_package(Qt5Widgets PATHS /usr/local/opt/qt)
if (Qt5Widgets_FOUND)
message(STATUS "Qt5 found, hecl-gui will be built")
add_subdirectory(hecl-gui)

237
CMakeSettings.json Normal file
View File

@ -0,0 +1,237 @@
{
"configurations": [
{
"name": "x64-Clang-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "clang_cl_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreadedDebug",
"type": "STRING"
},
{
"name": "CMAKE_C_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_LINKER",
"value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_AR",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ar.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_RANLIB",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ranlib.exe",
"type": "FILEPATH"
}
]
},
{
"name": "x64-Clang-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "clang_cl_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreaded",
"type": "STRING"
},
{
"name": "CMAKE_C_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_LINKER",
"value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_AR",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ar.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_RANLIB",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ranlib.exe",
"type": "FILEPATH"
}
]
},
{
"name": "x64-Clang-Release-vcpkg",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "clang_cl_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
},
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreaded",
"type": "STRING"
},
{
"name": "CMAKE_C_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_LINKER",
"value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_AR",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ar.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_RANLIB",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ranlib.exe",
"type": "FILEPATH"
}
]
},
{
"name": "x64-MSVC-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreadedDebug",
"type": "STRING"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "",
"type": "STRING"
},
{
"name": "CMAKE_C_FLAGS",
"value": "",
"type": "STRING"
}
]
},
{
"name": "x64-MSVC-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreaded",
"type": "STRING"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "",
"type": "STRING"
},
{
"name": "CMAKE_C_FLAGS",
"value": "",
"type": "STRING"
}
]
},
{
"name": "x64-MSVC-Release-vcpkg",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
},
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreaded",
"type": "STRING"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "",
"type": "STRING"
},
{
"name": "CMAKE_C_FLAGS",
"value": "",
"type": "STRING"
}
]
}
]
}

View File

@ -1,3 +1,3 @@
message(STATUS "32-bit asset name map not found; downloading to '${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin'")
file(DOWNLOAD "https://axiodl.com/files/AssetNameMap32.dat"
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin SHOW_PROGRESS EXPECTED_HASH SHA1=e1df648c04d4caaf0821266464c672e0c337b6f0)
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin SHOW_PROGRESS EXPECTED_HASH SHA1=90b4e941c192eef41c81e60314f348bc787d1336)

View File

@ -1,3 +1,3 @@
message(STATUS "64-bit asset name map not found; downloading to '${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin'")
file(DOWNLOAD "https://axiodl.com/files/AssetNameMap64.dat"
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin SHOW_PROGRESS EXPECTED_HASH SHA1=335abe49d4848ddc7bb2d623acc76918365bc705)
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin SHOW_PROGRESS EXPECTED_HASH SHA1=e49c03c9fff66adccec7af8120dda091636513e2)

View File

@ -1,10 +1,13 @@
#include "AssetNameMap.hpp"
#include "athena/Compression.hpp"
#include "athena/MemoryReader.hpp"
extern "C" const uint8_t ASSET_NAME_MP32[];
extern "C" const size_t ASSET_NAME_MP32_SZ;
extern "C" const size_t ASSET_NAME_MP32_DECOMPRESSED_SZ;
extern "C" const uint8_t ASSET_NAME_MP64[];
extern "C" const size_t ASSET_NAME_MP64_SZ;
extern "C" const size_t ASSET_NAME_MP64_DECOMPRESSED_SZ;
namespace DataSpec::AssetNameMap {
logvisor::Module Log("AssetNameMap");
@ -53,20 +56,34 @@ void InitAssetNameMap() {
Log.report(logvisor::Info, FMT_STRING("Initializing asset name database..."));
/* First load the 32bit map for MP1/2 */
{
athena::io::MemoryReader ar(ASSET_NAME_MP32, ASSET_NAME_MP32_SZ);
if (ASSET_NAME_MP32_DECOMPRESSED_SZ != 0u) {
auto* decompressed = new uint8_t[ASSET_NAME_MP32_DECOMPRESSED_SZ];
athena::io::Compression::decompressZlib(ASSET_NAME_MP32, ASSET_NAME_MP32_SZ, decompressed,
ASSET_NAME_MP32_DECOMPRESSED_SZ);
athena::io::MemoryReader ar(decompressed, ASSET_NAME_MP32_DECOMPRESSED_SZ);
LoadAssetMap(ar);
delete[](decompressed);
} else {
Log.report(logvisor::Warning,
FMT_STRING(_SYS_STR("AssetNameMap32 unavailable; Assets will not have proper filenames for most files.")));
}
/* Now load the 64bit map for MP3 */
{
athena::io::MemoryReader ar(ASSET_NAME_MP64, ASSET_NAME_MP64_SZ);
if (ASSET_NAME_MP64_DECOMPRESSED_SZ != 0u) {
auto* decompressed = new uint8_t[ASSET_NAME_MP64_DECOMPRESSED_SZ];
athena::io::Compression::decompressZlib(ASSET_NAME_MP64, ASSET_NAME_MP64_SZ, decompressed,
ASSET_NAME_MP64_DECOMPRESSED_SZ);
athena::io::MemoryReader ar(decompressed, ASSET_NAME_MP64_DECOMPRESSED_SZ);
LoadAssetMap(ar);
delete[](decompressed);
} else {
Log.report(logvisor::Warning,
FMT_STRING(_SYS_STR("AssetNameMap64 unavailable; Assets will not have proper filenames for most files.")));
}
g_AssetNameMapInit = true;
}
const std::string* TranslateIdToName(const UniqueID32& id) {
if (g_AssetNameMap.find(id.toUint64()) == g_AssetNameMap.end())
if (g_AssetNameMap.find(id.toUint64()) == g_AssetNameMap.cend())
return nullptr;
return &g_AssetNameMap[id.toUint64()].name;

View File

@ -0,0 +1,9 @@
#include <cstddef>
#include <cstdint>
extern "C" const uint8_t ASSET_NAME_MP32[] = {0};
extern "C" const size_t ASSET_NAME_MP32_SZ = 0;
extern "C" const size_t ASSET_NAME_MP32_DECOMPRESSED_SZ = 0;
extern "C" const uint8_t ASSET_NAME_MP64[] = {0};
extern "C" const size_t ASSET_NAME_MP64_SZ = 0;
extern "C" const size_t ASSET_NAME_MP64_DECOMPRESSED_SZ = 0;

View File

@ -42,11 +42,11 @@ bintoc(RetroMasterShader.cpp Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
# Download asset name databases
add_custom_command(OUTPUT AssetNameMap32.bin COMMAND ${CMAKE_COMMAND} ARGS -P
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap32Download.cmake)
bintoc(AssetNameMap32.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32)
bintoc_compress(AssetNameMap32.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32)
add_custom_command(OUTPUT AssetNameMap64.bin COMMAND ${CMAKE_COMMAND} ARGS -P
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap64Download.cmake)
bintoc(AssetNameMap64.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64)
bintoc_compress(AssetNameMap64.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64)
# Each game's DataSpec implementation
add_library(RetroDataSpec
@ -65,13 +65,16 @@ add_library(RetroDataSpec
Blender/RetroMasterShader.py
AssetNameMap.hpp
AssetNameMap.cpp
AssetNameMap32.bin AssetNameMap32.cpp
AssetNameMap64.bin AssetNameMap64.cpp
RetroMasterShader.cpp)
add_library(AssetNameMap
AssetNameMap32.bin AssetNameMap32.cpp
AssetNameMap64.bin AssetNameMap64.cpp)
add_library(AssetNameMapNull
AssetNameMapNull.cpp)
target_include_directories(RetroDataSpec PUBLIC ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
target_include_directories(RetroDataSpec PUBLIC ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod squish hecl-full ${PNG_LIB} ${ZLIB_LIBRARIES} lzokay logvisor)
target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod squish hecl-full ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} lzokay logvisor)
if(COMMAND add_sanitizers)
add_sanitizers(RetroDataSpec)
endif()
@ -85,4 +88,4 @@ foreach(i RANGE ${count})
target_atdna(RetroDataSpec ${src} ${header})
endforeach()
add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_PROPERTY:RetroDataSpec,INCLUDE_DIRECTORIES>")
add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_PROPERTY:RetroDataSpec,INCLUDE_DIRECTORIES>")

View File

@ -15,10 +15,11 @@
namespace DataSpec::DNAANCS {
template <class PAKRouter, class ANCSDNA, class MaterialSet, class SurfaceHeader, atUint32 CMDLVersion>
bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, const hecl::ProjectPath& outPath,
bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const hecl::ProjectPath& outPath,
PAKRouter& pakRouter, const typename PAKRouter::EntryType& entry, const SpecBase& dataspec,
std::function<void(const hecl::SystemChar*)> fileChanged, bool force) {
/* Extract character CMDL/CSKR first */
auto& conn = btok.getBlenderConnection();
/* Extract character CMDL/CSKR/CINF first */
std::vector<CharacterResInfo<typename PAKRouter::IDType>> chResInfo;
ancs.getCharacterResInfo(chResInfo);
for (const auto& info : chResInfo) {
@ -49,11 +50,19 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
conn.saveBlend();
}
}
if (const typename PAKRouter::EntryType* cinfE = pakRouter.lookupEntry(info.cinf, &node, true, false)) {
hecl::ProjectPath cinfPath = pakRouter.getWorking(cinfE);
if (cinfPath.getPathType() == hecl::ProjectPath::Type::None) {
PAKEntryReadStream rs = cinfE->beginReadStream(*node);
ANCSDNA::CINFType::Extract(dataspec, rs, cinfPath, pakRouter, *cinfE, false, btok, fileChanged);
}
}
}
/* Extract attachment CMDL/CSKRs first */
/* Extract attachment CMDL/CSKR/CINFs first */
auto attRange = pakRouter.lookupCharacterAttachmentRigs(entry.id);
for (auto it = attRange.first; it != attRange.second; ++it) {
auto cinfid = it->second.first.cinf;
auto cmdlid = it->second.first.cmdl;
const nod::Node* node;
@ -61,8 +70,9 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.isNone()) {
cmdlPath.makeDirChain(false);
if (!conn.createBlend(cmdlPath, hecl::blender::BlendType::Mesh))
if (!conn.createBlend(cmdlPath, hecl::blender::BlendType::Mesh)) {
return false;
}
std::string bestName = pakRouter.getBestEntryName(*cmdlE);
hecl::SystemStringConv bestNameView(bestName);
@ -84,6 +94,15 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
conn.saveBlend();
}
}
if (cinfid.isValid()) {
if (const typename PAKRouter::EntryType* cinfE = pakRouter.lookupEntry(cinfid, &node, true, false)) {
hecl::ProjectPath cinfPath = pakRouter.getWorking(cinfE);
if (cinfPath.getPathType() == hecl::ProjectPath::Type::None) {
PAKEntryReadStream rs = cinfE->beginReadStream(*node);
ANCSDNA::CINFType::Extract(dataspec, rs, cinfPath, pakRouter, *cinfE, false, btok, fileChanged);
}
}
}
}
std::string bestName = pakRouter.getBestEntryName(entry);
@ -253,17 +272,17 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
template bool
ReadANCSToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::ANCS, DNAMP1::MaterialSet, DNACMDL::SurfaceHeader_1, 2>(
hecl::blender::Connection& conn, const DNAMP1::ANCS& ancs, const hecl::ProjectPath& outPath,
hecl::blender::Token& btok, const DNAMP1::ANCS& ancs, const hecl::ProjectPath& outPath,
PAKRouter<DNAMP1::PAKBridge>& pakRouter, const typename PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
const SpecBase& dataspec, std::function<void(const hecl::SystemChar*)> fileChanged, bool force);
template bool
ReadANCSToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::ANCS, DNAMP2::MaterialSet, DNACMDL::SurfaceHeader_2, 4>(
hecl::blender::Connection& conn, const DNAMP2::ANCS& ancs, const hecl::ProjectPath& outPath,
hecl::blender::Token& btok, const DNAMP2::ANCS& ancs, const hecl::ProjectPath& outPath,
PAKRouter<DNAMP2::PAKBridge>& pakRouter, const typename PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
const SpecBase& dataspec, std::function<void(const hecl::SystemChar*)> fileChanged, bool force);
template bool
ReadANCSToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::CHAR, DNAMP3::MaterialSet, DNACMDL::SurfaceHeader_3, 4>(
hecl::blender::Connection& conn, const DNAMP3::CHAR& ancs, const hecl::ProjectPath& outPath,
hecl::blender::Token& btok, const DNAMP3::CHAR& ancs, const hecl::ProjectPath& outPath,
PAKRouter<DNAMP3::PAKBridge>& pakRouter, const typename PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
const SpecBase& dataspec, std::function<void(const hecl::SystemChar*)> fileChanged, bool force);

View File

@ -41,7 +41,7 @@ struct AnimationResInfo {
};
template <class PAKRouter, class ANCSDNA, class MaterialSet, class SurfaceHeader, atUint32 CMDLVersion>
bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, const hecl::ProjectPath& outPath,
bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const hecl::ProjectPath& outPath,
PAKRouter& pakRouter, const typename PAKRouter::EntryType& entry, const SpecBase& dataspec,
std::function<void(const hecl::SystemChar*)> fileChanged, bool force = false);

View File

@ -13,7 +13,7 @@ constexpr s32 AROT_MAX_LEVEL = 10;
constexpr s32 AROT_MIN_MODELS = 8;
constexpr s32 COLLISION_MIN_NODE_TRIANGLES = 8;
constexpr s32 PATH_MIN_NODE_REGIONS = 16;
constexpr float AROT_MIN_SUBDIV = 10.f;
constexpr float AROT_MIN_SUBDIV = 8.f;
static zeus::CAABox SplitAABB(const zeus::CAABox& aabb, int i) {
zeus::CAABox pos, neg;

View File

@ -145,14 +145,14 @@ public:
atUint32 addedVerts = 0;
atUint32 nextVert = 1;
while (nextVert < m_nextOverPos) {
for (const auto& ev : m_extraVerts) {
for (const auto& se : ev.second) {
for (const auto& [ev, evVec] : m_extraVerts) {
for (const auto& se : evVec) {
if (se.second == nextVert) {
os.format(FMT_STRING(
"bm.verts.ensure_lookup_table()\n"
"orig_vert = bm.verts[{}]\n"
"vert = bm.verts.new(orig_vert.co)\n"),
ev.first + baseVert);
ev + baseVert);
rp.first.second->weightVertex(os, *rp.second.second, se.first);
++nextVert;
++addedVerts;

View File

@ -9,6 +9,7 @@ make_dnalist(CMDL
EGMC
SAVWCommon
ParticleCommon
URDEVersionInfo
Tweaks/ITweakPlayerGun)
set(DNACOMMON_SOURCES
@ -40,6 +41,7 @@ set(DNACOMMON_SOURCES
RigInverter.hpp RigInverter.cpp
AROTBuilder.hpp AROTBuilder.cpp
OBBTreeBuilder.hpp OBBTreeBuilder.cpp
URDEVersionInfo.hpp
Tweaks/ITweak.hpp
Tweaks/TweakWriter.hpp
Tweaks/ITweakGame.hpp

View File

@ -253,7 +253,7 @@ struct PEImpl : BigDNA {
_Basis::gatherDependencies(deps, m_elem);
}
operator bool() const { return m_elem.operator bool(); }
explicit operator bool() const { return m_elem.operator bool(); }
auto* get() const { return m_elem.get(); }
auto* operator->() const { return get(); }
void reset() { m_elem.reset(); }
@ -565,7 +565,7 @@ struct IUVElement : IElement {
struct BoolHelper : IElement {
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
bool value = false;
operator bool() const { return value; }
explicit operator bool() const { return value; }
BoolHelper& operator=(bool val) {
value = val;
return *this;
@ -610,7 +610,7 @@ struct ValueHelper : BigDNA {
std::optional<Tp> value = {};
void emplace(Tp val) { value.emplace(val); }
Tp operator*() const { return *value; }
operator bool() const { return value.operator bool(); }
explicit operator bool() const { return value.operator bool(); }
};
struct RELifetimeTween : IRealElement {
@ -917,9 +917,9 @@ struct IEMultiply : IIntElement {
struct IESampleAndHold : IIntElement {
AT_DECL_DNA_YAMLV_NO_TYPE
IntElementFactory val;
IntElementFactory waitMin;
IntElementFactory waitMax;
IntElementFactory val;
std::string_view ClassID() const override { return "SPAH"sv; }
};
@ -1247,12 +1247,12 @@ struct VESphere : IEmitterElement {
struct VEAngleSphere : IEmitterElement {
AT_DECL_DNA_YAMLV_NO_TYPE
VectorElementFactory sphereOrigin;
RealElementFactory sphereRadius;
RealElementFactory magnitude;
RealElementFactory angleXBias;
RealElementFactory angleYBias;
RealElementFactory angleXRange;
RealElementFactory angleYRange;
RealElementFactory sphereRadius;
RealElementFactory magnitude;
std::string_view ClassID() const override { return "ASPH"sv; }
};
@ -1333,7 +1333,7 @@ struct SpawnSystemKeyframeData : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
AT_SUBDECL_DNA
operator bool() const { return spawns.size() != 0; }
explicit operator bool() const { return spawns.size() != 0; }
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
for (const auto& p : spawns)
@ -1347,7 +1347,7 @@ struct ChildResourceFactory : BigDNA {
IDType id;
AT_DECL_EXPLICIT_DNA_YAML
AT_SUBDECL_DNA
operator bool() const { return id.isValid(); }
explicit operator bool() const { return id.isValid(); }
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
if (id.isValid())
g_curSpec->flattenDependencies(id, pathsOut);

View File

@ -21,6 +21,9 @@ struct ITweakPlayerRes : ITweak {
ResId x18_minesBreakSecondTopIcon;
ResId x1c_minesBreakSecondBottomIcon;
ResId rs5_mapArrowUp;
ResId rs5_mapArrowDown;
/* N, U, UL, L, DL, D, DR, R, UR */
std::array<ResId, 9> x24_lStick;
std::array<ResId, 9> x4c_cStick;

View File

@ -0,0 +1,24 @@
#pragma once
#include <string>
#include "DataSpec/DNACommon/DNACommon.hpp"
namespace DataSpec {
enum class ERegion { Invalid = -1, NTSC_U = 'E', PAL = 'P', NTSC_J = 'J' };
enum class EGame {
Invalid = 0,
MetroidPrime1,
MetroidPrime2,
MetroidPrime3,
};
struct URDEVersionInfo : BigDNA {
AT_DECL_DNA_YAML
String<-1> version;
Value<ERegion> region;
Value<EGame> game;
Value<bool> isTrilogy;
};
} // namespace DataSpec

View File

@ -975,9 +975,8 @@ bool ANCS::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
}
if (force || blendType == hecl::ProjectPath::Type::None) {
hecl::blender::Connection& conn = btok.getBlenderConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1, 2>(
conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
btok, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
}

View File

@ -30,6 +30,7 @@
#include "PATH.hpp"
#include "DataSpec/DNACommon/Tweaks/TweakWriter.hpp"
#include "DataSpec/DNACommon/URDEVersionInfo.hpp"
#include "Tweaks/CTweakPlayerRes.hpp"
#include "Tweaks/CTweakGunRes.hpp"
#include "Tweaks/CTweakPlayer.hpp"
@ -237,8 +238,8 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
if (animResInfo.evntId.isValid()) {
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(animResInfo.evntId);
evntEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_evnt"), id, animResInfo.name);
charAssoc.m_cskrToCharacter[animResInfo.evntId] =
std::make_pair(entry.id, fmt::format(FMT_STRING("{}_{}.evnt.yaml"), animResInfo.name, animResInfo.evntId));
charAssoc.m_cskrToCharacter[animResInfo.evntId] = std::make_pair(
entry.id, fmt::format(FMT_STRING("{}_{}.evnt.yaml"), animResInfo.name, animResInfo.evntId));
}
}
} else if (entry.type == FOURCC('MREA')) {
@ -275,8 +276,8 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry).getParentPath();
if (mlvl.worldNameId.isValid())
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath,
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
pathOverrides[mlvl.worldNameId] =
hecl::ProjectPath(mlvlDirPath, fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
for (const MLVL::Area& area : mlvl.areas) {
{
@ -292,8 +293,8 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
if (area.areaNameId.isValid())
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath,
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId));
pathOverrides[area.areaNameId] =
hecl::ProjectPath(areaDirPath, fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId));
}
if (mlvl.worldMap.isValid()) {
@ -383,8 +384,14 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
std::string catalogueName;
std::string name = pak.bestEntryName(pakNode, entry, catalogueName);
if (!catalogueName.empty()) {
if (catalogueName == "PlayerRes"sv)
return {ExtractTweak<CTweakPlayerRes>, {_SYS_STR(".yaml")}};
if (catalogueName == "PlayerRes"sv) {
if (isCurrentSpecWii() || getCurrentRegion() == ERegion::PAL || getCurrentRegion() == ERegion::NTSC_J) {
/* We need to use the new rep for these tweaks */
return {ExtractTweak<CTweakPlayerRes<true>>, {_SYS_STR(".yaml")}};
}
/* We need to use the old rep for these tweaks */
return {ExtractTweak<CTweakPlayerRes<false>>, {_SYS_STR(".yaml")}};
}
if (catalogueName == "GunRes"sv)
return {ExtractTweak<CTweakGunRes>, {_SYS_STR(".yaml")}};
if (catalogueName == "Player"sv)
@ -395,8 +402,14 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
return {ExtractTweak<CTweakSlideShow>, {_SYS_STR(".yaml")}};
if (catalogueName == "Game"sv)
return {ExtractTweak<CTweakGame>, {_SYS_STR(".yaml")}};
if (catalogueName == "Targeting"sv)
return {ExtractTweak<CTweakTargeting>, {_SYS_STR(".yaml")}};
if (catalogueName == "Targeting"sv) {
if (isCurrentSpecWii() || getCurrentRegion() == ERegion::PAL || getCurrentRegion() == ERegion::NTSC_J) {
/* We need to use the new rep for these tweaks */
return {ExtractTweak<CTweakTargeting<true>>, {_SYS_STR(".yaml")}};
}
/* We need to use the old rep for these tweaks */
return {ExtractTweak<CTweakTargeting<false>>, {_SYS_STR(".yaml")}};
}
if (catalogueName == "Gui"sv)
return {ExtractTweak<CTweakGui>, {_SYS_STR(".yaml")}};
if (catalogueName == "AutoMapper"sv)

View File

@ -358,21 +358,21 @@ void MREA::Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKB
void MREA::MeshHeader::VisorFlags::setFromBlenderProps(const std::unordered_map<std::string, std::string>& props) {
auto search = props.find("retro_disable_enviro_visor");
if (search != props.cend() && search->second == "True")
if (search != props.cend() && search->second == "1")
setDisableEnviro(true);
search = props.find("retro_disable_thermal_visor");
if (search != props.cend() && search->second == "True")
if (search != props.cend() && search->second == "1")
setDisableThermal(true);
search = props.find("retro_disable_xray_visor");
if (search != props.cend() && search->second == "True")
if (search != props.cend() && search->second == "1")
setDisableXray(true);
search = props.find("retro_thermal_level");
if (search != props.cend()) {
if (search->second == "COOL")
if (search->second == "0")
setThermalLevel(ThermalLevel::Cool);
else if (search->second == "HOT")
else if (search->second == "1")
setThermalLevel(ThermalLevel::Hot);
else if (search->second == "WARM")
else if (search->second == "2")
setThermalLevel(ThermalLevel::Warm);
}
}

View File

@ -3,6 +3,7 @@
#include "DNAMP1.hpp"
#include "PAK.hpp"
#include "AGSC.hpp"
#include "DataSpec/AssetNameMap.hpp"
namespace DataSpec::DNAMP1 {
@ -176,6 +177,11 @@ std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, std
}
}
/* Prefer asset name map second */
if (const auto* name = AssetNameMap::TranslateIdToName(entry.id)) {
return fmt::format(FMT_STRING("{}_{}"), *name, entry.id);
}
/* Otherwise return ID format string */
return fmt::format(FMT_STRING("{}_{}"), entry.type, entry.id);
}

View File

@ -18,9 +18,9 @@ struct Drone : IScriptObject {
DamageInfo damageInfo1;
Value<atUint32> unknown3;
DamageInfo damageInfo2;
Value<atUint32> unknown4;
Value<atUint32> unknown5;
Value<atUint32> unknown6;
UniqueID32 unknown4;
Value<atUint32> unused;
UniqueID32 unknown6;
FlareDefinition flareDefinition1;
FlareDefinition flareDefinition2;
FlareDefinition flareDefinition3;
@ -73,6 +73,8 @@ struct Drone : IScriptObject {
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const override {
g_curSpec->flattenDependencies(unknown4, pathsOut);
g_curSpec->flattenDependencies(unknown6, pathsOut);
g_curSpec->flattenDependencies(crsc, pathsOut);
flareDefinition1.depIDs(pathsOut);
flareDefinition2.depIDs(pathsOut);

View File

@ -7,10 +7,12 @@ namespace DataSpec::DNAMP1 {
hecl::CVar* tw_fov = nullptr;
hecl::CVar* tw_hardmodeDMult = nullptr;
hecl::CVar* tw_hardmodeWMult = nullptr;
hecl::CVar* tw_splashScreensDisabled = nullptr;
namespace {
constexpr std::string_view skFov = "tweak.game.FieldOfView"sv;
constexpr std::string_view skHardModeDamageMultName = "tweak.game.HardModeDamageMult"sv;
constexpr std::string_view skHardModeWeaponMultName = "tweak.game.HardModeWeaponMult"sv;
constexpr std::string_view skSplashScreensDisabled = "tweak.game.SplashScreensDisabled"sv;
} // anonymous namespace
void CTweakGame::_tweakGameListener(hecl::CVar* cv) {
@ -20,6 +22,8 @@ void CTweakGame::_tweakGameListener(hecl::CVar* cv) {
x60_hardmodeDamageMult = cv->toReal();
} else if (cv == tw_hardmodeWMult) {
x64_hardmodeWeaponMult = cv->toReal();
} else if (cv == tw_splashScreensDisabled) {
x2b_splashScreensDisabled = cv->toBoolean();
}
}
@ -32,14 +36,23 @@ void CTweakGame::initCVars(hecl::CVarManager* mgr) {
cv->addListener([this](hecl::CVar* cv) { _tweakGameListener(cv); });
return cv;
};
auto assignBoolValue = [this, mgr](std::string_view name, std::string_view desc, bool& v, hecl::CVar::EFlags flags) {
hecl::CVar* cv = mgr->findOrMakeCVar(name, desc, v, flags);
// Check if the CVar was deserialized, this avoid an unnecessary conversion
if (cv->wasDeserialized())
v = cv->toBoolean();
cv->addListener([this](hecl::CVar* cv) { _tweakGameListener(cv); });
return cv;
};
tw_fov = assignRealValue(skFov, "", x24_fov,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive);
tw_fov = assignRealValue(skFov, "", x24_fov, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive);
tw_hardmodeDMult =
assignRealValue(skHardModeDamageMultName, "", x60_hardmodeDamageMult,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Cheat);
tw_hardmodeWMult =
assignRealValue(skHardModeWeaponMultName, "", x64_hardmodeWeaponMult,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Cheat);
tw_splashScreensDisabled = assignBoolValue(skSplashScreensDisabled, "", x2b_splashScreensDisabled,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive);
}
} // namespace DataSpec::DNAMP1

View File

@ -1,10 +1,11 @@
#pragma once
#include "../../DNACommon/Tweaks/ITweakPlayerRes.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp"
namespace DataSpec::DNAMP1 {
struct CTweakPlayerRes final : ITweakPlayerRes {
template <bool NewRep>
struct AT_SPECIALIZE_PARMS(true, false) CTweakPlayerRes final : ITweakPlayerRes {
AT_DECL_DNA_YAML
String<-1> m_saveStationIcon;
@ -16,6 +17,9 @@ struct CTweakPlayerRes final : ITweakPlayerRes {
String<-1> m_minesBreakSecondTopIcon;
String<-1> m_minesBreakSecondBottomIcon;
String<AT_DNA_COUNT(NewRep == true ? -1 : 0)> m_mapArrowDown;
String<AT_DNA_COUNT(NewRep == true ? -1 : 0)> m_mapArrowUp;
String<-1> m_lStickN;
String<-1> m_lStickU;
String<-1> m_lStickUL;

View File

@ -1,9 +1,10 @@
#pragma once
#include "../../DNACommon/Tweaks/ITweakTargeting.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakTargeting.hpp"
namespace DataSpec::DNAMP1 {
struct CTweakTargeting final : public ITweakTargeting {
template<bool NewRep>
struct AT_SPECIALIZE_PARMS(true, false) CTweakTargeting final : public ITweakTargeting {
AT_DECL_DNA_YAML
Value<atUint32> x4_targetRadiusMode;
Value<float> x8_currLockOnExitDuration;
@ -132,6 +133,69 @@ struct CTweakTargeting final : public ITweakTargeting {
Value<float> x220_scanTargetClampMax;
Value<float> x224_angularLagSpeed;
// RS5
Vector<float, AT_DNA_COUNT(NewRep == true ? 1 : 0)> x218_;
Vector<float, AT_DNA_COUNT(NewRep == true ? 1 : 0)> x21c_;
bool x224_ = true;
bool x225_ = false;
bool x226_ = true;
bool x227_ = true;
bool x22c_ = true;
bool x22d_ = false;
bool x22e_ = true;
bool x22f_ = true;
bool x234_ = true;
bool x235_ = false;
bool x236_ = true;
bool x237_ = true;
zeus::CVector3f x23c_ = zeus::skZero3f;
float x2c8_ = 0.25f;
float x2cc_ = 0.35f;
zeus::CColor x2d0_ = (zeus::Comp32)0xb6e6ffff;
float x2d4_ = 0.39215687f;
zeus::CColor x2d8_ = (zeus::Comp32)0xa82a00ff;
float x2dc_ = 0.78431374f;
zeus::CVector3f x2e0_ = zeus::CVector3f(0.f, 0.f, 0.46f);
float x2ec_ = 0.25f;
float x2f0_ = 0.25f;
float x2f4_ = 120.f;
float x2f8_ = 0.25f;
float x2fc_ = 3.5f;
float x300_ = 0.35f;
zeus::CColor x304_ = (zeus::Comp32)0xa82a00ff;
float x308_ = 0.78431374f;
zeus::CColor x30c_ = (zeus::Comp32)0x89d6ffff;
float x310_ = 0.5019608f;
float x314_ = 11.25f;
float x318_ = 0.25f;
float x31c_ = 0.125f;
zeus::CColor x320_ = (zeus::Comp32)0xffca28ff;
float x324_ = 0.78431374f;
zeus::CColor x328_ = (zeus::Comp32)0x89d6ffff;
float x32c_ = 0.19607843f;
float x330_ = 0.f;
float x334_ = 0.25f;
float x338_ = 3.f;
float x33c_ = 0.25f;
float x340_ = 0.25f;
float x344_ = 0.25f;
float x348_ = 0.25f;
float x34c_ = 45.f;
float x350_ = 0.5f;
float x354_ = 0.65f;
float x358_ = 1.5f;
float x35c_ = 0.18f;
float x360_ = 0.15f;
float x364_ = 0.25f;
zeus::CColor x368_ = (zeus::Comp32)0x56c1fb9f;
zeus::CColor x36c_ = (zeus::Comp32)0x49c3f6a0;
zeus::CColor x370_ = (zeus::Comp32)0x49c3f631;
zeus::CColor x374_ = (zeus::Comp32)0xff8930ff;
zeus::CColor x378_ = (zeus::Comp32)0xff2f28ff;
zeus::CColor x37c_ = (zeus::Comp32)0x93e9ffff;
zeus::CColor x380_ = (zeus::Comp32)0xff6b60ff;
CTweakTargeting() = default;
CTweakTargeting(athena::io::IStreamReader& r) {
this->read(r);

View File

@ -215,9 +215,8 @@ struct ANCS : BigDNA {
}
if (force || blendType == hecl::ProjectPath::Type::None) {
hecl::blender::Connection& conn = btok.getBlenderConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_2, 4>(
conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
btok, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
}

View File

@ -283,9 +283,8 @@ struct CHAR : BigDNA {
}
if (force || blendType == hecl::ProjectPath::Type::None) {
hecl::blender::Connection& conn = btok.getBlenderConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, CHAR, MaterialSet, DNACMDL::SurfaceHeader_3, 4>(
conn, aChar, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
btok, aChar, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
}

View File

@ -22,15 +22,11 @@ namespace DataSpec::DNAMP3 {
logvisor::Module Log("urde::DNAMP3");
static bool GetNoShare(std::string_view name) {
if (name == "UniverseArea.pak"sv)
return false;
std::string lowerName(name);
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (!lowerName.compare(0, 7, "metroid"))
return false;
if (!lowerName.compare(0, 5, "rs5fe"))
return false;
return true;
return !lowerName.starts_with("metroid"sv) && !lowerName.starts_with("frontend"sv) &&
!lowerName.starts_with("rs5fe"sv) && !lowerName.starts_with("universearea"sv) &&
!lowerName.starts_with("mp1fe"sv);
}
PAKBridge::PAKBridge(const nod::Node& node, bool doExtract)

View File

@ -3,11 +3,12 @@
#include <cstdlib>
#endif
#include "SpecBase.hpp"
#include "Blender/BlenderSupport.hpp"
#include "DNACommon/DNACommon.hpp"
#include "DNACommon/TXTR.hpp"
#include "AssetNameMap.hpp"
#include "DataSpec/SpecBase.hpp"
#include "DataSpec/Blender/BlenderSupport.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/TXTR.hpp"
#include "DataSpec/AssetNameMap.hpp"
#include "DataSpec/DNACommon/URDEVersionInfo.hpp"
#include "hecl/ClientProcess.hpp"
#include "nod/DiscBase.hpp"
#include "nod/nod.hpp"
@ -38,11 +39,19 @@ static const hecl::SystemChar* MomErr[] = {_SYS_STR("Your metroid is in another
constexpr uint32_t MomErrCount = std::extent<decltype(MomErr)>::value;
static ERegion g_CurRegion = ERegion::Invalid;
static bool g_CurSpecIsWii = false;
ERegion getCurrentRegion() { return g_CurRegion; }
bool isCurrentSpecWii() { return g_CurSpecIsWii; }
SpecBase::SpecBase(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
: hecl::Database::IDataSpec(specEntry)
, m_project(project)
, m_pc(pc)
, m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {
, m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend")
, m_region(ERegion::Invalid)
, m_game(EGame::Invalid) {
AssetNameMap::InitAssetNameMap();
SpecBase::setThreadProject();
}
@ -75,20 +84,25 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
if (m_standalone && !checkStandaloneID(gameID))
return false;
char region = m_disc->getHeader().m_gameID[3];
m_region = ERegion(m_disc->getHeader().m_gameID[3]);
const hecl::SystemString* regstr = &regNONE;
switch (region) {
case 'E':
switch (m_region) {
case ERegion::NTSC_U:
regstr = &regE;
break;
case 'J':
case ERegion::NTSC_J:
regstr = &regJ;
break;
case 'P':
case ERegion::PAL:
regstr = &regP;
break;
default:
break;
}
setCurRegion(m_region);
setCurSpecIsWii(m_isWii);
if (m_standalone)
return checkFromStandaloneDisc(*m_disc, *regstr, info.extractArgs, reps);
else
@ -126,8 +140,7 @@ bool IsPathAudioGroup(const hecl::ProjectPath& path) {
}
static bool IsPathSong(const hecl::ProjectPath& path) {
if (path.getPathType() != hecl::ProjectPath::Type::Glob ||
!path.getWithExtension(_SYS_STR(".mid"), true).isFile() ||
if (path.getPathType() != hecl::ProjectPath::Type::Glob || !path.getWithExtension(_SYS_STR(".mid"), true).isFile() ||
!path.getWithExtension(_SYS_STR(".yaml"), true).isFile()) {
return path.isFile() && path.getLastComponentExt() == _SYS_STR("mid") &&
path.getWithExtension(_SYS_STR(".yaml"), true).isFile();
@ -309,7 +322,8 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
hecl::SystemStringConv chSysName(sub.name);
if (!sub.cskrId.empty()) {
hecl::SystemStringConv cskrSysName(sub.cskrId);
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.CSKR")), chSysName, cskrSysName)));
pathsOut.push_back(
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.CSKR")), chSysName, cskrSysName)));
} else {
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.CSKR")), chSysName)));
}
@ -325,7 +339,8 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
flattenDependenciesBlend(overlay.mesh, pathsOut, btok);
pathsOut.push_back(overlay.mesh);
}
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, overlayCskrId)));
pathsOut.push_back(asGlob.ensureAuxInfo(
fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, overlayCskrId)));
}
}
};
@ -343,7 +358,8 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
hecl::SystemStringConv chSysName(att.name);
hecl::SystemStringConv sysCskrId(att.cskrId);
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}_{}.CSKR")), chSysName, sysCskrId)));
pathsOut.push_back(
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}_{}.CSKR")), chSysName, sysCskrId)));
if (att.armature >= 0) {
const auto& arm = actor.armatures[att.armature];
@ -356,8 +372,9 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
hecl::SystemStringConv actSysName(act.first);
hecl::SystemStringConv actAnimId(act.second);
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.ANIM")), actSysName, actAnimId)));
hecl::SystemString searchPrefix(asGlob.getWithExtension(
fmt::format(FMT_STRING(_SYS_STR(".{}_")), actSysName).c_str(), true).getLastComponent());
hecl::SystemString searchPrefix(
asGlob.getWithExtension(fmt::format(FMT_STRING(_SYS_STR(".{}_")), actSysName).c_str(), true)
.getLastComponent());
hecl::ProjectPath evntPath;
for (const auto& ent : dEnum) {
if (hecl::StringUtils::BeginsWith(ent.m_name, searchPrefix.c_str()) &&
@ -626,8 +643,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
std::unordered_set<urde::SObjectTag> addedTags;
addedTags.reserve(buildList.size());
for (auto& tag : buildList) {
if ((i == 0 && tag.type == FOURCC('CMDL')) ||
(i == 1 && tag.type != FOURCC('CMDL'))) {
if ((i == 0 && tag.type == FOURCC('CMDL')) || (i == 1 && tag.type != FOURCC('CMDL'))) {
if (addedTags.find(tag) != addedTags.end())
continue;
addedTags.insert(tag);
@ -975,7 +991,7 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDoc
/* Classify intermediate into tag */
urde::SObjectTag pathTag = buildTagFromPath(path);
if (pathTag) {
std::unique_lock<std::mutex> lk(m_backgroundIndexMutex);
std::unique_lock lk{m_backgroundIndexMutex};
bool useGlob = false;
/* Special multi-resource intermediates */
@ -1008,11 +1024,10 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDoc
hecl::SystemStringConv overlaySys(overlay.first);
hecl::SystemStringConv overlayCskrId(overlay.second);
if (!overlay.second.empty()) {
subPath =
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), subName, overlaySys, overlayCskrId));
subPath = asGlob.ensureAuxInfo(
fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), subName, overlaySys, overlayCskrId));
} else {
subPath =
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}.CSKR")), subName, overlaySys));
subPath = asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}.CSKR")), subName, overlaySys));
}
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
}
@ -1024,11 +1039,10 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDoc
hecl::SystemStringConv attachmentCskrId(attachment.second);
hecl::ProjectPath subPath;
if (!attachment.second.empty()) {
subPath =
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}_{}.CSKR")), attachmentSys, attachmentCskrId));
subPath = asGlob.ensureAuxInfo(
fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}_{}.CSKR")), attachmentSys, attachmentCskrId));
} else {
subPath =
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}.CSKR")), attachmentSys));
subPath = asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}.CSKR")), attachmentSys));
}
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
}
@ -1162,8 +1176,8 @@ void SpecBase::backgroundIndexProc() {
}
}
}
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Name index of '{}' loaded; {} names")), getOriginalSpec().m_name,
m_catalogNameToTag.size());
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Name index of '{}' loaded; {} names")),
getOriginalSpec().m_name, m_catalogNameToTag.size());
}
}
}
@ -1206,4 +1220,23 @@ void SpecBase::waitForIndexComplete() const {
}
}
void SpecBase::WriteVersionInfo(hecl::Database::Project& project, const hecl::ProjectPath& pakPath) {
hecl::ProjectPath versionPath(pakPath, _SYS_STR("version.yaml"));
versionPath.makeDirChain(false);
URDEVersionInfo info;
info.version = m_version;
info.region = m_region;
info.game = m_game;
info.isTrilogy = !m_standalone;
athena::io::FileWriter writer(versionPath.getAbsolutePath());
athena::io::ToYAMLStream(info, writer);
}
void SpecBase::setCurRegion(ERegion region) {
g_CurRegion = region;
}
void SpecBase::setCurSpecIsWii(bool isWii) {
g_CurSpecIsWii = isWii;
}
} // namespace DataSpec

View File

@ -23,6 +23,10 @@ class YAMLDocWriter;
} // namespace athena::io
namespace DataSpec {
enum class ERegion;
enum class EGame;
ERegion getCurrentRegion();
bool isCurrentSpecWii();
struct SpecBase : hecl::Database::IDataSpec {
/* HECL Adaptors */
@ -179,8 +183,8 @@ protected:
bool m_backgroundRunning = false;
void readCatalog(const hecl::ProjectPath& catalogPath, athena::io::YAMLDocWriter& nameWriter);
void insertPathTag(athena::io::YAMLDocWriter& cacheWriter, const urde::SObjectTag& tag,
const hecl::ProjectPath& path, bool dump = true);
void insertPathTag(athena::io::YAMLDocWriter& cacheWriter, const urde::SObjectTag& tag, const hecl::ProjectPath& path,
bool dump = true);
bool addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDocWriter& cacheWriter);
void backgroundIndexRecursiveProc(const hecl::ProjectPath& path, athena::io::YAMLDocWriter& cacheWriter,
athena::io::YAMLDocWriter& nameWriter, int level);
@ -197,8 +201,16 @@ protected:
const std::unordered_map<urde::CAssetId, std::vector<uint8_t>>& mlvlData);
std::unique_ptr<nod::DiscBase> m_disc;
bool m_isWii;
bool m_standalone;
bool m_isWii{};
bool m_standalone{};
ERegion m_region;
EGame m_game;
std::string m_version;
void WriteVersionInfo(hecl::Database::Project& project, const hecl::ProjectPath& pakPath);
static void setCurRegion(ERegion region);
static void setCurSpecIsWii(bool isWii);
};
bool IsPathAudioGroup(const hecl::ProjectPath& path);

View File

@ -29,6 +29,7 @@
#include "DNACommon/DPSC.hpp"
#include "DNACommon/DGRP.hpp"
#include "DNACommon/MAPU.hpp"
#include "DNACommon/URDEVersionInfo.hpp"
#include "DNACommon/Tweaks/TweakWriter.hpp"
#include "DNAMP1/Tweaks/CTweakPlayerRes.hpp"
#include "DNAMP1/Tweaks/CTweakGunRes.hpp"
@ -46,7 +47,6 @@
#include "DNAMP1/Tweaks/CTweakPlayerGun.hpp"
#include "DNAMP1/MazeSeeds.hpp"
#include "DNAMP1/SnowForces.hpp"
#include "hecl/ClientProcess.hpp"
#include "hecl/MultiProgressPrinter.hpp"
#include "hecl/Blender/Connection.hpp"
@ -63,7 +63,8 @@ extern hecl::Database::DataSpecEntry SpecEntMP1PC;
extern hecl::Database::DataSpecEntry SpecEntMP1ORIG;
struct TextureCache {
static void Generate(PAKRouter<DNAMP1::PAKBridge>& pakRouter, hecl::Database::Project& project, const hecl::ProjectPath& pakPath) {
static void Generate(PAKRouter<DNAMP1::PAKBridge>& pakRouter, hecl::Database::Project& project,
const hecl::ProjectPath& pakPath) {
hecl::ProjectPath texturePath(pakPath, _SYS_STR("texture_cache.yaml"));
hecl::ProjectPath catalogPath(pakPath, _SYS_STR("!catalog.yaml"));
texturePath.makeDirChain(false);
@ -112,9 +113,8 @@ struct TextureCache {
metaPairs.emplace_back(projectPath.parsedHash32(), meta);
}
std::sort(metaPairs.begin(), metaPairs.end(), [](const auto& a, const auto& b) -> bool {
return a.first < b.first;
});
std::sort(metaPairs.begin(), metaPairs.end(),
[](const auto& a, const auto& b) -> bool { return a.first < b.first; });
athena::io::FileWriter w(outPath.getAbsolutePath());
w.writeUint32Big(metaPairs.size());
@ -145,7 +145,8 @@ struct SpecMP1 : SpecBase {
, m_workPath(project.getProjectWorkingPath(), _SYS_STR("MP1"))
, m_cookPath(project.getProjectCookedPath(SpecEntMP1), _SYS_STR("MP1"))
, m_pakRouter(*this, m_workPath, m_cookPath) {
setThreadProject();
m_game = EGame::MetroidPrime1;
SpecBase::setThreadProject();
}
void buildPaks(nod::Node& root, const std::vector<hecl::SystemString>& args, ExtractReport& rep) {
@ -197,8 +198,9 @@ struct SpecMP1 : SpecBase {
/* Sort PAKs alphabetically */
m_orderedPaks.clear();
for (DNAMP1::PAKBridge& dpak : m_paks)
for (DNAMP1::PAKBridge& dpak : m_paks) {
m_orderedPaks[std::string(dpak.getName())] = &dpak;
}
/* Assemble extract report */
rep.childOpts.reserve(m_orderedPaks.size());
@ -218,18 +220,19 @@ struct SpecMP1 : SpecBase {
const std::vector<hecl::SystemString>& args, std::vector<ExtractReport>& reps) override {
nod::IPartition* partition = disc.getDataPartition();
m_dolBuf = partition->getDOLBuf();
const char* buildInfo = (char*)memmem(m_dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
const char* buildInfo =
static_cast<char*>(memmem(m_dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16)) + 19;
if (!buildInfo)
if (buildInfo == nullptr)
return false;
m_version = std::string(buildInfo);
/* Root Report */
ExtractReport& rep = reps.emplace_back();
rep.name = _SYS_STR("MP1");
rep.desc = _SYS_STR("Metroid Prime ") + regstr;
if (buildInfo) {
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
hecl::SystemStringConv buildView(m_version);
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
}
@ -275,15 +278,15 @@ struct SpecMP1 : SpecBase {
}
m_dolBuf = dolIt->getBuf();
const char* buildInfo = (char*)memmem(m_dolBuf.get(), dolIt->size(), "MetroidBuildInfo", 16) + 19;
const char* buildInfo = static_cast<char*>(memmem(m_dolBuf.get(), dolIt->size(), "MetroidBuildInfo", 16)) + 19;
/* Root Report */
ExtractReport& rep = reps.emplace_back();
rep.name = _SYS_STR("MP1");
rep.desc = _SYS_STR("Metroid Prime ") + regstr;
if (buildInfo) {
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
if (buildInfo != nullptr) {
m_version = std::string(buildInfo);
hecl::SystemStringConv buildView(m_version);
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
}
@ -378,6 +381,14 @@ struct SpecMP1 : SpecBase {
/* Generate Texture Cache containing meta data for every texture file */
TextureCache::Generate(m_pakRouter, m_project, noAramPath);
/* Write version data */
hecl::ProjectPath versionPath;
if (m_standalone) {
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files"));
} else {
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files/MP1"));
}
WriteVersionInfo(m_project, versionPath);
return true;
}
@ -417,7 +428,9 @@ struct SpecMP1 : SpecBase {
return true;
else if (classType == DNAFont::FONT<UniqueID32>::DNAType())
return true;
else if (classType == DNAMP1::CTweakPlayerRes::DNAType())
else if (classType == DNAMP1::CTweakPlayerRes<true>::DNAType())
return true;
else if (classType == DNAMP1::CTweakPlayerRes<false>::DNAType())
return true;
else if (classType == DNAMP1::CTweakGunRes::DNAType())
return true;
@ -431,7 +444,9 @@ struct SpecMP1 : SpecBase {
return true;
else if (classType == DNAMP1::CTweakAutoMapper::DNAType())
return true;
else if (classType == DNAMP1::CTweakTargeting::DNAType())
else if (classType == DNAMP1::CTweakTargeting<true>::DNAType())
return true;
else if (classType == DNAMP1::CTweakTargeting<false>::DNAType())
return true;
else if (classType == DNAMP1::CTweakGui::DNAType())
return true;
@ -572,13 +587,15 @@ struct SpecMP1 : SpecBase {
} else if (className == DataSpec::DNAMP1::SCAN::DNAType()) {
resTag.type = SBIG('SCAN');
return true;
} else if (className == DataSpec::DNAMP1::CTweakPlayerRes::DNAType() ||
} else if (className == DataSpec::DNAMP1::CTweakPlayerRes<true>::DNAType() ||
className == DataSpec::DNAMP1::CTweakPlayerRes<false>::DNAType() ||
className == DataSpec::DNAMP1::CTweakGunRes::DNAType() ||
className == DataSpec::DNAMP1::CTweakSlideShow::DNAType() ||
className == DataSpec::DNAMP1::CTweakPlayer::DNAType() ||
className == DataSpec::DNAMP1::CTweakCameraBob::DNAType() ||
className == DataSpec::DNAMP1::CTweakGame::DNAType() ||
className == DataSpec::DNAMP1::CTweakTargeting::DNAType() ||
className == DataSpec::DNAMP1::CTweakTargeting<true>::DNAType() ||
className == DataSpec::DNAMP1::CTweakTargeting<false>::DNAType() ||
className == DataSpec::DNAMP1::CTweakAutoMapper::DNAType() ||
className == DataSpec::DNAMP1::CTweakGui::DNAType() ||
className == DataSpec::DNAMP1::CTweakPlayerControl::DNAType() ||
@ -740,7 +757,8 @@ struct SpecMP1 : SpecBase {
}
if (!colMesh)
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find mesh named 'CMESH' in {}")), in.getAbsolutePath());
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find mesh named 'CMESH' in {}")),
in.getAbsolutePath());
std::vector<Light> lights = ds.compileLights();
@ -822,8 +840,12 @@ struct SpecMP1 : SpecBase {
DNAFont::FONT<UniqueID32> font;
font.read(reader);
DNAFont::WriteFONT(font, out);
} else if (classStr == DNAMP1::CTweakPlayerRes::DNAType()) {
DNAMP1::CTweakPlayerRes playerRes;
} else if (classStr == DNAMP1::CTweakPlayerRes<true>::DNAType()) {
DNAMP1::CTweakPlayerRes<true> playerRes;
playerRes.read(reader);
WriteTweak(playerRes, out);
} else if (classStr == DNAMP1::CTweakPlayerRes<false>::DNAType()) {
DNAMP1::CTweakPlayerRes<false> playerRes;
playerRes.read(reader);
WriteTweak(playerRes, out);
} else if (classStr == DNAMP1::CTweakGunRes::DNAType()) {
@ -850,8 +872,12 @@ struct SpecMP1 : SpecBase {
DNAMP1::CTweakAutoMapper autoMapper;
autoMapper.read(reader);
WriteTweak(autoMapper, out);
} else if (classStr == DNAMP1::CTweakTargeting::DNAType()) {
DNAMP1::CTweakTargeting targeting;
} else if (classStr == DNAMP1::CTweakTargeting<true>::DNAType()) {
DNAMP1::CTweakTargeting<false> targeting;
targeting.read(reader);
WriteTweak(targeting, out);
} else if (classStr == DNAMP1::CTweakTargeting<false>::DNAType()) {
DNAMP1::CTweakTargeting<false> targeting;
targeting.read(reader);
WriteTweak(targeting, out);
} else if (classStr == DNAMP1::CTweakGui::DNAType()) {
@ -1131,7 +1157,8 @@ struct SpecMP1 : SpecBase {
}
void buildPakList(hecl::blender::Token& btok, athena::io::FileWriter& w, const std::vector<urde::SObjectTag>& list,
const std::vector<std::pair<urde::SObjectTag, std::string>>& nameList, atUint64& resTableOffset) override {
const std::vector<std::pair<urde::SObjectTag, std::string>>& nameList,
atUint64& resTableOffset) override {
w.writeUint32Big(m_pc ? 0x80030005 : 0x00030005);
w.writeUint32Big(0);

View File

@ -12,6 +12,7 @@
#include "DNACommon/MAPU.hpp"
#include "DNACommon/PATH.hpp"
#include "DNACommon/TXTR.hpp"
#include "DNACommon/URDEVersionInfo.hpp"
#include "hecl/ClientProcess.hpp"
#include "hecl/Blender/Connection.hpp"
@ -111,7 +112,8 @@ struct SpecMP2 : SpecBase {
, m_workPath(project.getProjectWorkingPath(), _SYS_STR("MP2"))
, m_cookPath(project.getProjectCookedPath(SpecEntMP2), _SYS_STR("MP2"))
, m_pakRouter(*this, m_workPath, m_cookPath) {
setThreadProject();
m_game = EGame::MetroidPrime2;
SpecBase::setThreadProject();
}
void buildPaks(nod::Node& root, const std::vector<hecl::SystemString>& args, ExtractReport& rep) {
@ -183,16 +185,17 @@ struct SpecMP2 : SpecBase {
const std::vector<hecl::SystemString>& args, std::vector<ExtractReport>& reps) override {
nod::IPartition* partition = disc.getDataPartition();
std::unique_ptr<uint8_t[]> dolBuf = partition->getDOLBuf();
const char* buildInfo = (char*)memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
if (!buildInfo)
const char* buildInfo = static_cast<char*>(memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16)) + 19;
if (buildInfo == nullptr) {
return false;
}
m_version = std::string(buildInfo);
/* Root Report */
ExtractReport& rep = reps.emplace_back();
rep.name = _SYS_STR("MP2");
rep.desc = _SYS_STR("Metroid Prime 2 ") + regstr;
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
hecl::SystemStringConv buildView(m_version);
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
/* Iterate PAKs and build level options */
@ -206,7 +209,7 @@ struct SpecMP2 : SpecBase {
const std::vector<hecl::SystemString>& args, std::vector<ExtractReport>& reps) override {
std::vector<hecl::SystemString> mp2args;
bool doExtract = false;
if (args.size()) {
if (!args.empty()) {
/* Needs filter */
for (const hecl::SystemString& arg : args) {
hecl::SystemString lowerArg = arg;
@ -237,15 +240,15 @@ struct SpecMP2 : SpecBase {
}
std::unique_ptr<uint8_t[]> dolBuf = dolIt->getBuf();
const char* buildInfo = (char*)memmem(dolBuf.get(), dolIt->size(), "MetroidBuildInfo", 16) + 19;
const char* buildInfo = static_cast<char*>(memmem(dolBuf.get(), dolIt->size(), "MetroidBuildInfo", 16)) + 19;
/* Root Report */
ExtractReport& rep = reps.emplace_back();
rep.name = _SYS_STR("MP2");
rep.desc = _SYS_STR("Metroid Prime 2 ") + regstr;
if (buildInfo) {
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
if (buildInfo != nullptr) {
m_version = std::string(buildInfo);
hecl::SystemStringConv buildView(m_version);
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
}
@ -317,6 +320,14 @@ struct SpecMP2 : SpecBase {
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _SYS_STR("MP2/URDE"));
TextureCache::Generate(m_pakRouter, m_project, noAramPath);
/* Write version data */
hecl::ProjectPath versionPath;
if (m_standalone) {
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files"));
} else {
versionPath = hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files/MP2"));
}
WriteVersionInfo(m_project, versionPath);
return true;
}

View File

@ -9,6 +9,7 @@
#include "DataSpec/DNAMP3/MAPA.hpp"
#include "DataSpec/DNAMP2/STRG.hpp"
#include "DataSpec/DNACommon/TXTR.hpp"
#include "DataSpec/DNACommon/URDEVersionInfo.hpp"
#include "hecl/ClientProcess.hpp"
#include "hecl/Blender/Connection.hpp"
@ -89,11 +90,7 @@ struct TextureCache {
};
struct SpecMP3 : SpecBase {
bool checkStandaloneID(const char* id) const override {
if (!memcmp(id, "RM3", 3))
return true;
return false;
}
bool checkStandaloneID(const char* id) const override { return memcmp(id, "RM3", 3) == 0; }
bool doMP3 = false;
std::vector<const nod::Node*> m_nonPaks;
@ -102,6 +99,7 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath m_workPath;
hecl::ProjectPath m_cookPath;
hecl::ProjectPath m_outPath;
PAKRouter<DNAMP3::PAKBridge> m_pakRouter;
/* These are populated when extracting MPT's frontend (uses MP3's DataSpec) */
@ -112,6 +110,7 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath m_feWorkPath;
hecl::ProjectPath m_feCookPath;
hecl::ProjectPath m_feOutPath;
PAKRouter<DNAMP3::PAKBridge> m_fePakRouter;
SpecMP3(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
@ -122,7 +121,8 @@ struct SpecMP3 : SpecBase {
, m_feWorkPath(project.getProjectWorkingPath(), _SYS_STR("fe"))
, m_feCookPath(project.getProjectCookedPath(SpecEntMP3), _SYS_STR("fe"))
, m_fePakRouter(*this, m_feWorkPath, m_feCookPath) {
setThreadProject();
m_game = EGame::MetroidPrime3;
SpecBase::setThreadProject();
}
void buildPaks(nod::Node& root, const std::vector<hecl::SystemString>& args, ExtractReport& rep, bool fe) {
@ -223,20 +223,22 @@ struct SpecMP3 : SpecBase {
doMP3 = true;
nod::IPartition* partition = disc.getDataPartition();
std::unique_ptr<uint8_t[]> dolBuf = partition->getDOLBuf();
const char* buildInfo = (char*)memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
if (!buildInfo)
const char* buildInfo = static_cast<char*>(memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16)) + 19;
if (buildInfo == nullptr) {
return false;
}
/* We don't want no stinking demo dammit */
if (!strcmp(buildInfo, "Build v3.068 3/2/2006 14:55:13"))
if (strcmp(buildInfo, "Build v3.068 3/2/2006 14:55:13") == 0) {
return false;
}
m_version = std::string(buildInfo);
/* Root Report */
ExtractReport& rep = reps.emplace_back();
rep.name = _SYS_STR("MP3");
rep.desc = _SYS_STR("Metroid Prime 3 ") + regstr;
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
hecl::SystemStringConv buildView(m_version);
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
/* Iterate PAKs and build level options */
@ -317,8 +319,8 @@ struct SpecMP3 : SpecBase {
rep.name = _SYS_STR("MP3");
rep.desc = _SYS_STR("Metroid Prime 3 ") + regstr;
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
m_version = std::string(buildInfo);
hecl::SystemStringConv buildView(m_version);
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
/* Iterate PAKs and build level options */
@ -386,8 +388,8 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath mp3OutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/MP3"));
mp3OutPath.makeDirChain(true);
m_outPath = {outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/MP3")};
m_outPath.makeDirChain(true);
currentTarget = _SYS_STR("MP3 Root");
progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0);
@ -396,7 +398,7 @@ struct SpecMP3 : SpecBase {
nodeCount = m_nonPaks.size();
// TODO: Make this more granular
for (const nod::Node* node : m_nonPaks) {
node->extractToDirectory(mp3OutPath.getAbsolutePath(), ctx);
node->extractToDirectory(m_outPath.getAbsolutePath(), ctx);
prog++;
}
ctx.progressCB = nullptr;
@ -438,8 +440,8 @@ struct SpecMP3 : SpecBase {
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath feOutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/fe"));
feOutPath.makeDirChain(true);
m_feOutPath = {outPath, _SYS_STR("files/fe")};
m_feOutPath.makeDirChain(true);
currentTarget = _SYS_STR("fe Root");
progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0);
@ -448,7 +450,7 @@ struct SpecMP3 : SpecBase {
// TODO: Make this more granular
for (const nod::Node* node : m_feNonPaks) {
node->extractToDirectory(feOutPath.getAbsolutePath(), ctx);
node->extractToDirectory(m_feOutPath.getAbsolutePath(), ctx);
prog++;
}
progress.print(currentTarget.c_str(), _SYS_STR(""), 1.0);
@ -473,12 +475,24 @@ struct SpecMP3 : SpecBase {
}
process.waitUntilComplete();
}
/* Extract part of .dol for RandomStatic entropy */
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _SYS_STR("MP3/URDE"));
/* Generate Texture Cache containing meta data for every texture file */
/* Generate Texture Cache containing meta data for every texture file */
if (doMP3) {
hecl::ProjectPath noAramPath(m_workPath, _SYS_STR("URDE"));
TextureCache::Generate(m_pakRouter, m_project, noAramPath);
}
if (doMPTFE) {
hecl::ProjectPath noAramPath(m_feWorkPath, _SYS_STR("URDE"));
TextureCache::Generate(m_fePakRouter, m_project, noAramPath);
}
/* Write version data */
if (doMP3) {
WriteVersionInfo(m_project, m_outPath);
}
if (doMPTFE) {
WriteVersionInfo(m_project, m_feOutPath);
}
return true;
}

View File

@ -73,7 +73,7 @@ public:
};
protected:
const hecl::Database::Project* m_proj = nullptr;
hecl::Database::Project* m_proj = nullptr;
const hecl::Database::DataSpecEntry* m_origSpec = nullptr;
const hecl::Database::DataSpecEntry* m_pcSpec = nullptr;
/* Used to resolve cooked paths */
@ -155,9 +155,7 @@ public:
void Shutdown() { CancelBackgroundIndex(); }
bool IsBusy() const { return m_asyncLoadMap.size() != 0; }
SObjectTag TagFromPath(hecl::SystemStringView path) const {
return TagFromPath(hecl::ProjectPath(*(hecl::Database::Project*)m_proj, path));
}
SObjectTag TagFromPath(hecl::SystemStringView path) const { return TagFromPath(hecl::ProjectPath(*m_proj, path)); }
~ProjectResourceFactoryBase() override { Shutdown(); }
};

View File

@ -29,7 +29,7 @@ void ViewManager::InitMP1(MP1::CMain& main) {
if (!m_noShaderWarmup)
main.WarmupShaders();
m_testGameView.reset(new TestGameView(*this, m_viewResources, *m_rootView));
m_testGameView.reset(new TestGameView(*this, m_viewResources, *m_rootView, m_cvarManager));
m_rootView->accessContentViews().clear();
m_rootView->accessContentViews().push_back(m_testGameView.get());
@ -62,17 +62,11 @@ void ViewManager::TestGameView::think() {
if (m_debugText) {
std::string overlayText;
const hecl::CVar* showFrameIdx = hecl::CVarManager::instance()->findCVar("debugOverlay.showFrameCounter");
const hecl::CVar* playerInfo = hecl::CVarManager::instance()->findCVar("debugOverlay.playerInfo");
const hecl::CVar* worldInfo = hecl::CVarManager::instance()->findCVar("debugOverlay.worldInfo");
const hecl::CVar* areaInfo = hecl::CVarManager::instance()->findCVar("debugOverlay.areaInfo");
const hecl::CVar* showInGameTime = hecl::CVarManager::instance()->findCVar("debugOverlay.showInGameTime");
const hecl::CVar* showResourceStats = hecl::CVarManager::instance()->findCVar("debugOverlay.showResourceStats");
if (g_StateManager) {
if (showFrameIdx && showFrameIdx->toBoolean())
if (m_cvarCommons.m_debugOverlayShowFrameCounter->toBoolean())
overlayText += fmt::format(FMT_STRING("Frame: {}\n"), g_StateManager->GetUpdateFrameIndex());
if (showInGameTime && showInGameTime->toBoolean()) {
if (m_cvarCommons.m_debugOverlayShowInGameTime->toBoolean()) {
double igt = g_GameState->GetTotalPlayTime();
u32 ms = u64(igt * 1000) % 1000;
auto pt = std::div(igt, 3600);
@ -80,7 +74,7 @@ void ViewManager::TestGameView::think() {
fmt::format(FMT_STRING("PlayTime: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms);
}
if (g_StateManager->Player() && playerInfo && playerInfo->toBoolean()) {
if (g_StateManager->Player() && m_cvarCommons.m_debugOverlayPlayerInfo->toBoolean()) {
const CPlayer& pl = g_StateManager->GetPlayer();
const zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f());
const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
@ -98,7 +92,7 @@ void ViewManager::TestGameView::think() {
camXf.origin.y(), camXf.origin.z(), zeus::radToDeg(camQ.roll()),
zeus::radToDeg(camQ.pitch()), zeus::radToDeg(camQ.yaw()));
}
if (worldInfo && worldInfo->toBoolean()) {
if (m_cvarCommons.m_debugOverlayWorldInfo->toBoolean()) {
TLockedToken<CStringTable> tbl =
g_SimplePool->GetObj({FOURCC('STRG'), g_StateManager->GetWorld()->IGetStringTableAssetId()});
const urde::TAreaId aId = g_GameState->CurrentWorldState().GetCurrentAreaId();
@ -107,7 +101,7 @@ void ViewManager::TestGameView::think() {
}
const urde::TAreaId aId = g_GameState->CurrentWorldState().GetCurrentAreaId();
if (areaInfo && areaInfo->toBoolean() && g_StateManager->GetWorld() &&
if (m_cvarCommons.m_debugOverlayAreaInfo->toBoolean() && g_StateManager->GetWorld() &&
g_StateManager->GetWorld()->DoesAreaExist(aId)) {
const auto& layerStates = g_GameState->CurrentWorldState().GetLayerState();
std::string layerBits;
@ -126,7 +120,11 @@ void ViewManager::TestGameView::think() {
}
}
if (showResourceStats && showResourceStats->toBoolean())
if (m_cvarCommons.m_debugOverlayShowRandomStats->toBoolean()) {
overlayText += fmt::format(FMT_STRING("CRandom16::Next calls: {}\n"), urde::CRandom16::GetNumNextCalls());
}
if (m_cvarCommons.m_debugOverlayShowResourceStats->toBoolean())
overlayText += fmt::format(FMT_STRING("Resource Objects: {}\n"), g_SimplePool->GetLiveObjects());
if (!overlayText.empty())
@ -162,7 +160,12 @@ void ViewManager::RootSpaceViewBuilt(specter::View* view) {
void ViewManager::ProjectChanged(hecl::Database::Project& proj) {
CDvdFile::Shutdown();
CDvdFile::Initialize(hecl::ProjectPath(proj.getProjectWorkingPath(), _SYS_STR("out/files")));
// FIXME trilogy hack
hecl::ProjectPath projectPath(proj.getProjectWorkingPath(), _SYS_STR("out/files/MP1"));
if (!projectPath.isDirectory()) {
projectPath = hecl::ProjectPath(proj.getProjectWorkingPath(), _SYS_STR("out/files"));
}
CDvdFile::Initialize(projectPath);
}
void ViewManager::SetupEditorView() {

View File

@ -1,6 +1,7 @@
#pragma once
#include "hecl/CVarManager.hpp"
#include "hecl/CVarCommons.hpp"
#include "boo/audiodev/IAudioVoiceEngine.hpp"
#include "amuse/BooBackend.hpp"
#include "ProjectManager.hpp"
@ -57,9 +58,11 @@ class ViewManager final : public specter::IViewManager {
class TestGameView : public specter::View {
ViewManager& m_vm;
std::unique_ptr<specter::MultiLineTextView> m_debugText;
hecl::CVarCommons m_cvarCommons;
public:
TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent) : View(res, parent), m_vm(vm) {}
TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent, hecl::CVarManager& cvarMgr)
: View(res, parent), m_vm(vm), m_cvarCommons(cvarMgr) {}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) override;
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
void think() override;

View File

@ -5,8 +5,8 @@ find_library(M_LIB m)
if(NOT M_LIB)
unset(M_LIB CACHE)
endif()
target_link_libraries(packbadge ${PNG_LIB} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packbadge PRIVATE ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
target_link_libraries(packbadge ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packbadge PRIVATE ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
##################
# Package Export #

View File

@ -4,8 +4,8 @@ find_library(M_LIB m)
if(NOT M_LIB)
unset(M_LIB CACHE)
endif()
target_link_libraries(packicons ${PNG_LIB} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packicons PRIVATE ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
target_link_libraries(packicons ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packicons PRIVATE ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
##################
# Package Export #

View File

@ -161,7 +161,7 @@ int main(int argc, char* argv[])
fflush(stdout);
#if _WIN32
snprintf(command, 2048, " --export-png=\"%s/icon_pack.png\" --export-width=%d --export-height=%d \"%s\"",
snprintf(command, 2048, " --export-filename=\"%s/icon_pack.png\" --export-width=%d --export-height=%d \"%s\"",
TMPDIR, i, i, argv[2]);
STARTUPINFOA sinfo = {sizeof(STARTUPINFOA)};
@ -179,7 +179,7 @@ int main(int argc, char* argv[])
CloseHandle(pinfo.hProcess);
#else
snprintf(command, 2048, "%s --export-png=\"%s/icon_pack.png\" --export-width=%d --export-height=%d \"%s\"",
snprintf(command, 2048, "%s --export-filename=\"%s/icon_pack.png\" --export-width=%d --export-height=%d \"%s\"",
argv[1], TMPDIR, i, i, argv[2]);
fp = popen(command, "r");
if (!fp)

View File

@ -7,6 +7,7 @@
#include "hecl/hecl.hpp"
#include "hecl/CVarCommons.hpp"
#include "hecl/Console.hpp"
#include "fmt/chrono.h"
static logvisor::Module AthenaLog("Athena");
static void AthenaExc(athena::error::Level level, const char* file, const char*, int line, fmt::string_view fmt,
@ -48,17 +49,17 @@ static hecl::SystemString CPUFeatureString(const zeus::CPUInfo& cpuInf) {
}
struct Application : boo::IApplicationCallback {
hecl::Runtime::FileStoreManager m_fileMgr;
hecl::CVarManager m_cvarManager;
hecl::CVarCommons m_cvarCommons;
hecl::Runtime::FileStoreManager& m_fileMgr;
hecl::CVarManager& m_cvarManager;
hecl::CVarCommons& m_cvarCommons;
std::unique_ptr<ViewManager> m_viewManager;
std::atomic_bool m_running = {true};
Application()
: m_fileMgr(_SYS_STR("urde"))
, m_cvarManager(m_fileMgr)
, m_cvarCommons(m_cvarManager)
Application(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr, hecl::CVarCommons& cvarCmns)
: m_fileMgr(fileMgr)
, m_cvarManager(cvarMgr)
, m_cvarCommons(cvarCmns)
, m_viewManager(std::make_unique<ViewManager>(m_fileMgr, m_cvarManager)) {}
virtual ~Application() = default;
@ -89,7 +90,7 @@ struct Application : boo::IApplicationCallback {
void initialize(boo::IApplication* app) {
zeus::detectCPU();
createGlobalCVars();
for (const boo::SystemString& arg : app->getArgs()) {
if (arg.find(_SYS_STR("--verbosity=")) == 0 || arg.find(_SYS_STR("-v=")) == 0) {
hecl::SystemUTF8Conv utf8Arg(arg.substr(arg.find_last_of('=') + 1));
@ -98,8 +99,6 @@ struct Application : boo::IApplicationCallback {
}
}
m_cvarManager.parseCommandLine(app->getArgs());
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
Log.report(logvisor::Info, FMT_STRING("CPU Name: {}"), cpuInf.cpuBrand);
Log.report(logvisor::Info, FMT_STRING("CPU Vendor: {}"), cpuInf.cpuVendor);
@ -114,26 +113,7 @@ struct Application : boo::IApplicationCallback {
bool getDeepColor() const { return m_cvarCommons.getDeepColor(); }
void createGlobalCVars() {
m_cvarManager.findOrMakeCVar("debugOverlay.playerInfo"sv,
"Displays information about the player, such as location and orientation"sv, false,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
m_cvarManager.findOrMakeCVar("debugOverlay.worldInfo"sv,
"Displays information about the current world, such as world asset ID, and areaId"sv,
false,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
m_cvarManager.findOrMakeCVar(
"debugOverlay.areaInfo"sv,
"Displays information about the current area, such as asset ID, object/layer counts, and active layer bits"sv,
false, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
m_cvarManager.findOrMakeCVar("debugOverlay.showFrameCounter"sv, "Displays the current frame index"sv, false,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
m_cvarManager.findOrMakeCVar("debugOverlay.showInGameTime"sv, "Displays the current in game time"sv, false,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
m_cvarManager.findOrMakeCVar("debugOverlay.showResourceStats"sv,
"Displays the current live resource object and token counts"sv, false,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
}
int64_t getTargetFrameTime() { return m_cvarCommons.getVariableFrameTime() ? 0 : 1000000000L / 60; }
};
} // namespace urde
@ -181,6 +161,25 @@ int main(int argc, const boo::SystemChar** argv)
}
SetupBasics(IsClientLoggingEnabled(argc, argv));
hecl::Runtime::FileStoreManager fileMgr{_SYS_STR("urde")};
hecl::CVarManager cvarMgr{fileMgr};
hecl::CVarCommons cvarCmns{cvarMgr};
std::vector<boo::SystemString> args;
for (int i = 1; i < argc; ++i)
args.push_back(argv[i]);
cvarMgr.parseCommandLine(args);
hecl::SystemStringView logFile = hecl::SystemStringConv(cvarCmns.getLogFile()).sys_str();
hecl::SystemString logFilePath;
if (!logFile.empty()) {
std::time_t time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
char buf[100];
std::strftime(buf, 100, "%Y-%m-%d_%H-%M-%S", std::localtime(&time));
hecl::SystemString timeStr = hecl::SystemStringConv(buf).c_str();
logFilePath = fmt::format(FMT_STRING(_SYS_STR("{}/{}-{}")), fileMgr.getStoreRoot(), timeStr, logFile);
logvisor::RegisterFileLogger(logFilePath.c_str());
}
if (hecl::SystemChar* cwd = hecl::Getcwd(CwdBuf, 1024)) {
if (hecl::PathRelative(argv[0]))
@ -194,10 +193,10 @@ int main(int argc, const boo::SystemChar** argv)
/* Handle -j argument */
hecl::SetCpuCountOverride(argc, argv);
urde::Application appCb;
urde::Application appCb(fileMgr, cvarMgr, cvarCmns);
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto, appCb, _SYS_STR("urde"), _SYS_STR("URDE"), argc,
argv, appCb.getGraphicsApi(), appCb.getSamples(), appCb.getAnisotropy(),
appCb.getDeepColor(), false);
appCb.getDeepColor(), appCb.getTargetFrameTime(), false);
// printf("IM DYING!!\n");
return ret;
}
@ -229,7 +228,8 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int) {
for (int i = 0; i < argc; ++i)
booArgv[i + 1] = argv[i];
if (IsClientLoggingEnabled(argc + 1, booArgv))
const DWORD outType = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE));
if (IsClientLoggingEnabled(argc + 1, booArgv) && outType == FILE_TYPE_UNKNOWN)
logvisor::CreateWin32Console();
return wmain(argc + 1, booArgv);
}

View File

@ -1,6 +1,6 @@
add_executable(mkwmicon mkwmicon.c)
target_include_directories(mkwmicon PRIVATE ${LIBPNG_INCLUDE_DIR})
target_link_libraries(mkwmicon ${PNG_LIB} ${ZLIB_LIBRARIES})
target_link_libraries(mkwmicon ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
target_include_directories(mkwmicon PRIVATE ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
macro(declare_wmicon_target)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/Editor/platforms/freedesktop/mainicon_netwm.bin

View File

@ -1,29 +1,39 @@
## URDE
**Status:** In-Game with 0-00 (v1.088) only
**Status:** Metroid Prime 1 In-Game (all retail GC & Wii versions)
**Official Discord Channel:** https://discord.gg/AMBVFuf
![URDE screenshot](assets/urde-screen1.png)
### Download
Precompiled builds of the command-line extraction utility (`hecl`) with embedded dataspec libraries are available at https://releases.axiodl.com. This will give you intermediate dumps of original formats as *blender* and *yaml* representations.
Everything else is much too experimental to make portable/stable release builds (for now)
### Platform Support
* Windows 7+ (64-bit support only)
* macOS 10.11+
* Linux
* Windows 10 (64-bit, D3D11 / Vulkan)
* macOS 10.15+ (Metal)
* Linux (Vulkan)
* Arch is known to function with [`glx` vendor setup instructions](https://wiki.archlinux.org/index.php/Category:Graphics) *(main development/testing OS)*
* **[WIP]** Vulkan loader detection is also integrated into the cmake for Linux
* **[Coming Soon]** FreeBSD
* Much multimedia functionality is in place, but not fully tested
* Other distros with reasonably up-to-date packages will work (specific packages TBD)
### Usage
### Usage (GC versions)
* Extract ISO: `hecl extract [path].iso -o mp1`
* `mp1` can be substituted with the directory name of your choice
* Repackage game for URDE: `cd mp1; hecl package`
* Run URDE: `urde mp1/out`
### Usage (Wii versions)
NFS files dumped from Metroid Prime Trilogy on Wii U VC can be used directly without converting to ISO.
* Extract ISO or NFS: `hecl extract [path].[iso/nfs] -o mpt`
* `mpt` can be substituted with the directory name of your choice
* Repackage game for URDE: `cd mpt; hecl package MP1`
* The `MP1` parameter is important here.
* Run URDE: `urde mpt/out`
#### URDE options (non-exhaustive)
* `-l`: Enable console logging
@ -32,20 +42,22 @@ Everything else is much too experimental to make portable/stable release builds
### Build Prerequisites:
* [CMake 3.13+](https://cmake.org)
* For Windows: Install `CMake Tools` in Visual Studio
* Windows: Install `CMake Tools` in Visual Studio
* macOS: `brew install cmake`
* [Python 3+](https://python.org)
* For Windows: [Microsoft Store](https://go.microsoft.com/fwlink?linkID=2082640)
* Verify it's added to `%PATH%` by typing `python` in `cmd`.
* Windows: [Microsoft Store](https://go.microsoft.com/fwlink?linkID=2082640)
* Verify it's added to `%PATH%` by typing `python` in `cmd`.
* macOS: `brew install python@3`
* LLVM development package *(headers and libs)*
* [Specialized Windows Package](https://axiodl.com/files/LLVM-9.0.1-win64.exe)
* [Specialized macOS Package](https://axiodl.com/files/LLVM-9.0.1-Darwin.tar.xz)
* [Specialized Windows Package](https://axiodl.com/files/LLVM-10.0.1-win64.exe)
* macOS: `brew install --force-bottle llvm`
* **[Windows]** [Visual Studio 2019 Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx)
* Select `C++ Development` and verify the following packages are included:
* `Windows 10 SDK`
* `CMake Tools`
* `C++ Clang Compiler`
* `C++ Clang-cl`
* **[macOS]** [Xcode Tools](https://developer.apple.com/xcode/download/)
* **[macOS]** [Xcode 1.15+](https://developer.apple.com/xcode/download/)
* **[Linux]** recent development packages of `udev`, `x11`, `xcb`, `xinput`, `glx`, `asound`
### Prep Directions
@ -56,11 +68,22 @@ mkdir urde-build
cd urde-build
```
### Build Directions
#### ninja
### Update Directions
```sh
cd urde
git pull
git submodule update --recursive
```
### Build Directions
For Windows, it's recommended to use Visual Studio. See below.
#### ninja (Windows/macOS/Linux)
```sh
cd urde-build
cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja ../urde
ninja
```
@ -70,36 +93,31 @@ ninja
- Use clang+lld (faster linking): `-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++`
- Optimize for current CPU (resulting binaries are not portable): `-DURDE_VECTOR_ISA=native`
#### CLion
#### CLion (Windows/macOS/Linux)
*(main development / debugging IDE)*
Open the repository's `CMakeLists.txt`.
Configure CMake options via `File` > `Settings` > `Build, Execution, Deployment` > `CMake`.
Optionally configure CMake options via `File` > `Settings` > `Build, Execution, Deployment` > `CMake`.
It's recommended to create a new `Toolchain` with `clang`/`clang++` and configure the CMake profiles to use it.
#### Qt Creator
#### Qt Creator (Windows/macOS/Linux)
Open the repository's `CMakeLists.txt` via File > Open File or Project.
Configure the desired CMake targets to build in the *Projects* area of the IDE.
Build / Debug / Run on Windows, macOS and Linux in a unified way.
#### Visual Studio
#### Visual Studio (Windows)
Verify all required VS packages are installed from the above **Build Prerequisites** section.
Open the `urde` directory in Visual Studio (automatically imports CMake configuration).
Open the `urde` directory in Visual Studio (imports CMake configuration).
Follow [these instructions to use clang-cl](https://docs.microsoft.com/en-us/cpp/build/clang-support-cmake?view=vs-2019).
The build will **not** work with the normal VS compiler!
MSVC and clang-cl configurations should import automatically.
#### Xcode
#### Xcode (macOS)
```sh
cmake -G Xcode -DCMAKE_BUILD_TYPE=Debug -DLLVM_ROOT_DIR=<path-to-llvm-dev-package> ../urde
cmake -G Xcode ../urde
```
Then open `urde.xcodeproj`

View File

@ -393,33 +393,35 @@ void CSfxManager::UpdateEmitter(const CSfxHandle& handle, const zeus::CVector3f&
CSfxHandle CSfxManager::AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, bool useAcoustics,
bool looped, s16 prio, s32 areaId) {
CAudioSys::C3DEmitterParmData parmData;
parmData.x0_pos = pos;
parmData.xc_dir = dir;
parmData.x18_maxDist = 150.f;
parmData.x1c_distComp = 0.1f;
parmData.x20_flags = 1; // Continuous parameter update
parmData.x24_sfxId = id;
parmData.x26_maxVol = 1.f;
parmData.x27_minVol = 0.165f;
parmData.x28_important = false;
parmData.x29_prio = 0x7f;
const CAudioSys::C3DEmitterParmData parmData{
.x0_pos = pos,
.xc_dir = dir,
.x18_maxDist = 150.f,
.x1c_distComp = 0.1f,
.x20_flags = 1, // Continuous parameter update
.x24_sfxId = id,
.x26_maxVol = 1.f,
.x27_minVol = 0.165f,
.x28_important = false,
.x29_prio = 0x7f,
};
return AddEmitter(parmData, useAcoustics, prio, looped, areaId);
}
CSfxHandle CSfxManager::AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float vol,
bool useAcoustics, bool looped, s16 prio, s32 areaId) {
CAudioSys::C3DEmitterParmData parmData;
parmData.x0_pos = pos;
parmData.xc_dir = dir;
parmData.x18_maxDist = 150.f;
parmData.x1c_distComp = 0.1f;
parmData.x20_flags = 1; // Continuous parameter update
parmData.x24_sfxId = id;
parmData.x26_maxVol = std::max(vol, 0.165f);
parmData.x27_minVol = 0.165f;
parmData.x28_important = false;
parmData.x29_prio = 0x7f;
const CAudioSys::C3DEmitterParmData parmData{
.x0_pos = pos,
.xc_dir = dir,
.x18_maxDist = 150.f,
.x1c_distComp = 0.1f,
.x20_flags = 1, // Continuous parameter update
.x24_sfxId = id,
.x26_maxVol = std::max(vol, 0.165f),
.x27_minVol = 0.165f,
.x28_important = false,
.x29_prio = 0x7f,
};
return AddEmitter(parmData, useAcoustics, prio, looped, areaId);
}

View File

@ -60,16 +60,16 @@ public:
s16 xa_prio;
// CSfxHandle xc_handle;
TAreaId x10_area;
bool x14_24_isActive : 1;
bool x14_25_isPlaying : 1;
bool x14_24_isActive : 1 = true;
bool x14_25_isPlaying : 1 = false;
bool x14_26_looped : 1;
bool x14_27_inArea : 1;
bool x14_28_isReleased : 1;
bool x14_27_inArea : 1 = true;
bool x14_28_isReleased : 1 = false;
bool x14_29_useAcoustics : 1;
protected:
bool m_isEmitter : 1;
bool m_isClosed : 1;
bool m_isEmitter : 1 = false;
bool m_isClosed : 1 = false;
public:
virtual ~CBaseSfxWrapper() = default;
@ -112,14 +112,8 @@ public:
CBaseSfxWrapper(bool looped, s16 prio, /*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
: xa_prio(prio)
, /*xc_handle(handle),*/ x10_area(area)
, x14_24_isActive(true)
, x14_25_isPlaying(false)
, x14_26_looped(looped)
, x14_27_inArea(true)
, x14_28_isReleased(false)
, x14_29_useAcoustics(useAcoustics)
, m_isEmitter(false)
, m_isClosed(false) {}
, x14_29_useAcoustics(useAcoustics) {}
};
class CSfxEmitterWrapper : public CBaseSfxWrapper {

View File

@ -446,9 +446,9 @@ public:
private:
dspadpcm_header x0_header;
std::string x60_fileName; // arg1
bool x70_24_unclaimed : 1;
bool x70_25_headerReadCancelled : 1;
u8 x70_26_headerReadState : 2; // 0: not read 1: reading 2: read
bool x70_24_unclaimed : 1 = true;
bool x70_25_headerReadCancelled : 1 = false;
u8 x70_26_headerReadState : 2 = 0; // 0: not read 1: reading 2: read
s8 x71_companionRight = -1;
s8 x72_companionLeft = -1;
float x73_volume = 0.f;
@ -460,13 +460,11 @@ private:
static std::array<CDSPStreamManager, 4> g_Streams;
public:
CDSPStreamManager() : x70_24_unclaimed(true), x70_25_headerReadCancelled(false), x70_26_headerReadState(0) {}
CDSPStreamManager() = default;
CDSPStreamManager(std::string_view fileName, s32 handle, float volume, bool oneshot)
: x60_fileName(fileName)
, x70_24_unclaimed(!CDvdFile::FileExists(fileName))
, x70_25_headerReadCancelled(false)
, x70_26_headerReadState(0)
, x73_volume(volume)
, x74_oneshot(oneshot)
, x78_handleId(handle) {}

View File

@ -1049,13 +1049,13 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
} else {
x2fc_textpane_hint->TextSupport().SetText(u"");
std::u16string str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]);
str += g_MainStringTable->GetString(46); // Rotate
str += g_MainStringTable->GetString(46 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Rotate
x300_textpane_instructions->TextSupport().SetText(str);
str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]);
str += g_MainStringTable->GetString(47); // Move
str += g_MainStringTable->GetString(47 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Move
x304_textpane_instructions1->TextSupport().SetText(str);
str = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]);
str += g_MainStringTable->GetString(48); // Zoom
str += g_MainStringTable->GetString(48 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Zoom
str += fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]);
x308_textpane_instructions2->TextSupport().SetText(str);
}
@ -1104,10 +1104,10 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) {
m_frmeInitialized = true;
static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_left"))
->TextSupport()
.SetText(g_MainStringTable->GetString(42));
.SetText(g_MainStringTable->GetString(42 + (!g_Main->IsUSA() || g_Main->IsTrilogy())));
static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_yicon"))
->TextSupport()
.SetText(g_MainStringTable->GetString(43));
.SetText(g_MainStringTable->GetString(43 + (!g_Main->IsUSA() || g_Main->IsTrilogy())));
x2fc_textpane_hint = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_hint"));
x300_textpane_instructions = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_instructions"));
x304_textpane_instructions1 = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_instructions1"));
@ -1115,7 +1115,7 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) {
CGuiTextPane* mapLegend = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_mapLegend"));
mapLegend->TextSupport().ClearRenderBuffer();
mapLegend->TextSupport().SetImageBaseline(true);
mapLegend->TextSupport().SetText(g_MainStringTable->GetString(49));
mapLegend->TextSupport().SetText(g_MainStringTable->GetString(49 + (!g_Main->IsUSA() || g_Main->IsTrilogy())));
x30c_basewidget_leftPane = x28_frmeMapScreen->FindWidget("basewidget_leftPane");
x310_basewidget_yButtonPane = x28_frmeMapScreen->FindWidget("basewidget_yButtonPane");
x314_basewidget_bottomPane = x28_frmeMapScreen->FindWidget("basewidget_bottomPane");
@ -1472,7 +1472,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
beaconAlpha = loc.x4_beaconAlpha;
}
if (beaconAlpha > 0.f) {
const std::array<CTexturedQuadFilter::Vert, 4> verts{{
constexpr std::array<CTexturedQuadFilter::Vert, 4> verts{{
{{-4.f, -8.f, 8.f}, {0.f, 1.f}},
{{-4.f, -8.f, 0.f}, {0.f, 0.f}},
{{4.f, -8.f, 8.f}, {1.f, 1.f}},

View File

@ -8,6 +8,7 @@
#include "Runtime/rstl.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/AutoMapper/CMapUniverse.hpp"
#include "Runtime/MP1/CInGameGuiManager.hpp"
#include <zeus/CQuaternion.hpp>
@ -17,7 +18,6 @@
#include <zeus/CVector3f.hpp>
namespace urde {
class CMapUniverse;
class CMapWorldInfo;
class CStateManager;
class IWorld;

View File

@ -27,30 +27,40 @@ struct Circle {
Circle(const Circle2& circ2) : x0_point(circ2.x0_point), x8_radius(std::sqrt(circ2.x8_radiusSq)) {}
};
Circle2 ExactCircle1(const zeus::CVector2f* a) { return {*a, 0.f}; }
Circle2 ExactCircle1(const zeus::CVector2f* a) {
return {
.x0_point = *a,
.x8_radiusSq = 0.f,
};
}
Circle2 ExactCircle2(const zeus::CVector2f* a, const zeus::CVector2f* b) {
Circle2 ret = {};
ret.x0_point = 0.5f * (*a + *b);
ret.x8_radiusSq = (*b - *a).magSquared() * 0.25f;
return ret;
return {
.x0_point = 0.5f * (*a + *b),
.x8_radiusSq = (*b - *a).magSquared() * 0.25f,
};
}
Circle2 ExactCircle3(const zeus::CVector2f* a, const zeus::CVector2f* b, const zeus::CVector2f* c) {
Circle2 ret = {};
zeus::CVector2f d1 = *b - *a;
zeus::CVector2f d2 = *c - *a;
float cross = d1.cross(d2);
zeus::CVector2f magVec(d1.magSquared() * 0.5f, d2.magSquared() * 0.5f);
const zeus::CVector2f d1 = *b - *a;
const zeus::CVector2f d2 = *c - *a;
const float cross = d1.cross(d2);
const zeus::CVector2f magVec(d1.magSquared() * 0.5f, d2.magSquared() * 0.5f);
if (std::fabs(cross) > 0.01f) {
zeus::CVector2f tmp((d2.y() * magVec.x() - d1.y() * magVec.y()) / cross,
(d1.x() * magVec.y() - d2.x() * magVec.x()) / cross);
ret.x0_point = *a + tmp;
ret.x8_radiusSq = tmp.magSquared();
const zeus::CVector2f tmp((d2.y() * magVec.x() - d1.y() * magVec.y()) / cross,
(d1.x() * magVec.y() - d2.x() * magVec.x()) / cross);
return {
.x0_point = *a + tmp,
.x8_radiusSq = tmp.magSquared(),
};
} else {
ret.x8_radiusSq = FLT_MAX;
return {
.x0_point = zeus::skZero2f,
.x8_radiusSq = FLT_MAX,
};
}
return ret;
}
bool PointInsideCircle(const zeus::CVector2f& point, const Circle2& circ, float& intersect) {
@ -59,7 +69,7 @@ bool PointInsideCircle(const zeus::CVector2f& point, const Circle2& circ, float&
}
Circle2 UpdateSupport1(int idx, const zeus::CVector2f** list, Support& support) {
Circle2 ret = ExactCircle2(list[support.x4_[0]], list[idx]);
const Circle2 ret = ExactCircle2(list[support.x4_[0]], list[idx]);
support.x0_ = 2;
support.x4_[1] = idx;
return ret;

View File

@ -20,7 +20,7 @@ CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, C
SetIsMapped(i, mapped);
}
for (const TEditorId doorId : savw.GetDoors()) {
for (const auto& doorId : savw.GetDoors()) {
SetDoorVisited(doorId, reader.ReadEncoded(1) != 0);
}
@ -46,7 +46,7 @@ void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, CAss
}
}
for (const TEditorId doorId : savw.GetDoors()) {
for (const auto& doorId : savw.GetDoors()) {
writer.WriteEncoded(u32(IsDoorVisited(doorId)), 1);
}

View File

@ -170,7 +170,7 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha
m_texQuadFilter.emplace(EFilterType::Add, tex, CTexturedQuadFilter::ZTest::GEqual);
}
const std::array<CTexturedQuadFilter::Vert, 4> verts{{
constexpr std::array<CTexturedQuadFilter::Vert, 4> verts{{
{{-2.6f, 0.f, 2.6f}, {0.f, 1.f}},
{{-2.6f, 0.f, -2.6f}, {0.f, 0.f}},
{{2.6f, 0.f, 2.6f}, {1.f, 1.f}},

View File

@ -11,8 +11,9 @@ void CDependencyGroup::ReadFromStream(CInputStream& in) {
x0_objectTags.emplace_back(in);
}
CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& /*tag*/, CInputStream& in, const CVParamTransfer& /*param*/,
CObjectReference* selfRef) {
CFactoryFnReturn FDependencyGroupFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in,
[[maybe_unused]] const CVParamTransfer& param,
[[maybe_unused]] CObjectReference* selfRef) {
return TToken<CDependencyGroup>::GetIObjObjectFor(std::make_unique<CDependencyGroup>(in));
}

View File

@ -19,27 +19,28 @@ class CFileDvdRequest : public IDvdRequest {
std::function<void(u32)> m_callback;
public:
~CFileDvdRequest() override { PostCancelRequest(); }
~CFileDvdRequest() override { CFileDvdRequest::PostCancelRequest(); }
void WaitUntilComplete() override {
while (!m_complete.load() && !m_cancel.load()) {
std::unique_lock<std::mutex> lk(CDvdFile::m_WaitMutex);
std::unique_lock lk{CDvdFile::m_WaitMutex};
}
}
bool IsComplete() override { return m_complete.load(); }
void PostCancelRequest() override {
std::unique_lock<std::mutex> waitlk(CDvdFile::m_WaitMutex);
std::unique_lock waitlk{CDvdFile::m_WaitMutex};
m_cancel.store(true);
}
EMediaType GetMediaType() const override { return EMediaType::File; }
[[nodiscard]] EMediaType GetMediaType() const override { return EMediaType::File; }
CFileDvdRequest(CDvdFile& file, void* buf, u32 len, ESeekOrigin whence, int off, std::function<void(u32)>&& cb)
: m_reader(file.m_reader), m_buf(buf), m_len(len), m_whence(whence), m_offset(off), m_callback(std::move(cb)) {}
void DoRequest() {
if (m_cancel.load())
if (m_cancel.load()) {
return;
}
u32 readLen;
if (m_whence == ESeekOrigin::Cur && m_offset == 0) {
readLen = m_reader->readBytesToBuf(m_buf, m_len);
@ -47,8 +48,9 @@ public:
m_reader->seek(m_offset, athena::SeekOrigin(m_whence));
readLen = m_reader->readBytesToBuf(m_buf, m_len);
}
if (m_callback)
if (m_callback) {
m_callback(readLen);
}
m_complete.store(true);
}
};
@ -59,25 +61,27 @@ std::condition_variable CDvdFile::m_WorkerCV;
std::mutex CDvdFile::m_WaitMutex;
std::atomic_bool CDvdFile::m_WorkerRun = {false};
std::vector<std::shared_ptr<IDvdRequest>> CDvdFile::m_RequestQueue;
void CDvdFile::WorkerProc() {
logvisor::RegisterThreadName("CDvdFile");
while (m_WorkerRun.load()) {
std::unique_lock<std::mutex> lk(CDvdFile::m_WorkerMutex);
while (CDvdFile::m_RequestQueue.size()) {
std::unique_lock lk{m_WorkerMutex};
while (!m_RequestQueue.empty()) {
std::vector<std::shared_ptr<IDvdRequest>> swapQueue;
swapQueue.swap(CDvdFile::m_RequestQueue);
swapQueue.swap(m_RequestQueue);
lk.unlock();
std::unique_lock<std::mutex> waitlk(CDvdFile::m_WaitMutex);
std::unique_lock waitlk{m_WaitMutex};
for (std::shared_ptr<IDvdRequest>& req : swapQueue) {
CFileDvdRequest& concreteReq = static_cast<CFileDvdRequest&>(*req);
auto& concreteReq = static_cast<CFileDvdRequest&>(*req);
concreteReq.DoRequest();
}
waitlk.unlock();
swapQueue.clear();
lk.lock();
}
if (!m_WorkerRun.load())
if (!m_WorkerRun.load()) {
break;
}
m_WorkerCV.wait(lk);
}
}
@ -85,7 +89,7 @@ void CDvdFile::WorkerProc() {
std::shared_ptr<IDvdRequest> CDvdFile::AsyncSeekRead(void* buf, u32 len, ESeekOrigin whence, int off,
std::function<void(u32)>&& cb) {
std::shared_ptr<IDvdRequest> ret = std::make_shared<CFileDvdRequest>(*this, buf, len, whence, off, std::move(cb));
std::unique_lock<std::mutex> lk(CDvdFile::m_WorkerMutex);
std::unique_lock lk{m_WorkerMutex};
m_RequestQueue.emplace_back(ret);
lk.unlock();
m_WorkerCV.notify_one();
@ -94,12 +98,15 @@ std::shared_ptr<IDvdRequest> CDvdFile::AsyncSeekRead(void* buf, u32 len, ESeekOr
hecl::ProjectPath CDvdFile::ResolvePath(std::string_view path) {
auto start = path.begin();
while (*start == '/') ++start;
while (*start == '/') {
++start;
}
std::string lowerChStr(start, path.end());
std::transform(lowerChStr.begin(), lowerChStr.end(), lowerChStr.begin(), ::tolower);
auto search = m_caseInsensitiveMap.find(lowerChStr);
if (search == m_caseInsensitiveMap.end())
if (search == m_caseInsensitiveMap.end()) {
return {};
}
return hecl::ProjectPath(m_DvdRoot, search->second);
}
@ -120,19 +127,22 @@ void CDvdFile::RecursiveBuildCaseInsensitiveMap(const hecl::ProjectPath& path, s
void CDvdFile::Initialize(const hecl::ProjectPath& path) {
m_DvdRoot = path;
RecursiveBuildCaseInsensitiveMap(path, path.getAbsolutePathUTF8().length() + 1);
if (m_WorkerRun.load())
if (m_WorkerRun.load()) {
return;
}
m_WorkerRun.store(true);
m_WorkerThread = std::thread(WorkerProc);
}
void CDvdFile::Shutdown() {
if (!m_WorkerRun.load())
if (!m_WorkerRun.load()) {
return;
}
m_WorkerRun.store(false);
m_WorkerCV.notify_one();
if (m_WorkerThread.joinable())
if (m_WorkerThread.joinable()) {
m_WorkerThread.join();
}
m_RequestQueue.clear();
}

View File

@ -49,7 +49,38 @@ constexpr std::array<SGameOption, 4> ControllerOpts{{
{EGameOption::RestoreDefaults, 35, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry{{
constexpr std::array<SGameOption, 5> VisorOptsNew{{
{EGameOption::VisorOpacity, 23, 0.f, 255.f, 1.f, EOptionType::Float},
{EGameOption::HelmetOpacity, 24, 0.f, 255.f, 1.f, EOptionType::Float},
{EGameOption::HUDLag, 25, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::HintSystem, 26, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<SGameOption, 5> DisplayOptsNew{{
//{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
{EGameOption::ScreenBrightness, 28, -100.f, 100.f, 1.f, EOptionType::Float},
{EGameOption::ScreenOffsetX, 29, -30.f, 30.f, 1.f, EOptionType::Float},
{EGameOption::ScreenOffsetY, 30, -30.f, 30.f, 1.f, EOptionType::Float},
{EGameOption::ScreenStretch, 31, -10.f, 10.f, 1.f, EOptionType::Float},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<SGameOption, 4> SoundOptsNew{{
{EGameOption::SFXVolume, 32, 0.f, 127.f, 1.f, EOptionType::Float},
{EGameOption::MusicVolume, 33, 0.f, 127.f, 1.f, EOptionType::Float},
{EGameOption::SoundMode, 34, 0.f, 1.f, 1.f, EOptionType::TripleEnum},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<SGameOption, 4> ControllerOptsNew{{
{EGameOption::ReverseYAxis, 35, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::Rumble, 37, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::SwapBeamControls, 37, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry{{
{VisorOpts.size(), VisorOpts.data()},
{DisplayOpts.size(), DisplayOpts.data()},
{SoundOpts.size(), SoundOpts.data()},
@ -57,26 +88,36 @@ const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry{{
{0, nullptr},
}};
CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
for (u8& entry : x0_nesState)
entry = stream.ReadEncoded(8);
constexpr std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistryNew{{
{VisorOptsNew.size(), VisorOptsNew.data()},
{DisplayOptsNew.size(), DisplayOptsNew.data()},
{SoundOptsNew.size(), SoundOptsNew.data()},
{ControllerOptsNew.size(), ControllerOptsNew.data()},
{0, nullptr},
}};
for (bool& entry : x68_)
CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
for (u8& entry : x0_nesState) {
entry = stream.ReadEncoded(8);
}
for (bool& entry : x68_) {
entry = stream.ReadEncoded(8) != 0;
}
xc0_frozenFpsCount = stream.ReadEncoded(2);
xc4_frozenBallCount = stream.ReadEncoded(2);
xc8_powerBombAmmoCount = stream.ReadEncoded(1);
xcc_logScanPercent = stream.ReadEncoded(7);
xd0_24_fusionLinked = stream.ReadEncoded(1);
xd0_25_normalModeBeat = stream.ReadEncoded(1);
xd0_26_hardModeBeat = stream.ReadEncoded(1);
xd0_27_fusionBeat = stream.ReadEncoded(1);
xd0_24_fusionLinked = stream.ReadEncoded(1) != 0;
xd0_25_normalModeBeat = stream.ReadEncoded(1) != 0;
xd0_26_hardModeBeat = stream.ReadEncoded(1) != 0;
xd0_27_fusionBeat = stream.ReadEncoded(1) != 0;
xd0_28_fusionSuitActive = false;
xd0_29_allItemsCollected = stream.ReadEncoded(1);
xd0_29_allItemsCollected = stream.ReadEncoded(1) != 0;
xbc_autoMapperKeyState = stream.ReadEncoded(2);
auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
size_t cinematicCount = 0;
for (const auto& world : memWorlds) {
TLockedToken<CSaveWorld> saveWorld =
@ -86,8 +127,9 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
std::vector<bool> cinematicStates;
cinematicStates.reserve(cinematicCount);
for (size_t i = 0; i < cinematicCount; ++i)
cinematicStates.push_back(stream.ReadEncoded(1));
for (size_t i = 0; i < cinematicCount; ++i) {
cinematicStates.push_back(stream.ReadEncoded(1) != 0);
}
for (const auto& world : memWorlds) {
TLockedToken<CSaveWorld> saveWorld =
@ -101,11 +143,13 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
}
void CPersistentOptions::PutTo(CBitStreamWriter& w) const {
for (const u8 entry : x0_nesState)
for (const u8 entry : x0_nesState) {
w.WriteEncoded(entry, 8);
}
for (const bool entry : x68_)
w.WriteEncoded(entry, 8);
for (const bool entry : x68_) {
w.WriteEncoded(u32(entry), 8);
}
w.WriteEncoded(xc0_frozenFpsCount, 2);
w.WriteEncoded(xc4_frozenBallCount, 2);
@ -118,13 +162,14 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const {
w.WriteEncoded(xd0_29_allItemsCollected, 1);
w.WriteEncoded(xbc_autoMapperKeyState, 2);
auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
for (const auto& world : memWorlds) {
TLockedToken<CSaveWorld> saveWorld =
const TLockedToken<CSaveWorld> saveWorld =
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
for (TEditorId cineId : saveWorld->GetCinematics())
w.WriteEncoded(GetCinematicState(world.first, cineId), 1);
for (const auto& cineId : saveWorld->GetCinematics()) {
w.WriteEncoded(u32(GetCinematicState(world.first, cineId)), 1);
}
}
}
@ -164,11 +209,11 @@ CGameOptions::CGameOptions(CBitStreamReader& stream) {
x60_hudAlpha = stream.ReadEncoded(8);
x64_helmetAlpha = stream.ReadEncoded(8);
x68_24_hudLag = stream.ReadEncoded(1);
x68_28_hintSystem = stream.ReadEncoded(1);
x68_25_invertY = stream.ReadEncoded(1);
x68_26_rumble = stream.ReadEncoded(1);
x68_27_swapBeamsControls = stream.ReadEncoded(1);
x68_24_hudLag = stream.ReadEncoded(1) != 0;
x68_28_hintSystem = stream.ReadEncoded(1) != 0;
x68_25_invertY = stream.ReadEncoded(1) != 0;
x68_26_rumble = stream.ReadEncoded(1) != 0;
x68_27_swapBeamsControls = stream.ReadEncoded(1) != 0;
}
void CGameOptions::ResetToDefaults() {
@ -221,15 +266,19 @@ CGameOptions::CGameOptions()
InitSoundMode();
}
float CGameOptions::TuneScreenBrightness() { return (0.375f * 1.f) + (float(x48_screenBrightness) * 0.25f); }
float CGameOptions::TuneScreenBrightness() const { return (0.375f * 1.f) + (float(x48_screenBrightness) * 0.25f); }
void CGameOptions::InitSoundMode() { /* If system is mono, force x44 to mono, otherwise honor user preference */ }
void CGameOptions::InitSoundMode() { /* If system is mono, force x44 to mono, otherwise honor user preference */
}
static float BrightnessCopyFilter = 0.f;
void CGameOptions::SetScreenBrightness(s32 val, bool apply) {
x48_screenBrightness = zeus::clamp(0, val, 8);
void CGameOptions::SetScreenBrightness(s32 value, bool apply) {
x48_screenBrightness = zeus::clamp(0, value, 8);
if (apply)
BrightnessCopyFilter = TuneScreenBrightness();
if (!apply) {
return;
}
BrightnessCopyFilter = TuneScreenBrightness();
}
void CGameOptions::ApplyGamma() {
@ -241,51 +290,60 @@ void CGameOptions::ApplyGamma() {
CGraphics::g_BooFactory->setDisplayGamma(gammaT);
}
void CGameOptions::SetGamma(s32 val, bool apply) {
m_gamma = zeus::clamp(-100, val, 100);
void CGameOptions::SetGamma(s32 value, bool apply) {
m_gamma = zeus::clamp(-100, value, 100);
if (apply)
ApplyGamma();
if (!apply) {
return;
}
ApplyGamma();
}
void CGameOptions::SetScreenPositionX(s32 pos, bool apply) {
x4c_screenXOffset = zeus::clamp(-30, pos, 30);
void CGameOptions::SetScreenPositionX(s32 position, bool apply) {
x4c_screenXOffset = zeus::clamp(-30, position, 30);
if (apply) {
/* TOOD: CGraphics related funcs */
}
}
void CGameOptions::SetScreenPositionY(s32 pos, bool apply) {
x50_screenYOffset = zeus::clamp(-30, pos, 30);
void CGameOptions::SetScreenPositionY(s32 position, bool apply) {
x50_screenYOffset = zeus::clamp(-30, position, 30);
if (apply) {
/* TOOD: CGraphics related funcs */
}
}
void CGameOptions::SetScreenStretch(s32 st, bool apply) {
x54_screenStretch = zeus::clamp(-10, st, 10);
void CGameOptions::SetScreenStretch(s32 stretch, bool apply) {
x54_screenStretch = zeus::clamp(-10, stretch, 10);
if (apply) {
/* TOOD: CGraphics related funcs */
}
}
void CGameOptions::SetSfxVolume(s32 vol, bool apply) {
x58_sfxVol = zeus::clamp(0, vol, 0x7f);
void CGameOptions::SetSfxVolume(s32 volume, bool apply) {
x58_sfxVol = zeus::clamp(0, volume, 0x7f);
if (apply) {
CAudioSys::SysSetSfxVolume(x58_sfxVol, 1, 1, 1);
CStreamAudioManager::SetSfxVolume(x58_sfxVol);
CMoviePlayer::SetSfxVolume(x58_sfxVol);
if (!apply) {
return;
}
CAudioSys::SysSetSfxVolume(x58_sfxVol, 1, true, true);
CStreamAudioManager::SetSfxVolume(x58_sfxVol);
CMoviePlayer::SetSfxVolume(x58_sfxVol);
}
void CGameOptions::SetMusicVolume(s32 vol, bool apply) {
x5c_musicVol = zeus::clamp(0, vol, 0x7f);
if (apply)
CStreamAudioManager::SetMusicVolume(x5c_musicVol);
void CGameOptions::SetMusicVolume(s32 volume, bool apply) {
x5c_musicVol = zeus::clamp(0, volume, 0x7f);
if (!apply) {
return;
}
CStreamAudioManager::SetMusicVolume(x5c_musicVol);
}
void CGameOptions::SetHUDAlpha(u32 alpha) { x60_hudAlpha = alpha; }
@ -325,7 +383,7 @@ void CGameOptions::SetControls(int controls) {
ResetControllerAssets(controls);
}
const std::array<std::pair<CAssetId, CAssetId>, 5> CStickToDPadRemap{{
constexpr std::array<std::pair<CAssetId, CAssetId>, 5> CStickToDPadRemap{{
{0x2A13C23E, 0xF13452F8},
{0xA91A7703, 0xC042EC91},
{0x12A12131, 0x5F556002},
@ -333,7 +391,7 @@ const std::array<std::pair<CAssetId, CAssetId>, 5> CStickToDPadRemap{{
{0xCD7B1ACA, 0x8ADA8184},
}};
const std::array<std::pair<CAssetId, CAssetId>, 5> CStickOutlineToDPadRemap{{
constexpr std::array<std::pair<CAssetId, CAssetId>, 5> CStickOutlineToDPadRemap{{
{0x1A29C0E6, 0xF13452F8},
{0x5D9F9796, 0xC042EC91},
{0x951546A8, 0x5F556002},
@ -442,10 +500,10 @@ void CGameOptions::SetOption(EGameOption option, int value) {
options.SetHelmetAlpha(value);
break;
case EGameOption::HUDLag:
options.SetHUDLag(value);
options.SetHUDLag(value != 0);
break;
case EGameOption::HintSystem:
options.SetIsHintSystemEnabled(value);
options.SetIsHintSystemEnabled(value != 0);
break;
case EGameOption::ScreenBrightness:
options.SetGamma(value, true);
@ -469,13 +527,13 @@ void CGameOptions::SetOption(EGameOption option, int value) {
options.SetSurroundMode(value, true);
break;
case EGameOption::ReverseYAxis:
options.SetInvertYAxis(value);
options.SetInvertYAxis(value != 0);
break;
case EGameOption::Rumble:
options.SetIsRumbleEnabled(value);
options.SetIsRumbleEnabled(value != 0);
break;
case EGameOption::SwapBeamControls:
options.SetSwapBeamControls(value);
options.SetSwapBeamControls(value != 0);
break;
default:
break;
@ -491,9 +549,9 @@ int CGameOptions::GetOption(EGameOption option) {
case EGameOption::HelmetOpacity:
return options.GetHelmetAlpha();
case EGameOption::HUDLag:
return options.GetHUDLag();
return int(options.GetHUDLag());
case EGameOption::HintSystem:
return options.GetIsHintSystemEnabled();
return int(options.GetIsHintSystemEnabled());
case EGameOption::ScreenBrightness:
return options.GetGamma();
case EGameOption::ScreenOffsetX:
@ -509,11 +567,11 @@ int CGameOptions::GetOption(EGameOption option) {
case EGameOption::SoundMode:
return int(options.GetSurroundMode());
case EGameOption::ReverseYAxis:
return options.GetInvertYAxis();
return int(options.GetInvertYAxis());
case EGameOption::Rumble:
return options.GetIsRumbleEnabled();
return int(options.GetIsRumbleEnabled());
case EGameOption::SwapBeamControls:
return options.GetSwapBeamControls();
return int(options.GetSwapBeamControls());
default:
break;
}

View File

@ -44,6 +44,7 @@ struct SGameOption {
/** Static registry of Option UI presentation information */
extern const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry;
extern const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistryNew;
/** Options tracked persistently between game sessions */
class CPersistentOptions {
@ -56,41 +57,35 @@ class CPersistentOptions {
u32 xc4_frozenBallCount = 0;
u32 xc8_powerBombAmmoCount = 0;
u32 xcc_logScanPercent = 0;
bool xd0_24_fusionLinked : 1;
bool xd0_25_normalModeBeat : 1;
bool xd0_26_hardModeBeat : 1;
bool xd0_27_fusionBeat : 1;
bool xd0_28_fusionSuitActive : 1;
bool xd0_29_allItemsCollected : 1;
bool xd0_24_fusionLinked : 1 = false;
bool xd0_25_normalModeBeat : 1 = false;
bool xd0_26_hardModeBeat : 1 = false;
bool xd0_27_fusionBeat : 1 = false;
bool xd0_28_fusionSuitActive : 1 = false;
bool xd0_29_allItemsCollected : 1 = false;
public:
CPersistentOptions()
: xd0_24_fusionLinked(false)
, xd0_25_normalModeBeat(false)
, xd0_26_hardModeBeat(false)
, xd0_27_fusionBeat(false)
, xd0_28_fusionSuitActive(false)
, xd0_29_allItemsCollected(false) {}
CPersistentOptions() = default;
explicit CPersistentOptions(CBitStreamReader& stream);
bool GetCinematicState(CAssetId mlvlId, TEditorId cineId) const;
void SetCinematicState(CAssetId mlvlId, TEditorId cineId, bool state);
u32 GetAutoMapperKeyState() const { return xbc_autoMapperKeyState; }
void SetAutoMapperKeyState(u32 s) { xbc_autoMapperKeyState = s; }
void SetAutoMapperKeyState(u32 state) { xbc_autoMapperKeyState = state; }
bool GetPlayerLinkedFusion() const { return xd0_24_fusionLinked; }
void SetPlayerLinkedFusion(bool v) { xd0_24_fusionLinked = v; }
void SetPlayerLinkedFusion(bool fusionLinked) { xd0_24_fusionLinked = fusionLinked; }
bool GetPlayerBeatNormalMode() const { return xd0_25_normalModeBeat; }
void SetPlayerBeatNormalMode(bool v) { xd0_25_normalModeBeat = v; }
void SetPlayerBeatNormalMode(bool normalModeBeat) { xd0_25_normalModeBeat = normalModeBeat; }
bool GetPlayerBeatHardMode() const { return xd0_26_hardModeBeat; }
void SetPlayerBeatHardMode(bool v) { xd0_26_hardModeBeat = v; }
void SetPlayerBeatHardMode(bool hardModeBeat) { xd0_26_hardModeBeat = hardModeBeat; }
bool GetPlayerBeatFusion() const { return xd0_27_fusionBeat; }
void SetPlayerBeatFusion(bool v) { xd0_27_fusionBeat = v; }
void SetPlayerBeatFusion(bool fusionBeat) { xd0_27_fusionBeat = fusionBeat; }
bool GetPlayerFusionSuitActive() const { return xd0_28_fusionSuitActive; }
void SetPlayerFusionSuitActive(bool v) { xd0_28_fusionSuitActive = v; }
void SetPlayerFusionSuitActive(bool fusionSuitActive) { xd0_28_fusionSuitActive = fusionSuitActive; }
bool GetAllItemsCollected() const { return xd0_29_allItemsCollected; }
void SetAllItemsCollected(bool v) { xd0_29_allItemsCollected = v; }
void SetAllItemsCollected(bool allItemsCollected) { xd0_29_allItemsCollected = allItemsCollected; }
u32 GetLogScanPercent() const { return xcc_logScanPercent; }
void SetLogScanPercent(u32 v) { xcc_logScanPercent = v; }
void SetLogScanPercent(u32 percent) { xcc_logScanPercent = percent; }
void IncrementFrozenFpsCount() { xc0_frozenFpsCount = std::min(int(xc0_frozenFpsCount + 1), 3); }
bool GetShowFrozenFpsMessage() const { return xc0_frozenFpsCount != 3; }
void IncrementFrozenBallCount() { xc4_frozenBallCount = std::min(int(xc4_frozenBallCount + 1), 3); }
@ -133,37 +128,37 @@ public:
void EnsureSettings();
void PutTo(CBitStreamWriter& writer) const;
float TuneScreenBrightness();
void SetScreenBrightness(s32, bool);
float TuneScreenBrightness() const;
void SetScreenBrightness(s32 value, bool apply);
s32 GetScreenBrightness() const { return x48_screenBrightness; }
void ApplyGamma();
void SetGamma(s32, bool);
void SetGamma(s32 value, bool apply);
s32 GetGamma() const { return m_gamma; }
void SetScreenPositionX(s32, bool);
void SetScreenPositionX(s32 position, bool apply);
s32 GetScreenPositionX() const { return x4c_screenXOffset; }
void SetScreenPositionY(s32, bool);
void SetScreenPositionY(s32 position, bool apply);
s32 GetScreenPositionY() const { return x50_screenYOffset; }
void SetScreenStretch(s32, bool);
void SetScreenStretch(s32 stretch, bool apply);
s32 GetScreenStretch() const { return x54_screenStretch; }
void SetSfxVolume(s32, bool);
void SetSfxVolume(s32 volume, bool apply);
s32 GetSfxVolume() const { return x58_sfxVol; }
void SetMusicVolume(s32, bool);
void SetMusicVolume(s32 volume, bool apply);
s32 GetMusicVolume() const { return x5c_musicVol; }
void SetHUDAlpha(u32);
void SetHUDAlpha(u32 alpha);
u32 GetHUDAlpha() const { return x60_hudAlpha; }
void SetHelmetAlpha(u32);
void SetHelmetAlpha(u32 alpha);
u32 GetHelmetAlpha() const { return x64_helmetAlpha; }
void SetHUDLag(bool);
void SetHUDLag(bool lag);
bool GetHUDLag() const { return x68_24_hudLag; }
void SetSurroundMode(int mode, bool apply);
CAudioSys::ESurroundModes GetSurroundMode() const;
void SetInvertYAxis(bool);
void SetInvertYAxis(bool invert);
bool GetInvertYAxis() const { return x68_25_invertY; }
void SetIsRumbleEnabled(bool);
void SetIsRumbleEnabled(bool rumble);
bool GetIsRumbleEnabled() const { return x68_26_rumble; }
void SetSwapBeamControls(bool);
void SetSwapBeamControls(bool swap);
bool GetSwapBeamControls() const { return x68_27_swapBeamsControls; }
void SetIsHintSystemEnabled(bool);
void SetIsHintSystemEnabled(bool hints);
bool GetIsHintSystemEnabled() const { return x68_28_hintSystem; }
void SetControls(int controls);
void ResetControllerAssets(int controls);

View File

@ -24,15 +24,16 @@ union BitsToDouble {
};
CWorldLayerState::CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld) {
u32 bitCount = reader.ReadEncoded(10);
const u32 bitCount = reader.ReadEncoded(10);
x10_saveLayers.reserve(bitCount);
for (u32 i = 0; i < bitCount; ++i) {
bool bit = reader.ReadEncoded(1);
if (bit)
const bool bit = reader.ReadEncoded(1) != 0;
if (bit) {
x10_saveLayers.setBit(i);
else
} else {
x10_saveLayers.unsetBit(i);
}
}
}
@ -53,11 +54,14 @@ void CWorldLayerState::PutTo(CBitStreamWriter& writer) const {
}
void CWorldLayerState::InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers) {
if (x0_areaLayers.size())
if (!x0_areaLayers.empty()) {
return;
}
x0_areaLayers = layers;
if (x10_saveLayers.getBitCount() == 0)
if (x10_saveLayers.getBitCount() == 0) {
return;
}
u32 a = 0;
u32 b = 0;
@ -102,9 +106,9 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) {
}
ret.x14_timestamp = stream.ReadEncoded(32);
ret.x20_hardMode = stream.ReadEncoded(1);
ret.x20_hardMode = stream.ReadEncoded(1) != 0;
stream.ReadEncoded(1);
CAssetId origMLVL = u32(stream.ReadEncoded(32));
const CAssetId origMLVL = u32(stream.ReadEncoded(32));
ret.x8_mlvlId = origMLVL;
BitsToDouble conv;
@ -137,10 +141,10 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) {
CGameState::CGameState() {
x98_playerState = std::make_shared<CPlayerState>();
x9c_transManager = std::make_shared<CWorldTransManager>();
x228_24_hardMode = false;
x228_25_initPowerupsAtFirstSpawn = true;
if (g_MemoryCardSys)
if (g_MemoryCardSys != nullptr) {
InitializeMemoryStates();
}
}
CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx(saveIdx) {
@ -153,8 +157,8 @@ CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx
}
stream.ReadEncoded(32);
x228_24_hardMode = stream.ReadEncoded(1);
x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1);
x228_24_hardMode = stream.ReadEncoded(1) != 0;
x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1) != 0;
x84_mlvlId = u32(stream.ReadEncoded(32));
MP1::CMain::EnsureWorldPakReady(x84_mlvlId);

View File

@ -69,7 +69,7 @@ class CGameState {
friend class CStateManager;
std::array<bool, 128> x0_{};
u32 x80_;
u32 x80_ = 0;
CAssetId x84_mlvlId;
std::vector<CWorldState> x88_worldStates;
std::shared_ptr<CPlayerState> x98_playerState;
@ -81,8 +81,8 @@ class CGameState {
u32 x20c_saveFileIdx = 0;
u64 x210_cardSerial = 0;
std::vector<u8> x218_backupBuf;
bool x228_24_hardMode : 1;
bool x228_25_initPowerupsAtFirstSpawn : 1;
bool x228_24_hardMode : 1 = false;
bool x228_25_initPowerupsAtFirstSpawn : 1 = true;
public:
CGameState();

View File

@ -1,5 +1,6 @@
#pragma once
#include <algorithm>
#include <string>
#include <vector>
@ -25,6 +26,7 @@ public:
};
enum class EType {};
private:
EType x0_type;
std::string x4_key;
std::string x14_str;
@ -51,17 +53,17 @@ protected:
public:
bool HasTweakValue(std::string_view name) const {
for (const CTweakValue& val : x0_values)
if (val.GetName() == name)
return true;
return false;
return std::any_of(x0_values.cbegin(), x0_values.cend(),
[name](const auto& value) { return value.GetName() == name; });
}
const CTweakValue* GetTweakValue(std::string_view name) const {
for (const CTweakValue& val : x0_values)
if (val.GetName() == name)
return &val;
return nullptr;
const auto iter = std::find_if(x0_values.cbegin(), x0_values.cend(),
[name](const auto& value) { return value.GetName() == name; });
if (iter == x0_values.cend()) {
return nullptr;
}
return &*iter;
}
bool ReadFromMemoryCard(std::string_view name) { return true; }

View File

@ -136,7 +136,7 @@ endif()
endfunction()
set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(RUNTIME_LIBRARIES RetroDataSpec NESEmulator
set(RUNTIME_LIBRARIES RetroDataSpec AssetNameMapNull NESEmulator
libjpeg-turbo jbus kabufuda discord-rpc logvisor)
if(MSVC)

View File

@ -123,10 +123,10 @@ bool CMemoryCardSys::InitializePump() {
x20_scanStates.reserve(x20_scanStates.size() + savw.GetScans().size());
for (const CSaveWorld::SScanState& scan : savw.GetScans()) {
auto existingSearch = std::find_if(x20_scanStates.begin(), x20_scanStates.end(), [&](const auto& test) {
const auto scanStateIter = std::find_if(x20_scanStates.cbegin(), x20_scanStates.cend(), [&](const auto& test) {
return test.first == scan.x0_id && test.second == scan.x4_category;
});
if (existingSearch == x20_scanStates.end()) {
if (scanStateIter == x20_scanStates.cend()) {
x20_scanStates.emplace_back(scan.x0_id, scan.x4_category);
++x30_scanCategoryCounts[int(scan.x4_category)];
}
@ -525,7 +525,10 @@ void CMemoryCardSys::CommitToDisk(kabufuda::ECardSlot port) {
kabufuda::SystemString CMemoryCardSys::CreateDolphinCard(kabufuda::ECardSlot slot) {
kabufuda::SystemString path = _CreateDolphinCard(slot);
CardProbe(slot);
if (CardProbe(slot).x0_error != ECardResult::READY) {
return {};
}
MountCard(slot);
FormatCard(slot);
kabufuda::Card& card = g_CardStates[int(slot)];

View File

@ -1,50 +1,59 @@
#include "CMemoryCardSys.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/IMain.hpp"
namespace urde {
kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
const char* home = getenv("HOME");
if (!home || home[0] != '/')
return {};
const char* dataHome = getenv("XDG_DATA_HOME");
/* XDG-selected data path */
kabufuda::SystemString path =
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu";
path += fmt::format(FMT_STRING("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
hecl::Sstat theStat;
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) {
/* legacy case for older dolphin versions */
path = home;
path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
const char* home = getenv("HOME");
if (!home || home[0] != '/')
return {};
}
const char* dataHome = getenv("XDG_DATA_HOME");
return path;
/* XDG-selected data path */
kabufuda::SystemString path =
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu";
path += fmt::format(FMT_STRING("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
hecl::Sstat theStat;
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) {
/* legacy case for older dolphin versions */
path = home;
path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
return {};
}
return path;
}
return {};
}
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot) {
const char* home = getenv("HOME");
if (!home || home[0] != '/')
return {};
const char* dataHome = getenv("XDG_DATA_HOME");
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
const char* home = getenv("HOME");
if (!home || home[0] != '/')
return {};
const char* dataHome = getenv("XDG_DATA_HOME");
/* XDG-selected data path */
kabufuda::SystemString path =
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu/GC";
/* XDG-selected data path */
kabufuda::SystemString path =
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu/GC";
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
if (fp == nullptr) {
return {};
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
if (fp == nullptr) {
return {};
}
return path;
}
return path;
return {};
}
} // namespace urde

View File

@ -1,40 +1,47 @@
#include "CMemoryCardSys.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/IMain.hpp"
namespace urde {
kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
const char* home = getenv("HOME");
if (!home)
return {};
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
const char* home = getenv("HOME");
if (!home)
return {};
kabufuda::SystemString path = home;
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
kabufuda::SystemString path = home;
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
hecl::Sstat theStat;
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
return {};
hecl::Sstat theStat;
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
return {};
return path;
return path;
}
return {};
}
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot) {
const char* home = getenv("HOME");
if (!home)
return {};
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
const char* home = getenv("HOME");
if (!home)
return {};
kabufuda::SystemString path = home;
path += "/Library/Application Support/Dolphin/GC";
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
kabufuda::SystemString path = home;
path += "/Library/Application Support/Dolphin/GC";
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
if (fp == nullptr) {
return {};
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
if (fp == nullptr) {
return {};
}
return path;
}
return path;
return {};
}
} // namespace urde

View File

@ -1,5 +1,8 @@
#include "Runtime/CMemoryCardSys.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/IMain.hpp"
#include <shlobj.h>
namespace urde {
@ -12,101 +15,109 @@ using namespace Windows::Storage;
* https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/UICommon/UICommon.cpp
* Modified to not use dolphin-binary-relative paths. */
kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
#if !WINDOWS_STORE
/* Detect where the User directory is. There are two different cases
/* Detect where the User directory is. There are two different cases
* 1. HKCU\Software\Dolphin Emulator\UserConfigPath exists
* -> Use this as the user directory path
* 2. My Documents exists
* -> Use My Documents\Dolphin Emulator as the User directory path
*/
*/
/* Check our registry keys */
HKEY hkey;
kabufuda::SystemChar configPath[MAX_PATH] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
ERROR_SUCCESS) {
DWORD size = MAX_PATH;
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) != ERROR_SUCCESS)
configPath[0] = 0;
RegCloseKey(hkey);
}
/* Check our registry keys */
HKEY hkey;
kabufuda::SystemChar configPath[MAX_PATH] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
ERROR_SUCCESS) {
DWORD size = MAX_PATH;
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) !=
ERROR_SUCCESS)
configPath[0] = 0;
RegCloseKey(hkey);
}
/* Get My Documents path in case we need it. */
kabufuda::SystemChar my_documents[MAX_PATH];
bool my_documents_found =
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
/* Get My Documents path in case we need it. */
kabufuda::SystemChar my_documents[MAX_PATH];
bool my_documents_found =
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
kabufuda::SystemString path;
if (configPath[0]) /* Case 1 */
path = configPath;
else if (my_documents_found) /* Case 2 */
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
else /* Unable to find */
return {};
kabufuda::SystemString path;
if (configPath[0]) /* Case 1 */
path = configPath;
else if (my_documents_found) /* Case 2 */
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
else /* Unable to find */
return {};
#else
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
kabufuda::SystemString path(localFolder->Path->Data());
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
kabufuda::SystemString path(localFolder->Path->Data());
#endif
path += fmt::format(FMT_STRING(_SYS_STR("/GC/MemoryCard{}.USA.raw")),
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
path += fmt::format(FMT_STRING(_SYS_STR("/GC/MemoryCard{}.USA.raw")),
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
hecl::Sstat theStat;
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
return {};
hecl::Sstat theStat;
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
return {};
return path;
return path;
}
return {};
}
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot) {
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
#if !WINDOWS_STORE
/* Detect where the User directory is. There are two different cases
/* Detect where the User directory is. There are two different cases
* 1. HKCU\Software\Dolphin Emulator\UserConfigPath exists
* -> Use this as the user directory path
* 2. My Documents exists
* -> Use My Documents\Dolphin Emulator as the User directory path
*/
*/
/* Check our registry keys */
HKEY hkey;
kabufuda::SystemChar configPath[MAX_PATH] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
ERROR_SUCCESS) {
DWORD size = MAX_PATH;
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) != ERROR_SUCCESS)
configPath[0] = 0;
RegCloseKey(hkey);
}
/* Check our registry keys */
HKEY hkey;
kabufuda::SystemChar configPath[MAX_PATH] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
ERROR_SUCCESS) {
DWORD size = MAX_PATH;
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) !=
ERROR_SUCCESS)
configPath[0] = 0;
RegCloseKey(hkey);
}
/* Get My Documents path in case we need it. */
kabufuda::SystemChar my_documents[MAX_PATH];
bool my_documents_found =
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
/* Get My Documents path in case we need it. */
kabufuda::SystemChar my_documents[MAX_PATH];
bool my_documents_found =
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
kabufuda::SystemString path;
if (configPath[0]) /* Case 1 */
path = configPath;
else if (my_documents_found) /* Case 2 */
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
else /* Unable to find */
return {};
kabufuda::SystemString path;
if (configPath[0]) /* Case 1 */
path = configPath;
else if (my_documents_found) /* Case 2 */
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
else /* Unable to find */
return {};
#else
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
kabufuda::SystemString path(localFolder->Path->Data());
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
kabufuda::SystemString path(localFolder->Path->Data());
#endif
path += _SYS_STR("/GC");
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
path += _SYS_STR("/GC");
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
path += fmt::format(FMT_STRING(_SYS_STR("/MemoryCard{}.USA.raw")),
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
const auto fp = hecl::FopenUnique(path.c_str(), _SYS_STR("wb"));
if (fp == nullptr) {
return {};
path += fmt::format(FMT_STRING(_SYS_STR("/MemoryCard{}.USA.raw")),
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
const auto fp = hecl::FopenUnique(path.c_str(), _SYS_STR("wb"));
if (fp == nullptr) {
return {};
}
return path;
}
return path;
return {};
}
} // namespace urde

View File

@ -44,11 +44,10 @@ public:
m_id = m_list.GetNextObjectIndex(m_id);
return *this;
}
bool operator!=(const iterator& other) const { return m_id != other.m_id; }
bool operator==(const iterator& other) const { return m_id == other.m_id; }
bool operator!=(const iterator& other) const { return !operator==(other); }
CEntity* operator*() const { return m_list.GetObjectByIndex(m_id); }
};
iterator begin() { return iterator(*this, x2008_firstId); }
iterator end() { return iterator(*this, -1); }
class const_iterator {
friend class CObjectList;
@ -61,13 +60,19 @@ public:
m_id = m_list.GetNextObjectIndex(m_id);
return *this;
}
bool operator!=(const iterator& other) const { return m_id != other.m_id; }
bool operator==(const iterator& other) const { return m_id == other.m_id; }
bool operator!=(const iterator& other) const { return !operator==(other); }
const CEntity* operator*() const { return m_list.GetObjectByIndex(m_id); }
};
const_iterator cbegin() const { return const_iterator(*this, x2008_firstId); }
const_iterator cend() const { return const_iterator(*this, -1); }
CObjectList(EGameObjectList listEnum);
[[nodiscard]] iterator begin() { return iterator(*this, x2008_firstId); }
[[nodiscard]] iterator end() { return iterator(*this, -1); }
[[nodiscard]] const_iterator begin() const { return const_iterator(*this, x2008_firstId); }
[[nodiscard]] const_iterator end() const { return const_iterator(*this, -1); }
[[nodiscard]] const_iterator cbegin() const { return begin(); }
[[nodiscard]] const_iterator cend() const { return end(); }
explicit CObjectList(EGameObjectList listEnum);
virtual ~CObjectList() = default;
void AddObject(CEntity& entity);

View File

@ -8,9 +8,7 @@ CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak,
Log.report(logvisor::Fatal, FMT_STRING("{}: Unable to open"), GetPath());
x28_24_buildDepList = buildDepList;
//x28_24_buildDepList = true; // Always do this so URDE can rapidly pre-warm shaders
x28_25_aramFile = false;
x28_26_worldPak = worldPak;
x28_27_stashedInARAM = false;
m_override = override;
}

View File

@ -37,9 +37,9 @@ public:
private:
bool x28_24_buildDepList : 1;
bool x28_25_aramFile : 1;
bool x28_25_aramFile : 1 = false;
bool x28_26_worldPak : 1;
bool x28_27_stashedInARAM : 1;
bool x28_27_stashedInARAM : 1 = false;
bool m_override : 1;
enum class EAsyncPhase {
Warmup = 0,

View File

@ -74,13 +74,11 @@ constexpr std::array<float, 5> ComboAmmoPeriods{
};
} // Anonymous namespace
CPlayerState::CPlayerState()
: x0_24_alive(true), x0_25_firingComboBeam(false), x0_26_fusion(false), x188_staticIntf(5) {
CPlayerState::CPlayerState() {
x24_powerups.resize(41);
}
CPlayerState::CPlayerState(CBitStreamReader& stream)
: x0_24_alive(true), x0_25_firingComboBeam(false), x0_26_fusion(false), x188_staticIntf(5) {
CPlayerState::CPlayerState(CBitStreamReader& stream) {
x4_enabledItems = u32(stream.ReadEncoded(32));
const u32 integralHP = u32(stream.ReadEncoded(32));

View File

@ -94,9 +94,9 @@ private:
constexpr CPowerUp() = default;
constexpr CPowerUp(u32 amount, u32 capacity) : x0_amount(amount), x4_capacity(capacity) {}
};
bool x0_24_alive : 1;
bool x0_25_firingComboBeam : 1;
bool x0_26_fusion : 1;
bool x0_24_alive : 1 = true;
bool x0_25_firingComboBeam : 1 = false;
bool x0_26_fusion : 1 = false;
u32 x4_enabledItems = 0;
EBeamId x8_currentBeam = EBeamId::Power;
CHealthInfo xc_health = {99.f, 50.f};
@ -107,7 +107,7 @@ private:
rstl::reserved_vector<CPowerUp, 41> x24_powerups;
std::vector<std::pair<CAssetId, float>> x170_scanTimes;
std::pair<u32, u32> x180_scanCompletionRate = {};
CStaticInterference x188_staticIntf;
CStaticInterference x188_staticIntf{5};
bool m_canTakeDamage = true;
@ -119,7 +119,7 @@ public:
CHealthInfo& GetHealthInfo();
const CHealthInfo& GetHealthInfo() const;
u32 GetPickupTotal() { return 99; }
u32 GetPickupTotal() const { return 99; }
void SetIsFusionEnabled(bool val) { x0_26_fusion = val; }
bool IsFusionEnabled() const { return x0_26_fusion; }
EPlayerSuit GetCurrentSuit() const;

View File

@ -4,5 +4,11 @@ namespace urde {
CRandom16* CRandom16::g_randomNumber = nullptr; // &DefaultRandom;
CGlobalRandom* CGlobalRandom::g_currentGlobalRandom = nullptr; //&DefaultGlobalRandom;
namespace {
u32 g_numNextCalls = 0;
};
void CRandom16::IncrementNumNextCalls() { ++g_numNextCalls; }
u32 CRandom16::GetNumNextCalls() { return g_numNextCalls; }
void CRandom16::ResetNumNextCalls() { g_numNextCalls = 0; }
} // namespace urde

View File

@ -12,6 +12,7 @@ public:
explicit CRandom16(s32 seed = 99) : m_seed(seed) {}
s32 Next() {
IncrementNumNextCalls();
m_seed = (m_seed * 0x41c64e6d) + 0x00003039;
return (m_seed >> 16) & 0xffff;
}
@ -28,6 +29,9 @@ public:
static CRandom16* GetRandomNumber() { return g_randomNumber; }
static void SetRandomNumber(CRandom16* rnd) { g_randomNumber = rnd; }
static void IncrementNumNextCalls();
static u32 GetNumNextCalls();
static void ResetNumNextCalls();
};
class CGlobalRandom {

View File

@ -42,7 +42,7 @@ void CRelayTracker::RemoveRelay(TEditorId id) {
return;
}
x0_relayStates.erase(std::remove(x0_relayStates.begin(), x0_relayStates.end(), id), x0_relayStates.end());
std::erase(x0_relayStates, id);
}
void CRelayTracker::SendMsgs(TAreaId areaId, CStateManager& stateMgr) {

View File

@ -132,10 +132,10 @@ void CResLoader::GetTagListForFile(const char* pakName, std::vector<SObjectTag>&
bool CResLoader::_GetTagListForFile(std::vector<SObjectTag>& out, const std::string& path,
const std::unique_ptr<CPakFile>& file) const {
if (CStringExtras::CompareCaseInsensitive(file->GetPath(), path)) {
auto& depList = file->GetDepList();
const auto& depList = file->GetDepList();
out.reserve(depList.size());
for (const auto& dep : depList) {
auto resInfo = file->GetResInfo(dep);
const auto* const resInfo = file->GetResInfo(dep);
out.emplace_back(resInfo->GetType(), dep);
}
return true;

View File

@ -82,8 +82,9 @@ s32 CSaveWorld::GetDoorIndex(const TEditorId& id) const {
return it - x34_doors.begin();
}
CFactoryFnReturn FSaveWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,
CObjectReference* selfRef) {
CFactoryFnReturn FSaveWorldFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in,
[[maybe_unused]] const CVParamTransfer& param,
[[maybe_unused]] CObjectReference* selfRef) {
return TToken<CSaveWorld>::GetIObjObjectFor(std::make_unique<CSaveWorld>(in));
}

View File

@ -4,26 +4,30 @@
namespace urde {
CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, CAssetId resId) : x0_scannableObjectId(resId) {
u32 version = in.readUint32Big();
const u32 version = in.readUint32Big();
Load(in, version);
for (u32 i = 0; i < x14_buckets.size(); ++i) {
x14_buckets[i].x4_appearanceRange *= x8_totalDownloadTime;
for (auto& bucket : x14_buckets) {
bucket.x4_appearanceRange *= x8_totalDownloadTime;
}
float appearanceOffset = g_tweakGui->GetScanAppearanceDuration();
for (u32 i = 0; i < x14_buckets.size(); ++i) {
if (x14_buckets[i].x8_imagePos != -1) {
x8_totalDownloadTime += appearanceOffset;
for (u32 j = i; j < x14_buckets.size(); j++)
x14_buckets[j].x4_appearanceRange += appearanceOffset;
const float appearanceOffset = g_tweakGui->GetScanAppearanceDuration();
for (size_t i = 0; i < x14_buckets.size(); ++i) {
if (x14_buckets[i].x8_imagePos == UINT32_MAX) {
continue;
}
x8_totalDownloadTime += appearanceOffset;
for (size_t j = i; j < x14_buckets.size(); j++) {
x14_buckets[j].x4_appearanceRange += appearanceOffset;
}
}
for (u32 i = 0; i < x14_buckets.size() - 1; ++i) {
for (u32 j = i + 1; j < x14_buckets.size(); ++j) {
if (x14_buckets[i].x8_imagePos == x14_buckets[j].x8_imagePos && x14_buckets[i].x8_imagePos != -1)
x14_buckets[j].x8_imagePos = -1;
for (size_t i = 0; i < x14_buckets.size() - 1; ++i) {
for (size_t j = i + 1; j < x14_buckets.size(); ++j) {
if (x14_buckets[i].x8_imagePos == x14_buckets[j].x8_imagePos && x14_buckets[i].x8_imagePos != UINT32_MAX) {
x14_buckets[j].x8_imagePos = UINT32_MAX;
}
}
}
}
@ -32,18 +36,20 @@ void CScannableObjectInfo::Load(CInputStream& in, u32 version) {
in.readUint32Big();
in.readUint32Big();
x4_stringId = in.readUint32Big();
if (version < 4)
if (version < 4) {
x8_totalDownloadTime = in.readFloatBig();
else {
u32 scanSpeed = in.readUint32Big();
} else {
const u32 scanSpeed = in.readUint32Big();
x8_totalDownloadTime = g_tweakGui->GetScanSpeed(scanSpeed);
}
xc_category = in.readUint32Big();
if (version > 4)
if (version > 4) {
x10_important = in.readBool();
}
for (u32 i = 0; i < 4; i++)
for (size_t i = 0; i < x14_buckets.capacity(); i++) {
x14_buckets.emplace_back(in, version);
}
}
CScannableObjectInfo::SBucket::SBucket(CInputStream& in, u32 version) {
@ -60,7 +66,7 @@ CScannableObjectInfo::SBucket::SBucket(CInputStream& in, u32 version) {
}
CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer&,
CObjectReference* selfRef) {
CObjectReference*) {
return TToken<CScannableObjectInfo>::GetIObjObjectFor(std::make_unique<CScannableObjectInfo>(in, tag.id));
}
} // namespace urde

View File

@ -12,6 +12,8 @@ class CScannableObjectInfo {
public:
enum class EPanelType {};
static constexpr size_t NumBuckets = 4;
struct SBucket {
CAssetId x0_texture;
float x4_appearanceRange = 0.f;
@ -29,14 +31,14 @@ private:
float x8_totalDownloadTime = 0.f;
u32 xc_category = 0;
bool x10_important = false;
rstl::reserved_vector<SBucket, 4> x14_buckets;
rstl::reserved_vector<SBucket, NumBuckets> x14_buckets;
public:
CScannableObjectInfo(CInputStream&, CAssetId);
CAssetId GetScannableObjectId() const { return x0_scannableObjectId; }
CAssetId GetStringTableId() const { return x4_stringId; }
float GetTotalDownloadTime() const { return x8_totalDownloadTime; }
const SBucket& GetBucket(s32 idx) const { return x14_buckets[idx]; }
const SBucket& GetBucket(size_t idx) const { return x14_buckets[idx]; }
u32 GetCategory() const { return xc_category; }
bool IsImportant() const { return x10_important; }
};

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@
#include "Runtime/World/CFluidPlaneManager.hpp"
#include "Runtime/World/ScriptLoader.hpp"
#include "Runtime/World/ScriptObjectSupport.hpp"
#include "Runtime/World/CScriptMazeNode.hpp"
#include <zeus/CAABox.hpp>
#include <zeus/CVector2f.hpp>
@ -190,7 +191,7 @@ private:
std::list<TUniqueId> xf3c_activeFlickerBats;
std::list<TUniqueId> xf54_activeParasites;
TUniqueId xf6c_playerActorHead = kInvalidUniqueId;
u32 xf70_ = 0;
std::unique_ptr<CMazeState> xf70_currentMaze;
TUniqueId xf74_lastTrigger = kInvalidUniqueId;
TUniqueId xf76_lastRelay = kInvalidUniqueId;
@ -202,13 +203,13 @@ private:
CAssetId xf88_;
float xf8c_ = 0.f;
EStateManagerTransition xf90_deferredTransition = EStateManagerTransition::InGame;
bool xf94_24_readyToRender : 1;
bool xf94_25_quitGame : 1;
bool xf94_26_generatingObject : 1;
bool xf94_27_inMapScreen : 1;
bool xf94_28_inSaveUI : 1;
bool xf94_29_cinematicPause : 1;
bool xf94_30_fullThreat : 1;
bool xf94_24_readyToRender : 1 = false;
bool xf94_25_quitGame : 1 = false;
bool xf94_26_generatingObject : 1 = false;
bool xf94_27_inMapScreen : 1 = false;
bool xf94_28_inSaveUI : 1 = false;
bool xf94_29_cinematicPause : 1 = false;
bool xf94_30_fullThreat : 1 = false;
CColoredQuadFilter m_deathWhiteout{EFilterType::Add};
CColoredQuadFilter m_escapeWhiteout{EFilterType::Add};
@ -281,7 +282,7 @@ public:
TUniqueId GetIdForScript(TEditorId) const;
std::pair<std::multimap<TEditorId, TUniqueId>::const_iterator, std::multimap<TEditorId, TUniqueId>::const_iterator>
GetIdListForScript(TEditorId) const;
std::multimap<TEditorId, TUniqueId>::const_iterator GetIdListEnd() const { return x890_scriptIdMap.cend(); };
std::multimap<TEditorId, TUniqueId>::const_iterator GetIdListEnd() const { return x890_scriptIdMap.cend(); }
void LoadScriptObjects(TAreaId, CInputStream& in, std::vector<TEditorId>& idsOut);
void InitializeScriptObjects(const std::vector<TEditorId>& objIds);
std::pair<TEditorId, TUniqueId> LoadScriptObject(TAreaId, EScriptObjectType, u32, CInputStream& in);
@ -419,6 +420,9 @@ public:
return static_cast<CPlatformAndDoorList&>(*x808_objLists[7]);
}
std::pair<u32, u32> CalculateScanCompletionRate() const;
void SetCurrentMaze(std::unique_ptr<CMazeState> maze) { xf70_currentMaze = std::move(maze); }
void ClearCurrentMaze() { xf70_currentMaze.reset(); }
CMazeState* GetCurrentMaze() { return xf70_currentMaze.get(); }
void SetLastTriggerId(TUniqueId uid) { xf74_lastTrigger = uid; }
TUniqueId GetLastTriggerId() const { return xf74_lastTrigger; }
void SetLastRelayId(TUniqueId uid) { xf76_lastRelay = uid; }
@ -457,6 +461,9 @@ public:
static float g_EscapeShakeCountdown;
static bool g_EscapeShakeCountdownInit;
void SetWarping(bool v) { m_warping = true; }
void sub_80044098(const CCollisionResponseData& colRespData, const CRayCastResult& rayCast, TUniqueId uid,
const CWeaponMode& weaponMode, u32 w1, u8 thermalFlags);
void SetWarping(bool warp) { m_warping = warp; }
};
} // namespace urde

View File

@ -4,35 +4,39 @@
namespace urde {
CStaticInterference::CStaticInterference(int sourceCount) { m_sources.reserve(sourceCount); }
CStaticInterference::CStaticInterference(size_t sourceCount) { x0_sources.reserve(sourceCount); }
void CStaticInterference::RemoveSource(TUniqueId id) {
auto iter = std::find_if(m_sources.begin(), m_sources.end(),
[id](const CStaticInterferenceSource& src) -> bool { return src.id == id; });
if (iter != m_sources.end())
m_sources.erase(iter);
const auto iter =
std::find_if(x0_sources.cbegin(), x0_sources.cend(), [id](const auto& src) { return src.x0_id == id; });
if (iter == x0_sources.cend()) {
return;
}
x0_sources.erase(iter);
}
void CStaticInterference::Update(CStateManager&, float dt) {
std::vector<CStaticInterferenceSource> newSources;
newSources.reserve(m_sources.size());
for (CStaticInterferenceSource& src : m_sources) {
if (src.timeLeft >= 0.f) {
src.timeLeft -= dt;
newSources.reserve(x0_sources.size());
for (CStaticInterferenceSource& src : x0_sources) {
if (src.x8_timeLeft >= 0.f) {
src.x8_timeLeft -= dt;
newSources.push_back(src);
}
}
m_sources = std::move(newSources);
x0_sources = std::move(newSources);
}
float CStaticInterference::GetTotalInterference() const {
float validAccum = 0.f;
float invalidAccum = 0.f;
for (const CStaticInterferenceSource& src : m_sources) {
if (src.id == kInvalidUniqueId)
invalidAccum += src.magnitude;
for (const CStaticInterferenceSource& src : x0_sources) {
if (src.x0_id == kInvalidUniqueId)
invalidAccum += src.x4_magnitude;
else
validAccum += src.magnitude;
validAccum += src.x4_magnitude;
}
if (validAccum > 0.80000001f)
validAccum = 0.80000001f;
@ -44,15 +48,17 @@ float CStaticInterference::GetTotalInterference() const {
void CStaticInterference::AddSource(TUniqueId id, float magnitude, float duration) {
magnitude = zeus::clamp(0.f, magnitude, 1.f);
auto search = std::find_if(m_sources.begin(), m_sources.end(),
[id](CStaticInterferenceSource& source) { return source.id == id; });
if (search != m_sources.end()) {
search->magnitude = magnitude;
search->timeLeft = duration;
const auto search = std::find_if(x0_sources.begin(), x0_sources.end(),
[id](const CStaticInterferenceSource& source) { return source.x0_id == id; });
if (search != x0_sources.cend()) {
search->x4_magnitude = magnitude;
search->x8_timeLeft = duration;
return;
}
if (m_sources.size() < m_sources.capacity())
m_sources.push_back({id, magnitude, duration});
if (x0_sources.size() < x0_sources.capacity()) {
x0_sources.push_back({id, magnitude, duration});
}
}
} // namespace urde

View File

@ -7,16 +7,16 @@ namespace urde {
class CStateManager;
struct CStaticInterferenceSource {
TUniqueId id;
float magnitude;
float timeLeft;
TUniqueId x0_id;
float x4_magnitude;
float x8_timeLeft;
};
class CStaticInterference {
std::vector<CStaticInterferenceSource> m_sources;
std::vector<CStaticInterferenceSource> x0_sources;
public:
explicit CStaticInterference(int sourceCount);
explicit CStaticInterference(size_t sourceCount);
void RemoveSource(TUniqueId id);
void Update(CStateManager&, float dt);
float GetTotalInterference() const;

View File

@ -12,17 +12,17 @@ public:
double report(const char* name) const {
double t = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now() - m_start).count() / 1000000.0;
#ifndef NDEBUG
fmt::print(FMT_STRING("{} {}\n"), name, t);
#endif
//#ifndef NDEBUG
// fmt::print(FMT_STRING("{} {}\n"), name, t);
//#endif
return t;
}
double reportReset(const char* name) {
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
double t = std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count() / 1000000.0;
#ifndef NDEBUG
fmt::print(FMT_STRING("{} {}\n"), name, t);
#endif
//#ifndef NDEBUG
// fmt::print(FMT_STRING("{} {}\n"), name, t);
//#endif
m_start = now;
return t;
}

View File

@ -18,8 +18,9 @@ const CTextureInfo* CTextureCache::GetTextureInfo(CAssetId id) const {
return &it->second;
}
CFactoryFnReturn FTextureCacheFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& vparms, CObjectReference* selfRef) {
CFactoryFnReturn FTextureCacheFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in,
[[maybe_unused]] const CVParamTransfer& vparms,
[[maybe_unused]] CObjectReference* selfRef) {
return TToken<CTextureCache>::GetIObjObjectFor(std::make_unique<CTextureCache>(in));
}
}

View File

@ -3,21 +3,24 @@
#include "Runtime/Graphics/CGraphics.hpp"
namespace urde {
CTimeProvider* CTimeProvider::g_currentTimeProvider = nullptr;
CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(g_currentTimeProvider) {
if (x8_lastProvider != nullptr)
x8_lastProvider->x4_first = false;
static CTimeProvider* s_currentTimeProvider = nullptr;
g_currentTimeProvider = this;
CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(s_currentTimeProvider) {
if (x8_lastProvider != nullptr) {
x8_lastProvider->x4_first = false;
}
s_currentTimeProvider = this;
CGraphics::SetExternalTimeProvider(this);
}
CTimeProvider::~CTimeProvider() {
g_currentTimeProvider = x8_lastProvider;
if (g_currentTimeProvider)
g_currentTimeProvider->x4_first = true;
CGraphics::SetExternalTimeProvider(g_currentTimeProvider);
s_currentTimeProvider = x8_lastProvider;
if (s_currentTimeProvider != nullptr) {
s_currentTimeProvider->x4_first = true;
}
CGraphics::SetExternalTimeProvider(s_currentTimeProvider);
}
} // namespace urde

View File

@ -1,9 +1,7 @@
#pragma once
namespace urde {
class CTimeProvider;
class CTimeProvider {
public:
static CTimeProvider* g_currentTimeProvider;
const float& x0_currentTime; // in seconds
bool x4_first = true;
CTimeProvider* x8_lastProvider = nullptr;

View File

@ -107,7 +107,7 @@ public:
TToken(std::unique_ptr<T>&& obj) : CToken(GetIObjObjectFor(std::move(obj))) {}
TToken& operator=(std::unique_ptr<T>&& obj) {
*this = CToken(GetIObjObjectFor(std::move(obj)));
return this;
return *this;
}
virtual void Unlock() { CToken::Unlock(); }
virtual void Lock() { CToken::Lock(); }

View File

@ -57,34 +57,11 @@ CBallCamera::CBallCamera(TUniqueId uid, TUniqueId watchedId, const zeus::CTransf
, x250_ballCameraCentroidDistanceSpring(g_tweakBall->GetBallCameraCentroidDistanceSpringConstant(),
g_tweakBall->GetBallCameraCentroidDistanceSpringMax(),
g_tweakBall->GetBallCameraCentroidDistanceSpringTardis())
, x37c_camSpline(false)
, x41c_ballCameraChaseSpring(g_tweakBall->GetBallCameraChaseSpringConstant(),
g_tweakBall->GetBallCameraChaseSpringMax(), g_tweakBall->GetBallCameraChaseSpringTardis())
, x448_ballCameraBoostSpring(g_tweakBall->GetBallCameraBoostSpringConstant(),
g_tweakBall->GetBallCameraBoostSpringMax(),
g_tweakBall->GetBallCameraBoostSpringTardis()) {
x18c_24_ = true;
x18c_25_chaseAllowed = true;
x18c_26_boostAllowed = true;
x18c_27_obscureAvoidance = true;
x18c_28_volumeCollider = true;
x18c_29_clampAttitude = false;
x18c_30_clampAzimuth = false;
x18c_31_clearLOS = true;
x18d_24_prevClearLOS = true;
x18d_25_avoidGeometryFull = false;
x18d_26_lookAtBall = false;
x18d_27_forceProcessing = false;
x18d_28_obtuseDirection = false;
x18d_29_noElevationInterp = false;
x18d_30_directElevation = false;
x18d_31_overrideLookDir = false;
x18e_24_noElevationVelClamp = false;
x18e_25_noSpline = false;
x18e_26_ = false;
x18e_27_nearbyDoorClosed = false;
x18e_28_nearbyDoorClosing = false;
x190_curMinDistance = g_tweakBall->GetBallCameraMinSpeedDistance();
x194_targetMinDistance = g_tweakBall->GetBallCameraMinSpeedDistance();
x198_maxDistance = g_tweakBall->GetBallCameraMaxSpeedDistance();
@ -275,7 +252,7 @@ void CBallCamera::SetState(EBallCameraState state, CStateManager& mgr) {
x400_state = state;
}
static const CMaterialFilter BallCameraFilter = CMaterialFilter::MakeIncludeExclude(
constexpr CMaterialFilter BallCameraFilter = CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::Solid}, {EMaterialTypes::ProjectilePassthrough, EMaterialTypes::Player, EMaterialTypes::Character,
EMaterialTypes::CameraPassthrough});

View File

@ -79,27 +79,27 @@ private:
};
EBallCameraBehaviour x188_behaviour = EBallCameraBehaviour::Default;
bool x18c_24_ : 1;
bool x18c_25_chaseAllowed : 1;
bool x18c_26_boostAllowed : 1;
bool x18c_27_obscureAvoidance : 1;
bool x18c_28_volumeCollider : 1;
bool x18c_29_clampAttitude : 1;
bool x18c_30_clampAzimuth : 1;
bool x18c_31_clearLOS : 1;
bool x18d_24_prevClearLOS : 1;
bool x18d_25_avoidGeometryFull : 1;
bool x18d_26_lookAtBall : 1;
bool x18d_27_forceProcessing : 1;
bool x18d_28_obtuseDirection : 1;
bool x18d_29_noElevationInterp : 1;
bool x18d_30_directElevation : 1;
bool x18d_31_overrideLookDir : 1;
bool x18e_24_noElevationVelClamp : 1;
bool x18e_25_noSpline : 1;
bool x18e_26_ : 1;
bool x18e_27_nearbyDoorClosed : 1;
bool x18e_28_nearbyDoorClosing : 1;
bool x18c_24_ : 1 = true;
bool x18c_25_chaseAllowed : 1 = true;
bool x18c_26_boostAllowed : 1 = true;
bool x18c_27_obscureAvoidance : 1 = true;
bool x18c_28_volumeCollider : 1 = true;
bool x18c_29_clampAttitude : 1 = false;
bool x18c_30_clampAzimuth : 1 = false;
bool x18c_31_clearLOS : 1 = true;
bool x18d_24_prevClearLOS : 1 = true;
bool x18d_25_avoidGeometryFull : 1 = false;
bool x18d_26_lookAtBall : 1 = false;
bool x18d_27_forceProcessing : 1 = false;
bool x18d_28_obtuseDirection : 1 = false;
bool x18d_29_noElevationInterp : 1 = false;
bool x18d_30_directElevation : 1 = false;
bool x18d_31_overrideLookDir : 1 = false;
bool x18e_24_noElevationVelClamp : 1 = false;
bool x18e_25_noSpline : 1 = false;
bool x18e_26_ : 1 = false;
bool x18e_27_nearbyDoorClosed : 1 = false;
bool x18e_28_nearbyDoorClosing : 1 = false;
float x190_curMinDistance;
float x194_targetMinDistance;
float x198_maxDistance;
@ -153,7 +153,7 @@ private:
bool x370_24_reevalSplineEnd : 1;
float x374_splineCtrl = 0.f;
float x378_splineCtrlRange;
CCameraSpline x37c_camSpline;
CCameraSpline x37c_camSpline{false};
CMaterialList x3c8_collisionExcludeList = {EMaterialTypes::NoStepLogic};
bool x3d0_24_camBehindFloorOrWall : 1;
float x3d4_elevInterpTimer = 0.f;

View File

@ -6,6 +6,7 @@
#include "Runtime/CToken.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include "Runtime/Graphics/CTexture.hpp"
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
#include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp"
@ -13,8 +14,6 @@
#include "zeus/CColor.hpp"
namespace urde {
class CTexture;
enum class EFilterType {
Passthru,
Multiply,

View File

@ -21,13 +21,7 @@
namespace urde {
float CCameraManager::sFirstPersonFOV = 55.f;
CCameraManager::CCameraManager(TUniqueId curCameraId)
: x0_curCameraId(curCameraId)
, xa0_24_pendingRumble(false)
, xa0_25_rumbling(false)
, xa0_26_inWater(false)
, x3b8_24_(false)
, x3b8_25_(false) {
CCameraManager::CCameraManager(TUniqueId curCameraId) : x0_curCameraId(curCameraId) {
CSfxManager::AddListener(CSfxManager::ESfxChannels::Game, zeus::skZero3f, zeus::skZero3f, {1.f, 0.f, 0.f},
{0.f, 0.f, 1.f}, 50.f, 50.f, 1000.f, 1, 1.f);
sFirstPersonFOV = g_tweakGame->GetFirstPersonFOV();
@ -299,7 +293,7 @@ void CCameraManager::UpdateCameraHints(float, CStateManager& mgr) {
}
bool inactiveHintRemoved = false;
for (const TUniqueId id : x2b0_inactiveCameraHints) {
for (const auto& id : x2b0_inactiveCameraHints) {
if (const TCastToConstPtr<CScriptCameraHint> hint = mgr.GetObjectById(id)) {
if (hint->GetHelperCount() == 0 || hint->GetInactive()) {
for (auto it = xac_cameraHints.begin(); it != xac_cameraHints.end(); ++it) {
@ -319,7 +313,7 @@ void CCameraManager::UpdateCameraHints(float, CStateManager& mgr) {
x2b0_inactiveCameraHints.clear();
bool activeHintAdded = false;
for (const TUniqueId id : x334_activeCameraHints) {
for (const auto& id : x334_activeCameraHints) {
if (const TCastToConstPtr<CScriptCameraHint> hint = mgr.GetObjectById(id)) {
bool activeHintPresent = false;
for (auto it = xac_cameraHints.begin(); it != xac_cameraHints.end(); ++it) {

View File

@ -40,9 +40,9 @@ class CCameraManager {
float x94_fogDensityFactor = 1.f;
float x98_fogDensitySpeed = 0.f;
float x9c_fogDensityFactorTarget = 1.f;
bool xa0_24_pendingRumble : 1;
bool xa0_25_rumbling : 1;
bool xa0_26_inWater : 1;
bool xa0_24_pendingRumble : 1 = false;
bool xa0_25_rumbling : 1 = false;
bool xa0_26_inWater : 1 = false;
TUniqueId xa2_spindleCamId = kInvalidUniqueId;
TUniqueId xa4_pathCamId = kInvalidUniqueId;
TUniqueId xa6_camHintId = kInvalidUniqueId;
@ -50,8 +50,8 @@ class CCameraManager {
rstl::reserved_vector<std::pair<s32, TUniqueId>, 64> xac_cameraHints;
rstl::reserved_vector<TUniqueId, 64> x2b0_inactiveCameraHints;
rstl::reserved_vector<TUniqueId, 64> x334_activeCameraHints;
bool x3b8_24_ : 1;
bool x3b8_25_ : 1;
bool x3b8_24_ : 1 = false;
bool x3b8_25_ : 1 = false;
float x3bc_curFov = 60.f;
void SetPathCamera(TUniqueId id, CStateManager& mgr);

View File

@ -48,49 +48,49 @@ void CCinematicCamera::WasDeactivated(CStateManager& mgr) {
zeus::CVector3f CCinematicCamera::GetInterpolatedSplinePoint(const std::vector<zeus::CVector3f>& points, int& idxOut,
float tin) const {
if (points.size() > 0) {
const float cycleT = std::fmod(tin, x1e8_duration);
const float durPerPoint = x1e8_duration / float(points.size() - 1);
idxOut = int(cycleT / durPerPoint);
const float t = (cycleT - float(idxOut) * durPerPoint) / durPerPoint;
if (points.size() == 1) {
return points.front();
}
if (points.size() == 2) {
return (points[1] - points[0]) * t + points[0];
}
zeus::CVector3f ptA;
if (idxOut > 0) {
ptA = points[idxOut - 1];
} else {
ptA = points[0] - (points[1] - points[0]);
}
const zeus::CVector3f ptB = points[idxOut];
zeus::CVector3f ptC;
if (size_t(idxOut + 1) >= points.size()) {
const zeus::CVector3f& tmpA = points[points.size() - 1];
const zeus::CVector3f& tmpB = points[points.size() - 2];
ptC = tmpA - (tmpB - tmpA);
} else {
ptC = points[idxOut + 1];
}
zeus::CVector3f ptD;
if (size_t(idxOut + 2) >= points.size()) {
const zeus::CVector3f& tmpA = points[points.size() - 1];
const zeus::CVector3f& tmpB = points[points.size() - 2];
ptD = tmpA - (tmpB - tmpA);
} else {
ptD = points[idxOut + 2];
}
return zeus::getCatmullRomSplinePoint(ptA, ptB, ptC, ptD, t);
if (points.empty()) {
return {};
}
return {};
const float cycleT = std::fmod(tin, x1e8_duration);
const float durPerPoint = x1e8_duration / float(points.size() - 1);
idxOut = int(cycleT / durPerPoint);
const float t = (cycleT - float(idxOut) * durPerPoint) / durPerPoint;
if (points.size() == 1) {
return points.front();
}
if (points.size() == 2) {
return (points[1] - points[0]) * t + points[0];
}
zeus::CVector3f ptA;
if (idxOut > 0) {
ptA = points[idxOut - 1];
} else {
ptA = points[0] - (points[1] - points[0]);
}
const zeus::CVector3f ptB = points[idxOut];
zeus::CVector3f ptC;
if (size_t(idxOut + 1) >= points.size()) {
const zeus::CVector3f& tmpA = points[points.size() - 1];
const zeus::CVector3f& tmpB = points[points.size() - 2];
ptC = tmpA - (tmpB - tmpA);
} else {
ptC = points[idxOut + 1];
}
zeus::CVector3f ptD;
if (size_t(idxOut + 2) >= points.size()) {
const zeus::CVector3f& tmpA = points[points.size() - 1];
const zeus::CVector3f& tmpB = points[points.size() - 2];
ptD = tmpA - (tmpB - tmpA);
} else {
ptD = points[idxOut + 2];
}
return zeus::getCatmullRomSplinePoint(ptA, ptB, ptC, ptD, t);
}
zeus::CQuaternion CCinematicCamera::GetInterpolatedOrientation(const std::vector<zeus::CQuaternion>& rotations,
@ -215,10 +215,10 @@ void CCinematicCamera::Think(float dt, CStateManager& mgr) {
x1ec_t += dt;
if (x1ec_t > x1e8_duration) {
for (size_t i = x1f4_passedViewPoint + 1; i < x1a8_viewPointArrivals.size(); ++i) {
for (auto i = static_cast<size_t>(x1f4_passedViewPoint) + 1; i < x1a8_viewPointArrivals.size(); ++i) {
SendArrivedMsg(x1a8_viewPointArrivals[i], mgr);
}
for (size_t i = x1f8_passedTarget + 1; i < x1c8_targetArrivals.size(); ++i) {
for (auto i = static_cast<size_t>(x1f8_passedTarget) + 1; i < x1c8_targetArrivals.size(); ++i) {
SendArrivedMsg(x1c8_targetArrivals[i], mgr);
}
DeactivateSelf(mgr);
@ -306,7 +306,7 @@ void CCinematicCamera::CalculateMoveOutofIntoEyePosition(bool outOfEye, CStateMa
behindDelta = -behindDelta;
}
for (int i = 0; i < 2; ++i) {
for (size_t i = 0; i < 2; ++i) {
x188_viewPoints[outOfEye ? i : x188_viewPoints.size() - (2 - i)] = behindPos;
x198_viewOrientations[outOfEye ? i : x198_viewOrientations.size() - (2 - i)] = q;
x1b8_targets[outOfEye ? i : x1b8_targets.size() - (2 - i)] = eyePos;

Some files were not shown because too many files have changed in this diff Show More