mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-31 00:31:12 +00:00
Cmd line: Changed -fs-height=<best|nnnn> so it doesn't change the resolution when not full-screen (#876)
. NB. whenever switching back to non-full-screen, then it will restore the default desktop resolution. . Allow -no-full-screen to be placed before -fs-height=<best|nnnn> (previously it only worked when placed afterwards)
This commit is contained in:
parent
0ca972954e
commit
f076986c04
@ -199,16 +199,17 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-f") == 0 || strcmp(lpCmdLine, "-full-screen") == 0)
|
||||
{
|
||||
g_cmdLine.bSetFullScreen = true;
|
||||
g_cmdLine.setFullScreen = 1;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-no-full-screen") == 0)
|
||||
{
|
||||
g_cmdLine.bSetFullScreen = false;
|
||||
g_cmdLine.setFullScreen = 0;
|
||||
}
|
||||
#define CMD_FS_HEIGHT "-fs-height="
|
||||
else if (strncmp(lpCmdLine, CMD_FS_HEIGHT, sizeof(CMD_FS_HEIGHT)-1) == 0)
|
||||
{
|
||||
g_cmdLine.bSetFullScreen = true; // Implied. Can be overridden by "-no-full-screen"
|
||||
if (g_cmdLine.setFullScreen < 0) // Not yet been specified on cmd line?
|
||||
g_cmdLine.setFullScreen = 1; // Implicity set full-screen. NB. Can be overridden by "-no-full-screen"
|
||||
|
||||
LPSTR lpTmp = lpCmdLine + sizeof(CMD_FS_HEIGHT)-1;
|
||||
bool bRes = false;
|
||||
|
@ -12,9 +12,8 @@ struct CmdLine
|
||||
CmdLine()
|
||||
{
|
||||
bShutdown = false;
|
||||
bSetFullScreen = false;
|
||||
setFullScreen = -1;
|
||||
bBoot = false;
|
||||
bChangedDisplayResolution = false;
|
||||
bSlot0LanguageCard = false;
|
||||
bSlot7EmptyOnExit = false;
|
||||
bSwapButtons0and1 = false;
|
||||
@ -49,9 +48,8 @@ struct CmdLine
|
||||
}
|
||||
|
||||
bool bShutdown;
|
||||
bool bSetFullScreen;
|
||||
int setFullScreen; // tristate: -1 (no cmd line specified), 0="-no-full-screen", 1="-full-screen"
|
||||
bool bBoot;
|
||||
bool bChangedDisplayResolution;
|
||||
bool bSlot0LanguageCard;
|
||||
bool bSlotEmpty[NUM_SLOTS];
|
||||
bool bSlot7EmptyOnExit;
|
||||
|
@ -643,7 +643,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
|
||||
if (g_bRestart)
|
||||
{
|
||||
g_cmdLine.bSetFullScreen = g_bRestartFullScreen;
|
||||
g_cmdLine.setFullScreen = g_bRestartFullScreen ? 1 : 0;
|
||||
g_bRestartFullScreen = false;
|
||||
|
||||
MB_Reset(true);
|
||||
@ -981,25 +981,10 @@ static void RepeatInitialization(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_cmdLine.bestWidth && g_cmdLine.bestHeight)
|
||||
{
|
||||
DEVMODE devMode;
|
||||
memset(&devMode, 0, sizeof(devMode));
|
||||
devMode.dmSize = sizeof(devMode);
|
||||
devMode.dmPelsWidth = g_cmdLine.bestWidth;
|
||||
devMode.dmPelsHeight = g_cmdLine.bestHeight;
|
||||
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
|
||||
DWORD dwFlags = 0;
|
||||
LONG res = ChangeDisplaySettings(&devMode, dwFlags);
|
||||
if (res == 0)
|
||||
g_cmdLine.bChangedDisplayResolution = true;
|
||||
}
|
||||
|
||||
if (g_cmdLine.bSetFullScreen)
|
||||
if (g_cmdLine.setFullScreen > 0)
|
||||
{
|
||||
PostMessage(GetFrame().g_hFrameWindow, WM_USER_FULLSCREEN, 0, 0);
|
||||
g_cmdLine.bSetFullScreen = false;
|
||||
g_cmdLine.setFullScreen = 0;
|
||||
}
|
||||
|
||||
if (g_cmdLine.bBoot)
|
||||
@ -1012,8 +997,7 @@ static void RepeatInitialization(void)
|
||||
|
||||
static void Shutdown(void)
|
||||
{
|
||||
if (g_cmdLine.bChangedDisplayResolution)
|
||||
ChangeDisplaySettings(NULL, 0); // restore default
|
||||
ChangeDisplaySettings(NULL, 0); // restore default resolution
|
||||
|
||||
// Release COM
|
||||
SysClk_UninitTimer();
|
||||
|
@ -36,6 +36,8 @@ Win32Frame::Win32Frame()
|
||||
g_win_fullscreen_scale = 1;
|
||||
g_win_fullscreen_offsetx = 0;
|
||||
g_win_fullscreen_offsety = 0;
|
||||
m_bestWidthForFullScreen = 0;
|
||||
m_bestHeightForFullScreen = 0;
|
||||
|
||||
btnfacebrush = (HBRUSH)0;
|
||||
btnfacepen = (HPEN)0;
|
||||
|
@ -96,8 +96,8 @@ private:
|
||||
bool ConfirmReboot(bool bFromButtonUI);
|
||||
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive);
|
||||
void RelayEvent(UINT message, WPARAM wparam, LPARAM lparam);
|
||||
void SetFullScreenMode();
|
||||
void SetNormalMode();
|
||||
void SetFullScreenMode(void);
|
||||
void SetNormalMode(void);
|
||||
void SetUsingCursor(BOOL bNewValue);
|
||||
void SetupTooltipControls(void);
|
||||
void FrameResizeWindow(int nNewScale);
|
||||
@ -132,6 +132,8 @@ private:
|
||||
FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale;
|
||||
int g_win_fullscreen_offsetx;
|
||||
int g_win_fullscreen_offsety;
|
||||
UINT m_bestWidthForFullScreen;
|
||||
UINT m_bestHeightForFullScreen;
|
||||
|
||||
static const UINT MAX_DRAW_DEVICES = 10;
|
||||
char* draw_devices[MAX_DRAW_DEVICES];
|
||||
|
@ -2107,7 +2107,7 @@ int Win32Frame::GetFullScreenOffsetY(void)
|
||||
return g_win_fullscreen_offsety;
|
||||
}
|
||||
|
||||
void Win32Frame::SetFullScreenMode ()
|
||||
void Win32Frame::SetFullScreenMode(void)
|
||||
{
|
||||
#ifdef NO_DIRECT_X
|
||||
|
||||
@ -2115,6 +2115,21 @@ void Win32Frame::SetFullScreenMode ()
|
||||
|
||||
#else // NO_DIRECT_X
|
||||
|
||||
if (m_bestWidthForFullScreen && m_bestHeightForFullScreen)
|
||||
{
|
||||
DEVMODE devMode;
|
||||
memset(&devMode, 0, sizeof(devMode));
|
||||
devMode.dmSize = sizeof(devMode);
|
||||
devMode.dmPelsWidth = m_bestWidthForFullScreen;
|
||||
devMode.dmPelsHeight = m_bestHeightForFullScreen;
|
||||
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
|
||||
DWORD dwFlags = 0;
|
||||
LONG res = ChangeDisplaySettings(&devMode, dwFlags);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
MONITORINFO monitor_info;
|
||||
FULLSCREEN_SCALE_TYPE width, height, scalex, scaley;
|
||||
int top, left;
|
||||
@ -2158,8 +2173,10 @@ void Win32Frame::SetFullScreenMode ()
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void Win32Frame::SetNormalMode ()
|
||||
void Win32Frame::SetNormalMode(void)
|
||||
{
|
||||
ChangeDisplaySettings(NULL, 0); // restore default resolution
|
||||
|
||||
FullScreenRevealCursor(); // Do before clearing g_bIsFullScreen flag
|
||||
|
||||
buttonover = -1;
|
||||
@ -2682,6 +2699,9 @@ void Win32Frame::FrameUpdateApple2Type(void)
|
||||
|
||||
bool Win32Frame::GetBestDisplayResolutionForFullScreen(UINT& bestWidth, UINT& bestHeight, UINT userSpecifiedHeight /*= 0*/)
|
||||
{
|
||||
m_bestWidthForFullScreen = 0;
|
||||
m_bestHeightForFullScreen = 0;
|
||||
|
||||
typedef std::vector< std::pair<UINT,UINT> > VEC_PAIR;
|
||||
VEC_PAIR vecDisplayResolutions;
|
||||
|
||||
@ -2733,6 +2753,9 @@ bool Win32Frame::GetBestDisplayResolutionForFullScreen(UINT& bestWidth, UINT& be
|
||||
|
||||
bestWidth = width;
|
||||
bestHeight = userSpecifiedHeight;
|
||||
|
||||
m_bestWidthForFullScreen = bestWidth;
|
||||
m_bestHeightForFullScreen = bestHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2760,5 +2783,8 @@ bool Win32Frame::GetBestDisplayResolutionForFullScreen(UINT& bestWidth, UINT& be
|
||||
|
||||
bestWidth = tmpBestWidth;
|
||||
bestHeight = tmpBestHeight;
|
||||
|
||||
m_bestWidthForFullScreen = bestWidth;
|
||||
m_bestHeightForFullScreen = bestHeight;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user