mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-27 04:31:44 +00:00
cleanup: videotype -> g_eVideoType
This commit is contained in:
parent
93e901f012
commit
f440adffe2
@ -75,8 +75,10 @@ static int buttony = BUTTONY;
|
|||||||
static HRGN clipregion = (HRGN)0;
|
static HRGN clipregion = (HRGN)0;
|
||||||
HDC g_hFrameDC = (HDC)0;
|
HDC g_hFrameDC = (HDC)0;
|
||||||
static RECT framerect = {0,0,0,0};
|
static RECT framerect = {0,0,0,0};
|
||||||
HWND g_hFrameWindow = (HWND)0;
|
|
||||||
BOOL fullscreen = 0;
|
HWND g_hFrameWindow = (HWND)0;
|
||||||
|
BOOL g_bIsFullScreen = 0;
|
||||||
|
|
||||||
static BOOL helpquit = 0;
|
static BOOL helpquit = 0;
|
||||||
static BOOL g_bPaintingWindow = 0;
|
static BOOL g_bPaintingWindow = 0;
|
||||||
static HFONT smallfont = (HFONT)0;
|
static HFONT smallfont = (HFONT)0;
|
||||||
@ -86,8 +88,11 @@ static int viewportx = VIEWPORTX; // Default to Normal (non-FullScreen
|
|||||||
static int viewporty = VIEWPORTY; // Default to Normal (non-FullScreen) mode
|
static int viewporty = VIEWPORTY; // Default to Normal (non-FullScreen) mode
|
||||||
int g_nCharsetType = 0;
|
int g_nCharsetType = 0;
|
||||||
|
|
||||||
static LPDIRECTDRAW directdraw = (LPDIRECTDRAW)0;
|
// Direct Draw -- For Full Screen
|
||||||
static LPDIRECTDRAWSURFACE surface = (LPDIRECTDRAWSURFACE)0;
|
LPDIRECTDRAW g_pDD = (LPDIRECTDRAW)0;
|
||||||
|
LPDIRECTDRAWSURFACE g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
||||||
|
IDirectDrawPalette* g_pDDPal = (IDirectDrawPalette*)0;
|
||||||
|
|
||||||
|
|
||||||
static bool g_bShowingCursor = true;
|
static bool g_bShowingCursor = true;
|
||||||
static bool g_bLastCursorInAppleViewport = false;
|
static bool g_bLastCursorInAppleViewport = false;
|
||||||
@ -310,7 +315,7 @@ static void DrawCrosshairs (int x, int y) {
|
|||||||
|
|
||||||
// ERASE THE OLD CROSSHAIRS
|
// ERASE THE OLD CROSSHAIRS
|
||||||
if (lastx && lasty)
|
if (lastx && lasty)
|
||||||
if (fullscreen) {
|
if (g_bIsFullScreen) {
|
||||||
int loop = 4;
|
int loop = 4;
|
||||||
while (loop--) {
|
while (loop--) {
|
||||||
RECT rect = {0,0,5,5};
|
RECT rect = {0,0,5,5};
|
||||||
@ -378,7 +383,7 @@ static void DrawFrameWindow () {
|
|||||||
: GetDC(g_hFrameWindow));
|
: GetDC(g_hFrameWindow));
|
||||||
VideoRealizePalette(dc);
|
VideoRealizePalette(dc);
|
||||||
|
|
||||||
if (!fullscreen) {
|
if (!g_bIsFullScreen) {
|
||||||
|
|
||||||
// DRAW THE 3D BORDER AROUND THE EMULATED SCREEN
|
// DRAW THE 3D BORDER AROUND THE EMULATED SCREEN
|
||||||
Draw3dRect(dc,
|
Draw3dRect(dc,
|
||||||
@ -432,7 +437,7 @@ static void DrawStatusArea (HDC passdc, int drawflags)
|
|||||||
bool bP8Caps = KeybGetP8CapsStatus();
|
bool bP8Caps = KeybGetP8CapsStatus();
|
||||||
DiskGetLightStatus(&iDrive1Status,&iDrive2Status);
|
DiskGetLightStatus(&iDrive1Status,&iDrive2Status);
|
||||||
|
|
||||||
if (fullscreen)
|
if (g_bIsFullScreen)
|
||||||
{
|
{
|
||||||
SelectObject(dc,smallfont);
|
SelectObject(dc,smallfont);
|
||||||
SetBkMode(dc,OPAQUE);
|
SetBkMode(dc,OPAQUE);
|
||||||
@ -578,7 +583,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
if (fullscreen)
|
if (g_bIsFullScreen)
|
||||||
SetNormalMode();
|
SetNormalMode();
|
||||||
if (!IsIconic(window))
|
if (!IsIconic(window))
|
||||||
GetWindowRect(window,&framerect);
|
GetWindowRect(window,&framerect);
|
||||||
@ -635,7 +640,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
//MessageBox( NULL, filename, "DDE Exec", MB_OK );
|
//MessageBox( NULL, filename, "DDE Exec", MB_OK );
|
||||||
int error = DiskInsert(0,filename,0,0);
|
int error = DiskInsert(0,filename,0,0);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (!fullscreen)
|
if (!g_bIsFullScreen)
|
||||||
DrawButton((HDC)0,BTN_DRIVE1);
|
DrawButton((HDC)0,BTN_DRIVE1);
|
||||||
SetForegroundWindow(window);
|
SetForegroundWindow(window);
|
||||||
ProcessButtonClick(BTN_RUN);
|
ProcessButtonClick(BTN_RUN);
|
||||||
@ -685,7 +690,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
rect.bottom = rect.top+BUTTONCY;
|
rect.bottom = rect.top+BUTTONCY;
|
||||||
int error = DiskInsert(PtInRect(&rect,point) ? 1 : 0,filename,0,0);
|
int error = DiskInsert(PtInRect(&rect,point) ? 1 : 0,filename,0,0);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (!fullscreen)
|
if (!g_bIsFullScreen)
|
||||||
DrawButton((HDC)0,PtInRect(&rect,point) ? BTN_DRIVE2 : BTN_DRIVE1);
|
DrawButton((HDC)0,PtInRect(&rect,point) ? BTN_DRIVE2 : BTN_DRIVE1);
|
||||||
rect.top = buttony+BTN_DRIVE1*BUTTONCY+1;
|
rect.top = buttony+BTN_DRIVE1*BUTTONCY+1;
|
||||||
if (!PtInRect(&rect,point)) {
|
if (!PtInRect(&rect,point)) {
|
||||||
@ -736,7 +741,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
{
|
{
|
||||||
SetUsingCursor(0);
|
SetUsingCursor(0);
|
||||||
buttondown = wparam-VK_F1;
|
buttondown = wparam-VK_F1;
|
||||||
if (fullscreen && (buttonover != -1)) {
|
if (g_bIsFullScreen && (buttonover != -1)) {
|
||||||
if (buttonover != buttondown)
|
if (buttonover != buttondown)
|
||||||
EraseButton(buttonover);
|
EraseButton(buttonover);
|
||||||
buttonover = -1;
|
buttonover = -1;
|
||||||
@ -764,15 +769,15 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
else
|
else
|
||||||
if ( !g_bShiftKey ) // Backwards??? Drop Down Combo Box is in correct order
|
if ( !g_bShiftKey ) // Backwards??? Drop Down Combo Box is in correct order
|
||||||
{
|
{
|
||||||
videotype++;
|
g_eVideoType++;
|
||||||
if (videotype >= VT_NUM_MODES)
|
if (g_eVideoType >= VT_NUM_MODES)
|
||||||
videotype = 0;
|
g_eVideoType = 0;
|
||||||
}
|
}
|
||||||
else // Forwards
|
else // Forwards
|
||||||
{
|
{
|
||||||
if (videotype <= 0)
|
if (g_eVideoType <= 0)
|
||||||
videotype = VT_NUM_MODES;
|
g_eVideoType = VT_NUM_MODES;
|
||||||
videotype--;
|
g_eVideoType--;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoReinitialize();
|
VideoReinitialize();
|
||||||
@ -866,7 +871,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
if ((wparam >= VK_F1) && (wparam <= VK_F8) && (buttondown == (int)wparam-VK_F1))
|
if ((wparam >= VK_F1) && (wparam <= VK_F8) && (buttondown == (int)wparam-VK_F1))
|
||||||
{
|
{
|
||||||
buttondown = -1;
|
buttondown = -1;
|
||||||
if (fullscreen)
|
if (g_bIsFullScreen)
|
||||||
EraseButton(wparam-VK_F1);
|
EraseButton(wparam-VK_F1);
|
||||||
else
|
else
|
||||||
DrawButton((HDC)0,wparam-VK_F1);
|
DrawButton((HDC)0,wparam-VK_F1);
|
||||||
@ -942,7 +947,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
if (buttondown == buttonactive) {
|
if (buttondown == buttonactive) {
|
||||||
buttondown = -1;
|
buttondown = -1;
|
||||||
if (fullscreen)
|
if (g_bIsFullScreen)
|
||||||
EraseButton(buttonactive);
|
EraseButton(buttonactive);
|
||||||
else
|
else
|
||||||
DrawButton((HDC)0,buttonactive);
|
DrawButton((HDC)0,buttonactive);
|
||||||
@ -976,7 +981,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
DrawButton((HDC)0,buttonactive);
|
DrawButton((HDC)0,buttonactive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fullscreen && (newover != buttonover) && (buttondown == -1)) {
|
else if (g_bIsFullScreen && (newover != buttonover) && (buttondown == -1)) {
|
||||||
if (buttonover != -1)
|
if (buttonover != -1)
|
||||||
EraseButton(buttonover);
|
EraseButton(buttonover);
|
||||||
buttonover = newover;
|
buttonover = newover;
|
||||||
@ -1145,7 +1150,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
switch (wparam & 0xFFF0) {
|
switch (wparam & 0xFFF0) {
|
||||||
case SC_KEYMENU:
|
case SC_KEYMENU:
|
||||||
if (fullscreen && g_bAppActive)
|
if (g_bIsFullScreen && g_bAppActive)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case SC_MINIMIZE:
|
case SC_MINIMIZE:
|
||||||
@ -1291,7 +1296,7 @@ void ProcessButtonClick (int button) {
|
|||||||
case BTN_DRIVE1:
|
case BTN_DRIVE1:
|
||||||
case BTN_DRIVE2:
|
case BTN_DRIVE2:
|
||||||
DiskSelect(button-BTN_DRIVE1);
|
DiskSelect(button-BTN_DRIVE1);
|
||||||
if (!fullscreen)
|
if (!g_bIsFullScreen)
|
||||||
DrawButton((HDC)0,button);
|
DrawButton((HDC)0,button);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1300,7 +1305,7 @@ void ProcessButtonClick (int button) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BTN_FULLSCR:
|
case BTN_FULLSCR:
|
||||||
if (fullscreen)
|
if (g_bIsFullScreen)
|
||||||
SetNormalMode();
|
SetNormalMode();
|
||||||
else
|
else
|
||||||
SetFullScreenMode();
|
SetFullScreenMode();
|
||||||
@ -1311,7 +1316,7 @@ void ProcessButtonClick (int button) {
|
|||||||
{
|
{
|
||||||
ResetMachineState();
|
ResetMachineState();
|
||||||
}
|
}
|
||||||
|
else // bugfix: can't enter debugger into machine is actually running
|
||||||
if (g_nAppMode == MODE_STEPPING)
|
if (g_nAppMode == MODE_STEPPING)
|
||||||
{
|
{
|
||||||
DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
|
DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
|
||||||
@ -1451,7 +1456,7 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
|
void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
|
||||||
if (fullscreen)
|
if (g_bIsFullScreen)
|
||||||
return;
|
return;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
msg.hwnd = g_hFrameWindow;
|
msg.hwnd = g_hFrameWindow;
|
||||||
@ -1483,53 +1488,59 @@ void ResetMachineState () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void SetFullScreenMode () {
|
void SetFullScreenMode ()
|
||||||
fullscreen = 1;
|
{
|
||||||
buttonover = -1;
|
g_bIsFullScreen = true;
|
||||||
buttonx = FSBUTTONX;
|
buttonover = -1;
|
||||||
buttony = FSBUTTONY;
|
buttonx = FSBUTTONX;
|
||||||
viewportx = FSVIEWPORTX;
|
buttony = FSBUTTONY;
|
||||||
viewporty = FSVIEWPORTY;
|
viewportx = FSVIEWPORTX;
|
||||||
GetWindowRect(g_hFrameWindow,&framerect);
|
viewporty = FSVIEWPORTY;
|
||||||
SetWindowLong(g_hFrameWindow,GWL_STYLE,WS_POPUP | WS_SYSMENU | WS_VISIBLE);
|
GetWindowRect(g_hFrameWindow,&framerect);
|
||||||
DDSURFACEDESC ddsd;
|
SetWindowLong(g_hFrameWindow,GWL_STYLE,WS_POPUP | WS_SYSMENU | WS_VISIBLE);
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS;
|
DDSURFACEDESC ddsd;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
if (DirectDrawCreate(NULL,&directdraw,NULL) != DD_OK ||
|
ddsd.dwFlags = DDSD_CAPS;
|
||||||
directdraw->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK ||
|
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
directdraw->SetDisplayMode(640,480,8) != DD_OK ||
|
if (DirectDrawCreate(NULL,&g_pDD,NULL) != DD_OK ||
|
||||||
directdraw->CreateSurface(&ddsd,&surface,NULL) != DD_OK) {
|
g_pDD->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK ||
|
||||||
SetNormalMode();
|
g_pDD->SetDisplayMode(640,480,8) != DD_OK ||
|
||||||
return;
|
g_pDD->CreateSurface(&ddsd,&g_pDDPrimarySurface,NULL) != DD_OK)
|
||||||
}
|
{
|
||||||
InvalidateRect(g_hFrameWindow,NULL,1);
|
g_pDDPrimarySurface = NULL;
|
||||||
|
SetNormalMode();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InvalidateRect(g_hFrameWindow,NULL,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void SetNormalMode () {
|
void SetNormalMode ()
|
||||||
fullscreen = 0;
|
{
|
||||||
buttonover = -1;
|
g_bIsFullScreen = false;
|
||||||
buttonx = BUTTONX;
|
buttonover = -1;
|
||||||
buttony = BUTTONY;
|
buttonx = BUTTONX;
|
||||||
viewportx = VIEWPORTX;
|
buttony = BUTTONY;
|
||||||
viewporty = VIEWPORTY;
|
viewportx = VIEWPORTX;
|
||||||
directdraw->RestoreDisplayMode();
|
viewporty = VIEWPORTY;
|
||||||
directdraw->SetCooperativeLevel(NULL,DDSCL_NORMAL);
|
g_pDD->RestoreDisplayMode();
|
||||||
SetWindowLong(g_hFrameWindow,GWL_STYLE,
|
g_pDD->SetCooperativeLevel(NULL,DDSCL_NORMAL);
|
||||||
|
SetWindowLong(g_hFrameWindow,GWL_STYLE,
|
||||||
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
|
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
|
||||||
WS_VISIBLE);
|
WS_VISIBLE);
|
||||||
SetWindowPos(g_hFrameWindow,0,framerect.left,
|
SetWindowPos(g_hFrameWindow,0,framerect.left,
|
||||||
framerect.top,
|
framerect.top,
|
||||||
framerect.right - framerect.left,
|
framerect.right - framerect.left,
|
||||||
framerect.bottom - framerect.top,
|
framerect.bottom - framerect.top,
|
||||||
SWP_NOZORDER | SWP_FRAMECHANGED);
|
SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
if (surface) {
|
if (g_pDDPrimarySurface)
|
||||||
surface->Release();
|
{
|
||||||
surface = (LPDIRECTDRAWSURFACE)0;
|
g_pDDPrimarySurface->Release();
|
||||||
}
|
g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
||||||
directdraw->Release();
|
}
|
||||||
directdraw = (LPDIRECTDRAW)0;
|
g_pDD->Release();
|
||||||
|
g_pDD = (LPDIRECTDRAW)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@ -1647,9 +1658,11 @@ HDC FrameGetDC () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
HDC FrameGetVideoDC (LPBYTE *addr, LONG *pitch)
|
HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_)
|
||||||
{
|
{
|
||||||
if (fullscreen && g_bAppActive && !g_bPaintingWindow)
|
// ASSERT( pAddr_ );
|
||||||
|
// ASSERT( pPitch_ );
|
||||||
|
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
|
||||||
{
|
{
|
||||||
RECT rect = { FSVIEWPORTX,
|
RECT rect = { FSVIEWPORTX,
|
||||||
FSVIEWPORTY,
|
FSVIEWPORTY,
|
||||||
@ -1658,17 +1671,20 @@ HDC FrameGetVideoDC (LPBYTE *addr, LONG *pitch)
|
|||||||
DDSURFACEDESC surfacedesc;
|
DDSURFACEDESC surfacedesc;
|
||||||
surfacedesc.dwSize = sizeof(surfacedesc);
|
surfacedesc.dwSize = sizeof(surfacedesc);
|
||||||
// TC: Use DDLOCK_WAIT - see Bug #13425
|
// TC: Use DDLOCK_WAIT - see Bug #13425
|
||||||
if (surface->Lock(&rect,&surfacedesc,DDLOCK_WAIT,NULL) == DDERR_SURFACELOST)
|
if (g_pDDPrimarySurface->Lock(&rect,&surfacedesc,DDLOCK_WAIT,NULL) == DDERR_SURFACELOST)
|
||||||
{
|
{
|
||||||
surface->Restore();
|
g_pDDPrimarySurface->Restore();
|
||||||
surface->Lock(&rect,&surfacedesc,DDLOCK_WAIT,NULL);
|
g_pDDPrimarySurface->Lock(&rect,&surfacedesc,DDLOCK_WAIT,NULL);
|
||||||
}
|
}
|
||||||
*addr = (LPBYTE)surfacedesc.lpSurface+(VIEWPORTCY-1)*surfacedesc.lPitch;
|
*pAddr_ = (LPBYTE)surfacedesc.lpSurface+(VIEWPORTCY-1)*surfacedesc.lPitch;
|
||||||
*pitch = -surfacedesc.lPitch;
|
*pPitch_ = -surfacedesc.lPitch;
|
||||||
|
|
||||||
return (HDC)0;
|
return (HDC)0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*pAddr_ = g_pFramebufferbits;
|
||||||
|
*pPitch_ = FRAMEBUFFER_W;
|
||||||
return FrameGetDC();
|
return FrameGetDC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1709,22 +1725,22 @@ void FrameReleaseDC () {
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void FrameReleaseVideoDC () {
|
void FrameReleaseVideoDC () {
|
||||||
if (fullscreen && g_bAppActive && !g_bPaintingWindow) {
|
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow) {
|
||||||
|
|
||||||
// THIS IS CORRECT ACCORDING TO THE DIRECTDRAW DOCS
|
// THIS IS CORRECT ACCORDING TO THE DIRECTDRAW DOCS
|
||||||
RECT rect = {FSVIEWPORTX,
|
RECT rect = {FSVIEWPORTX,
|
||||||
FSVIEWPORTY,
|
FSVIEWPORTY,
|
||||||
FSVIEWPORTX+VIEWPORTCX,
|
FSVIEWPORTX+VIEWPORTCX,
|
||||||
FSVIEWPORTY+VIEWPORTCY};
|
FSVIEWPORTY+VIEWPORTCY};
|
||||||
surface->Unlock(&rect);
|
g_pDDPrimarySurface->Unlock(&rect);
|
||||||
|
|
||||||
// BUT THIS SEEMS TO BE WORKING
|
// BUT THIS SEEMS TO BE WORKING
|
||||||
surface->Unlock(NULL);
|
g_pDDPrimarySurface->Unlock(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
// TODO: FIXME: Util_TestFileExists()
|
||||||
static bool FileExists(string strFilename)
|
static bool FileExists(string strFilename)
|
||||||
{
|
{
|
||||||
struct stat stFileInfo;
|
struct stat stFileInfo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user