Batch #14574 by Yommy: 1 byte-identical, 0 confirmed by peer review. - fn_17370 BrowserPopupDispatch::Invoke: byte-identical Merged automatically: every function is byte-identical to the original.
78 lines
2.1 KiB
C++
78 lines
2.1 KiB
C++
#include "Client/Browser/BrowserClientSite.h"
|
|
#include "Client/Browser/WebBrowser.h"
|
|
#include "Render/Renderer.h"
|
|
#include "UI/Window/UIWindowMgr.h"
|
|
#include "Client/Browser/BrowserPopupDispatch.h"
|
|
|
|
#include "Utility/Math/ScalarConversion.h"
|
|
#include <exdispid.h>
|
|
#include <cwchar>
|
|
#include <memory>
|
|
|
|
// OFFSET: 0x00AB1AA0
|
|
// FUNCTION: fn_17380
|
|
HRESULT STDMETHODCALLTYPE BrowserPopupDispatch::QueryInterface(REFIID iid, void** output) {
|
|
return static_cast<IOleClientSite*>(this->m_site)->QueryInterface(iid, output);
|
|
}
|
|
|
|
// OFFSET: 0x00AB15E0
|
|
// FUNCTION: fn_17341
|
|
ULONG STDMETHODCALLTYPE BrowserPopupDispatch::AddRef() {
|
|
return 1;
|
|
}
|
|
|
|
// OFFSET: 0x00AB1C70
|
|
// FUNCTION: fn_17387
|
|
ULONG STDMETHODCALLTYPE BrowserPopupDispatch::Release() {
|
|
return 1;
|
|
}
|
|
|
|
// OFFSET: 0x00AB17D0
|
|
// FUNCTION: fn_17364
|
|
HRESULT STDMETHODCALLTYPE BrowserPopupDispatch::GetTypeInfoCount(UINT*) {
|
|
return S_OK;
|
|
}
|
|
|
|
// OFFSET: 0x00AB17C0
|
|
// FUNCTION: fn_17363
|
|
HRESULT STDMETHODCALLTYPE BrowserPopupDispatch::GetTypeInfo(UINT, LCID, ITypeInfo**) {
|
|
return S_OK;
|
|
}
|
|
|
|
// OFFSET: 0x00AB1790
|
|
// FUNCTION: fn_17360
|
|
HRESULT STDMETHODCALLTYPE BrowserPopupDispatch::GetIDsOfNames(REFIID, LPOLESTR*, UINT, LCID, DISPID*) {
|
|
return S_OK;
|
|
}
|
|
|
|
// OFFSET: 0x00AB1880
|
|
// FUNCTION: fn_17370
|
|
HRESULT STDMETHODCALLTYPE BrowserPopupDispatch::Invoke(DISPID id, REFIID, LCID, WORD, DISPPARAMS* args, VARIANT*, EXCEPINFO*, UINT*) {
|
|
if (id != DISPID_NEWWINDOW3) {
|
|
return S_OK;
|
|
}
|
|
|
|
const wchar_t* url = args->rgvarg[0].bstrVal;
|
|
|
|
*args->rgvarg[3].pboolVal = 11;
|
|
|
|
// STATIC: 0x01115448
|
|
// GLOBAL: gl_13426
|
|
const float scale = 0.7f;
|
|
CWebBrowser* browser = g_windowMgr.CreateBrowser(
|
|
static_cast<int>(static_cast<float>(g_renderer->viewport.width) * scale), static_cast<int>(static_cast<float>(g_renderer->viewport.height) * scale)
|
|
);
|
|
|
|
if (!browser) {
|
|
return S_OK;
|
|
}
|
|
|
|
const auto length = std::wcslen(url);
|
|
char* converted = new char[length + 1];
|
|
WideCharToMultiByte(CP_ACP, 0, url, -1, converted, static_cast<int>(length), nullptr, nullptr);
|
|
converted[length] = '\0';
|
|
browser->Navigate(converted);
|
|
delete[] converted;
|
|
|
|
return S_OK;
|
|
}
|