4
Fork 0

Ported Enderal DLL to CommonLibSSE-NG:

- Cross-runtime build, tested on SE and AE
- Intergrated Flat Map Markers and Stay At The System Page
- Added tons of sanity checks
- Automatically overrides bFreebiesSeen, bInvalidateOlderFiles, and bModManagerMenuEnabled INI values
master
Eddoursul 2 years ago
parent a9b880e1ee
commit f2150e94ef
  1. BIN
      SKSE/Plugins/EnderalSE.dll
  2. 2
      SKSE/Plugins/EnderalSE.ini
  3. 10
      SKSE/Plugins/FlatMapMarkersSSE.json
  4. BIN
      SKSE/Plugins/fs.dll
  5. BIN
      SKSE/Plugins/fs_se.dll
  6. BIN
      scripts/_00e_func_checkdependencies.pex
  7. BIN
      scripts/_00e_mqp01_functions.pex
  8. BIN
      scripts/_00e_phasmalist_apparationinventory.pex
  9. BIN
      scripts/_00e_theriantrophist_alchemycontrol.pex
  10. BIN
      scripts/_00e_theriantrophist_chymikum.pex
  11. BIN
      scripts/_00e_theriantrophist_transformsc.pex
  12. BIN
      scripts/_00e_theriantrophist_werewolfpotion.pex
  13. BIN
      scripts/enderalfunctions.pex
  14. BIN
      source/Enderal DLL/.clang-format
  15. 539
      source/Enderal DLL/.gitignore
  16. 74
      source/Enderal DLL/CMakeLists.txt
  17. 252
      source/Enderal DLL/CMakePresets.json
  18. BIN
      source/Enderal DLL/cmake/version.rc.in
  19. BIN
      source/Enderal DLL/cmake/x64-windows-skse.cmake
  20. 502
      source/Enderal DLL/src/CheckInvalidForms.h
  21. 64
      source/Enderal DLL/src/EventListener.cpp
  22. 42
      source/Enderal DLL/src/EventListener.h
  23. 20
      source/Enderal DLL/src/FlatMapMarkers.h
  24. 126
      source/Enderal DLL/src/Main.cpp
  25. 120
      source/Enderal DLL/src/PCH.h
  26. 21
      source/Enderal DLL/src/Papyrus.cpp
  27. 15
      source/Enderal DLL/src/Papyrus.h
  28. 59
      source/Enderal DLL/src/PapyrusFunctions.h
  29. 346
      source/Enderal DLL/src/PersistentFormManager.h
  30. 159
      source/Enderal DLL/src/PhasmalistFunctions.h
  31. 58
      source/Enderal DLL/src/StayAtSystemPage.h
  32. 106
      source/Enderal DLL/src/Util.h
  33. 15
      source/Enderal DLL/vcpkg-configuration.json
  34. 21
      source/Enderal DLL/vcpkg.json
  35. 9
      source/fs.dll/.gitignore
  36. 102
      source/fs.dll/common/IArchive.cpp
  37. 95
      source/fs.dll/common/IArchive.h
  38. 58
      source/fs.dll/common/IBufferStream.cpp
  39. 35
      source/fs.dll/common/IBufferStream.h
  40. 116
      source/fs.dll/common/IConsole.cpp
  41. 26
      source/fs.dll/common/IConsole.h
  42. 35
      source/fs.dll/common/ICriticalSection.h
  43. 472
      source/fs.dll/common/IDataStream.cpp
  44. 102
      source/fs.dll/common/IDataStream.h
  45. 1
      source/fs.dll/common/IDatabase.cpp
  46. 116
      source/fs.dll/common/IDatabase.h
  47. BIN
      source/fs.dll/common/IDatabase.inc
  48. 324
      source/fs.dll/common/IDebugLog.cpp
  49. 133
      source/fs.dll/common/IDebugLog.h
  50. 45
      source/fs.dll/common/IDirectoryIterator.cpp
  51. 24
      source/fs.dll/common/IDirectoryIterator.h
  52. 38
      source/fs.dll/common/IDynamicCreate.cpp
  53. 118
      source/fs.dll/common/IDynamicCreate.h
  54. 59
      source/fs.dll/common/IErrors.cpp
  55. 32
      source/fs.dll/common/IErrors.h
  56. 48
      source/fs.dll/common/IEvent.cpp
  57. 22
      source/fs.dll/common/IEvent.h
  58. 85
      source/fs.dll/common/IFIFO.cpp
  59. 27
      source/fs.dll/common/IFIFO.h
  60. 240
      source/fs.dll/common/IFileStream.cpp
  61. 37
      source/fs.dll/common/IFileStream.h
  62. 3
      source/fs.dll/common/IInterlockedLong.cpp
  63. 19
      source/fs.dll/common/IInterlockedLong.h
  64. 91
      source/fs.dll/common/ILinkedList.h
  65. 43
      source/fs.dll/common/IMemPool.cpp
  66. 312
      source/fs.dll/common/IMemPool.h
  67. 34
      source/fs.dll/common/IMutex.cpp
  68. 16
      source/fs.dll/common/IMutex.h
  69. 60
      source/fs.dll/common/IPipeClient.cpp
  70. 20
      source/fs.dll/common/IPipeClient.h
  71. 74
      source/fs.dll/common/IPipeServer.cpp
  72. 25
      source/fs.dll/common/IPipeServer.h
  73. 1
      source/fs.dll/common/IPrefix.cpp
  74. 23
      source/fs.dll/common/IPrefix.h
  75. 1
      source/fs.dll/common/IRangeMap.cpp
  76. 215
      source/fs.dll/common/IRangeMap.h
  77. 43
      source/fs.dll/common/IReadWriteLock.cpp
  78. 24
      source/fs.dll/common/IReadWriteLock.h
  79. 76
      source/fs.dll/common/ISegmentStream.cpp
  80. 44
      source/fs.dll/common/ISegmentStream.h
  81. 3
      source/fs.dll/common/ISingleton.cpp
  82. 53
      source/fs.dll/common/ISingleton.h
  83. 83
      source/fs.dll/common/ITextParser.cpp
  84. 25
      source/fs.dll/common/ITextParser.h
  85. 65
      source/fs.dll/common/IThread.cpp
  86. 32
      source/fs.dll/common/IThread.h
  87. 133
      source/fs.dll/common/ITimer.cpp
  88. 38
      source/fs.dll/common/ITimer.h
  89. 66
      source/fs.dll/common/ITypes.cpp
  90. 344
      source/fs.dll/common/ITypes.h
  91. 419
      source/fs.dll/common/common.vcproj
  92. 154
      source/fs.dll/common/common.vcxproj
  93. 196
      source/fs.dll/common/common.vcxproj.filters
  94. 22
      source/fs.dll/common/common_license.txt
  95. 24
      source/fs.dll/common/common_vc11.sln
  96. 188
      source/fs.dll/common/common_vc11.vcxproj
  97. 107
      source/fs.dll/common/common_vc11.vcxproj.filters
  98. 10
      source/fs.dll/common/common_vc11.vssscc
  99. 418
      source/fs.dll/common/common_vc12.vcproj
  100. 151
      source/fs.dll/common/common_vc12.vcxproj
  101. Some files were not shown because too many files have changed in this diff Show More

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

Binary file not shown.

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

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

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

Binary file not shown.

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

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

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

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

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

Binary file not shown.

Binary file not shown.

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

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

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

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

@ -0,0 +1,126 @@
#include "EventListener.h"
#include "Util.h"
#include "Papyrus.h"
#include "FlatMapMarkers.h"
#include "StayAtSystemPage.h"
using namespace SKSE;
static std::map<std::string, bool> g_settings{
{ "FlatMapMarkers", true },
{ "StayAtSystemPage", true }
};
namespace {
void InitializeLogging() {
auto path = logger::log_directory();
if (!path) {
SKSE::stl::report_and_fail("Failed to find standard logging directory"sv);
}
*path /= "EnderalSE.log"sv;
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true);
auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink));
log->set_level(spdlog::level::info);
log->flush_on(spdlog::level::info);
spdlog::set_default_logger(std::move(log));
spdlog::set_pattern("[%l] %v"s);
}
void InitializeMessaging()
{
GetMessagingInterface()->RegisterListener([](MessagingInterface::Message* message) {
if (message->type == MessagingInterface::kPostLoad) {
if ((std::filesystem::exists("Data\\Dawnguard.esm") && std::filesystem::file_size("Data\\Dawnguard.esm") > 1000000) || (std::filesystem::exists("Data\\Dragonborn.esm") && std::filesystem::file_size("Data\\Dragonborn.esm") > 1000000) || (std::filesystem::exists("Data\\HearthFires.esm") && std::filesystem::file_size("Data\\HearthFires.esm") > 1000000) || (std::filesystem::exists("Data\\Update.esm") && std::filesystem::file_size("Data\\Update.esm") > 1000000)) {
MessageBoxW(NULL, L"Skyrim DLCs are incompatible with Enderal.", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
if (std::filesystem::exists("Data\\Unofficial Skyrim Special Edition Patch.esp")) {
MessageBoxW(NULL, L"Unofficial Skyrim Special Edition Patch is incompatible with Enderal.", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
if (std::filesystem::exists("Data\\ccBGSSSE001-Fish.esm") || std::filesystem::exists("Data\\ccBGSSSE025-AdvDSGS.esm") || std::filesystem::exists("Data\\ccBGSSSE037-Curios.esl") || std::filesystem::exists("Data\\ccQDRSSE001-SurvivalMode.esl")) {
MessageBoxW(NULL, L"Creation Club mods are incompatible with Enderal.", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
if (g_settings.at("StayAtSystemPage")) {
if (const auto pluginInfo = GetLoadInterface()->GetPluginInfo("StayAtSystemPage"); pluginInfo) {
MessageBoxW(NULL, L"Stay At The System Page is already included in Enderal, please, disable it.", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
}
if (g_settings.at("FlatMapMarkers")) {
if (const auto pluginInfo = GetLoadInterface()->GetPluginInfo("FlatMapMarkersSSE"); pluginInfo) {
MessageBoxW(NULL, L"Flat Map Markers is already included in Enderal, please, disable it (remove file Data\\SKSE\\Plugins\\FlatMapMarkersSSE.dll).", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
}
SetINISettings();
EventListener::Install();
} else if (message->type == MessagingInterface::kPostPostLoad) {
//
} else if (message->type == MessagingInterface::kDataLoaded) {
const auto dataHandler = RE::TESDataHandler::GetSingleton();
if (dataHandler) {
if (!dataHandler->LookupLoadedModByName("Update.esm")) {
MessageBoxW(NULL, L"Update.esm is not loaded!", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
if (!dataHandler->LookupLoadedModByName("Enderal - Forgotten Stories.esm")) {
MessageBoxW(NULL, L"Enderal - Forgotten Stories.esm is not loaded!", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
}
const auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton();
if (!vm->TypeIsValid("_00e_questfunctions")) {
MessageBoxW(NULL, L"One or more of Enderal's BSA archives are not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files.", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
CheckIncompatibleMods();
} else if (message->type == MessagingInterface::kPreLoadGame) {
//
} else if ((message->type == MessagingInterface::kPostLoadGame && message->data) || message->type == MessagingInterface::kNewGame) {
NewGameCount(true);
}
});
}
}
SKSEPluginLoad(const LoadInterface* skse) {
GetLoadInterface(skse);
InitializeLogging();
auto* plugin = PluginDeclaration::GetSingleton();
auto version = plugin->GetVersion();
logger::info("{} {} is loading...", plugin->GetName(), version);
LoadINI(&g_settings, "Data/SKSE/Plugins/EnderalSE.ini");
Init(skse);
InitializeMessaging();
GetPapyrusInterface()->Register(Papyrus::Bind);
if (skse->RuntimeVersion() != RUNTIME_VR_1_4_15 && skse->RuntimeVersion() != RUNTIME_LATEST_VR && g_settings.at("FlatMapMarkers")) {
logger::info("Initializing Flat Map Markers...");
SKSE::AllocTrampoline(1 << 4);
FlatMapMarkers::Install();
}
if (g_settings.at("StayAtSystemPage")) {
logger::info("Initializing Stay At The System Page...");
JournalMenuEx::InstallHooks();
}
logger::info("{} has finished loading.", plugin->GetName());
return true;
}

@ -0,0 +1,120 @@
#pragma once
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cuchar>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <any>
#include <array>
#include <atomic>
#include <barrier>
#include <bit>
#include <bitset>
#include <charconv>
#include <chrono>
#include <compare>
#include <complex>
#include <concepts>
#include <condition_variable>
#include <deque>
#include <exception>
#include <execution>
#include <filesystem>
#include <format>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <iosfwd>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <latch>
#include <limits>
#include <locale>
#include <map>
#include <memory>
#include <memory_resource>
#include <mutex>
#include <new>
#include <numbers>
#include <numeric>
#include <optional>
#include <ostream>
#include <queue>
#include <random>
#include <ranges>
#include <regex>
#include <ratio>
#include <scoped_allocator>
#include <semaphore>
#include <set>
#include <shared_mutex>
#include <source_location>
#include <span>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <string_view>
#include <syncstream>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <typeinfo>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <variant>
#include <vector>
#include <version>
#include <RE/Skyrim.h>
#include <SKSE/SKSE.h>
#include <REL/Relocation.h>
#include <ShlObj_core.h>
#include <Windows.h>
#include <Psapi.h>
#undef cdecl // Workaround for Clang 14 CMake configure error.
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/msvc_sink.h>
// Compatible declarations with other sample projects.
#define DLLEXPORT __declspec(dllexport)
using namespace std::literals;
using namespace REL::literals;
namespace logger = SKSE::log;
namespace util {
using SKSE::stl::report_and_fail;
}

@ -0,0 +1,21 @@
#include "Papyrus.h"
#include "PapyrusFunctions.h"
#include "PhasmalistFunctions.h"
namespace Papyrus
{
bool Bind(VM* a_vm)
{
if (!a_vm) {
logger::critical("couldn't get VM State"sv);
return false;
}
logger::info("{:*^30}", "FUNCTIONS"sv);
PapyrusFunctions::Bind(*a_vm);
PhasmalistFunctions::Bind(*a_vm);
return true;
}
}

@ -0,0 +1,15 @@
#pragma once
#define BIND(a_method, ...) a_vm.RegisterFunction(#a_method##sv, script, a_method __VA_OPT__(, ) __VA_ARGS__)
#include <RE/Skyrim.h>
namespace Papyrus {
using VM = RE::BSScript::Internal::VirtualMachine;
using StackID = RE::VMStackID;
using Severity = RE::BSScript::ErrorLogger::Severity;
inline constexpr auto script = "EnderalFunctions"sv;
bool Bind(VM* a_vm);
}

@ -0,0 +1,59 @@
#pragma once
#include "Util.h"
#include "PersistentFormManager.h"
namespace Papyrus::PapyrusFunctions
{
inline RE::AlchemyItem* CreatePotion(RE::StaticFunctionTag*, std::vector<RE::EffectSetting*> effects, std::vector<float> magnitudes, std::vector<uint32_t> areas, std::vector<uint32_t> durations, uint32_t arraySize)
{
RE::AlchemyItem* result = NULL;
if (effects.size() >= arraySize && magnitudes.size() >= arraySize && areas.size() >= arraySize && durations.size() >= arraySize) {
RE::tArray<RE::Effect> effectItems;
effectItems.Allocate(effects.size());
uint16_t count = 0;
for (uint16_t i = 0; i < effects.size(); ++i) {
if (effects[i]) {
effectItems[i].baseEffect = effects[i];
effectItems[i].effectItem.duration = durations[i];
effectItems[i].effectItem.magnitude = magnitudes[i];
effectItems[i].effectItem.area = areas[i];
count++;
}
}
effectItems.count = count;
RE::PersistentFormManager::GetSingleton()->CreatePotion(&result, &effectItems);
effectItems.Clear();
} else {
logger::warn("Illegal arrays for creating a potion");
}
return result;
}
inline uint8_t GetNewGameCount(RE::StaticFunctionTag*)
{
return NewGameCount();
}
inline RE::TESObjectREFR* GetCurrentContainer(RE::StaticFunctionTag*)
{
const auto handle = RE::ContainerMenu::GetTargetRefHandle();
const auto refr = RE::TESObjectREFR::LookupByHandle(handle);
return refr ? refr.get() : nullptr;
}
inline void Bind(VM& a_vm)
{
BIND(CreatePotion);
logger::info("Registered CreatePotion"sv);
BIND(GetNewGameCount);
logger::info("Registered GetNewGameCount"sv);
BIND(GetCurrentContainer);
logger::info("Registered GetCurrentContainer"sv);
}
}

@ -0,0 +1,346 @@
#pragma once
namespace RE
{
// 18
template <class T, int nGrow = 10, int nShrink = 10>
class tArray
{
public:
T* entries; // 00
uint32_t capacity; // 08
uint32_t pad0C; // 0C
uint32_t count; // 10
uint32_t pad14; // 14
tArray() :
entries(NULL), capacity(0), count(0), pad0C(0), pad14(0) {}
T& operator[](uint64_t index)
{
return entries[index];
}
RE::MemoryManager* Heap()
{
return RE::MemoryManager::GetSingleton();
}
void Clear()
{
Heap()->Deallocate(entries, false);
entries = NULL;
capacity = 0;
count = 0;
}
bool Allocate(uint32_t numEntries)
{
entries = (T*)Heap()->Allocate(sizeof(T) * numEntries, 0, false);
if (!entries)
return false;
for (uint32_t i = 0; i < numEntries; i++)
new (&entries[i]) T;
capacity = numEntries;
count = numEntries;
return true;
}
bool CopyFrom(const tArray<T>* rhs)
{
if (rhs->count == 0)
return false;
if (!rhs->entries)
return false;
if (entries)
Clear();
if (!Allocate(rhs->count))
return false;
memcpy(entries, rhs->entries, sizeof(T) * count);
return true;
}
bool Resize(uint32_t numEntries)
{
if (numEntries == capacity)
return false;
if (!entries) {
Allocate(numEntries);
return true;
}
if (numEntries < capacity) {
// Delete the truncated entries
for (uint32_t i = numEntries; i < capacity; i++)
delete &entries[i];
}
T* newBlock = (T*)Heap()->Allocate(sizeof(T) * numEntries, 0, false); // Create a new block
memmove_s(newBlock, sizeof(T) * numEntries, entries, sizeof(T) * numEntries); // Move the old memory to the new block
if (numEntries > capacity) { // Fill in new remaining entries
for (uint32_t i = capacity; i < numEntries; i++)
new (&entries[i]) T;
}
Heap()->Deallocate(entries, false); // Free the old block
entries = newBlock; // Assign the new block
capacity = numEntries; // Capacity is now the number of total entries in the block
count = std::min(capacity, count); // Count stays the same, or is truncated to capacity
return true;
}
bool Push(const T& entry)
{
if (!entries || count + 1 > capacity) {
if (!Grow(nGrow))
return false;
}
new (&entries[count]) T(entry);
count++;
return true;
};
bool Insert(uint32_t index, const T& entry)
{
if (!entries || index < count)
return false;
entries[index] = entry;
return true;
};
bool Remove(uint32_t index)
{
if (!entries || index >= count)
return false;
// This might not be right for pointer types...
(&entries[index])->~T();
if (index + 1 < count) {
uint32_t remaining = count - index;
memmove_s(&entries[index + 1], sizeof(T) * remaining, &entries[index], sizeof(T) * remaining); // Move the rest up
}
count--;
if (capacity > count + nShrink)
Shrink();
return true;
}
bool Shrink()
{
if (!entries || count == capacity)
return false;
try {
uint32_t newSize = count;
T* oldArray = entries;
T* newArray = (T*)Heap()->Allocate(sizeof(T) * newSize, 0, false); // Allocate new block
memmove_s(newArray, sizeof(T) * newSize, entries, sizeof(T) * newSize); // Move the old block
entries = newArray;
capacity = count;
Heap()->Deallocate(oldArray, false); // Free the old block
return true;
} catch (...) {
return false;
}
return false;
}
bool Grow(uint32_t numEntries)
{
if (!entries) {
entries = (T*)Heap()->Allocate(sizeof(T) * numEntries, 0, false);
count = 0;
capacity = numEntries;
return true;
}
try {
uint32_t oldSize = capacity;
uint32_t newSize = oldSize + numEntries;
T* oldArray = entries;
T* newArray = (T*)Heap()->Allocate(sizeof(T) * newSize, 0, false); // Allocate new block
if (oldArray)
memmove_s(newArray, sizeof(T) * newSize, entries, sizeof(T) * capacity); // Move the old block
entries = newArray;
capacity = newSize;
if (oldArray)
Heap()->Deallocate(oldArray, false); // Free the old block
for (uint32_t i = oldSize; i < newSize; i++) // Allocate the rest of the free blocks
new (&entries[i]) T;
return true;
} catch (...) {
return false;
}
return false;
}
bool GetNthItem(uint64_t index, T& pT) const
{
if (index < count) {
pT = entries[index];
return true;
}
return false;
}
int64_t GetItemIndex(T& pFind) const
{
for (uint64_t n = 0; n < count; n++) {
T& pT = entries[n];
if (pT == pFind)
return n;
}
return -1;
}
};
typedef tArray<uint64_t> UnkArray;
typedef tArray<TESForm*> UnkFormArray;
// D0
class PersistentFormManager
{
public:
// 10
struct EnchantData
{
EnchantmentItem* enchantment; // 00
volatile long refCount; // 08
uint32_t pad; // 0C
};
uint64_t unk00; // 00
tArray<EnchantData> weaponEnchants; // 08
tArray<EnchantData> armorEnchants; // 20
uint64_t unk38; // 38
uint32_t unk40; // 40
uint32_t unk44; // 44
uint32_t unk48; // 48
uint32_t unk4C; // 4C
// 30
struct Data
{
void* unk00; // 00
uint64_t unk08; // 08
void* unk10; // 10
uint64_t unk18; // 18
uint32_t unk20; // 20
uint32_t unk24; // 24
uint32_t unk28; // 28
uint32_t unk2C; // 2C
};
Data unk50; // 50
Data unk80; // 80
void* unkB0; // B0
uint64_t unkB8; // B8
uint64_t unkC0; // C0
uint64_t unkC8; // C8
//RelocPtr<RE::PersistentFormManager*> g_persistentFormManager(0x01EBEAE8); // SE
//RelocPtr<RE::PersistentFormManager*> g_persistentFormManager(0x01F5A468); // AE
[[nodiscard]] static PersistentFormManager* GetSingleton()
{
REL::Relocation<PersistentFormManager**> singleton{ RELOCATION_ID(514172, 400320) };
return *singleton;
}
void IncRefEnchantment(EnchantmentItem* enchantment)
{
if (enchantment && enchantment->formID >= 0xFF000000) {
for (uint32_t i = 0; i < weaponEnchants.count; i++) {
EnchantData foundData;
weaponEnchants.GetNthItem(i, foundData);
if (foundData.enchantment == enchantment) {
InterlockedIncrement(&weaponEnchants[i].refCount);
break;
}
}
for (uint32_t i = 0; i < armorEnchants.count; i++) {
EnchantData foundData;
armorEnchants.GetNthItem(i, foundData);
if (foundData.enchantment == enchantment) {
InterlockedIncrement(&armorEnchants[i].refCount);
break;
}
}
}
}
// The game doesn't bother to dec ref or even delete custom enchants
// when they are no longer used, maybe we can fix this?
void DecRefEnchantment(EnchantmentItem* enchantment)
{
if (enchantment && enchantment->formID >= 0xFF000000) {
for (uint32_t i = 0; i < weaponEnchants.count; i++) {
EnchantData foundData;
weaponEnchants.GetNthItem(i, foundData);
if (foundData.enchantment == enchantment) {
if (!InterlockedDecrement(&weaponEnchants[i].refCount))
ScheduleForDeletion(enchantment);
break;
}
}
for (uint32_t i = 0; i < armorEnchants.count; i++) {
EnchantData foundData;
armorEnchants.GetNthItem(i, foundData);
if (foundData.enchantment == enchantment) {
if (!InterlockedDecrement(&armorEnchants[i].refCount))
ScheduleForDeletion(enchantment);
break;
}
}
}
}
//MEMBER_FN_PREFIX(PersistentFormManager);
// SE
/*
DEFINE_MEMBER_FN(CreateOffensiveEnchantment, EnchantmentItem*, 0x0059F0F0, tArray<Effect::EffectItem>* effectArray);
DEFINE_MEMBER_FN(CreateDefensiveEnchantment, EnchantmentItem*, 0x0059F190, tArray<Effect::EffectItem>* effectArray);
DEFINE_MEMBER_FN(CreatePoison, void, 0x0059F2E0, tArray<Effect::EffectItem>* effectArray, AlchemyItem** poison);
DEFINE_MEMBER_FN(CreatePotion, void, 0x0059F230, AlchemyItem** potion, tArray<Effect::EffectItem>* effectArray);
DEFINE_MEMBER_FN(ScheduleForDeletion, void, 0x0059F6E0, TESForm*);
*/
// AE
/*
DEFINE_MEMBER_FN(CreateOffensiveEnchantment, EnchantmentItem*, 0x005C1350, tArray<Effect::EffectItem>* effectArray);
DEFINE_MEMBER_FN(CreateDefensiveEnchantment, EnchantmentItem*, 0x005C13F0, tArray<Effect::EffectItem>* effectArray);
DEFINE_MEMBER_FN(CreatePoison, void, 0x005C1540, tArray<Effect::EffectItem>* effectArray, AlchemyItem** poison);
DEFINE_MEMBER_FN(CreatePotion, void, 0x005C1490, AlchemyItem** potion, tArray<Effect>* effectArray);
DEFINE_MEMBER_FN(ScheduleForDeletion, void, 0x005C1870, TESForm*);
*/
void CreatePotion(AlchemyItem** potion, tArray<Effect>* effectArray)
{
using func_t = decltype(&PersistentFormManager::CreatePotion);
REL::Relocation<func_t> func{ RELOCATION_ID(35265, 36167) };
return func(this, potion, effectArray);
}
void ScheduleForDeletion(TESForm* form)
{
using func_t = decltype(&PersistentFormManager::ScheduleForDeletion);
REL::Relocation<func_t> func{ RELOCATION_ID(35269, 36171) };
return func(this, form);
}
};
//STATIC_ASSERT(sizeof(PersistentFormManager) == 0xD0);
}

@ -0,0 +1,159 @@
#pragma once
namespace Papyrus::PhasmalistFunctions
{
static constexpr float magicWeight = 0.1;
float getMagicEffectStrength(RE::EffectSetting* magicEffect, float magnitude, float area, float duration)
{
float result = magicEffect->data.baseCost;
if (magnitude > 0) {
result *= magnitude;
}
if (area > 0) {
result *= area;
}
if (duration > 0) {
result *= duration;
}
return result;
}
float getEnchantmentStrength(RE::EnchantmentItem* ench)
{
if (!ench) {
return 0.0;
}
float result = 0;
const auto effects = ench->As<RE::MagicItem>()->effects;
for (int i = effects.size() - 1; i >= 0; i--) {
result += getMagicEffectStrength(
effects[i]->baseEffect,
effects[i]->GetMagnitude(),
effects[i]->GetArea(),
effects[i]->GetDuration());
}
return result * magicWeight;
}
float getSpellStrength(RE::SpellItem* spell)
{
if (!spell) {
return 0.0;
}
/*
* // Sum of effect costs
float result = 0;
for (int i = papyrusSpell::GetNumEffects(spell) - 1; i >= 0; i--) {
result += getMagicEffectStrength(
papyrusSpell::GetNthEffectMagicEffect(spell, i),
papyrusSpell::GetNthEffectMagnitude(spell, i),
papyrusSpell::GetNthEffectDuration(spell, i),
papyrusSpell::GetNthEffectArea(spell, i));
}
*/
/*
* // The costliest effect
int iCostliestEffect = papyrusSpell::GetCostliestEffectIndex(spell);
float result = getMagicEffectStrength(
papyrusSpell::GetNthEffectMagicEffect(spell, iCostliestEffect),
papyrusSpell::GetNthEffectMagnitude(spell, iCostliestEffect),
papyrusSpell::GetNthEffectDuration(spell, iCostliestEffect),
papyrusSpell::GetNthEffectArea(spell, iCostliestEffect)
);
*/
// 2.0.10: Switch to flat magicka correlation
return spell->GetData1()->costOverride * 1.5;
}
float getAdditionalExtendDataStrength(RE::InventoryEntryData* itemStack, float physicalStrength)
{
float strength = 0;
if (!itemStack->extraLists) {
return strength;
}
for (const auto& xList : *itemStack->extraLists) {
const auto xEnch = xList->GetByType<RE::ExtraEnchantment>();
if (xEnch && xEnch->enchantment) {
strength += getEnchantmentStrength(xEnch->enchantment) * xList->GetCount();
}
const auto xTempered = xList->GetByType<RE::ExtraHealth>();
if (xTempered && xTempered->health > 1.0) {
strength += physicalStrength * (xTempered->health - 1.0) * 20 * xList->GetCount();
}
}
return strength;
}
float getItemStackStrength(RE::InventoryEntryData* itemStack)
{
float strength = 0;
float physicalStrength = 0;
if (itemStack->object) {
if (itemStack->object->IsWeapon()) {
RE::TESObjectWEAP* asWeapon = itemStack->object->As<RE::TESObjectWEAP>();
if (asWeapon) {
float baseDmg = asWeapon->GetAttackDamage() * 1.5;
float speed = asWeapon->GetSpeed();
physicalStrength = baseDmg * speed;
strength += physicalStrength;
strength += getEnchantmentStrength(asWeapon->As<RE::TESEnchantableForm>()->formEnchanting);
}
}
if (itemStack->object->IsArmor()) {
RE::TESObjectARMO* asArmor = itemStack->object->As<RE::TESObjectARMO>();
if (asArmor) {
physicalStrength = asArmor->GetArmorRating();
strength += physicalStrength;
strength += getEnchantmentStrength(asArmor->As<RE::TESEnchantableForm>()->formEnchanting);
}
}
if (itemStack->object->IsBook()) {
RE::TESObjectBOOK* asBook = itemStack->object->As<RE::TESObjectBOOK>();
if (asBook && asBook->TeachesSpell()) {
return getSpellStrength(asBook->GetSpell());
}
}
}
strength = strength * itemStack->countDelta;
strength += getAdditionalExtendDataStrength(itemStack, physicalStrength);
return strength;
}
float calculateContentStrength(RE::StaticFunctionTag* tag, RE::TESObjectREFR* container)
{
if (!container) {
return 0.0;
}
float strength = 0;
const auto inv = container->GetInventory();
for (const auto& [item, data] : inv) {
const auto& [count, entry] = data;
if (count > 0) {
strength += getItemStackStrength(entry.get());
}
}
return strength;
}
inline void Bind(VM& a_vm)
{
BIND(calculateContentStrength);
logger::info("Registered calculateContentStrength"sv);
}
}

@ -0,0 +1,58 @@
#pragma once
// Based on Ryan McKenzie's Stay at the System Page
class JournalMenuEx :
public RE::JournalMenu
{
public:
enum class Tab : std::uint32_t
{
kQuest,
kStats,
kSystem
};
void Hook_Accept(RE::FxDelegateHandler::CallbackProcessor* a_cbProc)
{
_Accept(this, a_cbProc);
fxDelegate->callbacks.Remove("RememberCurrentTabIndex");
a_cbProc->Process("RememberCurrentTabIndex", RememberCurrentTabIndex);
}
RE::UI_MESSAGE_RESULTS Hook_ProcessMessage(RE::UIMessage& a_message)
{
switch (a_message.type.get()) {
case RE::UI_MESSAGE_TYPE::kShow:
{
auto UI = RE::UI::GetSingleton();
auto InterfaceStrings = RE::InterfaceStrings::GetSingleton();
if (UI && InterfaceStrings && UI->IsMenuOpen(InterfaceStrings->mapMenu)) {
*_savedTabIdx = Tab::kQuest;
} else {
*_savedTabIdx = Tab::kSystem;
}
}
default:
break;
}
return _ProcessMessage(this, a_message);
}
static void RememberCurrentTabIndex([[maybe_unused]] const RE::FxDelegateArgs& a_params)
{
return;
}
static void InstallHooks()
{
REL::Relocation<uintptr_t> vtbl(RE::VTABLE_JournalMenu[0]);
_Accept = vtbl.write_vfunc(0x01, &JournalMenuEx::Hook_Accept);
_ProcessMessage = vtbl.write_vfunc(0x04, &JournalMenuEx::Hook_ProcessMessage);
}
static inline REL::Relocation<decltype(&Hook_Accept)> _Accept;
static inline REL::Relocation<decltype(&Hook_ProcessMessage)> _ProcessMessage;
static inline REL::Relocation<Tab*> _savedTabIdx{ RELOCATION_ID(520167, 406697) };
};

@ -0,0 +1,106 @@
#pragma once
#include "CheckInvalidForms.h"
#include <SimpleIni.h>
inline const SKSE::LoadInterface* GetLoadInterface(const SKSE::LoadInterface* loadInterface = nullptr)
{
const static SKSE::LoadInterface* singleton;
if (loadInterface) {
singleton = loadInterface;
}
return singleton;
}
inline uint8_t NewGameCount(bool increment = false)
{
static uint8_t g_NewGameStarted = 0;
if (increment) {
g_NewGameStarted++;
}
return g_NewGameStarted;
}
inline bool IsSE()
{
return GetLoadInterface()->RuntimeVersion().minor() == 5;
}
inline void SetINISettings()
{
auto* setting = RE::INIPrefSettingCollection::GetSingleton()->GetSetting("bFreebiesSeen:General");
if (setting && !setting->GetBool()) {
setting->data.b = true;
RE::INIPrefSettingCollection::GetSingleton()->WriteSetting(setting);
}
setting = RE::INISettingCollection::GetSingleton()->GetSetting("bInvalidateOlderFiles:Archive");
if (setting && !setting->GetBool()) {
setting->data.b = true;
RE::INISettingCollection::GetSingleton()->WriteSetting(setting);
}
setting = RE::INISettingCollection::GetSingleton()->GetSetting("bModManagerMenuEnabled:General");
if (setting && setting->GetBool()) {
setting->data.b = false;
RE::INISettingCollection::GetSingleton()->WriteSetting(setting);
}
}
inline void CheckIncompatibleMods()
{
RE::ConsoleLog::GetSingleton()->Print("Loaded SureAI's Enderal: Forgotten Stories | Special Edition port v2.0.12 by Eddoursul et al");
CheckWorldspaces();
CheckSkyrimCells();
CheckEnderalCells();
}
inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
{
for (auto it = settings->begin(); it != settings->end(); it++) {
logger::info("[DEFAULT] {} = {}", it->first, it->second);
}
if (!std::filesystem::exists(iniPath)) {
logger::warn("{} does not exist, using default values.", iniPath);
return;
}
try {
CSimpleIniA ini;
ini.SetUnicode(false);
ini.SetMultiKey(false);
ini.LoadFile(iniPath);
std::list<CSimpleIniA::Entry> keysList;
ini.GetAllKeys("", keysList);
bool bUpdateINI = false;
for (auto it = settings->begin(); it != settings->end(); it++) {
bool bExists = false;
for (const auto& k : keysList) {
if (it->first == k.pItem) {
settings->insert_or_assign(k.pItem, ini.GetBoolValue("", k.pItem, settings->at(k.pItem)));
logger::info("[INI] {} = {}", k.pItem, settings->at(k.pItem));
bExists = true;
break;
}
}
if (!bExists) {
ini.SetBoolValue("", it->first.c_str(), it->second);
bUpdateINI = true;
}
}
if (bUpdateINI) {
logger::info("New settings detected, adding to ArtifactTracker.ini");
ini.SaveFile(iniPath);
}
} catch (const std::exception& e) {
logger::error(e.what());
}
}

@ -0,0 +1,15 @@
{
"registries": [
{
"kind": "git",
"repository": "https://gitlab.com/colorglass/vcpkg-colorglass",
"baseline": "5a11d06fd1b2d7cd6339d6aea48d450309e89cc1",
"packages": [
"commonlibsse-ng",
"gluino",
"script-extender-common",
"skse"
]
}
]
}

@ -0,0 +1,21 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "enderal-se",
"version-string": "1.0.0",
"port-version": 0,
"description": "Enderal SE Helper",
"homepage": "https://eddoursul.win/mods/enderal-se/",
"license": "LGPL-3.0",
"features": {
"plugin": {
"description": "Enderal SE functions and potion replacer.",
"dependencies": [
"commonlibsse-ng",
"simpleini"
]
}
},
"default-features": [
"plugin"
]
}

@ -1,9 +0,0 @@
*.db
.vs/
x64/
x64_*/
common/x64_*/
fs/x64/
skse64/.vs/
skse64/skse64/x64/
skse64/skse64_common/x64/

@ -1,102 +0,0 @@
#include "IArchive.h"
#include "IErrors.h"
#if ENABLE_IDYNAMICCREATE
IDynamic * IArchive::iterator::Instantiate(void)
{
IDataSubStream subStream(owner->theStream, GetDataOffset(), GetDataLength());
return IClassRegistry::Instantiate(GetTypeID(), &subStream);
}
void * IArchive::iterator::GetBuffer(UInt32 * outLength)
{
HeaderEntry * entry = GetData();
UInt8 * buf = new UInt8[entry->dataLength];
owner->theStream->SetOffset(entry->dataOffset);
owner->theStream->ReadBuf(buf, entry->dataLength);
if(outLength)
*outLength = entry->dataLength;
return buf;
}
void IArchive::iterator::NextOfType(UInt32 typeID)
{
idx++;
while((GetData()->typeID != typeID) && (idx < owner->header.numEntries))
idx++;
}
void IArchive::iterator::PrevOfType(UInt32 typeID)
{
idx--;
while((GetData()->typeID != typeID) && (idx > 0))
idx--;
}
IArchive::IArchive()
:theStream(NULL), entries(NULL), nameTable(NULL)
{
}
IArchive::IArchive(IDataStream * stream)
:theStream(NULL), entries(NULL), nameTable(NULL)
{
AttachStream(stream);
}
IArchive::~IArchive()
{
Dispose();
}
void IArchive::AttachStream(IDataStream * inStream)
{
Dispose();
theStream = inStream;
}
void IArchive::Dispose(void)
{
if(entries)
{
delete entries;
entries = NULL;
}
if(nameTable)
{
delete nameTable;
nameTable = NULL;
}
}
void IArchive::ReadHeader(void)
{
ASSERT(theStream);
theStream->Rewind();
theStream->ReadBuf(&header, sizeof(FileHeader));
entries = new HeaderEntry[header.numEntries];
theStream->ReadBuf(entries, header.numEntries * sizeof(HeaderEntry));
if(header.nameTableLength)
{
nameTable = new char[header.nameTableLength];
theStream->SetOffset(header.nameTableOffset);
theStream->ReadBuf(nameTable, header.nameTableLength);
}
}
#endif

@ -1,95 +0,0 @@
#pragma once
#include "common/IDataStream.h"
#include "common/IDynamicCreate.h"
#if ENABLE_IDYNAMICCREATE
/**
* An object archive
*
* This class implements reading and instantiating objects from an object archive.
*/
class IArchive
{
public:
class iterator;
friend iterator;
IArchive();
IArchive(IDataStream * inStream);
~IArchive();
void AttachStream(IDataStream * inStream);
void Dispose(void);
iterator begin(void) { return iterator(0, this); }
iterator end(void) { return iterator(header.numEntries, this); }
static const UInt32 kFileID = CHAR_CODE(0x00, 'A', 'R', 0x01);
static const UInt32 kCurrentVersion = VERSION_CODE(1, 0, 0);
private:
struct FileHeader
{
UInt32 fileID; // IArchive::kFileID
UInt32 version; // IArchive::kCurrentVersion
UInt32 numEntries;
UInt32 nameTableOffset;
UInt32 nameTableLength;
};
struct HeaderEntry
{
UInt32 typeID;
UInt32 subID;
UInt32 dataOffset;
UInt32 dataLength;
UInt32 nameOffset;
};
void ReadHeader(void);
IDataStream * theStream;
FileHeader header;
HeaderEntry * entries;
char * nameTable;
public:
class iterator
{
public:
iterator() { idx = 0; owner = NULL; }
iterator(UInt32 inIdx, IArchive * inArchive) { idx = inIdx; owner = inArchive; }
~iterator() { }
IDynamic * Instantiate(void);
UInt32 GetTypeID(void) { return GetData()->typeID; }
UInt32 GetSubID(void) { return GetData()->subID; }
UInt32 GetDataLength(void) { return GetData()->dataLength; }
char * GetName(void) { return &owner->nameTable[GetData()->nameOffset]; }
void * GetBuffer(UInt32 * outLength);
iterator & operator++() { Next(); return *this; }
iterator & operator--() { Prev(); return *this; }
void NextOfType(UInt32 typeID);
void Next(void) { idx++; }
void PrevOfType(UInt32 typeID);
void Prev(void) { idx--; }
private:
HeaderEntry * GetData(void) { return &owner->entries[idx]; }
UInt32 GetDataOffset(void) { return GetData()->dataOffset; }
UInt32 idx;
IArchive * owner;
};
};
#endif

@ -1,58 +0,0 @@
#include "IBufferStream.h"
IBufferStream::IBufferStream()
:streamBuf(NULL), flags(0)
{
}
IBufferStream::IBufferStream(const IBufferStream & rhs)
{
// explicitly not supporting copy constructor for self-owned buffers
ASSERT((flags & kFlag_OwnedBuf) == 0);
}
IBufferStream::IBufferStream(void * buf, UInt64 inLength)
:streamBuf(NULL), flags(0)
{
SetBuffer(buf, inLength);
}
IBufferStream::~IBufferStream()
{
if(flags & kFlag_OwnedBuf)
{
delete [] streamBuf;
}
}
IBufferStream & IBufferStream::operator=(IBufferStream & rhs)
{
// explicitly not supporting copying for self-owned buffers
ASSERT((flags & kFlag_OwnedBuf) == 0);
streamBuf = rhs.streamBuf;
flags = rhs.flags;
return *this;
}
void IBufferStream::SetBuffer(void * buf, UInt64 inLength)
{
streamBuf = (UInt8 *)buf;
streamLength = inLength;
Rewind();
}
void IBufferStream::ReadBuf(void * buf, UInt32 inLength)
{
memcpy(buf, &streamBuf[streamOffset], inLength);
streamOffset += inLength;
}
void IBufferStream::WriteBuf(const void * buf, UInt32 inLength)
{
memcpy(&streamBuf[streamOffset], buf, inLength);
streamOffset += inLength;
}

@ -1,35 +0,0 @@
#pragma once
#include "common/IDataStream.h"
class IBufferStream : public IDataStream
{
public:
IBufferStream();
IBufferStream(const IBufferStream & rhs);
IBufferStream(void * buf, UInt64 inLength);
virtual ~IBufferStream();
IBufferStream & operator=(IBufferStream & rhs);
void SetBuffer(void * buf, UInt64 inLength);
void * GetBuffer(void) { return streamBuf; }
void OwnBuffer(void) { flags |= kFlag_OwnedBuf; }
void DisownBuffer(void) { flags &= ~kFlag_OwnedBuf; }
// read
virtual void ReadBuf(void * buf, UInt32 inLength);
// write
virtual void WriteBuf(const void * buf, UInt32 inLength);
protected:
UInt8 * streamBuf;
UInt32 flags;
enum
{
kFlag_OwnedBuf = 1 << 0
};
};

@ -1,116 +0,0 @@
#include "common/IConsole.h"
#include <cstdarg>
#include <cstring>
#include <Windows.h>
IConsole::IConsole()
{
AllocConsole();
SetConsoleTitle("Console");
inputHandle = GetStdHandle(STD_INPUT_HANDLE);
outputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
ASSERT_STR(inputHandle, "IConsole: couldn't get input handle");
ASSERT_STR(outputHandle, "IConsole: couldn't get output handle");
SetConsoleMode(inputHandle, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
SetConsoleMode(outputHandle, ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
}
IConsole::~IConsole()
{
}
/**
* Writes a string to the console
*/
void IConsole::Write(char * buf)
{
UInt32 charsWritten;
WriteConsole(outputHandle, buf, std::strlen(buf), &charsWritten, NULL);
}
/**
* Writes a formatted string to the console
*
* You may specify a temp buffer to use for the formatted text, but if NULL
* is used a local buffer will be provided.
*
* @param buf a temporary buffer, or NULL to use the internal buffer
* @param fmt the format string
*/
void IConsole::Write(char * buf, UInt32 bufLen, const char * fmt, ...)
{
static char tempBuf[4096];
if(!buf)
{
buf = tempBuf;
bufLen = sizeof(tempBuf);
}
va_list args;
va_start(args, fmt);
vsprintf_s(buf, bufLen, fmt, args);
va_end(args);
Write(buf);
}
/**
* Reads a single character from the console
*/
char IConsole::ReadChar(void)
{
char data;
UInt32 charsRead;
ReadConsole(inputHandle, &data, 1, &charsRead, NULL);
return data;
}
/**
* Reads a newline-terminated string from the console
*
* @param buf output buffer
* @param len buffer size
* @return number of characters read
*/
UInt32 IConsole::ReadBuf(char * buf, UInt32 len)
{
UInt32 charsRead;
buf[0] = 0;
do
{
ReadConsole(inputHandle, buf, len, &charsRead, NULL);
}
while(!charsRead);
int done = 0;
for(UInt32 i = charsRead - 1; (i > 0) && !done; i--)
{
switch(buf[i])
{
case 0x0A:
case 0x0D:
buf[i] = 0;
break;
default:
done = 1;
break;
}
}
buf[charsRead] = 0;
return charsRead;
}

@ -1,26 +0,0 @@
#pragma once
#include "common/ITypes.h"
#include "common/ISingleton.h"
#include <Windows.h>
/**
* Wrapper class for a standard Windows console
*
* @todo make nonblocking
*/
class IConsole : public ISingleton<IConsole>
{
public:
IConsole();
~IConsole();
void Write(char * buf);
void Write(char * buf, UInt32 bufLen, const char * fmt, ...);
char ReadChar(void);
UInt32 ReadBuf(char * buf, UInt32 len);
private:
HANDLE inputHandle, outputHandle;
};

@ -1,35 +0,0 @@
#pragma once
class ICriticalSection
{
public:
ICriticalSection() { InitializeCriticalSection(&critSection); }
~ICriticalSection() { DeleteCriticalSection(&critSection); }
void Enter(void) { EnterCriticalSection(&critSection); }
void Leave(void) { LeaveCriticalSection(&critSection); }
bool TryEnter(void) { return TryEnterCriticalSection(&critSection) != 0; }
private:
CRITICAL_SECTION critSection;
};
class IScopedCriticalSection
{
public:
IScopedCriticalSection(ICriticalSection * cs)
:m_cs(cs)
{
m_cs->Enter();
}
~IScopedCriticalSection()
{
m_cs->Leave();
}
private:
IScopedCriticalSection(); // undefined
ICriticalSection * m_cs;
};

@ -1,472 +0,0 @@
#include "IDataStream.h"
/**** IDataStream *************************************************************/
IDataStream::IDataStream()
:streamLength(0), streamOffset(0), swapBytes(false)
{
}
IDataStream::~IDataStream()
{
}
/**
* Reads and returns an 8-bit value from the stream
*/
UInt8 IDataStream::Read8(void)
{
UInt8 out;
ReadBuf(&out, sizeof(UInt8));
return out;
}
/**
* Reads and returns a 16-bit value from the stream
*/
UInt16 IDataStream::Read16(void)
{
UInt16 out;
ReadBuf(&out, sizeof(UInt16));
if(swapBytes)
out = Swap16(out);
return out;
}
/**
* Reads and returns a 32-bit value from the stream
*/
UInt32 IDataStream::Read32(void)
{
UInt32 out;
ReadBuf(&out, sizeof(UInt32));
if(swapBytes)
out = Swap32(out);
return out;
}
/**
* Reads and returns a 64-bit value from the stream
*/
UInt64 IDataStream::Read64(void)
{
UInt64 out;
ReadBuf(&out, sizeof(UInt64));
if(swapBytes)
out = Swap64(out);
return out;
}
/**
* Reads and returns a 32-bit floating point value from the stream
*/
float IDataStream::ReadFloat(void)
{
UInt32 out = Read32();
return *((float *)&out);
}
/**
* Reads a null-or-return-terminated string from the stream
*
* If the buffer is too small to hold the entire string, it is truncated and
* properly terminated.
*
* @param buf the output buffer
* @param bufLength the size of the output buffer
* @return the number of characters written to the buffer
*/
UInt32 IDataStream::ReadString(char * buf, UInt32 bufLength, char altTerminator, char altTerminator2)
{
char * traverse = buf;
bool breakOnReturns = false;
if((altTerminator == '\n') || (altTerminator2 == '\n'))
breakOnReturns = true;
ASSERT_STR(bufLength > 0, "IDataStream::ReadString: zero-sized buffer");
if(bufLength == 1)
{
buf[0] = 0;
return 0;
}
bufLength--;
for(UInt32 i = 0; i < bufLength; i++)
{
if(HitEOF()) break;
UInt8 data = Read8();
if(breakOnReturns)
{
if(data == 0x0D)
{
if(Peek8() == 0x0A)
Skip(1);
break;
}
}
if(!data || (data == altTerminator) || (data == altTerminator2))
{
break;
}
*traverse++ = data;
}
*traverse++ = 0;
return traverse - buf - 1;
}
/**
* Reads and returns an 8-bit value from the stream without advancing the stream's position
*/
UInt8 IDataStream::Peek8(void)
{
IDataStream_PositionSaver saver(this);
return Read8();
}
/**
* Reads and returns a 16-bit value from the stream without advancing the stream's position
*/
UInt16 IDataStream::Peek16(void)
{
IDataStream_PositionSaver saver(this);
return Read16();
}
/**
* Reads and returns a 32-bit value from the stream without advancing the stream's position
*/
UInt32 IDataStream::Peek32(void)
{
IDataStream_PositionSaver saver(this);
return Read32();
}
/**
* Reads and returns a 32-bit value from the stream without advancing the stream's position
*/
UInt64 IDataStream::Peek64(void)
{
IDataStream_PositionSaver saver(this);
return Read64();
}
/**
* Reads and returns a 32-bit floating point value from the stream without advancing the stream's position
*/
float IDataStream::PeekFloat(void)
{
IDataStream_PositionSaver saver(this);
return ReadFloat();
}
/**
* Reads raw data into a buffer without advancing the stream's position
*/
void IDataStream::PeekBuf(void * buf, UInt32 inLength)
{
IDataStream_PositionSaver saver(this);
ReadBuf(buf, inLength);
}
/**
* Skips a specified number of bytes down the stream
*/
void IDataStream::Skip(SInt64 inBytes)
{
SetOffset(GetOffset() + inBytes);
}
/**
* Writes an 8-bit value to the stream.
*/
void IDataStream::Write8(UInt8 inData)
{
WriteBuf(&inData, sizeof(UInt8));
}
/**
* Writes a 16-bit value to the stream.
*/
void IDataStream::Write16(UInt16 inData)
{
if(swapBytes)
inData = Swap16(inData);
WriteBuf(&inData, sizeof(UInt16));
}
/**
* Writes a 32-bit value to the stream.
*/
void IDataStream::Write32(UInt32 inData)
{
if(swapBytes)
inData = Swap32(inData);
WriteBuf(&inData, sizeof(UInt32));
}
/**
* Writes a 64-bit value to the stream.
*/
void IDataStream::Write64(UInt64 inData)
{
if(swapBytes)
inData = Swap64(inData);
WriteBuf(&inData, sizeof(UInt64));
}
/**
* Writes a 32-bit floating point value to the stream.
*/
void IDataStream::WriteFloat(float inData)
{
if(swapBytes)
{
UInt32 temp = *((UInt32 *)&inData);
temp = Swap32(temp);
WriteBuf(&temp, sizeof(UInt32));
}
else
{
WriteBuf(&inData, sizeof(float));
}
}
/**
* Writes a null-terminated string to the stream.
*/
void IDataStream::WriteString(const char * buf)
{
WriteBuf(buf, std::strlen(buf) + 1);
}
/**
* Returns the length of the stream
*/
SInt64 IDataStream::GetLength(void)
{
return streamLength;
}
/**
* Returns the number of bytes remaining in the stream
*/
SInt64 IDataStream::GetRemain(void)
{
return streamLength - streamOffset;
}
/**
* Returns the current offset into the stream
*/
SInt64 IDataStream::GetOffset(void)
{
return streamOffset;
}
/**
* Returns whether we have reached the end of the stream or not
*/
bool IDataStream::HitEOF(void)
{
return streamOffset >= streamLength;
}
/**
* Moves the current offset into the stream
*/
void IDataStream::SetOffset(SInt64 inOffset)
{
streamOffset = inOffset;
}
/**
* Enables or disables byte swapping for basic data transfers
*/
void IDataStream::SwapBytes(bool inSwapBytes)
{
swapBytes = inSwapBytes;
}
IDataStream * IDataStream::GetRootParent(void)
{
IDataStream * parent = GetParent();
if(parent)
return parent->GetRootParent();
else
return this;
}
void IDataStream::CopyStreams(IDataStream * out, IDataStream * in, UInt64 bufferSize, UInt8 * buf)
{
in->Rewind();
bool ourBuffer = false;
if(!buf)
{
buf = new UInt8[bufferSize];
ourBuffer = true;
}
UInt64 remain = in->GetLength();
while(remain > 0)
{
UInt64 transferSize = remain;
if(transferSize > bufferSize)
transferSize = bufferSize;
in->ReadBuf(buf, transferSize);
out->WriteBuf(buf, transferSize);
remain -= transferSize;
}
if(ourBuffer)
delete [] buf;
}
void IDataStream::CopySubStreams(IDataStream * out, IDataStream * in, UInt64 remain, UInt64 bufferSize, UInt8 * buf)
{
bool ourBuffer = false;
if(!buf)
{
buf = new UInt8[bufferSize];
ourBuffer = true;
}
while(remain > 0)
{
UInt64 transferSize = remain;
if(transferSize > bufferSize)
transferSize = bufferSize;
in->ReadBuf(buf, transferSize);
out->WriteBuf(buf, transferSize);
remain -= transferSize;
}
if(ourBuffer)
delete [] buf;
}
/**** IDataStream_PositionSaver ***********************************************/
/**
* The constructor; save the stream's position
*/
IDataStream_PositionSaver::IDataStream_PositionSaver(IDataStream * tgt)
{
stream = tgt;
offset = tgt->GetOffset();
}
/**
* The destructor; restore the stream's saved position
*/
IDataStream_PositionSaver::~IDataStream_PositionSaver()
{
stream->SetOffset(offset);
}
/**** IDataSubStream **********************************************************/
IDataSubStream::IDataSubStream()
:stream(NULL), subBase(0)
{
//
}
IDataSubStream::IDataSubStream(IDataStream * inStream, SInt64 inOffset, SInt64 inLength)
{
stream = inStream;
subBase = inOffset;
streamLength = inLength;
stream->SetOffset(inOffset);
}
IDataSubStream::~IDataSubStream()
{
}
void IDataSubStream::Attach(IDataStream * inStream, SInt64 inOffset, SInt64 inLength)
{
stream = inStream;
subBase = inOffset;
streamLength = inLength;
stream->SetOffset(inOffset);
}
void IDataSubStream::ReadBuf(void * buf, UInt32 inLength)
{
ASSERT_STR(inLength <= GetRemain(), "IDataSubStream::ReadBuf: hit eof");
if(stream->GetOffset() != subBase + streamOffset)
stream->SetOffset(subBase + streamOffset);
stream->ReadBuf(buf, inLength);
streamOffset += inLength;
}
void IDataSubStream::WriteBuf(const void * buf, UInt32 inLength)
{
if(stream->GetOffset() != subBase + streamOffset)
stream->SetOffset(subBase + streamOffset);
stream->WriteBuf(buf, inLength);
streamOffset += inLength;
if(streamLength < streamOffset)
streamLength = streamOffset;
}
void IDataSubStream::SetOffset(SInt64 inOffset)
{
stream->SetOffset(subBase + inOffset);
streamOffset = inOffset;
}

@ -1,102 +0,0 @@
#pragma once
#include "common/IErrors.h"
/**
* An arbitrary data stream
*/
class IDataStream
{
public:
IDataStream();
virtual ~IDataStream();
// read
virtual UInt8 Read8(void);
virtual UInt16 Read16(void);
virtual UInt32 Read32(void);
virtual UInt64 Read64(void);
virtual float ReadFloat(void);
virtual UInt32 ReadString(char * buf, UInt32 bufLength, char altTerminator = 0, char altTerminator2 = 0);
virtual void ReadBuf(void * buf, UInt32 inLength) = 0;
// peek
virtual UInt8 Peek8(void);
virtual UInt16 Peek16(void);
virtual UInt32 Peek32(void);
virtual UInt64 Peek64(void);
virtual float PeekFloat(void);
virtual void PeekBuf(void * buf, UInt32 inLength);
virtual void Skip(SInt64 inBytes);
// write
virtual void Write8(UInt8 inData);
virtual void Write16(UInt16 inData);
virtual void Write32(UInt32 inData);
virtual void Write64(UInt64 inData);
virtual void WriteFloat(float inData);
virtual void WriteString(const char * buf);
virtual void WriteBuf(const void * buf, UInt32 inLength) = 0;
SInt64 GetLength(void);
SInt64 GetRemain(void);
SInt64 GetOffset(void);
bool HitEOF(void);
virtual void SetOffset(SInt64 inOffset);
void Rewind(void) { SetOffset(0); }
void SwapBytes(bool inSwapBytes);
virtual SInt64 GetParentOffset(void) { return GetOffset(); }
virtual IDataStream * GetParent(void) { return NULL; }
IDataStream * GetRootParent(void);
static void CopyStreams(IDataStream * out, IDataStream * in, UInt64 bufferSize = 1024 * 1024, UInt8 * buf = NULL);
static void CopySubStreams(IDataStream * out, IDataStream * in, UInt64 remain, UInt64 bufferSize = 1024 * 1024, UInt8 * buf = NULL);
protected:
SInt64 streamLength;
SInt64 streamOffset;
bool swapBytes;
};
/**
* A utility class to automatically save and restore the current position of an IDataStream
*/
class IDataStream_PositionSaver
{
public:
IDataStream_PositionSaver(IDataStream * tgt);
~IDataStream_PositionSaver();
private:
IDataStream * stream;
SInt64 offset;
};
class IDataSubStream : public IDataStream
{
public:
IDataSubStream();
IDataSubStream(IDataStream * inStream, SInt64 inOffset, SInt64 inLength);
~IDataSubStream();
void Attach(IDataStream * inStream, SInt64 inOffset, SInt64 inLength);
void ReadBuf(void * buf, UInt32 inLength);
void WriteBuf(const void * buf, UInt32 inLength);
void SetOffset(SInt64 inOffset);
virtual SInt64 GetParentOffset(void) { return stream->GetOffset(); }
virtual IDataStream * GetParent(void) { return stream; }
SInt64 GetSubBase(void) { return subBase; }
private:
IDataStream * stream;
SInt64 subBase;
};

@ -1 +0,0 @@
#include "IDatabase.h"

@ -1,116 +0,0 @@
#pragma once
#include <map>
#include "common/IDataStream.h"
#include "common/IFilestream.h"
template <class DataType>
class IDatabase
{
public:
typedef std::map <UInt64, DataType> DataMapType;
typedef typename DataMapType::iterator DataMapIterator;
static const UInt64 kGUIDMask = 0x0FFFFFFFFFFFFFFF;
IDatabase() { newKeyHint = 1; }
virtual ~IDatabase() { }
DataType * Get(UInt64 key)
{
key &= kGUIDMask;
if(!key)
return NULL;
DataMapType::iterator iter = theDataMap.find(key);
return (iter == theDataMap.end()) ? NULL : &((*iter).second);
}
DataType * Alloc(UInt64 key)
{
key &= kGUIDMask;
if(!key)
return NULL;
DataMapType::iterator iter = theDataMap.find(key);
return (iter == theDataMap.end()) ? &theDataMap[key] : NULL;
}
DataType * Alloc(UInt64 * key)
{
UInt64 newKey = newKeyHint;
do
{
if(!newKey)
newKey++;
DataMapType::iterator iter = theDataMap.find(newKey);
// is 'newKey' unused?
if(iter == theDataMap.end())
{
*key = newKey;
newKeyHint = (newKey + 1) & kGUIDMask;
return &theDataMap[newKey];
}
else
{
++iter;
if(iter == theDataMap.end())
{
newKey = 1;
}
else
{
UInt64 nextKey = (newKey + 1) & kGUIDMask;
if(iter->first != nextKey)
{
*key = nextKey;
newKeyHint = (nextKey + 1) & kGUIDMask;
return &theDataMap[nextKey];
}
}
}
}
while(1);
*key = 0;
return NULL;
}
void Delete(UInt64 key)
{
if(key)
{
key &= kGUIDMask;
theDataMap.erase(key);
newKeyHint = key;
}
}
void Save(IDataStream * stream);
void Load(IDataStream * stream);
bool SaveToFile(char * name);
bool LoadFromFile(char * name);
DataMapType & GetData(void) { return theDataMap; }
DataMapIterator Begin(void) { return theDataMap.begin(); }
DataMapIterator End(void) { return theDataMap.end(); }
UInt32 Length(void) { return theDataMap.size(); }
private:
DataMapType theDataMap;
UInt64 newKeyHint;
};
#include "common/IDatabase.inc"

BIN
source/fs.dll/common/IDatabase.inc (Stored with Git LFS)

Binary file not shown.

@ -1,324 +0,0 @@
#include "common/IDebugLog.h"
#include <share.h>
#include "common/IFileStream.h"
#include <shlobj.h>
std::FILE * IDebugLog::logFile = NULL;
char IDebugLog::sourceBuf[16] = { 0 };
char IDebugLog::headerText[16] = { 0 };
char IDebugLog::formatBuf[8192] = { 0 };
int IDebugLog::indentLevel = 0;
int IDebugLog::rightMargin = 0;
int IDebugLog::cursorPos = 0;
int IDebugLog::inBlock = 0;
bool IDebugLog::autoFlush = true;
IDebugLog::LogLevel IDebugLog::logLevel = IDebugLog::kLevel_DebugMessage;
IDebugLog::LogLevel IDebugLog::printLevel = IDebugLog::kLevel_Message;
IDebugLog::IDebugLog()
{
//
}
IDebugLog::IDebugLog(const char * name)
{
Open(name);
}
IDebugLog::~IDebugLog()
{
if(logFile)
fclose(logFile);
}
void IDebugLog::Open(const char * path)
{
logFile = _fsopen(path, "w", _SH_DENYWR);
if(!logFile)
{
UInt32 id = 0;
char name[1024];
do
{
sprintf_s(name, sizeof(name), "%s%d", path, id);
id++;
logFile = NULL;
logFile = _fsopen(name, "w", _SH_DENYWR);
}
while(!logFile && (id < 5));
}
}
void IDebugLog::OpenRelative(int folderID, const char * relPath)
{
char path[MAX_PATH];
HRESULT err = SHGetFolderPath(NULL, folderID | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, path);
if(!SUCCEEDED(err))
{
_FATALERROR("SHGetFolderPath %08X failed (result = %08X lasterr = %08X)", folderID, err, GetLastError());
}
ASSERT_CODE(SUCCEEDED(err), err);
strcat_s(path, sizeof(path), relPath);
IFileStream::MakeAllDirs(path);
Open(path);
}
/**
* Output a non-formatted message to the log file
*
* @param message the message
* @param source the source of the message, or NULL to use the previous source
*/
void IDebugLog::Message(const char * message, const char * source, bool newLine)
{
if(source)
SetSource(source);
if(inBlock)
{
SeekCursor(RoundToTab((indentLevel * 4) + strlen(headerText)));
}
else
{
SeekCursor(indentLevel * 4);
PrintText(headerText);
}
PrintText(message);
if(newLine)
NewLine();
}
/**
* Output a formatted message to the log file
*
* @note It is impossible to set the source of a formatted message.
* The previous source will be used.
*/
void IDebugLog::FormattedMessage(const char * fmt, ...)
{
va_list argList;
va_start(argList, fmt);
vsprintf_s(formatBuf, sizeof(formatBuf), fmt, argList);
Message(formatBuf);
va_end(argList);
}
/**
* Output a formatted message to the log file
*
* @note It is impossible to set the source of a formatted message.
* The previous source will be used.
*/
void IDebugLog::FormattedMessage(const char * fmt, va_list args)
{
vsprintf_s(formatBuf, sizeof(formatBuf), fmt, args);
Message(formatBuf);
}
void IDebugLog::Log(LogLevel level, const char * fmt, va_list args)
{
bool log = (level <= logLevel);
bool print = (level <= printLevel);
if(log || print)
vsprintf_s(formatBuf, sizeof(formatBuf), fmt, args);
if(log)
Message(formatBuf);
if(print)
printf("%s\n", formatBuf);
}
void IDebugLog::LogNNL(LogLevel level, const char * fmt, va_list args)
{
bool log = (level <= logLevel);
bool print = (level <= printLevel);
if(log || print)
vsprintf_s(formatBuf, sizeof(formatBuf), fmt, args);
if(log)
Message(formatBuf, NULL, false);
if(print)
printf("%s", formatBuf);
}
/**
* Set the current message source
*/
void IDebugLog::SetSource(const char * source)
{
strcpy_s(sourceBuf, sizeof(sourceBuf), source);
strcpy_s(headerText, sizeof(headerText), "[ ]\t");
char * tgt = headerText + 1;
char * src = sourceBuf;
for(int i = 0; (i < 8) && *src; i++, tgt++, src++)
*tgt = *src;
}
/**
* Clear the current message source
*/
void IDebugLog::ClearSource(void)
{
sourceBuf[0] = 0;
}
/**
* Increase the indentation level
*/
void IDebugLog::Indent(void)
{
indentLevel++;
}
/**
* Decrease the indentation level
*/
void IDebugLog::Outdent(void)
{
if(indentLevel)
indentLevel--;
}
/**
* Enter a logical block
*/
void IDebugLog::OpenBlock(void)
{
SeekCursor(indentLevel * 4);
PrintText(headerText);
inBlock = 1;
}
/**
* Close a logical block
*/
void IDebugLog::CloseBlock(void)
{
inBlock = 0;
}
/**
* Enable/disable autoflush
*
* @param inAutoFlush autoflush state
*/
void IDebugLog::SetAutoFlush(bool inAutoFlush)
{
autoFlush = inAutoFlush;
}
/**
* Print spaces to the log
*
* If possible, tabs are used instead of spaces.
*/
void IDebugLog::PrintSpaces(int numSpaces)
{
int originalNumSpaces = numSpaces;
if(logFile)
{
while(numSpaces > 0)
{
if(numSpaces >= TabSize())
{
numSpaces -= TabSize();
fputc('\t', logFile);
}
else
{
numSpaces--;
fputc(' ', logFile);
}
}
}
cursorPos += originalNumSpaces;
}
/**
* Prints raw text to the log file
*/
void IDebugLog::PrintText(const char * buf)
{
if(logFile)
{
fputs(buf, logFile);
if(autoFlush)
fflush(logFile);
}
const char * traverse = buf;
char data;
while(data = *traverse++)
{
if(data == '\t')
cursorPos += TabSize();
else
cursorPos++;
}
}
/**
* Moves to the next line of the log file
*/
void IDebugLog::NewLine(void)
{
if(logFile)
{
fputc('\n', logFile);
if(autoFlush)
fflush(logFile);
}
cursorPos = 0;
}
/**
* Prints spaces to align the cursor to the requested position
*
* @note The cursor move will not be performed if the request would move the cursor
* backwards.
*/
void IDebugLog::SeekCursor(int position)
{
if(position > cursorPos)
PrintSpaces(position - cursorPos);
}
/**
* Returns the number of spaces a tab would occupy at the current cursor position
*/
int IDebugLog::TabSize(void)
{
return ((~cursorPos) & 3) + 1;
}
/**
* Rounds a number of spaces to the nearest tab
*/
int IDebugLog::RoundToTab(int spaces)
{
return (spaces + 3) & ~3;
}

@ -1,133 +0,0 @@
#pragma once
#include <cstdarg>
/**
* A simple debug log file
*
* This class supports prefix blocks describing the source of the log event.
* It also allows logical blocks and outlining.\n
*/
class IDebugLog
{
public:
IDebugLog();
IDebugLog(const char * name);
~IDebugLog();
static void Open(const char * path);
static void OpenRelative(int folderID, const char * relPath);
static void Message(const char * message, const char * source = NULL, bool newLine = true);
static void FormattedMessage(const char * fmt, ...);
static void FormattedMessage(const char * fmt, va_list args);
enum LogLevel
{
kLevel_FatalError = 0,
kLevel_Error,
kLevel_Warning,
kLevel_Message,
kLevel_VerboseMessage,
kLevel_DebugMessage
};
static void Log(LogLevel level, const char * fmt, va_list args);
static void LogNNL(LogLevel level, const char * fmt, va_list args); // No new line
static void SetSource(const char * source);
static void ClearSource(void);
static void Indent(void);
static void Outdent(void);
static void OpenBlock(void);
static void CloseBlock(void);
static void SetAutoFlush(bool inAutoFlush);
static void SetLogLevel(LogLevel in) { logLevel = in; }
static void SetPrintLevel(LogLevel in) { printLevel = in; }
private:
static void PrintSpaces(int numSpaces);
static void PrintText(const char * buf);
static void NewLine(void);
static void SeekCursor(int position);
static int TabSize(void);
static int RoundToTab(int spaces);
static FILE * logFile; //!< the output file
static char sourceBuf[16]; //!< name of current source, used in prefix
static char headerText[16]; //!< current text to use as line prefix
static char formatBuf[8192]; //!< temp buffer used for formatted messages
static int indentLevel; //!< the current indentation level (in tabs)
static int rightMargin; //!< the column at which text should be wrapped
static int cursorPos; //!< current cursor position
static int inBlock; //!< are we in a block?
static bool autoFlush; //!< automatically flush the file after writing
static LogLevel logLevel; //!< least important log level to write
static LogLevel printLevel; //!< least important log level to print
};
extern IDebugLog gLog;
inline void _FATALERROR(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
gLog.Log(IDebugLog::kLevel_FatalError, fmt, args);
va_end(args);
}
inline void _ERROR(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
gLog.Log(IDebugLog::kLevel_Error, fmt, args);
va_end(args);
}
inline void _WARNING(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
gLog.Log(IDebugLog::kLevel_Warning, fmt, args);
va_end(args);
}
inline void _MESSAGE(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
gLog.Log(IDebugLog::kLevel_Message, fmt, args);
va_end(args);
}
inline void _VMESSAGE(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
gLog.Log(IDebugLog::kLevel_VerboseMessage, fmt, args);
va_end(args);
}
inline void _DMESSAGE(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
gLog.Log(IDebugLog::kLevel_DebugMessage, fmt, args);
va_end(args);
}

@ -1,45 +0,0 @@
#include "IDirectoryIterator.h"
#include <string>
IDirectoryIterator::IDirectoryIterator(const char * path, const char * match)
:m_searchHandle(INVALID_HANDLE_VALUE), m_done(false)
{
if(!match) match = "*";
strcpy_s(m_path, sizeof(m_path), path);
char wildcardPath[MAX_PATH];
sprintf_s(wildcardPath, sizeof(wildcardPath), "%s\\%s", path, match);
m_searchHandle = FindFirstFile(wildcardPath, &m_result);
if(m_searchHandle == INVALID_HANDLE_VALUE)
m_done = true;
}
IDirectoryIterator::~IDirectoryIterator()
{
if(m_searchHandle != INVALID_HANDLE_VALUE)
FindClose(m_searchHandle);
}
void IDirectoryIterator::GetFullPath(char * out, UInt32 outLen)
{
sprintf_s(out, outLen, "%s\\%s", m_path, m_result.cFileName);
}
std::string IDirectoryIterator::GetFullPath(void)
{
return std::string(m_path) + "\\" + std::string(m_result.cFileName);
}
void IDirectoryIterator::Next(void)
{
BOOL result = FindNextFile(m_searchHandle, &m_result);
if(!result)
m_done = true;
}
bool IDirectoryIterator::Done(void)
{
return m_done;
}

@ -1,24 +0,0 @@
#pragma once
class IDirectoryIterator
{
public:
IDirectoryIterator(const char * path, const char * match = NULL);
virtual ~IDirectoryIterator();
WIN32_FIND_DATA * Get(void) { return &m_result; }
void GetFullPath(char * out, UInt32 outLen);
std::string GetFullPath(void);
void Next(void);
bool Done(void);
private:
IDirectoryIterator(); // undefined, disallow
HANDLE m_searchHandle;
WIN32_FIND_DATA m_result;
bool m_done;
char m_path[MAX_PATH];
};

@ -1,38 +0,0 @@
#include "IDynamicCreate.h"
#if ENABLE_IDYNAMICCREATE
IClassRegistry _gClassRegistry;
IClassRegistry::IClassRegistry()
{
//
}
IClassRegistry::~IClassRegistry()
{
//
}
void IClassRegistry::RegisterClassInfo(UInt32 id, IDynamicType * typeInfo)
{
theClassRegistry[id] = typeInfo;
}
IDynamicType * IClassRegistry::LookupClassInfo(UInt32 id)
{
ClassRegistryType::iterator iter = theClassRegistry.find(id);
return (iter == theClassRegistry.end()) ? NULL : (*iter).second;
}
IDynamicType * IClassRegistry::LookupClassInfo(char * name)
{
for(ClassRegistryType::iterator iter = theClassRegistry.begin(); iter != theClassRegistry.end(); iter++)
if(!strcmp((*iter).second->GetName(), name))
return (*iter).second;
return NULL;
}
#endif

@ -1,118 +0,0 @@
#pragma once
#include <map>
#include "common/IDataStream.h"
#include "common/IErrors.h"
// this screws with edit-and-continue and we don't use it
#define ENABLE_IDYNAMICCREATE 0
#if ENABLE_IDYNAMICCREATE
//! Get a pointer to the IDynamicType for a class.
//! @note This is not a function; the parameter must be constant.
#define GetDynType(name) (&(##name##::__DYN_DynamicType))
//! Declare the members used for dynamic class creation
#define DYNAMIC_DECLARE(name) \
public: \
class __DYN_##name##_DynamicType : public IDynamicType \
{ \
public: \
__DYN_##name##_DynamicType() { } \
~__DYN_##name##_DynamicType() { } \
\
virtual IDynamic * Create(void) { return new name; } \
virtual char * GetName(void) { return #name; } \
virtual IDynamic * Instantiate(IDataStream * stream); \
}; \
\
static __DYN_##name##_DynamicType __DYN_DynamicType; \
virtual IDynamicType * __DYN_GetDynamicType(void) { return &__DYN_DynamicType; } \
\
friend __DYN_##name##_DynamicType;
//! Define the members used for dynamic class creation
#define DYNAMIC_DEFINE(name) name##::__DYN_##name##_DynamicType name##::__DYN_DynamicType;
//! Define a dynamic instantiation handler
#define DYNAMIC_INSTANTIATE_HANDLER(name) IDynamic * name##::__DYN_##name##_DynamicType::Instantiate(IDataStream * stream) { name * object = new name;
#define END_DYNAMIC_INSTANTIATE_HANDLER return object; }
//! Specifies that a dynamic class should not be instantiated automatically
#define NO_DYNAMIC_INSTANTIATE_HANDLER(name) DYNAMIC_INSTANTIATE_HANDLER(name) { HALT("attempted to instantiate " #name); } END_DYNAMIC_INSTANTIATE_HANDLER
//! Casts
#define CAST(ptr, type) _DynamicCast <type>(ptr);
class IDynamicType;
/**
* Pure virtual base class allowing dynamic creation of objects
*
* To allow dynamic creation of a class, publicly inherit IDynamic, add the
* macro DYNAMIC_DECLARE(classname) first in the class declaration, and add
* the macro DYNAMIC_DEFINE(classname) somewhere in the class definition file.
*/
class IDynamic
{
public:
IDynamic() { }
virtual ~IDynamic() { }
virtual IDynamicType * __DYN_GetDynamicType(void) = 0;
};
/**
* Pure virtual base class allowing class instantiation and information retrieval
*/
class IDynamicType
{
public:
IDynamicType() { }
virtual ~IDynamicType() { }
virtual IDynamic * Create(void) = 0;
virtual char * GetName(void) = 0;
virtual IDynamic * Instantiate(IDataStream * stream) = 0;
};
//!
template <typename T>
T * _DynamicCast(IDynamic * ptr)
{
if(ptr && (&T::__DYN_DynamicType == ptr->__DYN_GetDynamicType()))
return static_cast<T *>(ptr);
return NULL;
}
/**
* Registry of dynamic classes
*/
class IClassRegistry
{
public:
IClassRegistry();
~IClassRegistry();
static void RegisterClassInfo(UInt32 id, IDynamicType * typeInfo);
static IDynamicType * LookupClassInfo(UInt32 id);
static IDynamicType * LookupClassInfo(char * name);
static IDynamic * Create(UInt32 id) { IDynamicType * info = LookupClassInfo(id); return info ? info->Create() : NULL; }
static IDynamic * Create(char * name) { IDynamicType * info = LookupClassInfo(name); return info ? info->Create() : NULL; }
static IDynamic * Instantiate(UInt32 id, IDataStream * stream) { IDynamicType * info = LookupClassInfo(id); return info ? info->Instantiate(stream) : NULL; }
static IDynamic * Instantiate(char * name, IDataStream * stream) { IDynamicType * info = LookupClassInfo(name); return info ? info->Instantiate(stream) : NULL; }
static char * GetName(UInt32 id) { IDynamicType * info = LookupClassInfo(id); return info ? info->GetName() : NULL; }
private:
typedef std::map <UInt32, IDynamicType *> ClassRegistryType;
static ClassRegistryType theClassRegistry;
};
#endif

@ -1,59 +0,0 @@
#include "common/IErrors.h"
#include "common/IDebugLog.h"
#include <cstdlib>
__declspec(noreturn) static void IErrors_Halt(void)
{
// crash
*((int *)0) = 0xDEADBEEF;
}
/**
* Report a failed assertion and exit the program
*
* @param file the file where the error occured
* @param line the line number where the error occured
* @param desc an error message
*/
void _AssertionFailed(const char * file, unsigned long line, const char * desc)
{
_FATALERROR("Assertion failed in %s (%d): %s", file, line, desc);
IErrors_Halt();
}
/**
* Report a failed assertion and exit the program
*
* @param file the file where the error occured
* @param line the line number where the error occured
* @param desc an error message
* @param code the error code
*/
void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, unsigned long long code)
{
if(code & 0xFFFFFFFF00000000)
_FATALERROR("Assertion failed in %s (%d): %s (code = %16I64X (%I64d))", file, line, desc, code, code);
else
{
UInt32 code32 = code;
_FATALERROR("Assertion failed in %s (%d): %s (code = %08X (%d))", file, line, desc, code32, code32);
}
IErrors_Halt();
}
/**
* Report a failed assertion and exit the program
*
* @param file the file where the error occured
* @param line the line number where the error occured
* @param desc an error message
* @param code the error code
*/
void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, const char * code)
{
_FATALERROR("Assertion failed in %s (%d): %s (code = %s)", file, line, desc, code);
IErrors_Halt();
}

@ -1,32 +0,0 @@
#pragma once
void _AssertionFailed(const char * file, unsigned long line, const char * desc);
void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, unsigned long long code);
void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, const char * code);
//! Exit the program if the condition is not true
#define ASSERT(a) do { if(!(a)) _AssertionFailed(__FILE__, __LINE__, #a); } while(0)
//! Exit the program if the condition is not true, with an error message
#define ASSERT_STR(a, b) do { if(!(a)) _AssertionFailed(__FILE__, __LINE__, b); } while(0)
//! Exit the program if the condition is not true, reporting an error code
#define ASSERT_CODE(a, b) do { if(!(a)) _AssertionFailed_ErrCode(__FILE__, __LINE__, #a, b); } while(0)
//! Exit the program if the condition is not true, reporting an error code and message
#define ASSERT_STR_CODE(a, b, c) do { if(!(a)) _AssertionFailed_ErrCode(__FILE__, __LINE__, b, c); } while(0)
//! Exit the program with an error message
#define HALT(a) do { _AssertionFailed(__FILE__, __LINE__, a); } while(0)
//! Exit the program with and error code and message
#define HALT_CODE(a, b) do { _AssertionFailed_ErrCode(__FILE__, __LINE__, a, b); } while(0)
// based on the boost implementation of static asserts
template <bool x> struct StaticAssertFailure;
template <> struct StaticAssertFailure <true> { enum { a = 1 }; };
template <int x> struct static_assert_test { };
#define __MACRO_JOIN__(a, b) __MACRO_JOIN_2__(a, b)
#define __MACRO_JOIN_2__(a, b) __MACRO_JOIN_3__(a, b)
#define __MACRO_JOIN_3__(a, b) a##b
#define __PREPRO_TOKEN_STR2__(a) #a
#define __PREPRO_TOKEN_STR__(a) __PREPRO_TOKEN_STR2__(a)
#define __LOC__ __FILE__ "("__PREPRO_TOKEN_STR__(__LINE__)") : "
#define STATIC_ASSERT(a) typedef static_assert_test <sizeof(StaticAssertFailure<(bool)(a)>)> __MACRO_JOIN__(static_assert_typedef_, __COUNTER__)

@ -1,48 +0,0 @@
#include "IEvent.h"
IEvent::IEvent()
{
theEvent = CreateEvent(NULL, true, true, NULL);
ASSERT(theEvent);
blockCount.Set(0);
}
IEvent::~IEvent()
{
CloseHandle(theEvent);
}
bool IEvent::Block(void)
{
if(blockCount.Increment() == 1)
return (ResetEvent(theEvent) != 0);
else
return true;
}
bool IEvent::UnBlock(void)
{
if(blockCount.Decrement() == 0)
return (SetEvent(theEvent) != 0);
else
return true;
}
bool IEvent::Wait(UInt32 timeout)
{
switch(WaitForSingleObject(theEvent, timeout))
{
case WAIT_ABANDONED:
HALT("IEvent::Wait: got abandoned event");
return false;
case WAIT_OBJECT_0:
return true;
default:
case WAIT_TIMEOUT:
gLog.FormattedMessage("IEvent::Wait: timeout");
return false;
}
}

@ -1,22 +0,0 @@
#pragma once
#include "common/IInterlockedLong.h"
class IEvent
{
public:
static const UInt32 kDefaultTimeout = 1000 * 10;
IEvent();
~IEvent();
bool Block(void);
bool UnBlock(void);
bool Wait(UInt32 timeout = kDefaultTimeout);
bool IsBlocked(void) { return blockCount.Get() > 0; }
private:
HANDLE theEvent;
IInterlockedLong blockCount;
};

@ -1,85 +0,0 @@
#include "IFIFO.h"
IFIFO::IFIFO(UInt32 length)
{
fifoBuf = new UInt8[length];
fifoBufSize = length;
fifoBase = 0;
fifoDataLength = 0;
}
IFIFO::~IFIFO()
{
delete fifoBuf;
}
bool IFIFO::Push(UInt8 * buf, UInt32 length)
{
// would that overflow the buffer?
if(length > GetBufferRemain())
return false;
UInt32 writeOffset = GetWriteOffset();
// will this cross the end of the buffer?
if(writeOffset + length > fifoBufSize)
{
UInt32 segmentLength = fifoBufSize - writeOffset;
std::memcpy(&fifoBuf[writeOffset], buf, segmentLength);
std::memcpy(fifoBuf, &buf[segmentLength], length - segmentLength);
}
else
{
std::memcpy(&fifoBuf[writeOffset], buf, length);
}
// update pointers
fifoDataLength += length;
return true;
}
bool IFIFO::Pop(UInt8 * buf, UInt32 length)
{
bool result = Peek(buf, length);
// update pointers if we were successful
if(result)
{
fifoDataLength -= length;
fifoBase = ToRawOffset(fifoBase + length);
}
return result;
}
bool IFIFO::Peek(UInt8 * buf, UInt32 length)
{
// would that underflow the buffer?
if(length > fifoDataLength)
return false;
// will this cross the end of the buffer?
if(fifoBase + length > fifoBufSize)
{
UInt32 segmentLength = fifoBufSize - fifoBase;
std::memcpy(buf, &fifoBuf[fifoBase], segmentLength);
std::memcpy(&buf[segmentLength], fifoBuf, length - segmentLength);
}
else
{
std::memcpy(buf, &fifoBuf[fifoBase], length);
}
return true;
}
void IFIFO::Clear(void)
{
fifoDataLength = 0;
// this isn't needed, but staying away from the buffer end is always good
fifoBase = 0;
}

@ -1,27 +0,0 @@
#pragma once
class IFIFO
{
public:
IFIFO(UInt32 length = 0);
virtual ~IFIFO();
virtual bool Push(UInt8 * buf, UInt32 length);
virtual bool Pop(UInt8 * buf, UInt32 length);
virtual bool Peek(UInt8 * buf, UInt32 length);
virtual void Clear(void);
UInt32 GetBufferSize(void) { return fifoBufSize; }
UInt32 GetBufferRemain(void) { return fifoBufSize - fifoDataLength; }
UInt32 GetDataLength(void) { return fifoDataLength; }
private:
UInt32 ToRawOffset(UInt32 in) { return in % fifoBufSize; }
UInt32 ToDataOffset(UInt32 in) { return ToRawOffset(fifoBase + in); }
UInt32 GetWriteOffset(void) { return ToDataOffset(fifoDataLength); }
UInt8 * fifoBuf;
UInt32 fifoBufSize; // size of the buffer (in bytes)
UInt32 fifoBase; // pointer to the beginning of the data block
UInt32 fifoDataLength; // size of the data block
};

@ -1,240 +0,0 @@
#include "IFileStream.h"
#include "IDebugLog.h"
#include "IErrors.h"
#include <direct.h>
IFileStream::IFileStream()
:theFile(INVALID_HANDLE_VALUE)
{
}
IFileStream::IFileStream(const char * name)
:theFile(INVALID_HANDLE_VALUE)
{
Open(name);
}
IFileStream::~IFileStream()
{
Close();
}
/**
* Opens a file for reading and attaches it to the stream
*/
bool IFileStream::Open(const char * name)
{
Close();
theFile = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(theFile != INVALID_HANDLE_VALUE)
{
LARGE_INTEGER temp;
GetFileSizeEx(theFile, &temp);
streamLength = temp.QuadPart;
streamOffset = 0;
}
return theFile != INVALID_HANDLE_VALUE;
}
static UINT_PTR CALLBACK BrowseEventProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam)
{
return 0;
}
bool IFileStream::BrowseOpen(void)
{
bool result = false;
OPENFILENAME info;
char path[4096];
path[0] = 0;
info.lStructSize = sizeof(info);
info.hwndOwner = NULL;
info.hInstance = NULL;
info.lpstrFilter = NULL;
info.lpstrCustomFilter = NULL;
info.nMaxCustFilter = 0;
info.nFilterIndex = 0;
info.lpstrFile = path;
info.nMaxFile = sizeof(path);
info.lpstrFileTitle = NULL;
info.nMaxFileTitle = 0;
info.lpstrInitialDir = NULL;
info.lpstrTitle = NULL;
info.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_ENABLEHOOK | OFN_NOCHANGEDIR;
info.lpstrDefExt = NULL;
info.lCustData = NULL;
info.lpfnHook = BrowseEventProc;
info.lpTemplateName = NULL;
// info.pvReserved = NULL;
// info.dwReserved = NULL;
// info.FlagsEx = 0;
if(GetOpenFileName(&info))
{
result = Open(path);
}
return result;
}
/**
* Creates a new file for writing, overwriting any previously-existing files,
* and attaches it to the stream
*/
bool IFileStream::Create(const char * name)
{
Close();
theFile = CreateFile(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(theFile != INVALID_HANDLE_VALUE)
{
streamLength = 0;
streamOffset = 0;
}
return theFile != INVALID_HANDLE_VALUE;
}
bool IFileStream::BrowseCreate(const char * defaultName, const char * defaultPath, const char * title)
{
bool result = false;
OPENFILENAME info;
char path[4096];
if(defaultName)
strcpy_s(path, sizeof(path), defaultName);
info.lStructSize = sizeof(info);
info.hwndOwner = NULL;
info.hInstance = NULL;
info.lpstrFilter = NULL;
info.lpstrCustomFilter = NULL;
info.nMaxCustFilter = 0;
info.nFilterIndex = 0;
info.lpstrFile = path;
info.nMaxFile = sizeof(path);
info.lpstrFileTitle = NULL;
info.nMaxFileTitle = 0;
info.lpstrInitialDir = defaultPath;
info.lpstrTitle = title;
info.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_ENABLEHOOK |
OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
info.lpstrDefExt = NULL;
info.lCustData = NULL;
info.lpfnHook = BrowseEventProc;
info.lpTemplateName = NULL;
// info.pvReserved = NULL;
// info.dwReserved = NULL;
// info.FlagsEx = 0;
if(GetSaveFileName(&info))
{
result = Create(path);
}
return result;
}
/**
* Closes the current file
*/
void IFileStream::Close(void)
{
if(theFile)
{
CloseHandle(theFile);
theFile = INVALID_HANDLE_VALUE;
}
}
void IFileStream::ReadBuf(void * buf, UInt32 inLength)
{
UInt32 bytesRead;
ReadFile(theFile, buf, inLength, &bytesRead, NULL);
streamOffset += bytesRead;
}
void IFileStream::WriteBuf(const void * buf, UInt32 inLength)
{
UInt32 bytesWritten;
// check for file expansion
if(streamOffset > streamLength)
SetEndOfFile(theFile);
WriteFile(theFile, buf, inLength, &bytesWritten, NULL);
streamOffset += bytesWritten;
if(streamLength < streamOffset)
streamLength = streamOffset;
}
void IFileStream::SetOffset(SInt64 inOffset)
{
LARGE_INTEGER temp;
temp.QuadPart = inOffset;
SetFilePointerEx(theFile, temp, NULL, FILE_BEGIN);
streamOffset = inOffset;
}
void IFileStream::SetLength(UInt64 length)
{
SetOffset(length);
SetEndOfFile(theFile);
streamLength = length;
}
// ### TODO: get rid of buf
void IFileStream::MakeAllDirs(const char * path)
{
char buf[1024];
char * traverse = buf;
while(1)
{
char data = *path++;
if(!data)
break;
if((data == '\\') || (data == '/'))
{
*traverse = 0;
_mkdir(buf);
}
*traverse++ = data;
}
}
char * IFileStream::ExtractFileName(char * path)
{
char * traverse = path;
char * lastSlash = NULL;
while(1)
{
char data = *traverse++;
if((data == '\\') || (data == '/'))
lastSlash = traverse;
if(!data)
break;
}
return lastSlash;
}

@ -1,37 +0,0 @@
#pragma once
#include "common/IDataStream.h"
/**
* An input file stream
*/
class IFileStream : public IDataStream
{
public:
IFileStream();
IFileStream(const char * name);
~IFileStream();
bool Open(const char * name);
bool BrowseOpen(void);
bool Create(const char * name);
bool BrowseCreate(const char * defaultName = NULL, const char * defaultPath = NULL, const char * title = NULL);
void Close(void);
HANDLE GetHandle(void) { return theFile; }
virtual void ReadBuf(void * buf, UInt32 inLength);
virtual void WriteBuf(const void * buf, UInt32 inLength);
virtual void SetOffset(SInt64 inOffset);
// can truncate. implicitly seeks to the end of the file
void SetLength(UInt64 length);
static void MakeAllDirs(const char * path);
static char * ExtractFileName(char * path);
protected:
HANDLE theFile;
};

@ -1,3 +0,0 @@
#include "IInterlockedLong.h"
// all functions are inlined

@ -1,19 +0,0 @@
#pragma once
struct IInterlockedLong
{
public:
long Increment(void) { return InterlockedIncrement(&value); }
long Decrement(void) { return InterlockedDecrement(&value); }
long Get(void) { return value; }
long Set(long in) { return InterlockedExchange(&value, in); }
long TrySetIf(long newValue, long expectedOldValue)
{ return InterlockedCompareExchange(&value, newValue, expectedOldValue); }
// interlock variable semantics
bool Claim(void) { return TrySetIf(1, 0) == 0; }
bool Release(void) { return TrySetIf(0, 1) == 1; }
private:
volatile long value;
};

@ -1,91 +0,0 @@
#pragma once
// ILink members must be public
template <typename T>
struct ILink
{
static const UInt32 s_offset;
ILink <T> * next;
ILink <T> * prev;
T * GetObj(void) { return (T *)(((uintptr_t)this) - s_offset); }
static ILink <T> * GetLink(T * obj) { return (ILink <T> *)(((uintptr_t)obj) + s_offset); }
void Unlink(void)
{
if(next) next->prev = prev;
if(prev) prev->next = next;
next = prev = NULL;
}
void LinkBefore(T * obj)
{
LinkBefore(GetLink(obj));
}
void LinkAfter(T * obj)
{
LinkAfter(GetLink(obj));
}
void LinkBefore(ILink <T> * link)
{
link->next = this;
link->prev = prev;
if(prev)
{
prev->next = link;
}
prev = link;
}
void LinkAfter(ILink <T> * link)
{
link->next = next;
link->prev = this;
if(next)
{
next->prev = link;
}
next = link;
}
};
template <typename T>
struct ILinkedList
{
ILink <T> begin;
ILink <T> end;
void Reset(void)
{
begin.next = &end;
begin.prev = NULL;
end.next = NULL;
end.prev = &begin;
}
void PushFront(T * obj)
{
ILink <T> * objLink = ILink <T>::GetLink(obj);
objLink->next = begin.next;
objLink->prev = &begin;
if(objLink->next)
{
objLink->next->prev = objLink;
}
begin.next = objLink;
}
};
#define ILINK_INIT(baseType, memberName) template <typename T> const UInt32 ILink <T>::s_offset = offsetof(baseType, memberName)

@ -1,43 +0,0 @@
#include "IMemPool.h"
void Test_IMemPool(void)
{
IMemPool <UInt32, 3> pool;
_DMESSAGE("main: pool test");
gLog.Indent();
_DMESSAGE("start");
pool.Dump();
UInt32 * data0, * data1, * data2;
data0 = pool.Allocate();
_DMESSAGE("alloc0 = %08X", data0);
pool.Dump();
data1 = pool.Allocate();
_DMESSAGE("alloc1 = %08X", data1);
pool.Dump();
data2 = pool.Allocate();
_DMESSAGE("alloc2 = %08X", data2);
pool.Dump();
_DMESSAGE("free0 %08X", data0);
pool.Free(data0);
pool.Dump();
data0 = pool.Allocate();
_DMESSAGE("alloc0 = %08X", data0);
pool.Dump();
_DMESSAGE("free2 %08X", data2);
pool.Free(data2);
pool.Dump();
_DMESSAGE("done");
pool.Dump();
gLog.Outdent();
}

@ -1,312 +0,0 @@
#pragma once
#include "common/ICriticalSection.h"
template <typename T, UInt32 size>
class IMemPool
{
public:
IMemPool()
:m_free(NULL), m_alloc(NULL)
{
Reset();
}
~IMemPool() { Clear(); }
void Reset(void)
{
for(UInt32 i = 0; i < size - 1; i++)
{
m_items[i].next = &m_items[i + 1];
}
m_items[size - 1].next = NULL;
m_free = m_items;
m_alloc = NULL;
}
T * Allocate(void)
{
if(m_free)
{
PoolItem * item = m_free;
m_free = m_free->next;
item->next = m_alloc;
m_alloc = item;
T * obj = item->GetObj();
new (obj) T;
return obj;
}
return NULL;
}
void Free(T * obj)
{
PoolItem * item = reinterpret_cast <PoolItem *>(obj);
if(item == m_alloc)
{
m_alloc = item->next;
}
else
{
PoolItem * traverse = m_alloc;
while(traverse->next != item)
traverse = traverse->next;
traverse->next = traverse->next->next;
}
item->next = m_free;
m_free = item;
obj->~T();
}
UInt32 GetSize(void) { return size; }
T * Begin(void)
{
T * result = NULL;
if(m_alloc)
result = m_alloc->GetObj();
return result;
}
T * Next(T * obj)
{
PoolItem * item = reinterpret_cast <PoolItem *>(obj);
PoolItem * next = item->next;
T * result = NULL;
if(next)
result = next->GetObj();
return result;
}
void Dump(void)
{
gLog.Indent();
_DMESSAGE("free:");
gLog.Indent();
for(PoolItem * traverse = m_free; traverse; traverse = traverse->next)
_DMESSAGE("%08X", traverse);
gLog.Outdent();
_DMESSAGE("alloc:");
gLog.Indent();
for(PoolItem * traverse = m_alloc; traverse; traverse = traverse->next)
_DMESSAGE("%08X", traverse);
gLog.Outdent();
gLog.Outdent();
}
bool Full(void)
{
return m_free == NULL;
}
bool Empty(void)
{
return m_alloc == NULL;
}
void Clear(void)
{
while(m_alloc)
Free(m_alloc->GetObj());
}
private:
struct PoolItem
{
UInt8 obj[sizeof(T)];
PoolItem * next;
T * GetObj(void) { return reinterpret_cast <T *>(obj); }
};
PoolItem m_items[size];
PoolItem * m_free;
PoolItem * m_alloc;
};
template <typename T, UInt32 size>
class IBasicMemPool
{
public:
IBasicMemPool()
:m_free(NULL)
{
Reset();
}
~IBasicMemPool() { }
void Reset(void)
{
for(UInt32 i = 0; i < size - 1; i++)
{
m_items[i].next = &m_items[i + 1];
}
m_items[size - 1].next = NULL;
m_free = m_items;
}
T * Allocate(void)
{
if(m_free)
{
PoolItem * item = m_free;
m_free = m_free->next;
T * obj = item->GetObj();
new (obj) T;
return obj;
}
return NULL;
}
void Free(T * obj)
{
obj->~T();
PoolItem * item = reinterpret_cast <PoolItem *>(obj);
item->next = m_free;
m_free = item;
}
UInt32 GetSize(void) { return size; }
bool Full(void)
{
return m_free == NULL;
}
UInt32 GetIdx(T * obj)
{
PoolItem * item = reinterpret_cast <PoolItem *>(obj);
return item - m_items;
}
T * GetByID(UInt32 id)
{
return m_items[id].GetObj();
}
private:
union PoolItem
{
UInt8 obj[sizeof(T)];
PoolItem * next;
T * GetObj(void) { return reinterpret_cast <T *>(obj); }
};
PoolItem m_items[size];
PoolItem * m_free;
};
template <typename T, UInt32 size>
class IThreadSafeBasicMemPool
{
public:
IThreadSafeBasicMemPool()
:m_free(NULL)
{
Reset();
}
~IThreadSafeBasicMemPool() { }
void Reset(void)
{
m_mutex.Enter();
for(UInt32 i = 0; i < size - 1; i++)
{
m_items[i].next = &m_items[i + 1];
}
m_items[size - 1].next = NULL;
m_free = m_items;
m_mutex.Leave();
}
T * Allocate(void)
{
T * result = NULL;
m_mutex.Enter();
if(m_free)
{
PoolItem * item = m_free;
m_free = m_free->next;
m_mutex.Leave();
result = item->GetObj();
new (result) T;
}
else
{
m_mutex.Leave();
}
return result;
}
void Free(T * obj)
{
obj->~T();
PoolItem * item = reinterpret_cast <PoolItem *>(obj);
m_mutex.Enter();
item->next = m_free;
m_free = item;
m_mutex.Leave();
}
UInt32 GetSize(void) { return size; }
bool Full(void)
{
return m_free == NULL;
}
private:
union PoolItem
{
UInt8 obj[sizeof(T)];
PoolItem * next;
T * GetObj(void) { return reinterpret_cast <T *>(obj); }
};
PoolItem m_items[size];
PoolItem * m_free;
ICriticalSection m_mutex;
};
void Test_IMemPool(void);

@ -1,34 +0,0 @@
#include "IMutex.h"
IMutex::IMutex()
{
theMutex = CreateMutex(NULL, true, NULL);
}
IMutex::~IMutex()
{
CloseHandle(theMutex);
}
bool IMutex::Wait(UInt32 timeout)
{
switch(WaitForSingleObject(theMutex, timeout))
{
case WAIT_ABANDONED:
HALT("IMutex::Wait: got abandoned mutex");
return false;
case WAIT_OBJECT_0:
return true;
default:
case WAIT_TIMEOUT:
gLog.FormattedMessage("IMutex::Wait: timeout");
return false;
}
}
void IMutex::Release(void)
{
ASSERT_STR(ReleaseMutex(theMutex), "IMutex::Release: failed to release mutex");
}

@ -1,16 +0,0 @@
#pragma once
class IMutex
{
public:
static const UInt32 kDefaultTimeout = 1000 * 10;
IMutex();
~IMutex();
bool Wait(UInt32 timeout = kDefaultTimeout);
void Release(void);
private:
HANDLE theMutex;
};

@ -1,60 +0,0 @@
#include "IPipeClient.h"
IPipeClient::IPipeClient()
:m_pipe(INVALID_HANDLE_VALUE)
{
//
}
IPipeClient::~IPipeClient()
{
Close();
}
bool IPipeClient::Open(const char * name)
{
Close();
m_pipe = CreateFile(
name,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
return m_pipe != INVALID_HANDLE_VALUE;
}
void IPipeClient::Close(void)
{
if(m_pipe != INVALID_HANDLE_VALUE)
{
CloseHandle(m_pipe);
m_pipe = INVALID_HANDLE_VALUE;
}
}
bool IPipeClient::ReadMessage(UInt8 * buf, UInt32 length)
{
UInt32 bytesRead;
ReadFile(m_pipe, buf, length, &bytesRead, NULL);
IPipeServer::MessageHeader * header = (IPipeServer::MessageHeader *)buf;
return
(bytesRead >= sizeof(IPipeServer::MessageHeader)) && // has a valid header
(bytesRead >= (sizeof(IPipeServer::MessageHeader) + header->length));
}
bool IPipeClient::WriteMessage(IPipeServer::MessageHeader * msg)
{
UInt32 bytesWritten;
UInt32 length = sizeof(IPipeServer::MessageHeader) + msg->length;
WriteFile(m_pipe, msg, length, &bytesWritten, NULL);
return bytesWritten >= length;
}

@ -1,20 +0,0 @@
#pragma once
#include "common/IPipeServer.h"
class IPipeClient
{
public:
IPipeClient();
virtual ~IPipeClient();
bool Open(const char * name);
void Close(void);
bool ReadMessage(UInt8 * buf, UInt32 length);
bool WriteMessage(IPipeServer::MessageHeader * msg);
private:
HANDLE m_pipe;
std::string m_name;
};

@ -1,74 +0,0 @@
#include "IPipeServer.h"
IPipeServer::IPipeServer()
:m_pipe(INVALID_HANDLE_VALUE)
{
//
}
IPipeServer::~IPipeServer()
{
Close();
}
bool IPipeServer::Open(const char * name)
{
Close();
m_pipe = CreateNamedPipe(
name,
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_TYPE_MESSAGE | PIPE_TYPE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
8192, 8192,
10 * 1000, // 10 seconds
NULL);
return m_pipe != INVALID_HANDLE_VALUE;
}
void IPipeServer::Close(void)
{
if(m_pipe != INVALID_HANDLE_VALUE)
{
CloseHandle(m_pipe);
m_pipe = INVALID_HANDLE_VALUE;
}
}
bool IPipeServer::WaitForClient(void)
{
bool result = ConnectNamedPipe(m_pipe, NULL) != 0;
// already connected?
if(!result)
{
if(GetLastError() == ERROR_PIPE_CONNECTED)
result = true;
}
return result;
}
bool IPipeServer::ReadMessage(UInt8 * buf, UInt32 length)
{
UInt32 bytesRead;
ReadFile(m_pipe, buf, length, &bytesRead, NULL);
MessageHeader * header = (MessageHeader *)buf;
return
(bytesRead >= sizeof(MessageHeader)) && // has a valid header
(bytesRead >= (sizeof(MessageHeader) + header->length));
}
bool IPipeServer::WriteMessage(MessageHeader * msg)
{
UInt32 bytesWritten;
UInt32 length = sizeof(MessageHeader) + msg->length;
WriteFile(m_pipe, msg, length, &bytesWritten, NULL);
return bytesWritten >= length;
}

@ -1,25 +0,0 @@
#pragma once
class IPipeServer
{
public:
struct MessageHeader
{
UInt32 type;
UInt32 length;
};
IPipeServer();
virtual ~IPipeServer();
bool Open(const char * name);
void Close(void);
bool WaitForClient(void);
bool ReadMessage(UInt8 * buf, UInt32 length);
bool WriteMessage(MessageHeader * msg);
private:
HANDLE m_pipe;
};

@ -1 +0,0 @@
#include "IPrefix.h"

@ -1,23 +0,0 @@
#pragma once
// 4018 - signed/unsigned mismatch
// 4200 - zero-sized array
// 4244 - loss of data by assignment
// 4267 - possible loss of data (truncation)
// 4305 - truncation by assignment
// 4288 - disable warning for crap microsoft extension screwing up the scope of variables defined in for loops
// 4311 - pointer truncation
// 4312 - pointer extension
#pragma warning(disable: 4018 4200 4244 4267 4305 4288 4312 4311)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include "common/ITypes.h"
#include "common/IErrors.h"
#include "common/IDynamicCreate.h"
#include "common/IDebugLog.h"
#include "common/ISingleton.h"
#include <winsock2.h>
#include <Windows.h>

@ -1 +0,0 @@
#include "IRangeMap.h"

@ -1,215 +0,0 @@
#pragma once
#include <map>
// t_key must be a numeric type
// ### you can't create a range taking up the entire range of t_key
// ### (could be done by switching from start/length -> start/end)
template <typename t_key, typename t_data>
class IRangeMap
{
public:
struct Entry
{
bool Contains(t_key addr, t_key base)
{
return (addr >= base) && (addr <= (base + length - 1));
}
t_key length;
t_data data;
};
typedef std::map <t_key, Entry> EntryMapType;
typedef typename EntryMapType::iterator Iterator;
IRangeMap()
{
//
}
virtual ~IRangeMap()
{
//
}
void Clear(void)
{
m_entries.clear();
}
t_data * Add(t_key start, t_key length)
{
t_data * result = NULL;
Entry * entry = NULL;
t_key end = start + length - 1;
if(end >= start) // check for overflow ### should also check for overflow on length - 1, but that's pedantic
{
// special-case empty lists
if(m_entries.empty())
{
entry = &m_entries[start];
}
else
{
// collision check
EntryMapType::iterator iter = m_entries.lower_bound(start);
// iter contains the first entry at or after start (or null)
if(iter == m_entries.begin())
{
// there can't be anything before this entry
// so we only need to check if it's colliding with us
if(iter->first > end)
{
// can't provide a hint because we're inserting at the top
entry = &m_entries[start];
}
}
else
{
// see if this entry doesn't collide
// can be null (null entries don't collide)
if((iter == m_entries.end()) || (iter->first > end))
{
// we didn't get the first entry in the map
// and there is at least one entry in the map
// therefore there's an entry before iter
EntryMapType::iterator preIter = iter;
preIter--;
// check if this collides
// guaranteed to be the first entry before start
t_key preEnd = preIter->first + preIter->second.length - 1;
if(preEnd < start)
{
// cool, everything's fine, allocate it
EntryMapType::iterator newEntry = m_entries.insert(preIter, EntryMapType::value_type(start, Entry()));
entry = &newEntry->second;
}
}
}
}
}
// set up the entry
if(entry)
{
entry->length = length;
result = &entry->data;
}
return result;
}
t_data * Lookup(t_key addr, t_key * base = NULL, t_key * length = NULL)
{
t_data * result = NULL;
EntryMapType::iterator iter = LookupIter(addr);
if(iter != m_entries.end())
{
if(base) *base = iter->first;
if(length) *length = iter->second.length;
result = &iter->second.data;
}
return result;
}
bool Erase(t_key addr, t_key * base = NULL, t_key * length = NULL)
{
bool result = false;
EntryMapType::iterator iter = LookupIter(addr);
if(iter != m_entries.end())
{
if(base) *base = iter->first;
if(length) *length = iter->second.length;
m_entries.erase(iter);
result = true;
}
return result;
}
t_key GetDataRangeLength(t_data * data)
{
Entry * entry = reinterpret_cast <Entry *>(reinterpret_cast <UInt8 *>(data) - offsetof(Entry, data));
return entry->length;
}
typename EntryMapType::iterator LookupIter(t_key addr)
{
EntryMapType::iterator result = m_entries.end();
if(!m_entries.empty())
{
// we need to find the last entry less than or equal to addr
// find the first entry not less than addr
EntryMapType::iterator iter = m_entries.lower_bound(addr);
// iter is either equal to addr, greater than addr, or the end
if(iter == m_entries.end())
{
// iter is the end
// can only be in the entry before this
// which does exist because map isn't empty
--iter;
if(iter->second.Contains(addr, iter->first))
{
result = iter;
}
}
// at this point iter must be valid
else if(iter->first > addr)
{
// iter is greater than addr
// can only be in the entry before this
// but there may not be an entry before this
if(iter != m_entries.begin())
{
--iter;
if(iter->second.Contains(addr, iter->first))
{
result = iter;
}
}
}
else
{
// iter is equal to addr and matches
result = iter;
}
}
return result;
}
typename EntryMapType::iterator Begin(void)
{
return m_entries.begin();
}
typename EntryMapType::iterator End(void)
{
return m_entries.end();
}
private:
EntryMapType m_entries;
};

@ -1,43 +0,0 @@
#include "IReadWriteLock.h"
IReadWriteLock::IReadWriteLock()
{
readCount.Set(0);
readBlocker.UnBlock();
writeBlocker.UnBlock();
}
IReadWriteLock::~IReadWriteLock()
{
//
}
void IReadWriteLock::StartRead(void)
{
enterBlocker.Enter();
readBlocker.Wait();
if(readCount.Increment() == 1)
writeBlocker.Block();
enterBlocker.Leave();
}
void IReadWriteLock::EndRead(void)
{
if(!readCount.Decrement())
writeBlocker.UnBlock();
}
void IReadWriteLock::StartWrite(void)
{
writeMutex.Enter();
enterBlocker.Enter();
readBlocker.Block();
writeBlocker.Wait();
enterBlocker.Leave();
}
void IReadWriteLock::EndWrite(void)
{
readBlocker.UnBlock();
writeMutex.Leave();
}

@ -1,24 +0,0 @@
#pragma once
#include "common/ICriticalSection.h"
#include "common/IEvent.h"
#include "common/IInterlockedLong.h"
class IReadWriteLock
{
public:
IReadWriteLock();
~IReadWriteLock();
void StartRead(void);
void EndRead(void);
void StartWrite(void);
void EndWrite(void);
private:
IEvent readBlocker;
IEvent writeBlocker;
ICriticalSection enterBlocker;
ICriticalSection writeMutex;
IInterlockedLong readCount;
};

@ -1,76 +0,0 @@
#include "common/ISegmentStream.h"
ISegmentStream::ISegmentStream()
{
streamLength = 0;
}
ISegmentStream::~ISegmentStream()
{
}
void ISegmentStream::AttachStream(IDataStream * inStream)
{
parent = inStream;
streamLength = 0;
streamOffset = 0;
}
void ISegmentStream::AddSegment(UInt64 offset, UInt64 length, UInt64 parentOffset)
{
segmentInfo.push_back(SegmentInfo(offset, length, parentOffset));
if(streamLength < (parentOffset + length))
streamLength = parentOffset + length;
}
void ISegmentStream::ReadBuf(void * buf, UInt32 inLength)
{
UInt32 remain = inLength;
UInt8 * out = (UInt8 *)buf;
while(remain > 0)
{
SegmentInfo * info = LookupInfo(streamOffset);
ASSERT(info);
UInt64 segmentOffset = streamOffset - info->offset;
UInt64 transferLength = info->length - segmentOffset;
if(transferLength > remain)
transferLength = remain;
parent->SetOffset(info->parentOffset + segmentOffset);
parent->ReadBuf(out, transferLength);
streamOffset += transferLength;
remain -= transferLength;
}
}
void ISegmentStream::WriteBuf(const void * buf, UInt32 inLength)
{
HALT("ISegmentStream::WriteBuf: writing unsupported");
}
void ISegmentStream::SetOffset(SInt64 inOffset)
{
SegmentInfo * info = LookupInfo(inOffset);
ASSERT(info);
UInt64 segmentOffset = inOffset - info->offset;
parent->SetOffset(info->parentOffset + segmentOffset);
streamOffset = inOffset;
}
ISegmentStream::SegmentInfo * ISegmentStream::LookupInfo(UInt64 offset)
{
for(SegmentInfoListType::iterator iter = segmentInfo.begin(); iter != segmentInfo.end(); iter++)
if((offset >= (*iter).offset) && (offset < (*iter).offset + (*iter).length))
return &(*iter);
return NULL;
}

@ -1,44 +0,0 @@
#pragma once
#include "common/IDataStream.h"
#include <vector>
/**
* An stream composed of many non-contiguous segments of a larger stream
*/
class ISegmentStream : public IDataStream
{
public:
ISegmentStream();
~ISegmentStream();
void AttachStream(IDataStream * inStream);
void AddSegment(UInt64 offset, UInt64 length, UInt64 parentOffset);
virtual void ReadBuf(void * buf, UInt32 inLength);
virtual void WriteBuf(const void * buf, UInt32 inLength);
virtual void SetOffset(SInt64 inOffset);
protected:
IDataStream * parent;
struct SegmentInfo
{
SegmentInfo(UInt64 inOffset, UInt64 inLength, UInt64 inParentOffset)
{
offset = inOffset;
length = inLength;
parentOffset = inParentOffset;
}
UInt64 offset;
UInt64 length;
UInt64 parentOffset;
};
typedef std::vector <SegmentInfo> SegmentInfoListType;
SegmentInfoListType segmentInfo;
SegmentInfo * LookupInfo(UInt64 offset);
};

@ -1,3 +0,0 @@
#include "common/ISingleton.h"
//template <typename T> T * Singleton <T>::ms_Singleton = 0;

@ -1,53 +0,0 @@
#pragma once
#include "common/IErrors.h"
#pragma warning(push)
#pragma warning(disable: 4311 4312)
/**
* A singleton base class
*
* Singletons are useful when you have a class that will be instantiated once,
* like a global manager.
*/
template <typename T>
class ISingleton
{
static T * ms_Singleton;
public:
ISingleton()
{
ASSERT(!ms_Singleton);
intptr_t offset = (intptr_t)(T *)1 - (intptr_t)(ISingleton <T> *)(T *)1;
ms_Singleton = (T *)((intptr_t)this + offset);
}
virtual ~ISingleton()
{
ASSERT(ms_Singleton);
ms_Singleton = 0;
}
/**
* Returns the single instance of the derived class
*/
static T& GetSingleton(void)
{
ASSERT(ms_Singleton);
return *ms_Singleton;
}
/**
* Returns a pointer to the single instance of the derived class
*/
static T * GetSingletonPtr(void)
{
return ms_Singleton;
}
};
template <typename T> T * ISingleton <T>::ms_Singleton = 0;
#pragma warning(pop)

@ -1,83 +0,0 @@
#include "ITextParser.h"
#include "IDataStream.h"
ITextParser::ITextParser()
:m_stream(NULL)
{
//
}
ITextParser::ITextParser(IDataStream * stream)
:m_stream(stream)
{
//
}
ITextParser::~ITextParser()
{
//
}
void ITextParser::Attach(IDataStream * stream)
{
m_stream = stream;
}
void ITextParser::SkipWhitespace(void)
{
while(!m_stream->HitEOF())
{
char data = m_stream->Peek8();
if(!isspace(data))
break;
m_stream->Skip(1);
}
}
void ITextParser::SkipLine(void)
{
while(!m_stream->HitEOF())
{
char data = m_stream->Peek8();
if((data != '\n') && (data != '\r'))
break;
m_stream->Skip(1);
}
}
void ITextParser::ReadLine(char * out, UInt32 length)
{
m_stream->ReadString(out, length, '\n', '\r');
}
void ITextParser::ReadToken(char * buf, UInt32 bufLength)
{
char * traverse = buf;
ASSERT_STR(bufLength > 0, "ITextParser::ReadToken: zero-sized buffer");
if(bufLength == 1)
{
buf[0] = 0;
}
else
{
bufLength--;
for(UInt32 i = 0; (i < bufLength) && !m_stream->HitEOF(); i++)
{
UInt8 data = m_stream->Read8();
if(isspace(data) || !data)
break;
*traverse++ = data;
}
*traverse++ = 0;
}
}

@ -1,25 +0,0 @@
#pragma once
#include "common/IDataStream.h"
class ITextParser
{
public:
ITextParser();
ITextParser(IDataStream * stream);
~ITextParser();
void Attach(IDataStream * stream);
IDataStream * GetStream(void) { return m_stream; }
bool HitEOF(void) { return m_stream->HitEOF(); }
void SkipWhitespace(void);
void SkipLine(void);
void ReadLine(char * out, UInt32 length);
void ReadToken(char * out, UInt32 length);
private:
IDataStream * m_stream;
};

@ -1,65 +0,0 @@
#include "IThread.h"
IThread::IThread()
{
mainProc = NULL;
mainProcParam = NULL;
stopRequested = false;
isRunning = false;
theThread = NULL;
threadID = 0;
}
IThread::~IThread()
{
ForceStop();
if(theThread)
{
CloseHandle(theThread);
}
}
void IThread::Start(MainProcPtr proc, void * procParam)
{
if(!isRunning)
{
isRunning = true;
stopRequested = false;
mainProc = proc;
mainProcParam = procParam;
theThread = CreateThread(NULL, 0, _ThreadProc, static_cast<IThread *>(this), 0, &threadID);
}
}
void IThread::Stop(void)
{
if(isRunning)
{
stopRequested = true;
}
}
void IThread::ForceStop(void)
{
if(isRunning)
{
TerminateThread(theThread, 0);
isRunning = false;
}
}
UInt32 IThread::_ThreadProc(void * param)
{
IThread * _this = (IThread *)param;
if(_this->mainProc)
_this->mainProc(_this->mainProcParam);
_this->isRunning = false;
return 0;
}

@ -1,32 +0,0 @@
#pragma once
// TODO: I really don't like the interface for this
class IThread
{
public:
typedef void (* MainProcPtr)(void * param);
IThread();
~IThread();
void Start(MainProcPtr proc, void * procParam = NULL);
void Stop(void);
void ForceStop(void);
bool IsRunning(void) { return isRunning; }
bool StopRequested(void) { return stopRequested; }
HANDLE GetHandle(void) { return theThread; }
protected:
MainProcPtr mainProc;
void * mainProcParam;
volatile bool stopRequested;
bool isRunning;
HANDLE theThread;
UInt32 threadID;
private:
static UInt32 WINAPI _ThreadProc(void * param);
};

@ -1,133 +0,0 @@
#include "ITimer.h"
// QueryPerformanceCounter is very accurate, but hardware bugs can cause it to return inaccurate results
// this code uses multimedia timers to check for glitches in QPC
double ITimer::s_secondsPerCount = 0;
TIMECAPS ITimer::s_timecaps = { 0 };
bool ITimer::s_setTime = false;
UInt64 ITimer::s_lastQPC = 0;
UInt64 ITimer::s_qpcWrapMargin = 0;
bool ITimer::s_hasLastQPC = false;
UInt32 ITimer::s_qpcWrapCount = 0;
UInt32 ITimer::s_qpcInaccurateCount = 0;
ITimer::ITimer()
:m_qpcBase(0), m_tickBase(0)
{
Init();
}
ITimer::~ITimer()
{
}
void ITimer::Init(void)
{
if(!s_secondsPerCount)
{
// init qpc
UInt64 countsPerSecond;
BOOL res = QueryPerformanceFrequency((LARGE_INTEGER *)&countsPerSecond);
ASSERT_STR(res, "ITimer: no high-resolution timer support");
s_secondsPerCount = 1.0 / countsPerSecond;
s_qpcWrapMargin = (UInt64)(-((SInt64)(countsPerSecond * 60))); // detect if we've wrapped around by a delta greater than this - also limits max time
_MESSAGE("s_qpcWrapMargin: %016I64X", s_qpcWrapMargin);
_MESSAGE("wrap time: %fs", ((double)0xFFFFFFFFFFFFFFFF) * s_secondsPerCount);
// init multimedia timer
timeGetDevCaps(&s_timecaps, sizeof(s_timecaps));
_MESSAGE("min timer period = %d", s_timecaps.wPeriodMin);
s_setTime = (timeBeginPeriod(s_timecaps.wPeriodMin) == TIMERR_NOERROR);
if(!s_setTime)
_WARNING("couldn't change timer period");
}
}
void ITimer::DeInit(void)
{
if(s_secondsPerCount)
{
if(s_setTime)
{
timeEndPeriod(s_timecaps.wPeriodMin);
s_setTime = false;
}
if(s_qpcWrapCount)
_MESSAGE("s_qpcWrapCount: %d", s_qpcWrapCount);
s_secondsPerCount = 0;
}
}
void ITimer::Start(void)
{
m_qpcBase = GetQPC();
m_tickBase = timeGetTime();
}
double ITimer::GetElapsedTime(void)
{
UInt64 qpcNow = GetQPC();
UInt32 tickNow = timeGetTime();
UInt64 qpcDelta = qpcNow - m_qpcBase;
UInt64 tickDelta = tickNow - m_tickBase;
double qpcSeconds = ((double)qpcDelta) * s_secondsPerCount;
double tickSeconds = ((double)tickDelta) * 0.001; // ticks are in milliseconds
double qpcTickDelta = qpcSeconds - tickSeconds;
if(qpcTickDelta < 0) qpcTickDelta = -qpcTickDelta;
// if they differ by more than one second, something's wrong, return
if(qpcTickDelta > 1)
{
s_qpcInaccurateCount++;
return tickSeconds;
}
else
{
return qpcSeconds;
}
}
UInt64 ITimer::GetQPC(void)
{
UInt64 now;
QueryPerformanceCounter((LARGE_INTEGER *)&now);
if(s_hasLastQPC)
{
UInt64 delta = now - s_lastQPC;
if(delta > s_qpcWrapMargin)
{
// we've gone back in time, return a kludged value
s_lastQPC = now;
now = s_lastQPC + 1;
s_qpcWrapCount++;
}
else
{
s_lastQPC = now;
}
}
else
{
s_hasLastQPC = true;
s_lastQPC = now;
}
return now;
}

@ -1,38 +0,0 @@
#pragma once
#include "common/ITypes.h"
/**
* A high-resolution timer.
*/
class ITimer
{
public:
ITimer();
~ITimer();
static void Init(void);
static void DeInit(void);
void Start(void);
double GetElapsedTime(void); // seconds
private:
UInt64 m_qpcBase; // QPC
UInt32 m_tickBase; // timeGetTime
static double s_secondsPerCount;
static TIMECAPS s_timecaps;
static bool s_setTime;
// safe QPC stuff
static UInt64 GetQPC(void);
static UInt64 s_lastQPC;
static UInt64 s_qpcWrapMargin;
static bool s_hasLastQPC;
static UInt32 s_qpcWrapCount;
static UInt32 s_qpcInaccurateCount;
};

@ -1,66 +0,0 @@
#include "ITypes.h"
Bitstring::Bitstring()
:data(NULL)
{
}
Bitstring::Bitstring(UInt32 inLength)
:data(NULL)
{
Alloc(inLength);
}
Bitstring::~Bitstring()
{
Dispose();
}
void Bitstring::Alloc(UInt32 inLength)
{
Dispose();
inLength = (inLength + 7) & ~7;
length = inLength >> 3;
data = new UInt8[length];
}
void Bitstring::Dispose(void)
{
delete [] data;
}
void Bitstring::Clear(void)
{
std::memset(data, 0, length);
}
void Bitstring::Clear(UInt32 idx)
{
ASSERT_STR(idx < (length << 3), "Bitstring::Clear: out of range");
data[idx >> 3] &= ~(1 << (idx & 7));
}
void Bitstring::Set(UInt32 idx)
{
ASSERT_STR(idx < (length << 3), "Bitstring::Set: out of range");
data[idx >> 3] |= (1 << (idx & 7));
}
bool Bitstring::IsSet(UInt32 idx)
{
ASSERT_STR(idx < (length << 3), "Bitstring::IsSet: out of range");
return (data[idx >> 3] & (1 << (idx & 7))) ? true : false;
}
bool Bitstring::IsClear(UInt32 idx)
{
ASSERT_STR(idx < (length << 3), "Bitstring::IsClear: out of range");
return (data[idx >> 3] & (1 << (idx & 7))) ? false : true;
}

@ -1,344 +0,0 @@
#pragma once
#include "common/IErrors.h"
#pragma warning(disable: 4221)
#include <cmath>
typedef unsigned char UInt8; //!< An unsigned 8-bit integer value
typedef unsigned short UInt16; //!< An unsigned 16-bit integer value
typedef unsigned long UInt32; //!< An unsigned 32-bit integer value
typedef unsigned long long UInt64; //!< An unsigned 64-bit integer value
typedef signed char SInt8; //!< A signed 8-bit integer value
typedef signed short SInt16; //!< A signed 16-bit integer value
typedef signed long SInt32; //!< A signed 32-bit integer value
typedef signed long long SInt64; //!< A signed 64-bit integer value
typedef float Float32; //!< A 32-bit floating point value
typedef double Float64; //!< A 64-bit floating point value
inline UInt32 Extend16(UInt32 in)
{
return (in & 0x8000) ? (0xFFFF0000 | in) : in;
}
inline UInt32 Extend8(UInt32 in)
{
return (in & 0x80) ? (0xFFFFFF00 | in) : in;
}
inline UInt16 Swap16(UInt16 in)
{
return ((in >> 8) & 0x00FF) |
((in << 8) & 0xFF00);
}
inline UInt32 Swap32(UInt32 in)
{
return ((in >> 24) & 0x000000FF) |
((in >> 8) & 0x0000FF00) |
((in << 8) & 0x00FF0000) |
((in << 24) & 0xFF000000);
}
inline UInt64 Swap64(UInt64 in)
{
UInt64 temp;
temp = Swap32(in);
temp <<= 32;
temp |= Swap32(in >> 32);
return temp;
}
inline void SwapFloat(float * in)
{
UInt32 * temp = (UInt32 *)in;
*temp = Swap32(*temp);
}
inline void SwapDouble(double * in)
{
UInt64 * temp = (UInt64 *)in;
*temp = Swap64(*temp);
}
inline bool IsBigEndian(void)
{
union
{
UInt16 u16;
UInt8 u8[2];
} temp;
temp.u16 = 0x1234;
return temp.u8[0] == 0x12;
}
inline bool IsLittleEndian(void)
{
return !IsBigEndian();
}
#define CHAR_CODE(a, b, c, d) (((a & 0xFF) << 0) | ((b & 0xFF) << 8) | ((c & 0xFF) << 16) | ((d & 0xFF) << 24))
#define MACRO_SWAP16(a) ((((a) & 0x00FF) << 8) | (((a) & 0xFF00) >> 8))
#define MACRO_SWAP32(a) ((((a) & 0x000000FF) << 24) | (((a) & 0x0000FF00) << 8) | (((a) & 0x00FF0000) >> 8) | (((a) & 0xFF000000) >> 24))
#define VERSION_CODE(primary, secondary, sub) (((primary & 0xFFF) << 20) | ((secondary & 0xFFF) << 8) | ((sub & 0xFF) << 0))
#define VERSION_CODE_PRIMARY(in) ((in >> 20) & 0xFFF)
#define VERSION_CODE_SECONDARY(in) ((in >> 8) & 0xFFF)
#define VERSION_CODE_SUB(in) ((in >> 0) & 0xFF)
#define MAKE_COLOR(a, r, g, b) (((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF) << 0))
#define COLOR_ALPHA(in) ((in >> 24) & 0xFF)
#define COLOR_RED(in) ((in >> 16) & 0xFF)
#define COLOR_GREEN(in) ((in >> 8) & 0xFF)
#define COLOR_BLUE(in) ((in >> 0) & 0xFF)
/**
* A 64-bit variable combiner
*
* Useful for endian-independent value extraction.
*/
union VarCombiner
{
UInt64 u64;
SInt64 s64;
double f64;
struct { UInt32 b; UInt32 a; } u32;
struct { SInt32 b; SInt32 a; } s32;
struct { float b; float a; } f32;
struct { UInt16 d; UInt16 c; UInt16 b; UInt16 a; } u16;
struct { SInt16 d; SInt16 c; SInt16 b; SInt16 a; } s16;
struct { UInt8 h; UInt8 g; UInt8 f; UInt8 e;
UInt8 d; UInt8 c; UInt8 b; UInt8 a; } u8;
struct { SInt8 h; SInt8 g; SInt8 f; SInt8 e;
SInt8 d; SInt8 c; SInt8 b; SInt8 a; } s8;
};
/**
* A bitfield.
*/
template <typename T>
class Bitfield
{
public:
Bitfield() { }
~Bitfield() { }
void Clear(void) { field = 0; } //!< Clears all bits
void RawSet(UInt32 data) { field = data; } //!< Modifies all bits
void Set(UInt32 data) { field |= data; } //!< Sets individual bits
void Clear(UInt32 data) { field &= ~data; } //!< Clears individual bits
void UnSet(UInt32 data) { Clear(data); } //!< Clears individual bits
void Mask(UInt32 data) { field &= data; } //!< Masks individual bits
void Toggle(UInt32 data) { field ^= data; } //!< Toggles individual bits
void Write(UInt32 data, bool state)
{ if(state) Set(data); else Clear(data); }
T Get(void) const { return field; } //!< Gets all bits
T Get(UInt32 data) const { return field & data; } //!< Gets individual bits
T Extract(UInt32 bit) const { return (field >> bit) & 1; } //!< Extracts a bit
T ExtractField(UInt32 shift, UInt32 length) //!< Extracts a series of bits
{ return (field >> shift) & (0xFFFFFFFF >> (32 - length)); }
bool IsSet(UInt32 data) const { return ((field & data) == data) ? true : false; } //!< Are all these bits set?
bool IsUnSet(UInt32 data) const { return (field & data) ? false : true; } //!< Are all these bits clear?
bool IsClear(UInt32 data) const { return IsUnSet(data); } //!< Are all these bits clear?
private:
T field; //!< bitfield data
};
typedef Bitfield <UInt8> Bitfield8; //!< An 8-bit bitfield
typedef Bitfield <UInt16> Bitfield16; //!< A 16-bit bitfield
typedef Bitfield <UInt32> Bitfield32; //!< A 32-bit bitfield
STATIC_ASSERT(sizeof(Bitfield8) == 1);
STATIC_ASSERT(sizeof(Bitfield16) == 2);
STATIC_ASSERT(sizeof(Bitfield32) == 4);
/**
* A bitstring
*
* Essentially a long bitvector.
*/
class Bitstring
{
public:
Bitstring();
Bitstring(UInt32 inLength);
~Bitstring();
void Alloc(UInt32 inLength);
void Dispose(void);
void Clear(void);
void Clear(UInt32 idx);
void Set(UInt32 idx);
bool IsSet(UInt32 idx);
bool IsClear(UInt32 idx);
private:
UInt8 * data;
UInt32 length; //!< length in bytes
};
/**
* Time storage
*/
class Time
{
public:
Time() { Clear(); }
~Time() { }
//! Deinitialize the class
void Clear(void) { seconds = minutes = hours = 0; hasData = false; }
//! Sets the class to the current time
//! @todo implement this
void SetToNow(void) { Set(1, 2, 3); }
//! Sets the class to the specified time
void Set(UInt8 inS, UInt8 inM, UInt8 inH)
{ seconds = inS; minutes = inM; hours = inH; hasData = true; }
//! Gets whether the class has been initialized or not
bool IsSet(void) { return hasData; }
UInt8 GetSeconds(void) { return seconds; } //!< return the seconds portion of the time
UInt8 GetMinutes(void) { return minutes; } //!< return the minutes portion of the time
UInt8 GetHours(void) { return hours; } //!< return the hours portion of the time
private:
UInt8 seconds, minutes, hours;
bool hasData;
};
const float kFloatEpsilon = 0.0001f;
inline bool FloatEqual(float a, float b) { float magnitude = a - b; if(magnitude < 0) magnitude = -magnitude; return magnitude < kFloatEpsilon; }
class Vector2
{
public:
Vector2() { }
Vector2(const Vector2 & in) { x = in.x; y = in.y; }
Vector2(float inX, float inY) { x = inX; y = inY; }
~Vector2() { }
void Set(float inX, float inY) { x = inX; y = inY; }
void SetX(float inX) { x = inX; }
void SetY(float inY) { y = inY; }
void Get(float * outX, float * outY) { *outX = x; *outY = y; }
float GetX(void) { return x; }
float GetY(void) { return y; }
void Normalize(void) { float mag = Magnitude(); x /= mag; y /= mag; }
float Magnitude(void) { return sqrt(x*x + y*y); }
void Reverse(void) { float temp = -x; x = -y; y = temp; }
void Scale(float scale) { x *= scale; y *= scale; }
void SwapBytes(void) { SwapFloat(&x); SwapFloat(&y); }
Vector2 & operator+=(const Vector2 & rhs) { x += rhs.x; y += rhs.y; return *this; }
Vector2 & operator-=(const Vector2 & rhs) { x -= rhs.x; y -= rhs.y; return *this; }
Vector2 & operator*=(float rhs) { x *= rhs; y *= rhs; return *this; }
Vector2 & operator/=(float rhs) { x /= rhs; y /= rhs; return *this; }
float x;
float y;
};
inline Vector2 operator+(const Vector2 & lhs, const Vector2 & rhs)
{
return Vector2(lhs.x + rhs.x, lhs.y + rhs.y);
};
inline Vector2 operator-(const Vector2 & lhs, const Vector2 & rhs)
{
return Vector2(lhs.x - rhs.x, lhs.y - rhs.y);
};
inline Vector2 operator*(const Vector2 & lhs, float rhs)
{
return Vector2(lhs.x * rhs, lhs.y * rhs);
};
inline Vector2 operator/(const Vector2 & lhs, float rhs)
{
return Vector2(lhs.x / rhs, lhs.y / rhs);
};
inline bool MaskCompare(void * lhs, void * rhs, void * mask, UInt32 size)
{
UInt8 * lhs8 = (UInt8 *)lhs;
UInt8 * rhs8 = (UInt8 *)rhs;
UInt8 * mask8 = (UInt8 *)mask;
for(UInt32 i = 0; i < size; i++)
if((lhs8[i] & mask8[i]) != (rhs8[i] & mask8[i]))
return false;
return true;
}
class Vector3
{
public:
Vector3() { }
Vector3(const Vector3 & in) { x = in.x; y = in.y; z = in.z; }
Vector3(float inX, float inY, float inZ) { x = inX; y = inY; z = inZ; }
~Vector3() { }
void Set(float inX, float inY, float inZ) { x = inX; y = inY; z = inZ; }
void Get(float * outX, float * outY, float * outZ) { *outX = x; *outY = y; *outZ = z; }
void Normalize(void) { float mag = Magnitude(); x /= mag; y /= mag; z /= mag; }
float Magnitude(void) { return sqrt(x*x + y*y + z*z); }
void Scale(float scale) { x *= scale; y *= scale; z *= scale; }
void SwapBytes(void) { SwapFloat(&x); SwapFloat(&y); SwapFloat(&z); }
Vector3 & operator+=(const Vector3 & rhs) { x += rhs.x; y += rhs.y; z += rhs.z; return *this; }
Vector3 & operator-=(const Vector3 & rhs) { x -= rhs.x; y -= rhs.y; z -= rhs.z; return *this; }
Vector3 & operator*=(const Vector3 & rhs) { x *= rhs.x; y *= rhs.y; z *= rhs.z; return *this; }
Vector3 & operator/=(const Vector3 & rhs) { x /= rhs.x; y /= rhs.y; z /= rhs.z; return *this; }
union
{
struct
{
float x, y, z;
};
float d[3];
};
};
inline Vector3 operator+(const Vector3 & lhs, const Vector3 & rhs)
{
return Vector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);
}
inline Vector3 operator-(const Vector3 & lhs, const Vector3 & rhs)
{
return Vector3(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);
}
inline Vector3 operator*(const Vector3 & lhs, const Vector3 & rhs)
{
return Vector3(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z);
}
inline Vector3 operator/(const Vector3 & lhs, const Vector3 & rhs)
{
return Vector3(lhs.x / rhs.x, lhs.y / rhs.y, lhs.z / rhs.z);
}

@ -1,419 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="common"
ProjectGUID="{20C6411C-596F-4B85-BE4E-8BC91F59D8A6}"
RootNamespace="common"
SccProjectName="Perforce Project"
SccLocalPath="."
SccProvider="MSSCCI:Perforce SCM"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="$(SolutionDir);$(SolutionDir)\.."
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
ForcedIncludeFiles="common/IPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="$(SolutionDir);$(SolutionDir)\.."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
ForcedIncludeFiles="common/IPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="streams"
>
<File
RelativePath=".\IBufferStream.cpp"
>
</File>
<File
RelativePath=".\IBufferStream.h"
>
</File>
<File
RelativePath=".\IDataStream.cpp"
>
</File>
<File
RelativePath=".\IDataStream.h"
>
</File>
<File
RelativePath=".\IFileStream.cpp"
>
</File>
<File
RelativePath=".\IFileStream.h"
>
</File>
<File
RelativePath=".\ISegmentStream.cpp"
>
</File>
<File
RelativePath=".\ISegmentStream.h"
>
</File>
</Filter>
<Filter
Name="debug"
>
<File
RelativePath=".\IDebugLog.cpp"
>
</File>
<File
RelativePath=".\IDebugLog.h"
>
</File>
<File
RelativePath="IErrors.cpp"
>
</File>
<File
RelativePath="IErrors.h"
>
</File>
</Filter>
<Filter
Name="threads"
>
<File
RelativePath=".\ICriticalSection.h"
>
</File>
<File
RelativePath=".\IEvent.cpp"
>
</File>
<File
RelativePath=".\IEvent.h"
>
</File>
<File
RelativePath=".\IInterlockedLong.cpp"
>
</File>
<File
RelativePath=".\IInterlockedLong.h"
>
</File>
<File
RelativePath=".\IMutex.cpp"
>
</File>
<File
RelativePath=".\IMutex.h"
>
</File>
<File
RelativePath=".\IReadWriteLock.cpp"
>
</File>
<File
RelativePath=".\IReadWriteLock.h"
>
</File>
<File
RelativePath=".\IThread.cpp"
>
</File>
<File
RelativePath=".\IThread.h"
>
</File>
</Filter>
<Filter
Name="datatypes"
>
<File
RelativePath=".\IArchive.cpp"
>
</File>
<File
RelativePath=".\IArchive.h"
>
</File>
<File
RelativePath=".\IDatabase.cpp"
>
</File>
<File
RelativePath=".\IDatabase.h"
>
</File>
<File
RelativePath=".\IDatabase.inc"
>
</File>
<File
RelativePath=".\IFIFO.cpp"
>
</File>
<File
RelativePath=".\IFIFO.h"
>
</File>
<File
RelativePath=".\ILinkedList.h"
>
</File>
<File
RelativePath=".\IRangeMap.cpp"
>
</File>
<File
RelativePath=".\IRangeMap.h"
>
</File>
<File
RelativePath=".\ISingleton.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="ISingleton.h"
>
</File>
<File
RelativePath=".\ITextParser.cpp"
>
</File>
<File
RelativePath=".\ITextParser.h"
>
</File>
<File
RelativePath=".\ITypes.cpp"
>
</File>
<File
RelativePath=".\ITypes.h"
>
</File>
</Filter>
<Filter
Name="utilities"
>
<File
RelativePath="IConsole.cpp"
>
</File>
<File
RelativePath="IConsole.h"
>
</File>
<File
RelativePath=".\IDynamicCreate.cpp"
>
</File>
<File
RelativePath=".\IDynamicCreate.h"
>
</File>
<File
RelativePath=".\ITimer.cpp"
>
</File>
<File
RelativePath=".\ITimer.h"
>
</File>
</Filter>
<Filter
Name="memory"
>
<File
RelativePath=".\IMemPool.cpp"
>
</File>
<File
RelativePath=".\IMemPool.h"
>
</File>
</Filter>
<Filter
Name="pipe"
>
<File
RelativePath=".\IPipeClient.cpp"
>
</File>
<File
RelativePath=".\IPipeClient.h"
>
</File>
<File
RelativePath=".\IPipeServer.cpp"
>
</File>
<File
RelativePath=".\IPipeServer.h"
>
</File>
</Filter>
<Filter
Name="files"
>
<File
RelativePath=".\IDirectoryIterator.cpp"
>
</File>
<File
RelativePath=".\IDirectoryIterator.h"
>
</File>
</Filter>
<File
RelativePath=".\IPrefix.cpp"
>
</File>
<File
RelativePath=".\IPrefix.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -1,154 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{20C6411C-596F-4B85-BE4E-8BC91F59D8A6}</ProjectGuid>
<RootNamespace>common</RootNamespace>
<SccProjectName>Perforce Project</SccProjectName>
<SccLocalPath>.</SccLocalPath>
<SccProvider>MSSCCI:Perforce SCM</SccProvider>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ForcedIncludeFiles>common/IPrefix.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ForcedIncludeFiles>common/IPrefix.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="IBufferStream.cpp" />
<ClCompile Include="IDataStream.cpp" />
<ClCompile Include="IFileStream.cpp" />
<ClCompile Include="ISegmentStream.cpp" />
<ClCompile Include="IDebugLog.cpp" />
<ClCompile Include="IErrors.cpp" />
<ClCompile Include="IEvent.cpp" />
<ClCompile Include="IInterlockedLong.cpp" />
<ClCompile Include="IMutex.cpp" />
<ClCompile Include="IReadWriteLock.cpp" />
<ClCompile Include="IThread.cpp" />
<ClCompile Include="IArchive.cpp" />
<ClCompile Include="IDatabase.cpp" />
<ClCompile Include="IFIFO.cpp" />
<ClCompile Include="IRangeMap.cpp" />
<ClCompile Include="ISingleton.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="ITextParser.cpp" />
<ClCompile Include="ITypes.cpp" />
<ClCompile Include="IConsole.cpp" />
<ClCompile Include="IDynamicCreate.cpp" />
<ClCompile Include="ITimer.cpp" />
<ClCompile Include="IMemPool.cpp" />
<ClCompile Include="IPipeClient.cpp" />
<ClCompile Include="IPipeServer.cpp" />
<ClCompile Include="IDirectoryIterator.cpp" />
<ClCompile Include="IPrefix.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="IBufferStream.h" />
<ClInclude Include="IDataStream.h" />
<ClInclude Include="IFileStream.h" />
<ClInclude Include="ISegmentStream.h" />
<ClInclude Include="IDebugLog.h" />
<ClInclude Include="IErrors.h" />
<ClInclude Include="ICriticalSection.h" />
<ClInclude Include="IEvent.h" />
<ClInclude Include="IInterlockedLong.h" />
<ClInclude Include="IMutex.h" />
<ClInclude Include="IReadWriteLock.h" />
<ClInclude Include="IThread.h" />
<ClInclude Include="IArchive.h" />
<ClInclude Include="IDatabase.h" />
<ClInclude Include="IFIFO.h" />
<ClInclude Include="ILinkedList.h" />
<ClInclude Include="IRangeMap.h" />
<ClInclude Include="ISingleton.h" />
<ClInclude Include="ITextParser.h" />
<ClInclude Include="ITypes.h" />
<ClInclude Include="IConsole.h" />
<ClInclude Include="IDynamicCreate.h" />
<ClInclude Include="ITimer.h" />
<ClInclude Include="IMemPool.h" />
<ClInclude Include="IPipeClient.h" />
<ClInclude Include="IPipeServer.h" />
<ClInclude Include="IDirectoryIterator.h" />
<ClInclude Include="IPrefix.h" />
</ItemGroup>
<ItemGroup>
<None Include="IDatabase.inc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -1,196 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="streams">
<UniqueIdentifier>{3116e955-2cbf-4759-a5ae-1fd8a64cf82f}</UniqueIdentifier>
</Filter>
<Filter Include="debug">
<UniqueIdentifier>{2763d79e-c908-489f-98d7-e9033c13ee81}</UniqueIdentifier>
</Filter>
<Filter Include="threads">
<UniqueIdentifier>{0189b4d3-578c-4b8e-9e73-ef2a5658a139}</UniqueIdentifier>
</Filter>
<Filter Include="datatypes">
<UniqueIdentifier>{d245593e-d1c3-4f87-b989-1841f48a2837}</UniqueIdentifier>
</Filter>
<Filter Include="utilities">
<UniqueIdentifier>{454cfcb6-5332-4789-8092-3e68723f9eb2}</UniqueIdentifier>
</Filter>
<Filter Include="memory">
<UniqueIdentifier>{324323c6-8765-4754-bc66-3d8cf12d3ad0}</UniqueIdentifier>
</Filter>
<Filter Include="pipe">
<UniqueIdentifier>{1c594a4b-a331-4eeb-826c-87f764586bbd}</UniqueIdentifier>
</Filter>
<Filter Include="files">
<UniqueIdentifier>{22a19b00-a69e-48b2-a637-78e10e06217b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="IBufferStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="IDataStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="IFileStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="ISegmentStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="IDebugLog.cpp">
<Filter>debug</Filter>
</ClCompile>
<ClCompile Include="IErrors.cpp">
<Filter>debug</Filter>
</ClCompile>
<ClCompile Include="IEvent.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IInterlockedLong.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IMutex.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IReadWriteLock.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IThread.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IArchive.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="IDatabase.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="IFIFO.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="IRangeMap.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="ISingleton.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="ITextParser.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="ITypes.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="IConsole.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="IDynamicCreate.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="ITimer.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="IMemPool.cpp">
<Filter>memory</Filter>
</ClCompile>
<ClCompile Include="IPipeClient.cpp">
<Filter>pipe</Filter>
</ClCompile>
<ClCompile Include="IPipeServer.cpp">
<Filter>pipe</Filter>
</ClCompile>
<ClCompile Include="IDirectoryIterator.cpp">
<Filter>files</Filter>
</ClCompile>
<ClCompile Include="IPrefix.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="IBufferStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="IDataStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="IFileStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="ISegmentStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="IDebugLog.h">
<Filter>debug</Filter>
</ClInclude>
<ClInclude Include="IErrors.h">
<Filter>debug</Filter>
</ClInclude>
<ClInclude Include="ICriticalSection.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IEvent.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IInterlockedLong.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IMutex.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IReadWriteLock.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IThread.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IArchive.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="IDatabase.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="IFIFO.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="ILinkedList.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="IRangeMap.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="ISingleton.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="ITextParser.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="ITypes.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="IConsole.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="IDynamicCreate.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="ITimer.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="IMemPool.h">
<Filter>memory</Filter>
</ClInclude>
<ClInclude Include="IPipeClient.h">
<Filter>pipe</Filter>
</ClInclude>
<ClInclude Include="IPipeServer.h">
<Filter>pipe</Filter>
</ClInclude>
<ClInclude Include="IDirectoryIterator.h">
<Filter>files</Filter>
</ClInclude>
<ClInclude Include="IPrefix.h" />
</ItemGroup>
<ItemGroup>
<None Include="IDatabase.inc">
<Filter>datatypes</Filter>
</None>
</ItemGroup>
</Project>

@ -1,22 +0,0 @@
This license applies to all of the files in src/common:
Copyright (c) 2006-2011 Ian Patterson
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.

@ -1,24 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_vc11", "common_vc11.vcxproj", "{D4C128A1-73DC-4941-A453-CE55AF239BA8}"
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 1
SccLocalPath0 = .
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4C128A1-73DC-4941-A453-CE55AF239BA8}.Debug|x64.ActiveCfg = Debug|x64
{D4C128A1-73DC-4941-A453-CE55AF239BA8}.Debug|x64.Build.0 = Debug|x64
{D4C128A1-73DC-4941-A453-CE55AF239BA8}.Release|x64.ActiveCfg = Release|x64
{D4C128A1-73DC-4941-A453-CE55AF239BA8}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

@ -1,188 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="IBufferStream.cpp" />
<ClCompile Include="IDataStream.cpp" />
<ClCompile Include="IDebugLog.cpp" />
<ClCompile Include="IDirectoryIterator.cpp" />
<ClCompile Include="IErrors.cpp" />
<ClCompile Include="IEvent.cpp" />
<ClCompile Include="IFileStream.cpp" />
<ClCompile Include="IInterlockedLong.cpp" />
<ClCompile Include="IMutex.cpp" />
<ClCompile Include="IPrefix.cpp" />
<ClCompile Include="ISegmentStream.cpp" />
<ClCompile Include="ISingleton.cpp" />
<ClCompile Include="ITimer.cpp" />
<ClCompile Include="ITypes.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="IBufferStream.h" />
<ClInclude Include="ICriticalSection.h" />
<ClInclude Include="IDataStream.h" />
<ClInclude Include="IDebugLog.h" />
<ClInclude Include="IDirectoryIterator.h" />
<ClInclude Include="IErrors.h" />
<ClInclude Include="IEvent.h" />
<ClInclude Include="IFileStream.h" />
<ClInclude Include="IInterlockedLong.h" />
<ClInclude Include="IMutex.h" />
<ClInclude Include="IPrefix.h" />
<ClInclude Include="ISegmentStream.h" />
<ClInclude Include="ISingleton.h" />
<ClInclude Include="ITimer.h" />
<ClInclude Include="ITypes.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D4C128A1-73DC-4941-A453-CE55AF239BA8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>common_vc11</RootNamespace>
<SccProjectName>
</SccProjectName>
<SccAuxPath>
</SccAuxPath>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)_vc11\$(Configuration)\</OutDir>
<IntDir>$(Platform)_vc11\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)_vc11\$(Configuration)\</OutDir>
<IntDir>$(Platform)_vc11\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\..</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ForcedIncludeFiles>common/IPrefix.h</ForcedIncludeFiles>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\..</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ForcedIncludeFiles>common/IPrefix.h</ForcedIncludeFiles>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="IPrefix.cpp" />
<ClCompile Include="IBufferStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="IDataStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="IDebugLog.cpp">
<Filter>debug</Filter>
</ClCompile>
<ClCompile Include="IErrors.cpp">
<Filter>debug</Filter>
</ClCompile>
<ClCompile Include="IMutex.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IInterlockedLong.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IEvent.cpp">
<Filter>threads</Filter>
</ClCompile>
<ClCompile Include="IFileStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="ISegmentStream.cpp">
<Filter>streams</Filter>
</ClCompile>
<ClCompile Include="ISingleton.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="ITypes.cpp">
<Filter>datatypes</Filter>
</ClCompile>
<ClCompile Include="IDirectoryIterator.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="ITimer.cpp">
<Filter>utilities</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="IPrefix.h" />
<ClInclude Include="IBufferStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="IDataStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="IDebugLog.h">
<Filter>debug</Filter>
</ClInclude>
<ClInclude Include="IErrors.h">
<Filter>debug</Filter>
</ClInclude>
<ClInclude Include="IMutex.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IInterlockedLong.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="ICriticalSection.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IEvent.h">
<Filter>threads</Filter>
</ClInclude>
<ClInclude Include="IFileStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="ISegmentStream.h">
<Filter>streams</Filter>
</ClInclude>
<ClInclude Include="ISingleton.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="ITypes.h">
<Filter>datatypes</Filter>
</ClInclude>
<ClInclude Include="IDirectoryIterator.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="ITimer.h">
<Filter>utilities</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="streams">
<UniqueIdentifier>{9fbaeb6f-acb8-4ee5-ac77-3e3b4473acc0}</UniqueIdentifier>
</Filter>
<Filter Include="debug">
<UniqueIdentifier>{c27df8b6-6fe8-4628-a6ee-51346b65cd8c}</UniqueIdentifier>
</Filter>
<Filter Include="threads">
<UniqueIdentifier>{0496bc12-7477-42e4-87e7-d9565c164a32}</UniqueIdentifier>
</Filter>
<Filter Include="datatypes">
<UniqueIdentifier>{09a8ab62-d5b8-4cb4-a24e-33761b7c98f9}</UniqueIdentifier>
</Filter>
<Filter Include="utilities">
<UniqueIdentifier>{0bd6b089-31f2-4bc9-acc5-4bf164af219b}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

@ -1,10 +0,0 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
}

@ -1,418 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="common_vc12"
ProjectGUID="{20C6411C-596F-4B85-BE4E-8BC91F59D8A6}"
RootNamespace="common"
SccProjectName="Perforce Project"
SccLocalPath="."
SccProvider="MSSCCI:Perforce SCM"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug VC12"
IntermediateDirectory="Debug VC12"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\..&quot;;&quot;$(SolutionDir)\..\..&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
ForcedIncludeFiles="common/IPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release VC12"
IntermediateDirectory="Release VC12"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\..&quot;;&quot;$(SolutionDir)\..\..&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
ForcedIncludeFiles="common/IPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="streams"
>
<File
RelativePath=".\IBufferStream.cpp"
>
</File>
<File
RelativePath=".\IBufferStream.h"
>
</File>
<File
RelativePath=".\IDataStream.cpp"
>
</File>
<File
RelativePath=".\IDataStream.h"
>
</File>
<File
RelativePath=".\IFileStream.cpp"
>
</File>
<File
RelativePath=".\IFileStream.h"
>
</File>
<File
RelativePath=".\ISegmentStream.cpp"
>
</File>
<File
RelativePath=".\ISegmentStream.h"
>
</File>
</Filter>
<Filter
Name="debug"
>
<File
RelativePath=".\IDebugLog.cpp"
>
</File>
<File
RelativePath=".\IDebugLog.h"
>
</File>
<File
RelativePath="IErrors.cpp"
>
</File>
<File
RelativePath="IErrors.h"
>
</File>
</Filter>
<Filter
Name="threads"
>
<File
RelativePath=".\ICriticalSection.h"
>
</File>
<File
RelativePath=".\IEvent.cpp"
>
</File>
<File
RelativePath=".\IEvent.h"
>
</File>
<File
RelativePath=".\IInterlockedLong.cpp"
>
</File>
<File
RelativePath=".\IInterlockedLong.h"
>
</File>
<File
RelativePath=".\IMutex.cpp"
>
</File>
<File
RelativePath=".\IMutex.h"
>
</File>
<File
RelativePath=".\IReadWriteLock.cpp"
>
</File>
<File
RelativePath=".\IReadWriteLock.h"
>
</File>
<File
RelativePath=".\IThread.cpp"
>
</File>
<File
RelativePath=".\IThread.h"
>
</File>
</Filter>
<Filter
Name="datatypes"
>
<File
RelativePath=".\IArchive.cpp"
>
</File>
<File
RelativePath=".\IArchive.h"
>
</File>
<File
RelativePath=".\IDatabase.cpp"
>
</File>
<File
RelativePath=".\IDatabase.h"
>
</File>
<File
RelativePath=".\IDatabase.inc"
>
</File>
<File
RelativePath=".\IFIFO.cpp"
>
</File>
<File
RelativePath=".\IFIFO.h"
>
</File>
<File
RelativePath=".\ILinkedList.h"
>
</File>
<File
RelativePath=".\IRangeMap.cpp"
>
</File>
<File
RelativePath=".\IRangeMap.h"
>
</File>
<File
RelativePath=".\ISingleton.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="ISingleton.h"
>
</File>
<File
RelativePath=".\ITextParser.cpp"
>
</File>
<File
RelativePath=".\ITextParser.h"
>
</File>
<File
RelativePath=".\ITypes.cpp"
>
</File>
<File
RelativePath=".\ITypes.h"
>
</File>
</Filter>
<Filter
Name="utilities"
>
<File
RelativePath="IConsole.cpp"
>
</File>
<File
RelativePath="IConsole.h"
>
</File>
<File
RelativePath=".\IDynamicCreate.cpp"
>
</File>
<File
RelativePath=".\IDynamicCreate.h"
>
</File>
<File
RelativePath=".\ITimer.cpp"
>
</File>
<File
RelativePath=".\ITimer.h"
>
</File>
</Filter>
<Filter
Name="memory"
>
<File
RelativePath=".\IMemPool.cpp"
>
</File>
<File
RelativePath=".\IMemPool.h"
>
</File>
</Filter>
<Filter
Name="pipe"
>
<File
RelativePath=".\IPipeClient.cpp"
>
</File>
<File
RelativePath=".\IPipeClient.h"
>
</File>
<File
RelativePath=".\IPipeServer.cpp"
>
</File>
<File
RelativePath=".\IPipeServer.h"
>
</File>
</Filter>
<Filter
Name="files"
>
<File
RelativePath=".\IDirectoryIterator.cpp"
>
</File>
<File
RelativePath=".\IDirectoryIterator.h"
>
</File>
</Filter>
<File
RelativePath=".\IPrefix.cpp"
>
</File>
<File
RelativePath=".\IPrefix.h"
>
</File>
</Files>
</VisualStudioProject>

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug_VC12|Win32">
<Configuration>Debug_VC12</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_VC12|Win32">
<Configuration>Release_VC12</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>common_vc12</ProjectName>
<ProjectGuid>{20C6411C-596F-4B85-BE4E-8BC91F59D8A6}</ProjectGuid>
<RootNamespace>common</RootNamespace>
<SccProjectName>Perforce Project</SccProjectName>
<SccLocalPath>.</SccLocalPath>
<SccProvider>MSSCCI:Perforce SCM</SccProvider>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_VC12|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_VC12|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_VC12|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_VC12|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_VC12|Win32'">
<OutDir>Debug VC12\</OutDir>
<IntDir>Debug VC12\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_VC12|Win32'">
<OutDir>Release VC12\</OutDir>
<IntDir>Release VC12\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_VC12|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\..;$(SolutionDir)\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader />
<PrecompiledHeaderFile />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ForcedIncludeFiles>common/IPrefix.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_VC12|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\..;$(SolutionDir)\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader />
<PrecompiledHeaderFile />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ForcedIncludeFiles>common/IPrefix.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="IBufferStream.cpp" />
<ClCompile Include="IDataStream.cpp" />
<ClCompile Include="IFileStream.cpp" />
<ClCompile Include="ISegmentStream.cpp" />
<ClCompile Include="IDebugLog.cpp" />
<ClCompile Include="IErrors.cpp" />
<ClCompile Include="IEvent.cpp" />
<ClCompile Include="IInterlockedLong.cpp" />
<ClCompile Include="IMutex.cpp" />
<ClCompile Include="IReadWriteLock.cpp" />
<ClCompile Include="IThread.cpp" />
<ClCompile Include="IArchive.cpp" />
<ClCompile Include="IDatabase.cpp" />
<ClCompile Include="IFIFO.cpp" />
<ClCompile Include="IRangeMap.cpp" />
<ClCompile Include="ISingleton.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_VC12|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="ITextParser.cpp" />
<ClCompile Include="ITypes.cpp" />
<ClCompile Include="IConsole.cpp" />
<ClCompile Include="IDynamicCreate.cpp" />
<ClCompile Include="ITimer.cpp" />
<ClCompile Include="IMemPool.cpp" />
<ClCompile Include="IPipeClient.cpp" />
<ClCompile Include="IPipeServer.cpp" />
<ClCompile Include="IDirectoryIterator.cpp" />
<ClCompile Include="IPrefix.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="IBufferStream.h" />
<ClInclude Include="IDataStream.h" />
<ClInclude Include="IFileStream.h" />
<ClInclude Include="ISegmentStream.h" />
<ClInclude Include="IDebugLog.h" />
<ClInclude Include="IErrors.h" />
<ClInclude Include="ICriticalSection.h" />
<ClInclude Include="IEvent.h" />
<ClInclude Include="IInterlockedLong.h" />
<ClInclude Include="IMutex.h" />
<ClInclude Include="IReadWriteLock.h" />
<ClInclude Include="IThread.h" />
<ClInclude Include="IArchive.h" />
<ClInclude Include="IDatabase.h" />
<ClInclude Include="IFIFO.h" />
<ClInclude Include="ILinkedList.h" />
<ClInclude Include="IRangeMap.h" />
<ClInclude Include="ISingleton.h" />
<ClInclude Include="ITextParser.h" />
<ClInclude Include="ITypes.h" />
<ClInclude Include="IConsole.h" />
<ClInclude Include="IDynamicCreate.h" />
<ClInclude Include="ITimer.h" />
<ClInclude Include="IMemPool.h" />
<ClInclude Include="IPipeClient.h" />
<ClInclude Include="IPipeServer.h" />
<ClInclude Include="IDirectoryIterator.h" />
<ClInclude Include="IPrefix.h" />
</ItemGroup>
<ItemGroup>
<None Include="IDatabase.inc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

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

Loading…
Cancel
Save