Tidy-up for full-screen vars

This commit is contained in:
tomcw 2016-07-26 22:33:45 +01:00
parent 94b8e76e3b
commit af196ac8ae
4 changed files with 57 additions and 50 deletions

View File

@ -562,15 +562,15 @@ void StretchBltMemToFrameDC(void)
int nViewportCX, nViewportCY;
GetViewportCXCY(nViewportCX, nViewportCY);
FULLSCREEN_SCALE_TYPE xdest = g_win_fullscreen_offsetx;
FULLSCREEN_SCALE_TYPE ydest = g_win_fullscreen_offsety;
FULLSCREEN_SCALE_TYPE wdest = nViewportCX;
FULLSCREEN_SCALE_TYPE hdest = nViewportCY;
int xdest = GetFullScreenOffsetX();
int ydest = GetFullScreenOffsetY();
int wdest = nViewportCX;
int hdest = nViewportCY;
BOOL bRes = StretchBlt(
FrameGetDC(), // HDC hdcDest,
(int)xdest, (int)(ydest), // int nXOriginDest, int nYOriginDest,
(int)wdest, (int)(hdest), // int nWidthDest, int nHeightDest,
xdest, ydest, // int nXOriginDest, int nYOriginDest,
wdest, hdest, // int nWidthDest, int nHeightDest,
GetDebuggerMemDC(), // HDC hdcSrc,
0, 0, // int nXOriginSrc, int nYOriginSrc,
FRAMEBUFFER_BORDERLESS_W, FRAMEBUFFER_BORDERLESS_H, // int nWidthSrc, int nHeightSrc,

View File

@ -170,6 +170,19 @@ bool g_bScrollLock_FullSpeed = false;
bool g_bFreshReset = false;
static bool g_bFullScreen32Bit = true;
#if 0 // enable non-integral full-screen scaling
#define FULLSCREEN_SCALE_TYPE float
#else
#define FULLSCREEN_SCALE_TYPE int
#endif
static RECT g_main_window_saved_rect;
static int g_main_window_saved_style;
static int g_main_window_saved_exstyle;
static FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale = 1;
static int g_win_fullscreen_offsetx = 0;
static int g_win_fullscreen_offsety = 0;
// __ Prototypes __________________________________________________________________________________
static void DrawCrosshairs (int x, int y);
static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen);
@ -478,10 +491,10 @@ static void DrawCrosshairs (int x, int y) {
while (loop--) {
RECT rect = {0,0,5,5};
switch (loop) {
case 0: OffsetRect(&rect, g_win_fullscreen_offsetx+lastx-2, g_win_fullscreen_offsety+viewporty-5); break;
case 1: OffsetRect(&rect, g_win_fullscreen_offsetx+lastx-2, g_win_fullscreen_offsety+viewporty+g_nViewportCY); break;
case 2: OffsetRect(&rect, g_win_fullscreen_offsetx+viewportx-5, g_win_fullscreen_offsety+lasty-2); break;
case 3: OffsetRect(&rect, g_win_fullscreen_offsetx+viewportx+g_nViewportCX, g_win_fullscreen_offsety+lasty-2); break;
case 0: OffsetRect(&rect, GetFullScreenOffsetX()+lastx-2, GetFullScreenOffsetY()+viewporty-5); break;
case 1: OffsetRect(&rect, GetFullScreenOffsetX()+lastx-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY); break;
case 2: OffsetRect(&rect, GetFullScreenOffsetX()+viewportx-5, GetFullScreenOffsetY()+lasty-2); break;
case 3: OffsetRect(&rect, GetFullScreenOffsetX()+viewportx+g_nViewportCX, GetFullScreenOffsetY()+lasty-2); break;
}
FillRect(dc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH));
}
@ -521,14 +534,14 @@ static void DrawCrosshairs (int x, int y) {
SelectObject(dc,GetStockObject(WHITE_PEN));
else
SelectObject(dc,GetStockObject(BLACK_PEN));
LINE(g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty-5,
g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty);
LINE(g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty+g_nViewportCY+4,
g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty+g_nViewportCY-1);
LINE(g_win_fullscreen_offsetx+viewportx-5, g_win_fullscreen_offsety+y+loop-2,
g_win_fullscreen_offsetx+viewportx, g_win_fullscreen_offsety+y+loop-2);
LINE(g_win_fullscreen_offsetx+viewportx+g_nViewportCX+4, g_win_fullscreen_offsety+y+loop-2,
g_win_fullscreen_offsetx+viewportx+g_nViewportCX-1, g_win_fullscreen_offsety+y+loop-2);
LINE(GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty-5,
GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty);
LINE(GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY+4,
GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY-1);
LINE(GetFullScreenOffsetX()+viewportx-5, GetFullScreenOffsetY()+y+loop-2,
GetFullScreenOffsetX()+viewportx, GetFullScreenOffsetY()+y+loop-2);
LINE(GetFullScreenOffsetX()+viewportx+g_nViewportCX+4, GetFullScreenOffsetY()+y+loop-2,
GetFullScreenOffsetX()+viewportx+g_nViewportCX-1, GetFullScreenOffsetY()+y+loop-2);
}
}
else
@ -2088,13 +2101,15 @@ void SetFullScreen32Bit(bool b32Bit)
g_bFullScreen32Bit = b32Bit;
}
// TODO: Put this stuff in a header / somewhere sensible
RECT g_main_window_saved_rect;
int g_main_window_saved_style;
int g_main_window_saved_exstyle;
FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale = 1;
int g_win_fullscreen_offsetx = 0;
int g_win_fullscreen_offsety = 0;
int GetFullScreenOffsetX(void)
{
return g_win_fullscreen_offsetx;
}
int GetFullScreenOffsetY(void)
{
return g_win_fullscreen_offsety;
}
void SetFullScreenMode ()
{
@ -2144,8 +2159,8 @@ void SetFullScreenMode ()
// FS: desktop
SetViewportScale(g_win_fullscreen_scale, true);
buttonx = g_win_fullscreen_offsetx + g_nViewportCX + VIEWPORTX*2;
buttony = g_win_fullscreen_offsety;
buttonx = GetFullScreenOffsetX() + g_nViewportCX + VIEWPORTX*2;
buttony = GetFullScreenOffsetY();
viewportx = VIEWPORTX;
viewporty = VIEWPORTY;
#endif

View File

@ -52,16 +52,6 @@
extern int g_nCharsetType;
#if 0 // enable non-integral full-screen scaling
#define FULLSCREEN_SCALE_TYPE float
#else
#define FULLSCREEN_SCALE_TYPE int
#endif
extern FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale;
extern int g_win_fullscreen_offsetx;
extern int g_win_fullscreen_offsety;
// Prototypes
void CtrlReset();
@ -89,3 +79,5 @@ extern int g_win_fullscreen_offsety;
WPARAM wparam,
LPARAM lparam );
int GetFullScreenOffsetX(void);
int GetFullScreenOffsetY(void);

