Skip to content

Commit

Permalink
Fixes #10 freezes finally I think (capped at 240 FPS now though).
Browse files Browse the repository at this point in the history
  • Loading branch information
dtugend committed Feb 18, 2022
1 parent 985f73b commit 4dcfd4d
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 158 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

## FAQ

### Is this actively maintained?

**Currently development on this is paused**, since we work on other things (HLAE 3)!

### Can I use this for browsing the internet?

You should strongly avoid loading any untrusted content with afx-cefhud-interop at the moment, this would put your PC at a high risk:
Expand Down
30 changes: 23 additions & 7 deletions afx-cefhud-interop/AfxInterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2201,9 +2201,9 @@ class CDrawingInteropImpl : public CAfxObject,
(HANDLE)(((unsigned __int64)lo) | (((unsigned __int64)hi << 32)));


if (nullptr != m_OnFrame) {
auto fn_resolve = m_OnFrame;
m_OnFrame = nullptr;
if (0 < m_OnFrame.size()) {
auto fn_resolve = m_OnFrame.front();
m_OnFrame.pop();
CefPostTask(TID_RENDERER, new CAfxTask([this, fn_resolve]() {
if (nullptr == m_Context)
return;
Expand Down Expand Up @@ -2470,7 +2470,7 @@ CAfxObject::AddFunction(

if (2 <= arguments.size() && arguments[0]->IsFunction() &&
arguments[1]->IsFunction()) {
self->m_OnFrame = arguments[0];
self->m_OnFrame.emplace(arguments[0]);

auto message = CefProcessMessage::Create("afx-paint");
self->m_Frame->SendProcessMessage(PID_BROWSER, message);
Expand All @@ -2482,6 +2482,22 @@ CAfxObject::AddFunction(
return true;
});

CAfxObject::AddFunction(
obj, "invalidateCefClearTexture",
[](const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
CefString& exceptionoverride) {
auto self = CAfxObject::As<AfxObjectType::DrawingInteropImpl,
CDrawingInteropImpl>(object);
if (self == nullptr) {
exceptionoverride = g_szInvalidThis;
return true;
}

self->m_ClearHandle = INVALID_HANDLE_VALUE;
return true;
});

CAfxObject::AddFunction(
obj, "setCefUseClearTexture",
[](const CefString& name, CefRefPtr<CefV8Value> object,
Expand Down Expand Up @@ -8160,14 +8176,14 @@ CAfxObject::AddFunction(
IMPLEMENT_REFCOUNTING(CAfxD3d9VertexShader);
};

HANDLE m_ShareHandle = INVALID_HANDLE_VALUE;
HANDLE m_ClearHandle = INVALID_HANDLE_VALUE;
std::atomic<HANDLE> m_ShareHandle = INVALID_HANDLE_VALUE;
std::atomic<HANDLE> m_ClearHandle = INVALID_HANDLE_VALUE;

CefRefPtr<CAfxCallback> m_OnMessage;
CefRefPtr<CAfxCallback> m_OnError;
CefRefPtr<CAfxCallback> m_OnDeviceLost;
CefRefPtr<CAfxCallback> m_OnDeviceReset;
CefRefPtr<CefV8Value> m_OnFrame;
std::queue<CefRefPtr<CefV8Value>> m_OnFrame;
CefRefPtr<CefV8Value> m_OnAck;

bool m_WaitConnectionQuit = false;
Expand Down
Loading

0 comments on commit 4dcfd4d

Please sign in to comment.