d3d11 wrapping + xfrontpaneldisplay

This commit is contained in:
Unixian
2025-01-02 21:16:05 -05:00
parent ca746e5d7e
commit d795794690
5 changed files with 125 additions and 41 deletions
+7 -23
View File
@@ -3,33 +3,24 @@
#include <dxgiformat.h>
HRESULT __stdcall XFrontPanelGetButtonStates_X(
_Out_ uint32_t* buttons
)
HRESULT __stdcall XFrontPanelGetButtonStates_X(uint32_t* buttons)
{
*buttons = 0;
return S_OK;
}
HRESULT __stdcall XFrontPanelGetLightStates_X(
_Out_ uint32_t* lights
)
HRESULT __stdcall XFrontPanelGetLightStates_X(uint32_t* lights)
{
*lights = 0;
return S_OK;
}
HRESULT __stdcall XFrontPanelSetLightStates_X(
_In_ uint32_t lights
)
HRESULT __stdcall XFrontPanelSetLightStates_X(uint32_t lights)
{
return S_OK;
}
HRESULT __stdcall XFrontPanelGetScreenDimensions_X(
_Out_ uint32_t* height,
_Out_ uint32_t* width
)
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;
@@ -37,24 +28,17 @@ HRESULT __stdcall XFrontPanelGetScreenDimensions_X(
return S_OK;
}
HRESULT __stdcall XFrontPanelGetScreenPixelFormat_X(
_Out_ DXGI_FORMAT* pixelFormat
)
HRESULT __stdcall XFrontPanelGetScreenPixelFormat_X(DXGI_FORMAT* pixelFormat)
{
return E_NOTIMPL;
}
HRESULT __stdcall XFrontPanelSetDisplayName_X(
_In_ const char* displayName
)
HRESULT __stdcall XFrontPanelSetDisplayName_X(const char* displayName)
{
return S_OK;
}
HRESULT __stdcall XFrontPanelPresentBuffer_X(
_In_ uint32_t bufferSize,
_In_reads_(bufferSize) const uint8_t* buffer
)
HRESULT __stdcall XFrontPanelPresentBuffer_X(uint32_t bufferSize, const uint8_t* buffer)
{
return E_NOTIMPL;
}
+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
+61 -6
View File
@@ -2,6 +2,8 @@
// ReSharper disable CppClangTidyClangDiagnosticUnusedFunction
#include "pch.h"
#include <cstdio>
void D3DQuerySEQCounters_X()
{
@@ -22,11 +24,11 @@ HRESULT __stdcall D3D11XCreateDeviceXAndSwapChain1_X(const D3D11X_CREATE_DEVICE_
{
return E_INVALIDARG;
}
else
{
// @Patoke todo: should we be using pParameters->Flags? there's XBOX specific flags, also should we use pParameters->Version instead of D3D11_SDK_VERSION?
return D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, 0, pParameters->Flags, NULL, NULL, D3D11_SDK_VERSION, ppDevice, NULL, ppImmediateContext);
}
printf("!!! Game is trying to initialize D3D11 through D3D11X !!!");
printf("SDK Version: %d\n", pParameters->Version);
// @Patoke todo: should we be using pParameters->Flags? there's XBOX specific flags, also should we use pParameters->Version instead of D3D11_SDK_VERSION?
return D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, 0, pParameters->Flags, NULL, NULL, D3D11_SDK_VERSION, ppDevice, NULL, ppImmediateContext);
}
HRESULT __stdcall D3DAllocateGraphicsMemory_X(SIZE_T SizeBytes, SIZE_T AlignmentBytes, UINT64 DesiredGpuVirtualAddress, UINT Flags, void **ppAddress)
@@ -93,7 +95,7 @@ void DXGIXGetFrameStatistics_X()
void DXGIXPresentArray_X()
{
printf("[d3d11_x] !!! STUBBED: DXGIXPresentArray !!!");
}
void DXGIXSetFrameNotification_X()
@@ -104,4 +106,57 @@ void DXGIXSetFrameNotification_X()
void DXGIXSetVLineNotification_X()
{
}
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_ ID3D11Device** ppDevice,
_Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel,
_Out_opt_ 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;
}
return D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext);
}
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, 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);
}
+22 -1
View File
@@ -11,8 +11,29 @@
#define GetXDKVersion() "10.0.19041.0"
inline BOOL IsXboxModule(HMODULE Module)
BOOL IsXboxModule(HMODULE module)
{
wchar_t moduleFilePath[MAX_PATH];
if (GetModuleFileNameW(module, moduleFilePath, MAX_PATH) > 0)
{
std::wstring moduleFileName(moduleFilePath);
wprintf(L"%ls\n", moduleFileName.c_str());
wchar_t exeFilePath[MAX_PATH];
if (GetModuleFileNameW(NULL, exeFilePath, MAX_PATH) > 0)
{
std::wstring exeDir(exeFilePath);
size_t pos = exeDir.find_last_of(L"\\/");
if (pos != std::wstring::npos) {
exeDir = exeDir.substr(0, pos);
}
if (moduleFileName.find(exeDir) == 0) {
return TRUE;
}
}
}
return FALSE;
}
@@ -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();
}
}