Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Bagietka
2025-01-06 16:58:36 +01:00
77 changed files with 26533 additions and 1199 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ jobs:
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+1 -1
View File
@@ -59,7 +59,7 @@ and be sure to run clang-format!
## Contributors Wanted!
Have some spare time, know C++ and have knowledge about Windows internals,
and want to write code for the world's first Microsoft Xbox One compatiablity layer?
and want to write code for the world's first Microsoft Xbox One compatibility layer?
Contribute!
**For general rules and guidelines please see [CONTRIBUTING.md](docs/CONTRIBUTING.md).**
+70
View File
@@ -36,6 +36,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "dlls\common\common.vcxproj", "{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XFrontPanelDisplay", "dlls\XFrontPanelDisplay\XFrontPanelDisplay.vcxproj", "{4A5072B4-8304-4CC4-88C1-CF875110FF47}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@@ -440,6 +444,70 @@ Global
{6FD783E4-EA7E-40E6-8782-7C0E90CE6D7A}.ReleaseMD|x64.Build.0 = Release|x64
{6FD783E4-EA7E-40E6-8782-7C0E90CE6D7A}.ReleaseMD|x86.ActiveCfg = Release|Win32
{6FD783E4-EA7E-40E6-8782-7C0E90CE6D7A}.ReleaseMD|x86.Build.0 = Release|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|ARM.ActiveCfg = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|ARM.Build.0 = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|ARM64.ActiveCfg = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|ARM64.Build.0 = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|x64.ActiveCfg = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|x64.Build.0 = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|x86.ActiveCfg = Debug|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Debug|x86.Build.0 = Debug|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|ARM.ActiveCfg = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|ARM.Build.0 = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|ARM64.ActiveCfg = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|ARM64.Build.0 = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|x64.ActiveCfg = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|x64.Build.0 = Debug|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|x86.ActiveCfg = Debug|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.DebugMDd|x86.Build.0 = Debug|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|ARM.ActiveCfg = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|ARM.Build.0 = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|ARM64.ActiveCfg = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|ARM64.Build.0 = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|x64.ActiveCfg = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|x64.Build.0 = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|x86.ActiveCfg = Release|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.Release|x86.Build.0 = Release|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|ARM.ActiveCfg = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|ARM.Build.0 = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|ARM64.ActiveCfg = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|ARM64.Build.0 = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|x64.ActiveCfg = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|x64.Build.0 = Release|x64
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|x86.ActiveCfg = Release|Win32
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096}.ReleaseMD|x86.Build.0 = Release|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|ARM.ActiveCfg = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|ARM.Build.0 = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|ARM64.ActiveCfg = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|ARM64.Build.0 = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|x64.ActiveCfg = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|x64.Build.0 = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|x86.ActiveCfg = Debug|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Debug|x86.Build.0 = Debug|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|ARM.ActiveCfg = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|ARM.Build.0 = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|ARM64.ActiveCfg = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|ARM64.Build.0 = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|x64.ActiveCfg = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|x64.Build.0 = Debug|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|x86.ActiveCfg = Debug|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.DebugMDd|x86.Build.0 = Debug|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|ARM.ActiveCfg = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|ARM.Build.0 = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|ARM64.ActiveCfg = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|ARM64.Build.0 = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|x64.ActiveCfg = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|x64.Build.0 = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|x86.ActiveCfg = Release|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.Release|x86.Build.0 = Release|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|ARM.ActiveCfg = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|ARM.Build.0 = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|ARM64.ActiveCfg = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|ARM64.Build.0 = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|x64.ActiveCfg = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|x64.Build.0 = Release|x64
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|x86.ActiveCfg = Release|Win32
{4A5072B4-8304-4CC4-88C1-CF875110FF47}.ReleaseMD|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -457,6 +525,8 @@ Global
{A89A1631-2013-4642-B8A1-7AFE05D5A46B} = {BF759166-26A8-4B46-8423-8091158F2EA5}
{93628D69-C7A5-43E0-A6E7-AE920C666EB4} = {BF759166-26A8-4B46-8423-8091158F2EA5}
{6FD783E4-EA7E-40E6-8782-7C0E90CE6D7A} = {BF759166-26A8-4B46-8423-8091158F2EA5}
{DA57F1D7-7922-44CB-9251-4D0F7E5E4096} = {BF759166-26A8-4B46-8423-8091158F2EA5}
{4A5072B4-8304-4CC4-88C1-CF875110FF47} = {BF759166-26A8-4B46-8423-8091158F2EA5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {30EA489C-CFA4-4816-BE12-8BCE129039C5}
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+7 -1
View File
@@ -36,4 +36,10 @@ EXPORTS
;DllCanUnloadNow = MMDevAPI.DllCanUnloadNow @35
;DllGetClassObject = MMDevAPI.DllGetClassObject @36
;DllRegisterServer = MMDevAPI.DllRegisterServer @37
;DllUnregisterServer = MMDevAPI.DllUnregisterServer @38
;DllUnregisterServer = MMDevAPI.DllUnregisterServer @38
DllCanUnloadNow = DllCanUnloadNow_X
DllGetClassObject = DllGetClassObject_X
EnableSpatialAudio = EnableSpatialAudio_X
RefreshWasapiDeviceList = RefreshWasapiDeviceList_X
RestoreBitstreamOut = RestoreBitstreamOut_X
SetWasapiThreadAffinityMask = SetWasapiThreadAffinityMask_X
+15
View File
@@ -6,6 +6,11 @@ void ActivateAudioInterfaceAsync_X()
}
void DisableBitstreamOut_X()
{
}
void DllCanUnloadNow_X()
{
@@ -16,11 +21,21 @@ void DllGetClassObject_X()
}
void EnableSpatialAudio_X()
{
}
void RefreshWasapiDeviceList_X()
{
}
void RestoreBitstreamOut_X()
{
}
void SetWasapiThreadAffinityMask_X()
{
+10
View File
@@ -0,0 +1,10 @@
LIBRARY XFrontPanelDisplay
EXPORTS
XFrontPanelGetButtonStates = XFrontPanelGetButtonStates_X @1
XFrontPanelGetLightStates = XFrontPanelGetLightStates_X @2
XFrontPanelGetScreenDimensions = XFrontPanelGetScreenDimensions_X @3
XFrontPanelGetScreenPixelFormat = XFrontPanelGetScreenPixelFormat_X @4
XFrontPanelIsSupported = XFrontPanelIsSupported_X @5
XFrontPanelPresentBuffer = XFrontPanelPresentBuffer_X @6
XFrontPanelSetDisplayName = XFrontPanelSetDisplayName_X @7
XFrontPanelSetLightStates = XFrontPanelSetLightStates_X @8
@@ -0,0 +1,49 @@
#include "pch.h"
#include <cstdint>
#include <dxgiformat.h>
HRESULT __stdcall XFrontPanelGetButtonStates_X(uint32_t* buttons)
{
*buttons = 0;
return S_OK;
}
HRESULT __stdcall XFrontPanelGetLightStates_X(uint32_t* lights)
{
*lights = 0;
return S_OK;
}
HRESULT __stdcall XFrontPanelSetLightStates_X(uint32_t lights)
{
return S_OK;
}
HRESULT __stdcall XFrontPanelGetScreenDimensions_X(uint32_t* height, uint32_t* width)
{
// unixian: this replicates the front panel display that is on series console devkits, which is 256 x 64
*height = 64;
*width = 256;
return S_OK;
}
HRESULT __stdcall XFrontPanelGetScreenPixelFormat_X(DXGI_FORMAT* pixelFormat)
{
return E_NOTIMPL;
}
HRESULT __stdcall XFrontPanelSetDisplayName_X(const char* displayName)
{
return S_OK;
}
HRESULT __stdcall XFrontPanelPresentBuffer_X(uint32_t bufferSize, const uint8_t* buffer)
{
return E_NOTIMPL;
}
bool __stdcall XFrontPanelIsSupported_X()
{
return false;
}
@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{4a5072b4-8304-4cc4-88c1-cf875110ff47}</ProjectGuid>
<RootNamespace>XFrontPanelDisplay</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;XFRONTPANELDISPLAY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;XFRONTPANELDISPLAY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;XFRONTPANELDISPLAY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;XFRONTPANELDISPLAY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="XFrontPanelDisplay.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="Exports.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="XFrontPanelDisplay.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Exports.def">
<Filter>Source Files</Filter>
</None>
</ItemGroup>
</Project>
+19
View File
@@ -0,0 +1,19 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
+5
View File
@@ -0,0 +1,5 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
+5
View File
@@ -0,0 +1,5 @@
// pch.cpp: source file corresponding to the pre-compiled header
#include "pch.h"
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
+13
View File
@@ -0,0 +1,13 @@
// pch.h: This is a precompiled header file.
// Files listed below are compiled only once, improving build performance for future builds.
// This also affects IntelliSense performance, including code completion and many code browsing features.
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
// Do not add files here that you will be updating frequently as this negates the performance advantage.
#ifndef PCH_H
#define PCH_H
// add headers that you want to pre-compile here
#include "framework.h"
#endif //PCH_H
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+1
View File
@@ -0,0 +1 @@
[kernelx]
+3
View File
@@ -0,0 +1,3 @@
LIBRARY common
EXPORTS
XMemAlloc = XMemAlloc_X @504
+1
View File
@@ -0,0 +1 @@
#pragma once
+164
View File
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{da57f1d7-7922-44cb-9251-4d0f7e5e4096}</ProjectGuid>
<RootNamespace>common</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;COMMON_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;COMMON_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;COMMON_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;COMMON_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="common.h" />
<ClInclude Include="logfmtxx.hpp" />
<ClInclude Include="toml.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="Config.toml" />
<None Include="Exports.def.bak" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="Exports.def.bak" />
<None Include="Config.toml" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="common.h" />
<ClInclude Include="toml.hpp" />
<ClInclude Include="logfmtxx.hpp" />
</ItemGroup>
</Project>
+9
View File
@@ -0,0 +1,9 @@
#include <Windows.h>
#include "logfmtxx.hpp"
#include "toml.hpp"
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
+177
View File
@@ -0,0 +1,177 @@
#pragma once
#pragma once
#include <type_traits>
#include <concepts>
#include <functional>
#include <utility>
#include <chrono>
#include <vector>
#include <iomanip>
#include <sstream>
#include <string>
namespace logfmtxx {
enum class level {
debug,
info,
warn,
error
};
namespace details {
template <typename T>
concept as_string_trait = requires(T t) {
{ t.as_string( ) } -> std::same_as<std::string>;
};
template <typename T>
concept serializable_trait = (
std::is_convertible_v<T, std::string>
|| as_string_trait<T>
|| std::is_arithmetic_v<T>
|| std::is_same_v<T, std::chrono::system_clock::time_point>
|| std::is_same_v<T, level>
);
template <serializable_trait T>
std::string serialize(const T& value) {
if constexpr (std::is_convertible_v<T, std::string>) {
auto stream = std::ostringstream{};
stream << std::quoted(value);
return stream.str( );
}
else if constexpr (as_string_trait<T>) {
auto stream = std::ostringstream{};
stream << std::quoted(value.as_string( ));
return stream.str( );
}
else if constexpr (std::is_arithmetic_v<T>) {
return std::to_string(value);
}
else if constexpr (std::is_same_v<T, std::chrono::system_clock::time_point>) {
auto time = std::chrono::system_clock::to_time_t(value);
auto stream = std::ostringstream{};
stream << std::put_time(std::gmtime(&time), "%Y-%m-%dT%H:%M:%SZ");
return stream.str( );
}
else if constexpr (std::is_same_v<T, level>) {
switch (value) {
case level::debug: return "debug";
case level::info: return "info";
case level::warn: return "warn";
case level::error: return "error";
}
}
return "";
}
using field_kv_type = std::pair<std::string, std::string>;
struct record {
level lvl;
std::chrono::system_clock::time_point ts;
std::string msg;
field_kv_type* global_ctx;
std::size_t global_ctx_size;
field_kv_type* local_ctx;
std::size_t local_ctx_size;
};
}
template <details::serializable_trait T>
struct field {
std::string key;
T value;
};
template <typename T>
concept printer_trait = requires(T t, const std::string & msg) {
{ t(msg) };
};
template <
typename clock_type = std::chrono::system_clock,
printer_trait printer_type = std::function<void(const std::string&)>
>
class logger {
public:
template <typename... Args>
logger(
printer_type printer,
field<Args>... fields
) : m_printer(printer) {
m_extras.reserve(sizeof...(Args));
(m_extras.push_back({ fields.key, details::serialize(fields.value) }), ...);
}
template <typename... Args>
void log(level level, const std::string& message, field<Args>... fields) {
auto record = details::record{
.lvl = level,
.ts = clock_type::now( ),
.msg = message,
.global_ctx = m_extras.data( ),
.global_ctx_size = m_extras.size( )
};
std::array<details::field_kv_type, sizeof...(Args)> local_ctx = {
details::field_kv_type{fields.key, details::serialize(fields.value)}...
};
record.local_ctx = local_ctx.data( );
record.local_ctx_size = local_ctx.size( );
m_printer(format(record));
}
template <typename... Args>
void debug(const std::string& message, field<Args>... fields) {
log(level::debug, message, fields...);
}
template <typename... Args>
void info(const std::string& message, field<Args>... fields) {
log(level::info, message, fields...);
}
template <typename... Args>
void warn(const std::string& message, field<Args>... fields) {
log(level::warn, message, fields...);
}
template <typename... Args>
void error(const std::string& message, field<Args>... fields) {
log(level::error, message, fields...);
}
private:
std::string format(const details::record& record) {
auto stream = std::ostringstream{};
stream << "time=" << details::serialize(record.ts) << " ";
stream << "level=" << details::serialize(record.lvl) << " ";
stream << "message=" << std::quoted(record.msg);
for (auto i = 0; i < record.global_ctx_size; ++i) {
const auto& [key, value] = record.global_ctx[ i ];
stream << " " << key << "=" << value;
}
for (auto i = 0; i < record.local_ctx_size; ++i) {
const auto& [key, value] = record.local_ctx[ i ];
stream << " " << key << "=" << value;
}
return stream.str( );
}
private:
printer_type m_printer;
std::vector<details::field_kv_type> m_extras;
};
}
+17897
View File
File diff suppressed because it is too large Load Diff
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+3 -3
View File
@@ -3,9 +3,9 @@ EXPORTS
D3DQuerySEQCounters = D3DQuerySEQCounters_X @1
D3DUploadCustomMicrocode = D3DUploadCustomMicrocode_X @2
D3D10CreateBlob = d3d10.D3D10CreateBlob @3
D3D11CreateDevice = d3d11.D3D11CreateDevice @4
D3D11CreateDeviceAndSwapChain = d3d11.D3D11CreateDeviceAndSwapChain @5
D3D11XCreateDeviceX = d3d11.D3D11CreateDevice @6
D3D11CreateDevice = D3D11CreateDevice_X @4
D3D11CreateDeviceAndSwapChain = D3D11CreateDeviceAndSwapChain_X @5
D3D11XCreateDeviceX = D3D11XCreateDeviceX_X @6
D3D11XCreateDeviceXAndSwapChain1 = D3D11XCreateDeviceXAndSwapChain1_X @7
D3DAllocateGraphicsMemory = D3DAllocateGraphicsMemory_X @8
D3DConfigureVirtualMemory = D3DConfigureVirtualMemory_X @9
@@ -0,0 +1 @@
#include "pch.h"
+95
View File
@@ -0,0 +1,95 @@
#include "pch.h"
#include "ID3DWrappers.h"
namespace d3d11x
{
HRESULT ID3D11Texture2DWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(::ID3D11Texture2D))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
else
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
}
return m_realTexture->QueryInterface(riid, ppvObject);
}
ULONG ID3D11Texture2DWrapper::AddRef( )
{
return InterlockedIncrement(&m_RefCount);
}
ULONG ID3D11Texture2DWrapper::Release( )
{
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (refCount == 0)
delete this;
return refCount;
}
// @Patoke todo: unwrap?
void __stdcall ID3D11Texture2DWrapper::GetDevice(ID3D11Device** ppDevice)
{
// Probably not necessary but just to be sure -AleBlbl
::ID3D11Device** device = nullptr;
this->m_realTexture->GetDevice(device);
ppDevice = reinterpret_cast<ID3D11Device**>(ppDevice);
}
HRESULT __stdcall ID3D11Texture2DWrapper::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_realTexture->GetPrivateData(guid, pDataSize, pData);
}
HRESULT __stdcall ID3D11Texture2DWrapper::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_realTexture->SetPrivateData(guid, DataSize, pData);
}
HRESULT __stdcall ID3D11Texture2DWrapper::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_realTexture->SetPrivateDataInterface(guid, pData);
}
HRESULT __stdcall ID3D11Texture2DWrapper::SetName(const wchar_t* name)
{
printf("[ID3D11Texture2DWrapper]: SetName STUB\n");
return S_OK;
}
void __stdcall ID3D11Texture2DWrapper::GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension)
{
return m_realTexture->GetType(pResourceDimension);
}
void __stdcall ID3D11Texture2DWrapper::SetEvictionPriority(UINT EvictionPriority)
{
return m_realTexture->SetEvictionPriority(EvictionPriority);
}
UINT __stdcall ID3D11Texture2DWrapper::GetEvictionPriority(void)
{
return m_realTexture->GetEvictionPriority();
}
void __stdcall ID3D11Texture2DWrapper::GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor)
{
printf("[ID3D11Texture2DWrapper]: GetDescriptor STUB\n");
}
void __stdcall ID3D11Texture2DWrapper::GetDesc(D3D11_TEXTURE2D_DESC* pDesc)
{
return m_realTexture->GetDesc(pDesc);
}
}
File diff suppressed because it is too large Load Diff
+54
View File
@@ -0,0 +1,54 @@
#pragma once
#include "ID3DX.h"
#include "ID3DDeviceContext.h"
#include <array>
namespace d3d11x
{
struct D3D11X_TESSELLATION_PARAMETERS;
struct D3D11X_THREAD_TRACE_DESC;
struct D3D11X_GRAPHICS_SHADER_LIMITS;
struct D3D11X_COMPUTE_SHADER_LIMITS;
struct D3D11X_GS_PARAMETERS;
struct _D3D11X_MSAA_SCAN_CONVERTER_SETTINGS;
struct _D3D11X_MSAA_EQAA_SETTINGS;
struct _D3D11X_MSAA_SAMPLE_PRIORITIES;
struct _D3D11X_MSAA_SAMPLE_POSITIONS;
class ID3D11Texture2DWrapper : public ID3D11Texture2D_X
{
public:
ID3D11Texture2D* m_realTexture;
ID3D11Texture2DWrapper(::ID3D11Texture2D* tex) : m_realTexture(tex)
{
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// ID3D11DeviceChild
void STDMETHODCALLTYPE GetDevice(_Outptr_ ID3D11Device** ppDevice) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID guid, _Inout_ UINT* pDataSize,_Out_writes_bytes_opt_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID guid,_In_ UINT DataSize,_In_reads_bytes_opt_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID guid,_In_opt_ const IUnknown* pData) override;
HRESULT STDMETHODCALLTYPE SetName(const wchar_t* name) override;
// ID3D11Resource
void STDMETHODCALLTYPE GetType(_Out_ D3D11_RESOURCE_DIMENSION* pResourceDimension) override;
void STDMETHODCALLTYPE SetEvictionPriority(_In_ UINT EvictionPriority) override;
UINT STDMETHODCALLTYPE GetEvictionPriority(void) override;
void STDMETHODCALLTYPE GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor) override;
// ID3D11Texture2D
void STDMETHODCALLTYPE GetDesc(_Out_ D3D11_TEXTURE2D_DESC* pDesc) override;
};
}
+81
View File
@@ -0,0 +1,81 @@
#pragma once
#include "pch.h"
#include "d3d_x/d3d11_x_device.h"
#include "d3d_x/d3d_x.hpp"
namespace d3d11x
{
struct ID3D11DeviceChild_X : public IGraphicsUnknown
{
public: ID3D11Device* m_pDevice;
public: void* m_pPrivateData;
virtual void STDMETHODCALLTYPE GetDevice(
/* [annotation] */
_Outptr_ ID3D11Device * *ppDevice) PURE;
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
/* [annotation] */
_In_ REFGUID guid,
/* [annotation] */
_Inout_ UINT* pDataSize,
/* [annotation] */
_Out_writes_bytes_opt_(*pDataSize) void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
/* [annotation] */
_In_ REFGUID guid,
/* [annotation] */
_In_ UINT DataSize,
/* [annotation] */
_In_reads_bytes_opt_(DataSize) const void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
/* [annotation] */
_In_ REFGUID guid,
/* [annotation] */
_In_opt_ const IUnknown* pData) PURE;
// Xbox Extra functions:
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterfaceGraphics(const _GUID& name, const IGraphicsUnknown* data)
{
return SetPrivateDataInterface(name, reinterpret_cast<IUnknown const*>(data));
}
virtual HRESULT STDMETHODCALLTYPE SetName(const wchar_t* name) PURE;
};
struct ID3D11Resource_X : public ID3D11DeviceChild_X
{
virtual void STDMETHODCALLTYPE GetType(
/* [annotation] */
_Out_ D3D11_RESOURCE_DIMENSION * pResourceDimension) PURE;
virtual void STDMETHODCALLTYPE SetEvictionPriority(
/* [annotation] */
_In_ UINT EvictionPriority) PURE;
virtual UINT STDMETHODCALLTYPE GetEvictionPriority(void) PURE;
// xbox extra function
virtual void STDMETHODCALLTYPE GetDescriptor(D3D11X_DESCRIPTOR_RESOURCE* descriptor) PURE;
};
struct ID3D11Texture2D_X : public ID3D11Resource_X
{
virtual void STDMETHODCALLTYPE GetDesc(
/* [annotation] */
_Out_ D3D11_TEXTURE2D_DESC * pDesc) PURE;
};
}
+285
View File
@@ -0,0 +1,285 @@
#pragma once
#include "pch.h"
#include "d3d_x/d3d11_x_device.h"
#include "d3d_x/d3d_x.hpp"
#include <typeinfo>
namespace d3d11x
{
struct IDXGISwapChain1_X;
//MIDL_INTERFACE("aec22fb8-76f3-4639-9be0-28eb43a67a2e")
struct IDXGIObject_X : public IGraphicsUnknown
{
/* 0x0000: fields for IGraphicsUnknown */
/* 0x0010 */ public: void* m_pPrivateData;
public:
virtual HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) PURE;
/*virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterfaceGraphics(_In_ REFGUID Name, const IGraphicsUnknown* data)
{
return this->SetPrivateDataInterface(Name, reinterpret_cast<IUnknown const*>(data));
}*/
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) PURE;
virtual HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) PURE;
};
// Adapted to Xbox one (look at pdb)
//MIDL_INTERFACE("7b7166ec-21c7-44ae-b21a-c9ae321ae369")
struct IDXGIFactory_X : public IDXGIObject_X
{
public:
/* 0x0000: fields for IDXGIObject */
/* 0x0018 */ public: IDXGIAdapter2* m_pAdapter;
virtual HRESULT STDMETHODCALLTYPE EnumAdapters(
UINT Adapter,
IDXGIAdapter** ppAdapter) PURE;
virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation(
HWND WindowHandle,
UINT Flags) PURE;
virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation(
HWND* pWindowHandle) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChain(
IGraphicsUnknown* pDevice,
DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(
HMODULE Module,
IDXGIAdapter** ppAdapter) PURE;
};
// Adapted to Xbox one (look at pdb)
//MIDL_INTERFACE("770aae78-f26f-4dba-a829-253c83d1b387")
struct IDXGIFactory1_X : public IDXGIFactory_X
{
public:
virtual HRESULT STDMETHODCALLTYPE EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter) PURE;
virtual BOOL STDMETHODCALLTYPE IsCurrent(void) PURE;
};
// Adapted to Xbox one (look at pdb)
//MIDL_INTERFACE("50c83a1c-e072-4c48-87b0-3630fa36a6d0")
struct IDXGIFactory2_X : public IDXGIFactory1_X
{
public:
virtual BOOL STDMETHODCALLTYPE IsWindowedStereoEnabled(void) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(IGraphicsUnknown* pDevice,
HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForCoreWindow(
IGraphicsUnknown* pDevice,
IUnknown* pWindow,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1_X** ppSwapChain) PURE;
virtual HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(
HANDLE hResource,
LUID* pLuid) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) PURE;
virtual void STDMETHODCALLTYPE UnregisterStereoStatus(
DWORD dwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) PURE;
virtual void STDMETHODCALLTYPE UnregisterOcclusionStatus(
DWORD dwCookie) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForComposition(
IGraphicsUnknown* pDevice,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) PURE;
};
struct IDXGIAdapter_X : IDXGIObject_X
{
virtual HRESULT STDMETHODCALLTYPE EnumOutputs(UINT Output, IDXGIOutput** ppOutput) PURE;
virtual HRESULT STDMETHODCALLTYPE GetDesc(DXGI_ADAPTER_DESC* pDesc) PURE;
virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion) PURE;
};
struct IDXGIDevice_X : d3d11x::IDXGIObject_X
{
virtual HRESULT STDMETHODCALLTYPE GetAdapter(IDXGIAdapter_X** pAdapter) PURE;
virtual HRESULT STDMETHODCALLTYPE CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage,
const DXGI_SHARED_RESOURCE* pSharedResource,
_Out_writes_(NumSurfaces) IDXGISurface** ppSurface) PURE;
virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency(
_In_reads_(NumResources) IGraphicsUnknown** ppResources,
_Out_writes_(NumResources) DXGI_RESIDENCY* pResidencyStatus,
/* [in] */ UINT NumResources) PURE;
virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
/* [in] */ INT Priority) PURE;
virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
_Out_ INT* pPriority) PURE;
};
struct IDXGIDeviceSubObject_X : public IDXGIObject_X
{
public:
virtual HRESULT STDMETHODCALLTYPE GetDevice(
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][retval][out] */
_COM_Outptr_ void** ppDevice) = 0;
};
struct IDXGISwapChain_X : public IDXGIDeviceSubObject_X
{
virtual HRESULT STDMETHODCALLTYPE Present(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT Flags) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBuffer(
/* [in] */ UINT Buffer,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][out][in] */
_COM_Outptr_ void** ppSurface) = 0;
virtual HRESULT STDMETHODCALLTYPE SetFullscreenState(
/* [in] */ BOOL Fullscreen,
/* [annotation][in] */
_In_opt_ IDXGIOutput* pTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFullscreenState(
/* [annotation][out] */
_Out_opt_ BOOL* pFullscreen,
/* [annotation][out] */
_COM_Outptr_opt_result_maybenull_ IDXGIOutput** ppTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeBuffers(
/* [in] */ UINT BufferCount,
/* [in] */ UINT Width,
/* [in] */ UINT Height,
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeTarget(
/* [annotation][in] */
_In_ const DXGI_MODE_DESC* pNewTargetParameters) = 0;
virtual HRESULT STDMETHODCALLTYPE GetContainingOutput(
/* [annotation][out] */
_COM_Outptr_ IDXGIOutput** ppOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics(
/* [annotation][out] */
_Out_ DXGI_FRAME_STATISTICS* pStats) = 0;
virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount(
/* [annotation][out] */
_Out_ UINT* pLastPresentCount) = 0;
};
struct IDXGISwapChain1_X : public IDXGISwapChain_X
{
virtual HRESULT STDMETHODCALLTYPE GetDesc1(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC1 * pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFullscreenDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetHwnd(
/* [annotation][out] */
_Out_ HWND* pHwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCoreWindow(
/* [annotation][in] */
_In_ REFIID refiid,
/* [annotation][out] */
_COM_Outptr_ void** ppUnk) = 0;
virtual HRESULT STDMETHODCALLTYPE Present1(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT PresentFlags,
/* [annotation][in] */
_In_ const DXGI_PRESENT_PARAMETERS* pPresentParameters) = 0;
virtual BOOL STDMETHODCALLTYPE IsTemporaryMonoSupported(void) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRestrictToOutput(
/* [annotation][out] */
_Out_ IDXGIOutput** ppRestrictToOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE SetBackgroundColor(
/* [annotation][in] */
_In_ const DXGI_RGBA* pColor) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBackgroundColor(
/* [annotation][out] */
_Out_ DXGI_RGBA* pColor) = 0;
virtual HRESULT STDMETHODCALLTYPE SetRotation(
/* [annotation][in] */
_In_ DXGI_MODE_ROTATION Rotation) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRotation(
/* [annotation][out] */
_Out_ DXGI_MODE_ROTATION* pRotation) = 0;
};
}
+91
View File
@@ -0,0 +1,91 @@
#include "pch.h"
#include "IDXGIWrappers.h"
namespace d3d11x
{
HRESULT IDXGIAdapterWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGIAdapter))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
else
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
}
return m_realAdapter->QueryInterface(riid, ppvObject);
}
ULONG IDXGIAdapterWrapper::AddRef( )
{
return InterlockedIncrement(&m_refCount);
}
ULONG IDXGIAdapterWrapper::Release( )
{
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGIAdapterWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realAdapter->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGIAdapterWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realAdapter->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGIAdapterWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realAdapter->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGIAdapterWrapper::GetParent(REFIID riid, void** ppParent)
{
if (riid == __uuidof(IDXGIFactory) ||
riid == __uuidof(IDXGIFactory1) ||
riid == __uuidof(IDXGIFactory2))
{
IDXGIFactory2* factory = nullptr;
HRESULT hr = m_realAdapter->GetParent(IID_PPV_ARGS(&factory));
*ppParent = new IDXGIFactoryWrapper(factory);
this->AddRef( );
return hr;
}
*ppParent = nullptr;
return E_NOINTERFACE;
}
HRESULT __stdcall IDXGIAdapterWrapper::EnumOutputs(UINT Output, IDXGIOutput** ppOutput)
{
return m_realAdapter->EnumOutputs(Output, ppOutput);
}
HRESULT __stdcall IDXGIAdapterWrapper::GetDesc(DXGI_ADAPTER_DESC* pDesc)
{
return m_realAdapter->GetDesc(pDesc);
}
HRESULT __stdcall IDXGIAdapterWrapper::CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion)
{
return m_realAdapter->CheckInterfaceSupport(InterfaceName, pUMDVersion);
}
}
+97
View File
@@ -0,0 +1,97 @@
#include "pch.h"
#include "IDXGIWrappers.h"
namespace d3d11x
{
HRESULT IDXGIDeviceWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGIDevice))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
else
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
}
return m_realDevice->QueryInterface(riid, ppvObject);
}
ULONG IDXGIDeviceWrapper::AddRef( )
{
return InterlockedIncrement(&m_refCount);
}
ULONG IDXGIDeviceWrapper::Release( )
{
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGIDeviceWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realDevice->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGIDeviceWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realDevice->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGIDeviceWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realDevice->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGIDeviceWrapper::GetParent(REFIID riid, void** ppParent)
{
// this should probably check if fails -AleBlbl
HRESULT hr = m_realDevice->GetParent(riid, ppParent);
this->AddRef( );
return hr;
}
HRESULT __stdcall IDXGIDeviceWrapper::GetAdapter(IDXGIAdapter_X** pAdapter)
{
IDXGIAdapter* adapter;
HRESULT hr = m_realDevice->GetAdapter(&adapter);
*pAdapter = new IDXGIAdapterWrapper(adapter);
return hr;
}
HRESULT __stdcall IDXGIDeviceWrapper::CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage, const DXGI_SHARED_RESOURCE* pSharedResource, IDXGISurface** ppSurface)
{
return m_realDevice->CreateSurface(pDesc, NumSurfaces, Usage, pSharedResource, ppSurface);
}
HRESULT __stdcall IDXGIDeviceWrapper::QueryResourceResidency(IGraphicsUnknown** ppResources, DXGI_RESIDENCY* pResidencyStatus, UINT NumResources)
{
return m_realDevice->QueryResourceResidency(reinterpret_cast<IUnknown**>(ppResources), pResidencyStatus, NumResources);
}
HRESULT __stdcall IDXGIDeviceWrapper::SetGPUThreadPriority(INT Priority)
{
return m_realDevice->SetGPUThreadPriority(Priority);
}
HRESULT __stdcall IDXGIDeviceWrapper::GetGPUThreadPriority(INT* pPriority)
{
return m_realDevice->GetGPUThreadPriority(pPriority);
}
}
+166
View File
@@ -0,0 +1,166 @@
#include "pch.h"
#include "IDXGIWrappers.h"
#include "ID3DWrappers.h"
#include <windows.ui.core.h>
#include "../kernelx/CoreWindowWrapperX.h"
namespace d3d11x
{
HRESULT d3d11x::IDXGIFactoryWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGIFactory) ||
riid == __uuidof(IDXGIFactory1) ||
riid == __uuidof(IDXGIFactory2))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
else
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIFactoryWrapper] QueryInterface: %s\n", iidstr);
}
return m_realFactory->QueryInterface(riid, ppvObject);
}
ULONG IDXGIFactoryWrapper::AddRef( )
{
return InterlockedIncrement(&m_refCount);
}
ULONG IDXGIFactoryWrapper::Release( )
{
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGIFactoryWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realFactory->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGIFactoryWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realFactory->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGIFactoryWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realFactory->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGIFactoryWrapper::GetParent(REFIID riid, void** ppParent)
{
return m_realFactory->GetParent(riid, ppParent);
}
HRESULT __stdcall IDXGIFactoryWrapper::EnumAdapters(UINT Adapter, IDXGIAdapter** ppAdapter)
{
return m_realFactory->EnumAdapters(Adapter, ppAdapter);
}
HRESULT __stdcall IDXGIFactoryWrapper::MakeWindowAssociation(HWND WindowHandle, UINT Flags)
{
return m_realFactory->MakeWindowAssociation(WindowHandle, Flags);
}
HRESULT __stdcall IDXGIFactoryWrapper::GetWindowAssociation(HWND* pWindowHandle)
{
return m_realFactory->GetWindowAssociation(pWindowHandle);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChain(IGraphicsUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain)
{
return m_realFactory->CreateSwapChain(reinterpret_cast<IUnknown*>(pDevice), pDesc, ppSwapChain);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSoftwareAdapter(HMODULE Module, IDXGIAdapter** ppAdapter)
{
return m_realFactory->CreateSoftwareAdapter(Module, ppAdapter);
}
HRESULT __stdcall IDXGIFactoryWrapper::EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter)
{
return m_realFactory->EnumAdapters1(Adapter, ppAdapter);
}
BOOL __stdcall IDXGIFactoryWrapper::IsCurrent(void)
{
return m_realFactory->IsCurrent( );
}
BOOL __stdcall IDXGIFactoryWrapper::IsWindowedStereoEnabled(void)
{
return m_realFactory->IsWindowedStereoEnabled( );
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChainForHwnd(IGraphicsUnknown* pDevice, HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain)
{
return m_realFactory->CreateSwapChainForHwnd(reinterpret_cast<IUnknown*>(pDevice), hWnd, pDesc, pFullscreenDesc, pRestrictToOutput, ppSwapChain);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChainForCoreWindow(IGraphicsUnknown* pDevice, IUnknown* pWindow, const DXGI_SWAP_CHAIN_DESC1* pDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1_X** ppSwapChain)
{
IDXGISwapChain1* swap = nullptr;
HRESULT hr = m_realFactory->CreateSwapChainForCoreWindow(reinterpret_cast<IUnknown*>(pDevice), reinterpret_cast<CoreWindowWrapperX*>(pWindow)->m_realWindow, pDesc, pRestrictToOutput, &swap);
*ppSwapChain = new IDXGISwapChainWrapper(swap);
return hr;
}
HRESULT __stdcall IDXGIFactoryWrapper::GetSharedResourceAdapterLuid(HANDLE hResource, LUID* pLuid)
{
return m_realFactory->GetSharedResourceAdapterLuid(hResource, pLuid);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterStereoStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie)
{
return m_realFactory->RegisterStereoStatusWindow(WindowHandle, wMsg, pdwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterStereoStatusEvent(HANDLE hEvent, DWORD* pdwCookie)
{
return m_realFactory->RegisterStereoStatusEvent(hEvent, pdwCookie);
}
void __stdcall IDXGIFactoryWrapper::UnregisterStereoStatus(DWORD dwCookie)
{
return m_realFactory->UnregisterStereoStatus(dwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterOcclusionStatusWindow(HWND WindowHandle, UINT wMsg, DWORD* pdwCookie)
{
return m_realFactory->RegisterOcclusionStatusWindow(WindowHandle, wMsg, pdwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::RegisterOcclusionStatusEvent(HANDLE hEvent, DWORD* pdwCookie)
{
return m_realFactory->RegisterOcclusionStatusEvent(hEvent, pdwCookie);
}
void __stdcall IDXGIFactoryWrapper::UnregisterOcclusionStatus(DWORD dwCookie)
{
return m_realFactory->UnregisterOcclusionStatus(dwCookie);
}
HRESULT __stdcall IDXGIFactoryWrapper::CreateSwapChainForComposition(IGraphicsUnknown* pDevice, const DXGI_SWAP_CHAIN_DESC1* pDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain)
{
return m_realFactory->CreateSwapChainForComposition(reinterpret_cast<IUnknown*>(pDevice), pDesc, pRestrictToOutput, ppSwapChain);
}
}
+182
View File
@@ -0,0 +1,182 @@
#include "pch.h"
#include "IDXGIWrappers.h"
#include "ID3DWrappers.h"
namespace d3d11x
{
HRESULT IDXGISwapChainWrapper::QueryInterface(REFIID riid, void** ppvObject)
{
if (riid == __uuidof(IDXGISwapChain1) || riid == __uuidof(IDXGISwapChain))
{
*ppvObject = this;
AddRef( );
return S_OK;
}
else
{
// DEBUG
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[IDXGIDeviceWrapper] QueryInterface: %s\n", iidstr);
}
return m_realSwapchain->QueryInterface(riid, ppvObject);
}
ULONG IDXGISwapChainWrapper::AddRef( )
{
return InterlockedIncrement(&m_refCount);
}
ULONG IDXGISwapChainWrapper::Release( )
{
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT __stdcall IDXGISwapChainWrapper::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_realSwapchain->SetPrivateData(Name, DataSize, pData);
}
HRESULT __stdcall IDXGISwapChainWrapper::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_realSwapchain->SetPrivateDataInterface(Name, pUnknown);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_realSwapchain->GetPrivateData(Name, pDataSize, pData);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetParent(REFIID riid, void** ppParent)
{
return m_realSwapchain->GetParent(riid, ppParent);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetDevice(REFIID riid, void** ppDevice)
{
return m_realSwapchain->GetDevice(riid, ppDevice);
}
HRESULT __stdcall IDXGISwapChainWrapper::Present(UINT SyncInterval, UINT Flags)
{
return m_realSwapchain->Present(SyncInterval, Flags);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetBuffer(UINT Buffer, REFIID riid, void** ppSurface)
{
if (riid == __uuidof(ID3D11Texture2D))
{
ID3D11Texture2D* texture2d = nullptr;
HRESULT hr = m_realSwapchain->GetBuffer(Buffer, IID_PPV_ARGS(&texture2d));
*ppSurface = new ID3D11Texture2DWrapper(texture2d);
this->AddRef( );
return hr;
}
*ppSurface = nullptr;
return E_NOINTERFACE;
}
HRESULT __stdcall IDXGISwapChainWrapper::SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget)
{
return m_realSwapchain->SetFullscreenState(Fullscreen, pTarget);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget)
{
return m_realSwapchain->GetFullscreenState(pFullscreen, ppTarget);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc)
{
return m_realSwapchain->GetDesc(pDesc);
}
HRESULT __stdcall IDXGISwapChainWrapper::ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{
return m_realSwapchain->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags);
}
HRESULT __stdcall IDXGISwapChainWrapper::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters)
{
return m_realSwapchain->ResizeTarget(pNewTargetParameters);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetContainingOutput(IDXGIOutput** ppOutput)
{
return m_realSwapchain->GetContainingOutput(ppOutput);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats)
{
return m_realSwapchain->GetFrameStatistics(pStats);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetLastPresentCount(UINT* pLastPresentCount)
{
return m_realSwapchain->GetLastPresentCount(pLastPresentCount);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetDesc1(DXGI_SWAP_CHAIN_DESC1* pDesc)
{
return m_realSwapchain->GetDesc1(pDesc);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc)
{
return m_realSwapchain->GetFullscreenDesc(pDesc);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetHwnd(HWND* pHwnd)
{
return m_realSwapchain->GetHwnd(pHwnd);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetCoreWindow(REFIID refiid, void** ppUnk)
{
return m_realSwapchain->GetCoreWindow(refiid, ppUnk);
}
HRESULT __stdcall IDXGISwapChainWrapper::Present1(UINT SyncInterval, UINT PresentFlags, const DXGI_PRESENT_PARAMETERS* pPresentParameters)
{
return m_realSwapchain->Present1(SyncInterval, PresentFlags, pPresentParameters);
}
BOOL __stdcall IDXGISwapChainWrapper::IsTemporaryMonoSupported(void)
{
return m_realSwapchain->IsTemporaryMonoSupported();
}
HRESULT __stdcall IDXGISwapChainWrapper::GetRestrictToOutput(IDXGIOutput** ppRestrictToOutput)
{
return m_realSwapchain->GetRestrictToOutput(ppRestrictToOutput);
}
HRESULT __stdcall IDXGISwapChainWrapper::SetBackgroundColor(const DXGI_RGBA* pColor)
{
return m_realSwapchain->SetBackgroundColor(pColor);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetBackgroundColor(DXGI_RGBA* pColor)
{
return m_realSwapchain->GetBackgroundColor(pColor);
}
HRESULT __stdcall IDXGISwapChainWrapper::SetRotation(DXGI_MODE_ROTATION Rotation)
{
return m_realSwapchain->SetRotation(Rotation);
}
HRESULT __stdcall IDXGISwapChainWrapper::GetRotation(DXGI_MODE_ROTATION* pRotation)
{
return m_realSwapchain->GetRotation(pRotation);
}
}
+326
View File
@@ -0,0 +1,326 @@
#pragma once
#include "IDXGI.h"
namespace d3d11x
{
class IDXGIFactoryWrapper : public d3d11x::IDXGIFactory2_X
{
public:
IDXGIFactoryWrapper(IDXGIFactory2* factory) : m_realFactory(factory)
{
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
// IDXGIFactory
HRESULT STDMETHODCALLTYPE EnumAdapters(
UINT Adapter,
IDXGIAdapter** ppAdapter) override;
HRESULT STDMETHODCALLTYPE MakeWindowAssociation(
HWND WindowHandle,
UINT Flags) override;
HRESULT STDMETHODCALLTYPE GetWindowAssociation(
HWND* pWindowHandle) override;
HRESULT STDMETHODCALLTYPE CreateSwapChain(
IGraphicsUnknown* pDevice,
DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain) override;
HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(
HMODULE Module,
IDXGIAdapter** ppAdapter) override;
// IDXGIFactory1
HRESULT STDMETHODCALLTYPE EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter) override;
BOOL STDMETHODCALLTYPE IsCurrent(void) override;
// IDXGIFactory2
BOOL STDMETHODCALLTYPE IsWindowedStereoEnabled(void) override;
HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(IGraphicsUnknown* pDevice,
HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) override;
HRESULT STDMETHODCALLTYPE CreateSwapChainForCoreWindow(
IGraphicsUnknown* pDevice,
IUnknown* pWindow,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1_X** ppSwapChain) override;
HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(
HANDLE hResource,
LUID* pLuid) override;
HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) override;
HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) override;
void STDMETHODCALLTYPE UnregisterStereoStatus(
DWORD dwCookie) override;
HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(
HWND WindowHandle,
UINT wMsg,
DWORD* pdwCookie) override;
HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusEvent(
HANDLE hEvent,
DWORD* pdwCookie) override;
void STDMETHODCALLTYPE UnregisterOcclusionStatus(
DWORD dwCookie) override;
HRESULT STDMETHODCALLTYPE CreateSwapChainForComposition(
IGraphicsUnknown* pDevice,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) override;
private:
long m_refCount = 1;
::IDXGIFactory2* m_realFactory;
};
class IDXGIAdapterWrapper : public IDXGIAdapter_X
{
public:
IDXGIAdapterWrapper(IDXGIAdapter* adapter) : m_realAdapter(adapter)
{
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
HRESULT STDMETHODCALLTYPE EnumOutputs(
UINT Output,
IDXGIOutput** ppOutput) override;
HRESULT STDMETHODCALLTYPE GetDesc(
DXGI_ADAPTER_DESC* pDesc) override;
HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(
REFGUID InterfaceName,
LARGE_INTEGER* pUMDVersion) override;
private:
long m_refCount = 1;
::IDXGIAdapter* m_realAdapter;
};
class IDXGIDeviceWrapper : public IDXGIDevice_X
{
public:
IDXGIDeviceWrapper(IDXGIDevice1* device) : m_realDevice(device)
{
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
HRESULT STDMETHODCALLTYPE GetAdapter(
_COM_Outptr_ IDXGIAdapter_X** pAdapter) override;
HRESULT STDMETHODCALLTYPE CreateSurface(
_In_ const DXGI_SURFACE_DESC* pDesc,
UINT NumSurfaces,
DXGI_USAGE Usage,
_In_opt_ const DXGI_SHARED_RESOURCE* pSharedResource,
_Out_writes_(NumSurfaces) IDXGISurface** ppSurface) override;
HRESULT STDMETHODCALLTYPE QueryResourceResidency(
_In_reads_(NumResources) IGraphicsUnknown** ppResources,
_Out_writes_(NumResources) DXGI_RESIDENCY* pResidencyStatus,
UINT NumResources) override;
HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
INT Priority) override;
HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
_Out_ INT* pPriority) override;
private:
long m_refCount = 1;
::IDXGIDevice* m_realDevice;
};
class IDXGISwapChainWrapper : public IDXGISwapChain1_X
{
public:
IDXGISwapChainWrapper(IDXGISwapChain1* swapchain) : m_realSwapchain(swapchain)
{
}
// IGraphicsUnknown
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override;
ULONG Release( ) override;
// IDXGIObject
HRESULT STDMETHODCALLTYPE SetPrivateData(_In_ REFGUID Name, UINT DataSize, _In_reads_bytes_(DataSize) const void* pData) override;
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(_In_ REFGUID Name, _In_opt_ const IUnknown* pUnknown) override;
HRESULT STDMETHODCALLTYPE GetPrivateData(_In_ REFGUID Name, _Inout_ UINT* pDataSize, _Out_writes_bytes_(*pDataSize) void* pData) override;
HRESULT STDMETHODCALLTYPE GetParent(_In_ REFIID riid, _COM_Outptr_ void** ppParent) override;
// IDXGIDeviceSubObject
HRESULT STDMETHODCALLTYPE GetDevice(
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][retval][out] */
_COM_Outptr_ void** ppDevice) override;
// IDXGISwapChain
HRESULT STDMETHODCALLTYPE Present(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT Flags) override;
HRESULT STDMETHODCALLTYPE GetBuffer(
/* [in] */ UINT Buffer,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][out][in] */
_COM_Outptr_ void** ppSurface) override;
HRESULT STDMETHODCALLTYPE SetFullscreenState(
/* [in] */ BOOL Fullscreen,
/* [annotation][in] */
_In_opt_ IDXGIOutput* pTarget) override;
HRESULT STDMETHODCALLTYPE GetFullscreenState(
/* [annotation][out] */
_Out_opt_ BOOL* pFullscreen,
/* [annotation][out] */
_COM_Outptr_opt_result_maybenull_ IDXGIOutput** ppTarget) override;
HRESULT STDMETHODCALLTYPE GetDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC* pDesc) override;
HRESULT STDMETHODCALLTYPE ResizeBuffers(
/* [in] */ UINT BufferCount,
/* [in] */ UINT Width,
/* [in] */ UINT Height,
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags) override;
HRESULT STDMETHODCALLTYPE ResizeTarget(
/* [annotation][in] */
_In_ const DXGI_MODE_DESC* pNewTargetParameters) override;
HRESULT STDMETHODCALLTYPE GetContainingOutput(
/* [annotation][out] */
_COM_Outptr_ IDXGIOutput** ppOutput) override;
HRESULT STDMETHODCALLTYPE GetFrameStatistics(
/* [annotation][out] */
_Out_ DXGI_FRAME_STATISTICS* pStats) override;
HRESULT STDMETHODCALLTYPE GetLastPresentCount(
/* [annotation][out] */
_Out_ UINT* pLastPresentCount) override;
HRESULT STDMETHODCALLTYPE GetDesc1(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_DESC1* pDesc) override;
HRESULT STDMETHODCALLTYPE GetFullscreenDesc(
/* [annotation][out] */
_Out_ DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc) override;
HRESULT STDMETHODCALLTYPE GetHwnd(
/* [annotation][out] */
_Out_ HWND* pHwnd) override;
HRESULT STDMETHODCALLTYPE GetCoreWindow(
/* [annotation][in] */
_In_ REFIID refiid,
/* [annotation][out] */
_COM_Outptr_ void** ppUnk) override;
HRESULT STDMETHODCALLTYPE Present1(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT PresentFlags,
/* [annotation][in] */
_In_ const DXGI_PRESENT_PARAMETERS* pPresentParameters) override;
BOOL STDMETHODCALLTYPE IsTemporaryMonoSupported(void) override;
HRESULT STDMETHODCALLTYPE GetRestrictToOutput(
/* [annotation][out] */
_Out_ IDXGIOutput** ppRestrictToOutput) override;
HRESULT STDMETHODCALLTYPE SetBackgroundColor(
/* [annotation][in] */
_In_ const DXGI_RGBA* pColor)override;
HRESULT STDMETHODCALLTYPE GetBackgroundColor(
/* [annotation][out] */
_Out_ DXGI_RGBA* pColor) override;
HRESULT STDMETHODCALLTYPE SetRotation(
/* [annotation][in] */
_In_ DXGI_MODE_ROTATION Rotation) override;
HRESULT STDMETHODCALLTYPE GetRotation(
/* [annotation][out] */
_Out_ DXGI_MODE_ROTATION* pRotation) override;
private:
long m_refCount = 1;
IDXGISwapChain1* m_realSwapchain;
};
}
+174 -21
View File
@@ -2,62 +2,215 @@
// ReSharper disable CppClangTidyClangDiagnosticUnusedFunction
#include "pch.h"
void D3DQuerySEQCounters_X()
{
#include <cstdio>
#include "d3d_x/d3d_x.hpp"
#include "ID3DWrappers.h"
HRESULT _stdcall D3DQuerySEQCounters_X(D3D_SEQ_COUNTER_DATA* pData)
{
return E_NOTIMPL;
}
void D3DUploadCustomMicrocode_X()
HRESULT _stdcall D3DUploadCustomMicrocode_X(
_In_ UINT32 MicrocodeVersion,
_In_ SIZE_T CeMicrocodeSizeBytes,
_In_reads_bytes_(CeMicrocodeSizeBytes) const void* pCeMicrocode,
_In_ SIZE_T PfpMicrocodeSizeBytes,
_In_reads_bytes_(PfpMicrocodeSizeBytes) const void* pPfpMicrocode,
_In_ SIZE_T MeMicrocodeSizeBytes,
_In_reads_bytes_(MeMicrocodeSizeBytes) const void* pMeMicrocode)
{
return E_NOTIMPL;
}
void D3D11XCreateDeviceXAndSwapChain1_X()
HRESULT __stdcall D3D11XCreateDeviceXAndSwapChain1_X(const D3D11X_CREATE_DEVICE_PARAMETERS* pParameters,
const DXGI_SWAP_CHAIN_DESC1* pSwapChainDesc, IDXGISwapChain1** ppSwapChain,
// ID3D11DeviceX** ppDevice, ID3D11DeviceContextX** ppImmediateContext
ID3D11Device** ppDevice, ID3D11DeviceContext** ppImmediateContext)
{
// D3D11_CREATE_DEVICE_VIDEO_EXCLUSIVE
if ((pParameters->Flags & 0x10000) != 0 || !ppSwapChain)
{
return E_INVALIDARG;
}
printf("!!! Game is trying to initialize D3D11 through D3D11X !!!");
printf("SDK Version: %d\n", pParameters->Version);
return D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, 0, pParameters->Flags & CREATE_DEVICE_FLAG_MASK, NULL, NULL, D3D11_SDK_VERSION, ppDevice, NULL, ppImmediateContext);
}
void D3DAllocateGraphicsMemory_X()
HRESULT __stdcall D3DAllocateGraphicsMemory_X(SIZE_T SizeBytes, SIZE_T AlignmentBytes, UINT64 DesiredGpuVirtualAddress, UINT Flags, void** ppAddress)
{
DWORD Protect = 0;
if (!ppAddress || AlignmentBytes > 0x20000)
return E_INVALIDARG;
// @Patoke todo: these 2 types in the XBOX also use the MEM_GRAPHICS flag
// meaning it's allocating GPU memory, fix
DWORD AllocType = MEM_4MB_PAGES | MEM_COMMIT | MEM_RESERVE;
if (AlignmentBytes <= 0x10000)
AllocType = MEM_LARGE_PAGES | MEM_COMMIT | MEM_RESERVE;
if (Flags == D3D11_GRAPHICS_MEMORY_ACCESS_CPU_CACHE_COHERENT)
{
// @Patoke note: this also includes the PAGE_GPU_COHERENT flag in the XBOX
Protect = PAGE_READWRITE;
}
else if (Flags == D3D11_GRAPHICS_MEMORY_ACCESS_CPU_WRITECOMBINE_NONCOHERENT)
{
Protect = PAGE_READWRITE | PAGE_WRITECOMBINE;
}
else if (Flags == D3D11_GRAPHICS_MEMORY_ACCESS_CPU_CACHE_NONCOHERENT_GPU_READONLY)
{
return E_INVALIDARG;
}
else
{
// @Patoke note: this also includes the PAGE_GPU_READONLY flag in the XBOX
Protect = PAGE_READWRITE;
}
LPVOID AllocBase = VirtualAlloc((LPVOID)DesiredGpuVirtualAddress, SizeBytes, AllocType, Protect);
*ppAddress = AllocBase;
return AllocBase == nullptr ? E_OUTOFMEMORY : S_OK;
}
void D3DConfigureVirtualMemory_X()
HRESULT __stdcall D3DConfigureVirtualMemory_X(_Inout_ D3D11X_VIRTUAL_MEMORY_CONFIGURATION* pVMConfiguration)
{
return E_NOTIMPL;
}
void D3DFlushEntireCpuCache_X()
void __stdcall D3DFlushEntireCpuCache_X()
{
FlushInstructionCache(GetCurrentProcess( ), NULL, NULL);
}
void D3DFreeGraphicsMemory_X()
HRESULT __stdcall D3DFreeGraphicsMemory_X(void* pAddress)
{
// @Patoke todo: this should be freeing GPU memory
VirtualFree(pAddress, NULL, MEM_RELEASE);
return S_OK;
}
void D3DMapEsramMemory_X()
HRESULT __stdcall D3DMapEsramMemory_X(UINT Flags,
VOID* pVirtualAddress,
UINT NumPages,
_In_reads_opt_(NumPages) const UINT* pPageList)
{
return E_NOTIMPL;
}
void DXGIXGetFrameStatistics_X()
HRESULT __stdcall DXGIXGetFrameStatistics_X(
_In_ UINT NumberFramesRequested,
_Out_writes_(NumberFramesRequested) DXGIX_FRAME_STATISTICS* pStats)
{
return E_NOTIMPL;
}
void DXGIXPresentArray_X()
HRESULT _stdcall DXGIXPresentArray_X(
_In_ UINT SyncInterval,
_In_ UINT PresentImmediateThreshold,
_In_ UINT Flags,
_In_ UINT NumSwapChains,
_In_ IDXGISwapChain1* const* ppSwapChain,
_In_ const DXGIX_PRESENTARRAY_PARAMETERS* pPresentParameters)
{
printf("[d3d11_x] !!! STUBBED: DXGIXPresentArray !!!");
return E_NOTIMPL;
}
void DXGIXSetFrameNotification_X()
HRESULT __stdcall DXGIXSetFrameNotification_X(
_In_ DXGIX_FRAME_NOTIFICATION NotificationType,
_In_ HANDLE hEvent)
{
return E_NOTIMPL;
}
void DXGIXSetVLineNotification_X()
HRESULT __stdcall DXGIXSetVLineNotification_X(
_In_ DXGIX_VLINECOUNTER VLineCounter,
_In_ UINT32 VLineNumber,
_In_opt_ HANDLE hEvent)
{
return E_NOTIMPL;
}
HRESULT __stdcall D3D11CreateDevice_X(
_In_opt_ IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
_In_reads_opt_(FeatureLevels) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
_Out_opt_ d3d11x::ID3D11Device** ppDevice,
_Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel,
_Out_opt_ d3d11x::ID3D11DeviceContext** ppImmediateContext)
{
printf("!!! Game is trying to initialize D3D11 through NORMAL D3D11 !!!\n");
printf("SDK Version: %d\n", SDKVersion);
if (SDKVersion != D3D11_SDK_VERSION)
{
printf("SDK Version mismatch: %d, correcting to %d\n", SDKVersion, D3D11_SDK_VERSION);
SDKVersion = D3D11_SDK_VERSION;
}
D3D_FEATURE_LEVEL featurelevels[] = {
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
};
ID3D11Device2* device2{};
ID3D11DeviceContext2* device_context2{};
auto flags = Flags & CREATE_DEVICE_FLAG_MASK;
//flags |= D3D11_CREATE_DEVICE_DEBUG;
HRESULT hr = D3D11CreateDevice(pAdapter, DriverType, Software, flags, featurelevels, _ARRAYSIZE(featurelevels), SDKVersion, (ID3D11Device**)ppDevice, pFeatureLevel, (ID3D11DeviceContext**)ppImmediateContext);
if (SUCCEEDED(hr))
{
// get dx11.2 feature level, since that's what dx11.x inherits from
(*ppDevice)->QueryInterface(IID_PPV_ARGS(&device2));
(*ppImmediateContext)->QueryInterface(IID_PPV_ARGS(&device_context2));
*ppDevice = reinterpret_cast<d3d11x::ID3D11Device*>(new d3d11x::D3D11DeviceXWrapperX(device2));
*ppImmediateContext = reinterpret_cast<d3d11x::ID3D11DeviceContext*>(new d3d11x::ID3D11DeviceContextXWrapper(device_context2));
}
else
{
printf("failed to assign wrapped device, result code 0x%X, error code 0x%X\n", hr, GetLastError());
}
return hr;
}
HRESULT __stdcall D3D11XCreateDeviceX_X(
_In_ const D3D11X_CREATE_DEVICE_PARAMETERS* pParameters,
_Out_opt_ ID3D11Device** ppDevice,
_Out_opt_ ID3D11DeviceContext** ppImmediateContext)
{
printf("!!! Game is trying to initialize D3D11 through D3D11X !!!");
printf("SDK Version: %d\n", pParameters->Version);
return D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, 0, pParameters->Flags & CREATE_DEVICE_FLAG_MASK, NULL, NULL, D3D11_SDK_VERSION, ppDevice, NULL, ppImmediateContext);
}
HRESULT __stdcall D3D11CreateDeviceAndSwapChain_X(
_In_opt_ IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
_In_reads_opt_(FeatureLevels) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
_In_opt_ CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
_Out_opt_ IDXGISwapChain** ppSwapChain,
_Out_opt_ ID3D11Device** ppDevice,
_Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel,
_Out_opt_ ID3D11DeviceContext** ppImmediateContext)
{
printf("!!! Game is trying to initialize D3D11 through NORMAL D3D11 !!!");
printf("SDK Version: %d\n", SDKVersion);
return D3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext);
}
+84
View File
@@ -3,9 +3,93 @@
#define D3D11_X
#include "dxgi1_5.h"
#include "d3d_x/d3d_x.hpp"
// remove all XBOX only flags passed to CreateDevice
#define CREATE_DEVICE_FLAG_MASK (D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_SWITCH_TO_REF | \
D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS | D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_DEBUGGABLE | \
D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY | D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT | D3D11_CREATE_DEVICE_VIDEO_SUPPORT)
typedef GUID DXGI_DEBUG_ID;
typedef enum D3D11_GRAPHICS_MEMORY_ACCESS_FLAG
{
D3D11_GRAPHICS_MEMORY_ACCESS_CPU_CACHE_COHERENT = 0,
D3D11_GRAPHICS_MEMORY_ACCESS_CPU_WRITECOMBINE_NONCOHERENT = 1,
D3D11_GRAPHICS_MEMORY_ACCESS_CPU_CACHE_NONCOHERENT_GPU_READONLY = 2
} D3D11_GRAPHICS_MEMORY_ACCESS_FLAG;
typedef struct D3D11X_CREATE_DEVICE_PARAMETERS {
UINT Version;
UINT Flags;
void* pOffchipTessellationBuffer;
void* pTessellationFactorsBuffer;
UINT DeferredDeletionThreadAffinityMask;
UINT ImmediateContextDeRingSizeBytes;
UINT ImmediateContextCeRingSizeBytes;
UINT ImmediateContextDeSegmentSizeBytes;
UINT ImmediateContextCeSegmentSizeBytes;
} D3D11X_CREATE_DEVICE_PARAMETERS;
typedef struct _DXGIX_FRAME_STATISTICS
{
UINT64 CPUTimePresentCalled;
UINT64 CPUTimeAddedToQueue;
UINT32 QueueLengthAddedToQueue;
UINT64 CPUTimeFrameComplete;
UINT64 GPUTimeFrameComplete;
UINT64 GPUCountTitleUsed;
UINT64 GPUCountSystemUsed;
UINT64 CPUTimeVSync;
UINT64 GPUTimeVSync;
UINT64 CPUTimeFlip;
UINT64 GPUTimeFlip;
UINT64 VSyncCount;
FLOAT PercentScanned;
VOID* Cookie[ 2 ];
} DXGIX_FRAME_STATISTICS;
struct D3D11X_VIRTUAL_MEMORY_CONFIGURATION
{
UINT Flags;
UINT PageTableMemory4MBPageCount;
UINT64 MinimumValidGraphicsAddress;
UINT64 MaximumValidGraphicsAddress;
};
struct D3D_SEQ_COUNTER_DATA
{
unsigned int ReadCount[ 12 ];
unsigned int ReadEdcCount[ 12 ];
unsigned int WriteCount[ 12 ];
unsigned int WriteEdcCount[ 12 ];
};
typedef struct _DXGIX_PRESENTARRAY_PARAMETERS
{
BOOL Disable;
BOOL UsePreviousBuffer;
D3D11_RECT SourceRect;
POINT DestRectUpperLeft;
FLOAT ScaleFactorVert;
FLOAT ScaleFactorHorz;
void* Cookie;
UINT Flags;
} DXGIX_PRESENTARRAY_PARAMETERS;
typedef enum DXGIX_FRAME_NOTIFICATION
{
FRAME_NOTIFICATION_QUEUED = 0,
FRAME_NOTIFICATION_COMPLETED = 1,
FRAME_NOTIFICATION_FLIPPED = 2
} DXGIX_FRAME_NOTIFICATION;
typedef enum DXGIX_VLINECOUNTER
{
VLINECOUNTER0 = 0,
VLINECOUNTER1 = 1
} DXGIX_VLINECOUNTER;
extern "C" const GUID DXGI_DEBUG_ALL;
DEFINE_GUID(DXGI_DEBUG_DX, 0x35cdd7fc, 0x13b2, 0x421d, 0xa5, 0xd7, 0x7e, 0x44, 0x51, 0x28, 0x7d, 0x64);
DEFINE_GUID(DXGI_DEBUG_DXGI, 0x25cddaa4, 0xb1c6, 0x47e1, 0xac, 0x3e, 0x98, 0x87, 0x5b, 0x5a, 0x2e, 0x2a);
+14
View File
@@ -89,13 +89,27 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="d3d11_x.h" />
<ClInclude Include="d3d_x\d3d11_x_device.h" />
<ClInclude Include="d3d_x\d3d_x.hpp" />
<ClInclude Include="Exports.def" />
<ClInclude Include="framework.h" />
<ClInclude Include="ID3DDeviceContext.h" />
<ClInclude Include="ID3DWrappers.h" />
<ClInclude Include="ID3DX.h" />
<ClInclude Include="IDXGIWrappers.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="d3d11_x.cpp" />
<ClCompile Include="d3d_x\d3d11_x_device.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="ID3D11DeviceContextWrapper.cpp" />
<ClCompile Include="ID3D11Texture2DWrapper.cpp" />
<ClCompile Include="IDXGI.h" />
<ClCompile Include="IDXGIAdapterWrapper.cpp" />
<ClCompile Include="IDXGIDeviceWrapper.cpp" />
<ClCompile Include="IDXGIFactoryWrapper.cpp" />
<ClCompile Include="IDXGISwapChainWrapper.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+54
View File
@@ -13,6 +13,18 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\ID3D">
<UniqueIdentifier>{21a7221a-d303-4d64-98fa-eb1ef76f3c17}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ID3D">
<UniqueIdentifier>{a66d9c88-9c40-410e-8899-f02975549067}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\IDXGI">
<UniqueIdentifier>{cc2a8930-4142-49f7-9b17-f71e472520ed}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\IDXGI">
<UniqueIdentifier>{93367b01-f957-4ef5-82c7-4aab1139fc9c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
@@ -27,6 +39,24 @@
<ClInclude Include="Exports.def">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="d3d_x\d3d_x.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="d3d_x\d3d11_x_device.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="IDXGIWrappers.h">
<Filter>Header Files\IDXGI</Filter>
</ClInclude>
<ClInclude Include="ID3DX.h">
<Filter>Header Files\ID3D</Filter>
</ClInclude>
<ClInclude Include="ID3DWrappers.h">
<Filter>Header Files\ID3D</Filter>
</ClInclude>
<ClInclude Include="ID3DDeviceContext.h">
<Filter>Header Files\ID3D</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="d3d11_x.cpp">
@@ -38,6 +68,30 @@
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d3d_x\d3d11_x_device.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="IDXGI.h">
<Filter>Header Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="IDXGIFactoryWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="IDXGIDeviceWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="IDXGIAdapterWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="ID3D11Texture2DWrapper.cpp">
<Filter>Source Files\ID3D</Filter>
</ClCompile>
<ClCompile Include="IDXGISwapChainWrapper.cpp">
<Filter>Source Files\IDXGI</Filter>
</ClCompile>
<ClCompile Include="ID3D11DeviceContextWrapper.cpp">
<Filter>Source Files\ID3D</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Exports.def.bak" />
+315
View File
@@ -0,0 +1,315 @@
#include "pch.h"
#include "d3d11_x_device.h"
#include "d3d_x.hpp"
#include "../IDXGIWrappers.h"
#include "../ID3DWrappers.h"
#pragma region ID3D11DeviceX
// QueryInterface need to be in the cpp file because of circular dependency for IDXGIDeviceWrapper :}
HRESULT d3d11x::D3D11DeviceXWrapperX::QueryInterface(REFIID riid, void** ppvObject)
{
// note from unixian: for debugging purposes
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[D3D11DeviceXWrapperX] QueryInterface: %s\n", iidstr);
if (riid == __uuidof(ID3D11DeviceX) || riid == __uuidof(ID3D11Device2) ||
riid == __uuidof(ID3D11Device1) || riid == __uuidof(ID3D11Device))
{
*ppvObject = static_cast<ID3D11DeviceX*>(this);
AddRef( );
return S_OK;
}
if (riid == __uuidof(IDXGIDevice) ||
riid == __uuidof(IDXGIDevice1))
{
void** giDevice = nullptr;
HRESULT hr = m_realDevice->QueryInterface(riid, ppvObject);
*ppvObject = new IDXGIDeviceWrapper(static_cast<IDXGIDevice1*>(*ppvObject));
return S_OK;
}
return m_realDevice->QueryInterface(riid, ppvObject);
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateTexture2D(
const D3D11_TEXTURE2D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D** ppTexture2D) {
ID3D11Texture2D* texture2d = nullptr;
HRESULT hr = m_realDevice->CreateTexture2D(pDesc, pInitialData, &texture2d);
*reinterpret_cast<ID3D11Texture2D_X**>(ppTexture2D) = new ID3D11Texture2DWrapper(texture2d);
return hr;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateRenderTargetView(
ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView** ppRTView) {
return m_realDevice->CreateRenderTargetView(reinterpret_cast<ID3D11Texture2DWrapper*>(pResource)->m_realTexture, pDesc, ppRTView);
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDepthStencilView(
ID3D11Resource* pResource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
ID3D11DepthStencilView** ppDepthStencilView) {
return m_realDevice->CreateDepthStencilView(reinterpret_cast<ID3D11Texture2DWrapper*>(pResource)->m_realTexture, pDesc, ppDepthStencilView);
}
void d3d11x::D3D11DeviceXWrapperX::GetImmediateContext(ID3D11DeviceContext** ppImmediateContext)
{
::ID3D11DeviceContext2* ctx;
m_realDevice->GetImmediateContext(reinterpret_cast<::ID3D11DeviceContext**>(&ctx));
*ppImmediateContext = reinterpret_cast<d3d11x::ID3D11DeviceContext*>(new d3d11x::ID3D11DeviceContextXWrapper(ctx));
}
void d3d11x::D3D11DeviceXWrapperX::GetImmediateContextX(
_Out_ ID3D11DeviceContextX** ppImmediateContextX)
{
printf("[D3D11DeviceXWrapperX] GetImmediateContextX");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateCounterSet(
_In_ const D3D11X_COUNTER_SET_DESC* pCounterSetDesc,
_Out_opt_ ID3D11CounterSetX** ppCounterSet)
{
printf("[D3D11DeviceXWrapperX] CreateCounterSet");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateCounterSample(
_Out_opt_ ID3D11CounterSampleX** ppCounterSample)
{
printf("[D3D11DeviceXWrapperX] CreateCounterSample");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::SetDriverHint(
_In_ UINT Feature,
_In_ UINT Value)
{
printf("[D3D11DeviceXWrapperX] SetDriverHint");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDmaEngineContext(
_In_ const D3D11_DMA_ENGINE_CONTEXT_DESC* pDmaEngineContextDesc,
_Out_ d3d11x::ID3D11DmaEngineContextX** ppDmaDeviceContext)
{
printf("[D3D11DeviceXWrapperX] CreateDmaEngineContext");
return E_NOTIMPL;
}
BOOL d3d11x::D3D11DeviceXWrapperX::IsFencePending(UINT64 Fence)
{
printf("[D3D11DeviceXWrapperX] IsFencePending");
return E_NOTIMPL;
}
BOOL d3d11x::D3D11DeviceXWrapperX::IsResourcePending(
_In_ ID3D11Resource* pResource)
{
printf("[D3D11DeviceXWrapperX] IsResourcePending");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementBuffer(
_In_ const D3D11_BUFFER_DESC* pDesc,
_In_ void* pAddress,
_Out_opt_ ID3D11Buffer** ppBuffer)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementBuffer");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementTexture1D(
_In_ const D3D11_TEXTURE1D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ void* pAddress,
_Out_opt_ ID3D11Texture1D** ppTexture1D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementTexture1D");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementTexture2D(
_In_ const D3D11_TEXTURE2D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ void* pAddress,
_Out_opt_ ID3D11Texture2D** ppTexture2D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementTexture2D");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementTexture3D(
_In_ const D3D11_TEXTURE3D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ void* pAddress,
_Out_opt_ ID3D11Texture3D** ppTexture3D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementTexture3D");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GetTimestamps(
_Out_ UINT64* pGpuTimestamp,
_Out_ UINT64* pCpuRdtscTimestamp)
{
printf("[D3D11DeviceXWrapperX] GetTimestamps");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateSamplerStateX(
_In_ const d3d11x::D3D11X_SAMPLER_DESC* pSamplerDesc,
_Out_opt_ ID3D11SamplerState** ppSamplerState)
{
printf("[D3D11DeviceXWrapperX] CreateSamplerStateX");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDeferredContextX(
UINT ContextFlags,
_Out_ d3d11x::ID3D11DeviceContextX** ppDeferredContext)
{
printf("[D3D11DeviceXWrapperX] CreateDeferredContextX");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GarbageCollect(
_In_ UINT Flags)
{
printf("[D3D11DeviceXWrapperX] GarbageCollect");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateDepthStencilStateX(
_In_ const D3D11_DEPTH_STENCIL_DESC* pDepthStencilStateDescX,
_Out_opt_ ID3D11DepthStencilState** ppDepthStencilState)
{
printf("[D3D11DeviceXWrapperX] CreateDepthStencilStateX");
return E_NOTIMPL;
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreatePlacementRenderableTexture2D(
_In_ const D3D11_TEXTURE2D_DESC* pDesc,
_In_ UINT TileModeIndex,
_In_ UINT Pitch,
_In_ const D3D11X_RENDERABLE_TEXTURE_ADDRESSES* pAddresses,
_Out_opt_ ID3D11Texture2D** ppTexture2D)
{
printf("[D3D11DeviceXWrapperX] CreatePlacementRenderableTexture2D");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GetDriverStatistics(
_In_ UINT StructSize,
_Out_ D3D11X_DRIVER_STATISTICS* pStatistics)
{
printf("[D3D11DeviceXWrapperX] GetDriverStatistics");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::CreateComputeContextX(
_In_ const d3d11x::D3D11_COMPUTE_CONTEXT_DESC* pComputeContextDesc,
_Out_ d3d11x::ID3D11ComputeContextX** ppComputeContext)
{
printf("[D3D11DeviceXWrapperX] CreateComputeContextX");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::ComposeShaderResourceView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const d3d11x::D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ d3d11x::D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW* pDescriptorSrv)
{
printf("[D3D11DeviceXWrapperX] ComposeShaderResourceView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeUnorderedAccessView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ d3d11x::D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW* pDescriptorUav)
{
printf("[D3D11DeviceXWrapperX] ComposeUnorderedAccessView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeConstantBufferView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW* pDescriptorCb)
{
printf("[D3D11DeviceXWrapperX] ComposeConstantBufferView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeVertexBufferView(
_In_ const D3D11X_DESCRIPTOR_RESOURCE* pDescriptorResource,
_In_opt_ const D3D11X_RESOURCE_VIEW_DESC* pViewDesc,
_Out_ D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW* pDescriptorVb)
{
printf("[D3D11DeviceXWrapperX] ComposeVertexBufferView");
}
void d3d11x::D3D11DeviceXWrapperX::ComposeSamplerState(
_In_opt_ const d3d11x::D3D11X_SAMPLER_STATE_DESC* pSamplerDesc,
_Out_ d3d11x::D3D11X_DESCRIPTOR_SAMPLER_STATE* pDescriptorSamplerState)
{
printf("[D3D11DeviceXWrapperX] ComposeSamplerState");
}
void d3d11x::D3D11DeviceXWrapperX::PlaceSwapChainView(
_In_ ID3D11Resource* pSwapChainBuffer,
_Inout_ ID3D11View* pView)
{
printf("[D3D11DeviceXWrapperX] PlaceSwapChainView");
}
void d3d11x::D3D11DeviceXWrapperX::SetDebugFlags(
_In_ UINT Flags)
{
printf("[D3D11DeviceXWrapperX] SetDebugFlags");
}
UINT d3d11x::D3D11DeviceXWrapperX::GetDebugFlags( )
{
printf("[D3D11DeviceXWrapperX] GetDebugFlags");
return {};
}
void d3d11x::D3D11DeviceXWrapperX::SetHangCallbacks(
_In_ d3d11x::D3D11XHANGBEGINCALLBACK pBeginCallback,
_In_ d3d11x::D3D11XHANGPRINTCALLBACK pPrintCallback,
_In_ d3d11x::D3D11XHANGDUMPCALLBACK pDumpCallback)
{
printf("[D3D11DeviceXWrapperX] SetHangCallbacks");
}
void d3d11x::D3D11DeviceXWrapperX::ReportGpuHang(
_In_ UINT Flags)
{
printf("[D3D11DeviceXWrapperX] ReportGpuHang");
}
HRESULT d3d11x::D3D11DeviceXWrapperX::SetGpuMemoryPriority(
_In_ UINT Priority)
{
printf("[D3D11DeviceXWrapperX] SetGpuMemoryPriority");
return E_NOTIMPL;
}
void d3d11x::D3D11DeviceXWrapperX::GetGpuHardwareConfiguration(
_Out_ d3d11x::D3D11X_GPU_HARDWARE_CONFIGURATION* pGpuHardwareConfiguration)
{
printf("[D3D11DeviceXWrapperX] GetGpuHardwareConfiguration");
}
#pragma endregion
+800
View File
@@ -0,0 +1,800 @@
#pragma once
#include <cstdio>
#include <d3d11.h>
#include <d3d11_1.h>
#include <d3d11_2.h>
// thanks to Zombie for the idea
#define DX_MAJOR 2
#define DX_MINOR 12
#define MAKEINTVERSION(major, minor) (((0LL + (major)) << 48) | ((0LL + (minor)) << 32))
#define DX_VERSION (((0LL + (DX_MAJOR)) << 48) | ((0LL + (DX_MINOR)) << 32))
#define D3DDECL_UUID(Uuid) __declspec(uuid(#Uuid))
#define D3DINTERFACE(Name, Guid0, Guid1, Guid2, Guid3, Guid4, \
Guid5, Guid6, Guid7, Guid8, Guid9, Guid10) \
class D3DDECL_UUID(Guid0-Guid1-Guid2-Guid3##Guid4-Guid5##Guid6##Guid7##Guid8##Guid9##Guid10) Name
namespace d3d11x
{
D3DINTERFACE(IGraphicsUnknown, aceeea63, e0a9, 4a1c, bb, ec, 71, b2, f4, 85, f7, 58)
{
public:
#if !defined(DX_VERSION) || DX_VERSION >= MAKEINTVERSION(2, 18)
ULONG m_DeviceIndex : 3;
ULONG m_PrivateDataPresent : 1;
ULONG m_Reserved : 28;
#endif
#if !defined(DX_VERSION) || DX_VERSION >= MAKEINTVERSION(1, 1)
ULONG m_RefCount;
#endif
virtual HRESULT QueryInterface(REFIID riid, void** ppvObject) = 0;
virtual ULONG AddRef( ) = 0;
virtual ULONG Release( ) = 0;
};
class GraphicsUnknownWrapperX : public IGraphicsUnknown
{
public:
GraphicsUnknownWrapperX(IUnknown* pUnknown)
{
m_RefCount = 1;
m_pUnknown = pUnknown;
}
GraphicsUnknownWrapperX( )
{
m_RefCount = 1;
m_pUnknown = nullptr;
}
HRESULT QueryInterface(REFIID riid, void** ppvObject) override
{
// note from unixian: for debugging purposes
char iidstr[ sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}") ];
OLECHAR iidwstr[ sizeof(iidstr) ];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
printf("[GraphicsUnknownWrapperX] QueryInterface: %s\n", iidstr);
if (m_pUnknown)
return m_pUnknown->QueryInterface(riid, ppvObject);
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG AddRef( ) override
{
if (m_pUnknown)
return m_pUnknown->AddRef( );
return InterlockedIncrement(&m_RefCount);
}
ULONG Release( ) override
{
ULONG refCount = InterlockedDecrement(&m_RefCount);
if (m_pUnknown)
m_pUnknown->Release( );
if (refCount == 0)
{
delete this;
}
return refCount;
}
private:
IUnknown* m_pUnknown;
};
class IDXGIDeviceWrapper;
class ID3D11Texture2DWrapper;
class IGraphicsUnknown;
class ID3D11DeviceContext;
class ID3D11DeviceContextX;
class ID3D11CounterSetX;
class ID3D11CounterSampleX;
class ID3D11DmaEngineContextX;
class ID3D11ComputeContextX;
struct D3D11X_COUNTER_SET_DESC;
struct D3D11X_DESCRIPTOR_RESOURCE;
struct D3D11_DMA_ENGINE_CONTEXT_DESC;
struct D3D11X_SAMPLER_DESC;
struct D3D11X_RENDERABLE_TEXTURE_ADDRESSES;
struct D3D11X_DRIVER_STATISTICS;
struct D3D11_COMPUTE_CONTEXT_DESC;
struct D3D11X_RESOURCE_VIEW_DESC;
struct D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW;
struct D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW;
struct D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW;
struct D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW;
struct D3D11X_SAMPLER_STATE_DESC;
struct D3D11X_DESCRIPTOR_SAMPLER_STATE;
struct D3D11X_GPU_HARDWARE_CONFIGURATION;
typedef UINT(*D3D11XHANGBEGINCALLBACK) (UINT64 Flags);
typedef void (*D3D11XHANGPRINTCALLBACK) (const CHAR* strLine);
typedef void (*D3D11XHANGDUMPCALLBACK) (const WCHAR* strFileName);
D3DINTERFACE(ID3D11Device, db6f6ddb, ac77, 4e88, 82, 53, 81, 9d, f9, bb, f1, 40) : public IGraphicsUnknown
{
public:
UINT m_CreationFlags;
virtual HRESULT CreateBuffer(_In_ const D3D11_BUFFER_DESC* pDesc,
_In_opt_ const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ ID3D11Buffer** ppBuffer) = 0;
virtual HRESULT CreateTexture1D(_In_ const D3D11_TEXTURE1D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels* pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ ID3D11Texture1D** ppTexture1D) = 0;
virtual HRESULT CreateTexture2D(_In_ const D3D11_TEXTURE2D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels* pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ ID3D11Texture2D** ppTexture2D) = 0;
virtual HRESULT CreateTexture3D(_In_ const D3D11_TEXTURE3D_DESC* pDesc,
_In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D11_SUBRESOURCE_DATA* pInitialData,
_Out_opt_ ID3D11Texture3D** ppTexture3D) = 0;
virtual HRESULT CreateShaderResourceView(_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
_Out_opt_ ID3D11ShaderResourceView** ppSRView) = 0;
virtual HRESULT CreateUnorderedAccessView(_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
_Out_opt_ ID3D11UnorderedAccessView** ppUAView) = 0;
virtual HRESULT CreateRenderTargetView(_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
_Out_opt_ ID3D11RenderTargetView** ppRTView) = 0;
virtual HRESULT CreateDepthStencilView(
_In_ ID3D11Resource* pResource,
_In_opt_ const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
_Out_opt_ ID3D11DepthStencilView** ppDepthStencilView) = 0;
virtual HRESULT CreateInputLayout(
_In_reads_(NumElements) const D3D11_INPUT_ELEMENT_DESC * pInputElementDescs,
_In_range_(0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) UINT NumElements,
_In_ const void* pShaderBytecodeWithInputSignature,
_In_ SIZE_T BytecodeLength,
_Out_opt_ ID3D11InputLayout * *ppInputLayout) = 0;
virtual HRESULT CreateVertexShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11VertexShader** ppVertexShader) = 0;
virtual HRESULT CreateGeometryShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11GeometryShader** ppGeometryShader) = 0;
virtual HRESULT CreateGeometryShaderWithStreamOutput(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_reads_opt_(NumEntries) const D3D11_SO_DECLARATION_ENTRY* pSODeclaration,
_In_range_(0, D3D11_SO_STREAM_COUNT* D3D11_SO_OUTPUT_COMPONENT_COUNT) UINT NumEntries,
_In_reads_opt_(NumStrides) const UINT* pBufferStrides,
_In_range_(0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumStrides,
_In_ UINT RasterizedStream,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11GeometryShader** ppGeometryShader) = 0;
virtual HRESULT CreatePixelShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11PixelShader** ppPixelShader) = 0;
virtual HRESULT CreateHullShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11HullShader** ppHullShader) = 0;
virtual HRESULT CreateDomainShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11DomainShader** ppDomainShader) = 0;
virtual HRESULT CreateComputeShader(
_In_ const void* pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_opt_ ID3D11ClassLinkage* pClassLinkage,
_Out_opt_ ID3D11ComputeShader** ppComputeShader) = 0;
virtual HRESULT CreateClassLinkage(
_Out_ ID3D11ClassLinkage** ppLinkage) = 0;
virtual HRESULT CreateBlendState(
_In_ const D3D11_BLEND_DESC* pBlendStateDesc,
_Out_opt_ ID3D11BlendState** ppBlendState) = 0;
virtual HRESULT CreateDepthStencilState(
_In_ const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc,
_Out_opt_ ID3D11DepthStencilState** ppDepthStencilState) = 0;
virtual HRESULT CreateRasterizerState(
_In_ const D3D11_RASTERIZER_DESC* pRasterizerDesc,
_Out_opt_ ID3D11RasterizerState** ppRasterizerState) = 0;
virtual HRESULT CreateSamplerState(
_In_ const D3D11_SAMPLER_DESC* pSamplerDesc,
_Out_opt_ ID3D11SamplerState** ppSamplerState) = 0;
virtual HRESULT CreateQuery(
_In_ const D3D11_QUERY_DESC* pQueryDesc,
_Out_opt_ ID3D11Query** ppQuery) = 0;
virtual HRESULT CreatePredicate(
_In_ const D3D11_QUERY_DESC* pPredicateDesc,
_Out_opt_ ID3D11Predicate** ppPredicate) = 0;
virtual HRESULT CreateCounter(
_In_ const D3D11_COUNTER_DESC* pCounterDesc,
_Out_opt_ ID3D11Counter** ppCounter) = 0;
virtual HRESULT CreateDeferredContext(UINT ContextFlags, _Out_opt_ ::ID3D11DeviceContext** ppDeferredContext) = 0;
virtual HRESULT OpenSharedResource(
_In_ HANDLE hResource,
_In_ REFIID ReturnedInterface,
_Out_opt_ void** ppResource) = 0;
virtual HRESULT CheckFormatSupport(
_In_ DXGI_FORMAT Format,
_Out_ UINT* pFormatSupport) = 0;
virtual HRESULT CheckMultisampleQualityLevels(
_In_ DXGI_FORMAT Format,
_In_ UINT SampleCount,
_Out_ UINT* pNumQualityLevels) = 0;
virtual void CheckCounterInfo(_Out_ D3D11_COUNTER_INFO* pCounterInfo) = 0;
virtual HRESULT CheckCounter(
_In_ const D3D11_COUNTER_DESC* pDesc,
_Out_ D3D11_COUNTER_TYPE* pType,
_Out_ UINT* pActiveCounters,
_Out_writes_opt_(*pNameLength) LPSTR szName,
_Inout_opt_ UINT* pNameLength,
_Out_writes_opt_(*pUnitsLength) LPSTR szUnits,
_Inout_opt_ UINT* pUnitsLength,
_Out_writes_opt_(*pDescriptionLength) LPSTR szDescription,
_Inout_opt_ UINT* pDescriptionLength) = 0;
virtual HRESULT CheckFeatureSupport(
D3D11_FEATURE Feature,
_Out_writes_bytes_(FeatureSupportDataSize) void* pFeatureSupportData,
UINT FeatureSupportDataSize) = 0;
virtual HRESULT GetPrivateData(
_In_ REFGUID guid,
_Inout_ UINT* pDataSize,
_Out_writes_bytes_opt_(*pDataSize) void* pData) = 0;
virtual HRESULT SetPrivateData(_In_ REFGUID guid, _In_ UINT DataSize, _In_reads_bytes_opt_(DataSize) const void* pData)= 0;
virtual HRESULT SetPrivateDataInterface(_In_ REFGUID guid, _In_opt_ const IUnknown* pData) = 0;
virtual HRESULT SetPrivateDataInterfaceGraphics(_In_ REFGUID guid, _In_opt_ const IGraphicsUnknown* pData) = 0;
virtual D3D_FEATURE_LEVEL GetFeatureLevel( ) = 0;
virtual UINT GetCreationFlags( ) = 0;
virtual HRESULT GetDeviceRemovedReason( ) = 0;
virtual void GetImmediateContext(ID3D11DeviceContext** ppImmediateContext) = 0;
virtual HRESULT SetExceptionMode(UINT RaiseFlags) = 0;
virtual UINT GetExceptionMode( ) = 0;
};
D3DINTERFACE(ID3D11Device1, a04bfb29, 08ef, 43d6, a4, 9c, a9, bd, bd, cb, e6, 86) : public ID3D11Device{
public:
virtual void GetImmediateContext1(_Out_ ::ID3D11DeviceContext1** ppImmediateContext) = 0;
virtual HRESULT CreateDeferredContext1(
UINT ContextFlags,
_Out_ ::ID3D11DeviceContext1** ppDeferredContext) = 0;
virtual HRESULT CreateBlendState1(
_In_ const D3D11_BLEND_DESC1* pBlendStateDesc,
_Out_opt_ ID3D11BlendState1** ppBlendState) = 0;
virtual HRESULT CreateRasterizerState1(
_In_ const D3D11_RASTERIZER_DESC1* pRasterizerDesc,
_Out_opt_ ID3D11RasterizerState1** ppRasterizerState) = 0;
virtual HRESULT CreateDeviceContextState(
UINT Flags,
_In_reads_(FeatureLevels) const D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
REFIID EmulatedInterface,
_Out_opt_ D3D_FEATURE_LEVEL* pChosenFeatureLevel,
_Out_opt_ ID3DDeviceContextState** ppContextState) = 0;
virtual HRESULT OpenSharedResource1(
_In_ HANDLE hResource,
_In_ REFIID ReturnedInterface,
_Out_ void** ppResource) = 0;
virtual HRESULT OpenSharedResourceByName(
_In_ LPCWSTR lpName,
_In_ DWORD dwDesiredAccess,
_In_ REFIID ReturnedInterface,
_Out_ void** ppResource) = 0;
};
D3DINTERFACE(ID3D11Device2, 9d06dffa, d1e5, 4d07, 83, a8, 1b, b1, 23, f2, f8, 41) : public ID3D11Device1 {
virtual void GetImmediateContext2(
_Out_ ::ID3D11DeviceContext2** ppImmediateContext) = 0;
virtual HRESULT CreateDeferredContext2(
UINT ContextFlags,
_Out_ ::ID3D11DeviceContext2** ppDeferredContext) = 0;
virtual void GetResourceTiling(
_In_ ID3D11Resource* pTiledResource,
_Out_opt_ UINT* pNumTilesForEntireResource,
_Out_opt_ D3D11_PACKED_MIP_DESC* pPackedMipDesc,
_Out_opt_ D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips,
_Inout_opt_ UINT* pNumSubresourceTilings,
_In_ UINT FirstSubresourceTilingToGet,
_Out_writes_(*pNumSubresourceTilings) D3D11_SUBRESOURCE_TILING* pSubresourceTilingsForNonPackedMips) = 0;
virtual HRESULT CheckMultisampleQualityLevels1(
_In_ DXGI_FORMAT Format,
_In_ UINT SampleCount,
_In_ UINT Flags,
_Out_ UINT* pNumQualityLevels) = 0;
};
D3DINTERFACE(ID3D11DeviceX, 177700f9, 876a, 4436, b3, 68, 36, a6, 04, f8, 2c, ef) : public ID3D11Device2
{
public:
virtual void GetImmediateContextX(ID3D11DeviceContextX**) = 0;
virtual HRESULT CreateCounterSet(const D3D11X_COUNTER_SET_DESC*, ID3D11CounterSetX**) = 0;
virtual HRESULT CreateCounterSample(ID3D11CounterSampleX**) = 0;
virtual HRESULT SetDriverHint(unsigned int, unsigned int) = 0;
virtual HRESULT CreateDmaEngineContext(const D3D11_DMA_ENGINE_CONTEXT_DESC*, ID3D11DmaEngineContextX**) = 0;
virtual int IsFencePending(unsigned __int64) = 0;
virtual int IsResourcePending(ID3D11Resource*) = 0;
virtual HRESULT CreatePlacementBuffer(const D3D11_BUFFER_DESC*, void*, ID3D11Buffer**) = 0;
virtual HRESULT CreatePlacementTexture1D(const D3D11_TEXTURE1D_DESC*, unsigned int, unsigned int, void*, ID3D11Texture1D**) = 0;
virtual HRESULT CreatePlacementTexture2D(const D3D11_TEXTURE2D_DESC*, unsigned int, unsigned int, void*, ID3D11Texture2D**) = 0;
virtual HRESULT CreatePlacementTexture3D(const D3D11_TEXTURE3D_DESC*, unsigned int, unsigned int, void*, ID3D11Texture3D**) = 0;
virtual void GetTimestamps(unsigned __int64*, unsigned __int64*) = 0;
virtual HRESULT CreateSamplerStateX(const D3D11X_SAMPLER_DESC*, ID3D11SamplerState**) = 0;
virtual HRESULT CreateDeferredContextX(unsigned int, ID3D11DeviceContextX**) = 0;
virtual void GarbageCollect(unsigned int) = 0;
virtual HRESULT CreateDepthStencilStateX(const D3D11_DEPTH_STENCIL_DESC*, ID3D11DepthStencilState**) = 0;
virtual HRESULT CreatePlacementRenderableTexture2D(const D3D11_TEXTURE2D_DESC*, unsigned int, unsigned int, const D3D11X_RENDERABLE_TEXTURE_ADDRESSES*, ID3D11Texture2D**) = 0;
virtual void GetDriverStatistics(unsigned int, D3D11X_DRIVER_STATISTICS*) = 0;
virtual HRESULT CreateComputeContextX(const D3D11_COMPUTE_CONTEXT_DESC*, ID3D11ComputeContextX**) = 0;
virtual void ComposeShaderResourceView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW*) = 0;
virtual void ComposeUnorderedAccessView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW*) = 0;
virtual void ComposeConstantBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW*) = 0;
virtual void ComposeVertexBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW*) = 0;
virtual void ComposeSamplerState(const D3D11X_SAMPLER_STATE_DESC*, D3D11X_DESCRIPTOR_SAMPLER_STATE*) = 0;
virtual void PlaceSwapChainView(ID3D11Resource*, ID3D11View*) = 0;
virtual void SetDebugFlags(unsigned int) = 0;
virtual unsigned int GetDebugFlags( ) = 0;
virtual void SetHangCallbacks(D3D11XHANGBEGINCALLBACK, D3D11XHANGPRINTCALLBACK, D3D11XHANGDUMPCALLBACK) = 0;
virtual void ReportGpuHang(unsigned int) = 0;
virtual HRESULT SetGpuMemoryPriority(unsigned int) = 0;
virtual void GetGpuHardwareConfiguration(D3D11X_GPU_HARDWARE_CONFIGURATION*) = 0;
};
class D3D11DeviceXWrapperX : public ID3D11DeviceX
{
public:
explicit D3D11DeviceXWrapperX(::ID3D11Device2* pDevice)
{
m_realDevice = pDevice;
m_RefCount = 1;
}
HRESULT QueryInterface(REFIID riid, void** ppvObject) override;
ULONG AddRef( ) override
{
printf("[D3D11DeviceXWrapperX] AddRef\n");
InterlockedIncrement(&m_RefCount);
return m_realDevice->AddRef( );
}
ULONG Release( ) override
{
ULONG refCount = InterlockedDecrement(&m_RefCount);
m_realDevice->Release( );
printf("[D3D11DeviceXWrapperX] Release\n");
if (refCount == 0)
{
printf("[D3D11DeviceXWrapperX] Release | refCount == 0, class being deleted.\n");
delete this;
}
return refCount;
}
// ID3D11Device
HRESULT SetPrivateDataInterfaceGraphics(const GUID& guid, const IGraphicsUnknown* pData) override
{
return m_realDevice->SetPrivateDataInterface(guid, (IUnknown*)pData);
}
HRESULT CreateBuffer(
const D3D11_BUFFER_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Buffer** ppBuffer) override {
return m_realDevice->CreateBuffer(pDesc, pInitialData, ppBuffer);
}
HRESULT CreateTexture1D(
const D3D11_TEXTURE1D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture1D** ppTexture1D) override {
return m_realDevice->CreateTexture1D(pDesc, pInitialData, ppTexture1D);
}
HRESULT CreateTexture2D(
const D3D11_TEXTURE2D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D** ppTexture2D) override;
HRESULT CreateTexture3D(
const D3D11_TEXTURE3D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D** ppTexture3D) override {
return m_realDevice->CreateTexture3D(pDesc, pInitialData, ppTexture3D);
}
HRESULT CreateShaderResourceView(
ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
ID3D11ShaderResourceView** ppSRView) override {
return m_realDevice->CreateShaderResourceView(pResource, pDesc, ppSRView);
}
HRESULT CreateUnorderedAccessView(
ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
ID3D11UnorderedAccessView** ppUAView) override {
return m_realDevice->CreateUnorderedAccessView(pResource, pDesc, ppUAView);
}
HRESULT CreateRenderTargetView(ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView** ppRTView) override;
HRESULT CreateDepthStencilView(
ID3D11Resource* pResource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
ID3D11DepthStencilView** ppDepthStencilView) override;
HRESULT CreateInputLayout(
const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs,
UINT NumElements,
const void* pShaderBytecodeWithInputSignature,
SIZE_T BytecodeLength,
ID3D11InputLayout** ppInputLayout) override {
return m_realDevice->CreateInputLayout(pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
}
HRESULT CreateVertexShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11VertexShader** ppVertexShader) override {
return m_realDevice->CreateVertexShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader);
}
HRESULT CreateGeometryShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11GeometryShader** ppGeometryShader) override {
return m_realDevice->CreateGeometryShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppGeometryShader);
}
HRESULT CreateGeometryShaderWithStreamOutput(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
const D3D11_SO_DECLARATION_ENTRY* pSODeclaration,
UINT NumEntries,
const UINT* pBufferStrides,
UINT NumStrides,
UINT RasterizedStream,
ID3D11ClassLinkage* pClassLinkage,
ID3D11GeometryShader** ppGeometryShader) override {
return m_realDevice->CreateGeometryShaderWithStreamOutput(pShaderBytecode, BytecodeLength, pSODeclaration, NumEntries, pBufferStrides, NumStrides, RasterizedStream, pClassLinkage, ppGeometryShader);
}
HRESULT CreatePixelShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11PixelShader** ppPixelShader) override {
return m_realDevice->CreatePixelShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader);
}
HRESULT CreateHullShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11HullShader** ppHullShader) override {
return m_realDevice->CreateHullShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppHullShader);
}
HRESULT CreateDomainShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11DomainShader** ppDomainShader) override {
return m_realDevice->CreateDomainShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppDomainShader);
}
HRESULT CreateComputeShader(
const void* pShaderBytecode,
SIZE_T BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
ID3D11ComputeShader** ppComputeShader) override {
return m_realDevice->CreateComputeShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppComputeShader);
}
HRESULT CreateClassLinkage(
ID3D11ClassLinkage** ppLinkage) override {
return m_realDevice->CreateClassLinkage(ppLinkage);
}
HRESULT CreateBlendState(
const D3D11_BLEND_DESC* pBlendStateDesc,
ID3D11BlendState** ppBlendState) override {
return m_realDevice->CreateBlendState(pBlendStateDesc, ppBlendState);
}
HRESULT CreateDepthStencilState(
const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc,
ID3D11DepthStencilState** ppDepthStencilState) override {
return m_realDevice->CreateDepthStencilState(pDepthStencilDesc, ppDepthStencilState);
}
HRESULT CreateRasterizerState(
const D3D11_RASTERIZER_DESC* pRasterizerDesc,
ID3D11RasterizerState** ppRasterizerState) override {
return m_realDevice->CreateRasterizerState(pRasterizerDesc, ppRasterizerState);
}
HRESULT CreateSamplerState(
const D3D11_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState) override {
return m_realDevice->CreateSamplerState(pSamplerDesc, ppSamplerState);
}
HRESULT CreateQuery(
const D3D11_QUERY_DESC* pQueryDesc,
ID3D11Query** ppQuery) override {
return m_realDevice->CreateQuery(pQueryDesc, ppQuery);
}
HRESULT CreatePredicate(
const D3D11_QUERY_DESC* pPredicateDesc,
ID3D11Predicate** ppPredicate) override {
return m_realDevice->CreatePredicate(pPredicateDesc, ppPredicate);
}
HRESULT CreateCounter(
const D3D11_COUNTER_DESC* pCounterDesc,
ID3D11Counter** ppCounter) override {
return m_realDevice->CreateCounter(pCounterDesc, ppCounter);
}
// @Patoke todo: unwrap
HRESULT CreateDeferredContext(
UINT ContextFlags,
::ID3D11DeviceContext** ppDeferredContext) override {
return m_realDevice->CreateDeferredContext(ContextFlags, ppDeferredContext);
}
HRESULT OpenSharedResource(
HANDLE hResource,
REFIID ReturnedInterface,
void** ppResource) override {
return m_realDevice->OpenSharedResource(hResource, ReturnedInterface, ppResource);
}
HRESULT CheckFormatSupport(
DXGI_FORMAT Format,
UINT* pFormatSupport) override {
return m_realDevice->CheckFormatSupport(Format, pFormatSupport);
}
HRESULT CheckMultisampleQualityLevels(
DXGI_FORMAT Format,
UINT SampleCount,
UINT* pNumQualityLevels) override {
return m_realDevice->CheckMultisampleQualityLevels(Format, SampleCount, pNumQualityLevels);
}
void CheckCounterInfo(
D3D11_COUNTER_INFO* pCounterInfo) override {
m_realDevice->CheckCounterInfo(pCounterInfo);
}
HRESULT CheckCounter(
const D3D11_COUNTER_DESC* pDesc,
D3D11_COUNTER_TYPE* pType,
UINT* pActiveCounters,
LPSTR szName,
UINT* pNameLength,
LPSTR szUnits,
UINT* pUnitsLength,
LPSTR szDescription,
UINT* pDescriptionLength) override {
return m_realDevice->CheckCounter(pDesc, pType, pActiveCounters, szName, pNameLength, szUnits, pUnitsLength, szDescription, pDescriptionLength);
}
HRESULT CheckFeatureSupport(
D3D11_FEATURE Feature,
void* pFeatureSupportData,
UINT FeatureSupportDataSize) override {
return m_realDevice->CheckFeatureSupport(Feature, pFeatureSupportData, FeatureSupportDataSize);
}
HRESULT GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData) override {
return m_realDevice->GetPrivateData(guid, pDataSize, pData);
}
HRESULT SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData) override {
return m_realDevice->SetPrivateData(guid, DataSize, pData);
}
HRESULT SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData) override {
return m_realDevice->SetPrivateDataInterface(guid, pData);
}
D3D_FEATURE_LEVEL GetFeatureLevel(void) override {
return m_realDevice->GetFeatureLevel( );
}
UINT GetCreationFlags(void) override {
return m_realDevice->GetCreationFlags( );
}
HRESULT GetDeviceRemovedReason(void) override {
return m_realDevice->GetDeviceRemovedReason( );
}
// @Patoke todo: unwrap
// @Aleblbl don :} (check cpp file)
void GetImmediateContext(ID3D11DeviceContext** ppImmediateContext) override;
HRESULT SetExceptionMode(
UINT RaiseFlags) override {
return m_realDevice->SetExceptionMode(RaiseFlags);
}
UINT GetExceptionMode(void) override { return m_realDevice->GetExceptionMode( ); }
// ID3D11Device1
// @Patoke todo: unwrap
void GetImmediateContext1(::ID3D11DeviceContext1** ppImmediateContext) override {
m_realDevice->GetImmediateContext1(ppImmediateContext);
}
// @Patoke todo: unwrap
HRESULT CreateDeferredContext1(UINT ContextFlags, ::ID3D11DeviceContext1** ppDeferredContext) override {
return m_realDevice->CreateDeferredContext1(ContextFlags, ppDeferredContext);
}
HRESULT CreateBlendState1(const D3D11_BLEND_DESC1* pBlendStateDesc, ID3D11BlendState1** ppBlendState) override {
return m_realDevice->CreateBlendState1(pBlendStateDesc, ppBlendState);
}
HRESULT CreateRasterizerState1(const D3D11_RASTERIZER_DESC1* pRasterizerDesc, ID3D11RasterizerState1** ppRasterizerState) override {
return m_realDevice->CreateRasterizerState1(pRasterizerDesc, ppRasterizerState);
}
HRESULT CreateDeviceContextState(UINT Flags, const D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, REFIID EmulatedInterface, D3D_FEATURE_LEVEL* pChosenFeatureLevel, ID3DDeviceContextState** ppContextState) override {
return m_realDevice->CreateDeviceContextState(Flags, pFeatureLevels, FeatureLevels, SDKVersion, EmulatedInterface, pChosenFeatureLevel, ppContextState);
}
HRESULT OpenSharedResource1(HANDLE hResource, REFIID returnedInterface, void** ppResource) override {
return m_realDevice->OpenSharedResource1(hResource, returnedInterface, ppResource);
}
HRESULT OpenSharedResourceByName(LPCWSTR lpName, DWORD dwDesiredAccess, REFIID returnedInterface, void** ppResource) override {
return m_realDevice->OpenSharedResourceByName(lpName, dwDesiredAccess, returnedInterface, ppResource);
}
// ID3D11Device2
// @Patoke todo: unwrap
void GetImmediateContext2(::ID3D11DeviceContext2** ppImmediateContext) override
{
m_realDevice->GetImmediateContext2(ppImmediateContext);
}
// @Patoke todo: unwrap
HRESULT CreateDeferredContext2(UINT ContextFlags, ::ID3D11DeviceContext2** ppDeferredContext) override
{
return m_realDevice->CreateDeferredContext2(ContextFlags, ppDeferredContext);
}
void GetResourceTiling(ID3D11Resource* pTiledResource, UINT* pNumTilesForEntireResource,
D3D11_PACKED_MIP_DESC* pPackedMipDesc, D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips,
UINT* pNumSubresourceTilings, UINT FirstSubresourceTilingToGet, D3D11_SUBRESOURCE_TILING* pSubresourceTilingsForNonPackedMips) override
{
m_realDevice->GetResourceTiling(pTiledResource, pNumTilesForEntireResource,
pPackedMipDesc, pStandardTileShapeForNonPackedMips, pNumSubresourceTilings,
FirstSubresourceTilingToGet, pSubresourceTilingsForNonPackedMips);
}
HRESULT CheckMultisampleQualityLevels1(DXGI_FORMAT Format, UINT SampleCount, UINT Flags, UINT* pNumQualityLevels) override
{
return m_realDevice->CheckMultisampleQualityLevels1(Format, SampleCount, Flags, pNumQualityLevels);
}
// ID3D11DeviceX
void GetImmediateContextX(ID3D11DeviceContextX**) override;
HRESULT CreateCounterSet(const D3D11X_COUNTER_SET_DESC*, ID3D11CounterSetX**) override;
HRESULT CreateCounterSample(ID3D11CounterSampleX**) override;
HRESULT SetDriverHint(UINT Feature, UINT Value) override;
HRESULT CreateDmaEngineContext(const D3D11_DMA_ENGINE_CONTEXT_DESC*, ID3D11DmaEngineContextX**) override;
int IsFencePending(UINT64) override;
int IsResourcePending(ID3D11Resource*) override;
HRESULT CreatePlacementBuffer(const D3D11_BUFFER_DESC*, void*, ID3D11Buffer**) override;
HRESULT CreatePlacementTexture1D(const D3D11_TEXTURE1D_DESC*, UINT, UINT, void*, ID3D11Texture1D**) override;
HRESULT CreatePlacementTexture2D(const D3D11_TEXTURE2D_DESC*, UINT, UINT, void*, ID3D11Texture2D**) override;
HRESULT CreatePlacementTexture3D(const D3D11_TEXTURE3D_DESC*, UINT, UINT, void*, ID3D11Texture3D**) override;
void GetTimestamps(UINT64*, UINT64*) override;
HRESULT CreateSamplerStateX(const D3D11X_SAMPLER_DESC*, ID3D11SamplerState**) override;
HRESULT CreateDeferredContextX(UINT, ID3D11DeviceContextX**) override;
void GarbageCollect(UINT) override;
HRESULT CreateDepthStencilStateX(const D3D11_DEPTH_STENCIL_DESC*, ID3D11DepthStencilState**) override;
HRESULT CreatePlacementRenderableTexture2D(const D3D11_TEXTURE2D_DESC*, UINT, UINT, const D3D11X_RENDERABLE_TEXTURE_ADDRESSES*, ID3D11Texture2D**) override;
void GetDriverStatistics(UINT, D3D11X_DRIVER_STATISTICS*) override;
HRESULT CreateComputeContextX(const D3D11_COMPUTE_CONTEXT_DESC*, ID3D11ComputeContextX**) override;
void ComposeShaderResourceView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW*) override;
void ComposeUnorderedAccessView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_UNORDERED_ACCESS_VIEW*) override;
void ComposeConstantBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_CONSTANT_BUFFER_VIEW*) override;
void ComposeVertexBufferView(const D3D11X_DESCRIPTOR_RESOURCE*, const D3D11X_RESOURCE_VIEW_DESC*, D3D11X_DESCRIPTOR_VERTEX_BUFFER_VIEW*) override;
void ComposeSamplerState(const D3D11X_SAMPLER_STATE_DESC*, D3D11X_DESCRIPTOR_SAMPLER_STATE*) override;
void PlaceSwapChainView(ID3D11Resource*, ID3D11View*) override;
void SetDebugFlags(UINT) override;
unsigned int GetDebugFlags( ) override;
void SetHangCallbacks(D3D11XHANGBEGINCALLBACK, D3D11XHANGPRINTCALLBACK, D3D11XHANGDUMPCALLBACK) override;
void ReportGpuHang(UINT) override;
HRESULT SetGpuMemoryPriority(UINT) override;
void GetGpuHardwareConfiguration(D3D11X_GPU_HARDWARE_CONFIGURATION*) override;
private:
::ID3D11Device2* m_realDevice;
};
}
+4
View File
@@ -0,0 +1,4 @@
#pragma once
#include "d3d11_x_device.h"
// @Patoke todo: add more stuff here?
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+44
View File
@@ -0,0 +1,44 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
resharper_cpp_non_inline_variable_definition_in_header_file_highlighting = none
resharper_cpp_enforce_overriding_function_style_highlighting = none;
+147
View File
@@ -0,0 +1,147 @@
#include "pch.h"
#include "CoreApplicationWrapperX.h"
#include "FrameworkViewSourceWrapper.h"
HRESULT CoreApplicationWrapperX::GetIids(ULONG* iidCount, IID** iids)
{
printf("GetIids\n");
return m_realFactory->GetIids(iidCount, iids);
}
HRESULT CoreApplicationWrapperX::GetRuntimeClassName(HSTRING* className)
{
printf("GetRuntimeClassName\n");
return m_realFactory->GetRuntimeClassName(className);
}
HRESULT CoreApplicationWrapperX::GetTrustLevel(TrustLevel* trustLevel)
{
printf("GetTrustLevel\n");
return m_realFactory->GetTrustLevel(trustLevel);
}
INT32 CoreApplicationWrapperX::_abi_add_Resuming(__FIEventHandler_1_IInspectable* handler, EventRegistrationToken* token)
{
printf("_abi_add_Resuming\n");
//return m_realCoreApplication->add_Resuming(handler, token);
return S_OK;
}
INT32 CoreApplicationWrapperX::_abi_remove_Resuming(EventRegistrationToken token)
{
printf("_abi_remove_Resuming\n");
return m_realCoreApplication->remove_Resuming(token);
}
INT32 CoreApplicationWrapperX::_abi_add_Suspending(__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs* handler, EventRegistrationToken* token)
{
printf("_abi_add_Suspending\n");
//return m_realCoreApplication->add_Suspending(handler, token);
return S_OK;
}
INT32 CoreApplicationWrapperX::_abi_remove_Suspending(EventRegistrationToken token)
{
printf("_abi_remove_Suspending\n");
return m_realCoreApplication->remove_Suspending(token);
}
HRESULT CoreApplicationWrapperX::_abi_get_ResourceAvailability(ResourceAvailability* resourceAvailability)
{
// TODO: Stubbed for now.
*resourceAvailability = ResourceAvailability_Full;
printf("_abi_get_ResourceAvailability\n");
return S_OK;
}
HRESULT CoreApplicationWrapperX::_abi_add_ResourceAvailabilityChanged(winrt::Windows::Foundation::EventHandler<IInspectable>* handler, EventRegistrationToken* token)
{
printf("_abi_add_ResourceAvailabilityChanged\n");
//Stubbed at this moment.
return 0;
}
HRESULT CoreApplicationWrapperX::_abi_remove_ResourceAvailabilityChanged(EventRegistrationToken token)
{
printf("_abi_remove_ResourceAvailabilityChanged\n");
//Stubbed at this moment.
return 0;
}
INT32 CoreApplicationWrapperX::_abi_GetCurrentView(ABI::Windows::ApplicationModel::Core::ICoreApplicationView** value)
{
printf("[CoreApplicationWrapperX] ---> _abi_GetCurrentView\n");
return m_realCoreApplication->GetCurrentView(value);
}
INT32 CoreApplicationWrapperX::_abi_Run(ABI::Windows::ApplicationModel::Core::IFrameworkViewSource* viewSource)
{
printf("_abi_Run\n");
// Wrap the ViewSource and pass it to the original function
FrameworkViewSourceWrapper* wrappedViewSource = new FrameworkViewSourceWrapper(viewSource);
return m_realCoreApplication->Run(wrappedViewSource);
}
INT32 CoreApplicationWrapperX::_abi_get_Id(HSTRING* value)
{
printf("_abi_get_Id\n");
return m_realCoreApplication->get_Id(value);
}
INT32 CoreApplicationWrapperX::_abi_get_Properties(ABI::Windows::Foundation::Collections::IPropertySet** value)
{
printf("_abi_get_Properties\n");
return m_realCoreApplication->get_Properties(value);
}
HRESULT CoreApplicationWrapperX::QueryInterface(const IID& riid, void** ppvObject)
{
if (riid == __uuidof(IActivationFactory) || riid == __uuidof(IUnknown))
{
*ppvObject = static_cast<IActivationFactory*>(this);
AddRef();
return S_OK;
}
else if (riid == __uuidof(ICoreApplicationX))
{
*ppvObject = static_cast<ICoreApplicationX*>(this);
AddRef();
return S_OK;
}
else if (riid == __uuidof(ICoreApplicationResourceAvailabilityX)) // allow ICoreApplicationResourceAvailabilityX interface
{
*ppvObject = static_cast<ICoreApplicationResourceAvailabilityX*>(this);
AddRef();
return S_OK;
}
// DEBUG
HRESULT hr = m_realFactory->QueryInterface(riid, ppvObject);
if(FAILED(hr))
{
char iidstr[sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}")];
OLECHAR iidwstr[sizeof(iidstr)];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
MessageBoxA(nullptr, iidstr, typeid(*this).name(), MB_OK);
}
*ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG CoreApplicationWrapperX::AddRef()
{
return InterlockedIncrement(&m_refCount);
}
ULONG CoreApplicationWrapperX::Release()
{
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0)
delete this;
return refCount;
}
+53
View File
@@ -0,0 +1,53 @@
#pragma once
#include "ICoreApplicationX.h"
class CoreApplicationWrapperX : public RuntimeClass<IActivationFactory, ICoreApplicationResourceAvailabilityX, ICoreApplicationX>
{
public:
CoreApplicationWrapperX(ComPtr<IActivationFactory> realFactory)
: m_realFactory(realFactory)
{
HRESULT hr = m_realFactory.As(&m_realCoreApplication); // this get ICoreApplication from the IActivationFactory
if (FAILED(hr)) {
return;
}
}
// for IActivationFactory
HRESULT STDMETHODCALLTYPE ActivateInstance(__RPC__deref_out_opt IInspectable** instance) override
{
return m_realFactory->ActivateInstance(instance);
}
public:
// ICoreApplicationX
INT32 _abi_get_Id(HSTRING* value) override;
INT32 _abi_add_Suspending(__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_Suspending(EventRegistrationToken token) override;
INT32 _abi_add_Resuming(__FIEventHandler_1_IInspectable* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_Resuming(EventRegistrationToken token) override;
INT32 _abi_get_Properties(ABI::Windows::Foundation::Collections::IPropertySet** value) override;
INT32 _abi_GetCurrentView(ABI::Windows::ApplicationModel::Core::ICoreApplicationView** value) override;
INT32 _abi_Run(ABI::Windows::ApplicationModel::Core::IFrameworkViewSource* viewSource) override;
// ICoreApplicationResourceAvailabilityX
HRESULT _abi_get_ResourceAvailability(ResourceAvailability* resourceAvailability) override;
HRESULT _abi_add_ResourceAvailabilityChanged(winrt::Windows::Foundation::EventHandler<IInspectable>* handler, EventRegistrationToken* token) override;
HRESULT _abi_remove_ResourceAvailabilityChanged(EventRegistrationToken token) override;
// IActivationFactory (IInspectable + IUnknown)
HRESULT QueryInterface(const IID& riid, void** ppvObject) override;
ULONG AddRef() override;
ULONG Release() override;
HRESULT GetIids(ULONG* iidCount, IID** iids) override;
HRESULT GetRuntimeClassName(HSTRING* className) override;
HRESULT GetTrustLevel(TrustLevel* trustLevel) override;
private:
long m_refCount = 1;
ComPtr<IActivationFactory> m_realFactory;
ComPtr<ICoreApplication> m_realCoreApplication; // ICoreApplication to forward the calls
};
+270
View File
@@ -0,0 +1,270 @@
#include "pch.h"
#include "CoreWindowWrapperX.h"
HRESULT CoreWindowWrapperX::GetIids(ULONG* iidCount, IID** iids)
{
printf("[CoreWindowWrapperX] --> GetIids\n");
return m_realWindow->GetIids(iidCount, iids);
}
HRESULT CoreWindowWrapperX::GetRuntimeClassName(HSTRING* className)
{
printf("[CoreWindowWrapperX] --> GetRuntimeClassName\n");
return m_realWindow->GetRuntimeClassName(className);
}
HRESULT CoreWindowWrapperX::GetTrustLevel(TrustLevel* trustLevel)
{
printf("[CoreWindowWrapperX] --> GetTrustLevel\n");
return m_realWindow->GetTrustLevel(trustLevel);
}
INT32 CoreWindowWrapperX::_abi_get_Bounds(Rect* rect)
{
printf("[CoreWindowWrapperX] --> _abi_get_Bounds\n");
return m_realWindow->get_Bounds(rect);
}
INT32 CoreWindowWrapperX::_abi_get_Dispatcher(ICoreDispatcher** dispatcher)
{
printf("[CoreWindowWrapperX] --> _abi_get_Dispatcher\n");
return m_realWindow->get_Dispatcher(dispatcher);
}
INT32 CoreWindowWrapperX::_abi_get_IsInputEnabled(boolean* value)
{
printf("[CoreWindowWrapperX] --> _abi_get_IsInputEnabled\n");
return m_realWindow->get_IsInputEnabled(value);
}
INT32 CoreWindowWrapperX::_abi_set_IsInputEnabled(boolean value)
{
printf("[CoreWindowWrapperX] --> _abi_set_IsInputEnabled\n");
return m_realWindow->put_IsInputEnabled(value);
}
INT32 CoreWindowWrapperX::_abi_get_Visible(boolean* value)
{
printf("[CoreWindowWrapperX] --> _abi_get_Visible\n");
return m_realWindow->get_Visible(value);
}
INT32 CoreWindowWrapperX::_abi_Activate()
{
printf("[CoreWindowWrapperX] --> _abi_Activate\n");
return m_realWindow->Activate();
}
INT32 CoreWindowWrapperX::_abi_Close()
{
printf("[CoreWindowWrapperX] --> _abi_Close\n");
return m_realWindow->Close();
}
INT32 CoreWindowWrapperX::_abi_get_AsyncKeyState(VirtualKey key, CoreVirtualKeyStates* value)
{
printf("[CoreWindowWrapperX] --> _abi_get_AsyncKeyState\n");
return m_realWindow->GetAsyncKeyState(key, value);
}
INT32 CoreWindowWrapperX::_abi_get_KeyState(VirtualKey key, CoreVirtualKeyStates* value)
{
printf("[CoreWindowWrapperX] --> _abi_get_KeyState\n");
return m_realWindow->GetKeyState(key, value);
}
INT32 CoreWindowWrapperX::_abi_add_Activated(ITypedEventHandler<CoreWindow*, WindowActivatedEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_Activated\n");
return m_realWindow->add_Activated(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_Activated(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_Activated\n");
return m_realWindow->remove_Activated(token);
}
INT32 CoreWindowWrapperX::_abi_add_CharacterReceived(ITypedEventHandler<CoreWindow*, CharacterReceivedEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_CharacterReceived\n");
// STUB
*token = EventRegistrationToken();
return S_OK;
//return m_realWindow->add_CharacterReceived(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_CharacterReceived(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_CharacterReceived\n");
return m_realWindow->remove_CharacterReceived(token);
}
INT32 CoreWindowWrapperX::_abi_add_Closed(ITypedEventHandler<CoreWindow*, CoreWindowEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_Closed\n");
// STUB
*token = EventRegistrationToken();
return S_OK;
//return m_realWindow->add_Closed(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_Closed(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_Closed\n");
return m_realWindow->remove_Closed(token);
}
INT32 CoreWindowWrapperX::_abi_add_InputEnabled(ITypedEventHandler<CoreWindow*, InputEnabledEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_InputEnabled\n");
return m_realWindow->add_InputEnabled(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_InputEnabled(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_InputEnabled\n");
return m_realWindow->remove_InputEnabled(token);
}
INT32 CoreWindowWrapperX::_abi_add_KeyDown(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_KeyDown\n");
// STUB
*token = EventRegistrationToken();
return S_OK;
//return m_realWindow->add_KeyDown(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_KeyDown(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_KeyDown\n");
return m_realWindow->remove_KeyDown(token);
}
INT32 CoreWindowWrapperX::_abi_add_KeyUp(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_KeyUp\n");
// STUB
*token = EventRegistrationToken();
return S_OK;
//return m_realWindow->add_KeyUp(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_KeyUp(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_KeyUp\n");
return m_realWindow->remove_KeyUp(token);
}
INT32 CoreWindowWrapperX::_abi_add_PointerMoved(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_PointerMoved\n");
return m_realWindow->add_PointerMoved(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_PointerMoved(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_PointerMoved\n");
return m_realWindow->remove_PointerMoved(token);
}
INT32 CoreWindowWrapperX::_abi_add_PointerEntered(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_PointerEntered\n");
return m_realWindow->add_PointerEntered(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_PointerEntered(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_PointerEntered\n");
return m_realWindow->remove_PointerEntered(token);
}
INT32 CoreWindowWrapperX::_abi_add_PointerExited(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_PointerExited\n");
return m_realWindow->add_PointerExited(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_PointerExited(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_PointerExited\n");
return m_realWindow->remove_PointerExited(token);
}
INT32 CoreWindowWrapperX::_abi_add_SizeChanged(ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_SizeChanged\n");
return m_realWindow->add_SizeChanged(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_SizeChanged(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_SizeChanged\n");
return m_realWindow->remove_SizeChanged(token);
}
INT32 CoreWindowWrapperX::_abi_add_VisibilityChanged(ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*>* handler,
EventRegistrationToken* token)
{
printf("[CoreWindowWrapperX] --> _abi_add_VisibilityChanged\n");
return m_realWindow->add_VisibilityChanged(handler, token);
}
INT32 CoreWindowWrapperX::_abi_remove_VisibilityChanged(EventRegistrationToken token)
{
printf("[CoreWindowWrapperX] --> _abi_remove_VisibilityChanged\n");
return m_realWindow->remove_VisibilityChanged(token);
}
HRESULT CoreWindowWrapperX::QueryInterface(const IID& riid, void** ppvObject)
{
printf("[CoreWindowWrapperX] --> QueryInterface\n");
if (riid == __uuidof(IUnknown) ||
riid == __uuidof(IInspectable) ||
riid == __uuidof(ICoreWindow) ||
riid == __uuidof(IAgileObject))
{
*ppvObject = this;
AddRef();
return S_OK;
}
*ppvObject = nullptr;
return E_NOINTERFACE;
//return m_realWindow->QueryInterface(riid, ppvObject);
}
ULONG CoreWindowWrapperX::AddRef()
{
printf("[CoreWindowWrapperX] --> AddRef\n");
return InterlockedIncrement(&m_refCount);
}
ULONG CoreWindowWrapperX::Release()
{
printf("[CoreWindowWrapperX] --> Release\n");
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0) delete this;
return refCount;
}
@@ -1,24 +1,22 @@
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppClassCanBeFinal
// ReSharper disable CppPolymorphicClassWithNonVirtualPublicDestructor
// ReSharper disable CppClangTidyClangDiagnosticNonVirtualDtor
#pragma once
#include <wrl/client.h>
#include "ICoreWindowX.h"
class CoreWindowX : public ICoreWindowX
class CoreWindowWrapperX : public ICoreWindowX
{
public:
CoreWindowX(CoreWindow* window)
long m_refCount = 1;
ICoreWindow* m_realWindow;
CoreWindowWrapperX(CoreWindow* realWind)
{
m_coreWindow = reinterpret_cast<ICoreWindow*>(window);
m_realWindow = reinterpret_cast<ICoreWindow*>(realWind);
}
public:
HRESULT GetIids(ULONG* iidCount, IID** iids) override;
HRESULT GetRuntimeClassName(HSTRING* className) override;
HRESULT GetTrustLevel(TrustLevel* trustLevel) override;
INT32 _abi_get_Bounds(Rect* rect) override;
INT32 _abi_get_Dispatcher(ICoreDispatcher** dispatcher) override;
INT32 _abi_get_IsInputEnabled(boolean* value) override;
@@ -28,43 +26,39 @@ public:
INT32 _abi_Close() override;
INT32 _abi_get_AsyncKeyState(VirtualKey key, CoreVirtualKeyStates* value) override;
INT32 _abi_get_KeyState(VirtualKey key, CoreVirtualKeyStates* value) override;
INT32 _abi_add_Activated(ITypedEventHandler<CoreWindow*, WindowActivatedEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_Activated(ITypedEventHandler<CoreWindow*, WindowActivatedEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_Activated(EventRegistrationToken token) override;
INT32 _abi_add_CharacterRecieved(ITypedEventHandler<CoreWindow*, CharacterReceivedEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_remove_CharacterRecieved(EventRegistrationToken token) override;
INT32 _abi_add_Closed(ITypedEventHandler<CoreWindow*, CoreWindowEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_CharacterReceived(ITypedEventHandler<CoreWindow*, CharacterReceivedEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_CharacterReceived(EventRegistrationToken token) override;
INT32 _abi_add_Closed(ITypedEventHandler<CoreWindow*, CoreWindowEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_Closed(EventRegistrationToken token) override;
INT32 _abi_add_InputEnabled(ITypedEventHandler<CoreWindow*, InputEnabledEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_InputEnabled(ITypedEventHandler<CoreWindow*, InputEnabledEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_InputEnabled(EventRegistrationToken token) override;
INT32 _abi_add_KeyDown(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_KeyDown(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_KeyDown(EventRegistrationToken token) override;
INT32 _abi_add_KeyUp(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_KeyUp(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_KeyUp(EventRegistrationToken token) override;
INT32 _abi_add_PointerMoved(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_PointerMoved(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_PointerMoved(EventRegistrationToken token) override;
INT32 _abi_add_PointerEntered(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_PointerEntered(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_PointerEntered(EventRegistrationToken token) override;
INT32 _abi_add_PointerExited(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_PointerExited(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_PointerExited(EventRegistrationToken token) override;
INT32 _abi_add_SizeChanged(ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_SizeChanged(ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_SizeChanged(EventRegistrationToken token) override;
INT32 _abi_add_VisibilityChanged(ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*>* handler,
EventRegistrationToken* token) override;
INT32 _abi_add_VisibilityChanged(ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*>* handler, EventRegistrationToken* token) override;
INT32 _abi_remove_VisibilityChanged(EventRegistrationToken token) override;
// IInspectable + IUnknown
HRESULT QueryInterface(const IID& riid, void** ppvObject) override;
ULONG AddRef() override;
ULONG Release() override;
HRESULT GetIids(ULONG* iidCount, IID** iids) override;
HRESULT GetRuntimeClassName(HSTRING* className) override;
HRESULT GetTrustLevel(TrustLevel* trustLevel) override;
private:
ICoreWindow* m_coreWindow;
};
-201
View File
@@ -1,201 +0,0 @@
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppFunctionResultShouldBeUsed
// ReSharper disable CppParameterMayBeConst
#include "pch.h"
#include "CoreWindowX.h"
HRESULT CoreWindowX::GetIids(ULONG* iidCount, IID** iids)
{
return m_coreWindow->GetIids(iidCount, iids);
}
HRESULT CoreWindowX::GetRuntimeClassName(HSTRING* className)
{
return m_coreWindow->GetRuntimeClassName(className);
}
HRESULT CoreWindowX::GetTrustLevel(TrustLevel* trustLevel)
{
return m_coreWindow->GetTrustLevel(trustLevel);
}
INT32 CoreWindowX::_abi_get_Bounds(Rect* rect)
{
return m_coreWindow->get_Bounds(rect);
}
INT32 CoreWindowX::_abi_get_Dispatcher(ICoreDispatcher** dispatcher)
{
return m_coreWindow->get_Dispatcher(dispatcher);
}
INT32 CoreWindowX::_abi_get_IsInputEnabled(boolean* value)
{
return m_coreWindow->get_IsInputEnabled(value);
}
INT32 CoreWindowX::_abi_set_IsInputEnabled(boolean value)
{
return m_coreWindow->put_IsInputEnabled(value);
}
INT32 CoreWindowX::_abi_get_Visible(boolean* value)
{
return m_coreWindow->get_Visible(value);
}
INT32 CoreWindowX::_abi_Activate()
{
return m_coreWindow->Activate();
}
INT32 CoreWindowX::_abi_Close()
{
return m_coreWindow->Close();
}
INT32 CoreWindowX::_abi_get_AsyncKeyState(VirtualKey key, CoreVirtualKeyStates* value)
{
return m_coreWindow->GetAsyncKeyState(key, value);
}
INT32 CoreWindowX::_abi_get_KeyState(VirtualKey key, CoreVirtualKeyStates* value)
{
return m_coreWindow->GetKeyState(key, value);
}
INT32 CoreWindowX::_abi_add_Activated(ITypedEventHandler<CoreWindow*, WindowActivatedEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_Activated(handler, token);
}
INT32 CoreWindowX::_abi_remove_Activated(EventRegistrationToken token)
{
return m_coreWindow->remove_Activated(token);
}
INT32 CoreWindowX::_abi_add_CharacterRecieved(ITypedEventHandler<CoreWindow*, CharacterReceivedEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_CharacterReceived(handler, token);
}
INT32 CoreWindowX::_abi_remove_CharacterRecieved(EventRegistrationToken token)
{
return m_coreWindow->remove_CharacterReceived(token);
}
INT32 CoreWindowX::_abi_add_Closed(ITypedEventHandler<CoreWindow*, CoreWindowEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_Closed(handler, token);
}
INT32 CoreWindowX::_abi_remove_Closed(EventRegistrationToken token)
{
return m_coreWindow->remove_Closed(token);
}
INT32 CoreWindowX::_abi_add_InputEnabled(ITypedEventHandler<CoreWindow*, InputEnabledEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_InputEnabled(handler, token);
}
INT32 CoreWindowX::_abi_remove_InputEnabled(EventRegistrationToken token)
{
return m_coreWindow->remove_InputEnabled(token);
}
INT32 CoreWindowX::_abi_add_KeyDown(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_KeyDown(handler, token);
}
INT32 CoreWindowX::_abi_remove_KeyDown(EventRegistrationToken token)
{
return m_coreWindow->remove_KeyDown(token);
}
INT32 CoreWindowX::_abi_add_KeyUp(ITypedEventHandler<CoreWindow*, KeyEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_KeyUp(handler, token);
}
INT32 CoreWindowX::_abi_remove_KeyUp(EventRegistrationToken token)
{
return m_coreWindow->remove_KeyUp(token);
}
INT32 CoreWindowX::_abi_add_PointerMoved(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_PointerMoved(handler, token);
}
INT32 CoreWindowX::_abi_remove_PointerMoved(EventRegistrationToken token)
{
return m_coreWindow->remove_PointerMoved(token);
}
INT32 CoreWindowX::_abi_add_PointerEntered(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_PointerEntered(handler, token);
}
INT32 CoreWindowX::_abi_remove_PointerEntered(EventRegistrationToken token)
{
return m_coreWindow->remove_PointerEntered(token);
}
INT32 CoreWindowX::_abi_add_PointerExited(ITypedEventHandler<CoreWindow*, PointerEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_PointerExited(handler, token);
}
INT32 CoreWindowX::_abi_remove_PointerExited(EventRegistrationToken token)
{
return m_coreWindow->remove_PointerExited(token);
}
INT32 CoreWindowX::_abi_add_SizeChanged(ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_SizeChanged(handler, token);
}
INT32 CoreWindowX::_abi_remove_SizeChanged(EventRegistrationToken token)
{
return m_coreWindow->remove_SizeChanged(token);
}
INT32 CoreWindowX::_abi_add_VisibilityChanged(ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*>* handler,
EventRegistrationToken* token)
{
return m_coreWindow->add_VisibilityChanged(handler, token);
}
INT32 CoreWindowX::_abi_remove_VisibilityChanged(EventRegistrationToken token)
{
return m_coreWindow->remove_VisibilityChanged(token);
}
HRESULT CoreWindowX::QueryInterface(const IID& riid, void** ppvObject)
{
return m_coreWindow->QueryInterface(riid, ppvObject);
}
ULONG CoreWindowX::AddRef()
{
return m_coreWindow->AddRef();
}
ULONG CoreWindowX::Release()
{
return m_coreWindow->Release();
}
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include "pch.h"
struct CForzaThread
{
DWORD Id;
HANDLE Handle;
DWORD StackSize;
DWORD AffinityMask;
DWORD Priority;
char Name[128];
};
struct FmodThread
{
void* virtualtable;
char Name[256];
};
DWORD(*P_StartForzaThread_X)(CForzaThread*, LPTHREAD_START_ROUTINE, LPVOID);
DWORD(*P_FmodThreadProc_X)(FmodThread*);
DWORD D_StartForzaThread_X(CForzaThread* Thread, LPTHREAD_START_ROUTINE StartAddress, LPVOID Parameter)
{
WCHAR ThreadName[128];
ZeroMemory(ThreadName, sizeof(ThreadName));
DWORD r = P_StartForzaThread_X(Thread, StartAddress, Parameter);
MultiByteToWideChar(CP_UTF8, 0, Thread->Name, 128, ThreadName, 128);
SetThreadDescription(Thread->Handle, ThreadName);
return r;
}
DWORD D_FmodThreadProc_X(FmodThread* Thread)
{
WCHAR ThreadName[256];
MultiByteToWideChar(CP_UTF8, 0, Thread->Name, 256, ThreadName, 256);
SetThreadDescription(GetCurrentThread(), ThreadName);
return P_FmodThreadProc_X(Thread);
}
@@ -0,0 +1,65 @@
#include "pch.h"
#include "FrameworkViewSourceWrapper.h"
#include "FrameworkViewWrapper.h"
HRESULT __stdcall FrameworkViewSourceWrapper::CreateView(ABI::Windows::ApplicationModel::Core::IFrameworkView** viewProvider)
{
auto hr = m_realViewSource->CreateView(viewProvider);
if (SUCCEEDED(hr))
*viewProvider = new FrameworkViewWrapper(*viewProvider);
return hr;
}
HRESULT FrameworkViewSourceWrapper::QueryInterface(const IID& riid, void** ppvObject)
{
if (riid == __uuidof(IFrameworkViewSource))
{
*ppvObject = this;
AddRef();
return S_OK;
}
else
{
// DEBUG
char iidstr[sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}")];
OLECHAR iidwstr[sizeof(iidstr)];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
MessageBoxA(nullptr, iidstr, typeid(*this).name(), MB_OK);
}
return m_realViewSource->QueryInterface(riid, ppvObject);
}
ULONG FrameworkViewSourceWrapper::AddRef()
{
return InterlockedIncrement(&m_refCount);
}
ULONG FrameworkViewSourceWrapper::Release()
{
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT FrameworkViewSourceWrapper::GetIids(ULONG* iidCount, IID** iids)
{
return m_realViewSource->GetIids(iidCount, iids);
}
HRESULT FrameworkViewSourceWrapper::GetRuntimeClassName(HSTRING* className)
{
return m_realViewSource->GetRuntimeClassName(className);
}
HRESULT FrameworkViewSourceWrapper::GetTrustLevel(TrustLevel* trustLevel)
{
return m_realViewSource->GetTrustLevel(trustLevel);
}
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include "ICoreApplicationX.h"
class FrameworkViewSourceWrapper : public IFrameworkViewSource
{
public:
FrameworkViewSourceWrapper(IFrameworkViewSource* windowViewSource)
: m_realViewSource(windowViewSource)
{
}
HRESULT STDMETHODCALLTYPE CreateView(ABI::Windows::ApplicationModel::Core::IFrameworkView** viewProvider) override;
// IActivationFactory (IInspectable + IUnknown)
HRESULT QueryInterface(const IID& riid, void** ppvObject) override;
ULONG AddRef() override;
ULONG Release() override;
HRESULT GetIids(ULONG* iidCount, IID** iids) override;
HRESULT GetRuntimeClassName(HSTRING* className) override;
HRESULT GetTrustLevel(TrustLevel* trustLevel) override;
private:
long m_refCount = 1;
IFrameworkViewSource* m_realViewSource;
};
+83
View File
@@ -0,0 +1,83 @@
#include "pch.h"
#include "FrameworkViewWrapper.h"
HRESULT __stdcall FrameworkViewWrapper::Initialize(ABI::Windows::ApplicationModel::Core::ICoreApplicationView* applicationView)
{
return m_realView->Initialize(applicationView);
}
HRESULT __stdcall FrameworkViewWrapper::SetWindow(ABI::Windows::UI::Core::ICoreWindow* window)
{
// Finally Wraps the coreWindow with xbox CoreWindow
window = reinterpret_cast<ICoreWindow*>(new CoreWindowWrapperX((CoreWindow*)window));
return m_realView->SetWindow(window);
}
HRESULT __stdcall FrameworkViewWrapper::Load(HSTRING entryPoint)
{
return m_realView->Load(entryPoint);
}
HRESULT __stdcall FrameworkViewWrapper::Run(void)
{
return m_realView->Run();
}
HRESULT __stdcall FrameworkViewWrapper::Uninitialize(void)
{
return m_realView->Uninitialize();
}
HRESULT FrameworkViewWrapper::QueryInterface(const IID& riid, void** ppvObject)
{
if (riid == __uuidof(IFrameworkView) ||
riid == __uuidof(IUnknown) ||
riid == __uuidof(IInspectable))
{
*ppvObject = this;
AddRef();
return S_OK;
}
else
{
/*/ DEBUG
char iidstr[sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}")];
OLECHAR iidwstr[sizeof(iidstr)];
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
MessageBoxA(nullptr, iidstr, typeid(*this).name(), MB_OK);*/
}
return m_realView->QueryInterface(riid, ppvObject);
}
ULONG FrameworkViewWrapper::AddRef()
{
return InterlockedIncrement(&m_refCount);
}
ULONG FrameworkViewWrapper::Release()
{
ULONG refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0)
delete this;
return refCount;
}
HRESULT FrameworkViewWrapper::GetIids(ULONG* iidCount, IID** iids)
{
return m_realView->GetIids(iidCount, iids);
}
HRESULT FrameworkViewWrapper::GetRuntimeClassName(HSTRING* className)
{
return m_realView->GetRuntimeClassName(className);
}
HRESULT FrameworkViewWrapper::GetTrustLevel(TrustLevel* trustLevel)
{
return m_realView->GetTrustLevel(trustLevel);
}
+33
View File
@@ -0,0 +1,33 @@
#pragma once
#include "ICoreApplicationX.h"
class FrameworkViewWrapper : public IFrameworkView
{
public:
FrameworkViewWrapper(IFrameworkView* windowView)
: m_realView(windowView)
{
}
HRESULT STDMETHODCALLTYPE Initialize(ABI::Windows::ApplicationModel::Core::ICoreApplicationView* applicationView) override;
HRESULT STDMETHODCALLTYPE SetWindow(ABI::Windows::UI::Core::ICoreWindow* window) override;
HRESULT STDMETHODCALLTYPE Load(HSTRING entryPoint) override;
HRESULT STDMETHODCALLTYPE Run(void) override;
HRESULT STDMETHODCALLTYPE Uninitialize(void) override;
// IActivationFactory (IInspectable + IUnknown)
HRESULT QueryInterface(const IID& riid, void** ppvObject) override;
ULONG AddRef() override;
ULONG Release() override;
HRESULT GetIids(ULONG* iidCount, IID** iids) override;
HRESULT GetRuntimeClassName(HSTRING* className) override;
HRESULT GetTrustLevel(TrustLevel* trustLevel) override;
private:
long m_refCount = 1;
IFrameworkView* m_realView;
};
@@ -0,0 +1,25 @@
#pragma once
#include <winrt/Windows.ApplicationModel.h>
#include <windows.ui.core.h>
using namespace ABI::Windows::ApplicationModel;
using namespace ABI::Windows::ApplicationModel::Activation;
using namespace ABI::Windows::ApplicationModel::Core;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::System;
enum ResourceAvailability
{
ResourceAvailability_Full,
ResourceAvailability_Constrained,
ResourceAvailability_FullWithExtendedSystemReserve,
};
MIDL_INTERFACE("9FF3799E-6E83-468C-A5B0-501CE6BB0FA1")
ICoreApplicationResourceAvailabilityX : public IInspectable
{
public:
STDMETHOD(_abi_get_ResourceAvailability)(ResourceAvailability *) PURE;
STDMETHOD(_abi_add_ResourceAvailabilityChanged)(winrt::Windows::Foundation::EventHandler<IInspectable>* handler, EventRegistrationToken* token) PURE;
STDMETHOD(_abi_remove_ResourceAvailabilityChanged)(EventRegistrationToken) PURE;
};
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <winrt/Windows.ApplicationModel.h>
#include <windows.ui.core.h>
#include "ICoreApplicationResourceAvailabilityX.h"
using namespace ABI::Windows::ApplicationModel;
using namespace ABI::Windows::ApplicationModel::Activation;
using namespace ABI::Windows::ApplicationModel::Core;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::System;
MIDL_INTERFACE("0aacf7a4-5e1d-49df-8034-fb6a68bc5ed1")
ICoreApplicationX : public IInspectable
{
public:
virtual HRESULT QueryInterface(const IID & riid, void** ppvObject) override = 0;
virtual ULONG AddRef() override = 0;
virtual ULONG Release() override = 0;
virtual INT32 _abi_get_Id(HSTRING* value) = 0;
virtual INT32 _abi_add_Suspending(__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs* handler, EventRegistrationToken* token) = 0;
virtual INT32 _abi_remove_Suspending(EventRegistrationToken token) = 0;
virtual INT32 _abi_add_Resuming(__FIEventHandler_1_IInspectable* handler, EventRegistrationToken* token) = 0;
virtual INT32 _abi_remove_Resuming(EventRegistrationToken token) = 0;
virtual INT32 _abi_get_Properties(ABI::Windows::Foundation::Collections::IPropertySet** value) = 0;
virtual INT32 _abi_GetCurrentView(ABI::Windows::ApplicationModel::Core::ICoreApplicationView** value) = 0;
virtual INT32 _abi_Run(ABI::Windows::ApplicationModel::Core::IFrameworkViewSource* viewSource) = 0;
//virtual INT32 _abi_RunWithActivationFactories(ABI::Windows::Foundation::IGetActivationFactory* activationFactoryCallback) = 0;
};
+10 -13
View File
@@ -1,21 +1,22 @@
// ReSharper disable CppPolymorphicClassWithNonVirtualPublicDestructor
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppClangTidyClangDiagnosticNonVirtualDtor
// ReSharper disable IdentifierTypo
// ReSharper disable CppClangTidyClangDiagnosticHeaderHygiene
#pragma once
#include <inspectable.h>
#include <windows.foundation.h>
#include <windows.ui.core.h>
#include <windows.system.h>
#include <wrl.h>
using namespace Microsoft::WRL;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::UI::Core;
using namespace ABI::Windows::System;
class ICoreWindowX : public IInspectable
MIDL_INTERFACE("79b9d5f2-879e-4b89-b798-79e47598030c")
ICoreWindowX : public IInspectable
{
public:
virtual HRESULT QueryInterface(const IID & riid, void** ppvObject) override = 0;
virtual ULONG AddRef() override = 0;
virtual ULONG Release() override = 0;
virtual INT32 _abi_get_Bounds(Rect* rect) = 0;
virtual INT32 _abi_get_Dispatcher(ICoreDispatcher** dispatcher) = 0;
virtual INT32 _abi_get_IsInputEnabled(boolean* value) = 0;
@@ -27,8 +28,8 @@ public:
virtual INT32 _abi_get_KeyState(VirtualKey key, CoreVirtualKeyStates* value) = 0;
virtual INT32 _abi_add_Activated(ITypedEventHandler<CoreWindow*, WindowActivatedEventArgs*>* handler, EventRegistrationToken* token) = 0;
virtual INT32 _abi_remove_Activated(EventRegistrationToken token) = 0;
virtual INT32 _abi_add_CharacterRecieved(ITypedEventHandler<CoreWindow*, CharacterReceivedEventArgs*>* handler, EventRegistrationToken* token) = 0;
virtual INT32 _abi_remove_CharacterRecieved(EventRegistrationToken token) = 0;
virtual INT32 _abi_add_CharacterReceived(ITypedEventHandler<CoreWindow*, CharacterReceivedEventArgs*>* handler, EventRegistrationToken* token) = 0;
virtual INT32 _abi_remove_CharacterReceived(EventRegistrationToken token) = 0;
virtual INT32 _abi_add_Closed(ITypedEventHandler<CoreWindow*, CoreWindowEventArgs*>* handler, EventRegistrationToken* token) = 0;
virtual INT32 _abi_remove_Closed(EventRegistrationToken token) = 0;
virtual INT32 _abi_add_InputEnabled(ITypedEventHandler<CoreWindow*, InputEnabledEventArgs*>* handler, EventRegistrationToken* token) = 0;
@@ -47,8 +48,4 @@ public:
virtual INT32 _abi_remove_SizeChanged(EventRegistrationToken token) = 0;
virtual INT32 _abi_add_VisibilityChanged(ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*>* handler, EventRegistrationToken* token) = 0;
virtual INT32 _abi_remove_VisibilityChanged(EventRegistrationToken token) = 0;
virtual HRESULT QueryInterface(const IID& riid, void** ppvObject) override = 0;
virtual ULONG AddRef() override = 0;
virtual ULONG Release() override = 0;
};
+114 -36
View File
@@ -1,37 +1,115 @@
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppParameterMayBeConst
// ReSharper disable CppClangTidyClangDiagnosticMicrosoftCast
// ReSharper disable CppClangTidyClangDiagnosticUndefinedReinterpretCast
// ReSharper disable CppClangTidyClangDiagnosticShadow
// ReSharper disable CppClangTidyClangDiagnosticCastFunctionTypeStrict
// ReSharper disable CppFunctionalStyleCast
// ReSharper disable CppClangTidyClangDiagnosticCastAlign
// ReSharper disable CppClangTidyClangDiagnosticCastQual
// ReSharper disable CppZeroConstantCanBeReplacedWithNullptr
#include "pch.h"
#include "hooks.h"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID reserved)
{
if (DetourIsHelperProcess()) return TRUE;
if (dwReason == DLL_PROCESS_ATTACH)
{
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&reinterpret_cast<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourTransactionCommit();
}
else if (dwReason == DLL_PROCESS_DETACH)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&reinterpret_cast<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourDetach(&TrueGetForCurrentThread, GetForCurrentThread_Hook);
DetourTransactionCommit();
}
return TRUE;
#include "pch.h"
#include "hooks.h"
#include "ForzaThreadHook_X.h"
#include "kernelx.h"
// note from unixian: i used this since using appxlauncher requires me attaching to the game after it launches
#define WINDURANGO_WAIT_FOR_DEBUGGER 0
//Rodrigo Todescatto: For debbuging Forza.
#define RETURN_IF_FAILED(hr) if (FAILED(hr)) return hr
#define FORZADEBUG
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID reserved)
{
winrt::hstring GamePackage = winrt::Windows::ApplicationModel::Package::Current().Id().FamilyName();
InitializeCriticalSection(&XMemSetAllocationHooksLock_X);
if (DetourIsHelperProcess()) return TRUE;
if (dwReason == DLL_PROCESS_ATTACH)
{
#ifdef _DEBUG
// note from unixian: some games do not create a console window, so if one isn't already created, we create one.
if (!GetConsoleWindow())
{
AllocConsole();
FILE* stream;
freopen_s(&stream, "CONOUT$", "w", stdout);
SetConsoleTitleA("WinDurango Debug Console");
}
#ifdef FORZADEBUG
//Rodrigo Todescatto: Forza Horizon 2 Demo.
if (GamePackage == L"265E1020-Anthem_8wekyb3d8bbwe")
{
printf("Forza Horizon 2 Demo\n");
*(void**)&P_StartForzaThread_X = (char*)GetModuleHandleW(nullptr) + 0xFE6920;
if (FAILED(P_StartForzaThread_X))
{
printf("P_StartForzaThread_X failed!\n");
OutputDebugStringW(L"P_StartForzaThread_X failed!\n");
}
if (SUCCEEDED(P_StartForzaThread_X))
{
printf("P_StartForzaThread_X succeeded!\n");
OutputDebugStringW(L"P_StartForzaThread_X succeeded!\n");
}
RETURN_IF_FAILED(HRESULT_FROM_WIN32(DetourAttach((void**)&P_StartForzaThread_X, &D_StartForzaThread_X)));
}
//Rodrigo Todescatto: Forza Horizon 2.
if (GamePackage == L"Anthem_8wekyb3d8bbwe")
{
printf("Forza Horizon 2\n");
*(void**)&P_StartForzaThread_X = (char*)GetModuleHandleW(nullptr) + 0x1081A90;
if (FAILED(P_StartForzaThread_X))
{
printf("P_StartForzaThread_X failed!\n");
OutputDebugStringW(L"P_StartForzaThread_X failed!\n");
}
if (SUCCEEDED(P_StartForzaThread_X))
{
printf("P_StartForzaThread_X succeeded!\n");
OutputDebugStringW(L"P_StartForzaThread_X succeeded!\n");
}
*(void**)&P_FmodThreadProc_X = (char*)GetModuleHandleW(nullptr) + 0x19D3F80;
if (FAILED(P_FmodThreadProc_X))
{
printf("P_FmodThreadProc_X failed!\n");
OutputDebugStringW(L"P_FmodThreadProc_X failed!\n");
}
if (SUCCEEDED(P_FmodThreadProc_X))
{
printf("P_FmodThreadProc_X succeeded!\n");
OutputDebugStringW(L"P_FmodThreadProc_X succeeded!\n");
}
RETURN_IF_FAILED(HRESULT_FROM_WIN32(DetourAttach((void**)&P_StartForzaThread_X, &D_StartForzaThread_X)));
RETURN_IF_FAILED(HRESULT_FROM_WIN32(DetourAttach((void**)&P_FmodThreadProc_X, &D_FmodThreadProc_X)));
}
//Rodrigo Todescatto: Forza Motorsport 5.
if (GamePackage == L"Forza_8wekyb3d8bbwe")
{
printf("Forza Motorsport 5");
}
//Rodrigo Todescatto: Forza Horizon 2 Presents Fast & Furious.
if (GamePackage == L"Spire_8wekyb3d8bbwe")
{
printf("Forza Horizon 2 Presents Fast & Furious");
}
#endif
#if WINDURANGO_WAIT_FOR_DEBUGGER
printf("Waiting for debugger...\n");
while (!IsDebuggerPresent())
Sleep(1);
#endif
#endif
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&reinterpret_cast<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourTransactionCommit();
}
else if (dwReason == DLL_PROCESS_DETACH)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&reinterpret_cast<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourTransactionCommit();
}
return TRUE;
}
+137 -85
View File
@@ -1,86 +1,138 @@
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppParameterMayBeConst
// ReSharper disable CppClangTidyClangDiagnosticMicrosoftCast
// ReSharper disable CppClangTidyClangDiagnosticUndefinedReinterpretCast
// ReSharper disable CppClangTidyClangDiagnosticShadow
// ReSharper disable CppClangTidyClangDiagnosticCastFunctionTypeStrict
// ReSharper disable CppFunctionalStyleCast
// ReSharper disable CppClangTidyClangDiagnosticCastAlign
// ReSharper disable CppClangTidyClangDiagnosticCastQual
// ReSharper disable CppZeroConstantCanBeReplacedWithNullptr
#pragma once
inline bool IsClassName(HSTRING classId, const char* classIdName)
{
const wchar_t* classIdString = WindowsGetStringRawBuffer(classId, nullptr);
std::wstring classIdWString(classIdString);
const std::string classIdStringUTF8(classIdWString.begin(), classIdWString.end());
return (classIdStringUTF8 == classIdName);
}
typedef HRESULT(*DllGetForCurrentThreadFunc) (ICoreWindowStatic*, CoreWindow**);
typedef HRESULT(*DllGetActivationFactoryFunc) (HSTRING, IActivationFactory**);
DllGetForCurrentThreadFunc pDllGetForCurrentThread = nullptr;
DllGetActivationFactoryFunc pDllGetActivationFactory = nullptr;
HRESULT(STDMETHODCALLTYPE* TrueGetForCurrentThread)(ICoreWindowStatic* staticWindow, CoreWindow** window);
HRESULT(WINAPI* TrueRoGetActivationFactory)(HSTRING classId, REFIID iid, void** factory) = RoGetActivationFactory;
inline HRESULT STDMETHODCALLTYPE GetForCurrentThread_Hook(ICoreWindowStatic* paramThis, CoreWindow** window)
{
// ReSharper disable once CppLocalVariableMayBeConst
HRESULT hr = TrueGetForCurrentThread(paramThis, window);
//*reinterpret_cast<void**>(window) = new CoreWindowX(*window);
auto p = *reinterpret_cast<void**>(window);
p = new CoreWindowX(*window);
return hr;
}
inline HRESULT WINAPI RoGetActivationFactory_Hook(HSTRING classId, REFIID iid, void** factory)
{
auto hr = TrueRoGetActivationFactory(classId, iid, factory);
if (FAILED(hr))
{
auto library = LoadPackagedLibrary(L"winrt_x.dll", 0);
if (!library) library = LoadLibraryW(L"winrt_x.dll");
if (!library) return hr;
pDllGetActivationFactory = reinterpret_cast<DllGetActivationFactoryFunc>
(GetProcAddress(library, "DllGetActivationFactory"));
if (!pDllGetActivationFactory)
return hr;
ComPtr<IActivationFactory> _factory;
if (IsClassName(classId, "Windows.UI.Core.CoreWindow"))
{
ComPtr<ICoreWindowStatic> coreWindowStatic;
hr = RoGetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get(), IID_PPV_ARGS(&coreWindowStatic));
*reinterpret_cast<void**>(&TrueGetForCurrentThread) = (*reinterpret_cast<void***>(coreWindowStatic.Get()))[6];
DetourAttach(&TrueGetForCurrentThread, GetForCurrentThread_Hook);
}
else
{
hr = pDllGetActivationFactory(classId, _factory.GetAddressOf());
}
if (FAILED(hr)) return hr;
return _factory.CopyTo(iid, factory);
}
return hr;
#pragma once
#include <winrt/Windows.ApplicationModel.h>
#include "utils.h"
#include "CoreApplicationWrapperX.h"
#include <windows.applicationmodel.core.h>
/* This function is used to compare the class name of the classId with the classIdName. */
inline bool IsClassName(HSTRING classId, const char* classIdName)
{
const wchar_t* classIdString = WindowsGetStringRawBuffer(classId, nullptr);
std::wstring classIdWString(classIdString);
const std::string classIdStringUTF8(classIdWString.begin(), classIdWString.end());
return (classIdStringUTF8 == classIdName);
}
/* Function pointers for the DllGetForCurrentThread */
typedef HRESULT(*DllGetForCurrentThreadFunc) (ICoreWindowStatic*, CoreWindow**);
/* Function pointers for the DllGetForCurrentThread */
DllGetForCurrentThreadFunc pDllGetForCurrentThread = nullptr;
/* Function pointers for the DllGetForCurrentThread */
HRESULT(STDMETHODCALLTYPE* TrueGetForCurrentThread)(ICoreWindowStatic* staticWindow, CoreWindow** window);
/* Function pointers for the DllGetActivationFactory */
typedef HRESULT(*DllGetActivationFactoryFunc) (HSTRING, IActivationFactory**);
/* Function pointers for the DllGetActivationFactory */
DllGetActivationFactoryFunc pDllGetActivationFactory = nullptr;
/* Function pointers for the WinRT RoGetActivationFactory function. */
HRESULT(WINAPI* TrueRoGetActivationFactory)(HSTRING classId, REFIID iid, void** factory) = RoGetActivationFactory;
// The hook function for GetForCurrentThread
HRESULT STDMETHODCALLTYPE GetForCurrentThread_Hook(ICoreWindowStatic* pThis, CoreWindow** ppWindow)
{
HRESULT hr = TrueGetForCurrentThread(pThis, ppWindow);
if (FAILED(hr))
{
return hr;
}
if (*ppWindow == NULL)
return hr;
if (IsXboxCallee())
*reinterpret_cast<ICoreWindowX**>(ppWindow) = new CoreWindowWrapperX(*ppWindow);
return hr;
}
/* Hook for the WinRT RoGetActivationFactory function. */
inline HRESULT WINAPI RoGetActivationFactory_Hook(HSTRING classId, REFIID iid, void** factory)
{
// Get the raw buffer from the HSTRING
const wchar_t* rawString = WindowsGetStringRawBuffer(classId, nullptr);
if (rawString) {
// Print the string using wprintf
wprintf(L"%ls\n", rawString);
}
auto hr = 0;
if (IsClassName(classId, "Windows.ApplicationModel.Core.CoreApplication"))
{
ComPtr<IActivationFactory> realFactory;
hr = TrueRoGetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), IID_PPV_ARGS(&realFactory));
if (FAILED(hr))
return hr;
ComPtr<CoreApplicationWrapperX> wrappedFactory = Make<CoreApplicationWrapperX>(realFactory);
return wrappedFactory.CopyTo(iid, factory);
}
else if (IsClassName(classId, "Windows.UI.Core.CoreWindow"))
{
//
// for now we just hook GetForCurrentThread to get the CoreWindow but i'll change it later to
// wrap ICoreWindowStatic or as zombie said another thing that works is by hooking IFrameworkView::SetWindow
// but for now this *should* work just fine -AleBlbl
//
ComPtr<ICoreWindowStatic> coreWindowStatic;
hr = TrueRoGetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get(), IID_PPV_ARGS(&coreWindowStatic));
if (FAILED(hr)) {
return hr;
}
if (!TrueGetForCurrentThread)
{
*reinterpret_cast<void**>(&TrueGetForCurrentThread) = (*reinterpret_cast<void***>(coreWindowStatic.Get()))[6];
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&TrueGetForCurrentThread, GetForCurrentThread_Hook);
DetourTransactionCommit();
}
return coreWindowStatic.CopyTo(iid, factory);
}
// After WinDurango overrides try to load the rest
hr = TrueRoGetActivationFactory(classId, iid, factory);
if (FAILED(hr))
{
if (!pDllGetActivationFactory)
{
auto library = LoadPackagedLibrary(L"winrt_x.dll", 0);
if (!library) library = LoadLibraryW(L"winrt_x.dll");
if (!library) return hr;
pDllGetActivationFactory = reinterpret_cast<DllGetActivationFactoryFunc>
(GetProcAddress(library, "DllGetActivationFactory"));
if (!pDllGetActivationFactory)
return hr;
}
// fallback
ComPtr<IActivationFactory> fallbackFactory;
hr = pDllGetActivationFactory(classId, fallbackFactory.GetAddressOf());
if (FAILED(hr))
return hr;
return fallbackFactory.CopyTo(iid, factory);
}
return hr;
}
+527 -573
View File
File diff suppressed because it is too large Load Diff
+65 -29
View File
@@ -1,29 +1,65 @@
#pragma once
typedef NTSTATUS(NTAPI* NtAllocateVirtualMemory_t)(
HANDLE ProcessHandle,
PVOID* BaseAddress,
ULONG_PTR ZeroBits,
PSIZE_T RegionSize,
ULONG AllocationType,
ULONG Protect
);
typedef NTSTATUS(NTAPI* NtFreeVirtualMemory_t)(
HANDLE ProcessHandle,
PVOID* BaseAddress,
PSIZE_T RegionSize,
ULONG FreeType
);
// THE VALUES FOR NAMES ARE GUESSED, BUT NAMES ARE CORRECT (THAT HOW ENUM SHOULD LOOK LIKE)
enum CONSOLE_TYPE {
CONSOLE_TYPE_XBOX_ONE = 1,
CONSOLE_TYPE_XBOX_ONE_S = 2,
CONSOLE_TYPE_XBOX_ONE_X = 3,
CONSOLE_TYPE_XBOX_ONE_X_DEVKIT = 4
};
__int64 sub_18001BB8C();
NTSTATUS sub_18001BCA0(HINSTANCE hInstance, DWORD forwardReason, LPVOID lpvReserved);
#pragma once
typedef NTSTATUS(NTAPI* NtAllocateVirtualMemory_t)(
HANDLE ProcessHandle,
PVOID* BaseAddress,
ULONG_PTR ZeroBits,
PSIZE_T RegionSize,
ULONG AllocationType,
ULONG Protect
);
typedef NTSTATUS(NTAPI* NtFreeVirtualMemory_t)(
HANDLE ProcessHandle,
PVOID* BaseAddress,
PSIZE_T RegionSize,
ULONG FreeType
);
// THE VALUES FOR NAMES ARE GUESSED, BUT NAMES ARE CORRECT (THAT HOW ENUM SHOULD LOOK LIKE)
enum CONSOLE_TYPE {
CONSOLE_TYPE_XBOX_ONE = 1,
CONSOLE_TYPE_XBOX_ONE_S = 2,
CONSOLE_TYPE_XBOX_ONE_X = 3,
CONSOLE_TYPE_XBOX_ONE_X_DEVKIT = 4
};
typedef struct _SYSTEMOSVERSIONINFO {
UINT8 MajorVersion;
UINT8 MinorVersion;
UINT16 BuildNumber;
UINT16 Revision;
} SYSTEMOSVERSIONINFO, * LPSYSTEMOSVERSIONINFO;
typedef struct _PROCESSOR_SCHEDULING_STATISTICS {
UINT64 RunningTime;
UINT64 IdleTime;
UINT64 GlobalTime;
} PROCESSOR_SCHEDULING_STATISTICS, * PPROCESSOR_SCHEDULING_STATISTICS;
typedef struct _TOOLINGMEMORYSTATUS {
DWORD dwLength;
DWORD dwReserved;
DWORDLONG ullTotalMem;
DWORDLONG ullAvailMem;
DWORDLONG ulPeakUsage;
DWORDLONG ullPageTableUsage;
} TOOLINGMEMORYSTATUS, * PTOOLINGMEMORYSTATUS, * LPTOOLINGMEMORYSTATUS;
typedef struct _TITLEMEMORYSTATUS {
DWORD dwLength;
DWORD dwReserved;
DWORDLONG ullTotalMem;
DWORDLONG ullAvailMem;
DWORDLONG ullLegacyUsed;
DWORDLONG ullLegacyPeak;
DWORDLONG ullLegacyAvail;
DWORDLONG ullTitleUsed;
DWORDLONG ullTitleAvail;
} TITLEMEMORYSTATUS, * PTITLEMEMORYSTATUS, * LPTITLEMEMORYSTATUS;
__int64 sub_18001BB8C();
NTSTATUS sub_18001BCA0(HINSTANCE hInstance, DWORD forwardReason, LPVOID lpvReserved);
static CRITICAL_SECTION XMemSetAllocationHooksLock_X;
+136 -117
View File
@@ -1,118 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{94127830-3a6c-4861-bbd2-20c0d289802d}</ProjectGuid>
<RootNamespace>kernelx</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IncludePath>$(IncludePath);$(ProjectDir)\..\..\thirdparty\Detours\include</IncludePath>
<LibraryPath>$(LibraryPath);$(ProjectDir)\..\..\thirdparty\Detours\lib.X64;</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(IncludePath);$(SolutionPath)\thirdparty\thirdparty\Detours\includes</IncludePath>
<LibraryPath>$(LibraryPath);$(SolutionPath)\thirdparty\thirdparty\Detours\lib.X64;</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;KERNELX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
<AdditionalDependencies>ntdll.lib;detours.lib;runtimeobject.lib;kernel32.lib;Synchronization.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;KERNELX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>ntdll.lib;detours.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CoreWindowX.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="hooks.h" />
<ClInclude Include="ICoreWindowX.h" />
<ClInclude Include="kernelx.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="utils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CoreWindowX.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="kernelx.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Exports.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{94127830-3a6c-4861-bbd2-20c0d289802d}</ProjectGuid>
<RootNamespace>kernelx</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IncludePath>$(IncludePath);$(ProjectDir)\..\..\thirdparty\Detours\include</IncludePath>
<LibraryPath>$(LibraryPath);$(ProjectDir)\..\..\thirdparty\Detours\lib.X64;</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(IncludePath);$(SolutionPath)\thirdparty\thirdparty\Detours\includes</IncludePath>
<LibraryPath>$(LibraryPath);$(SolutionPath)\thirdparty\thirdparty\Detours\lib.X64;</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;KERNELX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
<AdditionalDependencies>ntdll.lib;detours.lib;runtimeobject.lib;kernel32.lib;Synchronization.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;KERNELX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>ntdll.lib;detours.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CoreApplicationWrapperX.h" />
<ClInclude Include="CoreWindowWrapperX.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="FrameworkViewSourceWrapper.h" />
<ClInclude Include="FrameworkViewWrapper.h" />
<ClInclude Include="hooks.h" />
<ClInclude Include="ICoreApplicationResourceAvailabilityX.h" />
<ClInclude Include="ICoreApplicationX.h" />
<ClInclude Include="ICoreWindowX.h" />
<ClInclude Include="kernelx.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="utils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CoreApplicationWrapperX.cpp" />
<ClCompile Include="CoreWindowWrapperX.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FrameworkViewSourceWrapper.cpp" />
<ClCompile Include="FrameworkViewWrapper.cpp" />
<ClCompile Include="kernelx.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
<None Include="cpp.hint" />
<None Include="Exports.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>
+72 -34
View File
@@ -1,35 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="kernelx.cpp" />
<ClCompile Include="pch.cpp" />
<ClCompile Include="CoreWindowX.cpp">
<Filter>Windows.UI.Core</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="kernelx.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="ICoreWindowX.h">
<Filter>Windows.UI.Core</Filter>
</ClInclude>
<ClInclude Include="CoreWindowX.h">
<Filter>Windows.UI.Core</Filter>
</ClInclude>
<ClInclude Include="hooks.h" />
<ClInclude Include="utils.h" />
</ItemGroup>
<ItemGroup>
<None Include="Exports.def" />
</ItemGroup>
<ItemGroup>
<Filter Include="Headers">
<UniqueIdentifier>{1fd01865-5063-43f8-8e37-2d5b0dd81b88}</UniqueIdentifier>
</Filter>
<Filter Include="Windows.UI.Core">
<UniqueIdentifier>{bb53c96d-38a7-46b6-bfc9-84fc5b33678e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="kernelx.cpp" />
<ClCompile Include="pch.cpp" />
<ClCompile Include="CoreWindowWrapperX.cpp">
<Filter>Windows.UI.Core</Filter>
</ClCompile>
<ClCompile Include="CoreApplicationWrapperX.cpp">
<Filter>Windows.ApplicationModel.Core\CoreApplication</Filter>
</ClCompile>
<ClCompile Include="FrameworkViewWrapper.cpp">
<Filter>Windows.ApplicationModel.Core\FrameworkView</Filter>
</ClCompile>
<ClCompile Include="FrameworkViewSourceWrapper.cpp">
<Filter>Windows.ApplicationModel.Core\FrameworkViewSource</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="kernelx.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="ICoreWindowX.h">
<Filter>Windows.UI.Core</Filter>
</ClInclude>
<ClInclude Include="CoreWindowWrapperX.h">
<Filter>Windows.UI.Core</Filter>
</ClInclude>
<ClInclude Include="hooks.h" />
<ClInclude Include="utils.h" />
<ClInclude Include="ICoreApplicationX.h">
<Filter>Windows.ApplicationModel.Core\CoreApplication</Filter>
</ClInclude>
<ClInclude Include="CoreApplicationWrapperX.h">
<Filter>Windows.ApplicationModel.Core\CoreApplication</Filter>
</ClInclude>
<ClInclude Include="ICoreApplicationResourceAvailabilityX.h">
<Filter>Windows.ApplicationModel.Core</Filter>
</ClInclude>
<ClInclude Include="FrameworkViewWrapper.h">
<Filter>Windows.ApplicationModel.Core\FrameworkView</Filter>
</ClInclude>
<ClInclude Include="FrameworkViewSourceWrapper.h">
<Filter>Windows.ApplicationModel.Core\FrameworkViewSource</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Exports.def" />
<None Include=".editorconfig" />
<None Include="cpp.hint" />
</ItemGroup>
<ItemGroup>
<Filter Include="Headers">
<UniqueIdentifier>{1fd01865-5063-43f8-8e37-2d5b0dd81b88}</UniqueIdentifier>
</Filter>
<Filter Include="Windows.UI.Core">
<UniqueIdentifier>{bb53c96d-38a7-46b6-bfc9-84fc5b33678e}</UniqueIdentifier>
</Filter>
<Filter Include="Windows.ApplicationModel.Core">
<UniqueIdentifier>{22d419bf-d552-4ab7-a078-94a3d47e5051}</UniqueIdentifier>
</Filter>
<Filter Include="Windows.ApplicationModel.Core\CoreApplication">
<UniqueIdentifier>{ee124397-8dbc-48c3-869f-10201a7d04fd}</UniqueIdentifier>
</Filter>
<Filter Include="Windows.ApplicationModel.Core\FrameworkView">
<UniqueIdentifier>{1dfef95c-7e52-4c34-862d-18e9cd60a9de}</UniqueIdentifier>
</Filter>
<Filter Include="Windows.ApplicationModel.Core\FrameworkViewSource">
<UniqueIdentifier>{c767c192-a92b-4536-b8a9-51f27fa78800}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
+2 -1
View File
@@ -4,7 +4,7 @@
#include "framework.h"
#include "kernelx.h"
#include "CoreWindowX.h"
#include "CoreWindowWrapperX.h"
#include "ICoreWindowX.h"
#include "../src/detours.h"
@@ -18,6 +18,7 @@
#include <string>
#include <string_view>
#include <__msvc_string_view.hpp>
#include <ntstatus.h>
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
+26 -27
View File
@@ -1,28 +1,27 @@
// ReSharper disable CppInconsistentNaming
#pragma once
#include <Windows.h>
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
#define RETURN_IF_FAILED(hr) if (FAILED(hr)) return hr
#define THROW_IF_FAILED(hr) if (FAILED(hr)) throw hr
#define IsXboxCallee() IsXboxAddress(_ReturnAddress())
#define GetXDKVersion() "10.0.19041.0"
inline BOOL IsXboxModule(HMODULE Module)
{
return FALSE;
}
inline BOOL IsXboxAddress(const PVOID Address)
{
HMODULE hModule;
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, static_cast<LPCWSTR>(Address), &hModule))
return FALSE;
return IsXboxModule(hModule);
#pragma once
#include <Windows.h>
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
#define RETURN_IF_FAILED(hr) if (FAILED(hr)) return hr
#define THROW_IF_FAILED(hr) if (FAILED(hr)) throw hr
#define IsXboxCallee() IsXboxAddress(_ReturnAddress())
#define GetXDKVersion() "10.0.19041.0"
BOOL IsXboxModule(HMODULE module)
{
return module == GetModuleHandleW(nullptr);
}
inline BOOL IsXboxAddress(const PVOID Address)
{
HMODULE hModule;
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, static_cast<LPCWSTR>(Address), &hModule))
return FALSE;
return IsXboxModule(hModule);
}
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
@@ -38,7 +38,7 @@ namespace winrt::Windows::Xbox::System::implementation
}
winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Xbox::System::User> User::Users()
{
throw hresult_not_implemented();
return winrt::single_threaded_vector<winrt::Windows::Xbox::System::User>( ).GetView();
}
winrt::event_token User::UserAdded(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::UserAddedEventArgs> const& handler)
{
@@ -50,7 +50,7 @@ namespace winrt::Windows::Xbox::System::implementation
}
winrt::event_token User::UserRemoved(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::UserRemovedEventArgs> const& handler)
{
return m_userRemovedEvent.add(handler);
return {};
}
void User::UserRemoved(winrt::event_token const& token) noexcept
{
@@ -58,50 +58,59 @@ namespace winrt::Windows::Xbox::System::implementation
}
winrt::Windows::Xbox::System::User User::GetUserById(uint32_t id)
{
printf("!!!! Windows.Xbox.System.User GetUserById | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::System::GetTokenAndSignatureResult> User::GetTokenAndSignatureForAllUsersAsync(hstring httpMethod, hstring url, hstring headers)
{
printf("!!!! Windows.Xbox.System.User GetTokenAndSignatureForAllUsersAsync | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::System::GetTokenAndSignatureResult> User::GetTokenAndSignatureForAllUsersAsync(hstring httpMethod, hstring url, hstring headers, array_view<uint8_t const> body)
{
printf("!!!! Windows.Xbox.System.User GetTokenAndSignatureForAllUsersAsync | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::System::GetTokenAndSignatureResult> User::GetTokenAndSignatureForAllUsersAsync(hstring httpMethod, hstring url, hstring headers, hstring body)
{
printf("!!!! Windows.Xbox.System.User GetTokenAndSignatureForAllUsersAsync | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::event_token User::AudioDeviceAdded(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::AudioDeviceAddedEventArgs> const& handler)
{
throw hresult_not_implemented();
return {};
}
void User::AudioDeviceAdded(winrt::event_token const& token) noexcept
{
throw hresult_not_implemented();
return;
}
winrt::event_token User::AudioDeviceRemoved(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::AudioDeviceRemovedEventArgs> const& handler)
{
printf("!!!! Windows.Xbox.System.User AudioDeviceRemoved | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
void User::AudioDeviceRemoved(winrt::event_token const& token) noexcept
{
printf("!!!! Windows.Xbox.System.User AudioDeviceRemoved | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::event_token User::AudioDeviceChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::AudioDeviceChangedEventArgs> const& handler)
{
printf("!!!! Windows.Xbox.System.User AudioDeviceChanged | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
void User::AudioDeviceChanged(winrt::event_token const& token) noexcept
{
printf("!!!! Windows.Xbox.System.User AudioDeviceChanged | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::event_token User::SignInCompleted(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::SignInCompletedEventArgs> const& handler)
{
throw hresult_not_implemented();
return {};
}
void User::SignInCompleted(winrt::event_token const& token) noexcept
{
printf("!!!! Windows.Xbox.System.User SignInCompleted | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::event_token User::SignOutStarted(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::SignOutStartedEventArgs> const& handler)
@@ -114,74 +123,89 @@ namespace winrt::Windows::Xbox::System::implementation
}
winrt::event_token User::SignOutCompleted(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::SignOutCompletedEventArgs> const& handler)
{
throw hresult_not_implemented();
return {};
}
void User::SignOutCompleted(winrt::event_token const& token) noexcept
{
throw hresult_not_implemented();
return;
}
winrt::event_token User::UserDisplayInfoChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::UserDisplayInfoChangedEventArgs> const& handler)
{
printf("!!!! Windows.Xbox.System.User UserDisplayInfoChanged | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
void User::UserDisplayInfoChanged(winrt::event_token const& token) noexcept
{
printf("!!!! Windows.Xbox.System.User UserDisplayInfoChanged | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::guid User::GetNetworkCacheIdForUsers(winrt::Windows::Foundation::Collections::IVectorView<uint32_t> const& users)
{
printf("!!!! Windows.Xbox.System.User GetNetworkCacheIdForUsers | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
uint32_t User::Id()
{
throw hresult_not_implemented();
return 1;
}
winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Xbox::System::IAudioDeviceInfo> User::AudioDevices()
{
printf("!!!! Windows.Xbox.System.User AudioDevices | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Xbox::Input::IController> User::Controllers()
{
printf("!!!! Windows.Xbox.System.User Controllers | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Xbox::System::UserDisplayInfo User::DisplayInfo()
{
printf("!!!! Windows.Xbox.System.User DisplayInfo | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
bool User::IsGuest()
{
printf("!!!! Windows.Xbox.System.User IsGuest | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
bool User::IsSignedIn()
{
printf("!!!! Windows.Xbox.System.User IsSignedIn | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Xbox::System::UserLocation User::Location()
{
printf("!!!! Windows.Xbox.System.User Location | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Xbox::System::User User::Sponsor()
{
printf("!!!! Windows.Xbox.System.User Sponsor | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
hstring User::XboxUserHash()
{
printf("!!!! Windows.Xbox.System.User XboxUserHash | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
hstring User::XboxUserId()
{
printf("!!!! Windows.Xbox.System.User XboxUserId | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::System::GetTokenAndSignatureResult> User::GetTokenAndSignatureAsync(hstring httpMethod, hstring url, hstring headers)
{
printf("!!!! Windows.Xbox.System.User GetTokenAndSignatureAsync | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::System::GetTokenAndSignatureResult> User::GetTokenAndSignatureAsync(hstring httpMethod, hstring url, hstring headers, array_view<uint8_t const> body)
{
printf("!!!! Windows.Xbox.System.User GetTokenAndSignatureAsync | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::System::GetTokenAndSignatureResult> User::GetTokenAndSignatureAsync(hstring httpMethod, hstring url, hstring headers, hstring body)
{
printf("!!!! Windows.Xbox.System.User GetTokenAndSignatureAsync | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
}
}
-2
View File
@@ -12,8 +12,6 @@
<RootNamespace>winrt_x</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.22621.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
+27 -9
View File
@@ -186,14 +186,32 @@
<Midl Include="External\Windows.Xbox.Shell.Social.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.Management.Deployment.idl" />
<Midl Include="External\Windows.Xbox.ApplicationModel.State.Internal.idl" />
<Midl Include="External\Windows.Xbox.Management.idl" />
<Midl Include="External\Windows.Xbox.Shell.idl" />
<Midl Include="External\Windows.Xbox.ApplicationModel.State.idl" />
<Midl Include="External\Windows.Xbox.ApplicationModel.Store.idl" />
<Midl Include="External\Windows.Xbox.Media.idl" />
<Midl Include="External\Windows.Xbox.Achievements.idl" />
<Midl Include="External\Windows.Xbox.Media.GameTransportControls.idl" />
<Midl Include="External\Windows.Xbox.Media.GameTransportControls.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.Achievements.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.ApplicationModel.State.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.ApplicationModel.State.Internal.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.ApplicationModel.Store.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.Management.Deployment.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.Management.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.Media.idl">
<Filter>External</Filter>
</Midl>
<Midl Include="External\Windows.Xbox.Shell.idl">
<Filter>External</Filter>
</Midl>
</ItemGroup>
</Project>
+102
View File
@@ -0,0 +1,102 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cl,cpp,cppm,cu,cuh,cxx,fx,fxh,glsl,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,shdbg,tlh,tli}]
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = ignore
cpp_new_line_before_open_brace_type = ignore
cpp_new_line_before_open_brace_function = ignore
cpp_new_line_before_open_brace_block = ignore
cpp_new_line_before_open_brace_lambda = ignore
cpp_new_line_scope_braces_on_separate_lines = false
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = true
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = true
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = true
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_optimize_unused_error_tag_type = suggestion
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
# ReSharper C++ settings
resharper_cpp_inconsistent_naming_highlighting = none
resharper_cpp_function_result_should_be_used_highlighting = none
resharper_cpp_parameter_may_be_const_highlighting = none
resharper_cpp_class_can_be_final_highlighting = none
resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = none
resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = none
resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = none
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
+1 -1
View File
@@ -44,7 +44,7 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>xgx</TargetName>
<TargetName>xg_x</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>xgx</TargetName>