mirror of
https://github.com/WinDurango/WinDurango.git
synced 2026-01-07 19:59:42 -06:00
Merge pull request #148 from Patoke/main
add back overlay aka keyboard input
This commit is contained in:
@@ -1,17 +1,66 @@
|
||||
#include "pch.h"
|
||||
#include "AcpHal.h"
|
||||
|
||||
#include <basetyps.h>
|
||||
#include <cstdio>
|
||||
#include <stdlib.h>
|
||||
#include "../common/debug.h"
|
||||
|
||||
HRESULT AcpHalAllocateShapeContexts_X(
|
||||
AcpHal_SHAPE_CONTEXTS* contextArrays
|
||||
) {
|
||||
DEBUG_PRINT( );
|
||||
return 0;
|
||||
#include "contexts.h"
|
||||
|
||||
struct SHAPE_CONTEXTS {
|
||||
UINT32 numSrcContexts;
|
||||
UINT32 numEqCompContexts;
|
||||
UINT32 numFiltVolContexts;
|
||||
UINT32 numDmaContexts;
|
||||
UINT32 numXmaContexts;
|
||||
UINT32 numPcmContexts;
|
||||
SHAPE_SRC_CONTEXT* srcContextArray;
|
||||
SHAPE_EQCOMP_CONTEXT* eqCompContextArray;
|
||||
SHAPE_FILTVOL_CONTEXT* filtVolContextArray;
|
||||
SHAPE_DMA_CONTEXT* dmaContextArray;
|
||||
SHAPE_XMA_CONTEXT* xmaContextArray;
|
||||
SHAPE_PCM_CONTEXT* pcmContextArray;
|
||||
APU_ADDRESS apuSrcContextArray;
|
||||
APU_ADDRESS apuEqCompContextArray;
|
||||
APU_ADDRESS apuFiltVolContextArray;
|
||||
APU_ADDRESS apuDmaContextArray;
|
||||
APU_ADDRESS apuXmaContextArray;
|
||||
APU_ADDRESS apuPcmContextArray;
|
||||
};
|
||||
|
||||
|
||||
HRESULT AcpHalAllocateShapeContexts_X(SHAPE_CONTEXTS* ctx) {
|
||||
if (ctx->numSrcContexts > 0)
|
||||
ctx->srcContextArray = static_cast<SHAPE_SRC_CONTEXT*>(malloc(sizeof(SHAPE_SRC_CONTEXT) * ctx->numSrcContexts));
|
||||
|
||||
if (ctx->numEqCompContexts > 0)
|
||||
ctx->eqCompContextArray = static_cast<SHAPE_EQCOMP_CONTEXT*>(malloc(sizeof(SHAPE_EQCOMP_CONTEXT) * ctx->numEqCompContexts));
|
||||
|
||||
if (ctx->numFiltVolContexts > 0)
|
||||
ctx->filtVolContextArray = static_cast<SHAPE_FILTVOL_CONTEXT*>(malloc(sizeof(SHAPE_FILTVOL_CONTEXT) * ctx->numFiltVolContexts));
|
||||
|
||||
if (ctx->numDmaContexts > 0)
|
||||
ctx->dmaContextArray = static_cast<SHAPE_DMA_CONTEXT*>(malloc(sizeof(SHAPE_DMA_CONTEXT) * ctx->numDmaContexts));
|
||||
|
||||
if (ctx->numXmaContexts > 0)
|
||||
ctx->xmaContextArray = static_cast<SHAPE_XMA_CONTEXT*>(malloc(sizeof(SHAPE_XMA_CONTEXT) * ctx->numXmaContexts));
|
||||
|
||||
if (ctx->numPcmContexts > 0)
|
||||
ctx->pcmContextArray = static_cast<SHAPE_PCM_CONTEXT*>(malloc(sizeof(SHAPE_PCM_CONTEXT) * ctx->numPcmContexts));
|
||||
|
||||
printf("[AcpHal] allocated shape contexts\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT AcpHalReleaseShapeContexts_X( ) {
|
||||
HRESULT AcpHalReleaseShapeContexts_X() {
|
||||
DEBUG_PRINT( );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT AcpHalCreate_X(IAcpHal** acpInterface) {
|
||||
printf("[WARNING] AcpHalCreate returns back a nullptr, the game is likely to crash!\n");
|
||||
*acpInterface = nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -28,10 +77,7 @@ HRESULT ApuAlloc_X(
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT ApuCreateHeap_X(UINT32 cachedSizeInBytes, UINT32 nonCachedSizeInBytes)
|
||||
{
|
||||
nonCachedSizeInBytes = 0;
|
||||
DEBUG_PRINT( );
|
||||
HRESULT ApuCreateHeap_X(size_t initialSize, size_t maximumSize) {
|
||||
// Don't think we need that as this is for chaning memory pool iirc...
|
||||
return 0;
|
||||
}
|
||||
@@ -66,11 +112,7 @@ APU_ADDRESS ApuMapVirtualAddress_X(
|
||||
DEBUG_PRINT( );
|
||||
return 0;
|
||||
}
|
||||
HRESULT AcpHalCreate_X(IAcpHal** acp)
|
||||
{
|
||||
DEBUG_PRINT( );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* ApuMapApuAddress_X(
|
||||
APU_ADDRESS apuPhysicalAddress
|
||||
)
|
||||
|
||||
@@ -407,7 +407,7 @@ void WD11XNotify_X(WDEVENT_TYPE event)
|
||||
throw std::exception("this shouldn't happen, check code that sends events.");
|
||||
case WDEVENT_TYPE_KEYBOARD_ENGAGE:
|
||||
printf("[d3d11_x] keyboard engage\n");
|
||||
WinDurango::g_Overlay->EnableKeyboard( );
|
||||
wd::g_Overlay->EnableKeyboard( );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -416,7 +416,7 @@ void WDWaitForKeyboard(const char** outText)
|
||||
{
|
||||
printf("[d3d11_x] waiting for keyboard\n");
|
||||
|
||||
WaitForSingleObject(WinDurango::g_KeyboardFinished, INFINITE);
|
||||
WaitForSingleObject(wd::g_KeyboardFinished, INFINITE);
|
||||
|
||||
*outText = WinDurango::g_KeyboardText;
|
||||
*outText = wd::g_KeyboardText;
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "dxgi_swapchain.h"
|
||||
#include "../kernelx/CoreWindowWrapperX.h"
|
||||
#include "overlay/overlay.h"
|
||||
#include <d3d11_2.h>
|
||||
|
||||
#define DXGI_SWAPCHAIN_FLAG_MASK DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE \
|
||||
| DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT | DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER | DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY | DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT \
|
||||
@@ -43,7 +45,7 @@ HRESULT wd::dxgi_factory::CreateSwapChainForCoreWindow(IGraphicsUnknown* pDevice
|
||||
pDesc->Flags &= DXGI_SWAPCHAIN_FLAG_MASK;
|
||||
pDesc->Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
|
||||
|
||||
IUnknown* pRealDevice = nullptr;
|
||||
::ID3D11Device2* pRealDevice = nullptr;
|
||||
hr = pDevice->QueryInterface(__uuidof(wdi::IGraphicsUnwrap), (void**)&pRealDevice);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
@@ -72,6 +74,13 @@ HRESULT wd::dxgi_factory::CreateSwapChainForCoreWindow(IGraphicsUnknown* pDevice
|
||||
}
|
||||
|
||||
// TODO: init overlay
|
||||
if (wd::g_Overlay == nullptr) {
|
||||
::ID3D11DeviceContext* ctx = nullptr;
|
||||
pRealDevice->GetImmediateContext(&ctx);
|
||||
|
||||
wd::g_Overlay = new wd::Overlay(pRealDevice, ctx, swap);
|
||||
wd::g_Overlay->Initialize( );
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "dxgi_swapchain.h"
|
||||
|
||||
#include "resource.hpp"
|
||||
#include "overlay/overlay.h"
|
||||
|
||||
HRESULT wd::dxgi_swapchain::QueryInterface(const IID& riid, void** ppvObject)
|
||||
{
|
||||
@@ -34,6 +35,9 @@ HRESULT wd::dxgi_swapchain::GetDevice(const IID& riid, void** ppDevice)
|
||||
|
||||
HRESULT wd::dxgi_swapchain::Present(UINT SyncInterval, UINT Flags)
|
||||
{
|
||||
if (wd::g_Overlay)
|
||||
wd::g_Overlay->Present( );
|
||||
|
||||
return wrapped_interface->Present(SyncInterval, Flags);
|
||||
}
|
||||
|
||||
@@ -138,6 +142,9 @@ HRESULT wd::dxgi_swapchain::GetCoreWindow(const IID& refiid, void** ppUnk)
|
||||
HRESULT wd::dxgi_swapchain::Present1(UINT SyncInterval, UINT PresentFlags,
|
||||
const DXGI_PRESENT_PARAMETERS* pPresentParameters)
|
||||
{
|
||||
if (wd::g_Overlay)
|
||||
wd::g_Overlay->Present( );
|
||||
|
||||
return wrapped_interface->Present1(SyncInterval, PresentFlags, pPresentParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "../../../thirdparty/imgui_impl_uwp.h"
|
||||
#include <winrt/windows.graphics.display.h>
|
||||
|
||||
WinDurango::Overlay::Overlay(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, IDXGISwapChain1* pSwapchain):
|
||||
wd::Overlay::Overlay(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, IDXGISwapChain1* pSwapchain):
|
||||
m_pRenderTargetView(nullptr)
|
||||
{
|
||||
m_pDevice = pDevice;
|
||||
@@ -13,7 +13,7 @@ WinDurango::Overlay::Overlay(ID3D11Device* pDevice, ID3D11DeviceContext* pContex
|
||||
m_pSwapchain = pSwapchain;
|
||||
}
|
||||
|
||||
WinDurango::Overlay::~Overlay()
|
||||
wd::Overlay::~Overlay()
|
||||
{
|
||||
Shutdown( );
|
||||
m_pDevice = nullptr;
|
||||
@@ -21,8 +21,7 @@ WinDurango::Overlay::~Overlay()
|
||||
m_pSwapchain = nullptr;
|
||||
}
|
||||
|
||||
// This should be called when Run is called by the game inside the wrapper.
|
||||
void WinDurango::Overlay::Initialize()
|
||||
void wd::Overlay::Initialize()
|
||||
{
|
||||
g_KeyboardFinished = CreateEventA(NULL, FALSE, FALSE, "KeyboardFinished");
|
||||
|
||||
@@ -45,19 +44,19 @@ void WinDurango::Overlay::Initialize()
|
||||
ImGui_ImplDX11_Init(m_pDevice, m_pContext);
|
||||
}
|
||||
|
||||
void WinDurango::Overlay::Shutdown()
|
||||
void wd::Overlay::Shutdown()
|
||||
{
|
||||
ImGui_ImplDX11_Shutdown( );
|
||||
ImGui_ImplUwp_Shutdown( );
|
||||
ImGui::DestroyContext( );
|
||||
}
|
||||
|
||||
void WinDurango::Overlay::EnableKeyboard()
|
||||
void wd::Overlay::EnableKeyboard()
|
||||
{
|
||||
m_bKeyboard = true;
|
||||
}
|
||||
|
||||
void WinDurango::Overlay::Present( )
|
||||
void wd::Overlay::Present( )
|
||||
{
|
||||
ImGui_ImplDX11_NewFrame( );
|
||||
ImGui_ImplUwp_NewFrame( );
|
||||
@@ -66,123 +65,123 @@ void WinDurango::Overlay::Present( )
|
||||
if (m_bKeyboard)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(500, 300));
|
||||
ImGui::Begin("WinDurango Keyboard Input", &m_bKeyboard, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
||||
ImGui::Begin("WinDurango Keyboard Input", nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
||||
|
||||
//static bool isUppercase = false;
|
||||
//static bool isSymbols = false;
|
||||
static bool isUppercase = false;
|
||||
static bool isSymbols = false;
|
||||
|
||||
//const char* keys[] = {
|
||||
// "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=",
|
||||
// "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]",
|
||||
// "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'",
|
||||
// "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/"
|
||||
//};
|
||||
const char* keys[] = {
|
||||
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=",
|
||||
"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]",
|
||||
"A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'",
|
||||
"Z", "X", "C", "V", "B", "N", "M", ",", ".", "/"
|
||||
};
|
||||
|
||||
//const char* symbols[] = {
|
||||
// "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+",
|
||||
// "~", "`", "|", "\\", "{", "}", "[", "]", ":", ";", "\"", "'",
|
||||
// "<", ">", "?", "/", ",", ".", "=", "-"
|
||||
//};
|
||||
const char* symbols[] = {
|
||||
"!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+",
|
||||
"~", "`", "|", "\\", "{", "}", "[", "]", ":", ";", "\"", "'",
|
||||
"<", ">", "?", "/", ",", ".", "=", "-"
|
||||
};
|
||||
|
||||
ImGui::InputText("Buffer", g_KeyboardText, IM_ARRAYSIZE(g_KeyboardText));
|
||||
|
||||
//if (ImGui::Button(isUppercase ? "Lowercase" : "Uppercase"))
|
||||
//{
|
||||
// isUppercase = !isUppercase;
|
||||
//}
|
||||
//ImGui::SameLine();
|
||||
//if (ImGui::Button(isSymbols ? "Letters" : "Symbols"))
|
||||
//{
|
||||
// isSymbols = !isSymbols;
|
||||
//}
|
||||
//ImGui::NewLine();
|
||||
if (ImGui::Button(isUppercase ? "Lowercase" : "Uppercase"))
|
||||
{
|
||||
isUppercase = !isUppercase;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(isSymbols ? "Letters" : "Symbols"))
|
||||
{
|
||||
isSymbols = !isSymbols;
|
||||
}
|
||||
ImGui::NewLine();
|
||||
|
||||
//const char** currentKeys = isSymbols ? symbols : keys;
|
||||
ImVec2 buttonSize = ImVec2(30, 30); // Set a fixed size for all buttons
|
||||
const char** currentKeys = isSymbols ? symbols : keys;
|
||||
ImVec2 buttonSize = ImVec2(30, 30);
|
||||
|
||||
//for (int i = 0; i < 12; ++i)
|
||||
//{
|
||||
// if (ImGui::Button(currentKeys[i], buttonSize))
|
||||
// {
|
||||
// size_t len = strlen(g_KeyboardText);
|
||||
// if (len < 255)
|
||||
// {
|
||||
// g_KeyboardText[len] = isUppercase ? currentKeys[i][0] : tolower(currentKeys[i][0]);
|
||||
// g_KeyboardText[len + 1] = '\0';
|
||||
// }
|
||||
// }
|
||||
// ImGui::SameLine();
|
||||
//}
|
||||
//ImGui::NewLine();
|
||||
for (int i = 0; i < 12; ++i)
|
||||
{
|
||||
if (ImGui::Button(currentKeys[i], buttonSize))
|
||||
{
|
||||
size_t len = strlen(g_KeyboardText);
|
||||
if (len < 255)
|
||||
{
|
||||
g_KeyboardText[len] = isUppercase ? currentKeys[i][0] : tolower(currentKeys[i][0]);
|
||||
g_KeyboardText[len + 1] = '\0';
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
}
|
||||
ImGui::NewLine();
|
||||
|
||||
//for (int i = 12; i < 24; ++i)
|
||||
//{
|
||||
// if (ImGui::Button(currentKeys[i], buttonSize))
|
||||
// {
|
||||
// size_t len = strlen(g_KeyboardText);
|
||||
// if (len < 255)
|
||||
// {
|
||||
// g_KeyboardText[len] = isUppercase ? currentKeys[i][0] : tolower(currentKeys[i][0]);
|
||||
// g_KeyboardText[len + 1] = '\0';
|
||||
// }
|
||||
// }
|
||||
// ImGui::SameLine();
|
||||
//}
|
||||
//ImGui::NewLine();
|
||||
for (int i = 12; i < 24; ++i)
|
||||
{
|
||||
if (ImGui::Button(currentKeys[i], buttonSize))
|
||||
{
|
||||
size_t len = strlen(g_KeyboardText);
|
||||
if (len < 255)
|
||||
{
|
||||
g_KeyboardText[len] = isUppercase ? currentKeys[i][0] : tolower(currentKeys[i][0]);
|
||||
g_KeyboardText[len + 1] = '\0';
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
}
|
||||
ImGui::NewLine();
|
||||
|
||||
//if (!isSymbols)
|
||||
//{
|
||||
// for (int i = 24; i < 35; ++i)
|
||||
// {
|
||||
// if (ImGui::Button(currentKeys[ i ], buttonSize))
|
||||
// {
|
||||
// size_t len = strlen(g_KeyboardText);
|
||||
// if (len < 255)
|
||||
// {
|
||||
// g_KeyboardText[ len ] = isUppercase ? currentKeys[ i ][ 0 ] : tolower(currentKeys[ i ][ 0 ]);
|
||||
// g_KeyboardText[ len + 1 ] = '\0';
|
||||
// }
|
||||
// }
|
||||
// ImGui::SameLine( );
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// for (int i = 24; i < 32; ++i)
|
||||
// {
|
||||
// if (ImGui::Button(currentKeys[ i ], buttonSize))
|
||||
// {
|
||||
// size_t len = strlen(g_KeyboardText);
|
||||
// if (len < 255)
|
||||
// {
|
||||
// g_KeyboardText[ len ] = isUppercase ? currentKeys[ i ][ 0 ] : tolower(currentKeys[ i ][ 0 ]);
|
||||
// g_KeyboardText[ len + 1 ] = '\0';
|
||||
// }
|
||||
// }
|
||||
// ImGui::SameLine( );
|
||||
// }
|
||||
//}
|
||||
if (!isSymbols)
|
||||
{
|
||||
for (int i = 24; i < 35; ++i)
|
||||
{
|
||||
if (ImGui::Button(currentKeys[ i ], buttonSize))
|
||||
{
|
||||
size_t len = strlen(g_KeyboardText);
|
||||
if (len < 255)
|
||||
{
|
||||
g_KeyboardText[ len ] = isUppercase ? currentKeys[ i ][ 0 ] : tolower(currentKeys[ i ][ 0 ]);
|
||||
g_KeyboardText[ len + 1 ] = '\0';
|
||||
}
|
||||
}
|
||||
ImGui::SameLine( );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 24; i < 32; ++i)
|
||||
{
|
||||
if (ImGui::Button(currentKeys[ i ], buttonSize))
|
||||
{
|
||||
size_t len = strlen(g_KeyboardText);
|
||||
if (len < 255)
|
||||
{
|
||||
g_KeyboardText[ len ] = isUppercase ? currentKeys[ i ][ 0 ] : tolower(currentKeys[ i ][ 0 ]);
|
||||
g_KeyboardText[ len + 1 ] = '\0';
|
||||
}
|
||||
}
|
||||
ImGui::SameLine( );
|
||||
}
|
||||
}
|
||||
|
||||
//ImGui::NewLine();
|
||||
ImGui::NewLine();
|
||||
|
||||
//if (!isSymbols)
|
||||
//{
|
||||
// for (int i = 35; i < 44; ++i)
|
||||
// {
|
||||
// if (ImGui::Button(currentKeys[ i ], buttonSize))
|
||||
// {
|
||||
// size_t len = strlen(g_KeyboardText);
|
||||
// if (len < 255)
|
||||
// {
|
||||
// g_KeyboardText[ len ] = isUppercase ? currentKeys[ i ][ 0 ] : tolower(currentKeys[ i ][ 0 ]);
|
||||
// g_KeyboardText[ len + 1 ] = '\0';
|
||||
// }
|
||||
// }
|
||||
// ImGui::SameLine( );
|
||||
// }
|
||||
//}
|
||||
if (!isSymbols)
|
||||
{
|
||||
for (int i = 35; i < 44; ++i)
|
||||
{
|
||||
if (ImGui::Button(currentKeys[ i ], buttonSize))
|
||||
{
|
||||
size_t len = strlen(g_KeyboardText);
|
||||
if (len < 255)
|
||||
{
|
||||
g_KeyboardText[ len ] = isUppercase ? currentKeys[ i ][ 0 ] : tolower(currentKeys[ i ][ 0 ]);
|
||||
g_KeyboardText[ len + 1 ] = '\0';
|
||||
}
|
||||
}
|
||||
ImGui::SameLine( );
|
||||
}
|
||||
}
|
||||
|
||||
//ImGui::NewLine();
|
||||
ImGui::NewLine();
|
||||
|
||||
if (ImGui::Button("OK", buttonSize) || ImGui::IsKeyPressed(ImGuiKey_GamepadStart))
|
||||
{
|
||||
@@ -190,14 +189,14 @@ void WinDurango::Overlay::Present( )
|
||||
SetEvent(g_KeyboardFinished);
|
||||
}
|
||||
|
||||
//if (ImGui::IsKeyPressed(ImGuiKey_GamepadBack))
|
||||
//{
|
||||
// size_t len = strlen(g_KeyboardText);
|
||||
// if (len > 0)
|
||||
// {
|
||||
// g_KeyboardText[len - 1] = '\0';
|
||||
// }
|
||||
//}
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_GamepadBack))
|
||||
{
|
||||
size_t len = strlen(g_KeyboardText);
|
||||
if (len > 0)
|
||||
{
|
||||
g_KeyboardText[len - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <d3d11.h>
|
||||
#include <dxgi1_2.h>
|
||||
|
||||
namespace WinDurango
|
||||
namespace wd
|
||||
{
|
||||
class Overlay
|
||||
{
|
||||
|
||||
@@ -1,6 +1,56 @@
|
||||
#include "pch.h"
|
||||
#include "CurrentAppWrapper.hpp"
|
||||
|
||||
HRESULT XboxUserLicenseInformationWrapperX::QueryInterface(const IID& riid, void** ppvObject)
|
||||
{
|
||||
if (riid == __uuidof(IXboxUserLicenseInformation))
|
||||
{
|
||||
*ppvObject = reinterpret_cast<ICurrentAppX*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObject = nullptr;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG XboxUserLicenseInformationWrapperX::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&m_RefCount);
|
||||
}
|
||||
|
||||
ULONG XboxUserLicenseInformationWrapperX::Release()
|
||||
{
|
||||
ULONG refCount = InterlockedDecrement(&m_RefCount);
|
||||
if (refCount == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
return refCount;
|
||||
}
|
||||
|
||||
HRESULT XboxUserLicenseInformationWrapperX::GetIids(ULONG* iidCount, IID** iids)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT XboxUserLicenseInformationWrapperX::GetRuntimeClassName(HSTRING* className)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT XboxUserLicenseInformationWrapperX::GetTrustLevel(TrustLevel* trustLevel)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT XboxUserLicenseInformationWrapperX::get_CurrentLicenseUserXuid(winrt::hstring* value)
|
||||
{
|
||||
printf("[XboxUserLicenseInformationWrapperX] get_CurrentLicenseUserXuid\n");
|
||||
*value = winrt::to_hstring(123);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT LicenseInformationWrapperX::QueryInterface(const IID& riid, void** ppvObject)
|
||||
{
|
||||
if (riid == __uuidof(ILicenseInformationX))
|
||||
@@ -10,6 +60,13 @@ HRESULT LicenseInformationWrapperX::QueryInterface(const IID& riid, void** ppvOb
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (riid == __uuidof(IXboxUserLicenseInformation))
|
||||
{
|
||||
*ppvObject = reinterpret_cast<IXboxUserLicenseInformation*>(new XboxUserLicenseInformationWrapperX());
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT hr = m_realLicenseInformation->QueryInterface(riid, ppvObject);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
@@ -17,7 +74,7 @@ HRESULT LicenseInformationWrapperX::QueryInterface(const IID& riid, void** ppvOb
|
||||
OLECHAR iidwstr[sizeof(iidstr)];
|
||||
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
|
||||
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
|
||||
printf("[CurrentAppWrapperX] Interface Not Implemented: %s\n", iidstr);
|
||||
printf("[LicenseInformationWrapperX] Interface Not Implemented: %s\n", iidstr);
|
||||
}
|
||||
|
||||
*ppvObject = nullptr;
|
||||
@@ -66,7 +123,8 @@ HRESULT LicenseInformationWrapperX::get_ProductLicenses(
|
||||
HRESULT LicenseInformationWrapperX::get_IsActive(boolean* value)
|
||||
{
|
||||
printf("[LicenseInformationWrapperX] get_IsActive\n");
|
||||
return E_NOTIMPL;
|
||||
*value = true;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT LicenseInformationWrapperX::get_IsTrial(boolean* value)
|
||||
@@ -79,7 +137,11 @@ HRESULT LicenseInformationWrapperX::get_IsTrial(boolean* value)
|
||||
HRESULT LicenseInformationWrapperX::get_ExpirationDate(ABI::Windows::Foundation::DateTime* value)
|
||||
{
|
||||
printf("[LicenseInformationWrapperX] get_ExpirationDate\n");
|
||||
return E_NOTIMPL;
|
||||
DateTime time;
|
||||
time.UniversalTime = UINT64_MAX;
|
||||
|
||||
*value = time;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT LicenseInformationWrapperX::add_LicenseChanged(
|
||||
|
||||
@@ -60,42 +60,25 @@ public:
|
||||
) = 0;
|
||||
};
|
||||
|
||||
//class LicenseInformationWrapperX : public RuntimeClass<IActivationFactory, ILicenseInformationX> {
|
||||
//public:
|
||||
// LicenseInformationWrapperX(ComPtr<IActivationFactory> realFactory)
|
||||
// : m_realFactory(realFactory)
|
||||
// {
|
||||
// HRESULT hr = m_realFactory.As(&m_realLicenseInformation);
|
||||
// if (FAILED(hr)) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// 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;
|
||||
// HRESULT STDMETHODCALLTYPE get_ProductLicenses(
|
||||
// __FIMapView_2_HSTRING_Windows__CApplicationModel__CStore__CProductLicense** value
|
||||
// ) override;
|
||||
// HRESULT STDMETHODCALLTYPE get_IsActive(
|
||||
// boolean* value
|
||||
// ) override;
|
||||
// HRESULT STDMETHODCALLTYPE get_IsTrial(
|
||||
// boolean* value
|
||||
// ) override;
|
||||
// HRESULT STDMETHODCALLTYPE get_ExpirationDate(
|
||||
// ABI::Windows::Foundation::DateTime* value
|
||||
// ) override;
|
||||
// HRESULT STDMETHODCALLTYPE add_LicenseChanged(
|
||||
// ABI::Windows::ApplicationModel::Store::ILicenseChangedEventHandler* handler,
|
||||
// EventRegistrationToken* cookie
|
||||
// ) override;
|
||||
// HRESULT STDMETHODCALLTYPE remove_LicenseChanged(
|
||||
// EventRegistrationToken cookie
|
||||
// ) override;
|
||||
//};
|
||||
MIDL_INTERFACE("AA98C583-A3C8-4F51-A5BC-463AE0C23EAA")
|
||||
IXboxUserLicenseInformation : public IInspectable
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE get_CurrentLicenseUserXuid(winrt::hstring* value) = 0;
|
||||
};
|
||||
|
||||
class XboxUserLicenseInformationWrapperX : public IXboxUserLicenseInformation
|
||||
{
|
||||
HRESULT QueryInterface(REFIID 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;
|
||||
HRESULT STDMETHODCALLTYPE get_CurrentLicenseUserXuid(winrt::hstring* value) override;
|
||||
private:
|
||||
long m_RefCount = 1;
|
||||
};
|
||||
|
||||
class LicenseInformationWrapperX : public ILicenseInformationX
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "Shlwapi.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
|
||||
#define WINDURANGO_WAIT_FOR_DEBUGGER 1
|
||||
|
||||
//Rodrigo Todescatto: For debbuging Forza.
|
||||
#define RETURN_IF_FAILED(hr) if (FAILED(hr)) return hr
|
||||
@@ -16,7 +16,6 @@ std::vector<HMODULE> loadedMods;
|
||||
|
||||
inline void LoadMods()
|
||||
{
|
||||
|
||||
WCHAR path[MAX_PATH];
|
||||
GetModuleFileNameW(GetModuleHandleW(nullptr), path, MAX_PATH);
|
||||
PathRemoveFileSpecW(path);
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace winrt::Windows::Xbox::System::implementation
|
||||
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();
|
||||
return winrt::single_threaded_vector<Input::IController>( ).GetView( );
|
||||
}
|
||||
winrt::Windows::Xbox::System::UserDisplayInfo User::DisplayInfo()
|
||||
{
|
||||
|
||||
2
thirdparty/Detours
vendored
2
thirdparty/Detours
vendored
Submodule thirdparty/Detours updated: 2df406eda2...09e035677d
Reference in New Issue
Block a user