View File

@ -994,8 +994,8 @@ void VideoDisplayLogo ()
nLogoX = 0;
nLogoY = 0;
#else
nLogoX += g_win_fullscreen_offsetx;
nLogoY += g_win_fullscreen_offsety;
nLogoX += GetFullScreenOffsetX();
nLogoY += GetFullScreenOffsetY();
#endif
}
VideoDrawLogoBitmap( hFrameDC, nLogoX, nLogoY, bm.bmWidth, bm.bmHeight, scale );
@ -1014,7 +1014,7 @@ void VideoDisplayLogo ()
char szVersion[ 64 ] = "";
sprintf( szVersion, "Version %s", VERSIONSTRING );
int xoff = g_win_fullscreen_offsetx, yoff = g_win_fullscreen_offsety;
int xoff = GetFullScreenOffsetX(), yoff = GetFullScreenOffsetY();
#define DRAWVERSION(x,y,c) \
SetTextColor(hFrameDC,c); \
@ -1068,15 +1068,15 @@ void VideoDisplayLogo ()
// sprintf( szVersion, "NTSC Alpha v17 BMP Palette" );
sprintf( szVersion, "NTSC Alpha v18" );
xoff = -g_nViewportCX + g_nViewportCX/6 + g_win_fullscreen_offsetx;
yoff = -g_nViewportCY/16 + g_win_fullscreen_offsety;
xoff = -g_nViewportCX + g_nViewportCX/6 + GetFullScreenOffsetX();
yoff = -g_nViewportCY/16 + GetFullScreenOffsetY();
DRAWVERSION( 0, 0,RGB(0x00,0x00,0x00));
DRAWVERSION( 1, 1,RGB(0x00,0x00,0x00));
DRAWVERSION( 2, 2,RGB(0xFF,0x00,0xFF));
sprintf( szVersion, "Blurry 80-col Text" );
xoff = -g_nViewportCX + g_nViewportCX/6 + g_win_fullscreen_offsetx;
yoff = +g_nViewportCY/16 + g_win_fullscreen_offsety;
xoff = -g_nViewportCX + g_nViewportCX/6 + GetFullScreenOffsetX();
yoff = +g_nViewportCY/16 + GetFullScreenOffsetY();
DRAWVERSION( 0, 0,RGB(0x00,0x00,0x00));
DRAWVERSION( 1, 1,RGB(0x00,0x00,0x00));
DRAWVERSION( 2, 2,RGB(0xFF,0x00,0xFF));
@ -1266,16 +1266,16 @@ void VideoRefreshScreen ( int bVideoModeFlags, UINT uDelayRefresh /* =0 */ )
ySrc -= 1;
}
FULLSCREEN_SCALE_TYPE xdest = g_win_fullscreen_offsetx;
FULLSCREEN_SCALE_TYPE ydest = g_win_fullscreen_offsety;
FULLSCREEN_SCALE_TYPE wdest = g_nViewportCX /** g_win_fullscreen_scale*/;
FULLSCREEN_SCALE_TYPE hdest = g_nViewportCY /** g_win_fullscreen_scale*/;
int xdest = GetFullScreenOffsetX();
int ydest = GetFullScreenOffsetY();
int wdest = g_nViewportCX;
int hdest = g_nViewportCY;
SetStretchBltMode(hFrameDC, COLORONCOLOR);
StretchBlt(
hFrameDC,
(int)xdest, (int)ydest,
(int)wdest, (int)hdest,
xdest, ydest,
wdest, hdest,
g_hDeviceDC,
xSrc, ySrc,
FRAMEBUFFER_BORDERLESS_W, FRAMEBUFFER_BORDERLESS_H,