Commit 0821a9bb authored by Kaldaien's avatar Kaldaien
Browse files

Add support for OSD widgets

parent d09ff41e
0.8.27
+ Added OSD Widgets (framepacing and CPU load)
>> Will polish these off later, they're just toys for now.
+ Changed Special K's config menu to work similar to a Mac, for easier access to the branches
sub-menu at lower resolutions
+ Fixed various Windows 7 issues
0.8.26
+ Added G-Sync status to framerate readout on OSD
+ Cleaned up log formatting, turn wordwrap off to appreciate the changes ;)
+ Various DLL Loader compliance issues have been fixed (in third-party software),
including using incorrect paths, wrong flags, etc.
>> I am likely to encounter broken software that relied on the original undefined
behavior, I'll fix it when it causes problems :)
>> This change actuall solves a few oddball problems in the meantime
+ Added mouse warp deadzone configuration to the control panel for games with obnoxious
mouselook.
+ Fixed occasional Wbem Locator issues caused by the Steam Overlay
>> The reason that CPU stats, etc. can take several seconds to load is because the Steam
overlay holds a thread sync lock on the service needed for those stats. The reason
those stats sometimes crash games is ... because the Steam overlay holds a lock.
>> Tsk, tsk, Steam - other people need those services too, damit :)
0.8.25:
+ Fixed mouse input in Mouse Effect: Andromeda, *AGAIN*.
......
......@@ -3,7 +3,7 @@
#define SK_MAJOR 0
#define SK_MINOR 8
#define SK_BUILD 25
#define SK_BUILD 27
#define SK_REV 0
......
......@@ -110,7 +110,7 @@ struct cpu_perf_t : WMI_refresh_thread_t
// Why 64-bit integers are needed for percents is beyond me,
// but this is WMI's doing not mine.
struct {
struct cpu_stat_s {
uint64_t percent_load = 0;
uint64_t percent_idle = 0;
uint64_t percent_kernel = 0;
......@@ -118,6 +118,8 @@ struct cpu_perf_t : WMI_refresh_thread_t
uint64_t percent_interrupt = 0;
uint64_t temp_c = 0;
DWORD update_time = 0UL;
} cpus [64];
DWORD num_cpus = 0;
......@@ -137,7 +139,7 @@ struct disk_perf_t : WMI_refresh_thread_t
long lPercentDiskTimeHandle = 0;
long lPercentIdleTimeHandle = 0;
struct {
struct disk_stat_s {
char name [32];
uint64_t percent_load = 0;
......
......@@ -783,7 +783,6 @@ SK_Detach (DLL_ROLE role)
ret = SK::DDraw::Shutdown ();
break;
#else
#endif
case DLL_ROLE::OpenGL:
......@@ -937,7 +936,7 @@ DllMain ( HMODULE hModule,
case DLL_PROCESS_DETACH:
{
SK_Inject_ReleaseProcess ();
if (! InterlockedCompareExchange (&__SK_DLL_Ending, 1, 0))
{
// If the DLL being unloaded is the source of a CBT hook, then
......@@ -945,7 +944,7 @@ DllMain ( HMODULE hModule,
if (InterlockedExchangeAdd (&__SK_HookContextOwner, 0UL))
{
SKX_RemoveCBTHook ();
// If SKX_RemoveCBTHook (...) is successful: (__SK_HookContextOwner = 0)
if (! InterlockedExchangeAdd (&__SK_HookContextOwner, 0UL))
{
......@@ -956,15 +955,16 @@ DllMain ( HMODULE hModule,
#endif
}
}
//
if (InterlockedExchangeAddAcquire (&__SK_DLL_Attached, 0))
{
InterlockedExchange (&__SK_DLL_Ending, TRUE);
SK_Detach (SK_GetDLLRole ());
}
}
if (InterlockedExchangeAddRelease (&__SK_DLL_Attached, 0))
SK_Detach (SK_GetDLLRole ());
if (__SK_TLS_INDEX != MAXDWORD)
TlsFree (__SK_TLS_INDEX);
......
......@@ -883,6 +883,8 @@ SK_InitCore (const wchar_t* backend, void* callback)
{
EnterCriticalSection (&init_mutex);
SK_Input_Init ();
wcscpy (SK_Backend, backend);
typedef void (WINAPI *finish_pfn) (void);
......@@ -1857,8 +1859,6 @@ BACKEND_INIT:
CreateThread ( nullptr, 0,
[](LPVOID) -> DWORD
{
SK_Input_Init ();
bool SK_InitWMI (void);
SK_InitWMI ( );
......
......@@ -6038,6 +6038,25 @@ SK_D3D11_InitTextures (void)
cache_opts.min_size = config.textures.cache.min_size;
cache_opts.ignore_non_mipped = config.textures.cache.ignore_nonmipped;
SK_D3D11_Textures.TexRefs_2D.reserve (8192);
SK_D3D11_Textures.Textures_2D.reserve (8192);
SK_D3D11_Textures.HashMap_2D [ 1].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 2].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 3].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 4].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 5].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 6].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 7].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 8].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [ 9].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [10].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [11].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [12].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [13].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [14].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [15].reserve ( 512);
SK_D3D11_Textures.HashMap_2D [16].reserve ( 512);
//
// Legacy Hack for Untitled Project X (FFX/FFX-2)
//
......
......@@ -502,13 +502,10 @@ SK_CEGUI_DrawD3D9 (IDirect3DDevice9* pDev, IDirect3DSwapChain9* pSwapChain)
CEGUI::System::getDllSingleton ().renderAllGUIContexts ();
if (SK_ImGui_Visible)
if ((int)SK_GetCurrentRenderBackend ().api & (int)SK_RenderAPI::D3D9)
{
if ((int)SK_GetCurrentRenderBackend ().api & (int)SK_RenderAPI::D3D9)
{
extern DWORD SK_ImGui_DrawFrame (DWORD dwFlags, void* user);
SK_ImGui_DrawFrame ( 0x00, nullptr );
}
extern DWORD SK_ImGui_DrawFrame (DWORD dwFlags, void* user);
SK_ImGui_DrawFrame ( 0x00, nullptr );
}
}
cegD3D9->endRendering ();
......
......@@ -173,14 +173,14 @@ BlacklistLibrary (const _T* lpFileName)
{
WaitForInit ();
while (SK_GetFramesDrawn () < 3) SleepEx (133, TRUE);
while (SK_GetFramesDrawn () < 6) SleepEx (666, TRUE);
}
#else
if (StrStrI (lpFileName, SK_TEXT("action_x86")))
{
WaitForInit ();
while (SK_GetFramesDrawn () < 3) SleepEx (133, TRUE);
while (SK_GetFramesDrawn () < 6) SleepEx (666, TRUE);
}
#endif
......@@ -188,7 +188,7 @@ BlacklistLibrary (const _T* lpFileName)
{
WaitForInit ();
while (SK_GetFramesDrawn () < 3) SleepEx (133, TRUE);
while (SK_GetFramesDrawn () < 4) SleepEx (250, TRUE);
}
......@@ -391,24 +391,24 @@ SK_TraceLoadLibrary ( HMODULE hCallingMod,
// not good. Hash the string and compare it in the future.
if ( StrStrIW (wszModName, L"Activation") ||
StrStrIW (wszModName, L"rxcore") ||
StrStrIW (wszModName, L"GeDoSaTo") )
StrStrIW (wszModName, L"GeDoSaTo") ||
StrStrIW (wszModName, L"gameoverlayrenderer") ||
StrStrIW (wszModName, L"RTSSHooks") ||
StrStrIW (wszModName, L"Activation") )
{
SK_ReHookLoadLibrary ();
}
}
if ( StrStrIW (wszModName, L"gameoverlayrenderer") ||
StrStrIW (wszModName, L"Nahimic2DevProps") ||
StrStrIW (wszModName, L"ReShade") ||
StrStrIW (wszModName, L"RTSSHooks") ||
StrStrIW (wszModName, L"Activation") )
if ( StrStrIW (wszModName, L"Nahimic2DevProps") ||
StrStrIW (wszModName, L"ReShade") )
{
static int tries = 0;
// If these things ever repeatedly try to rehook what we
// just rehooked, then give up eventuall to prevent
// infinite recursion.
if (tries++ < 5)
if (tries++ < 2)
SK_ReHookLoadLibrary ();
}
}
......
......@@ -1494,25 +1494,19 @@ SK_CEGUI_DrawD3D11 (IDXGISwapChain* This)
SK_Steam_DrawOSD ();
CEGUI::System::getDllSingleton ().renderAllGUIContexts ();
}
cegD3D11->endRendering ();
}
extern bool SK_ImGui_Visible;
if (SK_ImGui_Visible)
{
// XXX: TODO (Full startup isn't necessary, just update framebuffer dimensions).
if (ImGui_DX11Startup ( This ))
{
extern DWORD SK_ImGui_DrawFrame ( DWORD dwFlags, void* user );
SK_ImGui_DrawFrame ( 0x00, nullptr );
// XXX: TODO (Full startup isn't necessary, just update framebuffer dimensions).
if (ImGui_DX11Startup ( This ))
{
extern DWORD SK_ImGui_DrawFrame ( DWORD dwFlags, void* user );
SK_ImGui_DrawFrame ( 0x00, nullptr );
}
}
cegD3D11->endRendering ();
}
sb->apply (pImmediateContext);
//
// Update G-Sync; doing this here prevents trying to do this on frames where
// the swapchain was resized, which would deadlock the software.
......@@ -2371,8 +2365,8 @@ DXGISwap_ResizeTarget_Override ( IDXGISwapChain *This,
}
DXGI_LOG_CALL_I6 ( L" IDXGISwapChain", L"ResizeTarget ",
L"{ (%lux%lu @ %3.1f Hz),"
L" fmt=%lu,scaling=0x%02x,scanlines=0x%02x }",
L"{ (%lux%lu@%3.1f Hz),"
L"fmt=%lu,scaling=0x%02x,scanlines=0x%02x }",
pNewTargetParameters->Width, pNewTargetParameters->Height,
pNewTargetParameters->RefreshRate.Denominator != 0 ?
(float)pNewTargetParameters->RefreshRate.Numerator /
......@@ -2389,7 +2383,7 @@ DXGISwap_ResizeTarget_Override ( IDXGISwapChain *This,
pNewTargetParameters->Scaling !=
(DXGI_MODE_SCALING)config.render.dxgi.scaling_mode )
||
( config.render.framerate.refresh_rate != -1 &&
( config.render.framerate.refresh_rate != -1 &&
pNewTargetParameters->RefreshRate.Numerator !=
(UINT)config.render.framerate.refresh_rate )
)
......@@ -2924,11 +2918,11 @@ SK_DXGI_CreateSwapChain1_PostInit ( _In_ IUnknown *p
desc.BufferDesc.Format = pDesc1->Format;
//desc.BufferDesc.Scaling = pDesc1->Scaling;
desc.BufferCount = pDesc1->BufferCount;
desc.BufferUsage = pDesc1->BufferUsage;
desc.Flags = pDesc1->Flags;
desc.SampleDesc = pDesc1->SampleDesc;
desc.SwapEffect = pDesc1->SwapEffect;
desc.BufferCount = pDesc1->BufferCount;
desc.BufferUsage = pDesc1->BufferUsage;
desc.Flags = pDesc1->Flags;
desc.SampleDesc = pDesc1->SampleDesc;
desc.SwapEffect = pDesc1->SwapEffect;
if (pFullscreenDesc)
{
......@@ -4317,6 +4311,9 @@ HookDXGI (LPVOID user)
pFactory->CreateSwapChain (*d3d11_hook_ctx.ppDevice, &desc, &pSwapChain);
SK_DXGI_HookSwapChain (pSwapChain);
HookD3D11 (&d3d11_hook_ctx);
SK_DXGI_HookFactory (pFactory);
// Copy the vtable, so we can defer hook installation if needed
IDXGISwapChain* pSwapCopy =
(IDXGISwapChain *)malloc (sizeof IDXGISwapChain);
......@@ -4328,6 +4325,10 @@ HookDXGI (LPVOID user)
memcpy (pSwapCopy, pSwapChain, sizeof IDXGISwapChain);
// This won't catch Present1 (...), but no games use that
// and we can deal with it later if it happens.
SK_DXGI_HookPresentBase ((IDXGISwapChain *)pSwapCopy, false);
CreateThread ( nullptr,
0x0,
[](LPVOID user) -> DWORD
......@@ -4340,9 +4341,10 @@ HookDXGI (LPVOID user)
// and we can deal with it later if it happens.
SK_DXGI_HookPresentBase ((IDXGISwapChain *)user, false);
free (user);
MH_ApplyQueued ();
}
MH_ApplyQueued ();
CloseHandle (GetCurrentThread ());
return 0;
......@@ -4354,9 +4356,6 @@ HookDXGI (LPVOID user)
DestroyWindow (hWnd);
}
HookD3D11 (&d3d11_hook_ctx);
SK_DXGI_HookFactory (pFactory);
// These don't do anything (anymore)
if (config.apis.dxgi.d3d11.hook) SK_D3D11_EnableHooks ();
......
This diff is collapsed.
......@@ -148,12 +148,17 @@ ImGui_ImplGL3_RenderDrawLists (ImDrawData* draw_data)
static const char*
ImGui_ImplGL3_GetClipboardText (void* user_data)
{
UNREFERENCED_PARAMETER (user_data);
return nullptr;//return glfwGetClipboardString((GLFWwindow*)user_data);
}
static void
ImGui_ImplGL3_SetClipboardText (void* user_data, const char* text)
{
UNREFERENCED_PARAMETER (user_data);
UNREFERENCED_PARAMETER (text);
//glfwSetClipboardString((GLFWwindow*)user_data, text);
}
......
......@@ -9827,7 +9827,7 @@ bool ImGui::BeginMainMenuBar()
SetNextWindowSize(ImVec2(g.IO.DisplaySize.x, g.FontBaseSize + g.Style.FramePadding.y * 2.0f));
PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0,0));
if (!Begin("##MainMenuBar", NULL, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_MenuBar)
if (!Begin("##MainMenuBar", NULL, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_MenuBar|ImGuiWindowFlags_AlwaysAutoResize)
|| !BeginMenuBar())
{
End();
......
......@@ -322,7 +322,7 @@ di8_init_callback (finish_pfn finish)
SK_HookDI8 (nullptr);
while (! InterlockedCompareExchange (&__di8_ready, FALSE, FALSE))
SleepEx (100UL, TRUE);
SleepEx (8UL, TRUE);
}
finish ();
......@@ -332,10 +332,7 @@ di8_init_callback (finish_pfn finish)
bool
SK::DI8::Startup (void)
{
const bool ret =
SK_StartupCore (L"dinput8", di8_init_callback);
return ret;
return SK_StartupCore (L"dinput8", di8_init_callback);
}
bool
......
......@@ -683,6 +683,8 @@ SK_MonitorCPU (LPVOID user_param)
= ( cpu.cpus [i].percent_interrupt +
interrupt ) / 2;
cpu.cpus [i].update_time = timeGetTime ();
// Done with the object
cpu.apEnumAccess [i]->Release ();
cpu.apEnumAccess [i] = nullptr;
......
......@@ -86,7 +86,6 @@ ULONG
__stdcall
SK_GetFramesDrawn (void);
extern bool SK_ImGui_Visible;
extern DWORD SK_ImGui_DrawFrame (DWORD dwFlags, void* user);
unsigned int
......@@ -1292,9 +1291,8 @@ SK_CEGUI_DrawGL (void)
SK_Steam_DrawOSD ();
CEGUI::System::getDllSingleton ().renderAllGUIContexts ();
if (SK_ImGui_Visible)
SK_ImGui_DrawFrame (0x00, nullptr);
SK_ImGui_DrawFrame (0x00, nullptr);
}
cegGL->endRendering ();
......
......@@ -633,11 +633,31 @@ SK_DrawOSD (void)
last_fps_time = dwTime;
}
bool gsync = false;
if (sk::NVAPI::nv_hardware && config.apis.NvAPI.gsync_status)
{
if (SK_GetCurrentRenderBackend ().gsync_state.capable)
{
if (SK_GetCurrentRenderBackend ().gsync_state.active)
{
gsync = true;
}
}
}
if (mean != INFINITY)
{
if (SK::Framerate::GetLimiter ()->get_limit () != 0.0 && (! isTalesOfZestiria) && frame_history2.calcNumSamples () > 0)
{
OSD_PRINTF " %-7ws: %#4.01f FPS, %#13.01f ms (s=%3.2f,min=%3.2f,max=%3.2f,hitches=%d) <%4.01f FPS / %3.2f ms>",
const char* format = " %-7ws: %#4.01f FPS, %#13.01f ms (s=%3.2f,min=%3.2f,max=%3.2f,hitches=%d) <%4.01f FPS / %3.2f ms>";
if (gsync)
format = " %-7ws: %#4.01f FPS (G-Sync),%#5.01f ms (s=%3.2f,min=%3.2f,max=%3.2f,hitches=%d) <%4.01f FPS / %3.2f ms>";
OSD_PRINTF format,
SK_GetCurrentRenderBackend ().name,
// Cast to FP to avoid integer division by zero.
fps,
......@@ -654,7 +674,12 @@ SK_DrawOSD (void)
// No Effective Frametime History
else
{
OSD_PRINTF " %-7ws: %#4.01f FPS, %#13.01f ms (s=%3.2f,min=%3.2f,max=%3.2f,hitches=%d)",
const char* format = " %-7ws: %#4.01f FPS, %#13.01f ms (s=%3.2f,min=%3.2f,max=%3.2f,hitches=%d)";
if (gsync)
format = " %-7ws: %#4.01f FPS (G-Sync),%#5.01f ms (s=%3.2f,min=%3.2f,max=%3.2f,hitches=%d)";
OSD_PRINTF format,
SK_GetCurrentRenderBackend ().name,
// Cast to FP to avoid integer division by zero.
fps,
......@@ -670,7 +695,12 @@ SK_DrawOSD (void)
// No Frametime History
else
{
OSD_PRINTF " %-7ws: %#4.01f FPS, %#13.01f ms",
const char* format = " %-7ws: %#4.01f FPS, %#13.01f ms";
if (gsync)
format = " %-7ws: %#4.01f FPS (G-Sync),%5.01f ms";
OSD_PRINTF format,
SK_GetCurrentRenderBackend ().name,
// Cast to FP to avoid integer division by zero.
1000.0f * 0.0f / 1.0f, 0.0f
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment