mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Override alt-enter behavior, use borderless fullscreen instead of exclusive fullscreen. This should fix the game breaking when bringing up the open file dialog in fullscreen.
(Note that this doesn't handle resolution changes yet)
This commit is contained in:
@@ -15,7 +15,7 @@ namespace PortabilityLayer
|
||||
struct IResolutionChangeHandler
|
||||
{
|
||||
virtual void OnResolutionChanged(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) = 0;
|
||||
virtual void AdjustRequestedResolution(uint32_t &width, uint32_t &height) = 0;
|
||||
virtual void AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) = 0;
|
||||
};
|
||||
|
||||
virtual void Init() = 0;
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "MacFileMem.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLErrorCodes.h"
|
||||
#include "PLSysCalls.h"
|
||||
#include "ResTypeID.h"
|
||||
#include "HostSystemServices.h"
|
||||
|
||||
@@ -184,7 +185,7 @@ namespace PortabilityLayer
|
||||
|
||||
bool FileManagerImpl::PromptOpenFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity)
|
||||
{
|
||||
return PortabilityLayer::HostFileSystem::GetInstance()->PromptOpenFile(dirID, path, outPathLength, pathCapacity);
|
||||
return PLSysCalls::PromptOpenFile(dirID, path, outPathLength, pathCapacity);
|
||||
}
|
||||
|
||||
FileManagerImpl *FileManagerImpl::GetInstance()
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
||||
|
||||
virtual void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) = 0;
|
||||
virtual bool PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) = 0;
|
||||
virtual bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) = 0;
|
||||
};
|
||||
|
||||
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get();
|
||||
|
@@ -12,6 +12,7 @@ namespace PortabilityLayer
|
||||
int32_t m_int;
|
||||
size_t m_size;
|
||||
void *m_pointer;
|
||||
const void *m_constPointer;
|
||||
const void *m_constPointer;
|
||||
void (*m_functionPtr)(const HostSuspendCallArgument *args, HostSuspendCallArgument *returnValue);
|
||||
};
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ namespace PortabilityLayer
|
||||
HostSuspendCallID_Unknown,
|
||||
|
||||
HostSuspendCallID_Delay,
|
||||
HostSuspendCallID_CallOnVOSThread,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,10 @@
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "DisplayDeviceManager.h"
|
||||
#include "GpVOSEvent.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "InputManager.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostSuspendCallArgument.h"
|
||||
#include "HostSuspendHook.h"
|
||||
#include "HostVOSEventQueue.h"
|
||||
@@ -66,6 +69,20 @@ static void TranslateKeyboardInputEvent(const GpVOSEvent &vosEventBase, uint32_t
|
||||
if (vosEvent.m_eventType == GpKeyboardInputEventTypes::kUp || vosEvent.m_eventType == GpKeyboardInputEventTypes::kDown)
|
||||
inputManager->ApplyKeyboardEvent(vosEvent);
|
||||
|
||||
// Special handling of alt-enter, redirect to display driver
|
||||
if (vosEventBase.m_eventType == GpKeyboardInputEventTypes::kDown &&
|
||||
vosEventBase.m_event.m_keyboardInputEvent.m_keyIDSubset == GpKeyIDSubsets::kSpecial &&
|
||||
vosEventBase.m_event.m_keyboardInputEvent.m_key.m_specialKey == GpKeySpecials::kEnter)
|
||||
{
|
||||
const KeyDownStates *keyStates = inputManager->GetKeys();
|
||||
if (keyStates->m_special.Get(GpKeySpecials::kLeftAlt) || keyStates->m_special.Get(GpKeySpecials::kRightAlt))
|
||||
{
|
||||
IGpDisplayDriver *dd = PortabilityLayer::HostDisplayDriver::GetInstance();
|
||||
if (dd)
|
||||
dd->RequestToggleFullScreen(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (TimeTaggedVOSEvent *evt = queue->Enqueue())
|
||||
*evt = TimeTaggedVOSEvent::Create(vosEventBase, timestamp);
|
||||
}
|
||||
@@ -149,4 +166,63 @@ namespace PLSysCalls
|
||||
AnimationManager::GetInstance()->TickPlayers(ticks);
|
||||
}
|
||||
}
|
||||
|
||||
static void PromptOpenFileCallback(const PortabilityLayer::HostSuspendCallArgument *args, PortabilityLayer::HostSuspendCallArgument *returnValue)
|
||||
{
|
||||
bool result = PortabilityLayer::HostFileSystem::GetInstance()->PromptOpenFile(static_cast<PortabilityLayer::VirtualDirectory_t>(args[0].m_int), static_cast<char*>(args[1].m_pointer), *static_cast<size_t*>(args[2].m_pointer), args[3].m_uint);
|
||||
returnValue->m_uint = (result ? 1 : 0);
|
||||
}
|
||||
|
||||
bool PromptOpenFile(PortabilityLayer::VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity)
|
||||
{
|
||||
PortabilityLayer::HostSuspendCallArgument cbArgs[4];
|
||||
cbArgs[0].m_int = static_cast<int32_t>(dirID);
|
||||
cbArgs[1].m_pointer = path;
|
||||
cbArgs[2].m_pointer = &outPathLength;
|
||||
cbArgs[3].m_size = pathCapacity;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument cbReturnValue;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument dispatchArgs[3];
|
||||
dispatchArgs[0].m_functionPtr = PromptOpenFileCallback;
|
||||
dispatchArgs[1].m_constPointer = cbArgs;
|
||||
dispatchArgs[2].m_pointer = &cbReturnValue;
|
||||
|
||||
PortabilityLayer::SuspendApplication(PortabilityLayer::HostSuspendCallID_CallOnVOSThread, dispatchArgs, nullptr);
|
||||
|
||||
return cbReturnValue.m_uint != 0;
|
||||
}
|
||||
|
||||
static void PromptSaveFileCallback(const PortabilityLayer::HostSuspendCallArgument *args, PortabilityLayer::HostSuspendCallArgument *returnValue)
|
||||
{
|
||||
bool result = PortabilityLayer::HostFileSystem::GetInstance()->PromptSaveFile(
|
||||
static_cast<PortabilityLayer::VirtualDirectory_t>(args[0].m_int),
|
||||
static_cast<char*>(args[1].m_pointer),
|
||||
*static_cast<size_t*>(args[2].m_pointer),
|
||||
args[3].m_uint,
|
||||
static_cast<const char*>(args[4].m_constPointer));
|
||||
|
||||
returnValue->m_uint = (result ? 1 : 0);
|
||||
}
|
||||
|
||||
bool PromptSaveFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, char *path, size_t &outPathLength, size_t pathCapacity, const char *initialFileName)
|
||||
{
|
||||
PortabilityLayer::HostSuspendCallArgument cbArgs[5];
|
||||
cbArgs[0].m_int = static_cast<int32_t>(virtualDirectory);
|
||||
cbArgs[1].m_pointer = path;
|
||||
cbArgs[2].m_pointer = &outPathLength;
|
||||
cbArgs[3].m_size = pathCapacity;
|
||||
cbArgs[3].m_constPointer = initialFileName;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument cbReturnValue;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument dispatchArgs[3];
|
||||
dispatchArgs[0].m_functionPtr = PromptSaveFileCallback;
|
||||
dispatchArgs[1].m_constPointer = cbArgs;
|
||||
dispatchArgs[2].m_pointer = &cbReturnValue;
|
||||
|
||||
PortabilityLayer::SuspendApplication(PortabilityLayer::HostSuspendCallID_CallOnVOSThread, dispatchArgs, nullptr);
|
||||
|
||||
return cbReturnValue.m_uint != 0;
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "VirtualDirectory.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PLSysCalls
|
||||
{
|
||||
{
|
||||
void Sleep(uint32_t ticks);
|
||||
bool PromptOpenFile(PortabilityLayer::VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity);
|
||||
bool PromptSaveFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, char *path, size_t &outPathLength, size_t pathCapacity, const char *initialFileName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user