This commit is contained in:
= 2025-04-23 00:09:35 -04:00
parent f50753c07c
commit b620477446
88 changed files with 88912 additions and 280 deletions

View File

@ -1,12 +1,6 @@
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS += libs/core \ SUBDIRS += libs \
libs/compression \
libs/encryption \
libs/fastfile \
libs/zonefile \
libs/ddsfile \
libs/iwifile \
libs/ipakfile \
app \ app \
tools \
tests tests

625
XPlor.pro.user.40d992c Normal file
View File

@ -0,0 +1,625 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 15.0.0, 2025-04-04T21:57:41. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{40d992cb-ac11-4385-a22b-016f1b4251a7}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.LineEndingBehavior">0</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">2</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<value type="bool" key="AutoTest.ApplyFilter">false</value>
<valuemap type="QVariantMap" key="AutoTest.CheckStates">
<value type="Qt::CheckState" key="1@G:/Projects/Qt/XPlor/tests/autotest_cod.h:AutoTest_COD">Unchecked</value>
</valuemap>
<valuelist type="QVariantList" key="AutoTest.PathFilters"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">16</value>
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
<valuemap type="QVariantMap" key="CppEditor.QuickFix">
<value type="bool" key="UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.8.2 MSVC2022 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.8.2 MSVC2022 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.682.win64_msvc2022_64_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_2_MSVC2022_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_MSVC2022_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_2_MSVC2022_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_MSVC2022_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_2_MSVC2022_64bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_MSVC2022_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">G:/Projects/Qt/XPlor/app/app.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_MSVC2022_64bit-Debug/app</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">G:/Projects/Qt/XPlor/tests/tests.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_MSVC2022_64bit-Debug/tests</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.1</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.8.2 llvm-mingw 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.8.2 llvm-mingw 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.682.win64_llvm_mingw_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_2_llvm_mingw_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_llvm_mingw_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_2_llvm_mingw_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_llvm_mingw_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_2_llvm_mingw_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_2_llvm_mingw_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">G:/Projects/Qt/XPlor/app/app.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">G:/Projects/Qt/XPlor/tests/tests.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.2</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.8.1 MSVC2022 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.8.1 MSVC2022 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.681.win64_msvc2022_64_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_1_MSVC2022_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_1_MSVC2022_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:\Projects\Qt\XPlor\build\Desktop_Qt_6_8_1_MSVC2022_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_1_MSVC2022_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">G:/Projects/Qt/XPlor/app/app.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_1_MSVC2022_64bit-Debug/app</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">G:/Projects/Qt/XPlor/tests/tests.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">G:/Projects/Qt/XPlor/build/Desktop_Qt_6_8_1_MSVC2022_64bit-Debug/tests</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">3</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

View File

@ -73,6 +73,7 @@ app.depends += \
LIBS += \ LIBS += \
-L$$PWD/../third_party/devil_sdk/lib/ -lDevIL -lILU -lILUT \ -L$$PWD/../third_party/devil_sdk/lib/ -lDevIL -lILU -lILUT \
-L$$PWD/../third_party/zlib/lib/ -lzlib \ -L$$PWD/../third_party/zlib/lib/ -lzlib \
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64 \
-L$$OUT_PWD/../libs/ -lcore \ -L$$OUT_PWD/../libs/ -lcore \
-L$$OUT_PWD/../libs/ -lcompression \ -L$$OUT_PWD/../libs/ -lcompression \
-L$$OUT_PWD/../libs/ -lencryption \ -L$$OUT_PWD/../libs/ -lencryption \
@ -85,6 +86,7 @@ LIBS += \
INCLUDEPATH += \ INCLUDEPATH += \
$$PWD/../third_party/devil_sdk/include/ \ $$PWD/../third_party/devil_sdk/include/ \
$$PWD/../third_party/zlib/include \ $$PWD/../third_party/zlib/include \
$$PWD/../third_party/xbox_sdk/include \
$$PWD/../libs/core \ $$PWD/../libs/core \
$$PWD/../libs/compression \ $$PWD/../libs/compression \
$$PWD/../libs/encryption \ $$PWD/../libs/encryption \
@ -97,6 +99,7 @@ INCLUDEPATH += \
DEPENDPATH += \ DEPENDPATH += \
$$PWD/../third_party/devil_sdk/include/ \ $$PWD/../third_party/devil_sdk/include/ \
$$PWD/../third_party/zlib/include \ $$PWD/../third_party/zlib/include \
$$PWD/../third_party/xbox_sdk/include \
$$PWD/../libs/core \ $$PWD/../libs/core \
$$PWD/../libs/compression \ $$PWD/../libs/compression \
$$PWD/../libs/encryption \ $$PWD/../libs/encryption \
@ -108,6 +111,12 @@ DEPENDPATH += \
# Copy DLLs to Debug folder # Copy DLLs to Debug folder
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t) QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/zlib/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/xna/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
# Copy DLLs to Release folder # Copy DLLs to Release folder
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t) QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/zlib/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/xna/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)

View File

@ -755,7 +755,7 @@ int MainWindow::LoadFile_IPAK(const QString aFilePath) {
QString outputFilePath = outputFolder.filePath(QString("%1.iwi").arg(j)); QString outputFilePath = outputFolder.filePath(QString("%1.iwi").arg(j));
if (command.compressed) { if (command.compressed) {
data = Compression::DecompressLZO(data); //data = Compression::DecompressLZO(data);
} }
QFile outputFile(outputFilePath); QFile outputFile(outputFilePath);
if (!outputFile.open(QIODevice::WriteOnly)) { if (!outputFile.open(QIODevice::WriteOnly)) {
@ -872,7 +872,7 @@ void MainWindow::dropEvent(QDropEvent *event) {
qDebug() << "LZO: Failed to read file!"; qDebug() << "LZO: Failed to read file!";
continue; continue;
} }
QByteArray data = Compression::DecompressLZO(lzoFile.readAll()); QByteArray data;// = Compression::DecompressLZO(lzoFile.readAll());
lzoFile.close(); lzoFile.close();
if (data.isEmpty()) { if (data.isEmpty()) {

View File

@ -1,37 +1,117 @@
#include "compression.h" #include "compression.h"
#include "lzokay.h" //#include "lzokay.h"
#include "qlibrary.h"
#define XBOXAPI __declspec(dllimport)
#include "xcompress.h"
#include <QLibrary>
#include <QDebug>
#include <QFile>
#include <QDataStream>
QByteArray Compression::CompressXMem(const QByteArray &data)
{
XMEMCODEC_PARAMETERS_LZX lzxParams = {};
lzxParams.Flags = 0;
lzxParams.WindowSize = XCOMPRESS_LZX_BLOCK_SIZE;
lzxParams.CompressionPartitionSize = XCOMPRESS_LZX_BLOCK_SIZE;
XMEMCOMPRESSION_CONTEXT ctx = nullptr;
if (FAILED(XMemCreateCompressionContext(XMEMCODEC_LZX, &lzxParams, 0, &ctx)) || !ctx)
return QByteArray();
SIZE_T estimatedSize = data.size() + XCOMPRESS_LZX_BLOCK_GROWTH_SIZE_MAX;
QByteArray output(static_cast<int>(estimatedSize), 0);
SIZE_T actualSize = estimatedSize;
HRESULT hr = XMemCompress(ctx, output.data(), &actualSize, data.constData(), data.size());
XMemDestroyCompressionContext(ctx);
if (FAILED(hr))
return QByteArray();
output.resize(static_cast<int>(actualSize));
return output;
}
QByteArray Compression::DecompressXMem(const QByteArray &data)
{
XMEMCODEC_PARAMETERS_LZX lzxParams = {};
lzxParams.Flags = 0;
lzxParams.WindowSize = XCOMPRESS_LZX_BLOCK_SIZE;
lzxParams.CompressionPartitionSize = XCOMPRESS_LZX_BLOCK_SIZE;
XMEMDECOMPRESSION_CONTEXT ctx = nullptr;
if (FAILED(XMemCreateDecompressionContext(XMEMCODEC_LZX, &lzxParams, 0, &ctx)) || !ctx)
return QByteArray();
QByteArray output(data.size(), 0);
SIZE_T actualSize = data.size();
HRESULT hr = XMemDecompress(ctx, output.data(), &actualSize, data.constData(), data.size());
XMemDestroyDecompressionContext(ctx);
if (FAILED(hr))
return QByteArray();
output.resize(static_cast<int>(actualSize));
return output;
}
quint32 Compression::CalculateAdler32Checksum(const QByteArray &data) {
// Start with the initial value for Adler-32
quint32 adler = adler32(0L, Z_NULL, 0);
// Calculate Adler-32 checksum
adler = adler32(adler, reinterpret_cast<const Bytef *>(data.constData()), data.size());
return adler;
}
QByteArray Compression::DecompressZLIB(const QByteArray &aCompressedData) { QByteArray Compression::DecompressZLIB(const QByteArray &aCompressedData) {
if (aCompressedData.isEmpty()) if (aCompressedData.isEmpty()) {
return {}; return {};
}
z_stream strm{}; z_stream strm{};
strm.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(aCompressedData.data())); strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = static_cast<uInt>(aCompressedData.size()); strm.avail_in = static_cast<uInt>(aCompressedData.size());
strm.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(aCompressedData.data()));
if (inflateInit2(&strm, MAX_WBITS) != Z_OK) { if (inflateInit2(&strm, MAX_WBITS) != Z_OK) {
qWarning() << "Failed to initialize zlib for decompression."; qWarning() << "inflateInit2 failed";
return {}; return {};
} }
QByteArray decompressed; QByteArray decompressed;
char buffer[4096]; QByteArray buffer(fmin(strm.avail_in * 2, 4096), Qt::Uninitialized);
int ret; int ret;
do { do {
strm.next_out = reinterpret_cast<Bytef*>(buffer); strm.next_out = reinterpret_cast<Bytef*>(buffer.data());
strm.avail_out = sizeof(buffer); strm.avail_out = buffer.size();
ret = inflate(&strm, Z_NO_FLUSH); ret = inflate(&strm, Z_NO_FLUSH);
if (ret != Z_OK && ret != Z_STREAM_END) { if (strm.avail_out < buffer.size()) { // Data has been written to the buffer
qWarning() << "Zlib decompression error:" << zError(ret); decompressed.append(buffer.constData(), buffer.size() - strm.avail_out);
inflateEnd(&strm);
return {};
} }
decompressed.append(buffer, sizeof(buffer) - strm.avail_out); if (ret == Z_STREAM_END) {
break; // Proper end of the data stream
}
if (ret == Z_BUF_ERROR && strm.avail_out == 0) {
// Buffer was completely used, resize it
int newSize = buffer.size() * 2; // Double the buffer size
buffer.resize(newSize);
} else if (ret != Z_OK) {
qWarning() << "Zlib error:" << zError(ret);
inflateEnd(&strm);
return {}; // Return on other errors
}
} while (ret != Z_STREAM_END); } while (ret != Z_STREAM_END);
inflateEnd(&strm); inflateEnd(&strm);
@ -123,6 +203,8 @@ QByteArray Compression::CompressDeflate(const QByteArray &aData) {
} }
QByteArray Compression::CompressDeflateWithSettings(const QByteArray &aData, int aCompressionLevel, int aWindowBits, int aMemLevel, int aStrategy, const QByteArray &aDictionary) { QByteArray Compression::CompressDeflateWithSettings(const QByteArray &aData, int aCompressionLevel, int aWindowBits, int aMemLevel, int aStrategy, const QByteArray &aDictionary) {
Q_UNUSED(aDictionary);
if (aData.isEmpty()) if (aData.isEmpty())
return QByteArray(); return QByteArray();
@ -158,7 +240,6 @@ QByteArray Compression::CompressDeflateWithSettings(const QByteArray &aData, int
deflateEnd(&strm); deflateEnd(&strm);
return compressed; return compressed;
} }
QByteArray Compression::DecompressOodle(const QByteArray &aCompressedData, quint32 aDecompressedSize) { QByteArray Compression::DecompressOodle(const QByteArray &aCompressedData, quint32 aDecompressedSize) {
@ -166,10 +247,9 @@ QByteArray Compression::DecompressOodle(const QByteArray &aCompressedData, quint
} }
QByteArray Compression::CompressOodle(const QByteArray &aData) { QByteArray Compression::CompressOodle(const QByteArray &aData) {
quint32 maxSize = pGetOodleCompressedBounds(aData.length()); quint32 maxSize = pGetOodleCompressedBounds(aData.length());
QByteArray compressedData = pCompressOodle(aData, aData.length(), QByteArray compressedData = pCompressOodle(aData, aData.length(),
maxSize, OodleFormat::Kraken, OodleCompressionLevel::Optimal5); maxSize, OodleFormat::Kraken, OodleCompressionLevel::Optimal5);
return compressedData.mid(0, maxSize); return compressedData.mid(0, maxSize);
} }
@ -225,168 +305,3 @@ QByteArray Compression::pDecompressOodle(QByteArray aBuffer, quint32 aBufferSize
return QByteArray(reinterpret_cast<const char*>(outputBuffer), aOutputBufferSize); return QByteArray(reinterpret_cast<const char*>(outputBuffer), aOutputBufferSize);
} }
QByteArray Compression::DecompressLZO(const QByteArray &aCompressedData) {
lzokay::EResult error;
// Ensure the input QByteArray is valid
if (aCompressedData.isEmpty()) {
qDebug() << "Input QByteArray is empty.";
return QByteArray();
}
// Step 1: Cast QByteArray to uint8_t*
const uint8_t *compressedData = reinterpret_cast<const uint8_t *>(aCompressedData.constData());
std::size_t compressedSize = static_cast<std::size_t>(aCompressedData.size());
// Step 2: Allocate a sufficiently large decompression buffer
// Use a large initial estimate if the decompressed size is unknown
std::size_t initialBufferSize = compressedSize * 20; // Arbitrary multiplier for decompression
std::unique_ptr<uint8_t[]> decompressed(new uint8_t[initialBufferSize]);
// Step 3: Attempt decompression
std::size_t decompressedSize = 0;
error = lzokay::decompress(
compressedData, compressedSize, // Input data and size
decompressed.get(), initialBufferSize, // Output buffer and initial size
decompressedSize // Actual decompressed size
);
// Step 4: Handle decompression errors
if (error != lzokay::EResult::Success) {
qDebug() << "Decompression failed with error code:" << static_cast<int>(error);
return QByteArray();
}
// Step 5: Return the decompressed data as a QByteArray
return QByteArray(reinterpret_cast<const char *>(decompressed.get()), decompressedSize);
}
QByteArray Compression::CompressLZO(const QByteArray &aData) {
lzokay::EResult error;
// Check input validity
if (aData.isEmpty()) {
qDebug() << "Input QByteArray is empty.";
return QByteArray();
}
// Step 1: Cast QByteArray to uint8_t*
const uint8_t *uncompressedData = reinterpret_cast<const uint8_t *>(aData.constData());
std::size_t uncompressedSize = static_cast<std::size_t>(aData.size());
// Step 2: Allocate output buffer with sufficient size (compressBound-like estimation)
std::size_t maxCompressedSize = uncompressedSize + uncompressedSize / 16 + 64 + 3; // Safe estimation
std::unique_ptr<uint8_t[]> compressed(new uint8_t[maxCompressedSize]);
// Step 3: Compress data
std::size_t compressedSize = 0;
error = lzokay::compress(
uncompressedData, uncompressedSize, // Input data
compressed.get(), maxCompressedSize, // Output buffer
compressedSize // Actual compressed size
);
// Step 4: Handle compression errors
if (error != lzokay::EResult::Success) {
qDebug() << "Compression failed with error code:" << static_cast<int>(error);
return QByteArray();
}
// Step 5: Return compressed data as QByteArray
return QByteArray(reinterpret_cast<const char *>(compressed.get()), compressedSize);
}
QByteArray Compression::DecompressLZX(const QByteArray &compressedData, uint32_t windowBits)
{
if (compressedData.isEmpty())
return QByteArray();
// Calculate sliding window size.
const uint32_t windowSize = 1u << windowBits;
std::vector<uint8_t> window(windowSize, 0);
uint32_t windowPos = 0;
// Use a dynamic output buffer.
QByteArray outArray;
// Reserve an initial capacity.
outArray.reserve(1024);
// --- Bitstream state ---
const uint8_t *inData = reinterpret_cast<const uint8_t*>(compressedData.constData());
size_t inSize = compressedData.size();
size_t inPos = 0;
uint32_t bitBuffer = 0;
int bitsInBuffer = 0;
// Lambda: Ensure at least 'count' bits are available.
auto ensureBits = [&](int count) -> bool {
while (bitsInBuffer < count) {
if (inPos < inSize) {
bitBuffer = (bitBuffer << 8) | inData[inPos++];
bitsInBuffer += 8;
} else {
return false;
}
}
return true;
};
// Lambda: Get (and remove) 'count' bits from the bit buffer.
auto getBits = [&](int count) -> uint32_t {
if (!ensureBits(count))
return 0;
uint32_t result = (bitBuffer >> (bitsInBuffer - count)) & ((1u << count) - 1);
bitsInBuffer -= count;
return result;
};
// --- Main decompression loop ---
// In this simplified placeholder format:
// - A flag bit of 1 means a literal byte follows (8 bits).
// - A flag bit of 0 means a match follows: first 4 bits for match length (plus base 2)
// then windowBits bits for the match offset (relative to the current sliding window).
while (true) {
// Try to read a flag bit; if not available, we assume the stream is complete.
if (!ensureBits(1))
break;
uint32_t flag = getBits(1);
if (flag == 1) {
// Literal: next 8 bits form a literal byte.
if (!ensureBits(8)) {
qWarning() << "Unexpected end of input while reading literal.";
break;
}
uint8_t literal = static_cast<uint8_t>(getBits(8));
outArray.append(static_cast<char>(literal));
// Update the sliding window.
window[windowPos] = literal;
windowPos = (windowPos + 1) % windowSize;
} else {
// Match: first read a 4-bit match length (with a base of 2).
if (!ensureBits(4)) {
qWarning() << "Unexpected end of input while reading match length.";
break;
}
uint32_t matchLength = getBits(4) + 2;
// Then read the match offset (fixed number of bits equals windowBits).
if (!ensureBits(windowBits)) {
qWarning() << "Unexpected end of input while reading match offset.";
break;
}
uint32_t matchOffset = getBits(windowBits);
// Compute the source position in the sliding window.
uint32_t copyPos = (windowPos + windowSize - matchOffset) % windowSize;
// Copy matchLength bytes from the sliding window.
for (uint32_t i = 0; i < matchLength; i++) {
uint8_t byte = window[(copyPos + i) % windowSize];
outArray.append(static_cast<char>(byte));
// Update the sliding window with the decompressed byte.
window[windowPos] = byte;
windowPos = (windowPos + 1) % windowSize;
}
}
}
return outArray;
}

View File

@ -3,13 +3,12 @@
#include "QtZlib/zlib.h" #include "QtZlib/zlib.h"
#include <windows.h>
#include <QtGlobal>
#include <stddef.h> #include <stddef.h>
#include <QByteArray> #include <QByteArray>
#include <QDebug>
#include <QDataStream>
#include <QVector> #include <QVector>
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QFile>
enum OodleFormat { enum OodleFormat {
LZH = 0, LZH = 0,
@ -46,6 +45,7 @@ typedef int (*OodleLZ_DecompressFunc)(std::byte* Buffer, long BufferSize, std::b
class Compression { class Compression {
public: public:
static quint32 CalculateAdler32Checksum(const QByteArray &data);
static QByteArray DecompressZLIB(const QByteArray &aCompressedData); static QByteArray DecompressZLIB(const QByteArray &aCompressedData);
static QByteArray CompressZLIB(const QByteArray &aData); static QByteArray CompressZLIB(const QByteArray &aData);
static QByteArray CompressZLIBWithSettings(const QByteArray &aData, static QByteArray CompressZLIBWithSettings(const QByteArray &aData,
@ -58,19 +58,18 @@ public:
static QByteArray DecompressDeflate(const QByteArray &aCompressedData); static QByteArray DecompressDeflate(const QByteArray &aCompressedData);
static QByteArray CompressDeflate(const QByteArray &aData); static QByteArray CompressDeflate(const QByteArray &aData);
static QByteArray CompressDeflateWithSettings(const QByteArray &aData, static QByteArray CompressDeflateWithSettings(const QByteArray &aData,
int aCompressionLevel = Z_BEST_COMPRESSION, int aCompressionLevel = Z_BEST_COMPRESSION,
int aWindowBits = MAX_WBITS, int aWindowBits = MAX_WBITS,
int aMemLevel = 8, int aMemLevel = 8,
int aStrategy = Z_DEFAULT_STRATEGY, int aStrategy = Z_DEFAULT_STRATEGY,
const QByteArray &aDictionary = {}); const QByteArray &aDictionary = {});
static QByteArray DecompressOodle(const QByteArray &aCompressedData, quint32 aDecompressedSize); static QByteArray DecompressOodle(const QByteArray &aCompressedData, quint32 aDecompressedSize);
static QByteArray CompressOodle(const QByteArray &aData); static QByteArray CompressOodle(const QByteArray &aData);
static QByteArray DecompressLZO(const QByteArray& aCompressedData);
static QByteArray CompressLZO(const QByteArray& aData);
static QByteArray DecompressLZX(const QByteArray &compressedData, uint32_t windowBits = 15); static QByteArray CompressXMem(const QByteArray &data);
static QByteArray DecompressXMem(const QByteArray &data);
private: private:
static quint32 pGetOodleCompressedBounds(quint32 aBufferSize); static quint32 pGetOodleCompressedBounds(quint32 aBufferSize);

View File

@ -11,14 +11,17 @@ HEADERS += \
lzokay.h lzokay.h
LIBS += \ LIBS += \
-L$$PWD/../../third_party/xbox_sdk/lib -lxcompress64 \
-L$$OUT_PWD/../libs/core -lcore \ -L$$OUT_PWD/../libs/core -lcore \
-L$$OUT_PWD/../libs/encryption -lencryption -L$$OUT_PWD/../libs/encryption -lencryption
INCLUDEPATH += \ INCLUDEPATH += \
$$PWD/../../third_party/xbox_sdk/include \
$$PWD/../core \ $$PWD/../core \
$$PWD/../encryption $$PWD/../encryption
DEPENDPATH += \ DEPENDPATH += \
$$PWD/../../third_party/xbox_sdk/include \
$$PWD/../core \ $$PWD/../core \
$$PWD/../encryption $$PWD/../encryption

View File

@ -65,25 +65,25 @@ std::size_t offset; \
{ \ { \
std::size_t l; \ std::size_t l; \
for (l = length; l > 255; l -= 255) { *outp++ = 0; } \ for (l = length; l > 255; l -= 255) { *outp++ = 0; } \
*outp++ = l; \ *outp++ = static_cast<uint8_t>(l); \
} }
constexpr uint32_t M1MaxOffset = 0x0400; constexpr uint32_t M1MaxOffset = 0x0400;
constexpr uint32_t M2MaxOffset = 0x0800; constexpr uint32_t M2MaxOffset = 0x0800;
constexpr uint32_t M3MaxOffset = 0x4000; constexpr uint32_t M3MaxOffset = 0x4000;
constexpr uint32_t M4MaxOffset = 0xbfff; // constexpr uint32_t M4MaxOffset = 0xbfff;
constexpr uint32_t M1MinLen = 2; // constexpr uint32_t M1MinLen = 2;
constexpr uint32_t M1MaxLen = 2; // constexpr uint32_t M1MaxLen = 2;
constexpr uint32_t M2MinLen = 3; constexpr uint32_t M2MinLen = 3;
constexpr uint32_t M2MaxLen = 8; constexpr uint32_t M2MaxLen = 8;
constexpr uint32_t M3MinLen = 3; // constexpr uint32_t M3MinLen = 3;
constexpr uint32_t M3MaxLen = 33; constexpr uint32_t M3MaxLen = 33;
constexpr uint32_t M4MinLen = 3; // constexpr uint32_t M4MinLen = 3;
constexpr uint32_t M4MaxLen = 9; constexpr uint32_t M4MaxLen = 9;
constexpr uint32_t M1Marker = 0x0; constexpr uint32_t M1Marker = 0x0;
constexpr uint32_t M2Marker = 0x40; // constexpr uint32_t M2Marker = 0x40;
constexpr uint32_t M3Marker = 0x20; constexpr uint32_t M3Marker = 0x20;
constexpr uint32_t M4Marker = 0x10; constexpr uint32_t M4Marker = 0x10;

View File

@ -1,6 +1,4 @@
#ifndef LZOKAY_H #pragma once
#define LZOKAY_H
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
@ -79,5 +77,3 @@ constexpr std::size_t compress_worst_size(std::size_t s) {
} }
} }
#endif // LZOKAY_H

View File

@ -5,6 +5,7 @@ Public domain.
*/ */
#include "ecrypt-sync.h" #include "ecrypt-sync.h"
#include "qtpreprocessorsupport.h"
#define ROTATE(v,c) (ROTL32(v,c)) #define ROTATE(v,c) (ROTL32(v,c))
#define XOR(v,w) ((v) ^ (w)) #define XOR(v,w) ((v) ^ (w))
@ -21,6 +22,7 @@ static const char tau[17] = "expand 16-byte k";
void ECRYPT_keysetup(ECRYPT_ctx *x,const u8 *k,u32 kbits,u32 ivbits) void ECRYPT_keysetup(ECRYPT_ctx *x,const u8 *k,u32 kbits,u32 ivbits)
{ {
Q_UNUSED(ivbits);
const char *constants; const char *constants;
x->input[1] = U8TO32_LITTLE(k + 0); x->input[1] = U8TO32_LITTLE(k + 0);

View File

@ -207,8 +207,8 @@ void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len)
#endif #endif
j = (context->count[0] >> 3) & 63; j = (context->count[0] >> 3) & 63;
if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; if ((context->count[0] += static_cast<uint32_t>(len << 3)) < (len << 3)) context->count[1]++;
context->count[1] += (len >> 29); context->count[1] += static_cast<uint32_t>(len >> 29);
if ((j + len) > 63) { if ((j + len) > 63) {
memcpy(&context->buffer[j], data, (i = 64-j)); memcpy(&context->buffer[j], data, (i = 64-j));
SHA1_Transform(context->state, context->buffer); SHA1_Transform(context->state, context->buffer);

View File

@ -180,11 +180,11 @@ bool IWIFile::SaveIWI() {
// Determine number of mipmaps based on version // Determine number of mipmaps based on version
QVector<qint32> offsets((header.Version == 0x1B) ? 8 : 4); QVector<qint32> offsets((header.Version == 0x1B) ? 8 : 4);
qint32 currentOffset = file.pos() + (offsets.size() * sizeof(qint32)); size_t currentOffset = file.pos() + (offsets.size() * sizeof(qint32));
// Compute offsets // Compute offsets
for (int i = 0; i < offsets.size(); i++) { for (int i = 0; i < offsets.size(); i++) {
offsets[i] = currentOffset; offsets[i] = static_cast<qint32>(currentOffset);
if (mipmaps.size() && i < mipmaps.size()) { if (mipmaps.size() && i < mipmaps.size()) {
currentOffset += mipmaps[i].size; currentOffset += mipmaps[i].size;
} }

10
libs/libs.pro Normal file
View File

@ -0,0 +1,10 @@
TEMPLATE = subdirs
SUBDIRS += core \
compression \
encryption \
fastfile \
zonefile \
ddsfile \
iwifile \
ipakfile

View File

@ -32,6 +32,8 @@ bool ZoneFile_COD2::Load(const QByteArray aFileData, FF_PLATFORM aPlatform) {
} }
void ZoneFile_COD2::pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) { void ZoneFile_COD2::pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) {
Q_UNUSED(aPlatform);
SetTagCount(pParseZoneTagCount(aZoneFileStream)); SetTagCount(pParseZoneTagCount(aZoneFileStream));
pParseZoneUnknownsB(aZoneFileStream); pParseZoneUnknownsB(aZoneFileStream);
pParseZoneUnknownsC(aZoneFileStream); pParseZoneUnknownsC(aZoneFileStream);

View File

@ -31,6 +31,8 @@ bool ZoneFile_COD5::Load(const QByteArray aFileData, FF_PLATFORM aPlatform) {
} }
void ZoneFile_COD5::pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) { void ZoneFile_COD5::pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) {
Q_UNUSED(aPlatform);
SetSize(pParseZoneSize(aZoneFileStream)); SetSize(pParseZoneSize(aZoneFileStream));
pParseZoneUnknownsA(aZoneFileStream); pParseZoneUnknownsA(aZoneFileStream);

View File

@ -32,6 +32,8 @@ bool ZoneFile_COD9::Load(const QByteArray aFileData, FF_PLATFORM aPlatform) {
} }
void ZoneFile_COD9::pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) { void ZoneFile_COD9::pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) {
Q_UNUSED(aPlatform);
SetSize(pParseZoneSize(aZoneFileStream)); SetSize(pParseZoneSize(aZoneFileStream));
pParseZoneUnknownsA(aZoneFileStream); pParseZoneUnknownsA(aZoneFileStream);

View File

@ -39,6 +39,8 @@ void AutoTest_COD10_360::testDecompression_data() {
void AutoTest_COD10_360::testDecompression() { void AutoTest_COD10_360::testDecompression() {
QFETCH(QString, fastFilePath_cod10_360); QFETCH(QString, fastFilePath_cod10_360);
const QString testName = "Decompress: " + fastFilePath_cod10_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod10_360); QFile testFastFile(fastFilePath_cod10_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), QVERIFY2(testFastFile.open(QIODevice::ReadOnly),

View File

@ -39,6 +39,8 @@ void AutoTest_COD11_360::testDecompression_data() {
void AutoTest_COD11_360::testDecompression() { void AutoTest_COD11_360::testDecompression() {
QFETCH(QString, fastFilePath_cod11_360); QFETCH(QString, fastFilePath_cod11_360);
const QString testName = "Decompress: " + fastFilePath_cod11_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod11_360); QFile testFastFile(fastFilePath_cod11_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), QVERIFY2(testFastFile.open(QIODevice::ReadOnly),

View File

@ -39,9 +39,15 @@ void AutoTest_COD12_360::testDecompression_data() {
void AutoTest_COD12_360::testDecompression() { void AutoTest_COD12_360::testDecompression() {
QFETCH(QString, fastFilePath_cod12_360); QFETCH(QString, fastFilePath_cod12_360);
const QString testName = "Decompress: " + fastFilePath_cod12_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod12_360); QFile testFastFile(fastFilePath_cod12_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), bool fastFileOpened = testFastFile.open(QIODevice::ReadOnly);
if (!fastFileOpened) {
recordResult(testName, false);
}
QVERIFY2(fastFileOpened,
qPrintable("Failed to open test fastfile: " + fastFilePath_cod12_360)); qPrintable("Failed to open test fastfile: " + fastFilePath_cod12_360));
const QByteArray testFFData = testFastFile.readAll(); const QByteArray testFFData = testFastFile.readAll();
testFastFile.close(); testFastFile.close();
@ -55,7 +61,11 @@ void AutoTest_COD12_360::testDecompression() {
zoneStream.setByteOrder(QDataStream::LittleEndian); zoneStream.setByteOrder(QDataStream::LittleEndian);
quint32 zoneSize; quint32 zoneSize;
zoneStream >> zoneSize; zoneStream >> zoneSize;
QVERIFY2(zoneSize + 44 == testZoneData.size(), bool sizeMatches = zoneSize + 44 == testZoneData.size();
if (!sizeMatches) {
recordResult(testName, false);
}
QVERIFY2(sizeMatches,
qPrintable("Decompression validation failed for: " + fastFilePath_cod12_360)); qPrintable("Decompression validation failed for: " + fastFilePath_cod12_360));
// Write the decompressed zone data to the exports folder with a .zone extension. // Write the decompressed zone data to the exports folder with a .zone extension.
@ -63,8 +73,12 @@ void AutoTest_COD12_360::testDecompression() {
QString outputFileName = fi.completeBaseName() + ".zone"; QString outputFileName = fi.completeBaseName() + ".zone";
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName); QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
QFile outputFile(outputFilePath); QFile outputFile(outputFilePath);
QVERIFY2(outputFile.open(QIODevice::WriteOnly), bool zoneFileOpened = outputFile.open(QIODevice::WriteOnly);
qPrintable("Failed to open output file for writing: " + outputFilePath)); if (!zoneFileOpened) {
recordResult(testName, false);
}
QVERIFY2(zoneFileOpened,
qPrintable("Failed to open output zone file for writing: " + outputFilePath));
outputFile.write(testZoneData); outputFile.write(testZoneData);
outputFile.close(); outputFile.close();
} }

View File

@ -39,10 +39,16 @@ void AutoTest_COD2_360::testDecompression_data() {
void AutoTest_COD2_360::testDecompression() { void AutoTest_COD2_360::testDecompression() {
QFETCH(QString, fastFilePath_cod2_360); QFETCH(QString, fastFilePath_cod2_360);
const QString testName = "Decompress: " + fastFilePath_cod2_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod2_360); QFile testFastFile(fastFilePath_cod2_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), bool fastFileOpened = testFastFile.open(QIODevice::ReadOnly);
qPrintable("Failed to open test fastfile: " + fastFilePath_cod2_360)); if (!fastFileOpened) {
recordResult(testName, false);
}
QVERIFY2(fastFileOpened
, qPrintable("Failed to open test fastfile: " + fastFilePath_cod2_360));
const QByteArray testFFData = testFastFile.readAll(); const QByteArray testFFData = testFastFile.readAll();
testFastFile.close(); testFastFile.close();
@ -64,10 +70,16 @@ void AutoTest_COD2_360::testDecompression() {
QString outputFileName = fi.completeBaseName() + ".zone"; QString outputFileName = fi.completeBaseName() + ".zone";
QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName); QString outputFilePath = QDir(EXPORT_DIR).filePath(outputFileName);
QFile outputFile(outputFilePath); QFile outputFile(outputFilePath);
QVERIFY2(outputFile.open(QIODevice::WriteOnly), bool zoneFileOpened = outputFile.open(QIODevice::WriteOnly);
qPrintable("Failed to open output file for writing: " + outputFilePath)); if (!zoneFileOpened) {
recordResult(testName, false);
}
QVERIFY2(zoneFileOpened,
qPrintable("Failed to open output zone file for writing: " + outputFilePath));
outputFile.write(testZoneData); outputFile.write(testZoneData);
outputFile.close(); outputFile.close();
recordResult(testName, true);
} }
void AutoTest_COD2_360::testCompression_data() { void AutoTest_COD2_360::testCompression_data() {
@ -83,8 +95,14 @@ void AutoTest_COD2_360::testCompression_data() {
void AutoTest_COD2_360::testCompression() { void AutoTest_COD2_360::testCompression() {
QFETCH(QString, zoneFilePath_cod2_360); QFETCH(QString, zoneFilePath_cod2_360);
const QString testName = "Compress: " + zoneFilePath_cod2_360;
QFile zoneFile(zoneFilePath_cod2_360); QFile zoneFile(zoneFilePath_cod2_360);
QVERIFY2(zoneFile.open(QIODevice::ReadOnly), qPrintable("Failed to open zone file: " + zoneFilePath_cod2_360)); bool zoneFileOpened = zoneFile.open(QIODevice::ReadOnly);
if (!zoneFileOpened) {
recordResult(testName, false);
}
QVERIFY2(zoneFileOpened, qPrintable("Failed to open zone file: " + zoneFilePath_cod2_360));
QByteArray decompressedData = zoneFile.readAll(); QByteArray decompressedData = zoneFile.readAll();
zoneFile.close(); zoneFile.close();
@ -92,7 +110,11 @@ void AutoTest_COD2_360::testCompression() {
QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff"); QString originalFFPath = QDir(getFastFileDirectory()).filePath(fi.completeBaseName() + ".ff");
QFile originalFile(originalFFPath); QFile originalFile(originalFFPath);
QVERIFY2(originalFile.open(QIODevice::ReadOnly), qPrintable("Failed to open original .ff file: " + originalFFPath)); bool origFileOpened = originalFile.open(QIODevice::ReadOnly);
if (!origFileOpened) {
recordResult(testName, false);
}
QVERIFY2(origFileOpened, qPrintable("Failed to open original .ff file: " + originalFFPath));
QByteArray originalFFData = originalFile.readAll(); QByteArray originalFFData = originalFile.readAll();
originalFile.close(); originalFile.close();
@ -105,11 +127,21 @@ void AutoTest_COD2_360::testCompression() {
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff"); QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");
QFile recompressedFile(recompressedFilePath); QFile recompressedFile(recompressedFilePath);
QVERIFY2(recompressedFile.open(QIODevice::WriteOnly), qPrintable("Failed to write recompressed file.")); bool fastFileOpened = recompressedFile.open(QIODevice::WriteOnly);
if (!fastFileOpened) {
recordResult(testName, false);
}
QVERIFY2(fastFileOpened, qPrintable("Failed to write recompressed file."));
recompressedFile.write(recompressedData); recompressedFile.write(recompressedData);
recompressedFile.close(); recompressedFile.close();
bool dataMatches = recompressedData == originalFFData;
if (!dataMatches) {
recordResult(testName, false);
}
QCOMPARE(recompressedData, originalFFData); QCOMPARE(recompressedData, originalFFData);
recordResult(testName, true);
} }
void AutoTest_COD2_360::cleanupTestCase() { void AutoTest_COD2_360::cleanupTestCase() {

View File

@ -39,6 +39,8 @@ void AutoTest_COD4_360::testDecompression_data() {
void AutoTest_COD4_360::testDecompression() { void AutoTest_COD4_360::testDecompression() {
QFETCH(QString, fastFilePath_cod4_360); QFETCH(QString, fastFilePath_cod4_360);
const QString testName = "Decompress: " + fastFilePath_cod4_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod4_360); QFile testFastFile(fastFilePath_cod4_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
@ -46,6 +48,10 @@ void AutoTest_COD4_360::testDecompression() {
const QByteArray testFFData = testFastFile.readAll(); const QByteArray testFFData = testFastFile.readAll();
testFastFile.close(); testFastFile.close();
const QString magic = testFFData.mid(0, 8);
QVERIFY2(magic == "IWffu100",
qPrintable("Does not support encrypted fastfiles!"));
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data. // Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
const QByteArray compressedData = testFFData.mid(12); const QByteArray compressedData = testFFData.mid(12);
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData); const QByteArray testZoneData = Compression::DecompressZLIB(compressedData);
@ -55,7 +61,11 @@ void AutoTest_COD4_360::testDecompression() {
zoneStream.setByteOrder(QDataStream::BigEndian); zoneStream.setByteOrder(QDataStream::BigEndian);
quint32 zoneSize; quint32 zoneSize;
zoneStream >> zoneSize; zoneStream >> zoneSize;
QVERIFY2(zoneSize + 36 == testZoneData.size(), if (abs(zoneSize - testZoneData.size()) != 36) {
qDebug() << "Zone Size: " << zoneSize;
qDebug() << "Test zone Size: " << testZoneData.size();
}
QVERIFY2(abs(zoneSize - testZoneData.size()) == 36,
qPrintable("Decompression validation failed for: " + fastFilePath_cod4_360)); qPrintable("Decompression validation failed for: " + fastFilePath_cod4_360));
// Write the decompressed zone data to the exports folder with a .zone extension. // Write the decompressed zone data to the exports folder with a .zone extension.

View File

@ -38,6 +38,9 @@ void AutoTest_COD5_360::testDecompression_data() {
void AutoTest_COD5_360::testDecompression() { void AutoTest_COD5_360::testDecompression() {
QFETCH(QString, fastFilePath_cod5_360); QFETCH(QString, fastFilePath_cod5_360);
return;
const QString testName = "Decompress: " + fastFilePath_cod5_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod5_360); QFile testFastFile(fastFilePath_cod5_360);
@ -52,10 +55,15 @@ void AutoTest_COD5_360::testDecompression() {
// Verify the decompressed data via its embedded zone size. // Verify the decompressed data via its embedded zone size.
QDataStream zoneStream(testZoneData); QDataStream zoneStream(testZoneData);
zoneStream.setByteOrder(QDataStream::LittleEndian); zoneStream.setByteOrder(QDataStream::BigEndian);
quint32 zoneSize; quint32 zoneSize;
zoneStream >> zoneSize; zoneStream >> zoneSize;
QVERIFY2(zoneSize + 44 == testZoneData.size(), if (abs(zoneSize - testZoneData.size()) != 36) {
qDebug() << "Zone Size: " << zoneSize;
qDebug() << "Test zone Size: " << testZoneData.size();
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
}
QVERIFY2(zoneSize + 36 == testZoneData.size(),
qPrintable("Decompression validation failed for: " + fastFilePath_cod5_360)); qPrintable("Decompression validation failed for: " + fastFilePath_cod5_360));
// Write the decompressed zone data to the exports folder with a .zone extension. // Write the decompressed zone data to the exports folder with a .zone extension.
@ -98,7 +106,7 @@ void AutoTest_COD5_360::testCompression() {
QByteArray header = originalFFData.left(12); QByteArray header = originalFFData.left(12);
QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION); QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION);
newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {}); newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_SPEED, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {});
int remainder = (newCompressedData.size() + 12) % 32; int remainder = (newCompressedData.size() + 12) % 32;
if (remainder != 0) { if (remainder != 0) {

View File

@ -39,6 +39,8 @@ void AutoTest_COD6_360::testDecompression_data() {
void AutoTest_COD6_360::testDecompression() { void AutoTest_COD6_360::testDecompression() {
QFETCH(QString, fastFilePath_cod6_360); QFETCH(QString, fastFilePath_cod6_360);
const QString testName = "Decompress: " + fastFilePath_cod6_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod6_360); QFile testFastFile(fastFilePath_cod6_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
@ -46,16 +48,40 @@ void AutoTest_COD6_360::testDecompression() {
const QByteArray testFFData = testFastFile.readAll(); const QByteArray testFFData = testFastFile.readAll();
testFastFile.close(); testFastFile.close();
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data. const QString magic = testFFData.mid(0, 12);
const QByteArray compressedData = testFFData.mid(12); QVERIFY2(magic.contains("IWffu100"),
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData); qPrintable("Encountered signed fastfile: " + magic));
QByteArray pattern;
pattern.append(static_cast<unsigned char>(0x78));
pattern.append(static_cast<unsigned char>(0xDA));
pattern.append(static_cast<unsigned char>(0xEC));
int index = testFFData.indexOf(pattern);
QByteArray compressedData = testFFData.mid(index);
QByteArray testZoneData = Compression::DecompressZLIB(compressedData);
//while (index != -1 && testZoneData.isEmpty()) {
// compressedData = testFFData.mid(index);
// testZoneData = Compression::DecompressZLIB(compressedData);
// index = testFFData.indexOf(pattern, index + 2);
//}
QVERIFY2(!testZoneData.isEmpty(),
qPrintable("Zlib decompression failed!"));
// Verify the decompressed data via its embedded zone size. // Verify the decompressed data via its embedded zone size.
QDataStream zoneStream(testZoneData); QDataStream zoneStream(testZoneData);
zoneStream.setByteOrder(QDataStream::LittleEndian); zoneStream.setByteOrder(QDataStream::BigEndian);
quint32 zoneSize; quint32 zoneSize;
zoneStream >> zoneSize; zoneStream >> zoneSize;
QVERIFY2(zoneSize + 44 == testZoneData.size(), if (abs(zoneSize - testZoneData.size()) != 32) {
qDebug() << "Zone Size: " << zoneSize;
qDebug() << "Test zone Size: " << testZoneData.size();
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
}
QVERIFY2(zoneSize + 32 == testZoneData.size(),
qPrintable("Decompression validation failed for: " + fastFilePath_cod6_360)); qPrintable("Decompression validation failed for: " + fastFilePath_cod6_360));
// Write the decompressed zone data to the exports folder with a .zone extension. // Write the decompressed zone data to the exports folder with a .zone extension.
@ -95,17 +121,18 @@ void AutoTest_COD6_360::testCompression() {
QByteArray originalFFData = originalFile.readAll(); QByteArray originalFFData = originalFile.readAll();
originalFile.close(); originalFile.close();
QByteArray header = originalFFData.left(12); QByteArray pattern;
pattern.append(static_cast<unsigned char>(0x78));
pattern.append(static_cast<unsigned char>(0xDA));
pattern.append(static_cast<unsigned char>(0xEC));
int zlibOffset = originalFFData.indexOf(pattern);
QByteArray header = originalFFData.mid(0, zlibOffset);
QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION); QByteArray newCompressedData;// = Compressor::CompressZLIB(decompressedData, Z_BEST_COMPRESSION);
newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {}); newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_COMPRESSION, MAX_WBITS, 8, Z_DEFAULT_STRATEGY, {});
int remainder = (newCompressedData.size() + 12) % 32;
if (remainder != 0) {
int paddingNeeded = 32 - remainder;
newCompressedData.append(QByteArray(paddingNeeded, '\0'));
}
QByteArray recompressedData = header + newCompressedData; QByteArray recompressedData = header + newCompressedData;
QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff"); QString recompressedFilePath = QDir(EXPORT_DIR).filePath(fi.completeBaseName() + ".ff");

View File

@ -4,6 +4,7 @@
#include "autotest_cod.h" #include "autotest_cod.h"
#include "compression.h" #include "compression.h"
#include "encryption.h"
class AutoTest_COD7_360 : public AutoTest_COD { class AutoTest_COD7_360 : public AutoTest_COD {
Q_OBJECT Q_OBJECT
@ -39,6 +40,8 @@ void AutoTest_COD7_360::testDecompression_data() {
void AutoTest_COD7_360::testDecompression() { void AutoTest_COD7_360::testDecompression() {
QFETCH(QString, fastFilePath_cod7_360); QFETCH(QString, fastFilePath_cod7_360);
const QString testName = "Decompress: " + fastFilePath_cod7_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod7_360); QFile testFastFile(fastFilePath_cod7_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
@ -46,16 +49,77 @@ void AutoTest_COD7_360::testDecompression() {
const QByteArray testFFData = testFastFile.readAll(); const QByteArray testFFData = testFastFile.readAll();
testFastFile.close(); testFastFile.close();
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data. QByteArray decompressedData;
const QByteArray compressedData = testFFData.mid(12); QByteArray key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData);
// Create a QDataStream on the input data.
QDataStream fastFileStream(testFFData);
fastFileStream.setByteOrder(QDataStream::BigEndian);
fastFileStream.skipRawData(16);
// Read the 8-byte magic.
QByteArray fileMagic(8, Qt::Uninitialized);
fastFileStream.readRawData(fileMagic.data(), 8);
QVERIFY2(fileMagic == "PHEEBs71",
qPrintable("Invalid fast file magic: " + fileMagic));
fastFileStream.skipRawData(4);
// Read IV table name (32 bytes).
QByteArray fileName(32, Qt::Uninitialized);
fastFileStream.readRawData(fileName.data(), 32);
// Build the IV table from the fileName.
QByteArray ivTable = Encryption::InitIVTable(fileName);
// Skip the RSA signature (256 bytes).
QByteArray rsaSignature(256, Qt::Uninitialized);
fastFileStream.readRawData(rsaSignature.data(), 256);
// Now the stream should be positioned at 0x13C, where sections begin.
int sectionIndex = 0;
while (true) {
qint32 sectionSize = 0;
fastFileStream >> sectionSize;
if (sectionSize == 0)
break;
// Read the section data.
QByteArray sectionData;
sectionData.resize(sectionSize);
fastFileStream.readRawData(sectionData.data(), sectionSize);
// Compute the IV for this section.
QByteArray iv = Encryption::GetIV(ivTable, sectionIndex);
// Decrypt the section using Salsa20.
QByteArray decData = Encryption::salsa20DecryptSection(sectionData, key, iv);
// Compute SHA1 hash of the decrypted data.
QByteArray sectionHash = QCryptographicHash::hash(decData, QCryptographicHash::Sha1);
// Update the IV table based on the section hash.
Encryption::UpdateIVTable(ivTable, sectionIndex, sectionHash);
// Build a compressed data buffer by prepending the two-byte zlib header.
decompressedData.append(Compression::DecompressDeflate(decData));
sectionIndex++;
}
const QByteArray testZoneData = decompressedData;
// Verify the decompressed data via its embedded zone size. // Verify the decompressed data via its embedded zone size.
QDataStream zoneStream(testZoneData); QDataStream zoneStream(testZoneData);
zoneStream.setByteOrder(QDataStream::LittleEndian); zoneStream.setByteOrder(QDataStream::BigEndian);
quint32 zoneSize; quint32 zoneSize;
zoneStream >> zoneSize; zoneStream >> zoneSize;
QVERIFY2(zoneSize + 44 == testZoneData.size(), if (abs(zoneSize - testZoneData.size()) != 36) {
qDebug() << "Zone Size: " << zoneSize;
qDebug() << "Test zone Size: " << testZoneData.size();
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
}
QVERIFY2(zoneSize + 36 == testZoneData.size(),
qPrintable("Decompression validation failed for: " + fastFilePath_cod7_360)); qPrintable("Decompression validation failed for: " + fastFilePath_cod7_360));
// Write the decompressed zone data to the exports folder with a .zone extension. // Write the decompressed zone data to the exports folder with a .zone extension.

View File

@ -33,12 +33,15 @@ void AutoTest_COD8_360::testDecompression_data() {
for (const QString &filePath : ffFiles) { for (const QString &filePath : ffFiles) {
QString fileName = QFileInfo(filePath).fileName(); QString fileName = QFileInfo(filePath).fileName();
QTest::newRow(qPrintable(fileName)) << filePath; QTest::newRow(qPrintable(fileName)) << filePath;
break;
} }
} }
void AutoTest_COD8_360::testDecompression() { void AutoTest_COD8_360::testDecompression() {
QFETCH(QString, fastFilePath_cod8_360); QFETCH(QString, fastFilePath_cod8_360);
const QString testName = "Decompress: " + fastFilePath_cod8_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod8_360); QFile testFastFile(fastFilePath_cod8_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), QVERIFY2(testFastFile.open(QIODevice::ReadOnly),
@ -46,17 +49,40 @@ void AutoTest_COD8_360::testDecompression() {
const QByteArray testFFData = testFastFile.readAll(); const QByteArray testFFData = testFastFile.readAll();
testFastFile.close(); testFastFile.close();
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data. //const QByteArray testData = Compression::CompressXMem("Hello World!");
const QByteArray compressedData = testFFData.mid(12); //const QByteArray testOutData = Compression::DecompressXMem(testData);
const QByteArray testZoneData = Compression::DecompressZLIB(compressedData); //qDebug() << "Input: Hello World! - Output: " << testData.toHex() << " - New: " << testOutData;
QByteArray pattern;
pattern.append(static_cast<unsigned char>(0xFF));
QByteArray testZoneData;
for (int i = 12; i < testFFData.size(); i++) {
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
const QByteArray compressedData = testFFData.mid(i);
testZoneData = Compression::DecompressXMem(compressedData);
//QVERIFY2(!testZoneData.isEmpty(), qPrintable("Result was empty!"));
if (!testZoneData.isEmpty()) {
qDebug() << QString("Suceeded at %1!").arg(i);
//break;
}
qDebug() << QString("Failed at %1!").arg(i);
}
// Verify the decompressed data via its embedded zone size. // Verify the decompressed data via its embedded zone size.
QDataStream zoneStream(testZoneData); QDataStream zoneStream(testZoneData);
zoneStream.setByteOrder(QDataStream::LittleEndian); zoneStream.setByteOrder(QDataStream::LittleEndian);
quint32 zoneSize; quint32 zoneSize;
zoneStream >> zoneSize; zoneStream >> zoneSize;
QVERIFY2(zoneSize + 44 == testZoneData.size(), if (abs(zoneSize - testZoneData.size()) != 44) {
qPrintable("Decompression validation failed for: " + fastFilePath_cod8_360)); qDebug() << "Zone Size: " << zoneSize;
qDebug() << "Test zone Size: " << testZoneData.size();
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
}
//QVERIFY2(zoneSize + 44 == testZoneData.size(),
// qPrintable("Decompression validation failed for: " + fastFilePath_cod8_360));
// Write the decompressed zone data to the exports folder with a .zone extension. // Write the decompressed zone data to the exports folder with a .zone extension.
QFileInfo fi(fastFilePath_cod8_360); QFileInfo fi(fastFilePath_cod8_360);
@ -74,6 +100,7 @@ void AutoTest_COD8_360::testCompression_data() {
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory()); QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
for (const QString &filePath : zoneFiles) { for (const QString &filePath : zoneFiles) {
break;
QString fileName = QFileInfo(filePath).fileName(); QString fileName = QFileInfo(filePath).fileName();
QTest::newRow(qPrintable(fileName)) << filePath; QTest::newRow(qPrintable(fileName)) << filePath;
} }

View File

@ -39,6 +39,8 @@ void AutoTest_COD9_360::testDecompression_data() {
void AutoTest_COD9_360::testDecompression() { void AutoTest_COD9_360::testDecompression() {
QFETCH(QString, fastFilePath_cod9_360); QFETCH(QString, fastFilePath_cod9_360);
const QString testName = "Decompress: " + fastFilePath_cod9_360;
// Open the original .ff file. // Open the original .ff file.
QFile testFastFile(fastFilePath_cod9_360); QFile testFastFile(fastFilePath_cod9_360);
QVERIFY2(testFastFile.open(QIODevice::ReadOnly), QVERIFY2(testFastFile.open(QIODevice::ReadOnly),

View File

@ -97,7 +97,7 @@ void AutoTest_COD5_PC::testCompression() {
QByteArray header = originalFFData.left(12); QByteArray header = originalFFData.left(12);
QByteArray newCompressedData = Compression::CompressZLIB(decompressedData); QByteArray newCompressedData = Compression::CompressZLIBWithSettings(decompressedData, Z_BEST_SPEED);
int remainder = (newCompressedData.size() + 12) % 32; int remainder = (newCompressedData.size() + 12) % 32;
if (remainder != 0) { if (remainder != 0) {

View File

@ -55,7 +55,12 @@ void AutoTest_COD5_PS3::testDecompression() {
zoneStream.setByteOrder(QDataStream::LittleEndian); zoneStream.setByteOrder(QDataStream::LittleEndian);
quint32 zoneSize; quint32 zoneSize;
zoneStream >> zoneSize; zoneStream >> zoneSize;
QVERIFY2(zoneSize + 44 == testZoneData.size(), if (abs(zoneSize - testZoneData.size()) != 36) {
qDebug() << "Zone Size: " << zoneSize;
qDebug() << "Test zone Size: " << testZoneData.size();
qDebug() << "Difference: " << abs(zoneSize - testZoneData.size());
}
QVERIFY2(zoneSize + 36 == testZoneData.size(),
qPrintable("Decompression validation failed for: " + fastFilePath_cod5_ps3)); qPrintable("Decompression validation failed for: " + fastFilePath_cod5_ps3));
// Write the decompressed zone data to the exports folder with a .zone extension. // Write the decompressed zone data to the exports folder with a .zone extension.

View File

@ -6,7 +6,16 @@
class AutoTest_COD : public QObject { class AutoTest_COD : public QObject {
Q_OBJECT Q_OBJECT
protected:
QList<QPair<QString, bool>> m_subtestResults;
public: public:
const QList<QPair<QString, bool>>& getCollectedTestResults() const {
return m_subtestResults;
}
void recordResult(const QString& name, bool passed) {
m_subtestResults.append({ name, passed });
}
void setFastFileDirectory(const QString aFastFileDir) { void setFastFileDirectory(const QString aFastFileDir) {
mFastFileDirectory = aFastFileDir; mFastFileDirectory = aFastFileDir;
} }
@ -22,10 +31,8 @@ public:
} }
void createDirectory(const QString aDir) { void createDirectory(const QString aDir) {
QDir newDir(aDir); QDir newDir(".");
if (!newDir.exists()) { newDir.mkpath(aDir);
newDir.mkpath(aDir);
}
} }
QStringList findFastFiles(const QString &aBaseDir, int aMaxIter = MAX_ITER) { QStringList findFastFiles(const QString &aBaseDir, int aMaxIter = MAX_ITER) {
QStringList fastFiles; QStringList fastFiles;
@ -61,7 +68,7 @@ public:
virtual void cleanupTestCase() = 0; virtual void cleanupTestCase() = 0;
private: private:
static const int MAX_ITER = -1; static const int MAX_ITER = 10000;
QString mFastFileDirectory; QString mFastFileDirectory;
QString mZoneFileDirectory; QString mZoneFileDirectory;
}; };

View File

@ -38,7 +38,7 @@
#include "WiiU/autotest_cod10_wiiu.cpp" #include "WiiU/autotest_cod10_wiiu.cpp"
// clearly named defines for filtering logic // clearly named defines for filtering logic
#define TEST_EVERYTHING 1 #define TEST_EVERYTHING 0
// Global filters // Global filters
#define TEST_ALL_PLATFORMS 0 #define TEST_ALL_PLATFORMS 0
@ -46,11 +46,11 @@
// individual games // individual games
#define TEST_COD2 0 #define TEST_COD2 0
#define TEST_COD4 1 #define TEST_COD4 0
#define TEST_COD5 0 #define TEST_COD5 0
#define TEST_COD6 0 #define TEST_COD6 0
#define TEST_COD7 0 #define TEST_COD7 0
#define TEST_COD8 0 #define TEST_COD8 1
#define TEST_COD9 0 #define TEST_COD9 0
#define TEST_COD10 0 #define TEST_COD10 0
#define TEST_COD11 0 #define TEST_COD11 0
@ -95,61 +95,61 @@ int main(int argc, char *argv[]) {
QVector<AutoTest_COD*> wiiUTests; QVector<AutoTest_COD*> wiiUTests;
AutoTest_COD2_360 *test_cod2_360 = new AutoTest_COD2_360(); AutoTest_COD2_360 *test_cod2_360 = new AutoTest_COD2_360();
test_cod2_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD2"); test_cod2_360->setFastFileDirectory("G:/Fast Files/360/COD2");
test_cod2_360->setZoneFileDirectory("./exports/cod2/360"); test_cod2_360->setZoneFileDirectory("./exports/cod2/360");
cod2Tests << test_cod2_360; cod2Tests << test_cod2_360;
xbox360Tests << test_cod2_360; xbox360Tests << test_cod2_360;
AutoTest_COD4_360 *test_cod4_360 = new AutoTest_COD4_360(); AutoTest_COD4_360 *test_cod4_360 = new AutoTest_COD4_360();
test_cod4_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD4"); test_cod4_360->setFastFileDirectory("G:/Fast Files/360/COD4");
test_cod4_360->setZoneFileDirectory("./exports/cod4/360"); test_cod4_360->setZoneFileDirectory("./exports/cod4/360");
cod4Tests << test_cod4_360; cod4Tests << test_cod4_360;
xbox360Tests << test_cod4_360; xbox360Tests << test_cod4_360;
AutoTest_COD5_360 *test_cod5_360 = new AutoTest_COD5_360(); AutoTest_COD5_360 *test_cod5_360 = new AutoTest_COD5_360();
test_cod5_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD5"); test_cod5_360->setFastFileDirectory("G:/Fast Files/360/COD5");
test_cod5_360->setZoneFileDirectory("./exports/cod5/360"); test_cod5_360->setZoneFileDirectory("./exports/cod5/360");
cod5Tests << test_cod5_360; cod5Tests << test_cod5_360;
xbox360Tests << test_cod5_360; xbox360Tests << test_cod5_360;
AutoTest_COD6_360 *test_cod6_360 = new AutoTest_COD6_360(); AutoTest_COD6_360 *test_cod6_360 = new AutoTest_COD6_360();
test_cod6_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD6"); test_cod6_360->setFastFileDirectory("G:/Fast Files/360/COD6");
test_cod6_360->setZoneFileDirectory("./exports/cod6/360"); test_cod6_360->setZoneFileDirectory("./exports/cod6/360");
cod6Tests << test_cod6_360; cod6Tests << test_cod6_360;
xbox360Tests << test_cod6_360; xbox360Tests << test_cod6_360;
AutoTest_COD7_360 *test_cod7_360 = new AutoTest_COD7_360(); AutoTest_COD7_360 *test_cod7_360 = new AutoTest_COD7_360();
test_cod7_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD7"); test_cod7_360->setFastFileDirectory("G:/Fast Files/360/COD7");
test_cod7_360->setZoneFileDirectory("./exports/cod7/360"); test_cod7_360->setZoneFileDirectory("./exports/cod7/360");
cod7Tests << test_cod7_360; cod7Tests << test_cod7_360;
xbox360Tests << test_cod7_360; xbox360Tests << test_cod7_360;
AutoTest_COD8_360 *test_cod8_360 = new AutoTest_COD8_360(); AutoTest_COD8_360 *test_cod8_360 = new AutoTest_COD8_360();
test_cod8_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD8"); test_cod8_360->setFastFileDirectory("G:/Fast Files/360/COD8");
test_cod8_360->setZoneFileDirectory("./exports/cod8/360"); test_cod8_360->setZoneFileDirectory("./exports/cod8/360");
cod8Tests << test_cod8_360; cod8Tests << test_cod8_360;
xbox360Tests << test_cod8_360; xbox360Tests << test_cod8_360;
AutoTest_COD9_360 *test_cod9_360 = new AutoTest_COD9_360(); AutoTest_COD9_360 *test_cod9_360 = new AutoTest_COD9_360();
test_cod9_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD9"); test_cod9_360->setFastFileDirectory("G:/Fast Files/360/COD9");
test_cod9_360->setZoneFileDirectory("./exports/cod9/360"); test_cod9_360->setZoneFileDirectory("./exports/cod9/360");
cod9Tests << test_cod9_360; cod9Tests << test_cod9_360;
xbox360Tests << test_cod9_360; xbox360Tests << test_cod9_360;
AutoTest_COD10_360 *test_cod10_360 = new AutoTest_COD10_360(); AutoTest_COD10_360 *test_cod10_360 = new AutoTest_COD10_360();
test_cod10_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD10"); test_cod10_360->setFastFileDirectory("G:/Fast Files/360/COD10");
test_cod10_360->setZoneFileDirectory("./exports/cod10/360"); test_cod10_360->setZoneFileDirectory("./exports/cod10/360");
cod10Tests << test_cod10_360; cod10Tests << test_cod10_360;
xbox360Tests << test_cod10_360; xbox360Tests << test_cod10_360;
AutoTest_COD11_360 *test_cod11_360 = new AutoTest_COD11_360(); AutoTest_COD11_360 *test_cod11_360 = new AutoTest_COD11_360();
test_cod11_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD11"); test_cod11_360->setFastFileDirectory("G:/Fast Files/360/COD11");
test_cod11_360->setZoneFileDirectory("./exports/cod11/360"); test_cod11_360->setZoneFileDirectory("./exports/cod11/360");
cod11Tests << test_cod11_360; cod11Tests << test_cod11_360;
xbox360Tests << test_cod11_360; xbox360Tests << test_cod11_360;
AutoTest_COD12_360 *test_cod12_360 = new AutoTest_COD12_360(); AutoTest_COD12_360 *test_cod12_360 = new AutoTest_COD12_360();
test_cod12_360->setFastFileDirectory("G:/Fast Files/Xbox360/COD12"); test_cod12_360->setFastFileDirectory("G:/Fast Files/360/COD12");
test_cod12_360->setZoneFileDirectory("./exports/cod12/360"); test_cod12_360->setZoneFileDirectory("./exports/cod12/360");
cod12Tests << test_cod12_360; cod12Tests << test_cod12_360;
xbox360Tests << test_cod12_360; xbox360Tests << test_cod12_360;
@ -185,7 +185,7 @@ int main(int argc, char *argv[]) {
AutoTest_COD8_PC *test_cod8_pc = new AutoTest_COD8_PC(); AutoTest_COD8_PC *test_cod8_pc = new AutoTest_COD8_PC();
test_cod8_pc->setFastFileDirectory("G:/Fast Files/PC/COD8"); test_cod8_pc->setFastFileDirectory("G:/Fast Files/PC/COD8");
test_cod8_pc->setZoneFileDirectory("./exports/cod8/PC"); test_cod8_pc->setZoneFileDirectory("./exports/cod8/PC");
cod8Tests << test_cod8_pc; //cod8Tests << test_cod8_pc;
pcTests << test_cod8_pc; pcTests << test_cod8_pc;
AutoTest_COD9_PC *test_cod9_pc = new AutoTest_COD9_PC(); AutoTest_COD9_PC *test_cod9_pc = new AutoTest_COD9_PC();
@ -225,7 +225,7 @@ int main(int argc, char *argv[]) {
AutoTest_COD5_PS3 *test_cod5_ps3 = new AutoTest_COD5_PS3(); AutoTest_COD5_PS3 *test_cod5_ps3 = new AutoTest_COD5_PS3();
test_cod5_ps3->setFastFileDirectory("G:/Fast Files/PS3/COD5"); test_cod5_ps3->setFastFileDirectory("G:/Fast Files/PS3/COD5");
test_cod5_ps3->setZoneFileDirectory("./exports/cod5/PS3"); test_cod5_ps3->setZoneFileDirectory("./exports/cod5/PS3");
cod5Tests << test_cod5_ps3; //cod5Tests << test_cod5_ps3;
ps3Tests << test_cod5_ps3; ps3Tests << test_cod5_ps3;
AutoTest_COD6_PS3 *test_cod6_ps3 = new AutoTest_COD6_PS3(); AutoTest_COD6_PS3 *test_cod6_ps3 = new AutoTest_COD6_PS3();
@ -243,7 +243,7 @@ int main(int argc, char *argv[]) {
AutoTest_COD8_PS3 *test_cod8_ps3 = new AutoTest_COD8_PS3(); AutoTest_COD8_PS3 *test_cod8_ps3 = new AutoTest_COD8_PS3();
test_cod8_ps3->setFastFileDirectory("G:/Fast Files/PS3/COD8"); test_cod8_ps3->setFastFileDirectory("G:/Fast Files/PS3/COD8");
test_cod8_ps3->setZoneFileDirectory("./exports/cod8/PS3"); test_cod8_ps3->setZoneFileDirectory("./exports/cod8/PS3");
cod8Tests << test_cod8_ps3; //cod8Tests << test_cod8_ps3;
ps3Tests << test_cod8_ps3; ps3Tests << test_cod8_ps3;
AutoTest_COD9_PS3 *test_cod9_ps3 = new AutoTest_COD9_PS3(); AutoTest_COD9_PS3 *test_cod9_ps3 = new AutoTest_COD9_PS3();
@ -296,10 +296,13 @@ int main(int argc, char *argv[]) {
cod10Tests << test_cod10_wiiu; cod10Tests << test_cod10_wiiu;
wiiUTests << test_cod10_wiiu; wiiUTests << test_cod10_wiiu;
QList<QPair<QString, QList<QPair<QString, bool>>>> allResults;
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD2) { if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD2) {
qDebug() << "-- RUNNING TEST_COD2 --"; qDebug() << "-- RUNNING TEST_COD2 --";
foreach (auto test, cod2Tests) { foreach (auto test, cod2Tests) {
QTest::qExec(test, argc, argv); QTest::qExec(test, argc, argv);
allResults.append({ test->metaObject()->className(), test->getCollectedTestResults() });
} }
} }
if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD4) { if (TEST_EVERYTHING || TEST_ALL_COD_GAMES || TEST_COD4) {
@ -388,5 +391,45 @@ int main(int argc, char *argv[]) {
} }
} }
QJsonObject root;
root["project"] = "XPlor";
root["lastRun"] = QDateTime::currentDateTimeUtc().toString(Qt::ISODate);
bool allPassed = true;
QJsonArray testFiles;
for (const auto& [className, subtests] : allResults) {
QJsonObject fileEntry;
fileEntry["name"] = className;
QJsonArray testArray;
bool filePassed = true;
for (const auto& [testName, passed] : subtests) {
testArray.append(QJsonObject{
{"name", testName},
{"status", passed ? "passed" : "failed"}
});
if (!passed)
filePassed = false;
}
fileEntry["status"] = filePassed ? "passed" : "failed";
fileEntry["tests"] = testArray;
testFiles.append(fileEntry);
if (!filePassed)
allPassed = false;
}
root["status"] = allPassed ? "passed" : "failed";
root["tests"] = testFiles;
QFile file("G:/FileServer/files/auto_test.json");
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate))
file.write(QJsonDocument(root).toJson(QJsonDocument::Indented));
else
qWarning() << "Failed to write JSON output";
return 0; return 0;
} }

View File

@ -2,7 +2,7 @@ TEMPLATE = app
CONFIG += no_main CONFIG += no_main
# Enable the testlib module # Enable the testlib module
QT += testlib concurrent QT += testlib concurrent core-private
# Define a test-specific flag # Define a test-specific flag
DEFINES += QT_TESTS DEFINES += QT_TESTS
@ -70,18 +70,25 @@ app.depends += \
libs/fastfile libs/fastfile
LIBS += \ LIBS += \
-L$$OUT_PWD/../libs/ -lcore -lencryption -lcompression -lfastfile -L$$OUT_PWD/../libs/ -lcore -lencryption -lcompression -lfastfile \
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64
INCLUDEPATH += \ INCLUDEPATH += \
$$PWD/../third_party/xbox_sdk/include \
$$PWD/../libs/core \ $$PWD/../libs/core \
$$PWD/../libs/encryption \ $$PWD/../libs/encryption \
$$PWD/../libs/compression \ $$PWD/../libs/compression \
$$PWD/../libs/fastfile $$PWD/../libs/fastfile
DEPENDPATH += \ DEPENDPATH += \
$$PWD/../third_party/xbox_sdk/include \
$$PWD/../libs/core \ $$PWD/../libs/core \
$$PWD/../libs/encryption \ $$PWD/../libs/encryption \
$$PWD/../libs/compression \ $$PWD/../libs/compression \
$$PWD/../libs/fastfile $$PWD/../libs/fastfile
RESOURCES += RESOURCES +=
# Copy DLLs to Debug & Release folder
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)

291
third_party/xbox_sdk/include/NuiTools.h vendored Normal file
View File

@ -0,0 +1,291 @@
/************************************************************************
* *
* NuiTools.h -- This module aggregates all the Natural User *
* Interface(NUI) API structures and definitions *
* needed by Windows based NUI tools. *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
************************************************************************/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
//
// Define NUI error codes derived from win32 errors
//
#define E_NUI_DEVICE_NOT_CONNECTED __HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_CONNECTED)
#define E_NUI_DEVICE_NOT_READY __HRESULT_FROM_WIN32(ERROR_NOT_READY)
#define E_NUI_ALREADY_INITIALIZED __HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED)
#define E_NUI_IDENTITY_BUSY __HRESULT_FROM_WIN32(ERROR_BUSY)
#define E_NUI_NO_MORE_ITEMS __HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)
#define E_NUI_NOACCESS __HRESULT_FROM_WIN32(ERROR_NOACCESS)
#define E_NUI_NOT_FOUND __HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
//
// Define NUI specific error codes
//
#define FACILITY_NUI 0x301
#define E_NUI_FRAME_NO_DATA MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 1)
#define E_NUI_STREAM_NOT_ENABLED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 2)
#define E_NUI_IMAGE_STREAM_IN_USE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 3)
#define E_NUI_FRAME_LIMIT_EXCEEDED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 4)
#define E_NUI_FEATURE_NOT_INITIALIZED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 5)
#define E_NUI_IDENTITY_ENROLLMENT_LIMIT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 6)
#define E_NUI_IDENTITY_UI_REQUIRED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 7)
#define E_NUI_IDENTITY_LOST_TRACK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 8)
#define E_NUI_IDENTITY_QUALITY_ISSUE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 9)
#define E_NUI_IDENTITY_NO_UNENROLL_SIGN_IN MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 10)
#define E_NUI_SYSTEM_UI_PRESENT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 11)
#define E_NUI_MUST_CALL_IDENTIFY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 12)
#define E_NUI_DATABASE_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 13)
#define E_NUI_DATABASE_VERSION_MISMATCH MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 14)
#define E_NUI_DATABASE_CORRUPTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 15)
#define E_NUI_TRACKED_PLAYER_LIMIT_EXCEEDED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 16)
#define E_NUI_TRACKING_ID_IN_USE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 17)
#define E_NUI_LOST_TRACKING MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 18)
#define E_NUI_GESTURE_NOT_INITIALIZED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 19)
#define E_NUI_GESTURE_ALREADY_INITIALIZED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 20)
#define E_NUI_NOT_LIVE_USER MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 21)
#define E_NUI_LIVE_USER_NOT_LOGGED_IN MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NUI, 22)
// NOTE: Error codes in the range 100-199 associated with FACILITY_NUI are
// assigned to the NUI Handles API subsystem of NUI. See NuiHandles.h for
// details on those error codes.
typedef enum _NUI_IMAGE_TYPE
{
NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX = 0,
NUI_IMAGE_TYPE_COLOR,
NUI_IMAGE_TYPE_COLOR_YUV,
NUI_IMAGE_TYPE_DEPTH,
NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX_IN_COLOR_SPACE,
NUI_IMAGE_TYPE_DEPTH_IN_COLOR_SPACE,
NUI_IMAGE_TYPE_COLOR_IN_DEPTH_SPACE,
NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX_80x60,
NUI_IMAGE_TYPE_DEPTH_80x60,
} NUI_IMAGE_TYPE;
typedef enum _NUI_IMAGE_RESOLUTION
{
NUI_IMAGE_RESOLUTION_80x60,
NUI_IMAGE_RESOLUTION_320x240,
NUI_IMAGE_RESOLUTION_640x480
} NUI_IMAGE_RESOLUTION;
#define NUI_IMAGE_PLAYER_INDEX_SHIFT 3
#define NUI_IMAGE_PLAYER_INDEX_MASK ((1 << NUI_IMAGE_PLAYER_INDEX_SHIFT)-1)
#define NUI_IMAGE_DEPTH_MAXIMUM ((4000 << NUI_IMAGE_PLAYER_INDEX_SHIFT) | NUI_IMAGE_PLAYER_INDEX_MASK)
#define NUI_IMAGE_DEPTH_MINIMUM (800 << NUI_IMAGE_PLAYER_INDEX_SHIFT)
#define NUI_IMAGE_DEPTH_NO_VALUE 0
#define NUI_IMAGE_DEPTH_BUFFER_SIZE (384*240*2)
#define NUI_IMAGE_DEPTH_80x60_BUFFER_SIZE (128*60*2)
#define NUI_IMAGE_COLOR_640x480_BUFFER_SIZE (640*480*4)
#define NUI_IMAGE_COLOR_YUV_640x480_BUFFER_SIZE (640*480*2)
#define NUI_CAMERA_DEPTH_NOMINAL_FOCAL_LENGTH_IN_PIXELS (285.63f) // Based on 320x240 pixel size.
#define NUI_CAMERA_DEPTH_NOMINAL_INVERSE_FOCAL_LENGTH_IN_PIXELS (3.501e-3f) // (1/NUI_CAMERA_DEPTH_NOMINAL_FOCAL_LENGTH_IN_PIXELS)
#define NUI_CAMERA_DEPTH_NOMINAL_DIAGONAL_FOV (70.0f)
#define NUI_CAMERA_DEPTH_NOMINAL_HORIZONTAL_FOV (58.5f)
#define NUI_CAMERA_DEPTH_NOMINAL_VERTICAL_FOV (45.6f)
#define NUI_CAMERA_COLOR_NOMINAL_FOCAL_LENGTH_IN_PIXELS (531.15f) // Based on 640x480 pixel size.
#define NUI_CAMERA_COLOR_NOMINAL_INVERSE_FOCAL_LENGTH_IN_PIXELS (1.83e-3f) // (1/NUI_CAMERA_COLOR_NOMINAL_FOCAL_LENGTH_IN_PIXELS)
#define NUI_CAMERA_COLOR_NOMINAL_DIAGONAL_FOV ( 73.9f)
#define NUI_CAMERA_COLOR_NOMINAL_HORIZONTAL_FOV ( 62.0f)
#define NUI_CAMERA_COLOR_NOMINAL_VERTICAL_FOV ( 48.6f)
typedef enum _NUI_IMAGE_DIGITALZOOM
{
NUI_IMAGE_DIGITAL_ZOOM_1X = 0,
NUI_IMAGE_DIGITAL_ZOOM_2X = 1
} NUI_IMAGE_DIGITALZOOM;
typedef struct _NUI_IMAGE_VIEW_AREA
{
NUI_IMAGE_DIGITALZOOM eDigitalZoom;
LONG lCenterX;
LONG lCenterY;
} NUI_IMAGE_VIEW_AREA;
typedef enum _NUI_SKELETON_POSITION_INDEX
{
NUI_SKELETON_POSITION_HIP_CENTER = 0,
NUI_SKELETON_POSITION_SPINE,
NUI_SKELETON_POSITION_SHOULDER_CENTER,
NUI_SKELETON_POSITION_HEAD,
NUI_SKELETON_POSITION_SHOULDER_LEFT,
NUI_SKELETON_POSITION_ELBOW_LEFT,
NUI_SKELETON_POSITION_WRIST_LEFT,
NUI_SKELETON_POSITION_HAND_LEFT,
NUI_SKELETON_POSITION_SHOULDER_RIGHT,
NUI_SKELETON_POSITION_ELBOW_RIGHT,
NUI_SKELETON_POSITION_WRIST_RIGHT,
NUI_SKELETON_POSITION_HAND_RIGHT,
NUI_SKELETON_POSITION_HIP_LEFT,
NUI_SKELETON_POSITION_KNEE_LEFT,
NUI_SKELETON_POSITION_ANKLE_LEFT,
NUI_SKELETON_POSITION_FOOT_LEFT,
NUI_SKELETON_POSITION_HIP_RIGHT,
NUI_SKELETON_POSITION_KNEE_RIGHT,
NUI_SKELETON_POSITION_ANKLE_RIGHT,
NUI_SKELETON_POSITION_FOOT_RIGHT,
NUI_SKELETON_POSITION_COUNT
} NUI_SKELETON_POSITION_INDEX;
//
// Number of NUI_SKELETON_DATA elements in NUI_SKELETON_FRAME
//
#define NUI_SKELETON_COUNT 6
//
// Number of NUI_SKELETON_DATA elements that can be in the NUI_SKELETON_TRACKED state
//
#define NUI_SKELETON_MAX_TRACKED_COUNT 2
//
// Tracking IDs start at 1
//
#define NUI_SKELETON_INVALID_TRACKING_ID 0
typedef enum _NUI_SKELETON_POSITION_TRACKING_STATE
{
NUI_SKELETON_POSITION_NOT_TRACKED = 0,
NUI_SKELETON_POSITION_INFERRED,
NUI_SKELETON_POSITION_TRACKED
} NUI_SKELETON_POSITION_TRACKING_STATE;
typedef enum _NUI_SKELETON_TRACKING_STATE
{
NUI_SKELETON_NOT_TRACKED = 0,
NUI_SKELETON_POSITION_ONLY,
NUI_SKELETON_TRACKED
} NUI_SKELETON_TRACKING_STATE;
typedef struct _NUI_SKELETON_DATA
{
NUI_SKELETON_TRACKING_STATE eTrackingState;
DWORD dwTrackingID;
DWORD dwEnrollmentIndex;
DWORD dwUserIndex;
XMVECTOR Position;
XMVECTOR SkeletonPositions[NUI_SKELETON_POSITION_COUNT];
NUI_SKELETON_POSITION_TRACKING_STATE eSkeletonPositionTrackingState[NUI_SKELETON_POSITION_COUNT];
DWORD dwQualityFlags;
} NUI_SKELETON_DATA;
#define NUI_SKELETON_QUALITY_CLIPPED_RIGHT 0x00000001
#define NUI_SKELETON_QUALITY_CLIPPED_LEFT 0x00000002
#define NUI_SKELETON_QUALITY_CLIPPED_TOP 0x00000004
#define NUI_SKELETON_QUALITY_CLIPPED_BOTTOM 0x00000008
//#pragma pack(push, 16)
typedef struct _NUI_SKELETON_FRAME
{
LARGE_INTEGER liTimeStamp;
DWORD dwFrameNumber;
DWORD dwFlags;
XMVECTOR vFloorClipPlane;
XMVECTOR vNormalToGravity;
NUI_SKELETON_DATA SkeletonData[NUI_SKELETON_COUNT];
} NUI_SKELETON_FRAME;
//#pragma pack(pop)
#define NUI_SKELETON_FRAME_FLAG_CAMERA_MOTION 0x00000001
#define NUI_SKELETON_FRAME_FLAG_EXTRAPOLATED_FLOOR 0x00000002
#define NUI_SKELETON_FRAME_FLAG_UPPER_BODY_SKELETON 0x00000004
#define NUI_SKELETON_FRAME_FLAG_SEATED_SUPPORT_ENABLED 0x00000008
#define NUI_IDENTITY_QUALITY_ENVIRONMENT_FACE_DETECT_FAILURE 0x00000001
#define NUI_IDENTITY_QUALITY_USER_BODY_TURNED 0x00000002
#define NUI_IDENTITY_QUALITY_USER_NOT_UPRIGHT 0x00000004
#define NUI_IDENTITY_QUALITY_USER_OCCLUDED_FACE 0x00000008
#define NUI_IDENTITY_QUALITY_USER_OCCLUDED_BODY 0x00000010
#define NUI_IDENTITY_QUALITY_USER_FAR_AWAY 0x00000020
#define NUI_IDENTITY_QUALITY_USER_CLOSE 0x00000040
#define NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_LEFT 0x00000080
#define NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_RIGHT 0x00000100
#define NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_TOP 0x00000200
#define NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_BOTTOM 0x00000400
#define NUI_IDENTITY_QUALITY_ENVIRONMENT_TOO_DARK 0x00000800
#define NUI_IDENTITY_QUALITY_ENVIRONMENT_TOO_BRIGHT 0x00001000
#define NUI_IDENTITY_QUALITY_ENVIRONMENT_MASK \
(NUI_IDENTITY_QUALITY_ENVIRONMENT_FACE_DETECT_FAILURE | \
NUI_IDENTITY_QUALITY_ENVIRONMENT_TOO_DARK | \
NUI_IDENTITY_QUALITY_ENVIRONMENT_TOO_BRIGHT)
#define NUI_IDENTITY_QUALITY_USER_MASK \
(NUI_IDENTITY_QUALITY_USER_BODY_TURNED | \
NUI_IDENTITY_QUALITY_USER_NOT_UPRIGHT | \
NUI_IDENTITY_QUALITY_USER_OCCLUDED_FACE | \
NUI_IDENTITY_QUALITY_USER_OCCLUDED_BODY | \
NUI_IDENTITY_QUALITY_USER_FAR_AWAY | \
NUI_IDENTITY_QUALITY_USER_CLOSE | \
NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_LEFT | \
NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_RIGHT | \
NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_TOP | \
NUI_IDENTITY_QUALITY_USER_CLIPPED_AT_BOTTOM)
typedef enum _NUI_IDENTITY_MESSAGE_ID
{
NUI_IDENTITY_MESSAGE_ID_FRAME_PROCESSED,
NUI_IDENTITY_MESSAGE_ID_COMPLETE,
}NUI_IDENTITY_MESSAGE_ID;
typedef enum _NUI_IDENTITY_OPERATION_ID
{
NUI_IDENTITY_OPERATION_ID_NONE,
NUI_IDENTITY_OPERATION_ID_IDENTIFY,
NUI_IDENTITY_OPERATION_ID_ENROLL,
NUI_IDENTITY_OPERATION_ID_TUNER,
}NUI_IDENTITY_OPERATION_ID;
typedef struct _NUI_IDENTITY_MESSAGE_FRAME_PROCESSED
{
DWORD dwQualityFlags;
} NUI_IDENTITY_MESSAGE_FRAME_PROCESSED;
typedef struct _NUI_IDENTITY_MESSAGE_COMPLETE
{
HRESULT hrResult;
DWORD dwEnrollmentIndex;
BOOL bProfileMatched;
} NUI_IDENTITY_MESSAGE_COMPLETE;
typedef struct _NUI_IDENTITY_MESSAGE
{
NUI_IDENTITY_MESSAGE_ID MessageId;
NUI_IDENTITY_OPERATION_ID OperationId;
DWORD dwTrackingID;
DWORD dwSkeletonFrameNumber;
union
{
NUI_IDENTITY_MESSAGE_FRAME_PROCESSED FrameProcessed;
NUI_IDENTITY_MESSAGE_COMPLETE Complete;
} Data;
} NUI_IDENTITY_MESSAGE;
#ifdef __cplusplus
} //end of extern "C"
#endif
#ifdef __cplusplus
extern "C" {
#endif
//
// Gesture preprocess flags for input skeletons
//
#define NUI_GESTURE_PREPROCESS_NONE 0x00000000
#define NUI_GESTURE_PREPROCESS_MIRROR_LEFT_RIGHT 0x00000001
#define NUI_GESTURE_PREPROCESS_MAKE_SEATED 0x00000002
#ifdef __cplusplus
} //close extern "C"
#endif

9226
third_party/xbox_sdk/include/XDevkit.h vendored Normal file

File diff suppressed because it is too large Load Diff

1547
third_party/xbox_sdk/include/XDevkit.idl vendored Normal file

File diff suppressed because it is too large Load Diff

77
third_party/xbox_sdk/include/XStudio.h vendored Normal file
View File

@ -0,0 +1,77 @@
/***********************************************************************
* *
* XStudio.h -- This module aggregates the APIs for Xbox 360 Studio *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
***********************************************************************/
#pragma once
#ifndef XSTUDIO
#define XSTUDIO
#ifdef __cplusplus
extern "C" {
#endif
// -----------------------------------------------------------------------------
// Error codes
// -----------------------------------------------------------------------------
#define FACILITY_XSTUDIO 0x310
#define S_XSTUDIO_SUCCESS __HRESULT_FROM_WIN32( ERROR_SUCCESS )
#define S_XSTUDIO_STOPPED MAKE_HRESULT( SEVERITY_SUCCESS, FACILITY_XSTUDIO, 1 )
#define S_XSTUDIO_NO_PLAYER_INDEX MAKE_HRESULT( SEVERITY_SUCCESS, FACILITY_XSTUDIO, 2 )
#define E_XSTUDIO_OUT_OF_MEMORY __HRESULT_FROM_WIN32( ERROR_OUTOFMEMORY )
#define E_XSTUDIO_INVALID_ARG __HRESULT_FROM_WIN32( ERROR_INVALID_PARAMETER )
#define E_XSTUDIO_INVALID_HANDLE __HRESULT_FROM_WIN32( ERROR_INVALID_HANDLE )
#define E_XSTUDIO_INVALID_FUNCTION __HRESULT_FROM_WIN32( ERROR_INVALID_FUNCTION )
#define E_XSTUDIO_INVALID_FLAGS __HRESULT_FROM_WIN32( ERROR_INVALID_FLAGS )
#define E_XSTUDIO_INTERNAL E_FAIL
#define E_XSTUDIO_BUSY __HRESULT_FROM_WIN32( ERROR_BUSY )
#define E_XSTUDIO_ACCESS_DENIED __HRESULT_FROM_WIN32( ERROR_ACCESS_DENIED )
#define E_XSTUDIO_INVALID_DATA __HRESULT_FROM_WIN32( ERROR_INVALID_DATA )
#define E_XSTUDIO_NO_CONNECTION __HRESULT_FROM_WIN32( ERROR_CONNECTION_UNAVAIL )
#define E_XSTUDIO_FILE_ALREADY_EXISTS __HRESULT_FROM_WIN32( ERROR_ALREADY_EXISTS )
#define E_XSTUDIO_FILE_NOT_FOUND __HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND )
#define E_XSTUDIO_PATH_NOT_FOUND __HRESULT_FROM_WIN32( ERROR_PATH_NOT_FOUND )
#define E_XSTUDIO_SHARING_VIOLATION __HRESULT_FROM_WIN32( ERROR_SHARING_VIOLATION )
#define E_XSTUDIO_TOO_MANY_OPEN_FILES __HRESULT_FROM_WIN32( ERROR_TOO_MANY_OPEN_FILES )
#define E_XSTUDIO_NO_MORE_ITEMS __HRESULT_FROM_WIN32( ERROR_NO_MORE_ITEMS )
#define E_XSTUDIO_MORE_DATA __HRESULT_FROM_WIN32( ERROR_MORE_DATA )
#define E_XSTUDIO_TIMEOUT __HRESULT_FROM_WIN32( ERROR_TIMEOUT )
#define E_XSTUDIO_INVALID_OPERATION __HRESULT_FROM_WIN32( ERROR_INVALID_OPERATION )
#define E_XSTUDIO_ALREADY_ASSIGNED __HRESULT_FROM_WIN32( ERROR_ALREADY_ASSIGNED )
#define E_XSTUDIO_PROTOCOL_MISMATCH MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 2 )
#define E_XSTUDIO_TITLE_TERMINATE MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 3 )
#define E_XSTUDIO_NUI_NOT_INITIALIZED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 4 )
#define E_XSTUDIO_HEADLESS_MODE MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 5 )
#define E_XSTUDIO_NO_DATA_AVAILABLE MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 6 )
#define E_XSTUDIO_FILE_CONVERSION_REQUIRED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 7 )
#define E_XSTUDIO_INVALID_STREAM MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 8 )
#define E_XSTUDIO_STREAM_NOT_MAPPED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 9 )
#define E_XSTUDIO_STREAM_ALREADY_MAPPED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 10 )
#define E_XSTUDIO_NO_STREAM_SPECIFIED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 13 )
#define E_XSTUDIO_INVALID_TIMESTAMP MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 14 )
#define E_XSTUDIO_SKELETON_DATA_REQUIRED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 15 )
#define E_XSTUDIO_TRACKING_ID_NOT_FOUND MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 16 )
#define E_XSTUDIO_INVALID_EVENT_INDEX MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 17 )
#define E_XSTUDIO_NOT_SUSPENDED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 18 )
#define E_XSTUDIO_RECORD_WHILE_SUSPENDED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 19 )
#define E_XSTUDIO_SUSPEND_WHILE_RECORDING MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 20 )
#define E_XSTUDIO_SUSPEND_WITHOUT_PLAYING MAKE_HRESULT( SEVERITY_ERROR, FACILITY_XSTUDIO, 21 )
#ifdef __cplusplus
}
#endif
#include <XStudioService.h>
#include <XStudioApi.h>
#endif //XSTUDIO

View File

@ -0,0 +1,390 @@
/***********************************************************************
* *
* XStudioApi.h -- This module defines the APIs for Xbox 360 Studio *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
***********************************************************************/
#pragma once
#ifndef XSTUDIO
#error "You must include xstudio.h rather than including xstudioapi.h directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define XSTINLINE __inline
#define XSTAPI WINAPI
#ifndef _XBOX //
// -----------------------------------------------------------------------------
// Connection
// -----------------------------------------------------------------------------
typedef enum _XSTUDIO_CONNECTION_TYPE
{
XSTUDIO_CONNECTION_TYPE_USB,
XSTUDIO_CONNECTION_TYPE_TCP,
} XSTUDIO_CONNECTION_TYPE;
HRESULT
XSTAPI
XStudioConnect(
_In_z_ const char * sConsoleName,
_In_ XSTUDIO_CONNECTION_TYPE ConnectionType
);
HRESULT
XSTAPI
XStudioDisconnect();
HRESULT
XSTAPI
XStudioGetConnectionStatus();
#endif //
// -----------------------------------------------------------------------------
// XStudio File
// -----------------------------------------------------------------------------
HRESULT
XSTAPI
XStudioCreateFile(
_In_z_ const char * sFilePath,
_In_ DWORD dwDesiredAccess,
_In_ DWORD dwCreationDisposition,
_In_ XSTUDIO_STREAM_FLAGS dwStreams,
_Out_ XSTUDIO_FILE_HANDLE * phFile
);
HRESULT
XSTAPI
XStudioCloseFile(
_In_ XSTUDIO_FILE_HANDLE hFile
);
HRESULT
XSTAPI
XStudioGetFileStreams(
_In_ XSTUDIO_FILE_HANDLE hFile,
_Out_ XSTUDIO_STREAM_FLAGS * pdwStreams
);
// -----------------------------------------------------------------------------
// Stream Mapping
// -----------------------------------------------------------------------------
HRESULT
XSTAPI
XStudioMapStreams(
_In_ XSTUDIO_STREAM_FLAGS dwStreams,
_In_ XSTUDIO_HANDLE hHandle
);
HRESULT
XSTAPI
XStudioUnmapStreams(
_In_ XSTUDIO_STREAM_FLAGS dwStreams,
_In_ XSTUDIO_HANDLE hHandle
);
// -----------------------------------------------------------------------------
// Switch Producers
// -----------------------------------------------------------------------------
typedef enum XSTUDIO_PRODUCER
{
XSTUDIO_PRODUCER_FILE,
} XSTUDIO_PRODUCER;
HRESULT
XSTAPI
XStudioSwitchToProducers(
_In_ XSTUDIO_STREAM_FLAGS dwStreams,
_In_ XSTUDIO_PRODUCER producer
);
// -----------------------------------------------------------------------------
// Stream Callback
// -----------------------------------------------------------------------------
#define XSTUDIO_STREAM_CALLBACK_REGISTRATION_FLAG_CONSUMER 0x00000001
#define XSTUDIO_STREAM_CALLBACK_REGISTRATION_FLAG_PRODUCER 0x00000002
#define XSTUDIO_STREAM_CALLBACK_REGISTRATION_FLAG_PRODUCER_FILL_IN 0x00000005
#define XSTUDIO_STREAM_CALLBACK_REGISTRATION_FLAG_REALTIME 0x00000100
typedef struct _XSTUDIO_STREAM_EVENT
{
UINT cbSize;
XSTUDIO_STREAM_ID StreamID;
UINT uEventIndex;
UINT64 uEventMicroseconds;
void* pvIndexBuffer;
UINT cbIndexBufferSize;
UINT cbIndexBufferUsed;
void* pvDataBuffer;
UINT cbDataBufferSize;
UINT cbDataBufferUsed;
} XSTUDIO_STREAM_EVENT;
typedef enum _NUI_IMAGE_TYPE NUI_IMAGE_TYPE;
typedef struct _XSTUDIO_NUICAM_IMAGE_INDEX_DATA
{
NUI_IMAGE_TYPE ImageType;
USHORT Width;
USHORT Height;
DWORD FrameNumber;
DWORD64 NuiTimeStamp;
} XSTUDIO_NUICAM_IMAGE_INDEX_DATA;
typedef struct _XSTUDIO_TITLE_INDEX_DATA
{
UINT64 Reserved;
DWORD IndexData[4];
} XSTUDIO_TITLE_INDEX_DATA;
#ifdef _XBOX //
#endif //
#ifndef _XBOX //
typedef HRESULT (CALLBACK * XSTUDIO_STREAM_CALLBACK)(
_Inout_ XSTUDIO_STREAM_EVENT* pStreamEvent,
_In_opt_ void* pvStreamCallbackContext );
HRESULT
XSTAPI
XStudioRegisterStreamCallback(
_In_ XSTUDIO_STREAM_CALLBACK pfnStreamCallback,
_In_ DWORD dwStreamCallbackRegistrationFlags,
_In_opt_ void* pvStreamCallbackContext,
_Out_ XSTUDIO_HANDLE* phStreamCallback
);
HRESULT
XSTAPI
XStudioCloseHandle(
_In_ XSTUDIO_HANDLE Handle
);
#endif //
// -----------------------------------------------------------------------------
// Notifications
// -----------------------------------------------------------------------------
typedef HRESULT (CALLBACK * XSTUDIO_NOTIFICATION_CALLBACK)(
_In_ XSTUDIO_STREAM_FLAGS dwStreams,
_In_ DWORD dwNotification,
_In_ void* pvContext,
_In_ LPARAM lparam);
#ifndef _XBOX //
HRESULT
XSTAPI
XStudioRegisterNotificationCallback(
_In_ XSTUDIO_NOTIFICATION_CALLBACK pfnNotificationCallback,
_In_ XSTUDIO_STREAM_FLAGS dwStreams,
_In_ DWORD dwNotificationsFlags,
_In_ DWORD dwFlags,
_In_ void* pvContext,
_Out_ XSTUDIO_HANDLE* phandle
);
#endif //
// Called just before playback is started. No events will have been delivered at this point.
#define XSTUDIO_NOTIF_PLAYBACK_STARTING 0x00000001
// Called just after playback is stopped. No more events will be delivered at this point.
#define XSTUDIO_NOTIF_PLAYBACK_STOPPED 0x00000002
// Called just before recording is started. No events will have been delivered at this point.
#define XSTUDIO_NOTIF_RECORDING_STARTING 0x00000004
// Called just after recording is stopped. No more events will be delivered at this point.
#define XSTUDIO_NOTIF_RECORDING_STOPPED 0x00000008
// Called when playback is suspended / resumed
// Does not use stream flags argument
// For SUSPENDED, lparam is one of XSTUDIO_NOTIF_SUSPEND_...
#define XSTUDIO_NOTIF_SUSPENDED 0x00000010
#define XSTUDIO_NOTIF_RESUMING 0x00000020
// Called after the last event in a loop iteration,
// but before the first event in the next loop iteration
#define XSTUDIO_NOTIF_LOOPING 0x00000040
// Switching to a diff producer. Sent before any event make it to the new producer.
// lparam is one of the XSTUDIO_PRODUCER_... values
#define XSTUDIO_NOTIF_SWITCHING_TO_PROD 0x00000080
// Switched to a diff producer. Sent after the switch to a producer is complete.
// lparam is one of the XSTUDIO_PRODUCER_... values
#define XSTUDIO_NOTIF_SWITCHED_TO_PROD 0x00000100
//--------------------------------
// Suspend reasons
//--------------------------------
#define XSTUDIO_NOTIF_SUSPEND_API 1
#define XSTUDIO_NOTIF_SUSPEND_SUSPENDPOINT 2
#define XSTUDIO_NOTIF_SUSPEND_SINGLESTEP 3
// -----------------------------------------------------------------------------
// Monitoring / Live Preview
// -----------------------------------------------------------------------------
#ifndef _XBOX //
#endif //
// -----------------------------------------------------------------------------
// Record and Play Control
// -----------------------------------------------------------------------------
HRESULT
XSTAPI
XStudioStart(
_In_ XSTUDIO_STREAM_FLAGS dwStreams
);
HRESULT
XSTAPI
XStudioStop(
_In_ XSTUDIO_STREAM_FLAGS dwStreams
);
HRESULT
XSTAPI
XStudioStopEx(
_In_ XSTUDIO_STREAM_FLAGS dwStreams,
_In_ XSTUDIO_HANDLE handle
);
// -----------------------------------------------------------------------------
// Status Query
// -----------------------------------------------------------------------------
HRESULT
XSTAPI
XStudioGetActiveStreams(
_Out_ XSTUDIO_STREAM_FLAGS * pdwStreams
);
HRESULT
XSTAPI
XStudioGetErrorStreams(
_Out_ XSTUDIO_STREAM_FLAGS * pdwStreams
);
// -----------------------------------------------------------------------------
// Title Data
// -----------------------------------------------------------------------------
#define XSTUDIO_TITLE_DATA_MAX_BUFFER_SIZE (32*1024)
#ifdef _XBOX //
HRESULT
XSTAPI
XStudioWriteTitleData(
_In_opt_ const XSTUDIO_TITLE_INDEX_DATA * pTitleIndexData,
_In_opt_bytecount_(dwTitleDataBufferSize) const void * pTitleDataBuffer,
_In_ DWORD dwTitleDataBufferSize
);
HRESULT
XSTAPI
XStudioReadTitleData(
_In_ DWORD dwMillisecondsToWait,
_Out_opt_ XSTUDIO_TITLE_INDEX_DATA * pTitleIndexData,
_Out_opt_bytecap_(dwTitleDataBufferSize) void * pTitleDataBuffer,
_In_ DWORD dwTitleDataBufferSize,
_Out_ DWORD * pdwRequiredTitleDataBufferSize
);
#endif //
// -----------------------------------------------------------------------------
// Input Mode
// -----------------------------------------------------------------------------
typedef enum _XSTUDIO_INPUT_MODE
{
XSTUDIO_INPUT_MODE_DEFAULT,
XSTUDIO_INPUT_MODE_SIMULATED,
XSTUDIO_INPUT_MODE_INVALID = 0xFFFFFFFF,
} XSTUDIO_INPUT_MODE;
HRESULT XStudioSetInputMode(
XSTUDIO_STREAM_FLAGS streamFlags,
XSTUDIO_INPUT_MODE InputMode
);
HRESULT XStudioGetInputMode(
XSTUDIO_STREAM_FLAGS streamFlags,
_Out_ XSTUDIO_INPUT_MODE * pInputModeOut
);
// -----------------------------------------------------------------------------
// Loop
// -----------------------------------------------------------------------------
HRESULT XStudioSetLoopCount( XSTUDIO_STREAM_FLAGS streamFlags, UINT loopCount );
HRESULT XStudioGetLoopCount( XSTUDIO_STREAM_FLAGS streamFlags, _Out_ UINT * pLoopCount );
// -----------------------------------------------------------------------------
// Suspend / Resume
// -----------------------------------------------------------------------------
HRESULT XStudioSuspend( XSTUDIO_STREAM_FLAGS streamFlags );
HRESULT XStudioResume( XSTUDIO_STREAM_FLAGS streamFlags );
#ifndef _XBOX //
// -----------------------------------------------------------------------------
// Suspend points / Single step
// -----------------------------------------------------------------------------
HRESULT XStudioAddSuspendPoint(
_In_ XSTUDIO_STREAM_ID dwStreamID,
_In_ DWORD dwEventIndex,
_Out_ XSTUDIO_HANDLE* phandle
);
HRESULT XStudioSingleStep(
_In_ XSTUDIO_STREAM_FLAGS dwStreams
);
#endif //
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,98 @@
/***************************************************************************
* *
* XStudioService.h -- This module defines the APIs for Xbox 360 Studio *
* Services *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
***************************************************************************/
#pragma once
#ifndef XSTUDIO
#error "You must include xstudio.h rather than including xstudioservice.h directly"
#endif
#ifdef __cplusplus
extern "C" {
#endif
// Set bitfield ordering to lsb->msb on PPC (default is msb->lsb)
#if defined(_M_PPCBE)
#pragma bitfield_order(push)
#pragma bitfield_order(lsb_to_msb)
#endif
// -----------------------------------------------------------------------------
// Handle Types
// -----------------------------------------------------------------------------
typedef unsigned int XSTUDIO_HANDLE;
typedef XSTUDIO_HANDLE XSTUDIO_FILE_HANDLE;
// -----------------------------------------------------------------------------
// Stream Types
// -----------------------------------------------------------------------------
typedef enum _XSTUDIO_STREAM_ID
{
XSTUDIO_STREAM_ID_NUICAM_BASE = 0,
XSTUDIO_STREAM_ID_NUICAM_DEPTH = XSTUDIO_STREAM_ID_NUICAM_BASE + 0, // 0
XSTUDIO_STREAM_ID_NUICAM_COLOR = XSTUDIO_STREAM_ID_NUICAM_BASE + 1, // 1
XSTUDIO_STREAM_ID_NUIAPI_BASE = 4,
XSTUDIO_STREAM_ID_NUIAPI_SKELETON = XSTUDIO_STREAM_ID_NUIAPI_BASE + 0, // 4
XSTUDIO_STREAM_ID_NUIAPI_IDENTITY = XSTUDIO_STREAM_ID_NUIAPI_BASE + 2, // 6
XSTUDIO_STREAM_ID_NUIAPI_PLAYER_INDEX = XSTUDIO_STREAM_ID_NUIAPI_BASE + 3, // 7
XSTUDIO_STREAM_ID_TITLE_BASE = 16,
XSTUDIO_STREAM_ID_TITLE_DATA = XSTUDIO_STREAM_ID_TITLE_BASE + 0, // 16
XSTUDIO_STREAM_ID_MISC_PRIVATE = 31, // 31
XSTUDIO_STREAM_ID_COUNT = 32,
XSTUDIO_STREAM_ID_INVALID = 0xFFFFFFFF
} XSTUDIO_STREAM_ID;
typedef DWORD XSTUDIO_STREAM_FLAGS, *PXSTUDIO_STREAM_FLAGS;
#define XSTUDIO_STREAM_FLAG_NONE ( 0 )
#define XSTUDIO_STREAM_FLAG_DEFAULT ( (XSTUDIO_STREAM_FLAGS)-1 )
#define XSTUDIO_STREAM_FLAG_NUICAM_DEPTH ( 1 << XSTUDIO_STREAM_ID_NUICAM_DEPTH )
#define XSTUDIO_STREAM_FLAG_NUICAM_COLOR ( 1 << XSTUDIO_STREAM_ID_NUICAM_COLOR )
#define XSTUDIO_STREAM_FLAG_NUICAM_ALL ( XSTUDIO_STREAM_FLAG_NUICAM_DEPTH | XSTUDIO_STREAM_FLAG_NUICAM_COLOR )
#define XSTUDIO_STREAM_FLAG_NUIAPI_SKELETON ( 1 << XSTUDIO_STREAM_ID_NUIAPI_SKELETON )
#define XSTUDIO_STREAM_FLAG_NUIAPI_IDENTITY ( 1 << XSTUDIO_STREAM_ID_NUIAPI_IDENTITY )
#define XSTUDIO_STREAM_FLAG_NUIAPI_PLAYER_INDEX ( 1 << XSTUDIO_STREAM_ID_NUIAPI_PLAYER_INDEX )
#define XSTUDIO_STREAM_FLAG_NUIAPI_ALL ( XSTUDIO_STREAM_FLAG_NUIAPI_SKELETON \
| XSTUDIO_STREAM_FLAG_NUIAPI_IDENTITY \
| XSTUDIO_STREAM_FLAG_NUIAPI_PLAYER_INDEX )
#define XSTUDIO_STREAM_FLAG_TITLE_DATA ( 1 << XSTUDIO_STREAM_ID_TITLE_DATA )
#define XSTUDIO_STREAM_FLAG_TITLE_ALL ( XSTUDIO_STREAM_FLAG_TITLE_DATA )
#define XSTUDIO_STREAM_FLAG_ALL ( XSTUDIO_STREAM_FLAG_NUICAM_ALL \
| XSTUDIO_STREAM_FLAG_NUIAPI_ALL \
| XSTUDIO_STREAM_FLAG_TITLE_ALL )
#if defined(_M_PPCBE)
#pragma bitfield_order(pop)
#endif
#ifdef __cplusplus
}
#endif

373
third_party/xbox_sdk/include/XedFile.h vendored Normal file
View File

@ -0,0 +1,373 @@
/**************************************************************************
* *
* XedFile.h -- This module defines the APIs for Xbox 360 Studio Files *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
**************************************************************************/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define XEDAPI WINAPI
typedef enum _NUI_IMAGE_TYPE NUI_IMAGE_TYPE;
typedef struct _NUI_SKELETON_FRAME NUI_SKELETON_FRAME;
typedef struct _NUI_IDENTITY_MESSAGE NUI_IDENTITY_MESSAGE;
#ifndef NUI_INITIALIZE_FLAG_USES_COLOR
#define NUI_INITIALIZE_FLAG_USES_COLOR 0x00000002
#endif
#ifndef NUI_INITIALIZE_FLAG_USES_HIGH_QUALITY_COLOR
#define NUI_INITIALIZE_FLAG_USES_HIGH_QUALITY_COLOR 0x00000040
#endif
typedef struct _XSTUDIO_TITLE_INDEX_DATA XSTUDIO_TITLE_INDEX_DATA;
typedef struct XED_CONTEXT XED_CONTEXT;
#define XED_EVENTINDEX_INVALID ((UINT)-1)
#define XED_FRAMENUMBER_INVALID ((UINT)-1)
#define XED_TIMESTAMP_INVALID ((UINT64)-1)
#define XED_FLAG_CREATE_NEW CREATE_NEW
#define XED_FLAG_CREATE_ALWAYS CREATE_ALWAYS
HRESULT
XEDAPI
XedOpenFile(
_In_z_ const char * sFilePath,
DWORD flags,
_Deref_out_opt_ XED_CONTEXT ** ppContext
);
HRESULT
XEDAPI
XedCreateFile(
_In_z_ const char * sFilePath,
_In_opt_ const XED_CONTEXT * pTemplate,
DWORD flags,
_Deref_out_opt_ XED_CONTEXT ** ppContext
);
HRESULT
XEDAPI
XedCloseFile(
XED_CONTEXT ** ppContext
);
HRESULT
XedSetNuiDepthImageType(
XED_CONTEXT * pContext,
NUI_IMAGE_TYPE newImageType,
NUI_IMAGE_TYPE * pPreviousImageType
);
HRESULT
XEDAPI
XedSetNuiColorBufferType(
_In_ XED_CONTEXT * pContext,
NUI_IMAGE_TYPE newImageType,
_Out_opt_ NUI_IMAGE_TYPE * pPreviousImageType
);
HRESULT
XEDAPI
XedSetFileNuiColorQuality(
_In_ XED_CONTEXT * pContext,
DWORD newColorQuality,
_Out_opt_ DWORD * pPreviousColorQuality
);
UINT
XEDAPI
XedGetNuiDepthEventCount(
_In_ XED_CONTEXT * pContext
);
UINT
XEDAPI
XedGetNuiColorEventCount(
_In_ XED_CONTEXT * pContext
);
UINT
XEDAPI
XedGetNuiSkeletonEventCount(
_In_ XED_CONTEXT * pContext
);
UINT
XEDAPI
XedGetNuiDepthEventIndexFromFrameNumber(
_In_ XED_CONTEXT * pContext,
UINT frameNumber
);
UINT
XEDAPI
XedGetNuiColorEventIndexFromFrameNumber(
_In_ XED_CONTEXT * pContext,
UINT frameNumber
);
UINT
XEDAPI
XedGetNuiSkeletonEventIndexFromFrameNumber(
_In_ XED_CONTEXT * pContext,
UINT frameNumber
);
UINT
XEDAPI
XedGetNuiDepthEventIndexFromMicroseconds(
_In_ XED_CONTEXT * pContext,
UINT64 frameMicroseconds
);
UINT
XEDAPI
XedGetNuiColorEventIndexFromMicroseconds(
_In_ XED_CONTEXT * pContext,
UINT64 frameMicroseconds
);
UINT
XEDAPI
XedGetNuiSkeletonEventIndexFromMicroseconds(
_In_ XED_CONTEXT * pContext,
UINT64 frameMicroseconds
);
HRESULT
XEDAPI
XedReadNuiDepthFrame(
_In_ XED_CONTEXT * pContext,
UINT eventIndex,
_Out_opt_ UINT * pFrameNumber,
_Out_opt_ UINT64 * pFrameMicroseconds,
_Out_opt_bytecap_(bufferSize) WORD * pBuffer,
UINT bufferSize, // in bytes
BOOL registerWithColor
);
HRESULT
XEDAPI
XedReadNuiColorFrame(
_In_ XED_CONTEXT * pContext,
UINT eventIndex,
_Out_opt_ UINT * pFrameNumber,
_Out_opt_ UINT64 * pFrameMicroseconds,
_Out_opt_bytecap_(bufferSize) DWORD * pBuffer,
UINT bufferSize, // in bytes
BOOL registerWithDepth
);
HRESULT
XEDAPI
XedReadNuiSkeletonFrame(
_In_ XED_CONTEXT * pContext,
UINT eventIndex,
_Out_opt_ UINT * pFrameNumber,
_Out_opt_ UINT64 * pFrameMicroseconds,
_Out_opt_bytecap_(skeletonFrameSize) NUI_SKELETON_FRAME * pSkeletonFrame,
UINT skeletonFrameSize
);
HRESULT
XEDAPI
XedWriteNuiDepthFrame(
_In_ XED_CONTEXT * pContext,
UINT frameNumber,
UINT64 frameMicroseconds,
_In_bytecount_(bufferSize) const WORD * pBuffer,
UINT bufferSize // in bytes
);
HRESULT
XEDAPI
XedWriteNuiColorFrame(
_In_ XED_CONTEXT * pContext,
UINT frameNumber,
UINT64 frameMicroseconds,
_In_bytecount_(bufferSize) const DWORD * pBuffer,
UINT bufferSize // in bytes
);
HRESULT
XEDAPI
XedWriteNuiSkeletonFrame(
_In_ XED_CONTEXT * pContext,
UINT frameNumber,
UINT64 frameMicroseconds,
_In_bytecount_(skeletonFrameSize) const NUI_SKELETON_FRAME * pSkeletonFrame,
UINT skeletonFrameSize
);
HRESULT
XEDAPI
XedCopyNuiDepthFrame(
_In_ XED_CONTEXT * pFromContext,
UINT eventIndex,
_In_ XED_CONTEXT * pToContext,
UINT frameNumber,
UINT64 frameMicroseconds
);
HRESULT
XEDAPI
XedCopyNuiColorFrame(
_In_ XED_CONTEXT * pFromContext,
UINT eventIndex,
_In_ XED_CONTEXT * pToContext,
UINT frameNumber,
UINT64 frameMicroseconds
);
HRESULT
XEDAPI
XedCopyNuiSkeletonFrame(
_In_ XED_CONTEXT * pFromContext,
UINT eventIndex,
_In_ XED_CONTEXT * pToContext,
UINT frameNumber,
UINT64 frameMicroseconds
);
UINT
XEDAPI
XedGetTitleDataEventCount(
_In_ XED_CONTEXT * pContext
);
UINT
XEDAPI
XedGetTitleDataEventIndexFromMicroseconds(
_In_ XED_CONTEXT * pContext,
UINT64 eventMicroseconds
);
HRESULT
XEDAPI
XedReadTitleData(
_In_ XED_CONTEXT * pContext,
UINT eventIndex,
_Out_opt_ UINT64 * pEventMicroseconds,
_Out_opt_ XSTUDIO_TITLE_INDEX_DATA * pTitleIndexData,
_Out_opt_bytecap_(titleDataBufferSize) void * pTitleDataBuffer,
UINT titleDataBufferSize,
_Out_ UINT * pRequiredTitleDataBufferSize
);
HRESULT
XEDAPI
XedWriteTitleData(
_In_ XED_CONTEXT * pContext,
UINT64 eventMicroseconds,
_In_opt_ const XSTUDIO_TITLE_INDEX_DATA * pTitleIndexData,
_In_bytecount_(titleDataBufferSize) const void * pTitleDataBuffer,
UINT titleDataBufferSize
);
HRESULT
XEDAPI
XedCopyTitleData(
_In_ XED_CONTEXT * pFromContext,
UINT eventIndex,
_In_ XED_CONTEXT * pToContext,
UINT64 eventMicroseconds
);
UINT
XEDAPI
XedGetEventCount(
_In_ XED_CONTEXT * pContext,
XSTUDIO_STREAM_ID streamId
);
UINT
XEDAPI
XedGetEventIndexFromMicroseconds(
_In_ XED_CONTEXT * pContext,
XSTUDIO_STREAM_ID streamId,
UINT64 eventMicroseconds
);
HRESULT
XEDAPI
XedReadNuiIdentityMessage(
_In_ XED_CONTEXT * pContext,
UINT eventIndex,
_Out_opt_ UINT64* pFrameMicroseconds,
_Out_opt_bytecap_(identityMessageSize) NUI_IDENTITY_MESSAGE * pIdentityMessage,
UINT identityMessageSize
);
HRESULT
XEDAPI
XedWriteNuiIdentityMessage(
_In_ XED_CONTEXT * pContext,
UINT64 frameMicroseconds,
_In_bytecount_(identityMessageSize) const NUI_IDENTITY_MESSAGE * pIdentityMessage,
UINT identityMessageSize
);
HRESULT
XEDAPI
XedCopyNuiIdentityMessage(
_In_ XED_CONTEXT * pSrcContext,
UINT srcEventIndex,
_In_ XED_CONTEXT * pDstContext,
DWORD dwDstTrackingID,
UINT64 dstEventMicroseconds );
#ifdef __cplusplus
} // extern "C"
#endif

263
third_party/xbox_sdk/include/audiodefs.h vendored Normal file
View File

@ -0,0 +1,263 @@
/***************************************************************************
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* File: audiodefs.h
* Content: Basic constants and data types for audio work.
*
* Remarks: This header file defines all of the audio format constants and
* structures required for XAudio2 and XACT work. Providing these
* in a single location avoids certain dependency problems in the
* legacy audio headers (mmreg.h, mmsystem.h, ksmedia.h).
*
* NOTE: Including the legacy headers after this one may cause a
* compilation error, because they define some of the same types
* defined here without preprocessor guards to avoid multiple
* definitions. If a source file needs one of the old headers,
* it must include it before including audiodefs.h.
*
***************************************************************************/
#ifndef __AUDIODEFS_INCLUDED__
#define __AUDIODEFS_INCLUDED__
#include <windef.h> // For WORD, DWORD, etc.
#pragma pack(push, 1) // Pack structures to 1-byte boundaries
/**************************************************************************
*
* WAVEFORMATEX: Base structure for many audio formats. Format-specific
* extensions can be defined for particular formats by using a non-zero
* cbSize value and adding extra fields to the end of this structure.
*
***************************************************************************/
#ifndef _WAVEFORMATEX_
#define _WAVEFORMATEX_
typedef struct tWAVEFORMATEX
{
WORD wFormatTag; // Integer identifier of the format
WORD nChannels; // Number of audio channels
DWORD nSamplesPerSec; // Audio sample rate
DWORD nAvgBytesPerSec; // Bytes per second (possibly approximate)
WORD nBlockAlign; // Size in bytes of a sample block (all channels)
WORD wBitsPerSample; // Size in bits of a single per-channel sample
WORD cbSize; // Bytes of extra data appended to this struct
} WAVEFORMATEX;
#endif
// Defining pointer types outside of the #if block to make sure they are
// defined even if mmreg.h or mmsystem.h is #included before this file
typedef WAVEFORMATEX *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
typedef const WAVEFORMATEX *PCWAVEFORMATEX, *LPCWAVEFORMATEX;
/**************************************************************************
*
* WAVEFORMATEXTENSIBLE: Extended version of WAVEFORMATEX that should be
* used as a basis for all new audio formats. The format tag is replaced
* with a GUID, allowing new formats to be defined without registering a
* format tag with Microsoft. There are also new fields that can be used
* to specify the spatial positions for each channel and the bit packing
* used for wide samples (e.g. 24-bit PCM samples in 32-bit containers).
*
***************************************************************************/
#ifndef _WAVEFORMATEXTENSIBLE_
#define _WAVEFORMATEXTENSIBLE_
typedef struct
{
WAVEFORMATEX Format; // Base WAVEFORMATEX data
union
{
WORD wValidBitsPerSample; // Valid bits in each sample container
WORD wSamplesPerBlock; // Samples per block of audio data; valid
// if wBitsPerSample=0 (but rarely used).
WORD wReserved; // Zero if neither case above applies.
} Samples;
DWORD dwChannelMask; // Positions of the audio channels
GUID SubFormat; // Format identifier GUID
} WAVEFORMATEXTENSIBLE;
#endif
typedef WAVEFORMATEXTENSIBLE *PWAVEFORMATEXTENSIBLE, *LPWAVEFORMATEXTENSIBLE;
typedef const WAVEFORMATEXTENSIBLE *PCWAVEFORMATEXTENSIBLE, *LPCWAVEFORMATEXTENSIBLE;
/**************************************************************************
*
* Define the most common wave format tags used in WAVEFORMATEX formats.
*
***************************************************************************/
#ifndef WAVE_FORMAT_PCM // Pulse Code Modulation
// If WAVE_FORMAT_PCM is not defined, we need to define some legacy types
// for compatibility with the Windows mmreg.h / mmsystem.h header files.
// Old general format structure (information common to all formats)
typedef struct waveformat_tag
{
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
DWORD nAvgBytesPerSec;
WORD nBlockAlign;
} WAVEFORMAT, *PWAVEFORMAT, NEAR *NPWAVEFORMAT, FAR *LPWAVEFORMAT;
// Specific format structure for PCM data
typedef struct pcmwaveformat_tag
{
WAVEFORMAT wf;
WORD wBitsPerSample;
} PCMWAVEFORMAT, *PPCMWAVEFORMAT, NEAR *NPPCMWAVEFORMAT, FAR *LPPCMWAVEFORMAT;
#define WAVE_FORMAT_PCM 0x0001
#endif
#ifndef WAVE_FORMAT_ADPCM // Microsoft Adaptive Differental PCM
// Replicate the Microsoft ADPCM type definitions from mmreg.h.
typedef struct adpcmcoef_tag
{
short iCoef1;
short iCoef2;
} ADPCMCOEFSET;
#pragma warning(push)
#pragma warning(disable:4200) // Disable zero-sized array warnings
typedef struct adpcmwaveformat_tag {
WAVEFORMATEX wfx;
WORD wSamplesPerBlock;
WORD wNumCoef;
ADPCMCOEFSET aCoef[]; // Always 7 coefficient pairs for MS ADPCM
} ADPCMWAVEFORMAT;
#pragma warning(pop)
#define WAVE_FORMAT_ADPCM 0x0002
#endif
// Other frequently used format tags
#ifndef WAVE_FORMAT_UNKNOWN
#define WAVE_FORMAT_UNKNOWN 0x0000 // Unknown or invalid format tag
#endif
#ifndef WAVE_FORMAT_IEEE_FLOAT
#define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point
#endif
#ifndef WAVE_FORMAT_MPEGLAYER3
#define WAVE_FORMAT_MPEGLAYER3 0x0055 // ISO/MPEG Layer3
#endif
#ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 // Dolby Audio Codec 3 over S/PDIF
#endif
#ifndef WAVE_FORMAT_WMAUDIO2
#define WAVE_FORMAT_WMAUDIO2 0x0161 // Windows Media Audio
#endif
#ifndef WAVE_FORMAT_WMAUDIO3
#define WAVE_FORMAT_WMAUDIO3 0x0162 // Windows Media Audio Pro
#endif
#ifndef WAVE_FORMAT_WMASPDIF
#define WAVE_FORMAT_WMASPDIF 0x0164 // Windows Media Audio over S/PDIF
#endif
#ifndef WAVE_FORMAT_EXTENSIBLE
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE // All WAVEFORMATEXTENSIBLE formats
#endif
/**************************************************************************
*
* Define the most common wave format GUIDs used in WAVEFORMATEXTENSIBLE
* formats. Note that including the Windows ksmedia.h header after this
* one will cause build problems; this cannot be avoided, since ksmedia.h
* defines these macros without preprocessor guards.
*
***************************************************************************/
#ifdef __cplusplus // uuid() and __uuidof() are only available in C++
#ifndef KSDATAFORMAT_SUBTYPE_PCM
struct __declspec(uuid("00000001-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_PCM_STRUCT;
#define KSDATAFORMAT_SUBTYPE_PCM __uuidof(KSDATAFORMAT_SUBTYPE_PCM_STRUCT)
#endif
#ifndef KSDATAFORMAT_SUBTYPE_ADPCM
struct __declspec(uuid("00000002-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT;
#define KSDATAFORMAT_SUBTYPE_ADPCM __uuidof(KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT)
#endif
#ifndef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
struct __declspec(uuid("00000003-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT;
#define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT __uuidof(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT)
#endif
#endif
/**************************************************************************
*
* Speaker positions used in the WAVEFORMATEXTENSIBLE dwChannelMask field.
*
***************************************************************************/
#ifndef SPEAKER_FRONT_LEFT
#define SPEAKER_FRONT_LEFT 0x00000001
#define SPEAKER_FRONT_RIGHT 0x00000002
#define SPEAKER_FRONT_CENTER 0x00000004
#define SPEAKER_LOW_FREQUENCY 0x00000008
#define SPEAKER_BACK_LEFT 0x00000010
#define SPEAKER_BACK_RIGHT 0x00000020
#define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040
#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080
#define SPEAKER_BACK_CENTER 0x00000100
#define SPEAKER_SIDE_LEFT 0x00000200
#define SPEAKER_SIDE_RIGHT 0x00000400
#define SPEAKER_TOP_CENTER 0x00000800
#define SPEAKER_TOP_FRONT_LEFT 0x00001000
#define SPEAKER_TOP_FRONT_CENTER 0x00002000
#define SPEAKER_TOP_FRONT_RIGHT 0x00004000
#define SPEAKER_TOP_BACK_LEFT 0x00008000
#define SPEAKER_TOP_BACK_CENTER 0x00010000
#define SPEAKER_TOP_BACK_RIGHT 0x00020000
#define SPEAKER_RESERVED 0x7FFC0000
#define SPEAKER_ALL 0x80000000
#define _SPEAKER_POSITIONS_
#endif
#ifndef SPEAKER_STEREO
#define SPEAKER_MONO (SPEAKER_FRONT_CENTER)
#define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)
#define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY)
#define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
#define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
#define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
#define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
#define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER)
#define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
#define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
#endif
#pragma pack(pop)
#endif // #ifndef __AUDIODEFS_INCLUDED__

5282
third_party/xbox_sdk/include/d3d9.h vendored Normal file

File diff suppressed because it is too large Load Diff

531
third_party/xbox_sdk/include/d3d9caps.h vendored Normal file
View File

@ -0,0 +1,531 @@
/*==========================================================================;
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: d3d9caps.h
* Content: Direct3D capabilities include file
*
***************************************************************************/
#ifndef _d3d9CAPS_H
#define _d3d9CAPS_H
#ifndef DIRECT3D_VERSION
#define DIRECT3D_VERSION 0x0900
#endif //DIRECT3D_VERSION
// include this file content only if compiling for DX9 interfaces
#if(DIRECT3D_VERSION >= 0x0900)
#if defined(_X86_) || defined(_IA64)
#pragma pack(push, 4)
#endif
/*
* Various handy maximums for Xbox 360 D3D
*/
// The maximum number of streams
#define D3DMAXSTREAMS 16
// The maximum number of float vertex shader constants
#define D3DMAXVERTEXSHADERCONSTANTSF GPU_D3D_VERTEX_CONSTANTF_COUNT
// The maximum number of integer vertex shader constants
#define D3DMAXVERTEXSHADERCONSTANTSI GPU_D3D_VERTEX_CONSTANTI_COUNT
// The maximum number of boolean vertex shader constants
#define D3DMAXVERTEXSHADERCONSTANTSB GPU_D3D_VERTEX_CONSTANTB_COUNT
// The maximum number of float pixel shader constants
#define D3DMAXPIXELSHADERCONSTANTSF GPU_D3D_PIXEL_CONSTANTF_COUNT
// The maximum number of integer pixel shader constants
#define D3DMAXPIXELSHADERCONSTANTSI GPU_D3D_PIXEL_CONSTANTI_COUNT
// The maximum number of boolean pixel shader constants
#define D3DMAXPIXELSHADERCONSTANTSB GPU_D3D_PIXEL_CONSTANTB_COUNT
// The maximum shader instructions (shared between pixel and vertex shader)
#define D3DMAXSHADERINSTRUCTIONS GPU_INSTRUCTIONS
// The maximum number of simultaneous render targets
#define D3DMAXRENDERTARGETS 4
// The maximum number of user clipping planes
#define D3DMAXUSERCLIPPLANES 6
// The maximum dimension for textures and cubemaps
#define D3DMAXTEXTUREDIMENSION GPU_MAX_TEXTURE_DIMENSION
// The maximum offset of a renderable surface offset (there's 10MB of EDRAM)
#define D3DMAXSURFACEOFFSET GPU_EDRAM_SIZE
// The maximum number of samplers
#define D3DSAMP_MAXSAMPLERS GPU_D3D_TEXTURE_FETCH_CONSTANT_COUNT
// The source rectangle for Resolve must be 8x8 pixel aligned
#define D3DRESOLVEALIGNMENT GPU_RESOLVE_ALIGNMENT
// The maximum number of texture stages supported by the fixed function
// pipeline, if the fixed function pipeline were to be supported on Xbox 360
// (which it's not)
#define D3DTSS_MAXSTAGES 8
/*
* Standard DirectX 9 structures
*/
typedef struct _D3DVSHADERCAPS2_0
{
DWORD Caps;
INT DynamicFlowControlDepth;
INT NumTemps;
INT StaticFlowControlDepth;
} D3DVSHADERCAPS2_0;
#define D3DVS20CAPS_PREDICATION (1<<0)
#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24
#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0
#define D3DVS20_MAX_NUMTEMPS 32
#define D3DVS20_MIN_NUMTEMPS 12
#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4
#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1
typedef struct _D3DPSHADERCAPS2_0
{
DWORD Caps;
INT DynamicFlowControlDepth;
INT NumTemps;
INT StaticFlowControlDepth;
INT NumInstructionSlots;
} D3DPSHADERCAPS2_0;
#define D3DPS20CAPS_ARBITRARYSWIZZLE (1<<0)
#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1<<1)
#define D3DPS20CAPS_PREDICATION (1<<2)
#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1<<3)
#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1<<4)
#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24
#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0
#define D3DPS20_MAX_NUMTEMPS 32
#define D3DPS20_MIN_NUMTEMPS 12
#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4
#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0
#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512
#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96
#define D3DMIN30SHADERINSTRUCTIONS 512
#define D3DMAX30SHADERINSTRUCTIONS 32768
typedef struct _D3DCAPS9
{
/* Device Info */
D3DDEVTYPE DeviceType;
UINT AdapterOrdinal;
/* Caps from DX7 Draw */
DWORD Caps;
DWORD Caps2;
DWORD Caps3;
DWORD PresentationIntervals;
/* Cursor Caps */
DWORD CursorCaps;
/* 3D Device Caps */
DWORD DevCaps;
DWORD PrimitiveMiscCaps;
DWORD RasterCaps;
DWORD ZCmpCaps;
DWORD SrcBlendCaps;
DWORD DestBlendCaps;
DWORD AlphaCmpCaps;
DWORD ShadeCaps;
DWORD TextureCaps;
DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's
DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture9's
DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's
DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture9's
DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's
DWORD LineCaps; // D3DLINECAPS
DWORD MaxTextureWidth, MaxTextureHeight;
DWORD MaxVolumeExtent;
DWORD MaxTextureRepeat;
DWORD MaxTextureAspectRatio;
DWORD MaxAnisotropy;
float MaxVertexW;
float GuardBandLeft;
float GuardBandTop;
float GuardBandRight;
float GuardBandBottom;
float ExtentsAdjust;
DWORD StencilCaps;
DWORD FVFCaps;
DWORD TextureOpCaps;
DWORD MaxTextureBlendStages;
DWORD MaxSimultaneousTextures;
DWORD VertexProcessingCaps;
DWORD MaxActiveLights;
DWORD MaxUserClipPlanes;
DWORD MaxVertexBlendMatrices;
DWORD MaxVertexBlendMatrixIndex;
float MaxPointSize;
DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call
DWORD MaxVertexIndex;
DWORD MaxStreams;
DWORD MaxStreamStride; // max stride for SetStreamSource
DWORD VertexShaderVersion;
DWORD MaxVertexShaderConst; // number of vertex shader constant registers
DWORD PixelShaderVersion;
float PixelShader1xMaxValue; // max value storable in registers of ps.1.x shaders
// Here are the DX9 specific ones
DWORD DevCaps2;
float MaxNpatchTessellationLevel;
DWORD Reserved5;
UINT MasterAdapterOrdinal; // ordinal of master adaptor for adapter group
UINT AdapterOrdinalInGroup; // ordinal inside the adapter group
UINT NumberOfAdaptersInGroup; // number of adapters in this adapter group (only if master)
DWORD DeclTypes; // Data types, supported in vertex declarations
DWORD NumSimultaneousRTs; // Will be at least 1
DWORD StretchRectFilterCaps; // Filter caps supported by StretchRect
D3DVSHADERCAPS2_0 VS20Caps;
D3DPSHADERCAPS2_0 PS20Caps;
DWORD VertexTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used in vertex shaders
DWORD MaxVShaderInstructionsExecuted; // maximum number of vertex shader instructions that can be executed
DWORD MaxPShaderInstructionsExecuted; // maximum number of pixel shader instructions that can be executed
DWORD MaxVertexShader30InstructionSlots;
DWORD MaxPixelShader30InstructionSlots;
} D3DCAPS9;
//
// BIT DEFINES FOR D3DCAPS9 DWORD MEMBERS
//
//
// Caps
//
#define D3DCAPS_READ_SCANLINE 0x00020000L
//
// Caps2
//
#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L
#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L
#define D3DCAPS2_RESERVED 0x02000000L
#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L
#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L
#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L
//
// Caps3
//
#define D3DCAPS3_RESERVED 0x8000001fL
// Indicates that the device can respect the ALPHABLENDENABLE render state
// when fullscreen while using the FLIP or DISCARD swap effect.
// COPY and COPYVSYNC swap effects work whether or not this flag is set.
#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L
// Indicates that the device can perform a gamma correction from
// a windowed back buffer containing linear content to the sRGB desktop.
#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080L
#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L /* Device can acclerate copies from sysmem to local vidmem */
#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L /* Device can acclerate copies from local vidmem to sysmem */
//
// PresentationIntervals
//
#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L
#define D3DPRESENT_INTERVAL_ONE 0x00000001L
#define D3DPRESENT_INTERVAL_TWO 0x00000002L
#define D3DPRESENT_INTERVAL_THREE 0x00000004L
#define D3DPRESENT_INTERVAL_FOUR 0x00000008L
#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L
//
// CursorCaps
//
// Driver supports HW color cursor in at least hi-res modes(height >=400)
#define D3DCURSORCAPS_COLOR 0x00000001L
// Driver supports HW cursor also in low-res modes(height < 400)
#define D3DCURSORCAPS_LOWRES 0x00000002L
//
// DevCaps
//
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */
#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */
#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */
#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */
#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */
#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */
#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */
#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */
#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */
//
// PrimitiveMiscCaps
//
#define D3DPMISCCAPS_MASKZ 0x00000002L
#define D3DPMISCCAPS_CULLNONE 0x00000010L
#define D3DPMISCCAPS_CULLCW 0x00000020L
#define D3DPMISCCAPS_CULLCCW 0x00000040L
#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L
#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */
#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */
#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */
#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */
#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */
#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000L /* Device supports independent write masks for MET or MRT */
#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000L /* Device supports per-stage constants */
#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000L /* Device supports separate fog and specular alpha (many devices
use the specular alpha channel to store fog factor) */
#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000L /* Device supports separate blend settings for the alpha channel */
#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000L /* Device supports different bit depths for MRT */
#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L /* Device supports post-pixel shader operations for MRT */
#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L /* Device clamps fog blend factor per vertex */
//
// LineCaps
//
#define D3DLINECAPS_TEXTURE 0x00000001L
#define D3DLINECAPS_ZTEST 0x00000002L
#define D3DLINECAPS_BLEND 0x00000004L
#define D3DLINECAPS_ALPHACMP 0x00000008L
#define D3DLINECAPS_FOG 0x00000010L
#define D3DLINECAPS_ANTIALIAS 0x00000020L
//
// RasterCaps
//
#define D3DPRASTERCAPS_DITHER 0x00000001L
#define D3DPRASTERCAPS_ZTEST 0x00000010L
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L
#define D3DPRASTERCAPS_FOGTABLE 0x00000100L
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L
#define D3DPRASTERCAPS_FOGRANGE 0x00010000L
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L
#define D3DPRASTERCAPS_WBUFFER 0x00040000L
#define D3DPRASTERCAPS_WFOG 0x00100000L
#define D3DPRASTERCAPS_ZFOG 0x00200000L
#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */
#define D3DPRASTERCAPS_SCISSORTEST 0x01000000L
#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000L
#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000L
#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000L
//
// ZCmpCaps, AlphaCmpCaps
//
#define D3DPCMPCAPS_NEVER 0x00000001L
#define D3DPCMPCAPS_LESS 0x00000002L
#define D3DPCMPCAPS_EQUAL 0x00000004L
#define D3DPCMPCAPS_LESSEQUAL 0x00000008L
#define D3DPCMPCAPS_GREATER 0x00000010L
#define D3DPCMPCAPS_NOTEQUAL 0x00000020L
#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L
#define D3DPCMPCAPS_ALWAYS 0x00000080L
//
// SourceBlendCaps, DestBlendCaps
//
#define D3DPBLENDCAPS_ZERO 0x00000001L
#define D3DPBLENDCAPS_ONE 0x00000002L
#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L
#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L
#define D3DPBLENDCAPS_SRCALPHA 0x00000010L
#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L
#define D3DPBLENDCAPS_DESTALPHA 0x00000040L
#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L
#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L
#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L
#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L
#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000L /* Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR */
//
// ShadeCaps
//
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L
#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L
//
// TextureCaps
//
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */
#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */
#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */
#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */
#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */
// Device can use non-POW2 textures if:
// 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
// 2) D3DRS_WRAP(N) is zero for this texture's coordinates
// 3) mip mapping is not enabled (use magnification filter only)
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L
#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */
#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */
#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */
#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */
#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */
#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */
#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */
#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000L /* Device does not support projected bump env lookup operation
in programmable and fixed function pixel shaders */
//
// TextureFilterCaps, StretchRectFilterCaps
//
#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */
#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L
#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L
#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD 0x00000800L
#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000L
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L
#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000L
#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000L
//
// TextureAddressCaps
//
#define D3DPTADDRESSCAPS_WRAP 0x00000001L
#define D3DPTADDRESSCAPS_MIRROR 0x00000002L
#define D3DPTADDRESSCAPS_CLAMP 0x00000004L
#define D3DPTADDRESSCAPS_BORDER 0x00000008L
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L
#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L
//
// StencilCaps
//
#define D3DSTENCILCAPS_KEEP 0x00000001L
#define D3DSTENCILCAPS_ZERO 0x00000002L
#define D3DSTENCILCAPS_REPLACE 0x00000004L
#define D3DSTENCILCAPS_INCRSAT 0x00000008L
#define D3DSTENCILCAPS_DECRSAT 0x00000010L
#define D3DSTENCILCAPS_INVERT 0x00000020L
#define D3DSTENCILCAPS_INCR 0x00000040L
#define D3DSTENCILCAPS_DECR 0x00000080L
#define D3DSTENCILCAPS_TWOSIDED 0x00000100L
//
// TextureOpCaps
//
#define D3DTEXOPCAPS_DISABLE 0x00000001L
#define D3DTEXOPCAPS_SELECTARG1 0x00000002L
#define D3DTEXOPCAPS_SELECTARG2 0x00000004L
#define D3DTEXOPCAPS_MODULATE 0x00000008L
#define D3DTEXOPCAPS_MODULATE2X 0x00000010L
#define D3DTEXOPCAPS_MODULATE4X 0x00000020L
#define D3DTEXOPCAPS_ADD 0x00000040L
#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L
#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L
#define D3DTEXOPCAPS_SUBTRACT 0x00000200L
#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L
#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L
#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L
#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L
#define D3DTEXOPCAPS_PREMODULATE 0x00010000L
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L
#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L
#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L
#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L
#define D3DTEXOPCAPS_LERP 0x02000000L
//
// FVFCaps
//
#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */
#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */
#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */
//
// VertexProcessingCaps
//
#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */
#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */
#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */
#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */
#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */
#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */
#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100L /* device supports D3DTSS_TCI_SPHEREMAP */
#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200L /* device does not support TexGen in non-local
viewer mode */
//
// DevCaps2
//
#define D3DDEVCAPS2_STREAMOFFSET 0x00000001L /* Device supports offsets in streams. Must be set by DX9 drivers */
#define D3DDEVCAPS2_DMAPNPATCH 0x00000002L /* Device supports displacement maps for N-Patches*/
#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004L /* Device supports adaptive tesselation of RT-patches*/
#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008L /* Device supports adaptive tesselation of N-patches*/
#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010L /* Device supports StretchRect calls with a texture as the source*/
#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020L /* Device supports presampled displacement maps for N-Patches */
#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040L /* Vertex elements in a vertex declaration can share the same stream offset */
//
// DeclTypes
//
#define D3DDTCAPS_UBYTE4 0x00000001L
#define D3DDTCAPS_UBYTE4N 0x00000002L
#define D3DDTCAPS_SHORT2N 0x00000004L
#define D3DDTCAPS_SHORT4N 0x00000008L
#define D3DDTCAPS_USHORT2N 0x00000010L
#define D3DDTCAPS_USHORT4N 0x00000020L
#define D3DDTCAPS_UDEC3 0x00000040L
#define D3DDTCAPS_DEC3N 0x00000080L
#define D3DDTCAPS_FLOAT16_2 0x00000100L
#define D3DDTCAPS_FLOAT16_4 0x00000200L
#if defined(_X86_) || defined(_IA64)
#pragma pack(pop)
#endif
#endif /* (DIRECT3D_VERSION >= 0x0900) */
#endif /* _d3d9CAPS_H_ */

View File

@ -0,0 +1,239 @@
/*==========================================================================;
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: d3d9fftypes.h
* Content: Legacy Direct3D types used by the unsupported fixed function
* pipeline
*
***************************************************************************/
#ifndef _d3d9FFTYPES_H_
#define _d3d9FFTYPES_H_
// Only define these items if explicitly asked for.
// (This is done to prevent the casual reintroduction
// of these types, when all the program wants is some
// other D3D fixed function data type.
#ifdef D3DCOMPILE_DEFINE_POSITIONT_AND_XYZRHW
#define D3DDECLUSAGE_POSITIONT ((D3DDECLUSAGE) 9)
#define D3DFVF_XYZRHW 0x004
#endif // D3DCOMPILE_DEFINE_POSITIONT_AND_XYZRHW
typedef struct _D3DMATERIAL9 {
D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */
D3DCOLORVALUE Ambient; /* Ambient color RGB */
D3DCOLORVALUE Specular; /* Specular 'shininess' */
D3DCOLORVALUE Emissive; /* Emissive color RGB */
float Power; /* Sharpness if specular highlight */
} D3DMATERIAL9;
typedef enum _D3DLIGHTTYPE {
D3DLIGHT_POINT = 1,
D3DLIGHT_SPOT = 2,
D3DLIGHT_DIRECTIONAL = 3,
D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DLIGHTTYPE;
typedef struct _D3DLIGHT9 {
D3DLIGHTTYPE Type; /* Type of light source */
D3DCOLORVALUE Diffuse; /* Diffuse color of light */
D3DCOLORVALUE Specular; /* Specular color of light */
D3DCOLORVALUE Ambient; /* Ambient color of light */
D3DVECTOR Position; /* Position in world space */
D3DVECTOR Direction; /* Direction in world space */
float Range; /* Cutoff range */
float Falloff; /* Falloff */
float Attenuation0; /* Constant attenuation */
float Attenuation1; /* Linear attenuation */
float Attenuation2; /* Quadratic attenuation */
float Theta; /* Inner angle of spotlight cone */
float Phi; /* Outer angle of spotlight cone */
} D3DLIGHT9;
typedef enum _D3DFOGMODE {
D3DFOG_NONE = 0,
D3DFOG_EXP = 1,
D3DFOG_EXP2 = 2,
D3DFOG_LINEAR = 3,
D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DFOGMODE;
typedef enum _D3DTRANSFORMSTATETYPE {
D3DTS_WORLD = 0,
D3DTS_VIEW = 1,
D3DTS_PROJECTION = 2,
D3DTS_TEXTURE0 = 3,
D3DTS_TEXTURE1 = 4,
D3DTS_TEXTURE2 = 5,
D3DTS_TEXTURE3 = 6,
D3DTS_TEXTURE4 = 7,
D3DTS_TEXTURE5 = 8,
D3DTS_TEXTURE6 = 9,
D3DTS_TEXTURE7 = 10,
D3DTS_MAX = 11,
D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DTRANSFORMSTATETYPE;
#define D3DTS_WORLDMATRIX(index) (D3DTS_WORLD)
// Values for material source
typedef enum _D3DMATERIALCOLORSOURCE
{
D3DMCS_MATERIAL = 0, // Color from material is used
D3DMCS_COLOR1 = 1, // Diffuse vertex color is used
D3DMCS_COLOR2 = 2, // Specular vertex color is used
D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DMATERIALCOLORSOURCE;
/*
* State enumerants for per-stage processing of fixed function pixel processing
* Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX.
*/
typedef enum _D3DTEXTURESTAGESTATETYPE
{
D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */
D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */
D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */
D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */
D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */
D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */
D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */
D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */
D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */
D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */
D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */
D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */
D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */
D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */
D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */
D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */
D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */
D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */
D3DTSS_MAX = 33, /* Total number of texture stage states */
D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DTEXTURESTAGESTATETYPE;
// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
// and normal in the camera space) should be taken as texture coordinates
// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
//
#define D3DTSS_TCI_PASSTHRU 0x00000000
#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000
#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000
#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000
#define D3DTSS_TCI_SPHEREMAP 0x00040000
/*
* Enumerations for COLOROP and ALPHAOP texture blending operations set in
* texture processing stage controls in D3DTSS.
*/
typedef enum _D3DTEXTUREOP
{
// Control
D3DTOP_DISABLE = 1, // disables stage
D3DTOP_SELECTARG1 = 2, // the default
D3DTOP_SELECTARG2 = 3,
// Modulate
D3DTOP_MODULATE = 4, // multiply args together
D3DTOP_MODULATE2X = 5, // multiply and 1 bit
D3DTOP_MODULATE4X = 6, // multiply and 2 bits
// Add
D3DTOP_ADD = 7, // add arguments together
D3DTOP_ADDSIGNED = 8, // add with -0.5 bias
D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit
D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation
D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product
// Arg1 + Arg2 - Arg1*Arg2
// = Arg1 + (1-Arg1)*Arg2
// Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha
D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha
D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR
// Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha
D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color
// Specular mapping
D3DTOP_PREMODULATE = 17, // modulate with next texture before use
D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB
// COLOROP only
D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A
// COLOROP only
D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
// COLOROP only
D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
// COLOROP only
// Bump mapping
D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation
D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel
// This can do either diffuse or specular bump mapping with correct input.
// Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
// where each component has been scaled and offset to make it signed.
// The result is replicated into all four (including alpha) channels.
// This is a valid COLOROP only.
D3DTOP_DOTPRODUCT3 = 24,
// Triadic ops
D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2
D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2
D3DTOP_MAX = 27, /* Total number of texture operations */
D3DTOP_FORCE_DWORD = 0x7fffffff,
} D3DTEXTUREOP;
/*
* Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending
* operations set in texture processing stage controls in D3DRENDERSTATE.
*/
#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector
#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only)
#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write)
#define D3DTA_TEXTURE 0x00000002 // select texture color (read only)
#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only)
#define D3DTA_SPECULAR 0x00000004 // select specular color (read only)
#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write)
#define D3DTA_CONSTANT 0x00000006 // select texture stage constant
#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier)
#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier)
#define D3DTA_SELECTMAX 0x00000007
#define D3DTA_MODIFIERMAX 0x00000040
// The D3DVERTEXBLENDFLAGS type is used with D3DRS_VERTEXBLEND state.
//
typedef enum _D3DVERTEXBLENDFLAGS
{
D3DVBF_DISABLE = 0, // Disable vertex blending
D3DVBF_1WEIGHTS = 1, // 2 matrix blending
D3DVBF_2WEIGHTS = 2, // 3 matrix blending
D3DVBF_3WEIGHTS = 3, // 4 matrix blending
D3DVBF_TWEENING = 255, // blending using D3DRS_TWEENFACTOR
D3DVBF_0WEIGHTS = 256, // one matrix is used with weight 1.0
D3DVBF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DVERTEXBLENDFLAGS;
typedef enum _D3DTEXTURETRANSFORMFLAGS {
D3DTTFF_DISABLE = 0, // texture coordinates are passed directly
D3DTTFF_COUNT1 = 1, // rasterizer should expect 1-D texture coords
D3DTTFF_COUNT2 = 2, // rasterizer should expect 2-D texture coords
D3DTTFF_COUNT3 = 3, // rasterizer should expect 3-D texture coords
D3DTTFF_COUNT4 = 4, // rasterizer should expect 4-D texture coords
D3DTTFF_PROJECTED = 256, // texcoords to be divided by COUNTth element
D3DTTFF_FORCE_DWORD = 0x7fffffff,
} D3DTEXTURETRANSFORMFLAGS;
#endif /* _d3d9FFTYPES(P)_H_ */

5604
third_party/xbox_sdk/include/d3d9gpu.h vendored Normal file

File diff suppressed because it is too large Load Diff

3141
third_party/xbox_sdk/include/d3d9types.h vendored Normal file

File diff suppressed because it is too large Load Diff

114
third_party/xbox_sdk/include/d3d9xps.h vendored Normal file
View File

@ -0,0 +1,114 @@
/*==========================================================================;
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: d3d9xps.h
* Content: Xbox 360 include file for using Xbox Procedural Synthesis
*
****************************************************************************/
#ifndef _D3D9D3DXPS_H_
#define _D3D9D3DXPS_H_
// Prototype for the D3D-maintained, thread-specific XPS context given to
// an XPS routine:
typedef struct D3DXpsThread D3DXpsThread;
// Prototype for XPS routines:
typedef void (WINAPI *D3DXpsCallback)(__in D3DXpsThread* pThreadContext, __inout_opt void* pCallbackContext, __in CONST void* pSubmitData, DWORD InstanceIndex);
// Size, in bytes, of the ring-buffer space consumed by various
// 'D3DXps' calls:
#define D3DXPS_DRAWVERTICES_SIZE 132
#define D3DXPS_DRAWINDEXEDVERTICES_SIZE 140
// Default command size:
#define D3DXPS_COMMAND_SIZE D3DXPS_DRAWINDEXEDVERTICES_SIZE
// Maximum number of threads that can be enabled for XPS:
#define D3DXPS_MAX_THREADS 6
// Hardware fetch constant used for XPS:
#define D3DXPS_FETCH_CONSTANT (GPU_CONVERT_D3D_TO_HARDWARE_VERTEXFETCHCONSTANT(0) / 3)
//------------------------------------------------------------------------------
// The D3DXps class is only available with C++.
#ifdef __cplusplus
class D3DXps;
// Builder function prototypes:
void D3DXps_Initialize(__in D3DXps* pD3DXps, __in D3DXpsThread* pThreadContext);
void D3DXps_Uninitialize(__in D3DXps* pD3DXps);
void* D3DXps_Allocate(__in D3DXps* pD3DXps, DWORD DataSize, DWORD CommandSize);
void D3DXps_DrawVertices(__in D3DXps* pD3DXps, D3DPRIMITIVETYPE PrimitiveType, DWORD VertexCount, __in CONST void* pVertexData);
void D3DXps_DrawIndexedVertices(__in D3DXps* pD3DXps, D3DPRIMITIVETYPE PrimitiveType, DWORD IndexCount, __in CONST void* pIndexData, D3DFORMAT IndexDataFormat, __in CONST void* pVertexData);
void D3DXps_KickOff(__in D3DXps* pD3DXps);
BOOL D3DXps_KickOffAndGet(__in D3DXps* pD3DXps, __out DWORD* pInstanceIndex);
BOOL D3DXps_Get(__in D3DXps* pD3DXps, __out DWORD* pInstanceIndex);
// 'D3DXps' is the class used by XPS routines to synchronize with the
// other XPS threads, to write to the L2 buffer, and to kick-off commands
// to the GPU.
//
// NOTE: This object is intended to be instantiated on the stack at the
// entry of every XPS data generation routine.
//
// NOTE: Once final hardware arrives, all of the member functions will become
// '__forceinline' and so will always be inlined in the calling routine.
class D3DXps
{
private:
DWORD m_Reserved[100];
public:
D3DXps(__in D3DXpsThread* pThreadContext)
{
D3DXps_Initialize(this, pThreadContext);
}
~D3DXps()
{
D3DXps_Uninitialize(this);
}
void* WINAPI Allocate(DWORD DataSize, DWORD CommandSize = D3DXPS_COMMAND_SIZE)
{
return D3DXps_Allocate(this, DataSize, CommandSize);
}
void WINAPI DrawVertices(D3DPRIMITIVETYPE PrimitiveType, DWORD VertexCount, __in CONST void* pVertexData)
{
D3DXps_DrawVertices(this, PrimitiveType, VertexCount, pVertexData);
}
void WINAPI DrawIndexedVertices(D3DPRIMITIVETYPE PrimitiveType, DWORD IndexCount, __in CONST void* pIndexData, D3DFORMAT IndexDataFormat, __in CONST void* pVertexData)
{
D3DXps_DrawIndexedVertices(this, PrimitiveType, IndexCount, pIndexData, IndexDataFormat, pVertexData);
}
void WINAPI KickOff()
{
D3DXps_KickOff(this);
}
BOOL WINAPI KickOffAndGet(__out DWORD* pInstanceIndex)
{
return D3DXps_KickOffAndGet(this, pInstanceIndex);
}
};
#endif /* __cplusplus */
#endif /* _D3D9D3DXPS_H_ */

102
third_party/xbox_sdk/include/d3dx9.h vendored Normal file
View File

@ -0,0 +1,102 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dx9.h
// Content: D3DX utility library
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __D3DX9_H__
#define __D3DX9_H__
// Defines
#include <limits.h>
#ifdef _XBOX // Implies compiling for Xbox 360
#include "XObjBase.h"
#else
#include "ObjBase.h"
#endif
#define D3DX_DEFAULT ((UINT) -1)
#define D3DX_DEFAULT_NONPOW2 ((UINT) -2)
#define D3DX_DEFAULT_FLOAT FLT_MAX
#ifndef D3DXINLINE
#ifdef _MSC_VER
#if (_MSC_VER >= 1200)
#define D3DXINLINE __forceinline
#else
#define D3DXINLINE __inline
#endif
#else
#ifdef __cplusplus
#define D3DXINLINE inline
#else
#define D3DXINLINE
#endif
#endif
#endif
// Includes
#include "d3d9.h"
#include "d3dx9math.h"
#include "d3dx9core.h"
#include "d3dx9mesh.h"
#include "d3dx9tex.h"
#include "d3dx9shader.h"
#include "d3dx9effect.h"
#include "d3dx9shape.h"
#include "d3dx9anim.h"
#include "d3dx9xof.h"
// Errors
#define _FACDD 0x876
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
enum _D3DXERR {
D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900),
D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901),
D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902),
D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903),
D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904),
D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905),
D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906),
D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907),
// Xbox 360 Extension
D3DXERR_MICROCODEEMPTY = MAKE_DDHRESULT(2920),
D3DXERR_MICROCODETOOBIG = MAKE_DDHRESULT(2921),
D3DXERR_MICROCODEUNSUPPORTEDTARGET = MAKE_DDHRESULT(2922),
D3DXERR_MICROCODEOPTIMIZERFAILED = MAKE_DDHRESULT(2923),
D3DXERR_MICROCODETOOMANYLEVELS = MAKE_DDHRESULT(2924),
D3DXERR_MICROCODETOOMANYREGS = MAKE_DDHRESULT(2925),
D3DXERR_MICROCODETOOMANYCONSTS = MAKE_DDHRESULT(2926),
D3DXERR_MICROCODETOOMANYRSINSTS = MAKE_DDHRESULT(2927),
D3DXERR_MICROCODETOOMANYTEXINSTS = MAKE_DDHRESULT(2928),
D3DXERR_MICROCODETOOMANYALUINSTS = MAKE_DDHRESULT(2929),
D3DXERR_MICROCODETOOMANYCFINSTS = MAKE_DDHRESULT(2930),
D3DXERR_MICROCODETOOMANYTOTALINSTS = MAKE_DDHRESULT(2931),
D3DXERR_MICROCODETOOMANYCOMPILERLITERALS = MAKE_DDHRESULT(2932),
D3DXERR_MICROCODE_DEFB_CONSTANT_OUT_OF_RANGE = MAKE_DDHRESULT(2933),
D3DXERR_MICROCODE_DEFI_CONSTANT_OUT_OF_RANGE = MAKE_DDHRESULT(2934),
D3DXERR_MICROCODE_DEF_CONSTANT_OUT_OF_RANGE = MAKE_DDHRESULT(2935),
D3DXERR_MICROCODE_DEFB_CONSTANT_OUT_OF_ALPHA_PIXEL_SHADER_RANGE = MAKE_DDHRESULT(2936),
D3DXERR_MICROCODE_DEFI_CONSTANT_OUT_OF_ALPHA_PIXEL_SHADER_RANGE = MAKE_DDHRESULT(2937),
D3DXERR_MICROCODE_DEF_CONSTANT_OUT_OF_ALPHA_PIXEL_SHADER_RANGE = MAKE_DDHRESULT(2938),
D3DXERR_MICROCODE_DEFB_CONSTANT_OUT_OF_ALPHA_VERTEX_SHADER_RANGE = MAKE_DDHRESULT(2939),
D3DXERR_MICROCODE_DEFI_CONSTANT_OUT_OF_ALPHA_VERTEX_SHADER_RANGE = MAKE_DDHRESULT(2940),
D3DXERR_MICROCODE_DEF_CONSTANT_OUT_OF_ALPHA_VERTEX_SHADER_RANGE = MAKE_DDHRESULT(2941),
D3DXERR_MICROCODE_DUPLICATE_DEFB_CONSTANT = MAKE_DDHRESULT(2942),
D3DXERR_MICROCODE_DUPLICATE_DEFI_CONSTANT = MAKE_DDHRESULT(2943),
D3DXERR_MICROCODE_DUPLICATE_DEF_CONSTANT = MAKE_DDHRESULT(2944),
};
#endif //__D3DX9_H__

1097
third_party/xbox_sdk/include/d3dx9anim.h vendored Normal file

File diff suppressed because it is too large Load Diff

227
third_party/xbox_sdk/include/d3dx9core.h vendored Normal file
View File

@ -0,0 +1,227 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dx9core.h
// Content: D3DX core types and functions
//
///////////////////////////////////////////////////////////////////////////
#include "d3dx9.h"
#ifndef __D3DX9CORE_H__
#define __D3DX9CORE_H__
///////////////////////////////////////////////////////////////////////////
// D3DX_SDK_VERSION:
// -----------------
// This identifier is passed to D3DXCheckVersion in order to ensure that an
// application was built against the correct header files and lib files.
// This number is incremented whenever a header (or other) change would
// require applications to be rebuilt. If the version doesn't match,
// D3DXCreateVersion will return FALSE. (The number itself has no meaning.)
///////////////////////////////////////////////////////////////////////////
#define D3DX_VERSION 0x0901
#define D3DX_SDK_VERSION 21
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
BOOL WINAPI
D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion);
#ifdef __cplusplus
}
#endif //__cplusplus
///////////////////////////////////////////////////////////////////////////
// D3DXGetDriverLevel:
// Returns driver version information:
//
// 700 - DX7 level driver
// 800 - DX8 level driver
// 900 - DX9 level driver
///////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
UINT WINAPI
D3DXGetDriverLevel(__in LPDIRECT3DDEVICE9 pDevice);
#ifdef __cplusplus
}
#endif //__cplusplus
///////////////////////////////////////////////////////////////////////////
// ID3DXBuffer:
// ------------
// The buffer object is used by D3DX to return arbitrary size data.
//
// GetBufferPointer -
// Returns a pointer to the beginning of the buffer.
//
// GetBufferSize -
// Returns the size of the buffer, in bytes.
///////////////////////////////////////////////////////////////////////////
typedef interface ID3DXBuffer ID3DXBuffer;
typedef interface ID3DXBuffer *LPD3DXBUFFER;
// {932E6A7E-C68E-45dd-A7BF-53D19C86DB1F}
DEFINE_GUID(IID_ID3DXBuffer,
0x932e6a7e, 0xc68e, 0x45dd, 0xa7, 0xbf, 0x53, 0xd1, 0x9c, 0x86, 0xdb, 0x1f);
#undef INTERFACE
#define INTERFACE ID3DXBuffer
DECLARE_INTERFACE_(ID3DXBuffer, IUnknown)
{
// IUnknown
STDMETHOD(QueryInterface)(THIS_ REFIID iid, __deref_out LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
// ID3DXBuffer
STDMETHOD_(__out LPVOID, GetBufferPointer)(THIS) PURE;
STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
};
///////////////////////////////////////////////////////////////////////////
// ID3DXLine:
// ------------
// This object intends to provide an easy way to draw lines using D3D.
//
// Begin -
// Prepares device for drawing lines
//
// Draw -
// Draws a line strip in screen-space.
// Input is in the form of a array defining points on the line strip. of D3DXVECTOR2
//
// DrawTransform -
// Draws a line in screen-space with a specified input transformation matrix.
//
// End -
// Restores device state to how it was when Begin was called.
//
// SetPattern -
// Applies a stipple pattern to the line. Input is one 32-bit
// DWORD which describes the stipple pattern. 1 is opaque, 0 is
// transparent.
//
// SetPatternScale -
// Stretches the stipple pattern in the u direction. Input is one
// floating-point value. 0.0f is no scaling, whereas 1.0f doubles
// the length of the stipple pattern.
//
// SetWidth -
// Specifies the thickness of the line in the v direction. Input is
// one floating-point value.
//
// SetAntialias -
// Toggles line antialiasing. Input is a BOOL.
// TRUE = Antialiasing on.
// FALSE = Antialiasing off.
//
// SetGLLines -
// Toggles non-antialiased OpenGL line emulation. Input is a BOOL.
// TRUE = OpenGL line emulation on.
// FALSE = OpenGL line emulation off.
//
// OpenGL line: Regular line:
// *\ *\
// | \ / \
// | \ *\ \
// *\ \ \ \
// \ \ \ \
// \ * \ *
// \ | \ /
// \| *
// *
//
// OnLostDevice, OnResetDevice -
// Call OnLostDevice() on this object before calling Reset() on the
// device, so that this object can release any stateblocks and video
// memory resources. After Reset(), the call OnResetDevice().
///////////////////////////////////////////////////////////////////////////
typedef interface ID3DXLine ID3DXLine;
typedef interface ID3DXLine *LPD3DXLINE;
// {72CE4D70-CC40-4143-A896-32E50AD2EF35}
DEFINE_GUID( IID_ID3DXLine,
0x72ce4d70, 0xcc40, 0x4143, 0xa8, 0x96, 0x32, 0xe5, 0xa, 0xd2, 0xef, 0x35);
#undef INTERFACE
#define INTERFACE ID3DXLine
DECLARE_INTERFACE_(ID3DXLine, IUnknown)
{
// IUnknown
STDMETHOD(QueryInterface)(THIS_ REFIID iid, __deref_out LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
// ID3DXLine
STDMETHOD(GetDevice)(THIS_ __deref_out LPDIRECT3DDEVICE9* ppDevice) PURE;
STDMETHOD(Begin)(THIS) PURE;
STDMETHOD(Draw)(THIS_ __in_ecount(dwVertexListCount) CONST D3DXVECTOR2 *pVertexList,
DWORD dwVertexListCount, D3DCOLOR Color) PURE;
STDMETHOD(DrawTransform)(THIS_ __in_ecount(dwVertexListCount) CONST D3DXVECTOR3 *pVertexList,
DWORD dwVertexListCount, __in CONST D3DXMATRIX* pTransform,
D3DCOLOR Color) PURE;
STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE;
STDMETHOD_(DWORD, GetPattern)(THIS) PURE;
STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE;
STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE;
STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE;
STDMETHOD_(FLOAT, GetWidth)(THIS) PURE;
STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE;
STDMETHOD_(BOOL, GetAntialias)(THIS) PURE;
STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE;
STDMETHOD_(BOOL, GetGLLines)(THIS) PURE;
STDMETHOD(End)(THIS) PURE;
STDMETHOD(OnLostDevice)(THIS) PURE;
STDMETHOD(OnResetDevice)(THIS) PURE;
};
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
HRESULT WINAPI
D3DXCreateLine(
__in LPDIRECT3DDEVICE9 pDevice,
__deref_out LPD3DXLINE* ppLine);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //__D3DX9CORE_H__

View File

@ -0,0 +1,848 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: d3dx9effect.h
// Content: D3DX effect types and Shaders
//
//////////////////////////////////////////////////////////////////////////////
#include "d3dx9.h"
#ifndef __D3DX9EFFECT_H__
#define __D3DX9EFFECT_H__
//----------------------------------------------------------------------------
// D3DXFX_DONOTSAVESTATE
// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
// is specified, device state is not saved or restored in Begin/End.
// D3DXFX_DONOTSAVESHADERSTATE
// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
// is specified, shader device state is not saved or restored in Begin/End.
// This includes pixel/vertex shaders and shader constants
// D3DXFX_DONOTSAVESAMPLERSTATE
// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
// is specified, sampler device state is not saved or restored in Begin/End.
// D3DXFX_NOT_CLONEABLE
// This flag is used as a parameter to the D3DXCreateEffect family of APIs.
// When this flag is specified, the effect will be non-cloneable and will not
// contain any shader binary data.
// Furthermore, GetPassDesc will not return shader function pointers.
// Setting this flag reduces effect memory usage by about 50%.
//----------------------------------------------------------------------------
#define D3DXFX_DONOTSAVESTATE (1 << 0)
#define D3DXFX_DONOTSAVESHADERSTATE (1 << 1)
#define D3DXFX_DONOTSAVESAMPLERSTATE (1 << 2)
#define D3DXFX_NOT_CLONEABLE (1 << 11)
#define D3DXFX_CREATEEFFECT_VALID_PARAMS (D3DXFX_NOT_CLONEABLE) // internal
//----------------------------------------------------------------------------
// D3DX_PARAMETER_SHARED
// Indicates that the value of a parameter will be shared with all effects
// which share the same namespace. Changing the value in one effect will
// change it in all.
//
// D3DX_PARAMETER_LITERAL
// Indicates that the value of this parameter can be treated as literal.
// Literal parameters can be marked when the effect is compiled, and their
// cannot be changed after the effect is compiled. Shared parameters cannot
// be literal.
//----------------------------------------------------------------------------
#define D3DX_PARAMETER_SHARED (1 << 0)
#define D3DX_PARAMETER_LITERAL (1 << 1)
#define D3DX_PARAMETER_ANNOTATION (1 << 2)
#define D3DX_PARAMETER_SKIPCONSTANT (1 << 3) // internal
#define D3DX_PARAMETER_EXTERNALVALID (D3DX_PARAMETER_SHARED|D3DX_PARAMETER_LITERAL|D3DX_PARAMETER_ANNOTATION) // internal
//----------------------------------------------------------------------------
// D3DXEFFECT_DESC:
//----------------------------------------------------------------------------
typedef struct _D3DXEFFECT_DESC
{
LPCSTR Creator; // Creator string
UINT Parameters; // Number of parameters
UINT Techniques; // Number of techniques
UINT Functions; // Number of function entrypoints
} D3DXEFFECT_DESC;
//----------------------------------------------------------------------------
// D3DXPARAMETER_DESC:
//----------------------------------------------------------------------------
typedef struct _D3DXPARAMETER_DESC
{
LPCSTR Name; // Parameter name
LPCSTR Semantic; // Parameter semantic
D3DXPARAMETER_CLASS Class; // Class
D3DXPARAMETER_TYPE Type; // Component type
UINT Rows; // Number of rows
UINT Columns; // Number of columns
UINT Elements; // Number of array elements
UINT Annotations; // Number of annotations
UINT StructMembers; // Number of structure member sub-parameters
DWORD Flags; // D3DX_PARAMETER_* flags
UINT Bytes; // Parameter size, in bytes
} D3DXPARAMETER_DESC;
//----------------------------------------------------------------------------
// D3DXTECHNIQUE_DESC:
//----------------------------------------------------------------------------
typedef struct _D3DXTECHNIQUE_DESC
{
LPCSTR Name; // Technique name
UINT Passes; // Number of passes
UINT Annotations; // Number of annotations
} D3DXTECHNIQUE_DESC;
//----------------------------------------------------------------------------
// D3DXPASS_DESC:
//----------------------------------------------------------------------------
typedef struct _D3DXPASS_DESC
{
LPCSTR Name; // Pass name
UINT Annotations; // Number of annotations
CONST DWORD *pVertexShaderFunction; // Vertex shader function
CONST DWORD *pPixelShaderFunction; // Pixel shader function
} D3DXPASS_DESC;
//----------------------------------------------------------------------------
// D3DXFUNCTION_DESC:
//----------------------------------------------------------------------------
typedef struct _D3DXFUNCTION_DESC
{
LPCSTR Name; // Function name
UINT Annotations; // Number of annotations
} D3DXFUNCTION_DESC;
//////////////////////////////////////////////////////////////////////////////
// ID3DXEffectPool ///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
typedef interface ID3DXEffectPool ID3DXEffectPool;
typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL;
// {9537AB04-3250-412e-8213-FCD2F8677933}
DEFINE_GUID(IID_ID3DXEffectPool,
0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33);
#undef INTERFACE
#define INTERFACE ID3DXEffectPool
DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown)
{
// IUnknown
STDMETHOD(QueryInterface)(THIS_ REFIID iid, __deref_out LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
// No public methods
};
//////////////////////////////////////////////////////////////////////////////
// ID3DXBaseEffect ///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
typedef interface ID3DXBaseEffect ID3DXBaseEffect;
typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT;
// {3B7A6FFB-3A69-46d7-BC01-A6B2AD4C2BB0}
DEFINE_GUID(IID_ID3DXBaseEffect,
0x3b7a6ffb, 0x3a69, 0x46d7, 0xbc, 0x1, 0xa6, 0xb2, 0xad, 0x4c, 0x2b, 0xb0);
#undef INTERFACE
#define INTERFACE ID3DXBaseEffect
DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown)
{
// IUnknown
STDMETHOD(QueryInterface)(THIS_ REFIID iid, __deref_out LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
// Descs
STDMETHOD(GetDesc)(THIS_ __out D3DXEFFECT_DESC* pDesc) PURE;
STDMETHOD(GetParameterDesc)(THIS_ __in D3DXHANDLE hParameter, __out D3DXPARAMETER_DESC* pDesc) PURE;
STDMETHOD(GetTechniqueDesc)(THIS_ __in D3DXHANDLE hTechnique, __out D3DXTECHNIQUE_DESC* pDesc) PURE;
STDMETHOD(GetPassDesc)(THIS_ __in D3DXHANDLE hPass, __out D3DXPASS_DESC* pDesc) PURE;
STDMETHOD(GetFunctionDesc)(THIS_ __in D3DXHANDLE hShader, __out D3DXFUNCTION_DESC* pDesc) PURE;
// Handle operations
STDMETHOD_(__out D3DXHANDLE, GetParameter)(THIS_ __in D3DXHANDLE hParameter, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterByName)(THIS_ __in D3DXHANDLE hParameter, __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterBySemantic)(THIS_ __in D3DXHANDLE hParameter, __in_z LPCSTR pSemantic) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterElement)(THIS_ __in D3DXHANDLE hParameter, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetTechniqueByName)(THIS_ __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE __in hTechnique, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetPassByName)(THIS_ __in D3DXHANDLE hTechnique, __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetFunctionByName)(THIS_ __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetAnnotation)(THIS_ __in D3DXHANDLE hObject, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetAnnotationByName)(THIS_ __in D3DXHANDLE hObject, __in_z LPCSTR pName) PURE;
// Get/Set Parameters
STDMETHOD(SetValue)(THIS_ __in D3DXHANDLE hParameter, __in_bcount(Bytes) LPCVOID pData, UINT Bytes) PURE;
STDMETHOD(GetValue)(THIS_ __in D3DXHANDLE hParameter, __out_bcount(Bytes) LPVOID pData, UINT Bytes) PURE;
STDMETHOD(SetBool)(THIS_ __in D3DXHANDLE hParameter, BOOL b) PURE;
STDMETHOD(GetBool)(THIS_ __in D3DXHANDLE hParameter, __out BOOL* pb) PURE;
STDMETHOD(SetBoolArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST BOOL* pb, UINT Count) PURE;
STDMETHOD(GetBoolArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) BOOL* pb, UINT Count) PURE;
STDMETHOD(SetInt)(THIS_ __in D3DXHANDLE hParameter, INT n) PURE;
STDMETHOD(GetInt)(THIS_ __in D3DXHANDLE hParameter, __out INT* pn) PURE;
STDMETHOD(SetIntArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST INT* pn, UINT Count) PURE;
STDMETHOD(GetIntArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) INT* pn, UINT Count) PURE;
STDMETHOD(SetFloat)(THIS_ __in D3DXHANDLE hParameter, FLOAT f) PURE;
STDMETHOD(GetFloat)(THIS_ __in D3DXHANDLE hParameter, __out FLOAT* pf) PURE;
STDMETHOD(SetFloatArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST FLOAT* pf, UINT Count) PURE;
STDMETHOD(GetFloatArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) FLOAT* pf, UINT Count) PURE;
STDMETHOD(SetVector)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXVECTOR4* pVector) PURE;
STDMETHOD(GetVector)(THIS_ __in D3DXHANDLE hParameter, __out D3DXVECTOR4* pVector) PURE;
STDMETHOD(SetVectorArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXVECTOR4* pVector, UINT Count) PURE;
STDMETHOD(GetVectorArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXVECTOR4* pVector, UINT Count) PURE;
STDMETHOD(SetMatrix)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXMATRIX* pMatrix) PURE;
STDMETHOD(GetMatrix)(THIS_ __in D3DXHANDLE hParameter, __out D3DXMATRIX* pMatrix) PURE;
STDMETHOD(SetMatrixArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixPointerArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixPointerArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixTranspose)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXMATRIX* pMatrix) PURE;
STDMETHOD(GetMatrixTranspose)(THIS_ __in D3DXHANDLE hParameter, __out D3DXMATRIX* pMatrix) PURE;
STDMETHOD(SetMatrixTransposeArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixTransposeArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixTransposePointerArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixTransposePointerArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(SetString)(THIS_ __in D3DXHANDLE hParameter, __in_z LPCSTR pString) PURE;
STDMETHOD(GetString)(THIS_ __in D3DXHANDLE hParameter, __deref_out_z LPCSTR* ppString) PURE;
STDMETHOD(SetTexture)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DBASETEXTURE9 pTexture) PURE;
STDMETHOD(GetTexture)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
STDMETHOD(SetPixelShader)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DPIXELSHADER9 pPShader) PURE;
STDMETHOD(GetPixelShader)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
STDMETHOD(SetVertexShader)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DVERTEXSHADER9 pVShader) PURE;
STDMETHOD(GetVertexShader)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
//Set Range of an Array to pass to device
//Useful for sending only a subrange of an array down to the device
STDMETHOD(SetArrayRange)(THIS_ __in D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
};
//----------------------------------------------------------------------------
// ID3DXEffectStateManager:
// ------------------------
// This is a user implemented interface that can be used to manage device
// state changes made by an Effect.
//----------------------------------------------------------------------------
typedef interface ID3DXEffectStateManager ID3DXEffectStateManager;
typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER;
// {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE}
DEFINE_GUID(IID_ID3DXEffectStateManager,
0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce);
#undef INTERFACE
#define INTERFACE ID3DXEffectStateManager
DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown)
{
// The user must correctly implement QueryInterface, AddRef, and Release.
// IUnknown
STDMETHOD(QueryInterface)(THIS_ REFIID iid, __deref_out LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
// The following methods are called by the Effect when it wants to make
// the corresponding device call. Note that:
// 1. Users manage the state and are therefore responsible for making the
// the corresponding device calls themselves inside their callbacks.
// 2. Effects pay attention to the return values of the callbacks, and so
// users must pay attention to what they return in their callbacks.
STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, __in CONST D3DMATRIX *pMatrix) PURE;
STDMETHOD(SetMaterial)(THIS_ __in CONST D3DMATERIAL9 *pMaterial) PURE;
STDMETHOD(SetLight)(THIS_ DWORD Index, __in CONST D3DLIGHT9 *pLight) PURE;
STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE;
STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE;
STDMETHOD(SetTexture)(THIS_ DWORD Stage, __in LPDIRECT3DBASETEXTURE9 pTexture) PURE;
STDMETHOD(Do_Not_Use_SetTextureStageState)(THIS_ DWORD Stage, DWORD Type, DWORD Value) PURE;
STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE;
STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
STDMETHOD(SetVertexShader)(THIS_ __in LPDIRECT3DVERTEXSHADER9 pShader) PURE;
STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT RegisterIndex, __in_ecount(4*RegisterCount) CONST FLOAT *pConstantData, UINT RegisterCount) PURE;
STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT RegisterIndex, __in_ecount(4*RegisterCount) CONST INT *pConstantData, UINT RegisterCount) PURE;
STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT RegisterIndex, __in_ecount(RegisterCount) CONST BOOL *pConstantData, UINT RegisterCount) PURE;
STDMETHOD(SetPixelShader)(THIS_ __in LPDIRECT3DPIXELSHADER9 pShader) PURE;
STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT RegisterIndex, __in_ecount(4*RegisterCount) CONST FLOAT *pConstantData, UINT RegisterCount) PURE;
STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT RegisterIndex, __in_ecount(4*RegisterCount) CONST INT *pConstantData, UINT RegisterCount) PURE;
STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT RegisterIndex, __in_ecount(RegisterCount) CONST BOOL *pConstantData, UINT RegisterCount) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// ID3DXEffect ///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
typedef interface ID3DXEffect ID3DXEffect;
typedef interface ID3DXEffect *LPD3DXEFFECT;
// {0F0DCC9F-6152-4117-A933-FFAC29C43AA4}
DEFINE_GUID(IID_ID3DXEffect,
0xf0dcc9f, 0x6152, 0x4117, 0xa9, 0x33, 0xff, 0xac, 0x29, 0xc4, 0x3a, 0xa4);
#undef INTERFACE
#define INTERFACE ID3DXEffect
DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect)
{
// ID3DXBaseEffect
STDMETHOD(QueryInterface)(THIS_ REFIID iid, __deref_out LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
// Descs
STDMETHOD(GetDesc)(THIS_ __out D3DXEFFECT_DESC* pDesc) PURE;
STDMETHOD(GetParameterDesc)(THIS_ __in D3DXHANDLE hParameter, __out D3DXPARAMETER_DESC* pDesc) PURE;
STDMETHOD(GetTechniqueDesc)(THIS_ __in D3DXHANDLE hTechnique, __out D3DXTECHNIQUE_DESC* pDesc) PURE;
STDMETHOD(GetPassDesc)(THIS_ __in D3DXHANDLE hPass, __out D3DXPASS_DESC* pDesc) PURE;
STDMETHOD(GetFunctionDesc)(THIS_ __in D3DXHANDLE hShader, __out D3DXFUNCTION_DESC* pDesc) PURE;
// Handle operations
STDMETHOD_(__out D3DXHANDLE, GetParameter)(THIS_ __in D3DXHANDLE hParameter, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterByName)(THIS_ __in D3DXHANDLE hParameter, __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterBySemantic)(THIS_ __in D3DXHANDLE hParameter, __in_z LPCSTR pSemantic) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterElement)(THIS_ __in D3DXHANDLE hParameter, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetTechniqueByName)(THIS_ __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetPass)(THIS_ __in D3DXHANDLE hTechnique, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetPassByName)(THIS_ __in D3DXHANDLE hTechnique, __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetFunctionByName)(THIS_ __in_z LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetAnnotation)(THIS_ __in D3DXHANDLE hObject, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetAnnotationByName)(THIS_ __in D3DXHANDLE hObject, __in_z LPCSTR pName) PURE;
// Get/Set Parameters
STDMETHOD(SetValue)(THIS_ __in D3DXHANDLE hParameter, __in_bcount(Bytes) LPCVOID pData, UINT Bytes) PURE;
STDMETHOD(GetValue)(THIS_ __in D3DXHANDLE hParameter, __out_bcount(Bytes) LPVOID pData, UINT Bytes) PURE;
STDMETHOD(SetBool)(THIS_ __in D3DXHANDLE hParameter, BOOL b) PURE;
STDMETHOD(GetBool)(THIS_ __in D3DXHANDLE hParameter, __out BOOL* pb) PURE;
STDMETHOD(SetBoolArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST BOOL* pb, UINT Count) PURE;
STDMETHOD(GetBoolArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) BOOL* pb, UINT Count) PURE;
STDMETHOD(SetInt)(THIS_ __in D3DXHANDLE hParameter, INT n) PURE;
STDMETHOD(GetInt)(THIS_ __in D3DXHANDLE hParameter, __out INT* pn) PURE;
STDMETHOD(SetIntArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST INT* pn, UINT Count) PURE;
STDMETHOD(GetIntArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) INT* pn, UINT Count) PURE;
STDMETHOD(SetFloat)(THIS_ __in D3DXHANDLE hParameter, FLOAT f) PURE;
STDMETHOD(GetFloat)(THIS_ __in D3DXHANDLE hParameter, __out FLOAT* pf) PURE;
STDMETHOD(SetFloatArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST FLOAT* pf, UINT Count) PURE;
STDMETHOD(GetFloatArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) FLOAT* pf, UINT Count) PURE;
STDMETHOD(SetVector)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXVECTOR4* pVector) PURE;
STDMETHOD(GetVector)(THIS_ __in D3DXHANDLE hParameter, __out D3DXVECTOR4* pVector) PURE;
STDMETHOD(SetVectorArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXVECTOR4* pVector, UINT Count) PURE;
STDMETHOD(GetVectorArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXVECTOR4* pVector, UINT Count) PURE;
STDMETHOD(SetMatrix)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXMATRIX* pMatrix) PURE;
STDMETHOD(GetMatrix)(THIS_ __in D3DXHANDLE hParameter, __out D3DXMATRIX* pMatrix) PURE;
STDMETHOD(SetMatrixArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixPointerArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixPointerArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixTranspose)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXMATRIX* pMatrix) PURE;
STDMETHOD(GetMatrixTranspose)(THIS_ __in D3DXHANDLE hParameter, __out D3DXMATRIX* pMatrix) PURE;
STDMETHOD(SetMatrixTransposeArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixTransposeArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixTransposePointerArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixTransposePointerArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(SetString)(THIS_ __in D3DXHANDLE hParameter, __in_z LPCSTR pString) PURE;
STDMETHOD(GetString)(THIS_ __in D3DXHANDLE hParameter, __deref_out_z LPCSTR* ppString) PURE;
STDMETHOD(SetTexture)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DBASETEXTURE9 pTexture) PURE;
STDMETHOD(GetTexture)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
STDMETHOD(SetPixelShader)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DPIXELSHADER9 pPShader) PURE;
STDMETHOD(GetPixelShader)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
STDMETHOD(SetVertexShader)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DVERTEXSHADER9 pVShader) PURE;
STDMETHOD(GetVertexShader)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
//Set Range of an Array to pass to device
//Usefull for sending only a subrange of an array down to the device
STDMETHOD(SetArrayRange)(THIS_ __in D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
// ID3DXBaseEffect
// Pool
STDMETHOD(GetPool)(THIS_ __deref_out LPD3DXEFFECTPOOL* ppPool) PURE;
// Selecting and setting a technique
STDMETHOD(SetTechnique)(THIS_ __in D3DXHANDLE hTechnique) PURE;
STDMETHOD_(__out D3DXHANDLE, GetCurrentTechnique)(THIS) PURE;
STDMETHOD(ValidateTechnique)(THIS_ __in D3DXHANDLE hTechnique) PURE;
STDMETHOD(FindNextValidTechnique)(THIS_ __in D3DXHANDLE hTechnique, __deref_out D3DXHANDLE *pTechnique) PURE;
STDMETHOD_(BOOL, IsParameterUsed)(THIS_ __in D3DXHANDLE hParameter, __in D3DXHANDLE hTechnique) PURE;
// Using current technique
// Begin starts active technique
// BeginPass begins a pass
// CommitChanges updates changes to any set calls in the pass. This should be called before
// any DrawPrimitive call to d3d
// EndPass ends a pass
// End ends active technique
STDMETHOD(Begin)(THIS_ __out UINT *pPasses, DWORD Flags) PURE;
STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE;
STDMETHOD(CommitChanges)(THIS) PURE;
STDMETHOD(EndPass)(THIS) PURE;
STDMETHOD(End)(THIS) PURE;
// Managing D3D Device
STDMETHOD(GetDevice)(THIS_ __deref_out LPDIRECT3DDEVICE9* ppDevice) PURE;
STDMETHOD(OnLostDevice)(THIS) PURE;
STDMETHOD(OnResetDevice)(THIS) PURE;
// Logging device calls
STDMETHOD(SetStateManager)(THIS_ __in LPD3DXEFFECTSTATEMANAGER pManager) PURE;
STDMETHOD(GetStateManager)(THIS_ __deref_out LPD3DXEFFECTSTATEMANAGER *ppManager) PURE;
// Parameter blocks
STDMETHOD(BeginParameterBlock)(THIS) PURE;
STDMETHOD_(__out D3DXHANDLE, EndParameterBlock)(THIS) PURE;
STDMETHOD(ApplyParameterBlock)(THIS_ __in D3DXHANDLE hParameterBlock) PURE;
// Cloning
STDMETHOD(CloneEffect)(THIS_ __in LPDIRECT3DDEVICE9 pDevice, __deref_out LPD3DXEFFECT* ppEffect) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// ID3DXEffectCompiler ///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
typedef interface ID3DXEffectCompiler ID3DXEffectCompiler;
typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER;
// {15A709EB-5A8E-40a0-86A9-0C024124339B}
DEFINE_GUID(IID_ID3DXEffectCompiler,
0x15a709eb, 0x5a8e, 0x40a0, 0x86, 0xa9, 0xc, 0x2, 0x41, 0x24, 0x33, 0x9b);
#undef INTERFACE
#define INTERFACE ID3DXEffectCompiler
DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect)
{
// ID3DXBaseEffect
STDMETHOD(QueryInterface)(THIS_ REFIID iid, __deref_out LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
// Descs
STDMETHOD(GetDesc)(THIS_ __out D3DXEFFECT_DESC* pDesc) PURE;
STDMETHOD(GetParameterDesc)(THIS_ __in D3DXHANDLE hParameter, __out D3DXPARAMETER_DESC* pDesc) PURE;
STDMETHOD(GetTechniqueDesc)(THIS_ __in D3DXHANDLE hTechnique, __out D3DXTECHNIQUE_DESC* pDesc) PURE;
STDMETHOD(GetPassDesc)(THIS_ __in D3DXHANDLE hPass, __out D3DXPASS_DESC* pDesc) PURE;
STDMETHOD(GetFunctionDesc)(THIS_ __in D3DXHANDLE hShader, __out D3DXFUNCTION_DESC* pDesc) PURE;
// Handle operations
STDMETHOD_(__out D3DXHANDLE, GetParameter)(THIS_ __in D3DXHANDLE hParameter, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterByName)(THIS_ __in D3DXHANDLE hParameter, LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterBySemantic)(THIS_ __in D3DXHANDLE hParameter, LPCSTR pSemantic) PURE;
STDMETHOD_(__out D3DXHANDLE, GetParameterElement)(THIS_ __in D3DXHANDLE hParameter, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetPass)(THIS_ __in D3DXHANDLE hTechnique, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetPassByName)(THIS_ __in D3DXHANDLE hTechnique, LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE;
STDMETHOD_(__out D3DXHANDLE, GetAnnotation)(THIS_ __in D3DXHANDLE hObject, UINT Index) PURE;
STDMETHOD_(__out D3DXHANDLE, GetAnnotationByName)(THIS_ __in D3DXHANDLE hObject, LPCSTR pName) PURE;
// Get/Set Parameters
STDMETHOD(SetValue)(THIS_ __in D3DXHANDLE hParameter, __in_bcount(Bytes) LPCVOID pData, UINT Bytes) PURE;
STDMETHOD(GetValue)(THIS_ __in D3DXHANDLE hParameter, __out_bcount(Bytes) LPVOID pData, UINT Bytes) PURE;
STDMETHOD(SetBool)(THIS_ __in D3DXHANDLE hParameter, BOOL b) PURE;
STDMETHOD(GetBool)(THIS_ __in D3DXHANDLE hParameter, __out BOOL* pb) PURE;
STDMETHOD(SetBoolArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST BOOL* pb, UINT Count) PURE;
STDMETHOD(GetBoolArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) BOOL* pb, UINT Count) PURE;
STDMETHOD(SetInt)(THIS_ __in D3DXHANDLE hParameter, INT n) PURE;
STDMETHOD(GetInt)(THIS_ __in D3DXHANDLE hParameter, __out INT* pn) PURE;
STDMETHOD(SetIntArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST INT* pn, UINT Count) PURE;
STDMETHOD(GetIntArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) INT* pn, UINT Count) PURE;
STDMETHOD(SetFloat)(THIS_ __in D3DXHANDLE hParameter, FLOAT f) PURE;
STDMETHOD(GetFloat)(THIS_ __in D3DXHANDLE hParameter, __out FLOAT* pf) PURE;
STDMETHOD(SetFloatArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST FLOAT* pf, UINT Count) PURE;
STDMETHOD(GetFloatArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) FLOAT* pf, UINT Count) PURE;
STDMETHOD(SetVector)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXVECTOR4* pVector) PURE;
STDMETHOD(GetVector)(THIS_ __in D3DXHANDLE hParameter, __out D3DXVECTOR4* pVector) PURE;
STDMETHOD(SetVectorArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXVECTOR4* pVector, UINT Count) PURE;
STDMETHOD(GetVectorArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXVECTOR4* pVector, UINT Count) PURE;
STDMETHOD(SetMatrix)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXMATRIX* pMatrix) PURE;
STDMETHOD(GetMatrix)(THIS_ __in D3DXHANDLE hParameter, __out D3DXMATRIX* pMatrix) PURE;
STDMETHOD(SetMatrixArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixPointerArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixPointerArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixTranspose)(THIS_ __in D3DXHANDLE hParameter, __in CONST D3DXMATRIX* pMatrix) PURE;
STDMETHOD(GetMatrixTranspose)(THIS_ __in D3DXHANDLE hParameter, __out D3DXMATRIX* pMatrix) PURE;
STDMETHOD(SetMatrixTransposeArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixTransposeArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX* pMatrix, UINT Count) PURE;
STDMETHOD(SetMatrixTransposePointerArray)(THIS_ __in D3DXHANDLE hParameter, __in_ecount(Count) CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(GetMatrixTransposePointerArray)(THIS_ __in D3DXHANDLE hParameter, __out_ecount(Count) D3DXMATRIX** ppMatrix, UINT Count) PURE;
STDMETHOD(SetString)(THIS_ __in D3DXHANDLE hParameter, __in_z LPCSTR pString) PURE;
STDMETHOD(GetString)(THIS_ __in D3DXHANDLE hParameter, __deref_out_z LPCSTR* ppString) PURE;
STDMETHOD(SetTexture)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DBASETEXTURE9 pTexture) PURE;
STDMETHOD(GetTexture)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
STDMETHOD(SetPixelShader)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DPIXELSHADER9 pPShader) PURE;
STDMETHOD(GetPixelShader)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
STDMETHOD(SetVertexShader)(THIS_ __in D3DXHANDLE hParameter, __in LPDIRECT3DVERTEXSHADER9 pVShader) PURE;
STDMETHOD(GetVertexShader)(THIS_ __in D3DXHANDLE hParameter, __deref_out LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
//Set Range of an Array to pass to device
//Usefull for sending only a subrange of an array down to the device
STDMETHOD(SetArrayRange)(THIS_ __in D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
// ID3DXBaseEffect
// Parameter sharing, specialization, and information
STDMETHOD(SetLiteral)(THIS_ __in D3DXHANDLE hParameter, BOOL Literal) PURE;
STDMETHOD(GetLiteral)(THIS_ __in D3DXHANDLE hParameter, __out BOOL *pLiteral) PURE;
// Compilation
STDMETHOD(CompileEffect)(THIS_ DWORD Flags,
__in LPD3DXBUFFER* ppEffect, __deref_opt_out LPD3DXBUFFER* ppErrorMsgs) PURE;
STDMETHOD(CompileShader)(THIS_ __in D3DXHANDLE hFunction, __in_z LPCSTR pTarget, DWORD Flags,
__deref_out LPD3DXBUFFER* ppShader, __deref_opt_out LPD3DXBUFFER* ppErrorMsgs, __deref_opt_out LPD3DXCONSTANTTABLE* ppConstantTable) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// APIs //////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
//----------------------------------------------------------------------------
// D3DXCreateEffectPool:
// ---------------------
// Creates an effect pool. Pools are used for sharing parameters between
// multiple effects. For all effects within a pool, shared parameters of the
// same name all share the same value.
//
// Parameters:
// ppPool
// Returns the created pool.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateEffectPool(
__deref_out LPD3DXEFFECTPOOL* ppPool);
//----------------------------------------------------------------------------
// D3DXCreateEffect:
// -----------------
// Creates an effect from an ascii or binary effect description.
//
// Parameters:
// pDevice
// Pointer of the device on which to create the effect
// pSrcFile
// Name of the file containing the effect description
// hSrcModule
// Module handle. if NULL, current module will be used.
// pSrcResource
// Resource name in module
// pSrcData
// Pointer to effect description
// SrcDataSize
// Size of the effect description in bytes
// pDefines
// Optional NULL-terminated array of preprocessor macro definitions.
// pInclude
// Optional interface pointer to use for handling #include directives.
// If this parameter is NULL, #includes will be honored when compiling
// from file, and will error when compiling from resource or memory.
// pPool
// Pointer to ID3DXEffectPool object to use for shared parameters.
// If NULL, no parameters will be shared.
// ppEffect
// Returns a buffer containing created effect.
// ppCompilationErrors
// Returns a buffer containing any error messages which occurred during
// compile. Or NULL if you do not care about the error messages.
//
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateEffectFromFileA(
__in LPDIRECT3DDEVICE9 pDevice,
__in_z LPCSTR pSrcFile,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__in_opt LPD3DXEFFECTPOOL pPool,
__deref_out LPD3DXEFFECT* ppEffect,
__deref_opt_out LPD3DXBUFFER* ppCompilationErrors);
HRESULT WINAPI
D3DXCreateEffectFromFileW(
__in LPDIRECT3DDEVICE9 pDevice,
__in_z LPCWSTR pSrcFile,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__in_opt LPD3DXEFFECTPOOL pPool,
__deref_out LPD3DXEFFECT* ppEffect,
__deref_opt_out LPD3DXBUFFER* ppCompilationErrors);
#ifdef UNICODE
#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW
#else
#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA
#endif
#if 0 // Not on Xbox 360
HRESULT WINAPI
D3DXCreateEffectFromResourceA(
LPDIRECT3DDEVICE9 pDevice,
HMODULE hSrcModule,
LPCSTR pSrcResource,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXEFFECTPOOL pPool,
LPD3DXEFFECT* ppEffect,
LPD3DXBUFFER* ppCompilationErrors);
HRESULT WINAPI
D3DXCreateEffectFromResourceW(
LPDIRECT3DDEVICE9 pDevice,
HMODULE hSrcModule,
LPCWSTR pSrcResource,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXEFFECTPOOL pPool,
LPD3DXEFFECT* ppEffect,
LPD3DXBUFFER* ppCompilationErrors);
#ifdef UNICODE
#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW
#else
#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA
#endif
#endif // Not on Xbox 360
HRESULT WINAPI
D3DXCreateEffect(
__in LPDIRECT3DDEVICE9 pDevice,
__in_bcount(SrcDataLen) LPCVOID pSrcData,
UINT SrcDataLen,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__in_opt LPD3DXEFFECTPOOL pPool,
__deref_out LPD3DXEFFECT* ppEffect,
__deref_opt_out LPD3DXBUFFER* ppCompilationErrors);
//----------------------------------------------------------------------------
// D3DXCreateEffectCompiler:
// -------------------------
// Creates an effect from an ascii or binary effect description.
//
// Parameters:
// pSrcFile
// Name of the file containing the effect description
// hSrcModule
// Module handle. if NULL, current module will be used.
// pSrcResource
// Resource name in module
// pSrcData
// Pointer to effect description
// SrcDataSize
// Size of the effect description in bytes
// pDefines
// Optional NULL-terminated array of preprocessor macro definitions.
// pInclude
// Optional interface pointer to use for handling #include directives.
// If this parameter is NULL, #includes will be honored when compiling
// from file, and will error when compiling from resource or memory.
// pPool
// Pointer to ID3DXEffectPool object to use for shared parameters.
// If NULL, no parameters will be shared.
// ppCompiler
// Returns a buffer containing created effect compiler.
// ppParseErrors
// Returns a buffer containing any error messages which occurred during
// parse. Or NULL if you do not care about the error messages.
//
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateEffectCompilerFromFileA(
__in_z LPCSTR pSrcFile,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors);
HRESULT WINAPI
D3DXCreateEffectCompilerFromFileW(
__in_z LPCWSTR pSrcFile,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors);
#ifdef UNICODE
#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileW
#else
#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileA
#endif
HRESULT WINAPI
D3DXCreateEffectCompilerFromFileExA(
__in_z LPCSTR pSrcFile,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors,
__deref_inout_opt D3DXSHADER_COMPILE_PARAMETERSA* pCompileParameters); // May be NULL.
HRESULT WINAPI
D3DXCreateEffectCompilerFromFileExW(
__in_z LPCWSTR pSrcFile,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors,
__deref_inout_opt D3DXSHADER_COMPILE_PARAMETERSW* pCompileParameters); // May be NULL.
#ifdef UNICODE
#define D3DXCreateEffectCompilerFromFileEx D3DXCreateEffectCompilerFromFileExW
#else
#define D3DXCreateEffectCompilerFromFileEx D3DXCreateEffectCompilerFromFileExA
#endif
HRESULT WINAPI
D3DXCreateEffectCompilerFromResourceA(
__in HMODULE hSrcModule,
__in_z LPCSTR pSrcResource,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors);
HRESULT WINAPI
D3DXCreateEffectCompilerFromResourceW(
__in HMODULE hSrcModule,
__in_z LPCWSTR pSrcResource,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors);
#ifdef UNICODE
#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceW
#else
#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceA
#endif
HRESULT WINAPI
D3DXCreateEffectCompiler(
__in_z LPCSTR pSrcData,
UINT SrcDataLen,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors);
HRESULT WINAPI
D3DXCreateEffectCompilerExA(
__in_z LPCSTR pSrcData,
UINT SrcDataLen,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors,
__deref_inout_opt D3DXSHADER_COMPILE_PARAMETERSA* pCompileParameters); // May be NULL.
HRESULT WINAPI
D3DXCreateEffectCompilerExW(
__in_z LPCSTR pSrcData,
UINT SrcDataLen,
__in_opt CONST D3DXMACRO* pDefines,
__in_opt LPD3DXINCLUDE pInclude,
DWORD Flags,
__deref_out LPD3DXEFFECTCOMPILER* ppCompiler,
__deref_opt_out LPD3DXBUFFER* ppParseErrors,
__deref_inout_opt D3DXSHADER_COMPILE_PARAMETERSW* pCompileParameters); // May be NULL.
#ifdef UNICODE
#define D3DXCreateEffectCompilerEx D3DXCreateEffectCompilerExW
#else
#define D3DXCreateEffectCompilerEx D3DXCreateEffectCompilerExA
#endif
//----------------------------------------------------------------------------
// D3DXDisassembleEffect:
// -----------------------
//
// Parameters:
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXDisassembleEffect(
__in LPD3DXEFFECT pEffect,
BOOL EnableColorCode,
__deref_out LPD3DXBUFFER *ppDisassembly);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //__D3DX9EFFECT_H__

1778
third_party/xbox_sdk/include/d3dx9math.h vendored Normal file

File diff suppressed because it is too large Load Diff

3201
third_party/xbox_sdk/include/d3dx9math.inl vendored Normal file

File diff suppressed because it is too large Load Diff

2117
third_party/xbox_sdk/include/d3dx9mesh.h vendored Normal file

File diff suppressed because it is too large Load Diff

1475
third_party/xbox_sdk/include/d3dx9shader.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,176 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dx9shapes.h
// Content: D3DX simple shapes
//
///////////////////////////////////////////////////////////////////////////
#include "d3dx9.h"
#ifndef __D3DX9SHAPES_H__
#define __D3DX9SHAPES_H__
///////////////////////////////////////////////////////////////////////////
// Functions:
///////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
//-------------------------------------------------------------------------
// D3DXCreatePolygon:
// ------------------
// Creates a mesh containing an n-sided polygon. The polygon is centered
// at the origin.
//
// Parameters:
//
// pDevice The D3D device with which the mesh is going to be used.
// Length Length of each side.
// Sides Number of sides the polygon has. (Must be >= 3)
// ppMesh The mesh object which will be created
// ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
//-------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreatePolygon(
__in LPDIRECT3DDEVICE9 pDevice,
FLOAT Length,
UINT Sides,
__deref_out LPD3DXMESH* ppMesh,
__deref_opt_out LPD3DXBUFFER* ppAdjacency);
//-------------------------------------------------------------------------
// D3DXCreateBox:
// --------------
// Creates a mesh containing an axis-aligned box. The box is centered at
// the origin.
//
// Parameters:
//
// pDevice The D3D device with which the mesh is going to be used.
// Width Width of box (along X-axis)
// Height Height of box (along Y-axis)
// Depth Depth of box (along Z-axis)
// ppMesh The mesh object which will be created
// ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
//-------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateBox(
__in LPDIRECT3DDEVICE9 pDevice,
FLOAT Width,
FLOAT Height,
FLOAT Depth,
__deref_out LPD3DXMESH* ppMesh,
__deref_opt_out LPD3DXBUFFER* ppAdjacency);
//-------------------------------------------------------------------------
// D3DXCreateCylinder:
// -------------------
// Creates a mesh containing a cylinder. The generated cylinder is
// centered at the origin, and its axis is aligned with the Z-axis.
//
// Parameters:
//
// pDevice The D3D device with which the mesh is going to be used.
// Radius1 Radius at -Z end (should be >= 0.0f)
// Radius2 Radius at +Z end (should be >= 0.0f)
// Length Length of cylinder (along Z-axis)
// Slices Number of slices about the main axis
// Stacks Number of stacks along the main axis
// ppMesh The mesh object which will be created
// ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
//-------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateCylinder(
__in LPDIRECT3DDEVICE9 pDevice,
FLOAT Radius1,
FLOAT Radius2,
FLOAT Length,
UINT Slices,
UINT Stacks,
__deref_out LPD3DXMESH* ppMesh,
__deref_opt_out LPD3DXBUFFER* ppAdjacency);
//-------------------------------------------------------------------------
// D3DXCreateSphere:
// -----------------
// Creates a mesh containing a sphere. The sphere is centered at the
// origin.
//
// Parameters:
//
// pDevice The D3D device with which the mesh is going to be used.
// Radius Radius of the sphere (should be >= 0.0f)
// Slices Number of slices about the main axis
// Stacks Number of stacks along the main axis
// ppMesh The mesh object which will be created
// ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
//-------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateSphere(
__in LPDIRECT3DDEVICE9 pDevice,
FLOAT Radius,
UINT Slices,
UINT Stacks,
__deref_out LPD3DXMESH* ppMesh,
__deref_opt_out LPD3DXBUFFER* ppAdjacency);
//-------------------------------------------------------------------------
// D3DXCreateTorus:
// ----------------
// Creates a mesh containing a torus. The generated torus is centered at
// the origin, and its axis is aligned with the Z-axis.
//
// Parameters:
//
// pDevice The D3D device with which the mesh is going to be used.
// InnerRadius Inner radius of the torus (should be >= 0.0f)
// OuterRadius Outer radius of the torue (should be >= 0.0f)
// Sides Number of sides in a cross-section (must be >= 3)
// Rings Number of rings making up the torus (must be >= 3)
// ppMesh The mesh object which will be created
// ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
//-------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateTorus(
__in LPDIRECT3DDEVICE9 pDevice,
FLOAT InnerRadius,
FLOAT OuterRadius,
UINT Sides,
UINT Rings,
__deref_out LPD3DXMESH* ppMesh,
__deref_opt_out LPD3DXBUFFER* ppAdjacency);
//-------------------------------------------------------------------------
// D3DXCreateTeapot:
// -----------------
// Creates a mesh containing a teapot.
//
// Parameters:
//
// pDevice The D3D device with which the mesh is going to be used.
// ppMesh The mesh object which will be created
// ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
//-------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateTeapot(
__in LPDIRECT3DDEVICE9 pDevice,
__deref_out LPD3DXMESH* ppMesh,
__deref_opt_out LPD3DXBUFFER* ppAdjacency);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //__D3DX9SHAPES_H__

1810
third_party/xbox_sdk/include/d3dx9tex.h vendored Normal file

File diff suppressed because it is too large Load Diff

298
third_party/xbox_sdk/include/d3dx9xof.h vendored Normal file
View File

@ -0,0 +1,298 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dx9xof.h
// Content: D3DX .X File types and functions
//
///////////////////////////////////////////////////////////////////////////
#include "d3dx9.h"
#if !defined( __D3DX9XOF_H__ )
#define __D3DX9XOF_H__
#if defined( __cplusplus )
extern "C" {
#endif // defined( __cplusplus )
//----------------------------------------------------------------------------
// D3DXF_FILEFORMAT
// This flag is used to specify what file type to use when saving to disk.
// _LEGACYBINARY, _BINARY, and _TEXT are mutually exclusive, while
// _COMPRESSED is an optional setting that works with all file types.
//----------------------------------------------------------------------------
typedef DWORD D3DXF_FILEFORMAT;
#define D3DXF_FILEFORMAT_LEGACYBINARY 0
#define D3DXF_FILEFORMAT_BINARY 1
#define D3DXF_FILEFORMAT_TEXT 2
#define D3DXF_FILEFORMAT_COMPRESSED 4
#define D3DXF_FILEFORMAT_VALID 0x7 // internal (this is a mask)
//----------------------------------------------------------------------------
// D3DXF_FILESAVEOPTIONS
// This flag is used to specify where to save the file to. Each flag is
// mutually exclusive, indicates the data location of the file, and also
// chooses which additional data will specify the location.
// _TOFILE is paired with a filename (LPCSTR)
// _TOWFILE is paired with a filename (LPWSTR)
//----------------------------------------------------------------------------
typedef DWORD D3DXF_FILESAVEOPTIONS;
#define D3DXF_FILESAVE_TOFILE 0x00L
#define D3DXF_FILESAVE_TOWFILE 0x01L
#define D3DXF_FILESAVE_VALID 0x01L // internal
//----------------------------------------------------------------------------
// D3DXF_FILELOADOPTIONS
// This flag is used to specify where to load the file from. Each flag is
// mutually exclusive, indicates the data location of the file, and also
// chooses which additional data will specify the location.
// _FROMFILE is paired with a filename (LPCSTR)
// _FROMWFILE is paired with a filename (LPWSTR)
// _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description.
// _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description.
//----------------------------------------------------------------------------
typedef DWORD D3DXF_FILELOADOPTIONS;
#define D3DXF_FILELOAD_FROMFILE 0x00L
#define D3DXF_FILELOAD_FROMWFILE 0x01L
#define D3DXF_FILELOAD_FROMRESOURCE 0x02L
#define D3DXF_FILELOAD_FROMMEMORY 0x03L
//----------------------------------------------------------------------------
// D3DXF_FILELOADRESOURCE:
//----------------------------------------------------------------------------
typedef struct _D3DXF_FILELOADRESOURCE
{
HMODULE hModule; // Desc
LPCSTR lpName; // Desc
LPCSTR lpType; // Desc
} D3DXF_FILELOADRESOURCE;
//----------------------------------------------------------------------------
// D3DXF_FILELOADMEMORY:
//----------------------------------------------------------------------------
typedef struct _D3DXF_FILELOADMEMORY
{
LPCVOID lpMemory; // Desc
SIZE_T dSize; // Desc
} D3DXF_FILELOADMEMORY;
#if defined( _WIN32 ) && !defined( _NO_COM )
// {cef08cf9-7b4f-4429-9624-2a690a933201}
DEFINE_GUID( IID_ID3DXFile,
0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
// {cef08cfa-7b4f-4429-9624-2a690a933201}
DEFINE_GUID( IID_ID3DXFileSaveObject,
0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
// {cef08cfb-7b4f-4429-9624-2a690a933201}
DEFINE_GUID( IID_ID3DXFileSaveData,
0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
// {cef08cfc-7b4f-4429-9624-2a690a933201}
DEFINE_GUID( IID_ID3DXFileEnumObject,
0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
// {cef08cfd-7b4f-4429-9624-2a690a933201}
DEFINE_GUID( IID_ID3DXFileData,
0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
// begin internal
// {cef08cfe-7b4f-4429-9624-2a690a933201}
DEFINE_GUID( IID_TEnumObject,
0xcef08cfe, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
// {cef08cff-7b4f-4429-9624-2a690a933201}
DEFINE_GUID( IID_TBinaryLoad,
0xcef08cff, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
// end_internal
#endif // defined( _WIN32 ) && !defined( _NO_COM )
#if defined( __cplusplus )
#if !defined( DECLSPEC_UUID )
#if _MSC_VER >= 1100
#define DECLSPEC_UUID( x ) __declspec( uuid( x ) )
#else // !( _MSC_VER >= 1100 )
#define DECLSPEC_UUID( x )
#endif // !( _MSC_VER >= 1100 )
#endif // !defined( DECLSPEC_UUID )
interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" )
ID3DXFile;
interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" )
ID3DXFileSaveObject;
interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" )
ID3DXFileSaveData;
interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" )
ID3DXFileEnumObject;
interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" )
ID3DXFileData;
#if defined( _COM_SMARTPTR_TYPEDEF )
_COM_SMARTPTR_TYPEDEF( ID3DXFile,
__uuidof( ID3DXFile ) );
_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject,
__uuidof( ID3DXFileSaveObject ) );
_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData,
__uuidof( ID3DXFileSaveData ) );
_COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject,
__uuidof( ID3DXFileEnumObject ) );
_COM_SMARTPTR_TYPEDEF( ID3DXFileData,
__uuidof( ID3DXFileData ) );
#endif // defined( _COM_SMARTPTR_TYPEDEF )
#endif // defined( __cplusplus )
typedef interface ID3DXFile ID3DXFile;
typedef interface ID3DXFileSaveObject ID3DXFileSaveObject;
typedef interface ID3DXFileSaveData ID3DXFileSaveData;
typedef interface ID3DXFileEnumObject ID3DXFileEnumObject;
typedef interface ID3DXFileData ID3DXFileData;
//////////////////////////////////////////////////////////////////////////////
// ID3DXFile /////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#undef INTERFACE
#define INTERFACE ID3DXFile
DECLARE_INTERFACE_( ID3DXFile, IUnknown )
{
STDMETHOD( QueryInterface )( THIS_ REFIID, __deref_out LPVOID* ) PURE;
STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
STDMETHOD_( ULONG, Release )( THIS ) PURE;
STDMETHOD( CreateEnumObject )( THIS_ __in LPCVOID, D3DXF_FILELOADOPTIONS,
__deref_out ID3DXFileEnumObject** ) PURE;
STDMETHOD( CreateSaveObject )( THIS_ __in LPCVOID, D3DXF_FILESAVEOPTIONS,
D3DXF_FILEFORMAT, __deref_out ID3DXFileSaveObject** ) PURE;
STDMETHOD( RegisterTemplates )( THIS_ __in LPCVOID, SIZE_T) PURE;
STDMETHOD( RegisterEnumTemplates )( THIS_ __in ID3DXFileEnumObject* ) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// ID3DXFileSaveObject ///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#undef INTERFACE
#define INTERFACE ID3DXFileSaveObject
DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown )
{
STDMETHOD( QueryInterface )( THIS_ REFIID, __deref_out LPVOID* ) PURE;
STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
STDMETHOD_( ULONG, Release )( THIS ) PURE;
STDMETHOD( GetFile )( THIS_ __deref_out ID3DXFile** ) PURE;
STDMETHOD( AddDataObject )( THIS_ REFGUID, __in_z LPCSTR, __in CONST GUID*,
SIZE_T, __in LPCVOID, __deref_out ID3DXFileSaveData** ) PURE;
STDMETHOD( Save )( THIS ) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// ID3DXFileSaveData /////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#undef INTERFACE
#define INTERFACE ID3DXFileSaveData
DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown )
{
STDMETHOD( QueryInterface )( THIS_ REFIID, __deref_out LPVOID* ) PURE;
STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
STDMETHOD_( ULONG, Release )( THIS ) PURE;
STDMETHOD( GetSave )( THIS_ __deref_out ID3DXFileSaveObject** ) PURE;
STDMETHOD( GetName )( THIS_ __out_z LPSTR, __out SIZE_T* ) PURE;
STDMETHOD( GetId )( THIS_ __out LPGUID ) PURE;
STDMETHOD( GetType )( THIS_ __out GUID* ) PURE;
STDMETHOD( AddDataObject )( THIS_ REFGUID, __in_z LPCSTR, __in CONST GUID*,
SIZE_T, __in LPCVOID, __deref_out ID3DXFileSaveData** ) PURE;
STDMETHOD( AddDataReference )( THIS_ __in_z LPCSTR, __in CONST GUID* ) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// ID3DXFileEnumObject ///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#undef INTERFACE
#define INTERFACE ID3DXFileEnumObject
DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown )
{
STDMETHOD( QueryInterface )( THIS_ REFIID, __deref_out LPVOID* ) PURE;
STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
STDMETHOD_( ULONG, Release )( THIS ) PURE;
STDMETHOD( GetFile )( THIS_ __deref_out ID3DXFile** ) PURE;
STDMETHOD( GetChildren )( THIS_ __out SIZE_T* ) PURE;
STDMETHOD( GetChild )( THIS_ SIZE_T, __deref_out ID3DXFileData** ) PURE;
STDMETHOD( GetDataObjectById )( THIS_ REFGUID, __deref_out ID3DXFileData** ) PURE;
STDMETHOD( GetDataObjectByName )( THIS_ __in_z LPCSTR, __deref_out ID3DXFileData** ) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// ID3DXFileData /////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#undef INTERFACE
#define INTERFACE ID3DXFileData
DECLARE_INTERFACE_( ID3DXFileData, IUnknown )
{
STDMETHOD( QueryInterface )( THIS_ REFIID, __deref_out LPVOID* ) PURE;
STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
STDMETHOD_( ULONG, Release )( THIS ) PURE;
STDMETHOD( GetEnum )( THIS_ __deref_out ID3DXFileEnumObject** ) PURE;
STDMETHOD( GetName )( THIS_ __out_z LPSTR, __out SIZE_T* ) PURE;
STDMETHOD( GetId )( THIS_ __out LPGUID ) PURE;
STDMETHOD( Lock )( THIS_ __out SIZE_T*, __deref_out LPCVOID* ) PURE;
STDMETHOD( Unlock )( THIS ) PURE;
STDMETHOD( GetType )( THIS_ __out GUID* ) PURE;
STDMETHOD( IsReference )( THIS ) PURE;
STDMETHOD( GetChildren )( THIS_ __out SIZE_T* ) PURE;
STDMETHOD( GetChild )( THIS_ SIZE_T, __deref_out ID3DXFileData** ) PURE;
};
STDAPI D3DXFileCreate( __deref_out ID3DXFile** lplpDirectXFile );
/*
* DirectX File errors.
*/
#define _FACD3DXF 0x876
#define D3DXFERR_BADOBJECT MAKE_HRESULT( 1, _FACD3DXF, 850 )
#define D3DXFERR_BADVALUE MAKE_HRESULT( 1, _FACD3DXF, 851 )
#define D3DXFERR_BADTYPE MAKE_HRESULT( 1, _FACD3DXF, 852 )
#define D3DXFERR_NOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 853 )
#define D3DXFERR_NOTDONEYET MAKE_HRESULT( 1, _FACD3DXF, 854 )
#define D3DXFERR_FILENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 855 )
#define D3DXFERR_RESOURCENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 856 )
#define D3DXFERR_BADRESOURCE MAKE_HRESULT( 1, _FACD3DXF, 857 )
#define D3DXFERR_BADFILETYPE MAKE_HRESULT( 1, _FACD3DXF, 858 )
#define D3DXFERR_BADFILEVERSION MAKE_HRESULT( 1, _FACD3DXF, 859 )
#define D3DXFERR_BADFILEFLOATSIZE MAKE_HRESULT( 1, _FACD3DXF, 860 )
#define D3DXFERR_BADFILE MAKE_HRESULT( 1, _FACD3DXF, 861 )
#define D3DXFERR_PARSEERROR MAKE_HRESULT( 1, _FACD3DXF, 862 )
#define D3DXFERR_BADARRAYSIZE MAKE_HRESULT( 1, _FACD3DXF, 863 )
#define D3DXFERR_BADDATAREFERENCE MAKE_HRESULT( 1, _FACD3DXF, 864 )
#define D3DXFERR_NOMOREOBJECTS MAKE_HRESULT( 1, _FACD3DXF, 865 )
#define D3DXFERR_NOMOREDATA MAKE_HRESULT( 1, _FACD3DXF, 866 )
#define D3DXFERR_BADCACHEFILE MAKE_HRESULT( 1, _FACD3DXF, 867 )
#if defined( __cplusplus )
} // extern "C"
#endif // defined( __cplusplus )
#endif // !defined( __D3DX9XOF_H__ )

239
third_party/xbox_sdk/include/dxfile.h vendored Normal file
View File

@ -0,0 +1,239 @@
/***************************************************************************
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: dxfile.h
*
* Content: DirectX File public header file
*
***************************************************************************/
#ifndef __DXFILE_H__
#define __DXFILE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef DWORD DXFILEFORMAT;
#define DXFILEFORMAT_BINARY 0
#define DXFILEFORMAT_TEXT 1
#define DXFILEFORMAT_COMPRESSED 2
typedef DWORD DXFILELOADOPTIONS;
#define DXFILELOAD_FROMFILE 0x00L
#define DXFILELOAD_FROMRESOURCE 0x01L
#define DXFILELOAD_FROMMEMORY 0x02L
#define DXFILELOAD_FROMSTREAM 0x04L
#define DXFILELOAD_FROMURL 0x08L
typedef struct _DXFILELOADRESOURCE {
HMODULE hModule;
LPCTSTR lpName;
LPCTSTR lpType;
}DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE;
typedef struct _DXFILELOADMEMORY {
LPVOID lpMemory;
DWORD dSize;
}DXFILELOADMEMORY, *LPDXFILELOADMEMORY;
/*
* DirectX File object types.
*/
#ifndef WIN_TYPES
#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype
#endif
WIN_TYPES(IDirectXFile, DIRECTXFILE);
WIN_TYPES(IDirectXFileEnumObject, DIRECTXFILEENUMOBJECT);
WIN_TYPES(IDirectXFileSaveObject, DIRECTXFILESAVEOBJECT);
WIN_TYPES(IDirectXFileObject, DIRECTXFILEOBJECT);
WIN_TYPES(IDirectXFileData, DIRECTXFILEDATA);
WIN_TYPES(IDirectXFileDataReference, DIRECTXFILEDATAREFERENCE);
WIN_TYPES(IDirectXFileBinary, DIRECTXFILEBINARY);
/*
* API for creating IDirectXFile interface.
*/
STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile);
/*
* The methods for IUnknown
*/
#define IUNKNOWN_METHODS(kind) \
STDMETHOD(QueryInterface) (THIS_ REFIID riid, __deref_out LPVOID *ppvObj) kind; \
STDMETHOD_(ULONG, AddRef) (THIS) kind; \
STDMETHOD_(ULONG, Release) (THIS) kind
/*
* The methods for IDirectXFileObject
*/
#define IDIRECTXFILEOBJECT_METHODS(kind) \
STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \
STDMETHOD(GetId) (THIS_ LPGUID) kind
/*
* DirectX File interfaces.
*/
#undef INTERFACE
#define INTERFACE IDirectXFile
DECLARE_INTERFACE_(IDirectXFile, IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(CreateEnumObject) (THIS_ __in LPVOID, DXFILELOADOPTIONS,
__deref_out LPDIRECTXFILEENUMOBJECT *) PURE;
STDMETHOD(CreateSaveObject) (THIS_ __in_z LPCSTR, DXFILEFORMAT,
__deref_out LPDIRECTXFILESAVEOBJECT *) PURE;
STDMETHOD(RegisterTemplates) (THIS_ __in_bcount(cbSize) LPVOID, DWORD cbSize) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectXFileEnumObject
DECLARE_INTERFACE_(IDirectXFileEnumObject, IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(GetNextDataObject) (THIS_ __deref_out LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectById) (THIS_ REFGUID, __deref_out LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectByName) (THIS_ __in_z LPCSTR, __deref_out LPDIRECTXFILEDATA *) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectXFileSaveObject
DECLARE_INTERFACE_(IDirectXFileSaveObject, IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(SaveTemplates) (THIS_ DWORD cTemplates, __in_ecount(cTemplates) const GUID **) PURE;
STDMETHOD(CreateDataObject) (THIS_ REFGUID, __in_z LPCSTR, __in_opt const GUID *,
DWORD cbSize, __in_bcount_opt(cbSize) LPVOID, __deref_out LPDIRECTXFILEDATA *) PURE;
STDMETHOD(SaveData) (THIS_ __in LPDIRECTXFILEDATA) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectXFileObject
DECLARE_INTERFACE_(IDirectXFileObject, IUnknown)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
};
#undef INTERFACE
#define INTERFACE IDirectXFileData
DECLARE_INTERFACE_(IDirectXFileData, IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
STDMETHOD(GetData) (THIS_ __in_z LPCSTR, __out DWORD * pcbSize, __deref_out_bcount(*pcbSize) void ** ppvData) PURE;
STDMETHOD(GetType) (THIS_ __deref_out const GUID **) PURE;
STDMETHOD(GetNextObject) (THIS_ __deref_out LPDIRECTXFILEOBJECT *) PURE;
STDMETHOD(AddDataObject) (THIS_ __in LPDIRECTXFILEDATA) PURE;
STDMETHOD(AddDataReference) (THIS_ __in_z LPCSTR, __in const GUID *) PURE;
STDMETHOD(AddBinaryObject) (THIS_ __in_z LPCSTR, __in const GUID *, __in_z LPCSTR, __in_bcount(cbSize) LPVOID, DWORD cbSize) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectXFileDataReference
DECLARE_INTERFACE_(IDirectXFileDataReference, IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
STDMETHOD(Resolve) (THIS_ __deref_out LPDIRECTXFILEDATA *) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectXFileBinary
DECLARE_INTERFACE_(IDirectXFileBinary, IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
STDMETHOD(GetSize) (THIS_ __out DWORD *) PURE;
STDMETHOD(GetMimeType) (THIS_ __deref_out_z LPCSTR *) PURE;
STDMETHOD(Read) (THIS_ __out_bcount_part(cbSize, *pcbRead) LPVOID pvData, DWORD cbSize, __out LPDWORD pcbRead) PURE;
};
/*
* DirectXFile Object Class Id (for CoCreateInstance())
*/
DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
/*
* DirectX File Interface GUIDs.
*/
DEFINE_GUID(IID_IDirectXFile, 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileObject, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileData, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileDataReference, 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileBinary, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
/*
* DirectX File Header template's GUID.
*/
DEFINE_GUID(TID_DXFILEHeader, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
/*
* DirectX File errors.
*/
#define _FACDD 0x876
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
#define DXFILE_OK 0
#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850)
#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851)
#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852)
#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853)
#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854)
#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855)
#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856)
#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857)
#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858)
#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859)
#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860)
#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861)
#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862)
#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863)
#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864)
#define DXFILEERR_BADFILE MAKE_DDHRESULT(865)
#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866)
#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867)
#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868)
#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869)
#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870)
#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871)
#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872)
#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873)
#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874)
#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875)
#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876)
#ifdef __cplusplus
};
#endif
#endif /* _DXFILE_H_ */

1497
third_party/xbox_sdk/include/fxl.h vendored Normal file

File diff suppressed because it is too large Load Diff

8231
third_party/xbox_sdk/include/fxl.inl vendored Normal file

File diff suppressed because it is too large Load Diff

1497
third_party/xbox_sdk/include/xbdm.h vendored Normal file

File diff suppressed because it is too large Load Diff

97
third_party/xbox_sdk/include/xboxmath.h vendored Normal file
View File

@ -0,0 +1,97 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
xboxmath.h
Abstract:
Xbox math general library interface to XNA Math
--*/
#pragma once
#ifndef __XBOXMATH2_H__
#define __XBOXMATH2_H__
#if defined(_VMX1_INTRINSICS_) || defined(_VMX32_INTRINSICS_)
#error XNA math does not support VMX1 or VMX32
#endif
#ifdef _NO_INTRINSICS_
#define _XM_NO_INTRINSICS_
#endif
#ifdef _VMX128_INTRINSICS_
#define _XM_VMX128_INTRINSICS_
#endif
#ifdef _NOALIGNMENT_
#define XM_NO_ALIGNMENT
#endif
#include "xnamath.h"
/****************************************************************************
*
* Compatibility types
*
****************************************************************************/
typedef XMFLOAT2A XMFLOAT2A16;
typedef XMFLOAT3A XMFLOAT3A16;
typedef XMFLOAT4A XMFLOAT4A16;
typedef XMFLOAT4X3A XMFLOAT4X3A16;
typedef XMFLOAT4X4A XMFLOAT4X4A16;
typedef XMVECTORU32 XMVECTORI;
/****************************************************************************
*
* Compatibility aliases
*
****************************************************************************/
XMFINLINE XMVECTOR XMLoadScalar(CONST VOID* pSource) { return XMLoadFloat((CONST FLOAT*)pSource); }
XMFINLINE XMVECTOR XMLoadVector2(CONST VOID* pSource) { return XMLoadFloat2((CONST XMFLOAT2*)pSource); }
XMFINLINE XMVECTOR XMLoadVector2A(CONST VOID* pSource) { return XMLoadFloat2A((CONST XMFLOAT2A*)pSource); }
XMFINLINE XMVECTOR XMLoadVector3(CONST VOID* pSource) { return XMLoadFloat3((CONST XMFLOAT3*)pSource); }
XMFINLINE XMVECTOR XMLoadVector3A(CONST VOID* pSource) { return XMLoadFloat3A((CONST XMFLOAT3A*)pSource); }
XMFINLINE XMVECTOR XMLoadVector4(CONST VOID* pSource) { return XMLoadFloat4((CONST XMFLOAT4*)pSource); }
XMFINLINE XMVECTOR XMLoadVector4A(CONST VOID* pSource) { return XMLoadFloat4A((CONST XMFLOAT4A*)pSource); }
XMFINLINE XMVECTOR XMLoadVector2A16(CONST VOID* pSource) { return XMLoadVector2A(pSource); }
XMFINLINE XMVECTOR XMLoadVector3A16(CONST VOID* pSource) { return XMLoadVector3A(pSource); }
XMFINLINE XMVECTOR XMLoadVector4A16(CONST VOID* pSource) { return XMLoadVector4A(pSource); }
XMFINLINE XMVECTOR XMLoadFloat2A16(CONST XMFLOAT2A16* pSource) { return XMLoadFloat2A(pSource); }
XMFINLINE XMVECTOR XMLoadFloat3A16(CONST XMFLOAT3A16* pSource) { return XMLoadFloat3A(pSource); }
XMFINLINE XMVECTOR XMLoadFloat4A16(CONST XMFLOAT4A16* pSource) { return XMLoadFloat4A(pSource); }
XMFINLINE XMMATRIX XMLoadFloat4x3A16(CONST XMFLOAT4X3A16* pSource) { return XMLoadFloat4x3A(pSource); }
XMFINLINE XMMATRIX XMLoadFloat4x4A16(CONST XMFLOAT4X4A16* pSource) { return XMLoadFloat4x4A(pSource); }
XMFINLINE VOID XMStoreScalar(VOID* pDestination, FXMVECTOR V) { XMStoreFloat((FLOAT*)pDestination, V); }
XMFINLINE VOID XMStoreVector2(VOID* pDestination, FXMVECTOR V) { XMStoreFloat2((XMFLOAT2*)pDestination, V); }
XMFINLINE VOID XMStoreVector2A(VOID* pDestination, FXMVECTOR V) { XMStoreFloat2A((XMFLOAT2A*)pDestination, V); }
XMFINLINE VOID XMStoreVector3(VOID* pDestination, FXMVECTOR V) { XMStoreFloat3((XMFLOAT3*)pDestination, V); }
XMFINLINE VOID XMStoreVector3A(VOID* pDestination, FXMVECTOR V) { XMStoreFloat3A((XMFLOAT3A*)pDestination, V); }
XMFINLINE VOID XMStoreVector4(VOID* pDestination, FXMVECTOR V) { XMStoreFloat4((XMFLOAT4*)pDestination, V); }
XMFINLINE VOID XMStoreVector4A(VOID* pDestination, FXMVECTOR V) { XMStoreFloat4A((XMFLOAT4A*)pDestination, V); }
XMFINLINE VOID XMStoreVector4NC(VOID* pDestination, FXMVECTOR V) { XMStoreFloat4NC((XMFLOAT4*)pDestination, V); }
XMFINLINE VOID XMStoreVector2A16(VOID* pDestination, FXMVECTOR V) { XMStoreVector2A(pDestination, V); }
XMFINLINE VOID XMStoreVector3A16(VOID* pDestination, FXMVECTOR V) { XMStoreVector3A(pDestination, V); }
XMFINLINE VOID XMStoreVector4A16(VOID* pDestination, FXMVECTOR V) { XMStoreVector4A(pDestination, V); }
XMFINLINE VOID XMStoreFloat2A16(XMFLOAT2A16* pDestination, FXMVECTOR V) { XMStoreFloat2A(pDestination, V); }
XMFINLINE VOID XMStoreFloat3A16(XMFLOAT3A16* pDestination, FXMVECTOR V) { XMStoreFloat3A(pDestination, V); }
XMFINLINE VOID XMStoreFloat4A16(XMFLOAT4A16* pDestination, FXMVECTOR V) { XMStoreFloat4A(pDestination, V); }
XMFINLINE VOID XMStoreFloat4x3A16(XMFLOAT4X3A16* pDestination, CXMMATRIX M) { XMStoreFloat4x3A(pDestination, M); }
XMFINLINE VOID XMStoreFloat4x4A16(XMFLOAT4X4A16* pDestination, CXMMATRIX M) { XMStoreFloat4x4A(pDestination, M); }
XMFINLINE XMVECTOR XMVectorMinimize(FXMVECTOR V1, FXMVECTOR V2) { return XMVectorMin(V1, V2); }
XMFINLINE XMVECTOR XMVectorMaximize(FXMVECTOR V1, FXMVECTOR V2) { return XMVectorMax(V1, V2); }
#endif // __XBOXMATH2_H__

310
third_party/xbox_sdk/include/xcompress.h vendored Normal file
View File

@ -0,0 +1,310 @@
/************************************************************************
* *
* xcompress.h -- This module defines the Xbox Compression APIs *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
************************************************************************/
#pragma once
#ifndef _XCOMPRESS_H_
#define _XCOMPRESS_H_
#include <Windows.h>
#include <sal.h>
#ifndef XBOXAPI
#define XBOXAPI
#endif
#ifdef __cplusplus
#define XCTDEXTERN extern "C"
#else
#define XCTDEXTERN extern
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#pragma warning(push)
#pragma warning(disable: 4200) // zero-sized array
typedef enum _XMEMCODEC_TYPE
{
XMEMCODEC_DEFAULT = 0,
XMEMCODEC_LZX = 1
} XMEMCODEC_TYPE;
/*
* Data compression flags
*/
#define XMEMCOMPRESS_STREAM 0x00000001
/*
* Data compression functions
*/
typedef VOID* XMEMCOMPRESSION_CONTEXT;
XBOXAPI
HRESULT
WINAPI
XMemCreateCompressionContext(
__in XMEMCODEC_TYPE CodecType,
__in_opt CONST VOID* pCodecParams,
__in DWORD Flags,
__deref_out XMEMCOMPRESSION_CONTEXT* pContext
);
XBOXAPI
XMEMCOMPRESSION_CONTEXT
WINAPI
XMemInitializeCompressionContext(
__in XMEMCODEC_TYPE CodecType,
__in_opt CONST VOID* pCodecParams,
__in DWORD Flags,
__out_bcount(ContextSize) VOID* pContextData,
__in SIZE_T ContextSize
);
XBOXAPI
VOID
WINAPI
XMemDestroyCompressionContext(
__in XMEMCOMPRESSION_CONTEXT Context
);
XBOXAPI
SIZE_T
WINAPI
XMemGetCompressionContextSize(
__in XMEMCODEC_TYPE CodecType,
__in_opt CONST VOID* pCodecParams,
__in DWORD Flags
);
XBOXAPI
HRESULT
WINAPI
XMemResetCompressionContext(
__in XMEMCOMPRESSION_CONTEXT Context);
XBOXAPI
HRESULT
WINAPI
XMemCompress(
__in XMEMCOMPRESSION_CONTEXT Context,
__out_bcount_opt( *pDestSize ) VOID* pDestination,
__inout SIZE_T* pDestSize,
__in_bcount( SrcSize ) CONST VOID* pSource,
__in SIZE_T SrcSize
);
XBOXAPI
HRESULT
WINAPI
XMemCompressStream(
__in XMEMCOMPRESSION_CONTEXT Context,
__out_bcount_opt( *pDestSize ) VOID* pDestination,
__inout SIZE_T* pDestSize,
__in_bcount( *pSrcSize ) CONST VOID* pSource,
__inout SIZE_T* pSrcSize
);
/*
* Data decompression functions
*/
typedef VOID* XMEMDECOMPRESSION_CONTEXT;
XBOXAPI
HRESULT
WINAPI
XMemCreateDecompressionContext(
__in XMEMCODEC_TYPE CodecType,
__in_opt CONST VOID* pCodecParams,
__in DWORD Flags,
__deref_out XMEMDECOMPRESSION_CONTEXT* pContext
);
XBOXAPI
XMEMDECOMPRESSION_CONTEXT
WINAPI
XMemInitializeDecompressionContext(
__in XMEMCODEC_TYPE CodecType,
__in_opt CONST VOID* pCodecParams,
__in DWORD Flags,
__out_bcount( ContextSize ) VOID* pContextData,
__in SIZE_T ContextSize
);
XBOXAPI
VOID
WINAPI
XMemDestroyDecompressionContext(
__in XMEMDECOMPRESSION_CONTEXT Context
);
XBOXAPI
SIZE_T
WINAPI
XMemGetDecompressionContextSize(
__in XMEMCODEC_TYPE CodecType,
__in_opt CONST VOID* pCodecParams,
__in DWORD Flags
);
XBOXAPI
HRESULT
WINAPI
XMemResetDecompressionContext(
__in XMEMDECOMPRESSION_CONTEXT Context);
XBOXAPI
HRESULT
WINAPI
XMemDecompress(
__in XMEMDECOMPRESSION_CONTEXT Context,
__out_bcount( *pDestSize ) VOID* pDestination,
__inout SIZE_T* pDestSize,
__in_bcount( SrcSize) CONST VOID* pSource,
__in SIZE_T SrcSize
);
XBOXAPI
HRESULT
WINAPI
XMemDecompressStream(
__in XMEMDECOMPRESSION_CONTEXT Context,
__out_bcount( *pDestSize ) VOID* pDestination,
__inout SIZE_T* pDestSize,
__in_bcount( *pSrcSize ) CONST VOID* pSource,
__inout SIZE_T* pSrcSize
);
/*
* LZX codec for lossless compression
*/
typedef struct _XMEMCODEC_PARAMETERS_LZX
{
DWORD Flags;
DWORD WindowSize;
DWORD CompressionPartitionSize;
} XMEMCODEC_PARAMETERS_LZX;
#define XCOMPRESS_LZX_BLOCK_SIZE (32 * 1024)
#define XCOMPRESS_LZX_BLOCK_GROWTH_SIZE_MAX 6155
/*
* Error codes
*/
#define XMCDERR_MOREDATA _HRESULT_TYPEDEF_(0x81DE2001)
/*
* Transparent decoding
*/
#if defined(_M_PPCBE)
typedef struct _XTDECODER_PARAMETERS
{
XMEMCODEC_TYPE CodecType;
CONST VOID* pCodecParams;
DWORD Flags;
DWORD HardwareThread;
INT ThreadPriority;
DWORD SegmentSizeLimit;
DWORD PendingReadLimit;
DWORD OpenFileLimit;
DWORD TranslationCacheSize;
} XTDECODER_PARAMETERS;
/*
* Transparent decoding flags
*/
#define XTDECODER_NO_READ_ALIGNMENT_ENFORCEMENT 0x00000001
/*
* Transparent decoding global which, when set to TRUE before transparent
* decompression has been enabled, will force an explicit examination (read)
* of all files when created to determine their compression state (ignoring
* the presence or absence of the GDF compressed attribute bit). Use of this
* global should be done for debugging purposes only.
*/
XCTDEXTERN BOOL XCTD__ProbeFileCompressionState;
/*
* Transparent decoding functions
*/
XBOXAPI
HRESULT
WINAPI
XFileEnableTransparentDecompression(
__in_opt CONST XTDECODER_PARAMETERS* pDecoderParams
);
XBOXAPI
VOID
WINAPI
XFileDisableTransparentDecompression();
#endif
/*
* Compression file headers
*/
#define XCOMPRESS_FILE_IDENTIFIER_LZXTDECODE 0x0FF512ED
#define XCOMPRESS_FILE_IDENTIFIER_LZXNATIVE 0x0FF512EE
#define XCOMPRESS_SET_FILE_VERSION(Major, Minor) ((((Major) & 0xFF) << 8) | ((Minor) & 0xFF))
#define XCOMPRESS_GET_FILE_VERSION_MAJOR(Version) (((Version) >> 8) & 0xFF)
#define XCOMPRESS_GET_FILE_VERSION_MINOR(Version) ((Version) & 0xFF)
#define XCOMPRESS_LZXTDECODE_VERSION_MAJOR 1
#define XCOMPRESS_LZXTDECODE_VERSION_MINOR 0
#define XCOMPRESS_LZXNATIVE_VERSION_MAJOR 1
#define XCOMPRESS_LZXNATIVE_VERSION_MINOR 3
typedef struct _XCOMPRESS_FILE_HEADER
{
DWORD Identifier;
WORD Version;
WORD Reserved;
} XCOMPRESS_FILE_HEADER;
typedef struct _XCOMPRESS_FILE_HEADER_LZXNATIVE
{
XCOMPRESS_FILE_HEADER Common;
DWORD ContextFlags;
XMEMCODEC_PARAMETERS_LZX CodecParams;
DWORD UncompressedSizeHigh;
DWORD UncompressedSizeLow;
DWORD CompressedSizeHigh;
DWORD CompressedSizeLow;
DWORD UncompressedBlockSize;
DWORD CompressedBlockSizeMax;
} XCOMPRESS_FILE_HEADER_LZXNATIVE;
typedef struct _XCOMPRESS_BLOCK_HEADER_LZXNATIVE
{
DWORD CompressedBlockSize;
BYTE pCompressedData[0];
} XCOMPRESS_BLOCK_HEADER_LZXNATIVE;
#pragma warning(pop)
#ifdef __cplusplus
}
#endif
#endif /* _XCOMPRESS_H_ */

21
third_party/xbox_sdk/include/xdk.h vendored Normal file
View File

@ -0,0 +1,21 @@
/*++ BUILD Version: 0000 Increment this if a change has global effects
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
xdk.h
Abstract:
Defines the version of the XDK
Revision History:
--*/
#ifndef _XDK_
#define _XDK_
#define _XDK_VER 21256
#endif /* _XDK_ */

408
third_party/xbox_sdk/include/xectx.h vendored Normal file
View File

@ -0,0 +1,408 @@
/*++
Copyright (c) IBM Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
XeCtx.h
Abstract:
User-mode visible PowerPC (Xenon) specific structures and constants
--*/
#ifndef _XE_CTX_
#define _XE_CTX_
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
//
// The following flags control the contents of the XCONTEXT structure.
//
#if !defined(RC_INVOKED)
#define XCONTEXT_CONTROL 0x00000001L
#define XCONTEXT_FLOATING_POINT 0x00000002L
#define XCONTEXT_INTEGER 0x00000004L
#define XCONTEXT_VECTOR 0x00000010L
#define XCONTEXT_FULL (XCONTEXT_CONTROL | XCONTEXT_FLOATING_POINT | XCONTEXT_INTEGER | XCONTEXT_VECTOR)
#endif
//
// Xenon Context Frame - this is the CONTEXT structure on Xenon
//
typedef struct _XCONTEXT {
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
ULONG ContextFlags;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_CONTROL.
//
ULONG Msr; // Machine status register
ULONG Iar; // Instruction address register
ULONG Lr; // Link register
ULONGLONG Ctr; // Count register
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_INTEGER.
//
ULONGLONG Gpr0; // General registers 0..31
ULONGLONG Gpr1;
ULONGLONG Gpr2;
ULONGLONG Gpr3;
ULONGLONG Gpr4;
ULONGLONG Gpr5;
ULONGLONG Gpr6;
ULONGLONG Gpr7;
ULONGLONG Gpr8;
ULONGLONG Gpr9;
ULONGLONG Gpr10;
ULONGLONG Gpr11;
ULONGLONG Gpr12;
ULONGLONG Gpr13;
ULONGLONG Gpr14;
ULONGLONG Gpr15;
ULONGLONG Gpr16;
ULONGLONG Gpr17;
ULONGLONG Gpr18;
ULONGLONG Gpr19;
ULONGLONG Gpr20;
ULONGLONG Gpr21;
ULONGLONG Gpr22;
ULONGLONG Gpr23;
ULONGLONG Gpr24;
ULONGLONG Gpr25;
ULONGLONG Gpr26;
ULONGLONG Gpr27;
ULONGLONG Gpr28;
ULONGLONG Gpr29;
ULONGLONG Gpr30;
ULONGLONG Gpr31;
ULONG Cr; // Condition register
ULONG Xer; // Fixed point exception register
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_FLOATING_POINT.
//
double Fpscr; // Floating point status/control reg
double Fpr0; // Floating registers 0..31
double Fpr1;
double Fpr2;
double Fpr3;
double Fpr4;
double Fpr5;
double Fpr6;
double Fpr7;
double Fpr8;
double Fpr9;
double Fpr10;
double Fpr11;
double Fpr12;
double Fpr13;
double Fpr14;
double Fpr15;
double Fpr16;
double Fpr17;
double Fpr18;
double Fpr19;
double Fpr20;
double Fpr21;
double Fpr22;
double Fpr23;
double Fpr24;
double Fpr25;
double Fpr26;
double Fpr27;
double Fpr28;
double Fpr29;
double Fpr30;
double Fpr31;
ULONG UserModeControl; // User mode control state
ULONG Fill;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_VECTOR.
//
float Vscr[4]; // Vector status/control register
float Vr0[4]; // Vector registers 0..127
float Vr1[4];
float Vr2[4];
float Vr3[4];
float Vr4[4];
float Vr5[4];
float Vr6[4];
float Vr7[4];
float Vr8[4];
float Vr9[4];
float Vr10[4];
float Vr11[4];
float Vr12[4];
float Vr13[4];
float Vr14[4];
float Vr15[4];
float Vr16[4];
float Vr17[4];
float Vr18[4];
float Vr19[4];
float Vr20[4];
float Vr21[4];
float Vr22[4];
float Vr23[4];
float Vr24[4];
float Vr25[4];
float Vr26[4];
float Vr27[4];
float Vr28[4];
float Vr29[4];
float Vr30[4];
float Vr31[4];
float Vr32[4];
float Vr33[4];
float Vr34[4];
float Vr35[4];
float Vr36[4];
float Vr37[4];
float Vr38[4];
float Vr39[4];
float Vr40[4];
float Vr41[4];
float Vr42[4];
float Vr43[4];
float Vr44[4];
float Vr45[4];
float Vr46[4];
float Vr47[4];
float Vr48[4];
float Vr49[4];
float Vr50[4];
float Vr51[4];
float Vr52[4];
float Vr53[4];
float Vr54[4];
float Vr55[4];
float Vr56[4];
float Vr57[4];
float Vr58[4];
float Vr59[4];
float Vr60[4];
float Vr61[4];
float Vr62[4];
float Vr63[4];
float Vr64[4];
float Vr65[4];
float Vr66[4];
float Vr67[4];
float Vr68[4];
float Vr69[4];
float Vr70[4];
float Vr71[4];
float Vr72[4];
float Vr73[4];
float Vr74[4];
float Vr75[4];
float Vr76[4];
float Vr77[4];
float Vr78[4];
float Vr79[4];
float Vr80[4];
float Vr81[4];
float Vr82[4];
float Vr83[4];
float Vr84[4];
float Vr85[4];
float Vr86[4];
float Vr87[4];
float Vr88[4];
float Vr89[4];
float Vr90[4];
float Vr91[4];
float Vr92[4];
float Vr93[4];
float Vr94[4];
float Vr95[4];
float Vr96[4];
float Vr97[4];
float Vr98[4];
float Vr99[4];
float Vr100[4];
float Vr101[4];
float Vr102[4];
float Vr103[4];
float Vr104[4];
float Vr105[4];
float Vr106[4];
float Vr107[4];
float Vr108[4];
float Vr109[4];
float Vr110[4];
float Vr111[4];
float Vr112[4];
float Vr113[4];
float Vr114[4];
float Vr115[4];
float Vr116[4];
float Vr117[4];
float Vr118[4];
float Vr119[4];
float Vr120[4];
float Vr121[4];
float Vr122[4];
float Vr123[4];
float Vr124[4];
float Vr125[4];
float Vr126[4];
float Vr127[4];
} XCONTEXT, *PXCONTEXT;
//
// PowerPC special-purpose registers
//
//
// Define Machine Status Register (MSR) fields
//
typedef struct _XMSR {
ULONG LE : 1; // 31 Little-Endian execution mode
ULONG RI : 1; // 30 Recoverable Interrupt
ULONG Rsv1 : 2; // 29..28 reserved
ULONG DR : 1; // 27 Data Relocate
ULONG IR : 1; // 26 Instruction Relocate
ULONG IP : 1; // 25 Interrupt Prefix
ULONG Rsv2 : 1; // 24 reserved
ULONG FE1 : 1; // 23 Floating point Exception mode 1
ULONG BE : 1; // 22 Branch trace Enable
ULONG SE : 1; // 21 Single-step trace Enable
ULONG FE0 : 1; // 20 Floating point Exception mode 0
ULONG ME : 1; // 19 Machine check Enable
ULONG FP : 1; // 18 Floating Point available
ULONG PR : 1; // 17 Problem state
ULONG EE : 1; // 16 External interrupt Enable
ULONG ILE : 1; // 15 Interrupt Little-Endian mode
ULONG IMPL : 1; // 14 Implementation dependent
ULONG POW : 1; // 13 Power management enable
ULONG Rsv3 : 13; // 12..0 reserved
} XMSR, *PXMSR;
//
// Define Processor Version Register (PVR) fields
//
typedef struct _XPVR {
ULONG Revision : 16;
ULONG Version : 16;
} XPVR, *PXPVR;
//
// Define Condition Register (CR) fields
//
// We name the structure CondR rather than CR, so that a pointer
// to a condition register structure is PCondR rather than PCR.
// (PCR is an NT data structure, the Processor Control Region.)
typedef struct _XCondR {
ULONG CR7 : 4; // Eight 4-bit fields; machine numbers
ULONG CR6 : 4; // them in Big-Endian order
ULONG CR5 : 4;
ULONG CR4 : 4;
ULONG CR3 : 4;
ULONG CR2 : 4;
ULONG CR1 : 4;
ULONG CR0 : 4;
} XCondR, *PXCondR;
//
// Define Fixed Point Exception Register (XER) fields
//
typedef struct _XXER {
ULONG Rsv : 29; // 31..3 Reserved
ULONG CA : 1; // 2 Carry
ULONG OV : 1; // 1 Overflow
ULONG SO : 1; // 0 Summary Overflow
} XXER, *PXXER;
//
// Define Floating Point Status/Control Register (FPSCR) fields
//
typedef union _XFPSCR {
struct {
ULONG RN : 2; // 31..30 Rounding control
ULONG NI : 1; // 29 Non-IEEE mode
ULONG XE : 1; // 28 Inexact exception Enable
ULONG ZE : 1; // 27 Zero divide exception Enable
ULONG UE : 1; // 26 Underflow exception Enable
ULONG OE : 1; // 25 Overflow exception Enable
ULONG VE : 1; // 24 Invalid operation exception Enable
ULONG VXCVI : 1; // 23 Invalid op exception (integer convert)
ULONG VXSQRT : 1; // 22 Invalid op exception (square root)
ULONG VXSOFT : 1; // 21 Invalid op exception (software request)
ULONG Res1 : 1; // 20 reserved
ULONG FU : 1; // 19 Result Unordered or NaN
ULONG FE : 1; // 18 Result Equal or zero
ULONG FG : 1; // 17 Result Greater than or positive
ULONG FL : 1; // 16 Result Less than or negative
ULONG C : 1; // 15 Result Class descriptor
ULONG FI : 1; // 14 Fraction Inexact
ULONG FR : 1; // 13 Fraction Rounded
ULONG VXVC : 1; // 12 Invalid op exception (compare)
ULONG VXIMZ : 1; // 11 Invalid op exception (infinity * 0)
ULONG VXZDZ : 1; // 10 Invalid op exception (0 / 0)
ULONG VXIDI : 1; // 9 Invalid op exception (infinity / infinity)
ULONG VXISI : 1; // 8 Invalid op exception (infinity - infinity)
ULONG VXSNAN : 1; // 7 Invalid op exception (signalling NaN)
ULONG XX : 1; // 6 Inexact exception
ULONG ZX : 1; // 5 Zero divide exception
ULONG UX : 1; // 4 Underflow exception
ULONG OX : 1; // 3 Overflow exception
ULONG VX : 1; // 2 Invalid operation exception summary
ULONG FEX : 1; // 1 Enabled Exception summary
ULONG FX : 1; // 0 Exception summary
} bits;
ULONG AsULONG;
} FXPSCR, *PXFPSCR;
#ifdef __cplusplus
}
#endif
#endif // _XE_CTX_

2791
third_party/xbox_sdk/include/xgraphics.h vendored Normal file

File diff suppressed because it is too large Load Diff

718
third_party/xbox_sdk/include/xma2defs.h vendored Normal file
View File

@ -0,0 +1,718 @@
/***************************************************************************
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* File: xma2defs.h
* Content: Constants, data types and functions for XMA2 compressed audio.
*
***************************************************************************/
#ifndef __XMA2DEFS_INCLUDED__
#define __XMA2DEFS_INCLUDED__
#include <sal.h> // Markers for documenting API semantics
#include <winerror.h> // For S_OK, E_FAIL
#include <audiodefs.h> // Basic data types and constants for audio work
/***************************************************************************
* Overview
***************************************************************************/
// A typical XMA2 file contains these RIFF chunks:
//
// 'fmt' or 'XMA2' chunk (or both): A description of the XMA data's structure
// and characteristics (length, channels, sample rate, loops, block size, etc).
//
// 'seek' chunk: A seek table to help navigate the XMA data.
//
// 'data' chunk: The encoded XMA2 data.
//
// The encoded XMA2 data is structured as a set of BLOCKS, which contain PACKETS,
// which contain FRAMES, which contain SUBFRAMES (roughly speaking). The frames
// in a file may also be divided into several subsets, called STREAMS.
//
// FRAME: A variable-sized segment of XMA data that decodes to exactly 512 mono
// or stereo PCM samples. This is the smallest unit of XMA data that can
// be decoded in isolation. Frames are an arbitrary number of bits in
// length, and need not be byte-aligned. See "XMA frame structure" below.
//
// SUBFRAME: A region of bits in an XMA frame that decodes to 128 mono or stereo
// samples. The XMA decoder cannot decode a subframe in isolation; it needs
// a whole frame to work with. However, it can begin emitting the frame's
// decoded samples at any one of the four subframe boundaries. Subframes
// can be addressed for seeking and looping purposes.
//
// PACKET: A 2Kb region containing a 32-bit header and some XMA frames. Frames
// can (and usually do) span packets. A packet's header includes the offset
// in bits of the first frame that begins within that packet. All of the
// frames that begin in a given packet belong to the same "stream" (see the
// Multichannel Audio section below).
//
// STREAM: A set of packets within an XMA file that all contain data for the
// same mono or stereo component of a PCM file with more than two channels.
// The packets comprising a given stream may be interleaved with each other
// more or less arbitrarily; see Multichannel Audio.
//
// BLOCK: An array of XMA packets; or, to break it down differently, a series of
// consecutive XMA frames, padded at the end with reserved data. A block
// must contain at least one 2Kb packet per stream, and it can hold up to
// 4095 packets (8190Kb), but its size is typically in the 32Kb-128Kb range.
// (The size chosen involves a trade-off between memory use and efficiency
// of reading from permanent storage.)
//
// XMA frames do not span blocks, so a block is guaranteed to begin with a
// set of complete frames, one per stream. Also, a block in a multi-stream
// XMA2 file always contains the same number of samples for each stream;
// see Multichannel Audio.
//
// The 'data' chunk in an XMA2 file is an array of XMA2WAVEFORMAT.BlockCount XMA
// blocks, all the same size (as specified in XMA2WAVEFORMAT.BlockSizeInBytes)
// except for the last one, which may be shorter.
// MULTICHANNEL AUDIO: the XMA decoder can only decode raw XMA data into either
// mono or stereo PCM data. In order to encode a 6-channel file (say), the file
// must be deinterleaved into 3 stereo streams that are encoded independently,
// producing 3 encoded XMA data streams. Then the packets in these 3 streams
// are interleaved to produce a single XMA2 file, and some information is added
// to the file so that the original 6-channel audio can be reconstructed at
// decode time. This works using the concept of an XMA stream (see above).
//
// The frames for all the streams in an XMA file are interleaved in an arbitrary
// order. To locate a frame that belongs to a given stream in a given XMA block,
// you must examine the first few packets in the block. Here (and only here) the
// packets are guaranteed to be presented in stream order, so that all frames
// beginning in packet 0 belong to stream 0 (the first stereo pair), etc.
//
// (This means that when decoding multi-stream XMA files, only entire XMA blocks
// should be submitted to the decoder; otherwise it cannot know which frames
// belong to which stream.)
//
// Once you have one frame that belongs to a given stream, you can find the next
// one by looking at the frame's 'NextFrameOffsetBits' value (which is stored in
// its first 15 bits; see XMAFRAME below). The GetXmaFrameBitPosition function
// uses this technique.
// SEEKING IN XMA2 FILES: Here is some pseudocode to find the byte position and
// subframe in an XMA2 file which will contain sample S when decoded.
//
// 1. Traverse the seek table to find the XMA2 block containing sample S. The
// seek table is an array of big-endian DWORDs, one per block in the file.
// The Nth DWORD is the total number of PCM samples that would be obtained
// by decoding the entire XMA file up to the end of block N. Hence, the
// block we want is the first one whose seek table entry is greater than S.
// (See the GetXmaBlockContainingSample helper function.)
//
// 2. Calculate which frame F within the block found above contains sample S.
// Since each frame decodes to 512 samples, this is straightforward. The
// first frame in the block produces samples X to X + 512, where X is the
// seek table entry for the prior block. So F is (S - X) / 512.
//
// 3. Find the bit offset within the block where frame F starts. Since frames
// are variable-sized, this can only be done by traversing all the frames in
// the block until we reach frame F. (See GetXmaFrameBitPosition.)
//
// 4. Frame F has four 128-sample subframes. To find the subframe containing S,
// we can use the formula (S % 512) / 128.
//
// In the case of multi-stream XMA files, sample S is a multichannel sample with
// parts coming from several frames, one per stream. To find all these frames,
// steps 2-4 need to be repeated for each stream N, using the knowledge that the
// first packets in a block are presented in stream order. The frame traversal
// in step 3 must be started at the first frame in the Nth packet of the block,
// which will be the first frame for stream N. (And the packet header will tell
// you the first frame's start position within the packet.)
//
// Step 1 can be performed using the GetXmaBlockContainingSample function below,
// and steps 2-4 by calling GetXmaDecodePositionForSample once for each stream.
/***************************************************************************
* XMA constants
***************************************************************************/
// Size of the PCM samples produced by the XMA decoder
#define XMA_OUTPUT_SAMPLE_BYTES 2u
#define XMA_OUTPUT_SAMPLE_BITS (XMA_OUTPUT_SAMPLE_BYTES * 8u)
// Size of an XMA packet
#define XMA_BYTES_PER_PACKET 2048u
#define XMA_BITS_PER_PACKET (XMA_BYTES_PER_PACKET * 8u)
// Size of an XMA packet header
#define XMA_PACKET_HEADER_BYTES 4u
#define XMA_PACKET_HEADER_BITS (XMA_PACKET_HEADER_BYTES * 8u)
// Sample blocks in a decoded XMA frame
#define XMA_SAMPLES_PER_FRAME 512u
// Sample blocks in a decoded XMA subframe
#define XMA_SAMPLES_PER_SUBFRAME 128u
// Maximum encoded data that can be submitted to the XMA decoder at a time
#define XMA_READBUFFER_MAX_PACKETS 4095u
#define XMA_READBUFFER_MAX_BYTES (XMA_READBUFFER_MAX_PACKETS * XMA_BYTES_PER_PACKET)
// Maximum size allowed for the XMA decoder's output buffers
#define XMA_WRITEBUFFER_MAX_BYTES (31u * 256u)
// Required byte alignment of the XMA decoder's output buffers
#define XMA_WRITEBUFFER_BYTE_ALIGNMENT 256u
// Decode chunk sizes for the XMA_PLAYBACK_INIT.subframesToDecode field
#define XMA_MIN_SUBFRAMES_TO_DECODE 1u
#define XMA_MAX_SUBFRAMES_TO_DECODE 8u
#define XMA_OPTIMAL_SUBFRAMES_TO_DECODE 4u
// LoopCount<255 means finite repetitions; LoopCount=255 means infinite looping
#define XMA_MAX_LOOPCOUNT 254u
#define XMA_INFINITE_LOOP 255u
/***************************************************************************
* XMA format structures
***************************************************************************/
// The currently recommended way to express format information for XMA2 files
// is the XMA2WAVEFORMATEX structure. This structure is fully compliant with
// the WAVEFORMATEX standard and contains all the information needed to parse
// and manage XMA2 files in a compact way.
#define WAVE_FORMAT_XMA2 0x166
typedef struct XMA2WAVEFORMATEX
{
WAVEFORMATEX wfx;
// Meaning of the WAVEFORMATEX fields here:
// wFormatTag; // Audio format type; always WAVE_FORMAT_XMA2
// nChannels; // Channel count of the decoded audio
// nSamplesPerSec; // Sample rate of the decoded audio
// nAvgBytesPerSec; // Used internally by the XMA encoder
// nBlockAlign; // Decoded sample size; channels * wBitsPerSample / 8
// wBitsPerSample; // Bits per decoded mono sample; always 16 for XMA
// cbSize; // Size in bytes of the rest of this structure (34)
WORD NumStreams; // Number of audio streams (1 or 2 channels each)
DWORD ChannelMask; // Spatial positions of the channels in this file,
// stored as SPEAKER_xxx values (see audiodefs.h)
DWORD SamplesEncoded; // Total number of PCM samples the file decodes to
DWORD BytesPerBlock; // XMA block size (but the last one may be shorter)
DWORD PlayBegin; // First valid sample in the decoded audio
DWORD PlayLength; // Length of the valid part of the decoded audio
DWORD LoopBegin; // Beginning of the loop region in decoded sample terms
DWORD LoopLength; // Length of the loop region in decoded sample terms
BYTE LoopCount; // Number of loop repetitions; 255 = infinite
BYTE EncoderVersion; // Version of XMA encoder that generated the file
WORD BlockCount; // XMA blocks in file (and entries in its seek table)
} XMA2WAVEFORMATEX, *PXMA2WAVEFORMATEX;
// The legacy XMA format structures are described here for reference, but they
// should not be used in new content. XMAWAVEFORMAT was the structure used in
// XMA version 1 files. XMA2WAVEFORMAT was used in early XMA2 files; it is not
// placed in the usual 'fmt' RIFF chunk but in its own 'XMA2' chunk.
#ifndef WAVE_FORMAT_XMA
#define WAVE_FORMAT_XMA 0x0165
// Values used in the ChannelMask fields below. Similar to the SPEAKER_xxx
// values defined in audiodefs.h, but modified to fit in a single byte.
#ifndef XMA_SPEAKER_LEFT
#define XMA_SPEAKER_LEFT 0x01
#define XMA_SPEAKER_RIGHT 0x02
#define XMA_SPEAKER_CENTER 0x04
#define XMA_SPEAKER_LFE 0x08
#define XMA_SPEAKER_LEFT_SURROUND 0x10
#define XMA_SPEAKER_RIGHT_SURROUND 0x20
#define XMA_SPEAKER_LEFT_BACK 0x40
#define XMA_SPEAKER_RIGHT_BACK 0x80
#endif
// Used in XMAWAVEFORMAT for per-stream data
typedef struct XMASTREAMFORMAT
{
DWORD PsuedoBytesPerSec; // Used by the XMA encoder (typo preserved for legacy reasons)
DWORD SampleRate; // The stream's decoded sample rate (in XMA2 files,
// this is the same for all streams in the file).
DWORD LoopStart; // Bit offset of the frame containing the loop start
// point, relative to the beginning of the stream.
DWORD LoopEnd; // Bit offset of the frame containing the loop end.
BYTE SubframeData; // Two 4-bit numbers specifying the exact location of
// the loop points within the frames that contain them.
// SubframeEnd: Subframe of the loop end frame where
// the loop ends. Ranges from 0 to 3.
// SubframeSkip: Subframes to skip in the start frame to
// reach the loop. Ranges from 0 to 4.
BYTE Channels; // Number of channels in the stream (1 or 2)
WORD ChannelMask; // Spatial positions of the channels in the stream
} XMASTREAMFORMAT;
// Legacy XMA1 format structure
typedef struct XMAWAVEFORMAT
{
WORD FormatTag; // Audio format type (always WAVE_FORMAT_XMA)
WORD BitsPerSample; // Bit depth (currently required to be 16)
WORD EncodeOptions; // Options for XMA encoder/decoder
WORD LargestSkip; // Largest skip used in interleaving streams
WORD NumStreams; // Number of interleaved audio streams
BYTE LoopCount; // Number of loop repetitions; 255 = infinite
BYTE Version; // XMA encoder version that generated the file.
// Always 3 or higher for XMA2 files.
XMASTREAMFORMAT XmaStreams[1]; // Per-stream format information; the actual
// array length is in the NumStreams field.
} XMAWAVEFORMAT;
// Used in XMA2WAVEFORMAT for per-stream data
typedef struct XMA2STREAMFORMAT
{
BYTE Channels; // Number of channels in the stream (1 or 2)
BYTE RESERVED; // Reserved for future use
WORD ChannelMask; // Spatial positions of the channels in the stream
} XMA2STREAMFORMAT;
// Legacy XMA2 format structure (big-endian byte ordering)
typedef struct XMA2WAVEFORMAT
{
BYTE Version; // XMA encoder version that generated the file.
// Always 3 or higher for XMA2 files.
BYTE NumStreams; // Number of interleaved audio streams
BYTE RESERVED; // Reserved for future use
BYTE LoopCount; // Number of loop repetitions; 255 = infinite
DWORD LoopBegin; // Loop begin point, in samples
DWORD LoopEnd; // Loop end point, in samples
DWORD SampleRate; // The file's decoded sample rate
DWORD EncodeOptions; // Options for the XMA encoder/decoder
DWORD PsuedoBytesPerSec; // Used internally by the XMA encoder
DWORD BlockSizeInBytes; // Size in bytes of this file's XMA blocks (except
// possibly the last one). Always a multiple of
// 2Kb, since XMA blocks are arrays of 2Kb packets.
DWORD SamplesEncoded; // Total number of PCM samples encoded in this file
DWORD SamplesInSource; // Actual number of PCM samples in the source
// material used to generate this file
DWORD BlockCount; // Number of XMA blocks in this file (and hence
// also the number of entries in its seek table)
XMA2STREAMFORMAT Streams[1]; // Per-stream format information; the actual
// array length is in the NumStreams field.
} XMA2WAVEFORMAT;
#endif // #ifndef WAVE_FORMAT_XMA
/***************************************************************************
* XMA packet structure (in big-endian form)
***************************************************************************/
typedef struct XMA2PACKET
{
int FrameCount : 6; // Number of XMA frames that begin in this packet
int FrameOffsetInBits : 15; // Bit of XmaData where the first complete frame begins
int PacketMetaData : 3; // Metadata stored in the packet (always 1 for XMA2)
int PacketSkipCount : 8; // How many packets belonging to other streams must be
// skipped to find the next packet belonging to this one
BYTE XmaData[XMA_BYTES_PER_PACKET - sizeof(DWORD)]; // XMA encoded data
} XMA2PACKET;
// E.g. if the first DWORD of a packet is 0x30107902:
//
// 001100 000001000001111 001 00000010
// | | | |____ Skip 2 packets to find the next one for this stream
// | | |___________ XMA2 signature (always 001)
// | |_____________________ First frame starts 527 bits into packet
// |________________________________ Packet contains 12 frames
// Helper functions to extract the fields above from an XMA packet. (Note that
// the bitfields cannot be read directly on little-endian architectures such as
// the Intel x86, as they are laid out in big-endian form.)
__inline DWORD GetXmaPacketFrameCount(__in_bcount(1) const BYTE* pPacket)
{
return (DWORD)(pPacket[0] >> 2);
}
__inline DWORD GetXmaPacketFirstFrameOffsetInBits(__in_bcount(3) const BYTE* pPacket)
{
return ((DWORD)(pPacket[0] & 0x3) << 13) |
((DWORD)(pPacket[1]) << 5) |
((DWORD)(pPacket[2]) >> 3);
}
__inline DWORD GetXmaPacketMetadata(__in_bcount(3) const BYTE* pPacket)
{
return (DWORD)(pPacket[2] & 0x7);
}
__inline DWORD GetXmaPacketSkipCount(__in_bcount(4) const BYTE* pPacket)
{
return (DWORD)(pPacket[3]);
}
/***************************************************************************
* XMA frame structure
***************************************************************************/
// There is no way to represent the XMA frame as a C struct, since it is a
// variable-sized string of bits that need not be stored at a byte-aligned
// position in memory. This is the layout:
//
// XMAFRAME
// {
// LengthInBits: A 15-bit number representing the length of this frame.
// XmaData: Encoded XMA data; its size in bits is (LengthInBits - 15).
// }
// Size in bits of the frame's initial LengthInBits field
#define XMA_BITS_IN_FRAME_LENGTH_FIELD 15
// Special LengthInBits value that marks an invalid final frame
#define XMA_FINAL_FRAME_MARKER 0x7FFF
/***************************************************************************
* XMA helper functions
***************************************************************************/
// We define a local ASSERT macro to equal the global one if it exists.
// You can define XMA2DEFS_ASSERT in advance to override this default.
#ifndef XMA2DEFS_ASSERT
#ifdef ASSERT
#define XMA2DEFS_ASSERT ASSERT
#else
#define XMA2DEFS_ASSERT(a) /* No-op by default */
#endif
#endif
// GetXmaBlockContainingSample: Use a given seek table to find the XMA block
// containing a given decoded sample. Note that the seek table entries in an
// XMA file are stored in big-endian form and may need to be converted prior
// to calling this function.
__inline HRESULT GetXmaBlockContainingSample
(
DWORD nBlockCount, // Blocks in the file (= seek table entries)
__in_ecount(nBlockCount) const DWORD* pSeekTable, // Pointer to the seek table data
DWORD nDesiredSample, // Decoded sample to locate
__out DWORD* pnBlockContainingSample, // Index of the block containing the sample
__out DWORD* pnSampleOffsetWithinBlock // Position of the sample in this block
)
{
DWORD nPreviousTotalSamples = 0;
DWORD nBlock;
DWORD nTotalSamplesSoFar;
XMA2DEFS_ASSERT(pSeekTable);
XMA2DEFS_ASSERT(pnBlockContainingSample);
XMA2DEFS_ASSERT(pnSampleOffsetWithinBlock);
for (nBlock = 0; nBlock < nBlockCount; ++nBlock)
{
nTotalSamplesSoFar = pSeekTable[nBlock];
if (nTotalSamplesSoFar > nDesiredSample)
{
*pnBlockContainingSample = nBlock;
*pnSampleOffsetWithinBlock = nDesiredSample - nPreviousTotalSamples;
return S_OK;
}
nPreviousTotalSamples = nTotalSamplesSoFar;
}
return E_FAIL;
}
// GetXmaFrameLengthInBits: Reads a given frame's LengthInBits field.
__inline DWORD GetXmaFrameLengthInBits
(
__in_bcount(nBitPosition / 8 + 3)
__in const BYTE* pPacket, // Pointer to XMA packet[s] containing the frame
DWORD nBitPosition // Bit offset of the frame within this packet
)
{
DWORD nRegion;
DWORD nBytePosition = nBitPosition / 8;
DWORD nBitOffset = nBitPosition % 8;
if (nBitOffset < 2) // Only need to read 2 bytes (and might not be safe to read more)
{
nRegion = (DWORD)(pPacket[nBytePosition+0]) << 8 |
(DWORD)(pPacket[nBytePosition+1]);
return (nRegion >> (1 - nBitOffset)) & 0x7FFF; // Last 15 bits
}
else // Need to read 3 bytes
{
nRegion = (DWORD)(pPacket[nBytePosition+0]) << 16 |
(DWORD)(pPacket[nBytePosition+1]) << 8 |
(DWORD)(pPacket[nBytePosition+2]);
return (nRegion >> (9 - nBitOffset)) & 0x7FFF; // Last 15 bits
}
}
// GetXmaFrameBitPosition: Calculates the bit offset of a given frame within
// an XMA block or set of blocks. Returns 0 on failure.
__inline DWORD GetXmaFrameBitPosition
(
__in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s]
DWORD nXmaDataBytes, // Size of pXmaData in bytes
DWORD nStreamIndex, // Stream within which to seek
DWORD nDesiredFrame // Frame sought
)
{
const BYTE* pCurrentPacket;
DWORD nPacketsExamined = 0;
DWORD nFrameCountSoFar = 0;
DWORD nFramesToSkip;
DWORD nFrameBitOffset;
XMA2DEFS_ASSERT(pXmaData);
XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0);
// Get the first XMA packet belonging to the desired stream, relying on the
// fact that the first packets for each stream are in consecutive order at
// the beginning of an XMA block.
pCurrentPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET;
for (;;)
{
// If we have exceeded the size of the XMA data, return failure
if (pCurrentPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes)
{
return 0;
}
// If the current packet contains the frame we are looking for...
if (nFrameCountSoFar + GetXmaPacketFrameCount(pCurrentPacket) > nDesiredFrame)
{
// See how many frames in this packet we need to skip to get to it
XMA2DEFS_ASSERT(nDesiredFrame >= nFrameCountSoFar);
nFramesToSkip = nDesiredFrame - nFrameCountSoFar;
// Get the bit offset of the first frame in this packet
nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pCurrentPacket);
// Advance nFrameBitOffset to the frame of interest
while (nFramesToSkip--)
{
nFrameBitOffset += GetXmaFrameLengthInBits(pCurrentPacket, nFrameBitOffset);
}
// The bit offset to return is the number of bits from pXmaData to
// pCurrentPacket plus the bit offset of the frame of interest
return (DWORD)(pCurrentPacket - pXmaData) * 8 + nFrameBitOffset;
}
// If we haven't found the right packet yet, advance our counters
++nPacketsExamined;
nFrameCountSoFar += GetXmaPacketFrameCount(pCurrentPacket);
// And skip to the next packet belonging to the same stream
pCurrentPacket += XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pCurrentPacket) + 1);
}
}
// GetLastXmaFrameBitPosition: Calculates the bit offset of the last complete
// frame in an XMA block or set of blocks.
__inline DWORD GetLastXmaFrameBitPosition
(
__in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s]
DWORD nXmaDataBytes, // Size of pXmaData in bytes
DWORD nStreamIndex // Stream within which to seek
)
{
const BYTE* pLastPacket;
DWORD nBytesToNextPacket;
DWORD nFrameBitOffset;
DWORD nFramesInLastPacket;
XMA2DEFS_ASSERT(pXmaData);
XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0);
XMA2DEFS_ASSERT(nXmaDataBytes >= XMA_BYTES_PER_PACKET * (nStreamIndex + 1));
// Get the first XMA packet belonging to the desired stream, relying on the
// fact that the first packets for each stream are in consecutive order at
// the beginning of an XMA block.
pLastPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET;
// Search for the last packet belonging to the desired stream
for (;;)
{
nBytesToNextPacket = XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pLastPacket) + 1);
XMA2DEFS_ASSERT(nBytesToNextPacket);
if (pLastPacket + nBytesToNextPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes)
{
break; // The next packet would extend beyond the end of pXmaData
}
pLastPacket += nBytesToNextPacket;
}
// The last packet can sometimes have no seekable frames, in which case we
// have to use the previous one
if (GetXmaPacketFrameCount(pLastPacket) == 0)
{
pLastPacket -= nBytesToNextPacket;
}
// Found the last packet. Get the bit offset of its first frame.
nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pLastPacket);
// Traverse frames until we reach the last one
nFramesInLastPacket = GetXmaPacketFrameCount(pLastPacket);
while (--nFramesInLastPacket)
{
nFrameBitOffset += GetXmaFrameLengthInBits(pLastPacket, nFrameBitOffset);
}
// The bit offset to return is the number of bits from pXmaData to
// pLastPacket plus the offset of the last frame in this packet.
return (DWORD)(pLastPacket - pXmaData) * 8 + nFrameBitOffset;
}
// GetXmaDecodePositionForSample: Obtains the information needed to make the
// decoder generate audio starting at a given sample position relative to the
// beginning of the given XMA block: the bit offset of the appropriate frame,
// and the right subframe within that frame. This data can be passed directly
// to the XMAPlaybackSetDecodePosition function.
__inline HRESULT GetXmaDecodePositionForSample
(
__in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s]
DWORD nXmaDataBytes, // Size of pXmaData in bytes
DWORD nStreamIndex, // Stream within which to seek
DWORD nDesiredSample, // Sample sought
__out DWORD* pnBitOffset, // Returns the bit offset within pXmaData of
// the frame containing the sample sought
__out DWORD* pnSubFrame // Returns the subframe containing the sample
)
{
DWORD nDesiredFrame = nDesiredSample / XMA_SAMPLES_PER_FRAME;
DWORD nSubFrame = (nDesiredSample % XMA_SAMPLES_PER_FRAME) / XMA_SAMPLES_PER_SUBFRAME;
DWORD nBitOffset = GetXmaFrameBitPosition(pXmaData, nXmaDataBytes, nStreamIndex, nDesiredFrame);
XMA2DEFS_ASSERT(pnBitOffset);
XMA2DEFS_ASSERT(pnSubFrame);
if (nBitOffset)
{
*pnBitOffset = nBitOffset;
*pnSubFrame = nSubFrame;
return S_OK;
}
else
{
return E_FAIL;
}
}
// GetXmaSampleRate: Obtains the legal XMA sample rate (24, 32, 44.1 or 48Khz)
// corresponding to a generic sample rate.
__inline DWORD GetXmaSampleRate(DWORD dwGeneralRate)
{
DWORD dwXmaRate = 48000; // Default XMA rate for all rates above 44100Hz
if (dwGeneralRate <= 24000) dwXmaRate = 24000;
else if (dwGeneralRate <= 32000) dwXmaRate = 32000;
else if (dwGeneralRate <= 44100) dwXmaRate = 44100;
return dwXmaRate;
}
// Functions to convert between WAVEFORMATEXTENSIBLE channel masks (combinations
// of the SPEAKER_xxx flags defined in audiodefs.h) and XMA channel masks (which
// are limited to eight possible speaker positions: left, right, center, low
// frequency, side left, side right, back left and back right).
__inline DWORD GetStandardChannelMaskFromXmaMask(BYTE bXmaMask)
{
DWORD dwStandardMask = 0;
if (bXmaMask & XMA_SPEAKER_LEFT) dwStandardMask |= SPEAKER_FRONT_LEFT;
if (bXmaMask & XMA_SPEAKER_RIGHT) dwStandardMask |= SPEAKER_FRONT_RIGHT;
if (bXmaMask & XMA_SPEAKER_CENTER) dwStandardMask |= SPEAKER_FRONT_CENTER;
if (bXmaMask & XMA_SPEAKER_LFE) dwStandardMask |= SPEAKER_LOW_FREQUENCY;
if (bXmaMask & XMA_SPEAKER_LEFT_SURROUND) dwStandardMask |= SPEAKER_SIDE_LEFT;
if (bXmaMask & XMA_SPEAKER_RIGHT_SURROUND) dwStandardMask |= SPEAKER_SIDE_RIGHT;
if (bXmaMask & XMA_SPEAKER_LEFT_BACK) dwStandardMask |= SPEAKER_BACK_LEFT;
if (bXmaMask & XMA_SPEAKER_RIGHT_BACK) dwStandardMask |= SPEAKER_BACK_RIGHT;
return dwStandardMask;
}
__inline BYTE GetXmaChannelMaskFromStandardMask(DWORD dwStandardMask)
{
BYTE bXmaMask = 0;
if (dwStandardMask & SPEAKER_FRONT_LEFT) bXmaMask |= XMA_SPEAKER_LEFT;
if (dwStandardMask & SPEAKER_FRONT_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT;
if (dwStandardMask & SPEAKER_FRONT_CENTER) bXmaMask |= XMA_SPEAKER_CENTER;
if (dwStandardMask & SPEAKER_LOW_FREQUENCY) bXmaMask |= XMA_SPEAKER_LFE;
if (dwStandardMask & SPEAKER_SIDE_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_SURROUND;
if (dwStandardMask & SPEAKER_SIDE_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_SURROUND;
if (dwStandardMask & SPEAKER_BACK_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_BACK;
if (dwStandardMask & SPEAKER_BACK_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_BACK;
return bXmaMask;
}
// LocalizeXma2Format: Modifies a XMA2WAVEFORMATEX structure in place to comply
// with the current platform's byte-ordering rules (little- or big-endian).
__inline HRESULT LocalizeXma2Format(__inout XMA2WAVEFORMATEX* pXma2Format)
{
#define XMASWAP2BYTES(n) ((WORD)(((n) >> 8) | (((n) & 0xff) << 8)))
#define XMASWAP4BYTES(n) ((DWORD)((n) >> 24 | (n) << 24 | ((n) & 0xff00) << 8 | ((n) & 0xff0000) >> 8))
if (pXma2Format->wfx.wFormatTag == WAVE_FORMAT_XMA2)
{
return S_OK;
}
else if (XMASWAP2BYTES(pXma2Format->wfx.wFormatTag) == WAVE_FORMAT_XMA2)
{
pXma2Format->wfx.wFormatTag = XMASWAP2BYTES(pXma2Format->wfx.wFormatTag);
pXma2Format->wfx.nChannels = XMASWAP2BYTES(pXma2Format->wfx.nChannels);
pXma2Format->wfx.nSamplesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nSamplesPerSec);
pXma2Format->wfx.nAvgBytesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nAvgBytesPerSec);
pXma2Format->wfx.nBlockAlign = XMASWAP2BYTES(pXma2Format->wfx.nBlockAlign);
pXma2Format->wfx.wBitsPerSample = XMASWAP2BYTES(pXma2Format->wfx.wBitsPerSample);
pXma2Format->wfx.cbSize = XMASWAP2BYTES(pXma2Format->wfx.cbSize);
pXma2Format->NumStreams = XMASWAP2BYTES(pXma2Format->NumStreams);
pXma2Format->ChannelMask = XMASWAP4BYTES(pXma2Format->ChannelMask);
pXma2Format->SamplesEncoded = XMASWAP4BYTES(pXma2Format->SamplesEncoded);
pXma2Format->BytesPerBlock = XMASWAP4BYTES(pXma2Format->BytesPerBlock);
pXma2Format->PlayBegin = XMASWAP4BYTES(pXma2Format->PlayBegin);
pXma2Format->PlayLength = XMASWAP4BYTES(pXma2Format->PlayLength);
pXma2Format->LoopBegin = XMASWAP4BYTES(pXma2Format->LoopBegin);
pXma2Format->LoopLength = XMASWAP4BYTES(pXma2Format->LoopLength);
pXma2Format->BlockCount = XMASWAP2BYTES(pXma2Format->BlockCount);
return S_OK;
}
else
{
return E_FAIL; // Not a recognizable XMA2 format
}
#undef XMASWAP2BYTES
#undef XMASWAP4BYTES
}
#endif // #ifndef __XMA2DEFS_INCLUDED__

View File

@ -0,0 +1,252 @@
/**************************************************************************
*
* Copyright (C) Microsoft Corporation. All rights reserved.
*
* Module Name:
*
* XMAEncoder.h
*
* Abstract:
*
* XMA encoder public interfaces, functions and data types
*
**************************************************************************/
#ifndef _XMAENCODER_H_
#define _XMAENCODER_H_
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif // #if defined (_MSC_VER) && (_MSC_VER >= 1020)
//------------------------------------------------------------------------------
// The XMA1 and old-style XMA2 formats are no longer supported
//------------------------------------------------------------------------------
#ifndef XMA_ENABLE_OLD_FORMATS
#pragma deprecated(XMAInMemoryEncoder, XMA2InMemoryEncoder)
#endif // XMA_ENABLE_OLD_FORMATS
//------------------------------------------------------------------------------
// Headers
//------------------------------------------------------------------------------
#include <basetyps.h> // For COM interface macros
#include <unknwn.h> // For IUnknown
#include <audiodefs.h> // For WAVEFORMATEXTENSIBLE
#include <winerror.h> // For standard error codes
#include "XMA2Defs.h" // For the new XMA2WAVEFORMATEX structure
//------------------------------------------------------------------------------
// Flags
//------------------------------------------------------------------------------
#define XMAENCODER_LOOP 0x00000001
#define XMAENCODER_NOFILTER 0x00000002
#define XMAENCODER_DECODEFROMXMA 0x00000004 // Not supported for in-memory encoder
#define XMAENCODER_VERBOSE 0x00000008 // Enable debug output
#define XMAENCODER_PACKSTREAMS 0x00000010 // Pack channels into fewest streams possible
#define XMAENCODER_MASK 0x0000001F
//------------------------------------------------------------------------------
// Speaker assignments
//------------------------------------------------------------------------------
#define XMA_SPEAKER_LEFT 0x01
#define XMA_SPEAKER_RIGHT 0x02
#define XMA_SPEAKER_CENTER 0x04
#define XMA_SPEAKER_LFE 0x08
#define XMA_SPEAKER_LEFT_SURROUND 0x10
#define XMA_SPEAKER_RIGHT_SURROUND 0x20
#define XMA_SPEAKER_LEFT_BACK 0x40
#define XMA_SPEAKER_RIGHT_BACK 0x80
//------------------------------------------------------------------------------
// Other defines
//------------------------------------------------------------------------------
#define XMA_MAXINPUTCHANNELCOUNT 2
#define XMA_MAXLOOPCOUNT 255
#define XMA_INFINITELOOPCOUNT XMA_MAXLOOPCOUNT
#define XMA_LOOP_ALIGN_SAMPLES 0x00000080
#ifndef WAVE_FORMAT_XMA
#define WAVE_FORMAT_XMA 0x0165
typedef struct XMASTREAMFORMAT
{
DWORD PsuedoBytesPerSec; // Used by encoder
DWORD SampleRate; // Sample rate for the stream.
DWORD LoopStart; // Loop start offset (in bits).
DWORD LoopEnd; // Loop end offset (in bits).
// Format for SubframeData: eeee ssss.
// e: Subframe number of loop end point [0,3].
// s: Number of subframes to skip before decoding and outputting at the loop start point [1,4].
BYTE SubframeData; // Data for decoding subframes. See above.
BYTE Channels; // Number of channels in the stream (1 or 2).
WORD ChannelMask; // Channel assignments for the channels in the stream (same as
// lower 16 bits of dwChannelMask in WAVEFORMATEXTENSIBLE).
} XMASTREAMFORMAT, *PXMASTREAMFORMAT, *NPXMASTREAMFORMAT, *LPXMASTREAMFORMAT;
typedef const XMASTREAMFORMAT *LPCXMASTREAMFORMAT;
typedef struct XMAWAVEFORMAT
{
WORD FormatTag; // Audio format type (always WAVE_FORMAT_XMA).
WORD BitsPerSample; // Bit depth (currently required to be 16).
WORD EncodeOptions; // Options for XMA encoder/decoder.
WORD LargestSkip; // Largest skip used in interleaving streams.
WORD NumStreams; // Number of interleaved audio streams.
BYTE LoopCount; // Number of loop repetitions (255 == infinite).
BYTE Version; // Version of the encoder that generated this.
XMASTREAMFORMAT XmaStreams[1]; // Format info for each stream (can grow based on wNumStreams).
} XMAWAVEFORMAT, *PXMAWAVEFORMAT, *NPXMAWAVEFORMAT, *LPXMAWAVEFORMAT;
typedef XMAWAVEFORMAT *LPCXMAWAVEFORMAT;
// Additional information for file versions 3 and above:
typedef struct XMA2STREAMFORMAT
{
BYTE Channels; // Number of channels in the stream (1 or 2)
BYTE RESERVED;
WORD ChannelMask; // Channel assignments for the channels in the stream (same as
// lower 16 bits of dwChannelMask in WAVEFORMATEXTENSIBLE).
// Stored with big-endian byte ordering.
} XMA2STREAMFORMAT, *LPXMA2STREAMFORMAT;
typedef const XMA2STREAMFORMAT * LPCXMA2STREAMFORMAT;
// RIFF chunk ID is "XMA2"
// Data values are stored with big-endian byte ordering
typedef struct XMA2WAVEFORMAT
{
BYTE Version;
BYTE NumStreams;
BYTE RESERVED;
BYTE LoopCount; // Loop count, 255 == infinite
DWORD LoopBegin; // Loop begin point, in samples
DWORD LoopEnd; // Loop end point, in samples
DWORD SampleRate;
DWORD EncodeOptions; // Options for XMA encoder/decoder.
DWORD PsuedoBytesPerSec; // Used by encoder
DWORD BlockSizeInBytes; // Size of the blocks that were encoded.
DWORD SamplesEncoded; // Total number of samples in the XMA file.
DWORD SamplesInSource; // The number of samples in the file used to generate the XMA
DWORD BlockCount; // The number of encoded blocks in the file (also the number of elements in the seek table)
XMA2STREAMFORMAT Streams[1]; // Format info for each stream (can grow based on NumStreams)
} XMA2WAVEFORMAT, *LPXMA2WAVEFORMAT;
typedef const XMA2WAVEFORMAT *LPCXMA2WAVEFORMAT;
#endif // #ifndef WAVE_FORMAT_XMA
//------------------------------------------------------------------------------
// Encoder parameters
//------------------------------------------------------------------------------
typedef struct XMAENCODERSTREAM
{
WAVEFORMATEXTENSIBLE Format;
LPCVOID pBuffer;
DWORD BufferSize;
DWORD LoopStart;
DWORD LoopLength;
BYTE SpeakerAssignment[XMA_MAXINPUTCHANNELCOUNT];
} XMAENCODERSTREAM, *LPXMAENCODERSTREAM;
typedef const XMAENCODERSTREAM* LPCXMAENCODERSTREAM;
//------------------------------------------------------------------------------
// XMA Encoder Functions
//------------------------------------------------------------------------------
// The XMAInMemoryEncoder() and XMA2InMemoryEncoder() functions are no longer
// supported and should not be used in new code. Their declarations are only
// available if XMA_ENABLE_OLD_FORMATS is defined prior to including this header.
#ifdef XMA_ENABLE_OLD_FORMATS
// This function encodes to the original, unsupported XMA1 format
STDAPI XMAInMemoryEncoder
(
DWORD InputStreamCount,
__in_ecount(InputStreamCount) const XMAENCODERSTREAM* pStreams,
DWORD Compression,
DWORD Flags,
__deref_out_bcount(*pEncodedBufferSize) VOID** ppEncodedBuffer,
__out DWORD* pEncodedBufferSize,
__deref_out_bcount(*pEncodedBufferFormatSize) XMAWAVEFORMAT** ppEncodedBufferFormat,
__out DWORD* pEncodedBufferFormatSize,
__deref_out_bcount(*pSeekTableSize) DWORD** ppSeekTable,
__out DWORD* pSeekTableSize
);
// This function encodes to the old, unsupported version of the XMA2 format
STDAPI XMA2InMemoryEncoder
(
DWORD InputStreamCount,
__in_ecount(InputStreamCount) const XMAENCODERSTREAM* pStreams,
DWORD Compression,
DWORD Flags,
DWORD BlockSizeInKbytes, // Cannot be zero
__deref_out_bcount(*pEncodedBufferSize) VOID** ppEncodedBuffer,
__out DWORD* pEncodedBufferSize,
__deref_out_bcount(*pEncodedBufferFormatSize) XMA2WAVEFORMAT** ppEncodedBufferFormat,
__out DWORD* pEncodedBufferFormatSize,
__deref_out_bcount(*pSeekTableSize) DWORD** ppSeekTable,
__out DWORD* pSeekTableSize
);
#endif // #ifdef XMA_ENABLE_OLD_FORMATS
// This function encodes to the new, approved version of the XMA2 format,
// which is the only format usable in XAudio2.
STDAPI XAudio2XMAEncoder
(
DWORD InputStreamCount,
__in_ecount(InputStreamCount) const XMAENCODERSTREAM* pStreams,
DWORD Compression,
DWORD Flags,
DWORD BlockSizeInKbytes, // Cannot be zero
__deref_out_bcount(*pEncodedBufferSize) VOID** ppEncodedBuffer,
__out DWORD* pEncodedBufferSize,
__deref_out_bcount(*pEncodedBufferFormatSize) XMA2WAVEFORMATEX** ppEncodedBufferFormat,
__out DWORD* pEncodedBufferFormatSize,
__deref_out_bcount(*pSeekTableSize) DWORD** ppSeekTable,
__out DWORD* pSeekTableSize
);
//------------------------------------------------------------------------------
// Encoder error codes
//------------------------------------------------------------------------------
#define FACILITY_XMACodec 0x889
#define XMAENCODERERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XMACodec, n)
#define XMAENCODER_E_OUTOFMEMORY E_OUTOFMEMORY // Out of memory
#define XMAENCODER_E_INVALIDARG E_INVALIDARG // Invalid arg
#define XMAENCODER_E_NOTIMPL E_NOTIMPL // Not implemented
#define XMAENCODER_E_FAIL E_FAIL // Unknown error
#define XMAENCODER_E_INVALIDLOOP XMAENCODERERROR(0x001) // The loop points are invalid.
#define XMAENCODER_E_UNSUPPORTEDFORMAT XMAENCODERERROR(0x002) // Format is invalid.
#define XMAENCODER_E_OUTOFRANGE XMAENCODERERROR(0x003) // Parameter is out of valid range.
#define XMAENCODER_E_READFAILED XMAENCODERERROR(0x004) // Read operation failed.
#define XMAENCODER_E_INVALIDFRAME XMAENCODERERROR(0x005) // Invalid XMA frame.
#define XMAENCODER_E_INCOMPLETEFRAME XMAENCODERERROR(0x006) // Incomplete XMA frame.
#define XMAENCODER_E_ZEROSTUFFINGBIT XMAENCODERERROR(0x007) // Stuffing bit is zero
#define XMAENCODER_E_GETDATAFAILED XMAENCODERERROR(0x008) // Data fetch failed.
#endif // #ifndef _XMAENCODER_H_

952
third_party/xbox_sdk/include/xmcore.h vendored Normal file
View File

@ -0,0 +1,952 @@
/************************************************************************
* *
* XMCore.h -- This module defines the Xbox multicore APIs *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
************************************************************************/
#pragma once
#include <sal.h>
#ifdef __cplusplus
extern "C"
{
#endif
///////////////////////////////
// LOCK FREE DECLARATIONS //
///////////////////////////////
typedef DWORD_PTR XLOCKFREE_HANDLE;
typedef DWORD_PTR XLOCKFREE_LOG;
/////////////////////////////////////////////////////////////////////////////
// Wait function prototype called when a lock-free data structure needs //
// to block before it can add an element or must wait to remove an //
// element. Routine must return WAIT_OBJECT_0 if event is signaled. //
/////////////////////////////////////////////////////////////////////////////
typedef DWORD (CALLBACK *XLockFreeWait)(__in_opt PVOID context, // Developer supplied context for the wait.
__in HANDLE event, // Event the xmcore library wants to wait on.
__in DWORD dwMilliSeconds, // Expected wait time.
__in BOOL fAlertable); // Should the wait allow APC's
///////////////////////////////////////////////////////////////////////////////
// Function prototypes if allocators are to be replace. Memory call backs //
// are specific to one data structure. If all allocations need to be //
// replaced then XMemAlloc can be overridden. //
///////////////////////////////////////////////////////////////////////////////
typedef PVOID (CALLBACK *XLockFreeMemoryAllocate)(__in_opt PVOID context, __in DWORD dwSize);
typedef void (CALLBACK *XLockFreeMemoryFree)(__in_opt PVOID context, __in PVOID pAddress);
////////////////////////////////////////////////////////////////////////////////////////////////
// Function prototype for dump callbacks. Context is user specified in the //
// dump call, entry is the data stored in the structure and node is the system data. //
// Dump functions are NOT thread safe and should only be used when threads are NOT //
// accessing the data structures. //
////////////////////////////////////////////////////////////////////////////////////////////////
typedef HRESULT (CALLBACK *XLockFreeUnsafeDump)(__in_opt PVOID context, __in PVOID entry, __in PVOID node);
//////////////////////////////////////////////////////////////////////////////
// Default Allocation routines used by the lock free library. Allocation //
// is done through XMemAlloc using allocator ID //
// eXALLOCAllocatorID_XMCORE. //
//////////////////////////////////////////////////////////////////////////////
PVOID APIENTRY XLFAllocate(__in DWORD_PTR dwSize);
void APIENTRY XLFFree(__in_opt PVOID pAddress);
/////////////////////////////
// Lock free attributes //
/////////////////////////////
#define XLOCKFREE_NO_ATTRIBUTES 0x000
#define XLOCKFREE_ATTRIBUTE_FLAG 0x001 // Reservered for internal use
#define XLOCKFREE_RESERVED_FLAG 0x002
#define XLOCKFREE_ADD_WAIT 0x004 // Wait until there is room in the queue/stack to add an element.
#define XLOCKFREE_REMOVE_WAIT 0x008 // Wait until there is an entry to remove from the queue/stack.
#define XLOCKFREE_SPIN_ON_ADD 0x010 // If we need to wait do we spin first before adding an entry
#define XLOCKFREE_SPIN_ON_REMOVE 0x020 // If we need to wait do we spin first before removing an entry
#define XLOCKFREE_ALERTABLE_ADD 0x040 // If we wait while adding an entry, is the wait altertable
#define XLOCKFREE_ALERTABLE_REMOVE 0x080 // If we wait while removing an entry, is the wait altertable
#define XLOCKFREE_SINGLE_KEY_ENTRY 0x100 // Allow a single key value (PRIORITY QUEUE and HASH TABLE only)
/////////////////////////////////////////////////////////////////////////////
// The XLOCKFREE_CREATE structure is used to initialize the data //
// structures. All entries in the structure are optional. The structure //
// can be used to create data structures that have customized wait //
// characteristics and memory allocations. //
/////////////////////////////////////////////////////////////////////////////
typedef struct _XLOCKFREE_CREATE
{
DWORD attributes; // See attributes defined above (OPTIONAL)
PVOID addWaitContext; // User data passed when in when an add would wait (OPTIONAL)
PVOID removeWaitContext; // User data passed when in when a remove would wait (OPTIONAL)
DWORD addWaitTime; // Amount of time to wait before a timeout happens when adding an element (OPTIONAL)
DWORD removeWaitTime; // Amount of time to wait before a timeout happens when deleting an element (OPTIONAL)
XLockFreeWait addWait; // Custom wait function used if an element cannot be added to the data structure (OPTIONAL)
XLockFreeWait removeWait; // Custom wait function used if there is no element to removed from the data structure (OPTIONAL)
// All information after here is used only during creation
DWORD structureSize; // Must be set to sizeof(XLOCKFREE_CREATE)!.
DWORD allocationLength; // Number of elements to allocate when the data structure needs to allocate more nodes (OPTIONAL)
DWORD maximumLength; // Total number of entries allowed in the data structure. -1 or 0 means unlimited (OPTIONAL)
XLockFreeMemoryAllocate allocate; // Custom Allocator (OPTIONAL)
XLockFreeMemoryFree free; // Matching release for custom Allocator (OPTIONAL)
PVOID memoryContext; // Memory context if required.
} XLOCKFREE_CREATE, *PXLOCKFREE_CREATE;
////////////////////////////////////////////////////////////////////////////
// The 'C' API for the queue data structure provides the ability to //
// create, destroy, add elements and remove elements from a FIFO //
// queue. The queue is an opaque handle that must be passed into every //
// function. //
////////////////////////////////////////////////////////////////////////////
HRESULT WINAPI XLFQueueAdd(__in XLOCKFREE_HANDLE queue, __in void* data);
HRESULT WINAPI XLFQueueAllocated(__in XLOCKFREE_HANDLE queue, __out DWORD* size);
HRESULT WINAPI XLFQueueCreate(__in_opt PXLOCKFREE_CREATE info, __out XLOCKFREE_HANDLE* queue);
void WINAPI XLFQueueDestroy(__in XLOCKFREE_HANDLE queue);
HRESULT WINAPI XLFQueueGetEntryCount(__in XLOCKFREE_HANDLE queue, __out LONG* entries);
BOOL WINAPI XLFQueueIsEmpty(__in XLOCKFREE_HANDLE queue);
HRESULT WINAPI XLFQueueRemove(__in XLOCKFREE_HANDLE queue, __deref_out void** data);
HRESULT WINAPI XLFQueueUnsafeDump(__in XLOCKFREE_HANDLE queue, __in_opt PVOID context, __in XLockFreeUnsafeDump callback);
//////////////////////////////////////////////////
// The 'C' API for the stack data structure. //
//////////////////////////////////////////////////
HRESULT WINAPI XLFStackAllocated(__in XLOCKFREE_HANDLE stack, __out DWORD* size);
HRESULT WINAPI XLFStackCreate(__in_opt PXLOCKFREE_CREATE info, __out XLOCKFREE_HANDLE* stack);
void WINAPI XLFStackDestroy(__in XLOCKFREE_HANDLE stack);
HRESULT WINAPI XLFStackGetEntryCount(__in XLOCKFREE_HANDLE stack, __out LONG* entries);
BOOL WINAPI XLFStackIsEmpty(__in XLOCKFREE_HANDLE stack);
HRESULT WINAPI XLFStackPop(__in XLOCKFREE_HANDLE stack, __deref_out void** data);
HRESULT WINAPI XLFStackPush(__in XLOCKFREE_HANDLE stack, __in void* data);
HRESULT WINAPI XLFStackUnsafeDump(__in XLOCKFREE_HANDLE stack, __in_opt PVOID context, __in XLockFreeUnsafeDump callback);
///////////////////////////////////////////////////////////////////////////////
// Compare functions to compare and hash keys used in Priority Queues and //
// Hash Tables. Call back functions can be used in the Priority Queue and //
// Hash Table to customize how entries are added and removed from the //
// data structures. //
///////////////////////////////////////////////////////////////////////////////
typedef int (CALLBACK *XLockFreeCompareKeys)(int key1, int key2);
typedef unsigned int (CALLBACK *XLockFreeHashKey)(DWORD key, DWORD size);
typedef struct _XLOCKFREE_FUNCTIONS
{
XLockFreeCompareKeys compare; // Function to compare to keys (OPTIONAL)
XLockFreeHashKey hash; // Function that calculates the bucket [hashtable only] (OPTIONAL)
DWORD structureSize; // Must be set to the sizeof(XLOCKFREE_FUNCTIONS).
} XLOCKFREE_FUNCTIONS, *PXLOCKFREE_FUNCTIONS;
///////////////////////////////////////////////////////////
// The 'C' API for the priority queue data structure. //
///////////////////////////////////////////////////////////
HRESULT WINAPI XLFPriorityQueueAdd(__in XLOCKFREE_HANDLE queue, __in DWORD key, __in PVOID data);
HRESULT WINAPI XLFPriorityQueueAllocated(__in XLOCKFREE_HANDLE queue, __out DWORD* size);
HRESULT WINAPI XLFPriorityQueueCreate(__in_opt PXLOCKFREE_CREATE info, __in PXLOCKFREE_FUNCTIONS functions, __out XLOCKFREE_HANDLE* queue);
void WINAPI XLFPriorityQueueDestroy(__in XLOCKFREE_HANDLE queue);
HRESULT WINAPI XLFPriorityQueueGetEntryCount(__in XLOCKFREE_HANDLE queue, __out LONG* entries);
BOOL WINAPI XLFPriorityQueueIsEmpty(__in XLOCKFREE_HANDLE queue);
HRESULT WINAPI XLFPriorityQueueRemoveFirst(__in XLOCKFREE_HANDLE queue, __out PVOID* data);
HRESULT WINAPI XLFPriorityQueueRemove(__in XLOCKFREE_HANDLE queue, __in DWORD key, __out PVOID* data);
HRESULT WINAPI XLFPriorityQueueUnsafeDump(__in XLOCKFREE_HANDLE queue, __in_opt PVOID context, __in XLockFreeUnsafeDump callback);
///////////////////////////////////////////////////////
// The 'C' API for the hash table data structure. //
///////////////////////////////////////////////////////
HRESULT WINAPI XLFHashTableAdd(__in XLOCKFREE_HANDLE hashTable, __in DWORD key, __in PVOID data);
HRESULT WINAPI XLFHashTableAllocated(__in XLOCKFREE_HANDLE hashTable, __out DWORD* size);
HRESULT WINAPI XLFHashTableCreate(__in_opt PXLOCKFREE_CREATE info, __in PXLOCKFREE_FUNCTIONS functions, __in DWORD buckets, __out XLOCKFREE_HANDLE* hashTable);
void WINAPI XLFHashTableDestroy(__in XLOCKFREE_HANDLE hashTable);
HRESULT WINAPI XLFHashTableGetEntryCount(__in XLOCKFREE_HANDLE hashTable, __out LONG* entries);
BOOL WINAPI XLFHashTableIsEmpty(__in XLOCKFREE_HANDLE hashTable);
HRESULT WINAPI XLFHashTableRemoveFirst(__in XLOCKFREE_HANDLE hashTable, __out PVOID* data);
HRESULT WINAPI XLFHashTableRemove(__in XLOCKFREE_HANDLE hashTable, __in DWORD key, __out PVOID* data);
HRESULT WINAPI XLFHashTableUnsafeDump(__in XLOCKFREE_HANDLE hashTable, __in_opt PVOID context, __in XLockFreeUnsafeDump callback);
//////////////////
// LOCK POOL //
//////////////////
#define XLOCKFREE_POOL_ALLOW_RECURSION 0x1 // Allow recursive calls to locks (see warnings below)
#define XLOCKFREE_POOL_WATCH_THREAD 0x2 // Fail if another thread tries to destroy a lock
#define XLOCKFREE_POOL_ACQUIRE_WAIT 0x4 // Wait until the lock can be acquired
#define XLOCKFREE_POOL_SPIN_ON_WAIT 0x10 // If we need to wait do we spin first
#define XLOCKFREE_POOL_ALERTABLE_WAIT 0x20 // If we wait, the wait is altertable
// Recursion warnings:
// 1) A thread that has shared access to a lock will become blocked if it recursively tries to acquire shared
// access to the same lock when another thread is requesting exclusive access. When a thread requests exclusive
// access to a lock it will block all threads trying to acquire shared access. This includes threads that have
// already been granted shared access.
//
// 2) Threads that hold exclusive access will block if they ask for shared access.
//
typedef enum _TWO_WAY_LOCK_ACTIONS
{
XLF_LOCK_SHARED, // acquire shared lock (may require waiting);
XLF_LOCK_EXCLUSIVE, // acquire exclusive lock (may require waiting);
XLF_LOCK_DOWNGRADE, // downgrade exclusive lock to shared (non-blocking request);
XLF_LOCK_UPGRADE_SAFELY, // upgrade shared lock to exclusive in order (may require waiting);
XLF_LOCK_UPGRADE_IGNORE // upgrade shared
} TWO_WAY_LOCK_ACTIONS;
typedef struct _TWO_WAY_LOCK
{
__int64 data[2];
} TWO_WAY_LOCK, *PTWO_WAY_LOCK;
typedef struct _XLOCKFREE_POOL
{
DWORD attributes; // See attributes defined above (OPTIONAL)
DWORD allocationLength; // Number of elements to allocate when the data
// structure needs to allocate more nodes (OPTIONAL)
PVOID waitContext; // User data passed into the wait function associated
// with the data structure (OPTIONAL)
DWORD acquireWaitTime; // Amount of time to wait before a timeout happens when acquiring a lock
XLockFreeWait acquireWait; // Custom wait function used if an element cannot be
// added to the data structure (OPTIONAL)
DWORD structureSize; // Must be set to sizeof(XLOCKFREE_POOL).
} XLOCKFREE_POOL, *PXLOCKFREE_POOL;
HRESULT WINAPI XLFPoolAcquireLock(__in XLOCKFREE_HANDLE pool, __in TWO_WAY_LOCK_ACTIONS action, __in TWO_WAY_LOCK* lock);
HRESULT WINAPI XLFPoolAllocated(__in XLOCKFREE_HANDLE pool, __out DWORD* size);
HRESULT WINAPI XLFPoolCreate(__in_opt XLOCKFREE_POOL* info, __out XLOCKFREE_HANDLE* pool);
HRESULT WINAPI XLFPoolCreateLock(__in XLOCKFREE_HANDLE pool, __out PTWO_WAY_LOCK* lock);
void WINAPI XLFPoolDestroy(__in XLOCKFREE_HANDLE pool);
HRESULT WINAPI XLFPoolDestroyLock(__in XLOCKFREE_HANDLE pool, __in TWO_WAY_LOCK* lock);
HRESULT WINAPI XLFPoolIncreaseEvents(__in XLOCKFREE_HANDLE pool, __in DWORD number);
HRESULT WINAPI XLFPoolIncreaseLocks(__in XLOCKFREE_HANDLE pool, __in DWORD number);
HRESULT WINAPI XLFPoolInitializeLock(__in XLOCKFREE_HANDLE pool, __in TWO_WAY_LOCK* lock);
HRESULT WINAPI XLFPoolNumberOfEvents(__in XLOCKFREE_HANDLE pool, __out DWORD* number);
HRESULT WINAPI XLFPoolNumberOfLocks(__in XLOCKFREE_HANDLE pool, __out DWORD* number);
HRESULT WINAPI XLFPoolReleaseLock(__in XLOCKFREE_HANDLE pool, __in TWO_WAY_LOCK_ACTIONS action, __in TWO_WAY_LOCK* lock);
////////////////////
// Error codes //
////////////////////
#define FACILITY_XLOCKFREE 0x31
#define XLOCKFREE_STRUCTURE_FULL ((HRESULT)0x80310001L)
#define XLOCKFREE_STRUCTURE_EMPTY ((HRESULT)0x80310002L)
#define XLOCKFREE_INVALID_ACTION ((HRESULT)0x80310003L) // When releasing a lock the action must be XLF_LOCK_SHARED or XLF_LOCK_EXCLUSIVE
#define XLOCKFREE_INVALID_UNLOCK ((HRESULT)0x80310004L)
#define XLOCKFREE_PENDING_UPGRADE ((HRESULT)0x80310005L)
#define XLOCKFREE_PENDING_EXCLUSIVE_LOCK ((HRESULT)0x80310006L)
#define XLOCKFREE_PENDING_RECURSIVE_LOCK ((HRESULT)0x80310007L)
////////////////////////////////
// The 'C' API for the log //
////////////////////////////////
typedef HRESULT (CALLBACK *XLFLogMessage)(__in_opt PVOID messageContext, __in_bcount(length) PBYTE buffer, __in DWORD length);
HRESULT WINAPI XLFStartLog(__in int requestedCore, // Run the logging facility on this core
__in_z LPCSTR logFile, // Log messages to this file
__in int messageLength, // Maximum message length
__in int numberOfMessages, // Maximum number of messages allowed to be queued up
__in BOOL blockOnWrite, // Block if queue is at is maximum
__out XLOCKFREE_LOG* log); // Handle to the log is returned
HRESULT WINAPI XLFStartUserLog(__in int requestedCore, // Run the logging facility on this core
__in_opt PVOID messageContext, // Context passed to the callback
__in XLFLogMessage callback, // Callback processes message
__in int messageLength, // Maximum message length
__in int numberOfMessages, // Maximum number of messages allowed to be queued up
__in BOOL blockOnWrite, // Block if queue is at is maximum
__out XLOCKFREE_LOG* log); // Handle to the log is returned
void WINAPI XLFEndLog(__in XLOCKFREE_LOG log);
void WINAPI XLFLogPrint(__in XLOCKFREE_LOG log, __in_z const char* format, ...);
void WINAPI XLFLogPrintV(__in XLOCKFREE_LOG log, __in_z const char* format, va_list argptr);
void WINAPI XLFLogBuffer(__in XLOCKFREE_LOG log, __in_bcount(length) PBYTE buffer, __in DWORD length);
void WINAPI XLFLogMessageStats(__in XLOCKFREE_LOG log, __in DWORD* droppedMessages, DWORD* missedMessages);
///////////////////////////////////////////////////////////////////////////
// XLockFree library will RIP in debug mode unless a error handler is //
// supplied and it returns S_OK after being passed an error message. //
///////////////////////////////////////////////////////////////////////////
typedef HRESULT (CALLBACK *XLockFreeErrorHandler)(__in_z const char* msg);
XLockFreeErrorHandler APIENTRY XLockFreeGetErrorHandler(void);
XLockFreeErrorHandler APIENTRY XLockFreeSetErrorHandler(__in_opt XLockFreeErrorHandler func);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
///////////////////////////////////////////////////////////////////////////////////////////
// Elements added to the lock free data structures do not need to //
// inherit a link structure. These algorithm allocate external link //
// structures because it is very difficult to know when the link structures //
// can be released or changed. The link structure can be referenced on //
// multiple threads at the same and failure can occur if the link structure is updated //
// outside the data structure. //
// //
// User data cannot be delete when it is added to a list. After the data //
// is removed from a list it can be safely deleted at any time. //
// Only one thread will have a reference to the user data after it is //
// removed from a list. //
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// XLockFreeStack //
// -------------- //
// Creates a stack structure that can accept T objects. The stack stores pointers //
// to T, it does not copy the contents of T. If the object T is deleted while the //
// stack holds a reference results can be unpredictable. //
// //
// Care needs to be taken when creating a stack structure that will be visible to //
// multiple threads. The stack should either be constructed before threads are //
// started, passed as a parameter to the thread procedure, or have global references //
// updated using an interlocked function. //
///////////////////////////////////////////////////////////////////////////////////////////
template <class _T> class XLockFreeStack
{
public:
XLockFreeStack(); // Creates a stack structure.
~XLockFreeStack(); // Releases all the stack resources.
///////////////////////////////////////////////////////////////////////////
// Manually release all the stack resources. //
///////////////////////////////////////////////////////////////////////////
void Destroy();
///////////////////////////////////////////////////////////////////////////
// Returns the amount of memory allocated for the stack. //
///////////////////////////////////////////////////////////////////////////
DWORD GetAllocated() const;
///////////////////////////////////////////////////////////////////////////
// Returns the number of entries in the stack (is a snapshot in time). //
///////////////////////////////////////////////////////////////////////////
DWORD GetEntryCount() const;
///////////////////////////////////////////////////////////////////////////
// Creates a Stack structure that will allocate nodes as required and //
// will not block on Pushes and Pops. //
///////////////////////////////////////////////////////////////////////////
HRESULT Initialize();
////////////////////////////////////////////////////////////////////////////
// Creates a queue structure where the maximum number of elements, the //
// number of allocations and whether calls will block can be //
// specified. If waiting is specified in the attributes then an //
// optional custom Wait functions can be also added. //
////////////////////////////////////////////////////////////////////////////
HRESULT Initialize(__in_opt PXLOCKFREE_CREATE info);
// Returns TRUE if there are no items in the stack.
BOOL IsEmpty() const;
//////////////////////////////////////////////////////////////////////////////
// Returns the top data type in the stack. Returns NULL if no entry is //
// available. Because the stack can be used in a multithreaded //
// environment it is very possible that a call to IsEmpty() will return //
// FALSE and the Pop() will return NULL. By the time the Pop() has //
// executed another thread may have taken all the available entries. The //
// program must always test for a NULL. //
//////////////////////////////////////////////////////////////////////////////
_T* Pop();
///////////////////////////////////////////////////////////////////////////
// Returns the top data type in the stack. Returns //
// XLOCKFREE_STRUCTURE_EMPTY if no entry is available. If there is a //
// wait function added to the stack the error code from that function //
// would be returned in the case of a failure. //
///////////////////////////////////////////////////////////////////////////
HRESULT Pop(__deref_out _T** ref);
/////////////////////////////////////////////////////////////////////////////
// Adds a data type to the stack. Returns XLOCKFREE_STRUCTURE_FULL if //
// the stack was full. If there is a wait function added to the stack //
// the error code from that function would be returned in the case of a //
// failure. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Push(__in _T* entry);
PVOID operator new( __in size_t size);
void operator delete(__in_opt PVOID p);
PVOID operator new[]( __in size_t size);
void operator delete[](__in_opt PVOID p);
/////////////////////////////////////////////////////////////////////////////////
// Dump the stack. Context is user defined and passed into the dump function //
// along with every entry in the stack. This routine is NOT thread safe. //
/////////////////////////////////////////////////////////////////////////////////
HRESULT UnsafeDump(__in_opt PVOID context, __in XLockFreeUnsafeDump function);
private:
XLOCKFREE_HANDLE stack;
XLockFreeStack(__in const XLockFreeStack& s) {} // Copy constructor not allowed
};
///////////////////////////////////////////////////////////////////////////////
// XLockFreeQueue //
// -------------- //
// //
// Creates an queue structure that can accept T objects. The queue stores //
// pointers to T, it does not copy the contents of T. If the object T is //
// deleted while the queue holds a reference results can be //
// unpredictable. //
// //
// Creates a queue structure. Care needs to be taken when creating a //
// queue structure that will be visible to multiple threads. The queue //
// should be constructed before threads are started, should be passed as //
// a parameter to the thread procedure, or should have the global //
// reference updated using an interlocked function. //
///////////////////////////////////////////////////////////////////////////////
template <class _T> class XLockFreeQueue
{
public:
XLockFreeQueue();
~XLockFreeQueue();
/////////////////////////////////////////////////////////////////////////////
// Adds an entry to the queue, returns S_OK if element successfully //
// added. Returns XLOCKFREE_STRUCTURE_FULL if a free node was not //
// available to link in the data. If there is a wait function added to //
// the stack the error code from that function would be returned in the //
// case of a failure. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Add(__in _T* entry);
///////////////////////////////////////////////////////////////////////////
// Manually releases all the resources associated with the queue. The //
// queue should not be used after this method has been called. //
///////////////////////////////////////////////////////////////////////////
void Destroy();
//////////////////////////////////////////////////////////////
// Returns the amount of memory allocated for the Queue. //
//////////////////////////////////////////////////////////////
DWORD GetAllocated() const;
///////////////////////////////////////////////////////////////////////////
// Returns the number of entries in the Queue (is a snapshot in time). //
///////////////////////////////////////////////////////////////////////////
DWORD GetEntryCount() const;
///////////////////////////////////////////////////////////////////////////////
// Creates a queue structure that will grow as necessary and will not //
// block on when adding or removing elements. An Initialize() method must //
// be called before the queue can be used. //
///////////////////////////////////////////////////////////////////////////////
HRESULT Initialize();
////////////////////////////////////////////////////////////////////////////
// Creates a queue structure where the maximum number of elements, the //
// number of allocations and whether calls will block can be //
// specified. If waiting is specified in the attributes then an //
// optional custom Wait functions can be also added. //
////////////////////////////////////////////////////////////////////////////
HRESULT Initialize(__in_opt PXLOCKFREE_CREATE info);
//////////////////////////////////////////////////////////////
// Returns TRUE if there currently no items in the queue //
//////////////////////////////////////////////////////////////
BOOL IsEmpty() const;
//////////////////////////////////////////////////////////////////////////////
// Returns the last entry in the queue. Returns NULL if no entry is //
// available. Because the queue can be used in a multithreaded //
// environment it is very possible that a call to IsEmpty() will return //
// FALSE and Remove() will return NULL. By the time the Remove() has //
// executed another thread may have taken all the available entries. The //
// program must always test for a NULL. //
//////////////////////////////////////////////////////////////////////////////
_T* Remove();
///////////////////////////////////////////////////////////////////////////////
// Returns the last entry in the queue. Return XLOCKFREE_STRUCTURE_EMPTY //
// if no entry is available. If there is a wait function added to the //
// queue the error code from that function would be returned in the case //
// of a failure. //
///////////////////////////////////////////////////////////////////////////////
HRESULT Remove(__deref_out _T** ref);
PVOID operator new( __in size_t size );
void operator delete(__in_opt PVOID p);
PVOID operator new[]( __in size_t size );
void operator delete[](__in_opt PVOID p);
/////////////////////////////////////////////////////////////////////////////////
// Dump the queue. Context is user defined and passed into the dump function //
// along with every entry in the queue. This routine is NOT thread safe. //
/////////////////////////////////////////////////////////////////////////////////
HRESULT UnsafeDump(__in PVOID context, __in XLockFreeUnsafeDump function);
private:
XLockFreeQueue(__in const XLockFreeQueue& q) {} // Copy constructor not allowed
XLOCKFREE_HANDLE queue;
};
class XLockFreeCustom
{
public:
static int WINAPI compare(__in int p1, __in int p2);
static unsigned int WINAPI hash(__in unsigned int key, __in unsigned int buckets);
static unsigned int WINAPI bucketSize(__in unsigned int buckets);
};
template <class _T,
class _Functions = XLockFreeCustom>
class XLockFreeFunctions
{
public:
XLockFreeFunctions() {}
XLockFreeFunctions(__in _Functions c) : _func(c) {}
protected:
_Functions _func;
};
/////////////////////////////////////////////////////////////////////////////
// XLockFreePriorityQueue //
// ---------------------- //
// //
// Creates a queue structure that can accept T objects. The default //
// implementation supplies functions for comparing keys and for hashing //
// the key. //
// //
// Creates a priority queue structure. Care needs to be taken when //
// creating a priority queue structure that will be visible to multiple //
// threads. The queue should be constructed before threads are started, //
// should be passed as a parameter to the thread procedure, or should //
// have the global reference updated using an interlocked function. //
/////////////////////////////////////////////////////////////////////////////
template <class _T,
class _XFunctions = XLockFreeFunctions<_T> >
class XLockFreePriorityQueue : _XFunctions
{
public:
XLockFreePriorityQueue();
~XLockFreePriorityQueue();
////////////////////////////////////////////////////////////////////////////////
// Adds and entry to the priority queue. Returns //
// XLOCKFREE_STRUCTURE_FULL if there is no space to add the entry //
// //
// Returns XLOCKFREE_STRUCTURE_FULL if there is no space to add the //
// entry or the key exists in the queue and the queue was initialized //
// with XLOCKFREE_SINGLE_KEY_ENTRY //
// //
// If there is a wait function added to the queue the error code from that //
// function would be returned in the case of a failure //
////////////////////////////////////////////////////////////////////////////////
HRESULT Add(__in DWORD key, __in _T* entry);
///////////////////////////////////////////////////////////////////////////////
// Manually release all the priority queue resources. The priority queue //
// should not be used after this method has been called. //
///////////////////////////////////////////////////////////////////////////////
void Destroy();
///////////////////////////////////////////////////////////////////////
// Returns the amount of memory allocated for the priority queue. //
///////////////////////////////////////////////////////////////////////
DWORD GetAllocated() const;
//////////////////////////////////////////////////////////////////////////////////
// Returns the number of entries in the priority queue (is a snapshot in time). //
//////////////////////////////////////////////////////////////////////////////////
DWORD GetEntryCount() const;
///////////////////////////////////////////////////////////////////////////////
// Creates a priority queue structure that will allocate nodes as //
// required to add new entries and will not block when adding or removing //
// entries. //
///////////////////////////////////////////////////////////////////////////////
HRESULT Initialize();
/////////////////////////////////////////////////////////////////////////////
// Creates a priority queue structure where the maximum number of //
// elements, the number of allocations and whether calls will block can //
// be specified. If waiting is specified in the attributes then an //
// optional custom Wait functions can be also added. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Initialize(__in_opt PXLOCKFREE_CREATE info);
////////////////////////////////////////////////////////////////////////////
// Returns TRUE if there are currently no items in the priority queue //
////////////////////////////////////////////////////////////////////////////
BOOL IsEmpty() const;
/////////////////////////////////////////////////////////////////////////////
// Returns the first entry in the priority queue (the entry with the //
// lowest key). Returns NULL if no entry is available. Because the //
// queue can be used in a multithreaded environment it is very possible //
// that a call to Search() will return TRUE and Remove() will return //
// NULL. By the time the Remove() has executed another thread may have //
// taken entries. The program must always test for a NULL. //
/////////////////////////////////////////////////////////////////////////////
_T* RemoveFirst();
//////////////////////////////////////////////////////////////////////////////
// Returns the first entry in the queue (the entry with the lowest key). //
// Returns XLOCKFREE_STRUCTURE_EMPTY if no entry is available. If there //
// is a wait function added to the queue the error code from that //
// function would be returned in the case of a failure. //
//////////////////////////////////////////////////////////////////////////////
HRESULT RemoveFirst(__deref_out _T** ref);
///////////////////////////////////////////////////////////////////////////////
// Returns the entry in the queue identified by 'key'. Returns NULL if no //
// entry is available. Because the queue can be used in a multithreaded //
// environment it is very possible that a call to Search() will return //
// TRUE and Remove() will return NULL. By the time the Remove() has //
// executed another thread may have taken entries. The program must //
// always test for a NULL. //
///////////////////////////////////////////////////////////////////////////////
_T* Remove(__in DWORD key);
///////////////////////////////////////////////////////////////////////////
// Returns the entry in the queue identified by 'key'. Returns //
// XLOCKFREE_STRUCTURE_EMPTY if no entry is available. If there is a //
// wait function added to the queue the error code from that function //
// would be returned in the case of a failure. //
///////////////////////////////////////////////////////////////////////////
HRESULT Remove(__in DWORD key, __deref_out _T** ref);
PVOID operator new( __in size_t size );
void operator delete(__in_opt PVOID p);
PVOID operator new[]( __in size_t size );
void operator delete[](__in_opt PVOID p);
/////////////////////////////////////////////////////////////////////////////////
// Dump the priority queue. Context is user defined and passed into the //
// dump function along with every entry in the priority queue. This routine is //
// NOT thread safe. //
/////////////////////////////////////////////////////////////////////////////////
HRESULT UnsafeDump(__in PVOID context, __in XLockFreeUnsafeDump function);
private:
XLockFreePriorityQueue(__in const XLockFreePriorityQueue& q) {} // Copy constructor not allowed.
XLOCKFREE_HANDLE queue;
};
/////////////////////////////////////////////////////////////////////////////////
// XLockFreeHashTable //
// ------------------ //
// //
// Creates a hash table that can accept T objects. The default //
// implementation supplies functions for comparing keys and for hashing //
// the key //
// //
// Creates a hash table structure. Care needs to be taken when //
// creating a hash table structure that will be visible to multiple //
// threads. The hash table should be constructed before threads are started //
// should be passed as a parameter to the thread procedure, or should //
// have the global reference updated using an interlocked function //
/////////////////////////////////////////////////////////////////////////////////
template <class _T,
class _XFunctions = XLockFreeFunctions<_T> >
class XLockFreeHashTable : _XFunctions
{
public:
XLockFreeHashTable();
~XLockFreeHashTable();
/////////////////////////////////////////////////////////////////////////////
// Adds an entry to the hash table. The entries are added in the //
// numerical order of the keys. //
// //
// Returns XLOCKFREE_STRUCTURE_FULL if there is no space to add the entry //
// or the entry exists in the table and the table was initialized with //
// XLOCKFREE_SINGLE_KEY_ENTRY. //
// //
// If there is a wait function added to the queue the error code from //
// that function would be returned in the case of a failure //
/////////////////////////////////////////////////////////////////////////////
HRESULT Add(__in DWORD key, __in _T* entry);
/////////////////////////////////////////////////////////////////////////////
// Manually release all the hash table resources. The hash table should //
// not be used after this method is called. //
/////////////////////////////////////////////////////////////////////////////
void Destroy();
/////////////////////////////////////////////////////////////////////////////
// Returns the amount of memory currently allocated for the hash table. //
/////////////////////////////////////////////////////////////////////////////
DWORD GetAllocated() const;
//////////////////////////////////////////////////////////////////////////////
// Returns the number of entries in the hash table (is a snapshot in time). //
//////////////////////////////////////////////////////////////////////////////
DWORD GetEntryCount() const;
/////////////////////////////////////////////////////////////////////////////
// Creates a hash table that will allocate nodes as required to add new //
// entries and will not block when adding or removing entries. //
// //
// There hash table will be created with a fixed number of buckets. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Initialize(__in DWORD buckets);
/////////////////////////////////////////////////////////////////////////////
// Creates a hash table structure where the maximum number of elements, //
// the number of allocations and whether calls will block can be //
// specified. If the maximum number of elements is specified then //
// optional custom Wait functions can be also added. //
// //
// There hash table will be created with a fixed number of buckets. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Initialize(__in_opt PXLOCKFREE_CREATE info, __in DWORD buckets);
/////////////////////////////////////////////////////////////////////////////
// Returns TRUE if there are currently no items in the hash table //
/////////////////////////////////////////////////////////////////////////////
BOOL IsEmpty() const;
/////////////////////////////////////////////////////////////////////////////
// Returns the first entry in the hash table (the entry with the lowest //
// key). //
// //
// Returns NULL if no entry is available. //
/////////////////////////////////////////////////////////////////////////////
_T* RemoveFirst();
////////////////////////////////////////////////////////////////////////////
// Returns the first entry in the hash table queue (the entry with the //
// lowest key). //
// //
// Returns XLOCKFREE_STRUCTURE_EMPTY if no entry is available. //
////////////////////////////////////////////////////////////////////////////
HRESULT RemoveFirst(__deref_out _T** ref);
///////////////////////////////////////////////////////////////////////////////
// Returns the entry in the table identified by 'key'. Returns NULL if no //
// entry is available. Because the table can be used in a multithreaded //
// environment it is very possible that a call to Remove() will return //
// NULL. The program must always test for a NULL. //
///////////////////////////////////////////////////////////////////////////////
_T* Remove(__in DWORD key);
///////////////////////////////////////////////////////////////////////////
// Returns the entry in the queue identified by 'key'. //
// //
// Returns XLOCKFREE_STRUCTURE_EMPTY if no entry is available. //
// //
// If there is a wait function added to the queue the error code from //
// that function would be returned in the case of a failure. //
///////////////////////////////////////////////////////////////////////////
HRESULT Remove(__in DWORD key, __deref_out _T** ref);
PVOID operator new( __in size_t size );
void operator delete(__in_opt PVOID p);
PVOID operator new[]( __in size_t size );
void operator delete[](__in_opt PVOID p);
/////////////////////////////////////////////////////////////////////////////
// Dump the hashtable. Context is user defined and passed into the dump //
// function along with every entry in the hash table. This routine is not //
// thread safe. //
/////////////////////////////////////////////////////////////////////////////
HRESULT UnsafeDump(__in PVOID context, __in XLockFreeUnsafeDump function);
private:
XLOCKFREE_HANDLE hashTable;
XLockFreeHashTable(__in const XLockFreeHashTable& h) {}
};
/////////////////////////////////////////////////////////////////////////////////
// Often the number of lockable objects is huge. For example, an //
// implementation of a thread-safe hash table requires one lock per hash //
// chain (using one lock per hash table considerably reduces //
// performance). In such situations the number of two-way locks (and thus //
// event handles and size of memory required) grows proportionally to the //
// number of lockable objects. //
// //
// This class implements a pool of fast two locks. A fast two lock provides //
// exclusive or shared access where requests for exclusive lock will be //
// satisfied ahead of any requests for shared locks (it does not matter //
// of timing (traditional implementations process lock requests on "first //
// came first served" basis). //
// //
// In this implementation the number of event/semaphore pairs that are //
// actually required never exceeds the max number of threads running //
// simultaneousely (this limit may be reached on complete deadlock), and //
// since this number of threads that process may simultaneousely create is //
// very limited and the use of too many threads (more than few dozens) //
// considerably reduces performance, the total amount of required //
// synchonization events is limited and does not depend on number of //
// lockable objects. //
/////////////////////////////////////////////////////////////////////////////////
class XLockFreeLockPool
{
public:
XLockFreeLockPool();
~XLockFreeLockPool();
//
// Pool functions
//
/////////////////////////////////////////////////////////////////////////////
// Releases all resources associated with the pool The pool cannot be //
// used after calling this function. //
/////////////////////////////////////////////////////////////////////////////
void Destroy();
/////////////////////////////////////////////////////////////////////////////
// Returns the amount of memory allocated for the Pool. //
/////////////////////////////////////////////////////////////////////////////
HRESULT GetAllocated(__out DWORD* allocated);
/////////////////////////////////////////////////////////////////////////////
// Sets up the lock pool. This must be done prior to any other methods //
// calls on the Pool are attempted. If multiple threads will be accessing //
// the Pool it must be finished initializing before any other thread uses //
// the object. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Initialize();
/////////////////////////////////////////////////////////////////////////////
// Initializes the pool with custom information. The amount of memory //
// that is allocated, whether a thread should wait or not when accessing //
// the pool, and what the custom wait function should be. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Initialize(__in_opt XLOCKFREE_POOL* info);
//
// Lock functions
//
/////////////////////////////////////////////////////////////////////////////
// Acquire a lock. The lock can either be shared (multiple readers) or //
// exclusive (one writer). The writers are queued up in order of //
// requests. The only exception to this is when a shared lock is //
// upgraded. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Acquire(__in TWO_WAY_LOCK_ACTIONS action, __in TWO_WAY_LOCK* lock);
/////////////////////////////////////////////////////////////////////////////
// Returns the number of locks allocated for the pool (does not include //
// locks that were created using external memory - see SetupExternal()) //
/////////////////////////////////////////////////////////////////////////////
DWORD GetCount() const;
/////////////////////////////////////////////////////////////////////////////
// Increases the number of locks created in the Pool. Useful when the //
// total number of locks is known. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Increase(__in DWORD number);
/////////////////////////////////////////////////////////////////////////////
// Creates a lock that can be used to protect data or synchronize //
// execution. The lock is created using the Pool's memory routines. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Obtain(__deref_out TWO_WAY_LOCK** lock);
/////////////////////////////////////////////////////////////////////////////
// Releases a lock that has been acquired (see Acquire()). The action //
// must be identical to the action used when acquiring the lock. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Release(__in TWO_WAY_LOCK_ACTIONS action, __in TWO_WAY_LOCK* lock);
/////////////////////////////////////////////////////////////////////////////
// Returns the lock to pool so it can be reused. Only locks that were //
// created with Obtain() can be returned to the pool. Locks that are //
// created using SetupExternal() are not returned. //
/////////////////////////////////////////////////////////////////////////////
HRESULT Return(__in TWO_WAY_LOCK* lock);
/////////////////////////////////////////////////////////////////////////////
// Initializes a lock using memory supplied by the caller. The memory //
// must by 4 byte aligned. Memory management of the lock is the //
// responsibility of the caller. This lock can not be returned to the //
// pool (see Return()). //
/////////////////////////////////////////////////////////////////////////////
HRESULT SetupExternal(__in TWO_WAY_LOCK* lock);
//
// System resource functions
//
///////////////////////////////////////////////////////////////////////////////
// Returns the number of event/semaphore pairs used by the Pool. The //
// number will not exceed 32767. An event/semaphore pair is only required //
// when there is contention between locks. Pairs are shared between locks //
// because the maximum number required at any given point during //
// execution is determined by the number of simultaneously executing //
// threads. //
///////////////////////////////////////////////////////////////////////////////
DWORD GetEventCount() const;
///////////////////////////////////////////////////////////////////////////////
// Increase the number of events/semaphore pairs available to the //
// Pool. (Maximum 32767). This function is useful when the maximum number //
// concurrently running threads is known in advance. //
///////////////////////////////////////////////////////////////////////////////
HRESULT IncreaseEvents(__in DWORD number);
private:
XLOCKFREE_HANDLE pool;
};
////////////////////////////////////////////////////////////////////////////
// LOGGING FACILITY //
// //
// Create a log file that does the physical writes to the file on the //
// requested core. The log allocates a fixed number of messages of a //
// specified length. The can log can either be blocking or //
// non-blocking. If the log is non-blocking it will drop messages. The //
// number of dropped messages is reported when the log is shut down. //
// //
// N.B. Log created with InitializeUser writes to the debugger only //
// when _DEBUG is defined. The default behavior can be changed by //
// overriding LogMessage(PBYTE buffer, DWORD length). //
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
// Logs directly to file or output //
////////////////////////////////////////
class XLockFreeLog
{
public:
XLockFreeLog();
virtual ~XLockFreeLog();
HRESULT Initialize( __in int requestedCore, // Run the logging facility on this core
__in_z LPCSTR logFile, // Log messages to this file
__in int messageLength, // Maximum message length
__in int numberOfMessages, // Maximum number of messages allowed to be queued up
__in BOOL blockOnWrite); // Block if queue is at is maximum
HRESULT InitializeUser(__in int requestedCore, // Run the logging facility on this core
__in int messageLength, // Maximum message length
__in int numberOfMessages, // Maximum number of messages allowed to be queued up
__in BOOL blockOnWrite); // Block if queue is at is maximum
void Destroy();
void LogPrint(__in_z const char* format, ...);
void LogBuffer(__in_bcount(length) PBYTE buffer, __in DWORD length);
protected:
virtual HRESULT CALLBACK LogMessage(__in_bcount(length) PBYTE buffer, __in DWORD length);
private:
static HRESULT CALLBACK LogMessageCallback(__in PVOID context, __in_bcount(length) PBYTE buffer, __in DWORD length); // XLFLogMessage callback
XLockFreeLog(const XLockFreeLog&){} // Copy constructor not allowed.
XLOCKFREE_LOG log;
};
#include "xmcore.inl"
#endif /* __cplusplus */

771
third_party/xbox_sdk/include/xmcore.inl vendored Normal file
View File

@ -0,0 +1,771 @@
/**************************************************************************
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* File: xmcore.inl
* Content: XMCore inline functions
*
**************************************************************************/
#pragma once
// XLockFreeStack
template<class _T> inline XLockFreeStack<_T>::XLockFreeStack()
{
stack = NULL;
}
template <class _T> inline XLockFreeStack<_T>::~XLockFreeStack()
{
Destroy();
}
template <class _T> inline void XLockFreeStack<_T>::Destroy()
{
if(stack != NULL)
{
XLFStackDestroy(stack);
stack = NULL;
}
}
template <class _T> inline HRESULT XLockFreeStack<_T>::Initialize()
{
return XLFStackCreate(NULL, &stack);
}
template <class _T> inline HRESULT XLockFreeStack<_T>::Initialize(PXLOCKFREE_CREATE info)
{
if(info != NULL)
{
info->structureSize = sizeof(XLOCKFREE_CREATE);
}
return XLFStackCreate(info, &stack);
}
template <class _T> inline BOOL XLockFreeStack<_T>::IsEmpty() const
{
if(stack != NULL)
return XLFStackIsEmpty(stack);
else
return TRUE;
}
template <class _T> inline DWORD XLockFreeStack<_T>::GetAllocated() const
{
DWORD allocated;
if(SUCCEEDED(XLFStackAllocated(stack, &allocated)))
{
return allocated;
}
else
{
return 0;
}
}
template <class _T> inline DWORD XLockFreeStack<_T>::GetEntryCount() const
{
LONG entries;
if(SUCCEEDED(XLFStackGetEntryCount(stack, &entries)))
{
return entries;
}
else
{
return 0;
}
}
template <class _T> inline _T* XLockFreeStack<_T>::Pop()
{
PVOID data = NULL;
HRESULT hr = XLFStackPop(stack, &data);
if(SUCCEEDED(hr))
return (_T*) data;
else
return NULL;
}
template <class _T> inline HRESULT XLockFreeStack<_T>::Pop(_T** ref)
{
PVOID data = NULL;
HRESULT hr = XLFStackPop(stack, &data);
if(SUCCEEDED(hr) && ref != NULL) *ref = (_T*) data;
return hr;
}
template <class _T> inline HRESULT XLockFreeStack<_T>::Push(_T* entry)
{
return XLFStackPush(stack, entry);
}
template <class _T> inline
PVOID XLockFreeStack<_T>::operator new( size_t size)
{
return XLFAllocate(size);
}
template <class _T> inline
void XLockFreeStack<_T>::operator delete(PVOID p)
{
XLFFree(p);
}
template <class _T> inline
PVOID XLockFreeStack<_T>::operator new[]( size_t size)
{
return XLFAllocate(size);
}
template <class _T> inline
void XLockFreeStack<_T>::operator delete[](PVOID p)
{
XLFFree(p);
}
template <class _T> inline
HRESULT XLockFreeStack<_T>::UnsafeDump(PVOID context, XLockFreeUnsafeDump func)
{
return XLFStackUnsafeDump(stack, context, func);
}
// XLockFree Queue
template <class _T> inline XLockFreeQueue<_T>::XLockFreeQueue()
{
queue = NULL;
}
template <class _T> inline XLockFreeQueue<_T>::~XLockFreeQueue()
{
Destroy();
}
template <class _T> inline HRESULT XLockFreeQueue<_T>::Add(_T* entry)
{
return XLFQueueAdd(queue, entry);
}
template <class _T> inline void XLockFreeQueue<_T>::Destroy()
{
if(queue != NULL)
{
XLFQueueDestroy(queue);
queue = NULL;
}
}
template <class _T> inline HRESULT XLockFreeQueue<_T>::Initialize()
{
return XLFQueueCreate(NULL, &queue);
}
template <class _T> inline HRESULT XLockFreeQueue<_T>::Initialize(PXLOCKFREE_CREATE info)
{
if(info != NULL)
{
info->structureSize = sizeof(XLOCKFREE_CREATE);
}
return XLFQueueCreate(info, &queue);
}
template <class _T> inline BOOL XLockFreeQueue<_T>::IsEmpty() const
{
if(queue != NULL)
return XLFQueueIsEmpty(queue);
else
return TRUE;
}
template <class _T> inline DWORD XLockFreeQueue<_T>::GetAllocated() const
{
DWORD allocated = 0;
if(SUCCEEDED(XLFQueueAllocated(queue, &allocated)))
{
return allocated;
}
else
{
return 0;
}
}
template <class _T> inline DWORD XLockFreeQueue<_T>::GetEntryCount() const
{
LONG entries = 0;
if(SUCCEEDED(XLFQueueGetEntryCount(queue, &entries)))
{
return entries;
}
else
{
return 0;
}
}
template <class _T> inline _T* XLockFreeQueue<_T>::Remove()
{
PVOID data = NULL;
HRESULT hr = XLFQueueRemove(queue, &data);
if(SUCCEEDED(hr))
return (_T*) data;
else
return NULL;
}
template <class _T> inline HRESULT XLockFreeQueue<_T>::Remove(_T** ref)
{
PVOID data = NULL;
HRESULT hr = XLFQueueRemove(queue, &data);
if(SUCCEEDED(hr) && ref != NULL) *ref = (_T*) data;
return hr;
}
template <class _T> inline
PVOID XLockFreeQueue<_T>::operator new( size_t size )
{
return XLFAllocate( size );
}
template <class _T> inline
void XLockFreeQueue<_T>::operator delete(PVOID p)
{
XLFFree(p);
}
template <class _T> inline
PVOID XLockFreeQueue<_T>::operator new[]( size_t size )
{
return XLFAllocate(size);
}
template <class _T> inline
void XLockFreeQueue<_T>::operator delete[](PVOID p)
{
XLFFree(p);
}
template <class _T> inline
HRESULT XLockFreeQueue<_T>::UnsafeDump(PVOID context, XLockFreeUnsafeDump func)
{
return XLFQueueUnsafeDump(queue, context, func);
}
// XLockFreeCustom
inline
int XLockFreeCustom::compare(int p1, int p2)
{
ULONG left = (ULONG) p1;
ULONG right = (ULONG) p2;
if(left < right)
return -1;
else if(left > right)
return 1;
else
return 0;
}
inline
unsigned int XLockFreeCustom::hash(unsigned int key, unsigned int buckets)
{
unsigned int mask = buckets - 1;
unsigned __int64 spot = (unsigned __int64)key * 0xfaf57cee85433e40 +
0xfc2d7230d92f2eac;
unsigned int index = ((unsigned int) (spot >> 32)) & mask;
return index;
}
inline
unsigned int XLockFreeCustom::bucketSize(unsigned int buckets)
{
buckets = buckets & ~0x80000000;
unsigned int log2 = 1;
while(log2 < buckets) log2 = log2 << 1;
return log2;
}
// XLockFreePriorityQueue
template <class _T, class _XFunctions> inline XLockFreePriorityQueue<_T,_XFunctions>::XLockFreePriorityQueue()
{
queue = NULL;
}
template <class _T, class _XFunctions> inline XLockFreePriorityQueue<_T,_XFunctions>::~XLockFreePriorityQueue()
{
Destroy();
}
template <class _T, class _XFunctions> inline HRESULT XLockFreePriorityQueue<_T,_XFunctions>::Add(DWORD key, _T* entry)
{
return XLFPriorityQueueAdd(queue, key, entry);
}
template <class _T, class _XFunctions> inline void XLockFreePriorityQueue<_T,_XFunctions>::Destroy()
{
if(queue != NULL)
{
XLFPriorityQueueDestroy(queue);
queue = NULL;
}
}
template <class _T, class _XFunctions> inline HRESULT XLockFreePriorityQueue<_T,_XFunctions>::Initialize()
{
return Initialize(NULL);
}
template <class _T, class _XFunctions> inline HRESULT XLockFreePriorityQueue<_T,_XFunctions>::Initialize(PXLOCKFREE_CREATE info)
{
HRESULT hr = S_OK;
XLOCKFREE_FUNCTIONS functions;
functions.structureSize = sizeof(XLOCKFREE_FUNCTIONS);
functions.compare = (XLockFreeCompareKeys) _func.compare;
functions.hash = (XLockFreeHashKey) _func.hash;
if(info != NULL)
{
info->structureSize = sizeof(XLOCKFREE_CREATE);
}
hr = XLFPriorityQueueCreate(info, &functions, &queue);
return hr;
}
template <class _T, class _XFunctions> inline BOOL XLockFreePriorityQueue<_T,_XFunctions>::IsEmpty() const
{
if(queue != NULL)
return XLFPriorityQueueIsEmpty(queue);
else
return TRUE;
}
template <class _T, class _XFunctions> inline DWORD XLockFreePriorityQueue<_T,_XFunctions>::GetAllocated() const
{
DWORD allocated = 0;
if(SUCCEEDED(XLFPriorityQueueAllocated(queue, &allocated)))
{
return allocated;
}
else
{
return 0;
}
}
template <class _T, class _XFunctions> inline DWORD XLockFreePriorityQueue<_T,_XFunctions>::GetEntryCount() const
{
LONG entries = 0;
if(SUCCEEDED(XLFPriorityQueueGetEntryCount(queue, &entries)))
{
return entries;
}
else
{
return 0;
}
}
template <class _T, class _XFunctions> inline _T* XLockFreePriorityQueue<_T,_XFunctions>::RemoveFirst()
{
PVOID data = NULL;
HRESULT hr = XLFPriorityQueueRemoveFirst(queue, &data);
if(SUCCEEDED(hr))
return (_T*) data;
else
return NULL;
}
template <class _T, class _XFunctions> inline HRESULT XLockFreePriorityQueue<_T,_XFunctions>::RemoveFirst(_T** ref)
{
PVOID data = NULL;
HRESULT hr = XLFPriorityQueueRemoveFirst(queue, &data);
if(SUCCEEDED(hr) && ref != NULL) *ref = (_T*) data;
return hr;
}
template <class _T, class _XFunctions> inline _T* XLockFreePriorityQueue<_T,_XFunctions>::Remove(DWORD key)
{
PVOID data = NULL;
HRESULT hr = XLFPriorityQueueRemove(queue, key, &data);
if(SUCCEEDED(hr))
return (_T*) data;
else
return NULL;
}
template <class _T, class _XFunctions> inline HRESULT XLockFreePriorityQueue<_T,_XFunctions>::Remove(DWORD key, _T** ref)
{
PVOID data = NULL;
HRESULT hr = XLFPriorityQueueRemove(queue, key, &data);
if(SUCCEEDED(hr) && ref != NULL) *ref = (_T*) data;
return hr;
}
template <class _T, class _XFunctions> inline
PVOID XLockFreePriorityQueue<_T,_XFunctions>::operator new( size_t size )
{
return XLFAllocate(size);
}
template <class _T, class _XFunctions> inline
void XLockFreePriorityQueue<_T,_XFunctions>::operator delete(PVOID p)
{
XLFFree(p);
}
template <class _T, class _XFunctions> inline
PVOID XLockFreePriorityQueue<_T,_XFunctions>::operator new[]( size_t size )
{
return XLFAllocate(size);
}
template <class _T, class _XFunctions> inline
void XLockFreePriorityQueue<_T,_XFunctions>::operator delete[](PVOID p)
{
XLFFree(p);
}
template <class _T, class _XFunctions> inline
HRESULT XLockFreePriorityQueue<_T,_XFunctions>::UnsafeDump(PVOID context, XLockFreeUnsafeDump func)
{
return XLFPriorityQueueUnsafeDump(queue, context, func);
}
// XLockFreeHashTable
template <class _T, class _XFunctions> inline
XLockFreeHashTable<_T,_XFunctions>::XLockFreeHashTable()
{
hashTable = NULL;
}
template <class _T, class _XFunctions> inline
XLockFreeHashTable<_T,_XFunctions>::~XLockFreeHashTable()
{
Destroy();
}
template <class _T, class _XFunctions> inline
HRESULT XLockFreeHashTable<_T,_XFunctions>::Add(DWORD key, _T* entry)
{
return XLFHashTableAdd(hashTable, key, entry);
}
template <class _T, class _XFunctions> inline
void XLockFreeHashTable<_T,_XFunctions>::Destroy()
{
if(hashTable != NULL)
{
XLFHashTableDestroy(hashTable);
hashTable = NULL;
}
}
template <class _T, class _XFunctions> inline
HRESULT XLockFreeHashTable<_T,_XFunctions>::Initialize(DWORD buckets)
{
return Initialize(NULL, buckets);
}
template <class _T, class _XFunctions> inline
HRESULT XLockFreeHashTable<_T,_XFunctions>::Initialize(PXLOCKFREE_CREATE info, DWORD buckets)
{
HRESULT hr = S_OK;
XLOCKFREE_FUNCTIONS functions;
if(buckets == 0 || ((buckets & 0x80000000) != 0))
{
return E_INVALIDARG;
}
functions.structureSize = sizeof(XLOCKFREE_FUNCTIONS);
functions.compare = (XLockFreeCompareKeys) _func.compare;
functions.hash = (XLockFreeHashKey) _func.hash;
buckets = _func.bucketSize(buckets);
if(info != NULL)
{
info->structureSize = sizeof(XLOCKFREE_CREATE);
}
hr = XLFHashTableCreate(info, &functions, buckets, &hashTable);
return hr;
}
template <class _T, class _XFunctions> inline
BOOL XLockFreeHashTable<_T,_XFunctions>::IsEmpty() const
{
if(hashTable != NULL)
return XLFHashTableIsEmpty(hashTable);
else
return TRUE;
}
template <class _T, class _XFunctions> inline
DWORD XLockFreeHashTable<_T,_XFunctions>::GetAllocated() const
{
DWORD allocated = 0;
if(SUCCEEDED(XLFHashTableAllocated(hashTable, &allocated)))
{
return allocated;
}
else
{
return 0;
}
}
template <class _T, class _XFunctions> inline
DWORD XLockFreeHashTable<_T,_XFunctions>::GetEntryCount() const
{
LONG entries = 0;
if(SUCCEEDED(XLFHashTableGetEntryCount(hashTable, &entries)))
{
return entries;
}
else
{
return 0;
}
}
template <class _T, class _XFunctions> inline
_T* XLockFreeHashTable<_T,_XFunctions>::RemoveFirst()
{
PVOID data = NULL;
HRESULT hr = XLFHashTableRemoveFirst(hashTable, &data);
if(SUCCEEDED(hr))
return (_T*) data;
else
return NULL;
}
template <class _T, class _XFunctions> inline
HRESULT XLockFreeHashTable<_T,_XFunctions>::RemoveFirst(_T** ref)
{
PVOID data = NULL;
HRESULT hr = XLFHashTableRemoveFirst(hashTable, &data);
if(SUCCEEDED(hr) && ref != NULL) *ref = (_T*) data;
return hr;
}
template <class _T, class _XFunctions> inline
_T* XLockFreeHashTable<_T,_XFunctions>::Remove(DWORD key)
{
PVOID data = NULL;
HRESULT hr = XLFHashTableRemove(hashTable, key, &data);
if(SUCCEEDED(hr))
return (_T*) data;
else
return NULL;
}
template <class _T, class _XFunctions> inline
HRESULT XLockFreeHashTable<_T,_XFunctions>::Remove(DWORD key, _T** ref)
{
PVOID data = NULL;
HRESULT hr = XLFHashTableRemove(hashTable, key, &data);
if(SUCCEEDED(hr) && ref != NULL) *ref = (_T*) data;
return hr;
}
template <class _T, class _XFunctions> inline
PVOID XLockFreeHashTable<_T,_XFunctions>::operator new( size_t size )
{
return XLFAllocate(size);
}
template <class _T, class _XFunctions> inline
void XLockFreeHashTable<_T,_XFunctions>::operator delete(PVOID p)
{
XLFFree(p);
}
template <class _T, class _XFunctions> inline
PVOID XLockFreeHashTable<_T,_XFunctions>::operator new[]( size_t size )
{
return XLFAllocate(size);
}
template <class _T, class _XFunctions> inline
void XLockFreeHashTable<_T,_XFunctions>::operator delete[](PVOID p)
{
XLFFree(p);
}
template <class _T, class _XFunctions> inline
HRESULT XLockFreeHashTable<_T,_XFunctions>::UnsafeDump(PVOID context, XLockFreeUnsafeDump func)
{
return XLFHashTableUnsafeDump(hashTable, context, func);
}
// XLockFreeLockPool
inline XLockFreeLockPool::XLockFreeLockPool()
{
pool = NULL;
}
inline XLockFreeLockPool::~XLockFreeLockPool()
{
Destroy();
}
inline HRESULT XLockFreeLockPool::Acquire(TWO_WAY_LOCK_ACTIONS action, TWO_WAY_LOCK* lock)
{
return XLFPoolAcquireLock(pool, action, lock);
}
inline void XLockFreeLockPool::Destroy()
{
if(pool != NULL)
{
XLFPoolDestroy(pool);
pool = NULL;
}
}
inline HRESULT XLockFreeLockPool::Initialize()
{
return XLFPoolCreate(NULL, &pool);
}
inline HRESULT XLockFreeLockPool::Initialize(XLOCKFREE_POOL* info)
{
if(info != NULL)
{
info->structureSize = sizeof(XLOCKFREE_POOL);
}
return XLFPoolCreate(info, &pool);
}
inline HRESULT XLockFreeLockPool::GetAllocated(DWORD* allocated)
{
return XLFPoolAllocated(pool, allocated);
}
inline HRESULT XLockFreeLockPool::Obtain(TWO_WAY_LOCK** lock)
{
return XLFPoolCreateLock(pool, lock);
}
inline HRESULT XLockFreeLockPool::Return(TWO_WAY_LOCK* lock)
{
return XLFPoolDestroyLock(pool, lock);
}
inline HRESULT XLockFreeLockPool::IncreaseEvents(DWORD number)
{
return XLFPoolIncreaseEvents(pool, number);
}
inline HRESULT XLockFreeLockPool::Increase(DWORD number)
{
return XLFPoolIncreaseLocks(pool, number);
}
inline HRESULT XLockFreeLockPool::SetupExternal(TWO_WAY_LOCK* lock)
{
return XLFPoolInitializeLock(pool, lock);
}
inline DWORD XLockFreeLockPool::GetEventCount() const
{
DWORD count = 0;
if(SUCCEEDED(XLFPoolNumberOfEvents(pool, &count)))
{
return count;
}
else
{
return 0;
}
}
inline DWORD XLockFreeLockPool::GetCount() const
{
DWORD count = 0;
if(SUCCEEDED(XLFPoolNumberOfLocks(pool, &count)))
{
return count;
}
else
{
return 0;
}
}
inline HRESULT XLockFreeLockPool::Release(TWO_WAY_LOCK_ACTIONS action, TWO_WAY_LOCK* lock)
{
return XLFPoolReleaseLock(pool, action, lock);
}
// XLockFreeLog
inline XLockFreeLog::XLockFreeLog()
{
log = NULL;
}
inline XLockFreeLog::~XLockFreeLog()
{
//
// N.B. If deriving from the XLockFreeLog class, we recommend that you implement a
// virtual destructor that calls Destroy().
//
Destroy();
}
inline void XLockFreeLog::Destroy()
{
if (log != NULL)
{
XLFEndLog(log);
log = NULL;
}
}
inline void XLockFreeLog::LogPrint(const char* format, ...)
{
va_list args;
va_start(args, format);
XLFLogPrintV(log, format, args);
va_end(args);
}
inline void XLockFreeLog::LogBuffer(PBYTE buffer, DWORD length)
{
XLFLogBuffer(log, buffer, length);
}
inline HRESULT XLockFreeLog::Initialize(int requestedCore, LPCSTR logFile, int messageLength, int numberOfMessages, BOOL blockOnWrite)
{
if (log != NULL)
return E_UNEXPECTED;
return XLFStartLog(requestedCore, logFile, messageLength, numberOfMessages, blockOnWrite, &log);
}
inline HRESULT XLockFreeLog::InitializeUser(int requestedCore, int messageLength, int numberOfMessages, BOOL blockOnWrite)
{
if (log != NULL)
return E_UNEXPECTED;
return XLFStartUserLog(requestedCore, this, &XLockFreeLog::LogMessageCallback, messageLength, numberOfMessages, blockOnWrite, &log);
}
inline HRESULT CALLBACK XLockFreeLog::LogMessageCallback(PVOID context, PBYTE buffer, DWORD length)
{
XLockFreeLog* inst = (XLockFreeLog*) context;
return inst->LogMessage(buffer, length);
}
inline HRESULT CALLBACK XLockFreeLog::LogMessage(PBYTE buffer, DWORD length)
{
UNREFERENCED_PARAMETER(length);
#ifndef _DEBUG
UNREFERENCED_PARAMETER(buffer);
#else
OutputDebugStringA((LPCSTR)buffer);
#endif
return S_OK;
}

3397
third_party/xbox_sdk/include/xnamath.h vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

157
third_party/xbox_sdk/include/xsim.h vendored Normal file
View File

@ -0,0 +1,157 @@
//--------------------------------------------------------------------------------------
// XSim.h
//
// C-Style API for XSim
//
// Microsoft Game Studios Tools and Technology Group
// Copyright (C) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#ifndef _XSIM_H_
#define _XSIM_H_
#include <sal.h>
// Putting these here so that XSim clients only need to include XSim.h
#ifndef XSIM_INTERNAL
#include <xbdm.h>
#endif
#include "XSimError.h"
#ifdef __cplusplus
extern "C" {
#endif
const DWORD DEFAULT_COMPONENT_FRAMERATE = 60;
const DWORD DM_AUTOMATION_INPUTQUEUE_LENGTH = 100;
const DWORD IO_BUFFER_SIZE = 16384; // Buffer size is one Xbox HD sector.
//------------------------------------------------------------------------------
// Handle definition
//------------------------------------------------------------------------------
typedef HANDLE XSIMHANDLE;
//------------------------------------------------------------------------------
// General component status
//------------------------------------------------------------------------------
typedef enum _XSIM_COMPONENTSTATUS {
XSIM_COMPONENTSTATUS_IDLE,
XSIM_COMPONENTSTATUS_RUNNING
} XSIM_COMPONENTSTATUS;
//------------------------------------------------------------------------------
// Synchronization mode used by TextSequencePlayer
//------------------------------------------------------------------------------
typedef enum _XSIM_SYNCHMODE {
XSIM_SYNCHMODE_FRAME = 0x00000001,
XSIM_SYNCHMODE_TIME = 0x00000002
} XSIM_SYNCHMODE;
//------------------------------------------------------------------------------
// Structs used for Random Input Player button press timings
//------------------------------------------------------------------------------
typedef struct _XSIM_BUTTONPRESSATTRIBUTES {
DWORD dwIntervalMinMs;
DWORD dwIntervalMaxMs;
DWORD dwHoldTimeMinMs;
DWORD dwHoldTimeMaxMs;
} XSIM_BUTTONPRESSATTRIBUTES;
typedef struct _XSIM_CONTROLLERPRESSATTRIBUTES {
XSIM_BUTTONPRESSATTRIBUTES DpadUp;
XSIM_BUTTONPRESSATTRIBUTES DpadDown;
XSIM_BUTTONPRESSATTRIBUTES DpadLeft;
XSIM_BUTTONPRESSATTRIBUTES DpadRight;
XSIM_BUTTONPRESSATTRIBUTES Start;
XSIM_BUTTONPRESSATTRIBUTES Back;
XSIM_BUTTONPRESSATTRIBUTES LeftThumb;
XSIM_BUTTONPRESSATTRIBUTES RightThumb;
XSIM_BUTTONPRESSATTRIBUTES LeftShoulder;
XSIM_BUTTONPRESSATTRIBUTES RightShoulder;
XSIM_BUTTONPRESSATTRIBUTES A;
XSIM_BUTTONPRESSATTRIBUTES B;
XSIM_BUTTONPRESSATTRIBUTES X;
XSIM_BUTTONPRESSATTRIBUTES Y;
XSIM_BUTTONPRESSATTRIBUTES XBox360Button;
XSIM_BUTTONPRESSATTRIBUTES RightTrigger;
XSIM_BUTTONPRESSATTRIBUTES LeftTrigger;
XSIM_BUTTONPRESSATTRIBUTES ThumbLX;
XSIM_BUTTONPRESSATTRIBUTES ThumbLY;
XSIM_BUTTONPRESSATTRIBUTES ThumbRX;
XSIM_BUTTONPRESSATTRIBUTES ThumbRY;
} XSIM_CONTROLLERPRESSATTRIBUTES;
//------------------------------------------------------------------------------
// User index bits used for building user index masks
//------------------------------------------------------------------------------
typedef enum _XSIM_USERINDEXMASK {
XSIM_USERINDEXMASK_0 = 0x00000001,
XSIM_USERINDEXMASK_1 = 0x00000002,
XSIM_USERINDEXMASK_2 = 0x00000004,
XSIM_USERINDEXMASK_3 = 0x00000008,
XSIM_USERINDEXMASK_ALL = 0x0000000F,
} XSIM_USERINDEXMASK;
//------------------------------------------------------------------------------
// XSim Functions
//------------------------------------------------------------------------------
// Initialize/Uninitialize
HRESULT WINAPI XSimInitialize( __in DWORD dwComponentFrameRate );
HRESULT WINAPI XSimUninitialize( );
// Take/Return control from/to the physical controller
HRESULT WINAPI XSimAcquireControl( __in DWORD dwUserIndexMask );
HRESULT WINAPI XSimReturnControl( __in DWORD dwUserIndexMask );
// Player creation
HRESULT WINAPI XSimCreateRandomInputPlayer( __out XSIMHANDLE* phXSimHandle );
HRESULT WINAPI XSimCreateRandomStatePlayer( __in_z LPCSTR lpFileName, __out XSIMHANDLE* phXSimHandle );
HRESULT WINAPI XSimCreateFilePlayer( __in_z LPCSTR lpFileName,
__in XSIM_SYNCHMODE eSynchMode,
__out XSIMHANDLE* phXSimHandle );
HRESULT WINAPI XSimCreateTextSequencePlayer( __in_z LPCSTR lpPlaybackString,
__in XSIM_SYNCHMODE eSynchMode,
__in DWORD dwDefaultPlaybackRate,
__out XSIMHANDLE* phXSimHandle );
// Recorder creation
HRESULT WINAPI XSimCreateFileRecorder( __in_z LPCSTR lpFileName, __out XSIMHANDLE* phXSimHandle );
// Handle releasing
HRESULT WINAPI XSimCloseHandle( __in XSIMHANDLE hXSimHandle );
// Start/Stop player(s)
HRESULT WINAPI XSimStartPlayer( __in XSIMHANDLE hXSimHandle, __in DWORD dwUserIndex );
HRESULT WINAPI XSimStopPlayer( __in DWORD dwUserIndex);
// Start/Stop recorder(s)
HRESULT WINAPI XSimStartRecorder( __in XSIMHANDLE hXSimHandle, __in DWORD dwUserIndex );
HRESULT WINAPI XSimStopRecorder( __in DWORD dwUserIndex );
// Player/Recorder status
HRESULT WINAPI XSimGetPortPlayerStatus( __in DWORD dwUserIndex, __out XSIM_COMPONENTSTATUS* pStatus );
HRESULT WINAPI XSimGetPortRecorderStatus( __in DWORD dwUserIndex, __out XSIM_COMPONENTSTATUS* pStatus );
// Random Input Player settings
HRESULT WINAPI XSimSetRandomInputPlayerConnectAttributes( __in XSIMHANDLE hXSimHandle,
__in BOOL bStartConnected,
__in DWORD dwDisconnectIntervalMin,
__in DWORD dwDisconnectIntervalMax,
__in DWORD dwReconnectIntervalMin,
__in DWORD dwReconnectIntervalMax );
HRESULT WINAPI XSimGetRandomInputPlayerPressAttributes( __in XSIMHANDLE hXSimHandle, __out XSIM_CONTROLLERPRESSATTRIBUTES* pPressAttributes );
HRESULT WINAPI XSimSetRandomInputPlayerPressAttributes( __in XSIMHANDLE hXSimHandle, __in XSIM_CONTROLLERPRESSATTRIBUTES* pPressAttributes );
// Random State Player state control
HRESULT WINAPI XSimGetRandomStatePlayerState( __in XSIMHANDLE hXSimHandle,
__in DWORD dwBufferSize,
__out_ecount(dwBufferSize) LPSTR lpStateName );
HRESULT WINAPI XSimSetRandomStatePlayerState( __in XSIMHANDLE hXSimHandle, __in_z LPCSTR lpStateName );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,72 @@
//--------------------------------------------------------------------------------------
// XSimError
//
// Error codes generated by XSim
//
// Microsoft Game Studios Tools and Technology Group
// Copyright (C) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#ifndef MAKE_HRESULT
#define MAKE_HRESULT(sev,fac,code) ((HRESULT)(((unsigned long)(sev)<<31)|((unsigned long)(fac)<<16)|((unsigned long)(code))))
#endif
#define XSIM_FACILITY 0x71
// Success codes
#define XSIM_S_OK S_OK
#define XSIM_S_FIRST MAKE_HRESULT(0, XSIM_FACILITY, 0x0000)
#define XSIM_S_ALREADY_STARTED XSIM_S_FIRST + 1 // 0x00710001 // player/recorder already started
#define XSIM_S_ALREADY_STOPPED XSIM_S_FIRST + 2 // 0x00710002 // player/recorder already stopped
#define XSIM_S_THREAD_ALREADYRUNNING XSIM_S_FIRST + 3 // 0x00710003 // The thread is already running
#define XSIM_S_OUTOFINPUTS XSIM_S_FIRST + 4 // 0x00710004 // The sequence player is out of inputs (queue manager should stop the player)
// Error codes
#define XSIM_E_FIRST_ERROR MAKE_HRESULT(SEVERITY_ERROR, XSIM_FACILITY, 0x0000)
#define XSIM_E_FAIL XSIM_E_FIRST_ERROR + 1 // 0x80710001 // Unspecified failure
#define XSIM_E_MEMORY XSIM_E_FIRST_ERROR + 2 // 0x80710002 // Out of memory
#define XSIM_E_THREAD XSIM_E_FIRST_ERROR + 3 // 0x80710003 // Threading error
#define XSIM_E_SEQUENCE_PARSE_ERROR XSIM_E_FIRST_ERROR + 4 // 0x80710004 // Error parsing text sequence
#define XSIM_E_OPEN_FILE_FAILED XSIM_E_FIRST_ERROR + 5 // 0x80710005 // Couldn't open file
#define XSIM_E_READ_FILE_FAILED XSIM_E_FIRST_ERROR + 6 // 0x80710006 // Couldn't read from file
#define XSIM_E_WRITE_FILE_FAILED XSIM_E_FIRST_ERROR + 7 // 0x80710007 // Couldn't write to file
#define XSIM_E_INVALID_FILE XSIM_E_FIRST_ERROR + 8 // 0x80710008 // Invalid file format
#define XSIM_E_XML_PARSE_ERROR XSIM_E_FIRST_ERROR + 9 // 0x80710009 // RandomState XML file parse error
#define XSIM_E_UNSPECIFIED_INITIAL_STATE XSIM_E_FIRST_ERROR + 10 // 0x8071000A // RandomState no initial state specified
#define XSIM_E_NO_CURRENT_STATE XSIM_E_FIRST_ERROR + 11 // 0x8071000B // RandomState no current state set
#define XSIM_E_NO_CURRENT_CHOICE XSIM_E_FIRST_ERROR + 12 // 0x8071000C // RandomState no current choice set
#define XSIM_E_NO_STATES XSIM_E_FIRST_ERROR + 13 // 0x8071000D // RandomState no states defined
#define XSIM_E_NO_CHOICES XSIM_E_FIRST_ERROR + 14 // 0x8071000E // RandomState no choices defined in state
#define XSIM_E_NO_ACTION XSIM_E_FIRST_ERROR + 15 // 0x8071000F // RandomState no action define in choice
#define XSIM_E_ASYNC_REQUIRES_BUFFER XSIM_E_FIRST_ERROR + 16 // 0x80710010 // Asynchronous read/writes require bufsize > 0
#define XSIM_E_INVALID_HANDLE XSIM_E_FIRST_ERROR + 17 // 0x80710011 // Invalid handle
#define XSIM_E_NOT_INITIALIZED XSIM_E_FIRST_ERROR + 18 // 0x80710012 // XSimInitialize() hasn't been called
#define XSIM_E_INVALIDARG XSIM_E_FIRST_ERROR + 19 // 0x80710013 // Invalid argument (NULL pointer, etc)
#define XSIM_E_OUT_OF_HANDLES XSIM_E_FIRST_ERROR + 20 // 0x80710014 // No free handles remaining
#define XSIM_E_INVALID_USER_INDEX XSIM_E_FIRST_ERROR + 21 // 0x80710015 // Specified a user index greater than XUSER_MAX_COUNT-1
#define XSIM_E_INVALID_PLAYER XSIM_E_FIRST_ERROR + 22 // 0x80710016 // Attempted an operation with component that wasn't a player
#define XSIM_E_INVALID_RECORDER XSIM_E_FIRST_ERROR + 23 // 0x80710017 // Attempted an operation with component that wasn't a recorder
#define XSIM_E_PLAYER_IN_USE XSIM_E_FIRST_ERROR + 24 // 0x80710018 // Attempted to start a player that is already in use on another port
#define XSIM_E_RECORDER_IN_USE XSIM_E_FIRST_ERROR + 25 // 0x80710019 // Attempted to start a player that is already in use on another port
#define XSIM_E_NO_CONNECTION XSIM_E_FIRST_ERROR + 26 // 0x8071001A // Attempted to send a message to the XSim debugger extension DLL without a connection handle
#define XSIM_E_NOTIMPL XSIM_E_FIRST_ERROR + 27 // 0x8071001B // Feature not implemented
#define XSIM_E_INVALID_MSG XSIM_E_FIRST_ERROR + 28 // 0x8071001C // XSim Debugger extension received a debug channel message it did not understand
#define XSIM_E_NOT_SYNCHRONOUS XSIM_E_FIRST_ERROR + 29 // 0x8071001D // A player or recorder was told to start synchronously on the console, but it's not a remote player!
#define XSIM_E_INVALID_STATE_NAME XSIM_E_FIRST_ERROR + 30 // 0x8071001E // RandomState Invalid state name
#define XSIM_E_BUFFER_TOO_SMALL XSIM_E_FIRST_ERROR + 31 // 0x8071001F // Buffer too small
#define XSIM_E_INVALID_SYNCMODE XSIM_E_FIRST_ERROR + 32 // 0x80710020 // Invalid sync mode for FileRecorder or FilePlayer
#define XSIM_E_INVALID_PRESSDURATION XSIM_E_FIRST_ERROR + 33 // 0x80710021 // Invalid press duruation supplied to queue manager
#define XSIM_E_USER_INDEX_NOT_ACQUIRED XSIM_E_FIRST_ERROR + 34 // 0x80710022 // Attempted to use a player/recorder on an unbound user index
#define XSIM_E_ALREADY_ACQUIRED XSIM_E_FIRST_ERROR + 35 // 0x80710023 // Attempted to acquire a controller that is already acquired
#define XSIM_E_NOT_ACQUIRED XSIM_E_FIRST_ERROR + 36 // 0x80710024 // Attempted to release a controller that is not acquired
#define XSIM_E_ALREADY_INITIALIZED XSIM_E_FIRST_ERROR + 37 // 0x80710025 // XSimInitialize() has already been called
#define XSIM_E_FILENOTFOUND XSIM_E_FIRST_ERROR + 38 // 0x80710026 // The file specified for the fileplayer or filerecorder was not found on the console
#define XSIM_E_CANNOTACCESS XSIM_E_FIRST_ERROR + 39 // 0x80710027 // The default console is locked and/or the automation PC does not have permission connect to it
#define XSIM_E_SINGLE_PLAYER_ONLY XSIM_E_FIRST_ERROR + 40 // 0x80710028 // Only one player is allowed to be playing at any time
#define XSIM_E_SINGLE_RECORDER_ONLY XSIM_E_FIRST_ERROR + 41 // 0x80710029 // Only one recorder is allowed to be recording at any time
#define XSIM_E_CONNECTIONLOST XSIM_E_FIRST_ERROR + 42 // 0x8071002A // The connection was lost to the console. Check network cables, etc. shut down, restart, retry
#define XSIM_E_EXTENSION_NOTFOUND XSIM_E_FIRST_ERROR + 43 // 0x8071002B // XSim.xex was not found on your Xbox

View File

@ -0,0 +1,103 @@
/**************************************************************************
*
* Copyright (C) Microsoft Corporation. All rights reserved.
*
* Module Name:
*
* XWMAEncoder.h
*
* Abstract:
*
* xWMA encoder public interfaces, functions and data types
*
**************************************************************************/
#ifndef _XWMAENCODER_H_
#define _XWMAENCODER_H_
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif // #if defined (_MSC_VER) && (_MSC_VER >= 1020)
// Default XWMA encoding bitrate
#define XWMA_DEFAULT_BITRATE 48000
// XWMA encoder error codes
#define FACILITY_XWMA 0x899
#define XWMA_ERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XWMA, n)
#define XWMA_E_UNSUPPORTED_FORMATTAG XWMA_ERROR(0x01) // format tag must be WAVE_FORMAT_PCM or WAVE_FORMAT_IEEE_FLOAT
#define XWMA_E_UNSUPPORTED_FRAMERATE XWMA_ERROR(0x02) // nSamplesPerSec must be between 1kHz and 200kHz
#define XWMA_E_UNSUPPORTED_CHANNELS XWMA_ERROR(0x03) // nChannels must be 1, 2, or 6
#define XWMA_E_UNSUPPORTED_BITSPERSAMPLE XWMA_ERROR(0x04) // wBitsPerSample must be 8, 16 or 24 for integer input data or 32 for floating-point data
#define XWMA_E_UNSUPPORTED_BITRATE XWMA_ERROR(0x05) // bitrate must be 20kbps, 32kbps, 48kbps, 64kbps, 96kbps, 16kbps0, or 192kbps
#ifndef _WAVEFORMATEX_
#define _WAVEFORMATEX_
#pragma pack(push, 1)
typedef struct tWAVEFORMATEX
{
WORD wFormatTag; // format type
WORD nChannels; // number of channels (i.e. mono, stereo...)
DWORD nSamplesPerSec; // sample rate
DWORD nAvgBytesPerSec; // for buffer estimation
WORD nBlockAlign; // block size of data
WORD wBitsPerSample; // Number of bits per sample of mono data
WORD cbSize; // The count in bytes of the size of extra information (after cbSize)
} WAVEFORMATEX, *PWAVEFORMATEX;
typedef WAVEFORMATEX NEAR *NPWAVEFORMATEX;
typedef WAVEFORMATEX FAR *LPWAVEFORMATEX;
#pragma pack(pop)
#endif
////
// DESCRIPTION:
// Encodes PCM data to xWMA
//
// REMARKS:
// Resamples and pads the input data if necessary for it to encode successfully.
// May have to adjust the bitrate.
//
// PARAMETERS:
// pInputBuffer - [in] input buffer, contains PCM data, must contain at least one frame
// inputBufferSize - [in] size of input buffer (in bytes)
// pInputFormat - [in] input buffer format
// outputBitrate - [in] requested WMA encoder bitrate
// Must be one of 20000, 32000, 48000, 64000, 96000, 160000 or 192000
// Natively supported bitrates per sample rate and channel count:
// 22050Hz mono: 20000
// 22050Hz stereo: 32000
// 32000Hz mono: 20000
// 32000Hz stereo: 32000, 48000
// 44100Hz mono: 32000, 48000
// 44100Hz stereo: 32000, 48000, 96000, 192000
// 44100Hz 5.1: 96000, 192000
// 48000Hz stereo: 48000, 64000, 96000, 160000, 192000
// 48000Hz 5.1: 48000, 192000
// ppEncodedBuffer - [out] output buffer (use free [] to release)
// pEncodedBufferSize - [out] size of output buffer (in bytes)
// ppEncodedBufferFormat - [out] output buffer format (use free [] to release)
// pEncodedBufferFormatSize - [out] size of output buffer format
// ppDecodedPacketCumulativeBytes - [out] decoded packet cumulative data size array (use free [] to release)
// pDecodedPacketCumulativeBytesSize - [out] size of decoded packet cumulative data (in bytes) - number of packets = *pDecodedPacketCumulativeBytesSize / sizeof(DWORD)
//
// RETURN VALUE:
// S_OK on success, any other value on failure (see error codes above for reference)
////
STDAPI
XWMAEncoder(
__in_bcount(inputBufferSize) const BYTE* pInputBuffer,
__in DWORD inputBufferSize,
__in const WAVEFORMATEX* pInputFormat,
__in DWORD outputBitrate,
__deref_out_bcount(*pEncodedBufferSize) BYTE** ppEncodedBuffer,
__out DWORD* pEncodedBufferSize,
__deref_out_bcount(*pEncodedBufferFormatSize) WAVEFORMATEX** ppEncodedBufferFormat,
__out DWORD* pEncodedBufferFormatSize,
__deref_out_bcount(*pDecodedPacketCumulativeBytesSize) DWORD** ppDecodedPacketCumulativeBytes,
__out DWORD* pDecodedPacketCumulativeBytesSize
);
#endif // #ifndef _XWMAENCODER_H_

BIN
third_party/xbox_sdk/lib/xcompress32.dll vendored Normal file

Binary file not shown.

BIN
third_party/xbox_sdk/lib/xcompress32.lib vendored Normal file

Binary file not shown.

BIN
third_party/xbox_sdk/lib/xcompress64.dll vendored Normal file

Binary file not shown.

BIN
third_party/xbox_sdk/lib/xcompress64.lib vendored Normal file

Binary file not shown.

BIN
third_party/xna/lib/XnaNative.dll vendored Normal file

Binary file not shown.

3
tools/tools.pro Normal file
View File

@ -0,0 +1,3 @@
TEMPLATE = subdirs
SUBDIRS += zentry

BIN
tools/zentry/zentry.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

32
tools/zentry/zentry.pro Normal file
View File

@ -0,0 +1,32 @@
QT += core widgets gui multimedia
RC_ICONS = zentry.ico
SUBDIRS += zentry
CONFIG += c++17
SOURCES += \
zentrymain.cpp \
zentrywindow.cpp
HEADERS += \
zentrywindow.h
FORMS +=
app.depends += \
libs/compression
LIBS += \
-L$$OUT_PWD/../../libs/ -lcompression \
-L$$PWD/../../third_party/xbox_sdk/lib -lxcompress64
INCLUDEPATH += \
$$PWD/../../libs/compression \
$$PWD/../../third_party/xbox_sdk/include
DEPENDPATH += \
$$PWD/../../libs/compression \
$$PWD/../../third_party/xbox_sdk/include

View File

@ -0,0 +1,11 @@
#include "zentrywindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ZentryWindow w;
w.show();
return a.exec();
}

View File

@ -0,0 +1,118 @@
#include "zentrywindow.h"
#include "compression.h"
#include "qfiledialog.h"
#include <QMessageBox>
#include <QLabel>
#include <QFile>
#include <QVBoxLayout>
ZentryWindow::ZentryWindow(QWidget *parent)
: QMainWindow{parent} {
setWindowTitle("Zentry Tool");
setMinimumSize(250, 150);
setMaximumSize(250, 150);
setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
QLabel *dragLabel = new QLabel(this);
dragLabel->setText("Drop file here...");
dragLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
dragLabel->setStyleSheet("QLabel {"
" color: white;"
" background-color: grey;"
"}"
"QLabel::hover "
"{"
" background-color: black;"
"}");
setCentralWidget(dragLabel);
}
ZentryWindow::~ZentryWindow() {
}
void ZentryWindow::dragEnterEvent(QDragEnterEvent *event) {
const QMimeData *mimeData = event->mimeData();
bool goodDrag = true;
if (mimeData->hasUrls()) {
qDebug() << mimeData->urls();
} else {
goodDrag = false;
}
if (goodDrag) {
event->acceptProposedAction();
}
}
void ZentryWindow::dragMoveEvent(QDragMoveEvent *event) {
Q_UNUSED(event);
}
void ZentryWindow::dragLeaveEvent(QDragLeaveEvent *event) {
Q_UNUSED(event);
}
void ZentryWindow::dropEvent(QDropEvent *event) {
const QMimeData *mimeData = event->mimeData();
if (mimeData->hasUrls()) {
foreach (const QUrl &url, mimeData->urls()) {
const QString fileName = url.toString().split('/').last();
QMessageBox msgBox;
msgBox.setWindowTitle("Handle File");
msgBox.setText("Choose how to handle " + fileName);
QPushButton *compressButton = msgBox.addButton(tr("Compress"), QMessageBox::AcceptRole);
QPushButton *decompressButton = msgBox.addButton(tr("Decompress"), QMessageBox::RejectRole);
QPushButton *cancelButton = msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole);
msgBox.exec();
if ((QPushButton*)msgBox.clickedButton() == compressButton) {
// Compress
} else if ((QPushButton*)msgBox.clickedButton() == decompressButton) {
// Decompress
QFile compressedFile(url.toLocalFile());
if (!compressedFile.open(QIODevice::ReadOnly)) {
qDebug() << QString("Failed to open %1!").arg(fileName);
continue;
}
const QByteArray compressedData = compressedFile.readAll();
QByteArray decompressedData;
if (compressedData.left(2).toHex() == "7801") {
qDebug() << "Detected zlib data! (No Compression/low)";
decompressedData = Compression::DecompressZLIB(compressedData);
} else if (compressedData.left(2).toHex() == "785e") {
qDebug() << "Detected zlib data! (Fast Compression)";
decompressedData = Compression::DecompressZLIB(compressedData);
} else if (compressedData.left(2).toHex() == "789c") {
qDebug() << "Detected zlib data! (Default Compression)";
decompressedData = Compression::DecompressZLIB(compressedData);
} else if (compressedData.left(2).toHex() == "78da") {
qDebug() << "Detected zlib data! (Best Compression)";
decompressedData = Compression::DecompressZLIB(compressedData);
} else {
qDebug() << "Invalid zlib header!";
continue;
}
if (decompressedData.isEmpty()) {
qDebug() << "Zlib output was empty!";
continue;
}
const QString decompressedPath = QFileDialog::getSaveFileName(this, "Choose save name");
QFile decompressedFile(decompressedPath);
if (!decompressedFile.open(QIODevice::WriteOnly)) {
qDebug() << QString("Failed to open %1!").arg(decompressedPath.split('/').last());
continue;
}
decompressedFile.write(decompressedData);
decompressedFile.close();
} else if ((QPushButton*)msgBox.clickedButton() == cancelButton) {
// Cancel
}
}
}
}

View File

@ -0,0 +1,32 @@
#ifndef ZENTRYWINDOW_H
#define ZENTRYWINDOW_H
#include <QMainWindow>
#include <QDebug>
#include <QMimeData>
#include <QDragEnterEvent>
QT_BEGIN_NAMESPACE
namespace Ui {
class ZentryWindow;
}
QT_END_NAMESPACE
class ZentryWindow : public QMainWindow
{
Q_OBJECT
public:
ZentryWindow(QWidget *parent = nullptr);
~ZentryWindow();
protected:
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
void dropEvent(QDropEvent *event) override;
private:
Ui::ZentryWindow *ui;
};
#endif // ZENTRYWINDOW_H