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; int nViewportCX, nViewportCY;
GetViewportCXCY(nViewportCX, nViewportCY); GetViewportCXCY(nViewportCX, nViewportCY);
FULLSCREEN_SCALE_TYPE xdest = g_win_fullscreen_offsetx; int xdest = GetFullScreenOffsetX();
FULLSCREEN_SCALE_TYPE ydest = g_win_fullscreen_offsety; int ydest = GetFullScreenOffsetY();
FULLSCREEN_SCALE_TYPE wdest = nViewportCX; int wdest = nViewportCX;
FULLSCREEN_SCALE_TYPE hdest = nViewportCY; int hdest = nViewportCY;
BOOL bRes = StretchBlt( BOOL bRes = StretchBlt(
FrameGetDC(), // HDC hdcDest, FrameGetDC(), // HDC hdcDest,
(int)xdest, (int)(ydest), // int nXOriginDest, int nYOriginDest, xdest, ydest, // int nXOriginDest, int nYOriginDest,
(int)wdest, (int)(hdest), // int nWidthDest, int nHeightDest, wdest, hdest, // int nWidthDest, int nHeightDest,
GetDebuggerMemDC(), // HDC hdcSrc, GetDebuggerMemDC(), // HDC hdcSrc,
0, 0, // int nXOriginSrc, int nYOriginSrc, 0, 0, // int nXOriginSrc, int nYOriginSrc,
FRAMEBUFFER_BORDERLESS_W, FRAMEBUFFER_BORDERLESS_H, // int nWidthSrc, int nHeightSrc, 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; bool g_bFreshReset = false;
static bool g_bFullScreen32Bit = true; 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 __________________________________________________________________________________ // __ Prototypes __________________________________________________________________________________
static void DrawCrosshairs (int x, int y); static void DrawCrosshairs (int x, int y);
static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen); 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--) { while (loop--) {
RECT rect = {0,0,5,5}; RECT rect = {0,0,5,5};
switch (loop) { switch (loop) {
case 0: OffsetRect(&rect, g_win_fullscreen_offsetx+lastx-2, g_win_fullscreen_offsety+viewporty-5); break; case 0: OffsetRect(&rect, GetFullScreenOffsetX()+lastx-2, GetFullScreenOffsetY()+viewporty-5); break;
case 1: OffsetRect(&rect, g_win_fullscreen_offsetx+lastx-2, g_win_fullscreen_offsety+viewporty+g_nViewportCY); break; case 1: OffsetRect(&rect, GetFullScreenOffsetX()+lastx-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY); break;
case 2: OffsetRect(&rect, g_win_fullscreen_offsetx+viewportx-5, g_win_fullscreen_offsety+lasty-2); break; case 2: OffsetRect(&rect, GetFullScreenOffsetX()+viewportx-5, GetFullScreenOffsetY()+lasty-2); break;
case 3: OffsetRect(&rect, g_win_fullscreen_offsetx+viewportx+g_nViewportCX, g_win_fullscreen_offsety+lasty-2); break; case 3: OffsetRect(&rect, GetFullScreenOffsetX()+viewportx+g_nViewportCX, GetFullScreenOffsetY()+lasty-2); break;
} }
FillRect(dc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH)); FillRect(dc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH));
} }
@ -521,14 +534,14 @@ static void DrawCrosshairs (int x, int y) {
SelectObject(dc,GetStockObject(WHITE_PEN)); SelectObject(dc,GetStockObject(WHITE_PEN));
else else
SelectObject(dc,GetStockObject(BLACK_PEN)); SelectObject(dc,GetStockObject(BLACK_PEN));
LINE(g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty-5, LINE(GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty-5,
g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty); GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty);
LINE(g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty+g_nViewportCY+4, LINE(GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY+4,
g_win_fullscreen_offsetx+x+loop-2, g_win_fullscreen_offsety+viewporty+g_nViewportCY-1); GetFullScreenOffsetX()+x+loop-2, GetFullScreenOffsetY()+viewporty+g_nViewportCY-1);
LINE(g_win_fullscreen_offsetx+viewportx-5, g_win_fullscreen_offsety+y+loop-2, LINE(GetFullScreenOffsetX()+viewportx-5, GetFullScreenOffsetY()+y+loop-2,
g_win_fullscreen_offsetx+viewportx, g_win_fullscreen_offsety+y+loop-2); GetFullScreenOffsetX()+viewportx, GetFullScreenOffsetY()+y+loop-2);
LINE(g_win_fullscreen_offsetx+viewportx+g_nViewportCX+4, g_win_fullscreen_offsety+y+loop-2, LINE(GetFullScreenOffsetX()+viewportx+g_nViewportCX+4, GetFullScreenOffsetY()+y+loop-2,
g_win_fullscreen_offsetx+viewportx+g_nViewportCX-1, g_win_fullscreen_offsety+y+loop-2); GetFullScreenOffsetX()+viewportx+g_nViewportCX-1, GetFullScreenOffsetY()+y+loop-2);
} }
} }
else else
@ -2088,13 +2101,15 @@ void SetFullScreen32Bit(bool b32Bit)
g_bFullScreen32Bit = b32Bit; g_bFullScreen32Bit = b32Bit;
} }
// TODO: Put this stuff in a header / somewhere sensible int GetFullScreenOffsetX(void)
RECT g_main_window_saved_rect; {
int g_main_window_saved_style; return g_win_fullscreen_offsetx;
int g_main_window_saved_exstyle; }
FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale = 1;
int g_win_fullscreen_offsetx = 0; int GetFullScreenOffsetY(void)
int g_win_fullscreen_offsety = 0; {
return g_win_fullscreen_offsety;
}
void SetFullScreenMode () void SetFullScreenMode ()
{ {
@ -2144,8 +2159,8 @@ void SetFullScreenMode ()
// FS: desktop // FS: desktop
SetViewportScale(g_win_fullscreen_scale, true); SetViewportScale(g_win_fullscreen_scale, true);
buttonx = g_win_fullscreen_offsetx + g_nViewportCX + VIEWPORTX*2; buttonx = GetFullScreenOffsetX() + g_nViewportCX + VIEWPORTX*2;
buttony = g_win_fullscreen_offsety; buttony = GetFullScreenOffsetY();
viewportx = VIEWPORTX; viewportx = VIEWPORTX;
viewporty = VIEWPORTY; viewporty = VIEWPORTY;
#endif #endif

View File

@ -52,16 +52,6 @@
extern int g_nCharsetType; 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 // Prototypes
void CtrlReset(); void CtrlReset();
@ -89,3 +79,5 @@ extern int g_win_fullscreen_offsety;
WPARAM wparam, WPARAM wparam,
LPARAM lparam ); LPARAM lparam );
int GetFullScreenOffsetX(void);
int GetFullScreenOffsetY(void);

View File

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