mirror of
https://codeberg.org/WinDurango/WinDurango.git
synced 2026-04-18 02:23:34 -04:00
Fixed CoreWindow hooking problem and XboxLiveConfiguration GUID
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
//All GUIDs came from "EmbeddedXvd/Windows/System32/config/SOFTWARE" and "appmodel.dll".
|
||||
namespace Windows.Xbox.Services
|
||||
{
|
||||
[interface_name("IXboxLiveConfiguration", fdeeeb27-66b0-465b-9dfb-99c62a62f7bc)]
|
||||
[static_name("IXboxLiveConfigurationStatics", af86e2e0-b12d-4c6a-9c5a-d7aa65101e90)]
|
||||
[static_name("IXboxLiveConfigurationStatics", 00193376-6a84-4c67-84a5-3b8a8aaea712)]
|
||||
runtimeclass XboxLiveConfiguration
|
||||
{
|
||||
static String TitleId { get; };
|
||||
|
||||
@@ -200,7 +200,7 @@ HRESULT DXGIFactory2<ABI>::CreateSwapChainForCoreWindow(xbox::IGraphicsUnknown<A
|
||||
return hr;
|
||||
}
|
||||
|
||||
auto Window = reinterpret_cast<CoreWindowEra*>(pWindow)->m_realWindow;
|
||||
ICoreWindow* Window = reinterpret_cast<CoreWindowEra*>(pWindow)->m_realWindow;
|
||||
ICoreWindowInterop *interop;
|
||||
Window->QueryInterface(IID_PPV_ARGS(&interop));
|
||||
HWND hwnd;
|
||||
@@ -209,14 +209,14 @@ HRESULT DXGIFactory2<ABI>::CreateSwapChainForCoreWindow(xbox::IGraphicsUnknown<A
|
||||
IDXGISwapChain1 *SwapChain{};
|
||||
hr = m_pFunction->CreateSwapChainForHwnd(dev, hwnd, &pDesc2, NULL, NULL, &SwapChain);
|
||||
|
||||
auto* realDevice = static_cast<D3D11DeviceX<ABI>*>(pDevice);
|
||||
//TODO: Fix ImGui for HWND Swap Chains?
|
||||
/*auto *realDevice = static_cast<D3D11DeviceX<ABI> *>(pDevice);
|
||||
gfx::ID3D11DeviceContext<ABI>* ctx = nullptr;
|
||||
realDevice->GetImmediateContext(&ctx);
|
||||
|
||||
ID3D11DeviceContext* dxCtx = nullptr;
|
||||
hr = ctx->QueryInterface(__uuidof(ID3D11DeviceContext), reinterpret_cast<void**>(&dxCtx));
|
||||
ctx->Release();
|
||||
p_wd->gui.Initialize(realDevice->m_pFunction, dxCtx, SwapChain);
|
||||
p_wd->gui.Initialize(realDevice->m_pFunction, dxCtx, SwapChain);*/
|
||||
|
||||
if (SwapChain)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetDevice(REFIID riid, void **
|
||||
//
|
||||
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::Present(uint32_t SyncInterval, uint32_t Flags)
|
||||
{
|
||||
p_wd->gui.Render();
|
||||
//p_wd->gui.Render();
|
||||
return m_pFunction->Present(SyncInterval, Flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -200,10 +200,6 @@ HRESULT CoreWindowEra::QueryInterface(const IID &riid, void **ppvObject)
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
else if (riid == __uuidof(ICoreWindowInterop))
|
||||
{
|
||||
return m_realWindow->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
char iidstr[sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}")];
|
||||
OLECHAR iidwstr[sizeof(iidstr)];
|
||||
|
||||
@@ -216,21 +216,13 @@ static void WdRoInitializeLibraries()
|
||||
static void WdRoInitializeClasses()
|
||||
{
|
||||
DetourTransactionBegin();
|
||||
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
if (ComPtr<IActivationFactory> factory;
|
||||
SUCCEEDED(WdRoGetActivationFactoryCore(HStringReference{L"Windows.ApplicationModel.Store.CurrentApp"}.Get(), IID_PPV_ARGS(&factory))))
|
||||
{
|
||||
DetourAttach(reinterpret_cast<PVOID *>(&TrueActivateInstance), reinterpret_cast<PVOID>(EraAppActivateInstance));
|
||||
}
|
||||
|
||||
if (ComPtr<ICoreWindowStatic> coreWindowStatic;
|
||||
SUCCEEDED(RoGetActivationFactory(HStringReference{RuntimeClass_Windows_UI_Core_CoreWindow}.Get(), IID_PPV_ARGS(&coreWindowStatic))))
|
||||
{
|
||||
*reinterpret_cast<void **>(&TrueGetForCurrentThread) =
|
||||
(*reinterpret_cast<void ***>(coreWindowStatic.Get()))[6];
|
||||
DetourAttach(reinterpret_cast<PVOID *>(&TrueGetForCurrentThread), reinterpret_cast<PVOID>(EraGetForCurrentThread));
|
||||
}
|
||||
|
||||
DetourTransactionCommit();
|
||||
}
|
||||
|
||||
@@ -298,6 +290,16 @@ HRESULT WINAPI WdRoGetActivationFactoryCore(
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (!TrueGetForCurrentThread)
|
||||
{
|
||||
*reinterpret_cast<void **>(&TrueGetForCurrentThread) = (*reinterpret_cast<void ***>(coreWindowStatic.Get()))[6];
|
||||
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
DetourAttach(reinterpret_cast<PVOID*>(&TrueGetForCurrentThread), EraGetForCurrentThread);
|
||||
DetourTransactionCommit();
|
||||
}
|
||||
|
||||
return coreWindowStatic.CopyTo(iid, factory);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user