mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-03 13:31:18 +12:00
input: Add option to make show screen
button a toggle (#1383)
This commit is contained in:
parent
d6575455ee
commit
f9a4b2dbb1
7 changed files with 64 additions and 31 deletions
|
@ -989,8 +989,6 @@ void LatteRenderTarget_copyToBackbuffer(LatteTextureView* textureView, bool isPa
|
|||
g_renderer->ImguiEnd();
|
||||
}
|
||||
|
||||
bool ctrlTabHotkeyPressed = false;
|
||||
|
||||
void LatteRenderTarget_itHLECopyColorBufferToScanBuffer(MPTR colorBufferPtr, uint32 colorBufferWidth, uint32 colorBufferHeight, uint32 colorBufferSliceIndex, uint32 colorBufferFormat, uint32 colorBufferPitch, Latte::E_HWTILEMODE colorBufferTilemode, uint32 colorBufferSwizzle, uint32 renderTarget)
|
||||
{
|
||||
cemu_assert_debug(colorBufferSliceIndex == 0); // todo - support for non-zero slice
|
||||
|
@ -1000,38 +998,31 @@ void LatteRenderTarget_itHLECopyColorBufferToScanBuffer(MPTR colorBufferPtr, uin
|
|||
return;
|
||||
}
|
||||
|
||||
auto getVPADScreenActive = [](size_t n) -> std::pair<bool, bool> {
|
||||
auto controller = InputManager::instance().get_vpad_controller(n);
|
||||
if (!controller)
|
||||
return {false,false};
|
||||
auto pressed = controller->is_screen_active();
|
||||
auto toggle = controller->is_screen_active_toggle();
|
||||
return {pressed && !toggle, pressed && toggle};
|
||||
};
|
||||
|
||||
const bool tabPressed = gui_isKeyDown(PlatformKeyCodes::TAB);
|
||||
const bool ctrlPressed = gui_isKeyDown(PlatformKeyCodes::LCONTROL);
|
||||
const auto [vpad0Active, vpad0Toggle] = getVPADScreenActive(0);
|
||||
const auto [vpad1Active, vpad1Toggle] = getVPADScreenActive(1);
|
||||
|
||||
bool showDRC = swkbd_hasKeyboardInputHook() == false && tabPressed;
|
||||
bool& alwaysDisplayDRC = LatteGPUState.alwaysDisplayDRC;
|
||||
const bool altScreenRequested = (!ctrlPressed && tabPressed) || vpad0Active || vpad1Active;
|
||||
const bool togglePressed = (ctrlPressed && tabPressed) || vpad0Toggle || vpad1Toggle;
|
||||
static bool togglePressedLast = false;
|
||||
|
||||
if (ctrlPressed && tabPressed)
|
||||
{
|
||||
if (ctrlTabHotkeyPressed == false)
|
||||
{
|
||||
alwaysDisplayDRC = !alwaysDisplayDRC;
|
||||
ctrlTabHotkeyPressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
ctrlTabHotkeyPressed = false;
|
||||
bool& isDRCPrimary = LatteGPUState.isDRCPrimary;
|
||||
|
||||
if (alwaysDisplayDRC)
|
||||
showDRC = !tabPressed;
|
||||
if(togglePressed && !togglePressedLast)
|
||||
isDRCPrimary = !isDRCPrimary;
|
||||
togglePressedLast = togglePressed;
|
||||
|
||||
if (!showDRC)
|
||||
{
|
||||
auto controller = InputManager::instance().get_vpad_controller(0);
|
||||
if (controller && controller->is_screen_active())
|
||||
showDRC = true;
|
||||
if (!showDRC)
|
||||
{
|
||||
controller = InputManager::instance().get_vpad_controller(1);
|
||||
if (controller && controller->is_screen_active())
|
||||
showDRC = true;
|
||||
}
|
||||
}
|
||||
bool showDRC = swkbd_hasKeyboardInputHook() == false && (isDRCPrimary ^ altScreenRequested);
|
||||
|
||||
if ((renderTarget & RENDER_TARGET_DRC) && g_renderer->IsPadWindowActive())
|
||||
LatteRenderTarget_copyToBackbuffer(texView, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue