Merge remote-tracking branch 'upstream/master'
# Conflicts: # source/Interface.h
This commit is contained in:
commit
577a997003
30 changed files with 691 additions and 699 deletions
|
@ -96,7 +96,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Speech.h"
|
||||
#endif
|
||||
#include "SynchronousEventManager.h"
|
||||
#include "Video.h"
|
||||
#include "NTSC.h"
|
||||
#include "Log.h"
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
|||
lpCmdLine = GetCurrArg(lpNextArg);
|
||||
lpNextArg = GetNextArg(lpNextArg);
|
||||
|
||||
if (!ReadVideoRomFile(lpCmdLine))
|
||||
if (!GetVideo().ReadVideoRomFile(lpCmdLine))
|
||||
{
|
||||
std::string msg = "Failed to load video rom (not found or not exactly 2/4/8/16KiB)\n";
|
||||
LogFileOutput("%s", msg.c_str());
|
||||
|
@ -314,12 +314,12 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
|||
}
|
||||
else
|
||||
{
|
||||
SetVideoRomRockerSwitch(true); // Use PAL char set
|
||||
GetVideo().SetVideoRomRockerSwitch(true); // Use PAL char set
|
||||
}
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-printscreen") == 0) // Turn on display of the last filename print screen was saved to
|
||||
{
|
||||
g_bDisplayPrintScreenFileName = true;
|
||||
GetVideo().SetDisplayPrintScreenFileName(true);
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-no-printscreen-key") == 0) // Don't try to capture PrintScreen key GH#469
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
|||
}
|
||||
else if (strcmp(lpCmdLine, "-no-printscreen-dlg") == 0) // Turn off the PrintScreen warning message dialog (if PrintScreen key can't be grabbed)
|
||||
{
|
||||
g_bShowPrintScreenWarningDialog = false;
|
||||
GetVideo().SetShowPrintScreenWarningDialog(false);
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-no-hook-system-key") == 0) // Don't hook the System keys (eg. Left-ALT+ESC/SPACE/TAB) GH#556
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "RgbMonitor.h"
|
||||
#include "Harddisk.h"
|
||||
#include "Disk.h"
|
||||
#include "Video.h"
|
||||
#include "Common.h"
|
||||
#include "Card.h"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "../CPU.h"
|
||||
#include "../DiskImage.h" // Disk_Status_e
|
||||
#include "../Harddisk.h" // HD_CardIsEnabled()
|
||||
#include "../Video.h" // VideoRefreshRate_e, GetVideoRefreshRate()
|
||||
#include "../Interface.h" // VideoRefreshRate_e, GetVideoRefreshRate()
|
||||
|
||||
class CConfigNeedingRestart
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ public:
|
|||
m_Apple2Type( GetApple2Type() ),
|
||||
m_CpuType( GetMainCpu() ),
|
||||
m_uSaveLoadStateMsg(0),
|
||||
m_videoRefreshRate( GetVideoRefreshRate() )
|
||||
m_videoRefreshRate( GetVideo().GetVideoRefreshRate() )
|
||||
{
|
||||
m_bEnableHDD = HD_CardIsEnabled();
|
||||
m_bEnableTheFreezesF8Rom = bEnableTheFreezesF8Rom;
|
||||
|
|
|
@ -22,8 +22,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "PageAdvanced.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "PropertySheet.h"
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../ParallelPrinter.h"
|
||||
|
|
|
@ -24,9 +24,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "StdAfx.h"
|
||||
|
||||
#include "PageConfig.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "PropertySheet.h"
|
||||
|
||||
#include "../Interface.h"
|
||||
#include "../Windows/AppleWin.h"
|
||||
#include "../Windows/WinFrame.h"
|
||||
#include "../Registry.h"
|
||||
|
@ -117,7 +116,7 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
|
|||
break;
|
||||
|
||||
case IDC_MONOCOLOR:
|
||||
VideoChooseMonochromeColor();
|
||||
GetVideo().ChooseMonochromeColor();
|
||||
break;
|
||||
|
||||
case IDC_CHECK_CONFIRM_REBOOT:
|
||||
|
@ -201,12 +200,12 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
|
|||
|
||||
CheckDlgButton(hWnd, IDC_CHECK_CONFIRM_REBOOT, GetFrame().g_bConfirmReboot ? BST_CHECKED : BST_UNCHECKED );
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE, g_aVideoChoices, GetVideoType());
|
||||
CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, IsVideoStyle(VS_HALF_SCANLINES) ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE, GetVideo().GetVideoChoices(), GetVideo().GetVideoType());
|
||||
CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, GetVideo().IsVideoStyle(VS_HALF_SCANLINES) ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS, GetFullScreenShowSubunitStatus() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideoType() == VT_COLOR_IDEALIZED) ? TRUE : FALSE);
|
||||
CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, GetVideo().IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideo().GetVideoType() == VT_COLOR_IDEALIZED) ? TRUE : FALSE);
|
||||
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
{
|
||||
|
@ -219,7 +218,7 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
|
|||
EnableWindow(GetDlgItem(hWnd, IDC_SERIALPORT), FALSE);
|
||||
}
|
||||
|
||||
CheckDlgButton(hWnd, IDC_CHECK_50HZ_VIDEO, (GetVideoRefreshRate() == VR_50HZ) ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_CHECK_50HZ_VIDEO, (GetVideo().GetVideoRefreshRate() == VR_50HZ) ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,TBM_SETRANGE,1,MAKELONG(0,40));
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,TBM_SETPAGESIZE,0,5);
|
||||
|
@ -275,36 +274,36 @@ void CPageConfig::DlgOK(HWND hWnd)
|
|||
bool bVideoReinit = false;
|
||||
|
||||
const VideoType_e newVideoType = (VideoType_e) SendDlgItemMessage(hWnd, IDC_VIDEOTYPE, CB_GETCURSEL, 0, 0);
|
||||
if (GetVideoType() != newVideoType)
|
||||
if (GetVideo().GetVideoType() != newVideoType)
|
||||
{
|
||||
SetVideoType(newVideoType);
|
||||
GetVideo().SetVideoType(newVideoType);
|
||||
bVideoReinit = true;
|
||||
}
|
||||
|
||||
const bool newHalfScanLines = IsDlgButtonChecked(hWnd, IDC_CHECK_HALF_SCAN_LINES) != 0;
|
||||
const bool currentHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const bool currentHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
|
||||
if (currentHalfScanLines != newHalfScanLines)
|
||||
{
|
||||
if (newHalfScanLines)
|
||||
SetVideoStyle( (VideoStyle_e) (GetVideoStyle() | VS_HALF_SCANLINES) );
|
||||
GetVideo().SetVideoStyle( (VideoStyle_e) (GetVideo().GetVideoStyle() | VS_HALF_SCANLINES) );
|
||||
else
|
||||
SetVideoStyle( (VideoStyle_e) (GetVideoStyle() & ~VS_HALF_SCANLINES) );
|
||||
GetVideo().SetVideoStyle( (VideoStyle_e) (GetVideo().GetVideoStyle() & ~VS_HALF_SCANLINES) );
|
||||
bVideoReinit = true;
|
||||
}
|
||||
|
||||
const bool newVerticalBlend = IsDlgButtonChecked(hWnd, IDC_CHECK_VERTICAL_BLEND) != 0;
|
||||
const bool currentVerticalBlend = IsVideoStyle(VS_COLOR_VERTICAL_BLEND);
|
||||
const bool currentVerticalBlend = GetVideo().IsVideoStyle(VS_COLOR_VERTICAL_BLEND);
|
||||
if (currentVerticalBlend != newVerticalBlend)
|
||||
{
|
||||
if (newVerticalBlend)
|
||||
SetVideoStyle( (VideoStyle_e) (GetVideoStyle() | VS_COLOR_VERTICAL_BLEND) );
|
||||
GetVideo().SetVideoStyle( (VideoStyle_e) (GetVideo().GetVideoStyle() | VS_COLOR_VERTICAL_BLEND) );
|
||||
else
|
||||
SetVideoStyle( (VideoStyle_e) (GetVideoStyle() & ~VS_COLOR_VERTICAL_BLEND) );
|
||||
GetVideo().SetVideoStyle( (VideoStyle_e) (GetVideo().GetVideoStyle() & ~VS_COLOR_VERTICAL_BLEND) );
|
||||
bVideoReinit = true;
|
||||
}
|
||||
|
||||
const bool isNewVideoRate50Hz = IsDlgButtonChecked(hWnd, IDC_CHECK_50HZ_VIDEO) != 0;
|
||||
const bool isCurrentVideoRate50Hz = GetVideoRefreshRate() == VR_50HZ;
|
||||
const bool isCurrentVideoRate50Hz = GetVideo().GetVideoRefreshRate() == VR_50HZ;
|
||||
if (isCurrentVideoRate50Hz != isNewVideoRate50Hz)
|
||||
{
|
||||
m_PropertySheetHelper.GetConfigNew().m_videoRefreshRate = isNewVideoRate50Hz ? VR_50HZ : VR_60HZ;
|
||||
|
@ -312,11 +311,11 @@ void CPageConfig::DlgOK(HWND hWnd)
|
|||
|
||||
if (bVideoReinit)
|
||||
{
|
||||
Config_Save_Video();
|
||||
GetVideo().Config_Save_Video();
|
||||
|
||||
GetFrame().FrameRefreshStatus(DRAW_TITLE, false);
|
||||
|
||||
VideoReinitialize();
|
||||
GetVideo().VideoReinitialize();
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
{
|
||||
GetFrame().VideoRedrawScreen();
|
||||
|
|
|
@ -24,9 +24,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "StdAfx.h"
|
||||
|
||||
#include "PageDisk.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "PropertySheet.h"
|
||||
|
||||
#include "../Interface.h"
|
||||
#include "../Windows/AppleWin.h"
|
||||
#include "../CardManager.h"
|
||||
#include "../Disk.h" // Drive_e, Disk_Status_e
|
||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "StdAfx.h"
|
||||
|
||||
#include "PageInput.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "PropertySheet.h"
|
||||
|
||||
#include "../SaveState_Structs_common.h"
|
||||
#include "../Common.h"
|
||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "StdAfx.h"
|
||||
|
||||
#include "PageSound.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "PropertySheet.h"
|
||||
|
||||
#include "../SaveState_Structs_common.h"
|
||||
#include "../Common.h"
|
||||
|
|
|
@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "PropertySheet.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "IPropertySheet.h"
|
||||
|
||||
#include "../Windows/AppleWin.h" // g_nAppMode, g_uScrollLockToggle, sg_PropertySheet
|
||||
#include "../CardManager.h"
|
||||
|
@ -33,7 +33,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "../Log.h"
|
||||
#include "../Registry.h"
|
||||
#include "../SaveState.h"
|
||||
#include "../Interface.h"
|
||||
|
||||
/*
|
||||
Config causing AfterClose msgs:
|
||||
|
@ -388,7 +387,7 @@ void CPropertySheetHelper::SaveCurrentConfig(void)
|
|||
m_ConfigOld.m_Slot[SLOT5] = GetCardMgr().QuerySlot(SLOT5);
|
||||
m_ConfigOld.m_bEnableHDD = HD_CardIsEnabled();
|
||||
m_ConfigOld.m_bEnableTheFreezesF8Rom = GetPropertySheet().GetTheFreezesF8Rom();
|
||||
m_ConfigOld.m_videoRefreshRate = GetVideoRefreshRate();
|
||||
m_ConfigOld.m_videoRefreshRate = GetVideo().GetVideoRefreshRate();
|
||||
|
||||
// Reset flags each time:
|
||||
m_ConfigOld.m_uSaveLoadStateMsg = 0;
|
||||
|
|
|
@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Core.h"
|
||||
#include "CardManager.h"
|
||||
#include "CPU.h"
|
||||
#include "Video.h"
|
||||
#include "Interface.h"
|
||||
#include "Log.h"
|
||||
#include "Memory.h"
|
||||
#include "Mockingboard.h"
|
||||
|
@ -194,7 +194,7 @@ CardManager& GetCardMgr(void)
|
|||
|
||||
double Get6502BaseClock(void)
|
||||
{
|
||||
return (GetVideoRefreshRate() == VR_50HZ) ? CLK_6502_PAL : CLK_6502_NTSC;
|
||||
return (GetVideo().GetVideoRefreshRate() == VR_50HZ) ? CLK_6502_PAL : CLK_6502_NTSC;
|
||||
}
|
||||
|
||||
void SetCurrentCLK6502(void)
|
||||
|
@ -202,11 +202,11 @@ void SetCurrentCLK6502(void)
|
|||
static DWORD dwPrevSpeed = (DWORD) -1;
|
||||
static VideoRefreshRate_e prevVideoRefreshRate = VR_NONE;
|
||||
|
||||
if (dwPrevSpeed == g_dwSpeed && GetVideoRefreshRate() == prevVideoRefreshRate)
|
||||
if (dwPrevSpeed == g_dwSpeed && GetVideo().GetVideoRefreshRate() == prevVideoRefreshRate)
|
||||
return;
|
||||
|
||||
dwPrevSpeed = g_dwSpeed;
|
||||
prevVideoRefreshRate = GetVideoRefreshRate();
|
||||
prevVideoRefreshRate = GetVideo().GetVideoRefreshRate();
|
||||
|
||||
// SPEED_MIN = 0 = 0.50 MHz
|
||||
// SPEED_NORMAL = 10 = 1.00 MHz
|
||||
|
|
|
@ -46,7 +46,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "../SoundCore.h" // SoundCore_SetFade()
|
||||
#include "../Windows/WinVideo.h"
|
||||
#include "../Windows/WinFrame.h"
|
||||
#include "../Video.h"
|
||||
|
||||
// #define DEBUG_COMMAND_HELP 1
|
||||
// #define DEBUG_ASM_HASH 1
|
||||
|
@ -4942,7 +4941,7 @@ size_t Util_GetTextScreen ( char* &pText_ )
|
|||
g_nTextScreen = 0;
|
||||
memset( pBeg, 0, sizeof( g_aTextScreen ) );
|
||||
|
||||
unsigned int uBank2 = VideoGetSWPAGE2() ? 1 : 0;
|
||||
unsigned int uBank2 = GetVideo().VideoGetSWPAGE2() ? 1 : 0;
|
||||
LPBYTE g_pTextBank1 = MemGetAuxPtr (0x400 << uBank2);
|
||||
LPBYTE g_pTextBank0 = MemGetMainPtr(0x400 << uBank2);
|
||||
|
||||
|
@ -4955,7 +4954,7 @@ size_t Util_GetTextScreen ( char* &pText_ )
|
|||
{
|
||||
char c; // TODO: FormatCharTxtCtrl() ?
|
||||
|
||||
if ( VideoGetSW80COL() )
|
||||
if ( GetVideo().VideoGetSW80COL() )
|
||||
{ // AUX
|
||||
c = g_pTextBank1[ nAddressStart ] & 0x7F;
|
||||
c = RemapChar(c);
|
||||
|
@ -5432,7 +5431,7 @@ Update_t CmdNTSC (int nArgs)
|
|||
}
|
||||
};
|
||||
|
||||
bool bColorTV = (g_eVideoType == VT_COLOR_TV);
|
||||
bool bColorTV = (GetVideo().GetVideoType() == VT_COLOR_TV);
|
||||
|
||||
uint32_t* pChromaTable = NTSC_VideoGetChromaTable( false, bColorTV );
|
||||
char aStatusText[ CONSOLE_WIDTH*2 ] = "Loaded";
|
||||
|
@ -5467,7 +5466,7 @@ Update_t CmdNTSC (int nArgs)
|
|||
|
||||
// Write BMP header
|
||||
WinBmpHeader_t bmp, *pBmp = &bmp;
|
||||
Video_SetBitmapHeader( pBmp, 64, 256, 32 );
|
||||
GetVideo().Video_SetBitmapHeader( pBmp, 64, 256, 32 );
|
||||
fwrite( pBmp, sizeof( WinBmpHeader_t ), 1, pFile );
|
||||
}
|
||||
else
|
||||
|
@ -5637,7 +5636,7 @@ int CmdTextSave (int nArgs)
|
|||
g_sMemoryLoadSaveFileName = g_aArgs[ 1 ].sArg;
|
||||
else
|
||||
{
|
||||
if( VideoGetSW80COL() )
|
||||
if( GetVideo().VideoGetSW80COL() )
|
||||
g_sMemoryLoadSaveFileName = "AppleWin_Text80.txt";
|
||||
else
|
||||
g_sMemoryLoadSaveFileName = "AppleWin_Text40.txt";
|
||||
|
@ -6886,8 +6885,8 @@ Update_t _ViewOutput( ViewVideoPage_t iPage, int bVideoModeFlags )
|
|||
switch( iPage )
|
||||
{
|
||||
case VIEW_PAGE_X:
|
||||
bVideoModeFlags |= !VideoGetSWPAGE2() ? 0 : VF_PAGE2;
|
||||
bVideoModeFlags |= !VideoGetSWMIXED() ? 0 : VF_MIXED;
|
||||
bVideoModeFlags |= !GetVideo().VideoGetSWPAGE2() ? 0 : VF_PAGE2;
|
||||
bVideoModeFlags |= !GetVideo().VideoGetSWMIXED() ? 0 : VF_MIXED;
|
||||
break; // Page Current & current MIXED state
|
||||
case VIEW_PAGE_1: bVideoModeFlags |= 0; break; // Page 1
|
||||
case VIEW_PAGE_2: bVideoModeFlags |= VF_PAGE2; break; // Page 2
|
||||
|
@ -6897,7 +6896,7 @@ Update_t _ViewOutput( ViewVideoPage_t iPage, int bVideoModeFlags )
|
|||
}
|
||||
|
||||
DebugVideoMode::Instance().Set(bVideoModeFlags);
|
||||
VideoRefreshScreen( bVideoModeFlags, true );
|
||||
GetVideo().VideoRefreshScreen( bVideoModeFlags, true );
|
||||
return UPDATE_NOTHING; // intentional
|
||||
}
|
||||
|
||||
|
@ -7450,7 +7449,7 @@ Update_t CmdWindowViewOutput (int nArgs)
|
|||
{
|
||||
GetFrame().VideoRedrawScreen();
|
||||
|
||||
DebugVideoMode::Instance().Set(g_uVideoMode);
|
||||
DebugVideoMode::Instance().Set( GetVideo().GetVideoMode() );
|
||||
|
||||
return UPDATE_NOTHING; // intentional
|
||||
}
|
||||
|
@ -9584,7 +9583,7 @@ void DebugDisplay( BOOL bInitDisasm/*=FALSE*/ )
|
|||
{
|
||||
uint32_t mode = 0;
|
||||
DebugVideoMode::Instance().Get(&mode);
|
||||
VideoRefreshScreen(mode, true);
|
||||
GetVideo().VideoRefreshScreen(mode, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "../Memory.h"
|
||||
#include "../Mockingboard.h"
|
||||
#include "../NTSC.h"
|
||||
#include "../Video.h"
|
||||
|
||||
// NEW UI debugging - force display ALL meta-info (regs, stack, bp, watches, zp) for debugging purposes
|
||||
#define DEBUG_FORCE_DISPLAY 0
|
||||
|
@ -683,7 +682,7 @@ void StretchBltMemToFrameDC(void)
|
|||
wdest, hdest, // int nWidthDest, int nHeightDest,
|
||||
GetDebuggerMemDC(), // HDC hdcSrc,
|
||||
0, 0, // int nXOriginSrc, int nYOriginSrc,
|
||||
GetFrameBufferBorderlessWidth(), GetFrameBufferBorderlessHeight(), // int nWidthSrc, int nHeightSrc,
|
||||
GetVideo().GetFrameBufferBorderlessWidth(), GetVideo().GetFrameBufferBorderlessHeight(), // int nWidthSrc, int nHeightSrc,
|
||||
SRCCOPY // DWORD dwRop
|
||||
);
|
||||
}
|
||||
|
@ -3124,25 +3123,25 @@ void DrawSoftSwitches( int iSoftSwitch )
|
|||
bool bSet;
|
||||
|
||||
// $C050 / $C051 = TEXTOFF/TEXTON = SW.TXTCLR/SW.TXTSET
|
||||
bSet = !VideoGetSWTEXT();
|
||||
bSet = !GetVideo().VideoGetSWTEXT();
|
||||
_DrawSoftSwitch( rect, 0xC050, bSet, NULL, "GR.", "TEXT" );
|
||||
|
||||
// $C052 / $C053 = MIXEDOFF/MIXEDON = SW.MIXCLR/SW.MIXSET
|
||||
// FULL/MIXED
|
||||
// MIX OFF/ON
|
||||
bSet = !VideoGetSWMIXED();
|
||||
bSet = !GetVideo().VideoGetSWMIXED();
|
||||
_DrawSoftSwitch( rect, 0xC052, bSet, NULL, "FULL", "MIX" );
|
||||
|
||||
// $C054 / $C055 = PAGE1/PAGE2 = PAGE2OFF/PAGE2ON = SW.LOWSCR/SW.HISCR
|
||||
// PAGE 1 / 2
|
||||
bSet = !VideoGetSWPAGE2();
|
||||
bSet = !GetVideo().VideoGetSWPAGE2();
|
||||
_DrawSoftSwitch( rect, 0xC054, bSet, "PAGE ", "1", "2" );
|
||||
|
||||
// $C056 / $C057 LORES/HIRES = HIRESOFF/HIRESON = SW.LORES/SW.HIRES
|
||||
// LO / HIRES
|
||||
// LO / -----
|
||||
// -- / HIRES
|
||||
bSet = !VideoGetSWHIRES();
|
||||
bSet = !GetVideo().VideoGetSWHIRES();
|
||||
_DrawSoftSwitch( rect, 0xC056, bSet, NULL, "LO", "HI", "RES" );
|
||||
|
||||
DebuggerSetColorBG( DebuggerGetColor( BG_INFO ));
|
||||
|
@ -3150,7 +3149,7 @@ void DrawSoftSwitches( int iSoftSwitch )
|
|||
|
||||
// 280/560 HGR
|
||||
// C05E = ON, C05F = OFF
|
||||
bSet = VideoGetSWDHIRES();
|
||||
bSet = GetVideo().VideoGetSWDHIRES();
|
||||
_DrawSoftSwitch( rect, 0xC05E, bSet, NULL, "DHGR", "HGR" );
|
||||
|
||||
|
||||
|
@ -3158,18 +3157,18 @@ void DrawSoftSwitches( int iSoftSwitch )
|
|||
int bgMemory = BG_DATA_2;
|
||||
|
||||
// C000 = 80STOREOFF, C001 = 80STOREON
|
||||
bSet = !VideoGetSW80STORE();
|
||||
bSet = !GetVideo().VideoGetSW80STORE();
|
||||
_DrawSoftSwitch( rect, 0xC000, bSet, "80Sto", "0", "1", NULL, bgMemory );
|
||||
|
||||
// C002 .. C005
|
||||
_DrawSoftSwitchMainAuxBanks( rect, bgMemory );
|
||||
|
||||
// C00C = off, C00D = on
|
||||
bSet = !VideoGetSW80COL();
|
||||
bSet = !GetVideo().VideoGetSW80COL();
|
||||
_DrawSoftSwitch( rect, 0xC00C, bSet, "Col", "40", "80", NULL, bgMemory );
|
||||
|
||||
// C00E = off, C00F = on
|
||||
bSet = !VideoGetSWAltCharSet();
|
||||
bSet = !GetVideo().VideoGetSWAltCharSet();
|
||||
_DrawSoftSwitch( rect, 0xC00E, bSet, NULL, "ASC", "MOUS", NULL, bgMemory ); // ASCII/MouseText
|
||||
|
||||
#if SOFTSWITCH_LANGCARD
|
||||
|
|
|
@ -42,7 +42,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Memory.h"
|
||||
#include "Registry.h"
|
||||
#include "SaveState.h"
|
||||
#include "Video.h"
|
||||
#include "YamlHelper.h"
|
||||
|
||||
#include "../resource/resource.h"
|
||||
|
@ -352,7 +351,7 @@ void Disk2InterfaceCard::EjectDisk(const int drive)
|
|||
Snapshot_UpdatePath();
|
||||
|
||||
SaveLastDiskImage(drive);
|
||||
Video_ResetScreenshotCounter("");
|
||||
GetVideo().Video_ResetScreenshotCounter("");
|
||||
}
|
||||
|
||||
void Disk2InterfaceCard::UnplugDrive(const int drive)
|
||||
|
@ -710,14 +709,14 @@ ImageError_e Disk2InterfaceCard::InsertDisk(const int drive, LPCTSTR pszImageFil
|
|||
GetImageTitle(pszImageFilename, pFloppy->m_imagename, pFloppy->m_fullname);
|
||||
Snapshot_UpdatePath();
|
||||
|
||||
Video_ResetScreenshotCounter(pFloppy->m_imagename);
|
||||
GetVideo().Video_ResetScreenshotCounter(pFloppy->m_imagename);
|
||||
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
InitFirmware(GetCxRomPeripheral());
|
||||
}
|
||||
else
|
||||
{
|
||||
Video_ResetScreenshotCounter("");
|
||||
GetVideo().Video_ResetScreenshotCounter("");
|
||||
}
|
||||
|
||||
SaveLastDiskImage(drive);
|
||||
|
@ -1577,8 +1576,6 @@ bool Disk2InterfaceCard::UserSelectNewDiskImage(const int drive, LPCSTR pszFilen
|
|||
RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_START_DIR), 1, directory, MAX_PATH, TEXT(""));
|
||||
StringCbPrintf(title, 40, TEXT("Select Disk Image For Drive %d"), drive + 1);
|
||||
|
||||
_ASSERT(sizeof(OPENFILENAME) == sizeof(OPENFILENAME_NT4)); // Required for Win98/ME support (selected by _WIN32_WINNT=0x0400 in stdafx.h)
|
||||
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn, 0, sizeof(OPENFILENAME));
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
|
|
|
@ -460,8 +460,6 @@ static bool HD_SelectImage(const int drive, LPCSTR pszFilename)
|
|||
RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, directory, MAX_PATH, TEXT(""));
|
||||
StringCbPrintf(title, 40, TEXT("Select HDV Image For HDD %d"), drive + 1);
|
||||
|
||||
_ASSERT(sizeof(OPENFILENAME) == sizeof(OPENFILENAME_NT4)); // Required for Win98/ME support (selected by _WIN32_WINNT=0x0400 in stdafx.h)
|
||||
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn, 0, sizeof(OPENFILENAME));
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
// an AppleWin frontend must provide the implementation of these 2 methods
|
||||
// an AppleWin frontend must provide the implementation of these methods
|
||||
//
|
||||
// once this is done,
|
||||
// the core emulator files (i.e. almost all the .cpp directly in Source)
|
||||
|
@ -8,8 +8,11 @@
|
|||
// this does not include the main event loop which is left in the arch specific area
|
||||
// nor the actual rendering of the video buffer to screen
|
||||
|
||||
#include "Video.h"
|
||||
Video& GetVideo(void);
|
||||
|
||||
#include "Configuration/IPropertySheet.h"
|
||||
IPropertySheet& GetPropertySheet();
|
||||
IPropertySheet& GetPropertySheet(void);
|
||||
|
||||
#include "FrameBase.h"
|
||||
FrameBase& GetFrame();
|
||||
FrameBase& GetFrame(void);
|
||||
|
|
|
@ -43,7 +43,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Log.h"
|
||||
#include "Mockingboard.h"
|
||||
#include "MouseInterface.h"
|
||||
#include "Video.h"
|
||||
#include "NTSC.h"
|
||||
#include "NoSlotClock.h"
|
||||
#include "ParallelPrinter.h"
|
||||
|
@ -419,7 +418,7 @@ static BYTE __stdcall IOWrite_C00x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
|
|||
if ((addr & 0xf) <= 0xB)
|
||||
return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
|
||||
else
|
||||
return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -441,13 +440,13 @@ static BYTE __stdcall IORead_C01x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
|
|||
case 0x6: res = SW_ALTZP ? true : false; break;
|
||||
case 0x7: res = SW_SLOTC3ROM ? true : false; break;
|
||||
case 0x8: res = SW_80STORE ? true : false; break;
|
||||
case 0x9: res = VideoGetVblBar(nExecutedCycles); break;
|
||||
case 0xA: res = VideoGetSWTEXT(); break;
|
||||
case 0xB: res = VideoGetSWMIXED(); break;
|
||||
case 0x9: res = GetVideo().VideoGetVblBar(nExecutedCycles); break;
|
||||
case 0xA: res = GetVideo().VideoGetSWTEXT(); break;
|
||||
case 0xB: res = GetVideo().VideoGetSWMIXED(); break;
|
||||
case 0xC: res = SW_PAGE2 ? true : false; break;
|
||||
case 0xD: res = VideoGetSWHIRES(); break;
|
||||
case 0xE: res = VideoGetSWAltCharSet(); break;
|
||||
case 0xF: res = VideoGetSW80COL(); break;
|
||||
case 0xD: res = GetVideo().VideoGetSWHIRES(); break;
|
||||
case 0xE: res = GetVideo().VideoGetSWAltCharSet(); break;
|
||||
case 0xF: res = GetVideo().VideoGetSW80COL(); break;
|
||||
}
|
||||
|
||||
return KeybGetKeycode() | (res ? 0x80 : 0);
|
||||
|
@ -500,10 +499,10 @@ static BYTE __stdcall IORead_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
|
|||
{
|
||||
switch (addr & 0xf)
|
||||
{
|
||||
case 0x0: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x1: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x2: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x3: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x0: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x1: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x2: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x3: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x4: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x5: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x6: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
|
||||
|
@ -518,7 +517,7 @@ static BYTE __stdcall IORead_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
|
|||
case 0xF: if (IsApple2PlusOrClone(GetApple2Type()))
|
||||
IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
|
||||
else
|
||||
return (!SW_IOUDIS) ? VideoSetMode(pc, addr, bWrite, d, nExecutedCycles)
|
||||
return (!SW_IOUDIS) ? GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles)
|
||||
: IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
|
||||
}
|
||||
|
||||
|
@ -529,10 +528,10 @@ static BYTE __stdcall IOWrite_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
|
|||
{
|
||||
switch (addr & 0xf)
|
||||
{
|
||||
case 0x0: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x1: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x2: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x3: return VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x0: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x1: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x2: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x3: return GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x4: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x5: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0x6: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
|
||||
|
@ -547,7 +546,7 @@ static BYTE __stdcall IOWrite_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
|
|||
case 0xF: if (IsApple2PlusOrClone(GetApple2Type()))
|
||||
IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
|
||||
else
|
||||
return (!SW_IOUDIS) ? VideoSetMode(pc, addr, bWrite, d, nExecutedCycles)
|
||||
return (!SW_IOUDIS) ? GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles)
|
||||
: IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
|
||||
}
|
||||
|
||||
|
@ -615,7 +614,7 @@ static BYTE __stdcall IORead_C07x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
|
|||
case 0xD: return IO_Null(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0xE: return IS_APPLE2C() ? MemReadFloatingBus(SW_IOUDIS ? true : false, nExecutedCycles) // GH#636
|
||||
: IO_Null(pc, addr, bWrite, d, nExecutedCycles);
|
||||
case 0xF: return IsEnhancedIIEorIIC() ? MemReadFloatingBus(VideoGetSWDHIRES(), nExecutedCycles) // GH#636
|
||||
case 0xF: return IsEnhancedIIEorIIC() ? MemReadFloatingBus(GetVideo().VideoGetSWDHIRES(), nExecutedCycles) // GH#636
|
||||
: IO_Null(pc, addr, bWrite, d, nExecutedCycles);
|
||||
}
|
||||
|
||||
|
@ -1354,7 +1353,7 @@ LPBYTE MemGetAuxPtr(const WORD offset)
|
|||
|
||||
#ifdef RAMWORKS
|
||||
// Video scanner (for 14M video modes) always fetches from 1st 64K aux bank (UTAIIe ref?)
|
||||
if (((SW_PAGE2 && SW_80STORE) || VideoGetSW80COL()) &&
|
||||
if (((SW_PAGE2 && SW_80STORE) || GetVideo().VideoGetSW80COL()) &&
|
||||
(
|
||||
( ((offset & 0xFF00)>=0x0400) && ((offset & 0xFF00)<=0x0700) ) ||
|
||||
( SW_HIRES && ((offset & 0xFF00)>=0x2000) && ((offset & 0xFF00)<=0x3F00) )
|
||||
|
@ -2128,7 +2127,7 @@ BYTE __stdcall MemSetPaging(WORD programcounter, WORD address, BYTE write, BYTE
|
|||
|
||||
// Replicate 80STORE, PAGE2 and HIRES to video sub-system
|
||||
if ((address <= 1) || ((address >= 0x54) && (address <= 0x57)))
|
||||
return VideoSetMode(programcounter,address,write,value,nExecutedCycles);
|
||||
return GetVideo().VideoSetMode(programcounter,address,write,value,nExecutedCycles);
|
||||
|
||||
return write ? 0 : MemReadFloatingBus(nExecutedCycles);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ Etc.
|
|||
#include "Interface.h" // FrameSetCursorPosByMousePos()
|
||||
#include "Log.h"
|
||||
#include "Memory.h"
|
||||
#include "Video.h"
|
||||
#include "NTSC.h" // NTSC_GetCyclesUntilVBlank()
|
||||
#include "YamlHelper.h"
|
||||
|
||||
|
|
106
source/NTSC.cpp
106
source/NTSC.cpp
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Core.h"
|
||||
#include "CPU.h" // CpuGetCyclesThisVideoFrame()
|
||||
#include "Memory.h" // MemGetMainPtr(), MemGetAuxPtr(), MemGetAnnunciator()
|
||||
#include "Video.h" // g_pFramebufferbits
|
||||
#include "Interface.h" // GetFrameBuffer()
|
||||
#include "RGBMonitor.h"
|
||||
|
||||
#include "NTSC_CharSet.h"
|
||||
|
@ -104,7 +104,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
static bgra_t *g_pVideoAddress = 0;
|
||||
static bgra_t *g_pScanLines[VIDEO_SCANNER_Y_DISPLAY*2]; // To maintain the 280x192 aspect ratio for 560px width, we double every scan line -> 560x384
|
||||
|
||||
static const UINT g_kFrameBufferWidth = GetFrameBufferWidth();
|
||||
static const UINT g_kFrameBufferWidth = GetVideo().GetFrameBufferWidth();
|
||||
|
||||
static unsigned short (*g_pHorzClockOffset)[VIDEO_SCANNER_MAX_HORZ] = 0;
|
||||
|
||||
|
@ -364,7 +364,7 @@ static void set_csbits()
|
|||
case A2TYPE_PRAVETS8M: csbits = &csbits_pravets8M[0]; g_nVideoCharSet = 0; break; // Apple ][ clone
|
||||
case A2TYPE_PRAVETS8A: csbits = &csbits_pravets8C[0]; break; // Apple //e clone
|
||||
case A2TYPE_TK30002E: csbits = &csbits_enhanced2e[0]; break; // Enhanced Apple //e clone
|
||||
case A2TYPE_BASE64A: csbits = &csbits_base64a[GetVideoRomRockerSwitch() ? 0 : 1]; g_nVideoCharSet = 0; break; // Apple ][ clone
|
||||
case A2TYPE_BASE64A: csbits = &csbits_base64a[GetVideo().GetVideoRomRockerSwitch() ? 0 : 1]; g_nVideoCharSet = 0; break; // Apple ][ clone
|
||||
default: _ASSERT(0); csbits = &csbits_enhanced2e[0]; break;
|
||||
}
|
||||
}
|
||||
|
@ -715,14 +715,14 @@ inline void updateVideoScannerHorzEOL()
|
|||
//===========================================================================
|
||||
inline void updateVideoScannerAddress()
|
||||
{
|
||||
if (g_nVideoMixed && g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED && GetVideoRefreshRate() == VR_50HZ) // GH#763
|
||||
if (g_nVideoMixed && g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED && GetVideo().GetVideoRefreshRate() == VR_50HZ) // GH#763
|
||||
g_nColorBurstPixels = 0; // instantaneously kill color-burst!
|
||||
|
||||
g_pVideoAddress = g_nVideoClockVert < VIDEO_SCANNER_Y_DISPLAY ? g_pScanLines[2*g_nVideoClockVert] : g_pScanLines[0];
|
||||
|
||||
// Adjust, as these video styles have 2x 14M pixels of pre-render
|
||||
// NB. For VT_COLOR_MONITOR_NTSC, also check color-burst so that TEXT and MIXED(HGR+TEXT) render the TEXT at the same offset (GH#341)
|
||||
if (g_eVideoType == VT_MONO_TV || g_eVideoType == VT_COLOR_TV || (g_eVideoType == VT_COLOR_MONITOR_NTSC && GetColorBurst()))
|
||||
if (GetVideo().GetVideoType() == VT_MONO_TV || GetVideo().GetVideoType() == VT_COLOR_TV || (GetVideo().GetVideoType() == VT_COLOR_MONITOR_NTSC && GetColorBurst()))
|
||||
g_pVideoAddress -= 2;
|
||||
|
||||
// GH#555: For the 14M video modes (DHGR,DGR,80COL), start rendering 1x 14M pixel early to account for these video modes being shifted right by 1 pixel
|
||||
|
@ -735,7 +735,7 @@ inline void updateVideoScannerAddress()
|
|||
(g_pFuncUpdateGraphicsScreen == updateScreenText80) ||
|
||||
(g_pFuncUpdateGraphicsScreen == updateScreenText80RGB) ||
|
||||
(g_nVideoMixed && g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED && (g_pFuncUpdateTextScreen == updateScreenText80 || g_pFuncUpdateGraphicsScreen == updateScreenText80RGB)))
|
||||
&& (g_eVideoType != VT_COLOR_IDEALIZED) && (g_eVideoType != VT_COLOR_VIDEOCARD_RGB)) // Fix for "Ansi Story" (Turn the disk over) - Top row of TEXT80 is shifted by 1 pixel
|
||||
&& (GetVideo().GetVideoType() != VT_COLOR_IDEALIZED) && (GetVideo().GetVideoType() != VT_COLOR_VIDEOCARD_RGB)) // Fix for "Ansi Story" (Turn the disk over) - Top row of TEXT80 is shifted by 1 pixel
|
||||
{
|
||||
g_pVideoAddress -= 1;
|
||||
}
|
||||
|
@ -1652,8 +1652,8 @@ void updateScreenText80 (long cycles6502)
|
|||
aux ^= g_nTextFlashMask;
|
||||
|
||||
uint16_t bits = (main << 7) | (aux & 0x7f);
|
||||
if ((g_eVideoType != VT_COLOR_IDEALIZED) // No extra 14M bit needed for VT_COLOR_IDEALIZED
|
||||
&& (g_eVideoType != VT_COLOR_VIDEOCARD_RGB))
|
||||
if ((GetVideo().GetVideoType() != VT_COLOR_IDEALIZED) // No extra 14M bit needed for VT_COLOR_IDEALIZED
|
||||
&& (GetVideo().GetVideoType() != VT_COLOR_VIDEOCARD_RGB))
|
||||
bits = (bits << 1) | g_nLastColumnPixelNTSC; // GH#555: Align TEXT80 chars with DHGR
|
||||
|
||||
updatePixels( bits );
|
||||
|
@ -1766,7 +1766,7 @@ uint16_t NTSC_VideoGetScannerAddress ( const ULONG uExecutedCycles )
|
|||
}
|
||||
|
||||
uint16_t addr;
|
||||
bool bHires = (g_uVideoMode & VF_HIRES) && !(g_uVideoMode & VF_TEXT); // SW_HIRES && !SW_TEXT
|
||||
bool bHires = (GetVideo().GetVideoMode() & VF_HIRES) && !(GetVideo().GetVideoMode() & VF_TEXT); // SW_HIRES && !SW_TEXT
|
||||
if( bHires )
|
||||
addr = getVideoScannerAddressHGR();
|
||||
else
|
||||
|
@ -1787,7 +1787,7 @@ uint16_t NTSC_VideoGetScannerAddressForDebugger(void)
|
|||
//===========================================================================
|
||||
void NTSC_SetVideoTextMode( int cols )
|
||||
{
|
||||
if (g_eVideoType == VT_COLOR_VIDEOCARD_RGB)
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB)
|
||||
{
|
||||
if (cols == 40)
|
||||
g_pFuncUpdateTextScreen = updateScreenText40RGB;
|
||||
|
@ -1814,7 +1814,7 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
|
||||
|
||||
g_nVideoMixed = uVideoModeFlags & VF_MIXED;
|
||||
g_nVideoCharSet = VideoGetSWAltCharSet() ? 1 : 0;
|
||||
g_nVideoCharSet = GetVideo().VideoGetSWAltCharSet() ? 1 : 0;
|
||||
|
||||
RGB_DisableTextFB();
|
||||
|
||||
|
@ -1831,14 +1831,14 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
}
|
||||
}
|
||||
|
||||
if (GetVideoRefreshRate() == VR_50HZ && g_pVideoAddress) // GH#763 / NB. g_pVideoAddress==NULL when called via VideoResetState()
|
||||
if (GetVideo().GetVideoRefreshRate() == VR_50HZ && g_pVideoAddress) // GH#763 / NB. g_pVideoAddress==NULL when called via VideoResetState()
|
||||
{
|
||||
if (uVideoModeFlags & VF_TEXT)
|
||||
{
|
||||
g_nColorBurstPixels = 0; // (For mid-line video mode change) Instantaneously kill color-burst! (not correct as TV's can take many lines)
|
||||
|
||||
// Switching mid-line from graphics to TEXT
|
||||
if (g_eVideoType == VT_COLOR_MONITOR_NTSC &&
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_MONITOR_NTSC &&
|
||||
g_pFuncUpdateGraphicsScreen != updateScreenText40 && g_pFuncUpdateGraphicsScreen != updateScreenText40RGB
|
||||
&& g_pFuncUpdateGraphicsScreen != updateScreenText80 && g_pFuncUpdateGraphicsScreen != updateScreenText80RGB)
|
||||
{
|
||||
|
@ -1852,7 +1852,7 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
g_nColorBurstPixels = 1024; // (For mid-line video mode change)
|
||||
|
||||
// Switching mid-line from TEXT to graphics
|
||||
if (g_eVideoType == VT_COLOR_MONITOR_NTSC &&
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_MONITOR_NTSC &&
|
||||
(g_pFuncUpdateGraphicsScreen == updateScreenText40 || g_pFuncUpdateGraphicsScreen == updateScreenText40RGB
|
||||
|| g_pFuncUpdateGraphicsScreen == updateScreenText80 || g_pFuncUpdateGraphicsScreen == updateScreenText80RGB))
|
||||
{
|
||||
|
@ -1862,7 +1862,7 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
}
|
||||
|
||||
// Video7_SL7 extra RGB modes handling
|
||||
if (g_eVideoType == VT_COLOR_VIDEOCARD_RGB
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB
|
||||
&& RGB_GetVideocard() == RGB_Videocard_e::Video7_SL7
|
||||
// Exclude following modes (fallback through regular NTSC rendering with RGB text)
|
||||
// VF_DHIRES = 1 -> regular Apple IIe modes
|
||||
|
@ -1917,12 +1917,12 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
{
|
||||
if (uVideoModeFlags & VF_80COL)
|
||||
{
|
||||
if (g_eVideoType == VT_COLOR_VIDEOCARD_RGB)
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB)
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenText80RGB;
|
||||
else
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenText80;
|
||||
}
|
||||
else if (g_eVideoType == VT_COLOR_VIDEOCARD_RGB)
|
||||
else if (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB)
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenText40RGB;
|
||||
else
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenText40;
|
||||
|
@ -1933,18 +1933,18 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
{
|
||||
if (uVideoModeFlags & VF_80COL)
|
||||
{
|
||||
if (g_eVideoType == VT_COLOR_IDEALIZED)
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_IDEALIZED)
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenDoubleHires80Simplified;
|
||||
else if (g_eVideoType == VT_COLOR_VIDEOCARD_RGB)
|
||||
else if (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB)
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenDoubleHires80RGB;
|
||||
else
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenDoubleHires80;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_eVideoType == VT_COLOR_IDEALIZED)
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_IDEALIZED)
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenHires40Simplified; // handles both Single/Double Hires40 (EG. FT's DIGIDREAM demo)
|
||||
// else if (g_eVideoType == VT_COLOR_VIDEOCARD_RGB)
|
||||
// else if (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB)
|
||||
// // TODO
|
||||
else
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenDoubleHires40;
|
||||
|
@ -1952,9 +1952,9 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
}
|
||||
else
|
||||
{
|
||||
if (g_eVideoType == VT_COLOR_IDEALIZED)
|
||||
if (GetVideo().GetVideoType() == VT_COLOR_IDEALIZED)
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenHires40Simplified;
|
||||
else if (g_eVideoType == VT_COLOR_VIDEOCARD_RGB)
|
||||
else if (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB)
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenSingleHires40RGB;
|
||||
else
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenSingleHires40;
|
||||
|
@ -1966,7 +1966,7 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
{
|
||||
if (uVideoModeFlags & VF_80COL)
|
||||
{
|
||||
if ((g_eVideoType == VT_COLOR_IDEALIZED) || (g_eVideoType == VT_COLOR_VIDEOCARD_RGB))
|
||||
if ((GetVideo().GetVideoType() == VT_COLOR_IDEALIZED) || (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB))
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenDoubleLores80Simplified;
|
||||
else
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenDoubleLores80;
|
||||
|
@ -1978,7 +1978,7 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((g_eVideoType == VT_COLOR_IDEALIZED) || (g_eVideoType == VT_COLOR_VIDEOCARD_RGB))
|
||||
if ((GetVideo().GetVideoType() == VT_COLOR_IDEALIZED) || (GetVideo().GetVideoType() == VT_COLOR_VIDEOCARD_RGB))
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenSingleLores40Simplified;
|
||||
else
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenSingleLores40;
|
||||
|
@ -1990,11 +1990,11 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
|
|||
|
||||
void NTSC_SetVideoStyle(void)
|
||||
{
|
||||
const bool half = IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const VideoRefreshRate_e refresh = GetVideoRefreshRate();
|
||||
const bool half = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const VideoRefreshRate_e refresh = GetVideo().GetVideoRefreshRate();
|
||||
uint8_t r, g, b;
|
||||
|
||||
switch ( g_eVideoType )
|
||||
switch ( GetVideo().GetVideoType() )
|
||||
{
|
||||
case VT_COLOR_TV:
|
||||
r = 0xFF;
|
||||
|
@ -2068,9 +2068,9 @@ void NTSC_SetVideoStyle(void)
|
|||
//#define GetRValue(rgb) (LOBYTE(rgb))
|
||||
//#define GetGValue(rgb) (LOBYTE(((WORD)(rgb)) >> 8))
|
||||
//#define GetBValue(rgb) (LOBYTE((rgb)>>16))
|
||||
r = (g_nMonochromeRGB >> 0) & 0xFF;
|
||||
g = (g_nMonochromeRGB >> 8) & 0xFF;
|
||||
b = (g_nMonochromeRGB >> 16) & 0xFF;
|
||||
r = (GetVideo().GetMonochromeRGB() >> 0) & 0xFF;
|
||||
g = (GetVideo().GetMonochromeRGB() >> 8) & 0xFF;
|
||||
b = (GetVideo().GetMonochromeRGB() >> 16) & 0xFF;
|
||||
_mono:
|
||||
updateMonochromeTables( r, g, b ); // Custom Monochrome color
|
||||
if (half)
|
||||
|
@ -2087,7 +2087,7 @@ static void GenerateBaseColors(baseColors_t pBaseNtscColors);
|
|||
|
||||
void NTSC_Destroy(void)
|
||||
{
|
||||
// After a VM restart, this will point to an old g_pFramebufferbits
|
||||
// After a VM restart, this will point to an old FrameBuffer
|
||||
// - if it's now unmapped then this can cause a crash in NTSC_SetVideoMode()!
|
||||
g_pVideoAddress = 0;
|
||||
}
|
||||
|
@ -2102,8 +2102,10 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit
|
|||
|
||||
for (int y = 0; y < (VIDEO_SCANNER_Y_DISPLAY*2); y++)
|
||||
{
|
||||
uint32_t offset = sizeof(bgra_t) * GetFrameBufferWidth() * ((GetFrameBufferHeight() - 1) - y - GetFrameBufferBorderHeight()) + (sizeof(bgra_t) * GetFrameBufferBorderWidth());
|
||||
g_pScanLines[y] = (bgra_t*) (g_pFramebufferbits + offset);
|
||||
uint32_t offset = sizeof(bgra_t) * GetVideo().GetFrameBufferWidth()
|
||||
* ((GetVideo().GetFrameBufferHeight() - 1) - y - GetVideo().GetFrameBufferBorderHeight())
|
||||
+ (sizeof(bgra_t) * GetVideo().GetFrameBufferBorderWidth());
|
||||
g_pScanLines[y] = (bgra_t*) (GetVideo().GetFrameBuffer() + offset);
|
||||
}
|
||||
|
||||
g_pVideoAddress = g_pScanLines[0];
|
||||
|
@ -2111,7 +2113,7 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit
|
|||
g_pFuncUpdateTextScreen = updateScreenText40;
|
||||
g_pFuncUpdateGraphicsScreen = updateScreenText40;
|
||||
|
||||
VideoReinitialize(); // Setup g_pFunc_ntsc*Pixel()
|
||||
GetVideo().VideoReinitialize(); // Setup g_pFunc_ntsc*Pixel()
|
||||
|
||||
bgra_t baseColors[kNumBaseColors];
|
||||
GenerateBaseColors(&baseColors);
|
||||
|
@ -2317,15 +2319,15 @@ static bool CheckVideoTables2( eApple2Type type, uint32_t mode )
|
|||
SetApple2Type(type);
|
||||
NTSC_VideoInitAppleType();
|
||||
|
||||
g_uVideoMode = mode;
|
||||
GetVideo().SetVideoMode(mode);
|
||||
|
||||
g_dwCyclesThisFrame = 0;
|
||||
g_nVideoClockHorz = g_nVideoClockVert = 0;
|
||||
|
||||
for (DWORD cycles=0; cycles<VIDEO_SCANNER_MAX_VERT*VIDEO_SCANNER_MAX_HORZ; cycles++)
|
||||
{
|
||||
WORD addr1 = VideoGetScannerAddress(cycles);
|
||||
WORD addr2 = g_uVideoMode & VF_TEXT ? getVideoScannerAddressTXT()
|
||||
WORD addr1 = GetVideo().VideoGetScannerAddress(cycles);
|
||||
WORD addr2 = GetVideo().GetVideoMode() & VF_TEXT ? getVideoScannerAddressTXT()
|
||||
: getVideoScannerAddressHGR();
|
||||
_ASSERT(addr1 == addr2);
|
||||
if (addr1 != addr2)
|
||||
|
@ -2363,7 +2365,7 @@ static bool IsNTSC(void)
|
|||
static void GenerateVideoTables( void )
|
||||
{
|
||||
eApple2Type currentApple2Type = GetApple2Type();
|
||||
uint32_t currentVideoMode = g_uVideoMode;
|
||||
uint32_t currentVideoMode = GetVideo().GetVideoMode();
|
||||
int currentHiresPage = g_nHiresPage;
|
||||
int currentTextPage = g_nTextPage;
|
||||
|
||||
|
@ -2373,18 +2375,18 @@ static void GenerateVideoTables( void )
|
|||
// g_aClockVertOffsetsHGR[]
|
||||
//
|
||||
|
||||
g_uVideoMode = VF_HIRES;
|
||||
GetVideo().SetVideoMode(VF_HIRES);
|
||||
{
|
||||
UINT i = 0, cycle = VIDEO_SCANNER_HORZ_START;
|
||||
for (; i < VIDEO_SCANNER_MAX_VERT; i++, cycle += VIDEO_SCANNER_MAX_HORZ)
|
||||
{
|
||||
g_aClockVertOffsetsHGR[i] = VideoGetScannerAddress(cycle, VS_PartialAddrV);
|
||||
g_aClockVertOffsetsHGR[i] = GetVideo().VideoGetScannerAddress(cycle, Video::VS_PartialAddrV);
|
||||
if (IsNTSC()) _ASSERT(g_aClockVertOffsetsHGR[i] == g_kClockVertOffsetsHGR[i]);
|
||||
}
|
||||
if (!IsNTSC())
|
||||
{
|
||||
for (; i < VIDEO_SCANNER_MAX_VERT_PAL; i++, cycle += VIDEO_SCANNER_MAX_HORZ)
|
||||
g_aClockVertOffsetsHGR[i] = VideoGetScannerAddress(cycle, VS_PartialAddrV);
|
||||
g_aClockVertOffsetsHGR[i] = GetVideo().VideoGetScannerAddress(cycle, Video::VS_PartialAddrV);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2392,18 +2394,18 @@ static void GenerateVideoTables( void )
|
|||
// g_aClockVertOffsetsTXT[]
|
||||
//
|
||||
|
||||
g_uVideoMode = VF_TEXT;
|
||||
GetVideo().SetVideoMode(VF_TEXT);
|
||||
{
|
||||
UINT i = 0, cycle = VIDEO_SCANNER_HORZ_START;
|
||||
for (; i < (256 + 8) / 8; i++, cycle += VIDEO_SCANNER_MAX_HORZ * 8)
|
||||
{
|
||||
g_aClockVertOffsetsTXT[i] = VideoGetScannerAddress(cycle, VS_PartialAddrV);
|
||||
g_aClockVertOffsetsTXT[i] = GetVideo().VideoGetScannerAddress(cycle, Video::VS_PartialAddrV);
|
||||
if (IsNTSC()) _ASSERT(g_aClockVertOffsetsTXT[i] == g_kClockVertOffsetsTXT[i]);
|
||||
}
|
||||
if (!IsNTSC())
|
||||
{
|
||||
for (; i < VIDEO_SCANNER_MAX_VERT_PAL / 8; i++, cycle += VIDEO_SCANNER_MAX_HORZ * 8)
|
||||
g_aClockVertOffsetsTXT[i] = VideoGetScannerAddress(cycle, VS_PartialAddrV);
|
||||
g_aClockVertOffsetsTXT[i] = GetVideo().VideoGetScannerAddress(cycle, Video::VS_PartialAddrV);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2411,13 +2413,13 @@ static void GenerateVideoTables( void )
|
|||
// APPLE_IIP_HORZ_CLOCK_OFFSET[]
|
||||
//
|
||||
|
||||
g_uVideoMode = VF_TEXT;
|
||||
GetVideo().SetVideoMode(VF_TEXT);
|
||||
SetApple2Type(A2TYPE_APPLE2PLUS);
|
||||
for (UINT j=0; j<5; j++)
|
||||
{
|
||||
for (UINT i=0, cycle=j*64*VIDEO_SCANNER_MAX_HORZ; i<VIDEO_SCANNER_MAX_HORZ; i++, cycle++)
|
||||
{
|
||||
APPLE_IIP_HORZ_CLOCK_OFFSET[j][i] = VideoGetScannerAddress(cycle, VS_PartialAddrH);
|
||||
APPLE_IIP_HORZ_CLOCK_OFFSET[j][i] = GetVideo().VideoGetScannerAddress(cycle, Video::VS_PartialAddrH);
|
||||
if (IsNTSC()) _ASSERT(APPLE_IIP_HORZ_CLOCK_OFFSET[j][i] == kAPPLE_IIP_HORZ_CLOCK_OFFSET[j][i]);
|
||||
}
|
||||
}
|
||||
|
@ -2426,13 +2428,13 @@ static void GenerateVideoTables( void )
|
|||
// APPLE_IIE_HORZ_CLOCK_OFFSET[]
|
||||
//
|
||||
|
||||
g_uVideoMode = VF_TEXT;
|
||||
GetVideo().SetVideoMode(VF_TEXT);
|
||||
SetApple2Type(A2TYPE_APPLE2E);
|
||||
for (UINT j=0; j<5; j++)
|
||||
{
|
||||
for (UINT i=0, cycle=j*64*VIDEO_SCANNER_MAX_HORZ; i<VIDEO_SCANNER_MAX_HORZ; i++, cycle++)
|
||||
{
|
||||
APPLE_IIE_HORZ_CLOCK_OFFSET[j][i] = VideoGetScannerAddress(cycle, VS_PartialAddrH);
|
||||
APPLE_IIE_HORZ_CLOCK_OFFSET[j][i] = GetVideo().VideoGetScannerAddress(cycle, Video::VS_PartialAddrH);
|
||||
if (IsNTSC()) _ASSERT(APPLE_IIE_HORZ_CLOCK_OFFSET[j][i] == kAPPLE_IIE_HORZ_CLOCK_OFFSET[j][i]);
|
||||
}
|
||||
}
|
||||
|
@ -2441,10 +2443,8 @@ static void GenerateVideoTables( void )
|
|||
|
||||
CheckVideoTables();
|
||||
|
||||
// VideoResetState();
|
||||
|
||||
SetApple2Type(currentApple2Type);
|
||||
g_uVideoMode = currentVideoMode;
|
||||
GetVideo().SetVideoMode(currentVideoMode);
|
||||
g_nHiresPage = currentHiresPage;
|
||||
g_nTextPage = currentTextPage;
|
||||
}
|
||||
|
@ -2507,7 +2507,7 @@ UINT NTSC_GetCyclesPerLine(void)
|
|||
|
||||
UINT NTSC_GetVideoLines(void)
|
||||
{
|
||||
return (GetVideoRefreshRate() == VR_50HZ) ? VIDEO_SCANNER_MAX_VERT_PAL : VIDEO_SCANNER_MAX_VERT;
|
||||
return (GetVideo().GetVideoRefreshRate() == VR_50HZ) ? VIDEO_SCANNER_MAX_VERT_PAL : VIDEO_SCANNER_MAX_VERT;
|
||||
}
|
||||
|
||||
// Get # cycles until rising Vbl edge: !VBl -> VBl at (0,192)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include "Video.h"
|
||||
|
||||
// Globals (Public)
|
||||
extern uint16_t g_nVideoClockVert;
|
||||
extern uint16_t g_nVideoClockHorz;
|
||||
|
|
|
@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Interface.h"
|
||||
#include "Core.h"
|
||||
#include "../resource/resource.h"
|
||||
#include "Video.h"
|
||||
|
||||
|
||||
unsigned char csbits_enhanced2e[2][256][8]; // Enhanced //e (2732 4K video ROM)
|
||||
|
@ -162,11 +161,11 @@ static void userVideoRom4K(csbits_t csbits, const BYTE* pVideoRom)
|
|||
static void userVideoRomForIIe(void)
|
||||
{
|
||||
const BYTE* pVideoRom;
|
||||
UINT size = GetVideoRom(pVideoRom); // 2K or 4K or 8K
|
||||
if (size < kVideoRomSize4K)
|
||||
UINT size = GetVideo().GetVideoRom(pVideoRom); // 2K or 4K or 8K
|
||||
if (size < Video::kVideoRomSize4K)
|
||||
return;
|
||||
|
||||
if (size == kVideoRomSize4K)
|
||||
if (size == Video::kVideoRomSize4K)
|
||||
{
|
||||
userVideoRom4K(&csbits_enhanced2e[0], pVideoRom);
|
||||
}
|
||||
|
@ -241,8 +240,8 @@ static void userVideoRom2K(csbits_t csbits, const BYTE* pVideoRom, const eApple2
|
|||
static void userVideoRomForIIPlus(void)
|
||||
{
|
||||
const BYTE* pVideoRom;
|
||||
UINT size = GetVideoRom(pVideoRom); // 2K or 4K or 8K
|
||||
if (size != kVideoRomSize2K)
|
||||
UINT size = GetVideo().GetVideoRom(pVideoRom); // 2K or 4K or 8K
|
||||
if (size != Video::kVideoRomSize2K)
|
||||
return;
|
||||
|
||||
userVideoRom2K(&csbits_a2[0], pVideoRom);
|
||||
|
@ -257,7 +256,7 @@ static void VideoRomForIIJPlus(void)
|
|||
return;
|
||||
|
||||
DWORD dwResSize = SizeofResource(NULL, hResInfo);
|
||||
if(dwResSize != kVideoRomSize2K)
|
||||
if(dwResSize != Video::kVideoRomSize2K)
|
||||
return;
|
||||
|
||||
HGLOBAL hResData = LoadResource(NULL, hResInfo);
|
||||
|
@ -279,7 +278,7 @@ static void VideoRomForBase64A(void)
|
|||
return;
|
||||
|
||||
DWORD dwResSize = SizeofResource(NULL, hResInfo);
|
||||
if (dwResSize != kVideoRomSize4K)
|
||||
if (dwResSize != Video::kVideoRomSize4K)
|
||||
return;
|
||||
|
||||
HGLOBAL hResData = LoadResource(NULL, hResInfo);
|
||||
|
@ -291,7 +290,7 @@ static void VideoRomForBase64A(void)
|
|||
return;
|
||||
|
||||
userVideoRom2K(&csbits_base64a[0], pVideoRom, A2TYPE_BASE64A, 0);
|
||||
userVideoRom2K(&csbits_base64a[1], pVideoRom + kVideoRomSize2K, A2TYPE_BASE64A, 0);
|
||||
userVideoRom2K(&csbits_base64a[1], pVideoRom + Video::kVideoRomSize2K, A2TYPE_BASE64A, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,8 +324,8 @@ csbits_t Get2e_csbits(void)
|
|||
{
|
||||
const csbits_t videoRom4K = (GetApple2Type() == A2TYPE_APPLE2E) ? csbits_2e : csbits_enhanced2e;
|
||||
|
||||
if (IsVideoRom4K()) // 4K means US-only, so no secondary PAL video ROM
|
||||
if (GetVideo().IsVideoRom4K()) // 4K means US-only, so no secondary PAL video ROM
|
||||
return videoRom4K;
|
||||
|
||||
return GetVideoRomRockerSwitch() == false ? videoRom4K : csbits_2e_pal; // NB. Same PAL video ROM for Original & Enhanced //e
|
||||
return GetVideo().GetVideoRomRockerSwitch() == false ? videoRom4K : csbits_2e_pal; // NB. Same PAL video ROM for Original & Enhanced //e
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "RGBMonitor.h"
|
||||
#include "Memory.h" // MemGetMainPtr() MemGetAuxPtr()
|
||||
#include "Video.h"
|
||||
#include "Interface.h"
|
||||
#include "Card.h"
|
||||
#include "YamlHelper.h"
|
||||
|
||||
|
@ -514,7 +514,7 @@ static void CopyMixedSource(int x, int y, int sx, int sy, bgra_t *pVideoAddress)
|
|||
|
||||
const int matx = x*14;
|
||||
const int maty = HGR_MATRIX_YOFFSET + y;
|
||||
const bool isSWMIXED = VideoGetSWMIXED();
|
||||
const bool isSWMIXED = GetVideo().VideoGetSWMIXED();
|
||||
|
||||
// transfer 14 pixels (i.e. the visible part of an apple hgr-byte) from row to pixelmatrix
|
||||
for (int nBytes=13; nBytes>=0; nBytes--)
|
||||
|
@ -522,8 +522,8 @@ static void CopyMixedSource(int x, int y, int sx, int sy, bgra_t *pVideoAddress)
|
|||
hgrpixelmatrix[matx+nBytes][maty] = *(pSrc+nBytes);
|
||||
}
|
||||
|
||||
const bool bIsHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const UINT frameBufferWidth = GetFrameBufferWidth();
|
||||
const bool bIsHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const UINT frameBufferWidth = GetVideo().GetFrameBufferWidth();
|
||||
|
||||
for (int nBytes=13; nBytes>=0; nBytes--)
|
||||
{
|
||||
|
@ -559,8 +559,8 @@ static void CopySource(int w, int h, int sx, int sy, bgra_t *pVideoAddress, cons
|
|||
UINT32* pDst = (UINT32*) pVideoAddress;
|
||||
const BYTE* const pSrc = g_aSourceStartofLine[ sy ] + sx;
|
||||
|
||||
const bool bIsHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const UINT frameBufferWidth = GetFrameBufferWidth();
|
||||
const bool bIsHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const UINT frameBufferWidth = GetVideo().GetFrameBufferWidth();
|
||||
|
||||
while (h--)
|
||||
{
|
||||
|
@ -594,14 +594,14 @@ void UpdateHiResCell (int x, int y, uint16_t addr, bgra_t *pVideoAddress)
|
|||
BYTE byteval2 = *(pMain);
|
||||
BYTE byteval3 = (x < 39) ? *(pMain+1) : 0;
|
||||
|
||||
if (g_uVideoMode & VF_DHIRES) // ie. VF_DHIRES=1, VF_HIRES=1, VF_80COL=0 - NTSC.cpp refers to this as "DoubleHires40"
|
||||
if (GetVideo().GetVideoMode() & VF_DHIRES) // ie. VF_DHIRES=1, VF_HIRES=1, VF_80COL=0 - NTSC.cpp refers to this as "DoubleHires40"
|
||||
{
|
||||
byteval1 &= 0x7f;
|
||||
byteval2 &= 0x7f;
|
||||
byteval3 &= 0x7f;
|
||||
}
|
||||
|
||||
if (IsVideoStyle(VS_COLOR_VERTICAL_BLEND))
|
||||
if (GetVideo().IsVideoStyle(VS_COLOR_VERTICAL_BLEND))
|
||||
{
|
||||
CopyMixedSource(x, y, SRCOFFS_HIRES+HIRES_COLUMN_OFFSET+((x & 1)*HIRES_COLUMN_SUBUNIT_SIZE), (int)byteval2, pVideoAddress);
|
||||
}
|
||||
|
@ -727,11 +727,11 @@ void UpdateHiResRGBCell(int x, int y, uint16_t addr, bgra_t* pVideoAddress)
|
|||
dwordval = dwordval >> 1;
|
||||
}
|
||||
|
||||
const bool bIsHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const bool bIsHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
|
||||
|
||||
// Second line
|
||||
UINT32* pSrc = (UINT32*)pVideoAddress;
|
||||
pDst = pSrc - GetFrameBufferWidth();
|
||||
pDst = pSrc - GetVideo().GetFrameBufferWidth();
|
||||
if (bIsHalfScanLines)
|
||||
{
|
||||
// Scanlines
|
||||
|
@ -942,11 +942,11 @@ void UpdateDHiResCellRGB(int x, int y, uint16_t addr, bgra_t* pVideoAddress, boo
|
|||
}
|
||||
}
|
||||
|
||||
const bool bIsHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const bool bIsHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
|
||||
|
||||
// Second line
|
||||
UINT32* pSrc = (UINT32*)pVideoAddress ;
|
||||
pDst = pSrc - GetFrameBufferWidth();
|
||||
pDst = pSrc - GetVideo().GetFrameBufferWidth();
|
||||
if (bIsHalfScanLines)
|
||||
{
|
||||
// Scanlines
|
||||
|
@ -1121,8 +1121,8 @@ void UpdateDuochromeCell(int h, int w, bgra_t* pVideoAddress, uint8_t bits, uint
|
|||
{
|
||||
UINT32* pDst = (UINT32*)pVideoAddress;
|
||||
|
||||
const bool bIsHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const UINT frameBufferWidth = GetFrameBufferWidth();
|
||||
const bool bIsHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
|
||||
const UINT frameBufferWidth = GetVideo().GetFrameBufferWidth();
|
||||
RGBQUAD colors[2];
|
||||
// use LoRes palette
|
||||
background += 12;
|
||||
|
@ -1240,7 +1240,7 @@ void RGB_SetVideoMode(WORD address)
|
|||
if (address == 0x5F && g_rgbPrevAN3Addr == 0x5E)
|
||||
{
|
||||
g_rgbFlags = (g_rgbFlags << 1) & 3;
|
||||
g_rgbFlags |= ((g_uVideoMode & VF_80COL) ? 0 : 1); // clock in !80COL
|
||||
g_rgbFlags |= ((GetVideo().GetVideoMode() & VF_80COL) ? 0 : 1); // clock in !80COL
|
||||
g_rgbMode = g_rgbFlags; // latch F2,F1
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "SerialComms.h"
|
||||
#include "Speaker.h"
|
||||
#include "Speech.h"
|
||||
#include "Video.h"
|
||||
#include "z80emu.h"
|
||||
|
||||
#include "Configuration/Config.h"
|
||||
|
@ -284,11 +283,11 @@ static void ParseUnitApple2(YamlLoadHelper& yamlLoadHelper, UINT version)
|
|||
JoyLoadSnapshot(yamlLoadHelper);
|
||||
KeybLoadSnapshot(yamlLoadHelper, version);
|
||||
SpkrLoadSnapshot(yamlLoadHelper);
|
||||
VideoLoadSnapshot(yamlLoadHelper, version);
|
||||
GetVideo().VideoLoadSnapshot(yamlLoadHelper, version);
|
||||
MemLoadSnapshot(yamlLoadHelper, version);
|
||||
|
||||
// g_Apple2Type may've changed: so redraw frame (title, buttons, leds, etc)
|
||||
VideoReinitialize(); // g_CharsetType changed
|
||||
GetVideo().VideoReinitialize(); // g_CharsetType changed
|
||||
GetFrame().FrameUpdateApple2Type(); // Calls VideoRedrawScreen() before the aux mem has been loaded (so if DHGR is enabled, then aux mem will be zeros at this stage)
|
||||
}
|
||||
|
||||
|
@ -491,8 +490,8 @@ static void Snapshot_LoadState_v2(void)
|
|||
HD_SetEnabled(false);
|
||||
|
||||
KeybReset();
|
||||
VideoResetState();
|
||||
SetVideoRefreshRate(VR_60HZ); // Default to 60Hz as older save-states won't contain refresh rate
|
||||
GetVideo().VideoResetState();
|
||||
GetVideo().SetVideoRefreshRate(VR_60HZ); // Default to 60Hz as older save-states won't contain refresh rate
|
||||
MB_InitializeForLoadingSnapshot(); // GH#609
|
||||
#ifdef USE_SPEECH_API
|
||||
g_Speech.Reset();
|
||||
|
@ -584,7 +583,7 @@ void Snapshot_SaveState(void)
|
|||
JoySaveSnapshot(yamlSaveHelper);
|
||||
KeybSaveSnapshot(yamlSaveHelper);
|
||||
SpkrSaveSnapshot(yamlSaveHelper);
|
||||
VideoSaveSnapshot(yamlSaveHelper);
|
||||
GetVideo().VideoSaveSnapshot(yamlSaveHelper);
|
||||
MemSaveSnapshot(yamlSaveHelper);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Core.h"
|
||||
#include "CardManager.h"
|
||||
#include "CPU.h"
|
||||
#include "Video.h"
|
||||
#include "Joystick.h"
|
||||
#include "Log.h"
|
||||
#include "Mockingboard.h"
|
||||
|
@ -196,7 +195,7 @@ void LoadConfiguration(void)
|
|||
}
|
||||
|
||||
REGLOAD_DEFAULT(TEXT(REGVALUE_EMULATION_SPEED), &g_dwSpeed, SPEED_NORMAL);
|
||||
Config_Load_Video();
|
||||
GetVideo().Config_Load_Video();
|
||||
SetCurrentCLK6502(); // Pre: g_dwSpeed && Config_Load_Video()->SetVideoRefreshRate()
|
||||
|
||||
DWORD dwEnhanceDisk;
|
||||
|
@ -495,10 +494,10 @@ void GetAppleWindowTitle()
|
|||
|
||||
g_pAppTitle += " - ";
|
||||
|
||||
if (IsVideoStyle(VS_HALF_SCANLINES))
|
||||
if (GetVideo().IsVideoStyle(VS_HALF_SCANLINES))
|
||||
g_pAppTitle += " 50% ";
|
||||
|
||||
g_pAppTitle += VideoGetAppWindowTitle();
|
||||
g_pAppTitle += GetVideo().VideoGetAppWindowTitle();
|
||||
|
||||
if (GetCardMgr().GetDisk2CardMgr().IsAnyFirmware13Sector())
|
||||
g_pAppTitle += " (S6-13) ";
|
||||
|
@ -536,7 +535,7 @@ void ResetMachineState()
|
|||
PravetsReset();
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Boot();
|
||||
VideoResetState();
|
||||
GetVideo().VideoResetState();
|
||||
KeybReset();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommReset();
|
||||
|
@ -571,7 +570,7 @@ void CtrlReset()
|
|||
MemResetPaging();
|
||||
|
||||
// For A][ & A][+, reset doesn't reset the video mode (UTAII:4-4)
|
||||
VideoResetState(); // Switch Alternate char set off
|
||||
GetVideo().VideoResetState(); // Switch Alternate char set off
|
||||
}
|
||||
|
||||
if (IsAppleIIeOrAbove(GetApple2Type()) || IsCopamBase64A(GetApple2Type()))
|
||||
|
|
310
source/Video.cpp
310
source/Video.cpp
|
@ -37,7 +37,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Registry.h"
|
||||
#include "NTSC.h"
|
||||
#include "RGBMonitor.h"
|
||||
|
||||
#include "YamlHelper.h"
|
||||
|
||||
#define SW_80COL (g_uVideoMode & VF_80COL)
|
||||
|
@ -48,123 +47,87 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#define SW_PAGE2 (g_uVideoMode & VF_PAGE2)
|
||||
#define SW_TEXT (g_uVideoMode & VF_TEXT)
|
||||
|
||||
// Globals (Public)
|
||||
|
||||
uint8_t *g_pFramebufferbits = NULL; // last drawn frame (initialized in WinVideoInitialize)
|
||||
int g_nAltCharSetOffset = 0; // alternate character set
|
||||
|
||||
// Globals (Private)
|
||||
|
||||
// video scanner constants
|
||||
int const kHBurstClock = 53; // clock when Color Burst starts
|
||||
int const kHBurstClocks = 4; // clocks per Color Burst duration
|
||||
int const kHClock0State = 0x18; // H[543210] = 011000
|
||||
int const kHClocks = 65; // clocks per horizontal scan (including HBL)
|
||||
int const kHPEClock = 40; // clock when HPE (horizontal preset enable) goes low
|
||||
int const kHPresetClock = 41; // clock when H state presets
|
||||
int const kHSyncClock = 49; // clock when HSync starts
|
||||
int const kHSyncClocks = 4; // clocks per HSync duration
|
||||
int const kNTSCScanLines = 262; // total scan lines including VBL (NTSC)
|
||||
int const kNTSCVSyncLine = 224; // line when VSync starts (NTSC)
|
||||
int const kPALScanLines = 312; // total scan lines including VBL (PAL)
|
||||
int const kPALVSyncLine = 264; // line when VSync starts (PAL)
|
||||
int const kVLine0State = 0x100; // V[543210CBA] = 100000000
|
||||
int const kVPresetLine = 256; // line when V state presets
|
||||
int const kVSyncLines = 4; // lines per VSync duration
|
||||
int const kVDisplayableScanLines = 192; // max displayable scanlines
|
||||
|
||||
COLORREF g_nMonochromeRGB = RGB(0xC0,0xC0,0xC0);
|
||||
|
||||
uint32_t g_uVideoMode = VF_TEXT; // Current Video Mode (this is the last set one as it may change mid-scan line!)
|
||||
|
||||
DWORD g_eVideoType = VT_DEFAULT;
|
||||
static VideoStyle_e g_eVideoStyle = VS_HALF_SCANLINES;
|
||||
|
||||
static bool g_bVideoScannerNTSC = true; // NTSC video scanning (or PAL)
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
// NOTE: KEEP IN SYNC: VideoType_e g_aVideoChoices g_apVideoModeDesc
|
||||
TCHAR g_aVideoChoices[] =
|
||||
TEXT("Monochrome (Custom)\0")
|
||||
TEXT("Color (Composite Idealized)\0") // newly added
|
||||
TEXT("Color (RGB Card/Monitor)\0") // was "Color (RGB Monitor)"
|
||||
TEXT("Color (Composite Monitor)\0") // was "Color (NTSC Monitor)"
|
||||
TEXT("Color TV\0")
|
||||
TEXT("B&W TV\0")
|
||||
TEXT("Monochrome (Amber)\0")
|
||||
TEXT("Monochrome (Green)\0")
|
||||
TEXT("Monochrome (White)\0")
|
||||
const char Video::g_aVideoChoices[] =
|
||||
"Monochrome (Custom)\0"
|
||||
"Color (Composite Idealized)\0"
|
||||
"Color (RGB Card/Monitor)\0"
|
||||
"Color (Composite Monitor)\0"
|
||||
"Color TV\0"
|
||||
"B&W TV\0"
|
||||
"Monochrome (Amber)\0"
|
||||
"Monochrome (Green)\0"
|
||||
"Monochrome (White)\0"
|
||||
;
|
||||
|
||||
// NOTE: KEEP IN SYNC: VideoType_e g_aVideoChoices g_apVideoModeDesc
|
||||
// The window title will be set to this.
|
||||
static const char *g_apVideoModeDesc[ NUM_VIDEO_MODES ] =
|
||||
|
||||
const char Video::m_szModeDesc0[] = "Monochrome (Custom)";
|
||||
const char Video::m_szModeDesc1[] = "Color (Composite Idealized)";
|
||||
const char Video::m_szModeDesc2[] = "Color (RGB Card/Monitor)";
|
||||
const char Video::m_szModeDesc3[] = "Color (Composite Monitor)";
|
||||
const char Video::m_szModeDesc4[] = "Color TV";
|
||||
const char Video::m_szModeDesc5[] = "B&W TV";
|
||||
const char Video::m_szModeDesc6[] = "Monochrome (Amber)";
|
||||
const char Video::m_szModeDesc7[] = "Monochrome (Green)";
|
||||
const char Video::m_szModeDesc8[] = "Monochrome (White)";
|
||||
|
||||
const char* const Video::g_apVideoModeDesc[NUM_VIDEO_MODES] =
|
||||
{
|
||||
"Monochrome (Custom)"
|
||||
, "Color (Composite Idealized)"
|
||||
, "Color (RGB Card/Monitor)"
|
||||
, "Color (Composite Monitor)"
|
||||
, "Color TV"
|
||||
, "B&W TV"
|
||||
, "Monochrome (Amber)"
|
||||
, "Monochrome (Green)"
|
||||
, "Monochrome (White)"
|
||||
Video::m_szModeDesc0,
|
||||
Video::m_szModeDesc1,
|
||||
Video::m_szModeDesc2,
|
||||
Video::m_szModeDesc3,
|
||||
Video::m_szModeDesc4,
|
||||
Video::m_szModeDesc5,
|
||||
Video::m_szModeDesc6,
|
||||
Video::m_szModeDesc7,
|
||||
Video::m_szModeDesc8
|
||||
};
|
||||
|
||||
// Prototypes (Private) _____________________________________________
|
||||
|
||||
bool g_bDisplayPrintScreenFileName = false;
|
||||
bool g_bShowPrintScreenWarningDialog = true;
|
||||
static void Util_MakeScreenShotFileName( TCHAR *pFinalFileName_, DWORD chars );
|
||||
static bool Util_TestScreenShotFileName( const TCHAR *pFileName );
|
||||
static void Video_MakeScreenShot( FILE *pFile, const VideoScreenShot_e ScreenShotType );
|
||||
static void videoCreateDIBSection();
|
||||
|
||||
//===========================================================================
|
||||
|
||||
//
|
||||
// ----- ALL GLOBALLY ACCESSIBLE FUNCTIONS ARE BELOW THIS LINE -----
|
||||
//
|
||||
|
||||
UINT GetFrameBufferBorderlessWidth(void)
|
||||
UINT Video::GetFrameBufferBorderlessWidth(void)
|
||||
{
|
||||
static const UINT uFrameBufferBorderlessW = 560; // 560 = Double Hi-Res
|
||||
return uFrameBufferBorderlessW;
|
||||
}
|
||||
|
||||
UINT GetFrameBufferBorderlessHeight(void)
|
||||
UINT Video::GetFrameBufferBorderlessHeight(void)
|
||||
{
|
||||
static const UINT uFrameBufferBorderlessH = 384; // 384 = Double Scan Line
|
||||
return uFrameBufferBorderlessH;
|
||||
}
|
||||
|
||||
// NB. These border areas are not visible (... and these border areas are unrelated to the 3D border below)
|
||||
UINT GetFrameBufferBorderWidth(void)
|
||||
UINT Video::GetFrameBufferBorderWidth(void)
|
||||
{
|
||||
static const UINT uBorderW = 20;
|
||||
return uBorderW;
|
||||
}
|
||||
|
||||
UINT GetFrameBufferBorderHeight(void)
|
||||
UINT Video::GetFrameBufferBorderHeight(void)
|
||||
{
|
||||
static const UINT uBorderH = 18;
|
||||
return uBorderH;
|
||||
}
|
||||
|
||||
UINT GetFrameBufferWidth(void)
|
||||
UINT Video::GetFrameBufferWidth(void)
|
||||
{
|
||||
return GetFrameBufferBorderlessWidth() + 2 * GetFrameBufferBorderWidth();
|
||||
}
|
||||
|
||||
UINT GetFrameBufferHeight(void)
|
||||
UINT Video::GetFrameBufferHeight(void)
|
||||
{
|
||||
return GetFrameBufferBorderlessHeight() + 2 * GetFrameBufferBorderHeight();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void VideoReinitialize (bool bInitVideoScannerAddress /*= true*/)
|
||||
void Video::VideoReinitialize(bool bInitVideoScannerAddress /*= true*/)
|
||||
{
|
||||
NTSC_VideoReinitialize( g_dwCyclesThisFrame, bInitVideoScannerAddress );
|
||||
NTSC_VideoInitAppleType();
|
||||
|
@ -175,7 +138,8 @@ void VideoReinitialize (bool bInitVideoScannerAddress /*= true*/)
|
|||
}
|
||||
|
||||
//===========================================================================
|
||||
void VideoResetState ()
|
||||
|
||||
void Video::VideoResetState(void)
|
||||
{
|
||||
g_nAltCharSetOffset = 0;
|
||||
g_uVideoMode = VF_TEXT;
|
||||
|
@ -188,7 +152,7 @@ void VideoResetState ()
|
|||
|
||||
//===========================================================================
|
||||
|
||||
BYTE VideoSetMode(WORD, WORD address, BYTE write, BYTE, ULONG uExecutedCycles)
|
||||
BYTE Video::VideoSetMode(WORD, WORD address, BYTE write, BYTE, ULONG uExecutedCycles)
|
||||
{
|
||||
address &= 0xFF;
|
||||
|
||||
|
@ -229,42 +193,42 @@ BYTE VideoSetMode(WORD, WORD address, BYTE write, BYTE, ULONG uExecutedCycles)
|
|||
|
||||
//===========================================================================
|
||||
|
||||
bool VideoGetSW80COL(void)
|
||||
bool Video::VideoGetSW80COL(void)
|
||||
{
|
||||
return SW_80COL ? true : false;
|
||||
}
|
||||
|
||||
bool VideoGetSWDHIRES(void)
|
||||
bool Video::VideoGetSWDHIRES(void)
|
||||
{
|
||||
return SW_DHIRES ? true : false;
|
||||
}
|
||||
|
||||
bool VideoGetSWHIRES(void)
|
||||
bool Video::VideoGetSWHIRES(void)
|
||||
{
|
||||
return SW_HIRES ? true : false;
|
||||
}
|
||||
|
||||
bool VideoGetSW80STORE(void)
|
||||
bool Video::VideoGetSW80STORE(void)
|
||||
{
|
||||
return SW_80STORE ? true : false;
|
||||
}
|
||||
|
||||
bool VideoGetSWMIXED(void)
|
||||
bool Video::VideoGetSWMIXED(void)
|
||||
{
|
||||
return SW_MIXED ? true : false;
|
||||
}
|
||||
|
||||
bool VideoGetSWPAGE2(void)
|
||||
bool Video::VideoGetSWPAGE2(void)
|
||||
{
|
||||
return SW_PAGE2 ? true : false;
|
||||
}
|
||||
|
||||
bool VideoGetSWTEXT(void)
|
||||
bool Video::VideoGetSWTEXT(void)
|
||||
{
|
||||
return SW_TEXT ? true : false;
|
||||
}
|
||||
|
||||
bool VideoGetSWAltCharSet(void)
|
||||
bool Video::VideoGetSWAltCharSet(void)
|
||||
{
|
||||
return g_nAltCharSetOffset != 0;
|
||||
}
|
||||
|
@ -276,13 +240,13 @@ bool VideoGetSWAltCharSet(void)
|
|||
#define SS_YAML_KEY_CYCLES_THIS_FRAME "Cycles This Frame"
|
||||
#define SS_YAML_KEY_VIDEO_REFRESH_RATE "Video Refresh Rate"
|
||||
|
||||
static std::string VideoGetSnapshotStructName(void)
|
||||
std::string Video::VideoGetSnapshotStructName(void)
|
||||
{
|
||||
static const std::string name("Video");
|
||||
return name;
|
||||
}
|
||||
|
||||
void VideoSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
void Video::VideoSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
{
|
||||
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", VideoGetSnapshotStructName().c_str());
|
||||
yamlSaveHelper.SaveBool(SS_YAML_KEY_ALT_CHARSET, g_nAltCharSetOffset ? true : false);
|
||||
|
@ -291,7 +255,7 @@ void VideoSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
yamlSaveHelper.SaveUint(SS_YAML_KEY_VIDEO_REFRESH_RATE, (UINT)GetVideoRefreshRate());
|
||||
}
|
||||
|
||||
void VideoLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
void Video::VideoLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (!yamlLoadHelper.GetSubMap(VideoGetSnapshotStructName()))
|
||||
return;
|
||||
|
@ -315,8 +279,24 @@ void VideoLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
|||
// References to Jim Sather's books are given as eg:
|
||||
// UTAIIe:5-7,P3 (Understanding the Apple IIe, chapter 5, page 7, Paragraph 3)
|
||||
//
|
||||
WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr /*= VS_FullAddr*/)
|
||||
WORD Video::VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr /*= VS_FullAddr*/)
|
||||
{
|
||||
const int kHBurstClock = 53; // clock when Color Burst starts
|
||||
const int kHBurstClocks = 4; // clocks per Color Burst duration
|
||||
const int kHClock0State = 0x18; // H[543210] = 011000
|
||||
const int kHClocks = 65; // clocks per horizontal scan (including HBL)
|
||||
const int kHPEClock = 40; // clock when HPE (horizontal preset enable) goes low
|
||||
const int kHPresetClock = 41; // clock when H state presets
|
||||
const int kHSyncClock = 49; // clock when HSync starts
|
||||
const int kHSyncClocks = 4; // clocks per HSync duration
|
||||
const int kNTSCScanLines = 262; // total scan lines including VBL (NTSC)
|
||||
const int kNTSCVSyncLine = 224; // line when VSync starts (NTSC)
|
||||
const int kPALScanLines = 312; // total scan lines including VBL (PAL)
|
||||
const int kPALVSyncLine = 264; // line when VSync starts (PAL)
|
||||
const int kVLine0State = 0x100; // V[543210CBA] = 100000000
|
||||
const int kVPresetLine = 256; // line when V state presets
|
||||
const int kVSyncLines = 4; // lines per VSync duration
|
||||
|
||||
// machine state switches
|
||||
//
|
||||
bool bHires = VideoGetSWHIRES() && !VideoGetSWTEXT();
|
||||
|
@ -432,7 +412,7 @@ WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr /*= V
|
|||
//===========================================================================
|
||||
|
||||
// Called when *outside* of CpuExecute()
|
||||
bool VideoGetVblBarEx(const DWORD dwCyclesThisFrame)
|
||||
bool Video::VideoGetVblBarEx(const DWORD dwCyclesThisFrame)
|
||||
{
|
||||
if (g_bFullSpeed)
|
||||
{
|
||||
|
@ -444,7 +424,7 @@ bool VideoGetVblBarEx(const DWORD dwCyclesThisFrame)
|
|||
}
|
||||
|
||||
// Called when *inside* CpuExecute()
|
||||
bool VideoGetVblBar(const DWORD uExecutedCycles)
|
||||
bool Video::VideoGetVblBar(const DWORD uExecutedCycles)
|
||||
{
|
||||
if (g_bFullSpeed)
|
||||
{
|
||||
|
@ -454,39 +434,25 @@ bool VideoGetVblBar(const DWORD uExecutedCycles)
|
|||
|
||||
return g_nVideoClockVert < kVDisplayableScanLines;
|
||||
}
|
||||
//===========================================================================
|
||||
|
||||
#define SCREENSHOT_BMP 1
|
||||
#define SCREENSHOT_TGA 0
|
||||
|
||||
static int g_nLastScreenShot = 0;
|
||||
const int nMaxScreenShot = 999999999;
|
||||
static std::string g_pLastDiskImageName;
|
||||
|
||||
//===========================================================================
|
||||
void Video_ResetScreenshotCounter( const std::string & pImageName )
|
||||
|
||||
void Video::Video_ResetScreenshotCounter(const std::string& pImageName)
|
||||
{
|
||||
g_nLastScreenShot = 0;
|
||||
g_pLastDiskImageName = pImageName;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void Util_MakeScreenShotFileName( TCHAR *pFinalFileName_, DWORD chars )
|
||||
void Video::Util_MakeScreenShotFileName(TCHAR *pFinalFileName_, DWORD chars)
|
||||
{
|
||||
const std::string sPrefixScreenShotFileName = "AppleWin_ScreenShot";
|
||||
// TODO: g_sScreenshotDir
|
||||
const std::string pPrefixFileName = !g_pLastDiskImageName.empty() ? g_pLastDiskImageName : sPrefixScreenShotFileName;
|
||||
#if SCREENSHOT_BMP
|
||||
StringCbPrintf( pFinalFileName_, chars, TEXT("%s_%09d.bmp"), pPrefixFileName.c_str(), g_nLastScreenShot );
|
||||
#endif
|
||||
#if SCREENSHOT_TGA
|
||||
StringCbPrintf( pFinalFileName_, chars, TEXT("%s%09d.tga"), pPrefixFileName.c_str(), g_nLastScreenShot );
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns TRUE if file exists, else FALSE
|
||||
//===========================================================================
|
||||
bool Util_TestScreenShotFileName( const TCHAR *pFileName )
|
||||
bool Video::Util_TestScreenShotFileName(const TCHAR *pFileName)
|
||||
{
|
||||
bool bFileExists = false;
|
||||
FILE *pFile = fopen( pFileName, "rt" );
|
||||
|
@ -499,7 +465,8 @@ bool Util_TestScreenShotFileName( const TCHAR *pFileName )
|
|||
}
|
||||
|
||||
//===========================================================================
|
||||
void Video_TakeScreenShot( const VideoScreenShot_e ScreenShotType )
|
||||
|
||||
void Video::Video_TakeScreenShot(const VideoScreenShot_e ScreenShotType)
|
||||
{
|
||||
TCHAR sScreenShotFileName[ MAX_PATH ];
|
||||
|
||||
|
@ -529,41 +496,8 @@ void Video_TakeScreenShot( const VideoScreenShot_e ScreenShotType )
|
|||
g_nLastScreenShot++;
|
||||
}
|
||||
|
||||
WinBmpHeader_t g_tBmpHeader;
|
||||
|
||||
#if SCREENSHOT_TGA
|
||||
enum TargaImageType_e
|
||||
void Video::Video_SetBitmapHeader(WinBmpHeader_t *pBmp, int nWidth, int nHeight, int nBitsPerPixel)
|
||||
{
|
||||
TARGA_RGB = 2
|
||||
};
|
||||
|
||||
struct TargaHeader_t
|
||||
{ // Addr Bytes
|
||||
u8 nIdBytes ; // 00 01 size of ID field that follows 18 byte header (0 usually)
|
||||
u8 bHasPalette ; // 01 01
|
||||
u8 iImageType ; // 02 01 type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
|
||||
|
||||
s16 iPaletteFirstColor ; // 03 02
|
||||
s16 nPaletteColors ; // 05 02
|
||||
u8 nPaletteBitsPerEntry ; // 07 01 number of bits per palette entry 15,16,24,32
|
||||
|
||||
s16 nOriginX ; // 08 02 image x origin
|
||||
s16 nOriginY ; // 0A 02 image y origin
|
||||
s16 nWidthPixels ; // 0C 02
|
||||
s16 nHeightPixels ; // 0E 02
|
||||
u8 nBitsPerPixel ; // 10 01 image bits per pixel 8,16,24,32
|
||||
u8 iDescriptor ; // 11 01 image descriptor bits (vh flip bits)
|
||||
|
||||
// pixel data...
|
||||
u8 aPixelData[1] ; // rgb
|
||||
};
|
||||
|
||||
TargaHeader_t g_tTargaHeader;
|
||||
#endif // SCREENSHOT_TGA
|
||||
|
||||
void Video_SetBitmapHeader( WinBmpHeader_t *pBmp, int nWidth, int nHeight, int nBitsPerPixel )
|
||||
{
|
||||
#if SCREENSHOT_BMP
|
||||
pBmp->nCookie[ 0 ] = 'B'; // 0x42
|
||||
pBmp->nCookie[ 1 ] = 'M'; // 0x4d
|
||||
pBmp->nSizeFile = 0;
|
||||
|
@ -596,7 +530,8 @@ void Video_SetBitmapHeader( WinBmpHeader_t *pBmp, int nWidth, int nHeight, int n
|
|||
}
|
||||
|
||||
//===========================================================================
|
||||
static void Video_MakeScreenShot(FILE *pFile, const VideoScreenShot_e ScreenShotType)
|
||||
|
||||
void Video::Video_MakeScreenShot(FILE *pFile, const VideoScreenShot_e ScreenShotType)
|
||||
{
|
||||
WinBmpHeader_t *pBmp = &g_tBmpHeader;
|
||||
|
||||
|
@ -607,12 +542,6 @@ static void Video_MakeScreenShot(FILE *pFile, const VideoScreenShot_e ScreenShot
|
|||
32
|
||||
);
|
||||
|
||||
// char sText[256];
|
||||
// sprintf( sText, "sizeof: BITMAPFILEHEADER = %d\n", sizeof(BITMAPFILEHEADER) ); // = 14
|
||||
// MessageBox( GetFrame().g_hFrameWindow, sText, "Info 1", MB_OK );
|
||||
// sprintf( sText, "sizeof: BITMAPINFOHEADER = %d\n", sizeof(BITMAPINFOHEADER) ); // = 40
|
||||
// MessageBox( GetFrame().g_hFrameWindow, sText, "Info 2", MB_OK );
|
||||
|
||||
char sIfSizeZeroOrUnknown_BadWinBmpHeaderPackingSize54[ sizeof( WinBmpHeader_t ) == (14 + 40) ];
|
||||
/**/ sIfSizeZeroOrUnknown_BadWinBmpHeaderPackingSize54[0]=0;
|
||||
|
||||
|
@ -670,22 +599,11 @@ static void Video_MakeScreenShot(FILE *pFile, const VideoScreenShot_e ScreenShot
|
|||
pSrc += GetFrameBufferWidth();
|
||||
}
|
||||
}
|
||||
#endif // SCREENSHOT_BMP
|
||||
|
||||
#if SCREENSHOT_TGA
|
||||
TargaHeader_t *pHeader = &g_tTargaHeader;
|
||||
memset( (void*)pHeader, 0, sizeof( TargaHeader_t ) );
|
||||
|
||||
pHeader->iImageType = TARGA_RGB;
|
||||
pHeader->nWidthPixels = FRAMEBUFFER_W;
|
||||
pHeader->nHeightPixels = FRAMEBUFFER_H;
|
||||
pHeader->nBitsPerPixel = 24;
|
||||
#endif // SCREENSHOT_TGA
|
||||
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void Video_SaveScreenShot( const VideoScreenShot_e ScreenShotType, const TCHAR *pScreenShotFileName )
|
||||
|
||||
void Video::Video_SaveScreenShot(const VideoScreenShot_e ScreenShotType, const TCHAR *pScreenShotFileName)
|
||||
{
|
||||
FILE *pFile = fopen( pScreenShotFileName, "wb" );
|
||||
if( pFile )
|
||||
|
@ -700,17 +618,9 @@ void Video_SaveScreenShot( const VideoScreenShot_e ScreenShotType, const TCHAR *
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
||||
static const UINT kVideoRomSize8K = kVideoRomSize4K*2;
|
||||
static const UINT kVideoRomSize16K = kVideoRomSize8K*2;
|
||||
static const UINT kVideoRomSizeMax = kVideoRomSize16K;
|
||||
static BYTE g_videoRom[kVideoRomSizeMax];
|
||||
static UINT g_videoRomSize = 0;
|
||||
static bool g_videoRomRockerSwitch = false;
|
||||
|
||||
bool ReadVideoRomFile(const TCHAR* pRomFile)
|
||||
bool Video::ReadVideoRomFile(const TCHAR* pRomFile)
|
||||
{
|
||||
g_videoRomSize = 0;
|
||||
|
||||
|
@ -738,29 +648,31 @@ bool ReadVideoRomFile(const TCHAR* pRomFile)
|
|||
return g_videoRomSize != 0;
|
||||
}
|
||||
|
||||
UINT GetVideoRom(const BYTE*& pVideoRom)
|
||||
UINT Video::GetVideoRom(const BYTE*& pVideoRom)
|
||||
{
|
||||
pVideoRom = &g_videoRom[0];
|
||||
return g_videoRomSize;
|
||||
}
|
||||
|
||||
bool GetVideoRomRockerSwitch(void)
|
||||
bool Video::GetVideoRomRockerSwitch(void)
|
||||
{
|
||||
return g_videoRomRockerSwitch;
|
||||
}
|
||||
|
||||
void SetVideoRomRockerSwitch(bool state)
|
||||
void Video::SetVideoRomRockerSwitch(bool state)
|
||||
{
|
||||
g_videoRomRockerSwitch = state;
|
||||
}
|
||||
|
||||
bool IsVideoRom4K(void)
|
||||
bool Video::IsVideoRom4K(void)
|
||||
{
|
||||
return g_videoRomSize <= kVideoRomSize4K;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void Video::Config_Load_Video()
|
||||
{
|
||||
enum VideoType127_e
|
||||
{
|
||||
VT127_MONO_CUSTOM
|
||||
|
@ -773,8 +685,6 @@ enum VideoType127_e
|
|||
, VT127_NUM_VIDEO_MODES
|
||||
};
|
||||
|
||||
void Config_Load_Video()
|
||||
{
|
||||
DWORD dwTmp;
|
||||
|
||||
REGLOAD_DEFAULT(TEXT(REGVALUE_VIDEO_MODE), &dwTmp, (DWORD)VT_DEFAULT);
|
||||
|
@ -828,7 +738,7 @@ void Config_Load_Video()
|
|||
g_eVideoType = VT_DEFAULT;
|
||||
}
|
||||
|
||||
void Config_Save_Video()
|
||||
void Video::Config_Save_Video()
|
||||
{
|
||||
REGSAVE(TEXT(REGVALUE_VIDEO_MODE) ,g_eVideoType);
|
||||
REGSAVE(TEXT(REGVALUE_VIDEO_STYLE) ,g_eVideoStyle);
|
||||
|
@ -838,40 +748,64 @@ void Config_Save_Video()
|
|||
|
||||
//===========================================================================
|
||||
|
||||
VideoType_e GetVideoType(void)
|
||||
uint32_t Video::GetVideoMode(void)
|
||||
{
|
||||
return g_uVideoMode;
|
||||
}
|
||||
|
||||
void Video::SetVideoMode(uint32_t videoMode)
|
||||
{
|
||||
g_uVideoMode = videoMode;
|
||||
}
|
||||
|
||||
VideoType_e Video::GetVideoType(void)
|
||||
{
|
||||
return (VideoType_e) g_eVideoType;
|
||||
}
|
||||
|
||||
// TODO: Can only do this at start-up (mid-emulation requires a more heavy-weight video reinit)
|
||||
void SetVideoType(VideoType_e newVideoType)
|
||||
void Video::SetVideoType(VideoType_e newVideoType)
|
||||
{
|
||||
g_eVideoType = newVideoType;
|
||||
}
|
||||
|
||||
VideoStyle_e GetVideoStyle(void)
|
||||
VideoStyle_e Video::GetVideoStyle(void)
|
||||
{
|
||||
return g_eVideoStyle;
|
||||
}
|
||||
|
||||
void SetVideoStyle(VideoStyle_e newVideoStyle)
|
||||
void Video::IncVideoType(void)
|
||||
{
|
||||
g_eVideoType++;
|
||||
if (g_eVideoType >= NUM_VIDEO_MODES)
|
||||
g_eVideoType = 0;
|
||||
}
|
||||
|
||||
void Video::DecVideoType(void)
|
||||
{
|
||||
if (g_eVideoType <= 0)
|
||||
g_eVideoType = NUM_VIDEO_MODES;
|
||||
g_eVideoType--;
|
||||
}
|
||||
|
||||
void Video::SetVideoStyle(VideoStyle_e newVideoStyle)
|
||||
{
|
||||
g_eVideoStyle = newVideoStyle;
|
||||
}
|
||||
|
||||
bool IsVideoStyle(VideoStyle_e mask)
|
||||
bool Video::IsVideoStyle(VideoStyle_e mask)
|
||||
{
|
||||
return (g_eVideoStyle & mask) != 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
VideoRefreshRate_e GetVideoRefreshRate(void)
|
||||
VideoRefreshRate_e Video::GetVideoRefreshRate(void)
|
||||
{
|
||||
return (g_bVideoScannerNTSC == false) ? VR_50HZ : VR_60HZ;
|
||||
}
|
||||
|
||||
void SetVideoRefreshRate(VideoRefreshRate_e rate)
|
||||
void Video::SetVideoRefreshRate(VideoRefreshRate_e rate)
|
||||
{
|
||||
if (rate != VR_50HZ)
|
||||
rate = VR_60HZ;
|
||||
|
@ -882,7 +816,7 @@ void SetVideoRefreshRate(VideoRefreshRate_e rate)
|
|||
|
||||
//===========================================================================
|
||||
|
||||
const char* VideoGetAppWindowTitle(void)
|
||||
const char* Video::VideoGetAppWindowTitle(void)
|
||||
{
|
||||
static const char *apVideoMonitorModeDesc[ 2 ] =
|
||||
{
|
||||
|
|
122
source/Video.h
122
source/Video.h
|
@ -82,7 +82,7 @@
|
|||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/// turn of MSVC struct member padding
|
||||
// turn of MSVC struct member padding
|
||||
#pragma pack(push,1)
|
||||
#define PACKED
|
||||
#else
|
||||
|
@ -177,13 +177,49 @@ struct WinBmpHeader4_t
|
|||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
// Globals __________________________________________________________
|
||||
extern COLORREF g_nMonochromeRGB; // saved to Registry
|
||||
extern uint32_t g_uVideoMode;
|
||||
extern DWORD g_eVideoType; // saved to Registry
|
||||
extern uint8_t *g_pFramebufferbits;
|
||||
//
|
||||
|
||||
// Prototypes _______________________________________________________
|
||||
class Video
|
||||
{
|
||||
public:
|
||||
Video(void)
|
||||
{
|
||||
g_pFramebufferbits = NULL; // last drawn frame (initialized in WinVideoInitialize)
|
||||
g_nAltCharSetOffset = 0;
|
||||
g_uVideoMode = VF_TEXT;
|
||||
g_eVideoType = VT_DEFAULT;
|
||||
g_eVideoStyle = VS_HALF_SCANLINES;
|
||||
g_bVideoScannerNTSC = true;
|
||||
g_nMonochromeRGB = RGB(0xC0,0xC0,0xC0);
|
||||
g_bDisplayPrintScreenFileName = false;
|
||||
g_bShowPrintScreenWarningDialog = true;
|
||||
g_nLastScreenShot = 0;
|
||||
g_videoRomSize = 0;
|
||||
g_videoRomRockerSwitch = false;
|
||||
}
|
||||
|
||||
virtual ~Video(void)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false) = 0;
|
||||
virtual void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame) = 0;
|
||||
virtual void VideoRefreshScreen(uint32_t uRedrawWholeScreenVideoMode = 0, bool bRedrawWholeScreen = false) = 0;
|
||||
virtual void Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename) = 0;
|
||||
virtual void ChooseMonochromeColor(void) = 0;
|
||||
virtual void Benchmark(void) = 0;
|
||||
virtual void DisplayLogo(void) = 0;
|
||||
|
||||
uint8_t* GetFrameBuffer(void) { return g_pFramebufferbits; }
|
||||
void SetFrameBuffer(uint8_t* frameBuffer) { g_pFramebufferbits = frameBuffer; }
|
||||
|
||||
// size of the video buffer stored in g_pFramebufferbits
|
||||
UINT GetFrameBufferBorderlessWidth(void);
|
||||
|
@ -193,8 +229,12 @@ UINT GetFrameBufferBorderHeight(void);
|
|||
UINT GetFrameBufferWidth(void);
|
||||
UINT GetFrameBufferHeight(void);
|
||||
|
||||
COLORREF GetMonochromeRGB(void) { return g_nMonochromeRGB; }
|
||||
void SetMonochromeRGB(COLORREF colorRef) { g_nMonochromeRGB = colorRef; }
|
||||
|
||||
void VideoReinitialize(bool bInitVideoScannerAddress = true);
|
||||
void VideoResetState ();
|
||||
void VideoResetState(void);
|
||||
|
||||
enum VideoScanner_e {VS_FullAddr, VS_PartialAddrV, VS_PartialAddrH};
|
||||
WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr = VS_FullAddr);
|
||||
bool VideoGetVblBarEx(const DWORD dwCyclesThisFrame);
|
||||
|
@ -212,9 +252,6 @@ bool VideoGetSWAltCharSet(void);
|
|||
void VideoSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
extern bool g_bDisplayPrintScreenFileName;
|
||||
extern bool g_bShowPrintScreenWarningDialog;
|
||||
|
||||
void Video_ResetScreenshotCounter(const std::string & pDiskImageFileName);
|
||||
enum VideoScreenShot_e
|
||||
{
|
||||
|
@ -224,11 +261,13 @@ enum VideoScreenShot_e
|
|||
void Video_TakeScreenShot(VideoScreenShot_e ScreenShotType);
|
||||
void Video_SetBitmapHeader(WinBmpHeader_t *pBmp, int nWidth, int nHeight, int nBitsPerPixel);
|
||||
void Video_SaveScreenShot(const VideoScreenShot_e ScreenShotType, const TCHAR* pScreenShotFileName);
|
||||
void SetDisplayPrintScreenFileName(bool state) { g_bDisplayPrintScreenFileName = state; }
|
||||
|
||||
bool GetShowPrintScreenWarningDialog(void) { return g_bShowPrintScreenWarningDialog; }
|
||||
void SetShowPrintScreenWarningDialog(bool state) { g_bShowPrintScreenWarningDialog = state; }
|
||||
|
||||
BYTE VideoSetMode(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
|
||||
|
||||
const UINT kVideoRomSize2K = 1024*2;
|
||||
const UINT kVideoRomSize4K = kVideoRomSize2K*2;
|
||||
bool ReadVideoRomFile(const char* pRomFile);
|
||||
UINT GetVideoRom(const BYTE*& pVideoRom);
|
||||
bool GetVideoRomRockerSwitch(void);
|
||||
|
@ -238,8 +277,12 @@ bool IsVideoRom4K(void);
|
|||
void Config_Load_Video(void);
|
||||
void Config_Save_Video(void);
|
||||
|
||||
uint32_t GetVideoMode(void);
|
||||
void SetVideoMode(uint32_t videoMode);
|
||||
VideoType_e GetVideoType(void);
|
||||
void SetVideoType(VideoType_e newVideoType);
|
||||
void IncVideoType(void);
|
||||
void DecVideoType(void);
|
||||
VideoStyle_e GetVideoStyle(void);
|
||||
void SetVideoStyle(VideoStyle_e newVideoStyle);
|
||||
bool IsVideoStyle(VideoStyle_e mask);
|
||||
|
@ -248,3 +291,56 @@ VideoRefreshRate_e GetVideoRefreshRate(void);
|
|||
void SetVideoRefreshRate(VideoRefreshRate_e rate);
|
||||
|
||||
const char* VideoGetAppWindowTitle(void);
|
||||
const char* GetVideoChoices(void) { return g_aVideoChoices; }
|
||||
|
||||
static const UINT kVideoRomSize2K = 1024*2;
|
||||
static const UINT kVideoRomSize4K = kVideoRomSize2K*2;
|
||||
|
||||
protected:
|
||||
uint8_t *g_pFramebufferbits;
|
||||
|
||||
private:
|
||||
void Util_MakeScreenShotFileName(TCHAR *pFinalFileName_, DWORD chars);
|
||||
bool Util_TestScreenShotFileName(const TCHAR *pFileName);
|
||||
void Video_MakeScreenShot(FILE *pFile, const VideoScreenShot_e ScreenShotType);
|
||||
|
||||
std::string VideoGetSnapshotStructName(void);
|
||||
|
||||
int g_nAltCharSetOffset;
|
||||
uint32_t g_uVideoMode; // Current Video Mode (this is the last set one as it may change mid-scan line!)
|
||||
DWORD g_eVideoType; // saved to Registry
|
||||
VideoStyle_e g_eVideoStyle;
|
||||
bool g_bVideoScannerNTSC; // NTSC video scanning (or PAL)
|
||||
COLORREF g_nMonochromeRGB; // saved to Registry
|
||||
|
||||
WinBmpHeader_t g_tBmpHeader;
|
||||
|
||||
bool g_bDisplayPrintScreenFileName;
|
||||
bool g_bShowPrintScreenWarningDialog;
|
||||
|
||||
int g_nLastScreenShot;
|
||||
static const int nMaxScreenShot = 999999999;
|
||||
std::string g_pLastDiskImageName;
|
||||
|
||||
static const int kVDisplayableScanLines = 192; // max displayable scanlines
|
||||
|
||||
static const UINT kVideoRomSize8K = kVideoRomSize4K*2;
|
||||
static const UINT kVideoRomSize16K = kVideoRomSize8K*2;
|
||||
static const UINT kVideoRomSizeMax = kVideoRomSize16K;
|
||||
BYTE g_videoRom[kVideoRomSizeMax];
|
||||
UINT g_videoRomSize;
|
||||
bool g_videoRomRockerSwitch;
|
||||
|
||||
static const char g_aVideoChoices[];
|
||||
|
||||
static const char m_szModeDesc0[];
|
||||
static const char m_szModeDesc1[];
|
||||
static const char m_szModeDesc2[];
|
||||
static const char m_szModeDesc3[];
|
||||
static const char m_szModeDesc4[];
|
||||
static const char m_szModeDesc5[];
|
||||
static const char m_szModeDesc6[];
|
||||
static const char m_szModeDesc7[];
|
||||
static const char m_szModeDesc8[];
|
||||
static const char* const g_apVideoModeDesc[NUM_VIDEO_MODES];
|
||||
};
|
||||
|
|
|
@ -172,7 +172,7 @@ static void ContinueExecution(void)
|
|||
if (g_bFullSpeed)
|
||||
{
|
||||
if (!bWasFullSpeed)
|
||||
VideoRedrawScreenDuringFullSpeed(0, true); // Init for full-speed mode
|
||||
GetVideo().VideoRedrawScreenDuringFullSpeed(0, true); // Init for full-speed mode
|
||||
|
||||
// Don't call Spkr_Mute() - will get speaker clicks
|
||||
MB_Mute();
|
||||
|
@ -190,7 +190,7 @@ static void ContinueExecution(void)
|
|||
else
|
||||
{
|
||||
if (bWasFullSpeed)
|
||||
VideoRedrawScreenAfterFullSpeed(g_dwCyclesThisFrame);
|
||||
GetVideo().VideoRedrawScreenAfterFullSpeed(g_dwCyclesThisFrame);
|
||||
|
||||
// Don't call Spkr_Demute()
|
||||
MB_Demute();
|
||||
|
@ -243,7 +243,7 @@ static void ContinueExecution(void)
|
|||
//
|
||||
|
||||
const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame();
|
||||
if (g_dwCyclesThisFrame >= dwClksPerFrame && !VideoGetVblBarEx(g_dwCyclesThisFrame))
|
||||
if (g_dwCyclesThisFrame >= dwClksPerFrame && !GetVideo().VideoGetVblBarEx(g_dwCyclesThisFrame))
|
||||
{
|
||||
#ifdef LOG_PERF_TIMINGS
|
||||
PerfMarker perfMarkerVideoRefresh(g_timeVideoRefresh);
|
||||
|
@ -251,9 +251,9 @@ static void ContinueExecution(void)
|
|||
g_dwCyclesThisFrame -= dwClksPerFrame;
|
||||
|
||||
if (g_bFullSpeed)
|
||||
VideoRedrawScreenDuringFullSpeed(g_dwCyclesThisFrame);
|
||||
GetVideo().VideoRedrawScreenDuringFullSpeed(g_dwCyclesThisFrame);
|
||||
else
|
||||
VideoRefreshScreen(); // Just copy the output of our Apple framebuffer to the system Back Buffer
|
||||
GetVideo().VideoRefreshScreen(); // Just copy the output of our Apple framebuffer to the system Back Buffer
|
||||
}
|
||||
|
||||
#ifdef LOG_PERF_TIMINGS
|
||||
|
@ -482,7 +482,7 @@ static void RegisterHotKeys(void)
|
|||
if (!bStatus[2])
|
||||
msg += "\n. Ctrl+PrintScreen";
|
||||
|
||||
if (g_bShowPrintScreenWarningDialog)
|
||||
if (GetVideo().GetShowPrintScreenWarningDialog())
|
||||
SHMessageBoxCheck( GetFrame().g_hFrameWindow, msg.c_str(), "Warning", MB_ICONASTERISK | MB_OK, MB_OK, "AppleWin-75097740-8e59-444c-bc94-2d4915132599" );
|
||||
|
||||
msg += "\n";
|
||||
|
@ -741,7 +741,8 @@ static void OneTimeInitialization(HINSTANCE passinstance)
|
|||
#endif
|
||||
|
||||
// Initialize COM - so we can use CoCreateInstance
|
||||
// . NB. DSInit() & DIMouse::DirectInputInit are done when g_hFrameWindow is created (WM_CREATE)
|
||||
// . DSInit() & DIMouse::DirectInputInit are done when g_hFrameWindow is created (WM_CREATE)
|
||||
// . DDInit() is done in RepeatInitialization() by GetVideo().Initialize()
|
||||
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
LogFileOutput("Init: CoInitializeEx(), hr=0x%08X\n", hr);
|
||||
|
||||
|
@ -754,9 +755,6 @@ static void OneTimeInitialization(HINSTANCE passinstance)
|
|||
LogFileOutput("Init: SysClk_InitTimer(), res=%d\n", bSpeechOK ? 1:0);
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
DDInit(); // For WaitForVerticalBlank()
|
||||
#endif
|
||||
|
||||
GetFrame().g_hInstance = passinstance;
|
||||
GdiSetBatchLimit(512);
|
||||
|
@ -793,14 +791,14 @@ static void RepeatInitialization(void)
|
|||
|
||||
if (g_cmdLine.newVideoType >= 0)
|
||||
{
|
||||
SetVideoType( (VideoType_e)g_cmdLine.newVideoType );
|
||||
GetVideo().SetVideoType( (VideoType_e)g_cmdLine.newVideoType );
|
||||
g_cmdLine.newVideoType = -1; // Don't reapply after a restart
|
||||
}
|
||||
SetVideoStyle( (VideoStyle_e) ((GetVideoStyle() | g_cmdLine.newVideoStyleEnableMask) & ~g_cmdLine.newVideoStyleDisableMask) );
|
||||
GetVideo().SetVideoStyle( (VideoStyle_e) ((GetVideo().GetVideoStyle() | g_cmdLine.newVideoStyleEnableMask) & ~g_cmdLine.newVideoStyleDisableMask) );
|
||||
|
||||
if (g_cmdLine.newVideoRefreshRate != VR_NONE)
|
||||
{
|
||||
SetVideoRefreshRate(g_cmdLine.newVideoRefreshRate);
|
||||
GetVideo().SetVideoRefreshRate(g_cmdLine.newVideoRefreshRate);
|
||||
g_cmdLine.newVideoRefreshRate = VR_NONE; // Don't reapply after a restart
|
||||
SetCurrentCLK6502();
|
||||
}
|
||||
|
@ -842,7 +840,7 @@ static void RepeatInitialization(void)
|
|||
JoyInitialize();
|
||||
LogFileOutput("Main: JoyInitialize()\n");
|
||||
|
||||
WinVideoInitialize(); // g_pFramebufferinfo been created now
|
||||
GetVideo().Initialize(); // g_pFramebufferinfo been created now & COM init'ed
|
||||
LogFileOutput("Main: VideoInitialize()\n");
|
||||
|
||||
LogFileOutput("Main: FrameCreateWindow() - pre\n");
|
||||
|
@ -850,7 +848,7 @@ static void RepeatInitialization(void)
|
|||
LogFileOutput("Main: FrameCreateWindow() - post\n");
|
||||
|
||||
// Init palette color
|
||||
VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideoType());
|
||||
VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideo().GetVideoType());
|
||||
|
||||
// Allow the 4 hardcoded slots to be configurated as empty
|
||||
// NB. this state is not persisted to the Registry/conf.ini (just as '-s7 empty' isn't)
|
||||
|
@ -977,7 +975,7 @@ static void RepeatInitialization(void)
|
|||
|
||||
if (g_cmdLine.szScreenshotFilename)
|
||||
{
|
||||
Video_RedrawAndTakeScreenShot(g_cmdLine.szScreenshotFilename);
|
||||
GetVideo().Video_RedrawAndTakeScreenShot(g_cmdLine.szScreenshotFilename);
|
||||
g_cmdLine.bShutdown = true;
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1021,6 @@ static void Shutdown(void)
|
|||
ChangeDisplaySettings(NULL, 0); // restore default
|
||||
|
||||
// Release COM
|
||||
DDUninit();
|
||||
SysClk_UninitTimer();
|
||||
LogFileOutput("Exit: SysClk_UninitTimer()\n");
|
||||
|
||||
|
@ -1047,14 +1044,20 @@ static void Shutdown(void)
|
|||
UnplugHardDiskControllerCard();
|
||||
}
|
||||
|
||||
IPropertySheet& GetPropertySheet()
|
||||
IPropertySheet& GetPropertySheet(void)
|
||||
{
|
||||
static CPropertySheet sg_PropertySheet;
|
||||
return sg_PropertySheet;
|
||||
}
|
||||
|
||||
FrameBase& GetFrame()
|
||||
FrameBase& GetFrame(void)
|
||||
{
|
||||
static Win32Frame sg_Win32Frame;
|
||||
return sg_Win32Frame;
|
||||
}
|
||||
|
||||
Video& GetVideo(void)
|
||||
{
|
||||
static WinVideo video;
|
||||
return video;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#define VIEWPORTY 5
|
||||
|
||||
static const int kDEFAULT_VIEWPORT_SCALE = 2;
|
||||
int g_nViewportCX = GetFrameBufferBorderlessWidth() * kDEFAULT_VIEWPORT_SCALE;
|
||||
int g_nViewportCY = GetFrameBufferBorderlessHeight() * kDEFAULT_VIEWPORT_SCALE;
|
||||
int g_nViewportCX = GetVideo().GetFrameBufferBorderlessWidth() * kDEFAULT_VIEWPORT_SCALE;
|
||||
int g_nViewportCY = GetVideo().GetFrameBufferBorderlessHeight() * kDEFAULT_VIEWPORT_SCALE;
|
||||
static int g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; // saved REGSAVE
|
||||
static int g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; // Max scale in Windowed mode with borders, buttons etc (full-screen may be +1)
|
||||
|
||||
|
@ -585,7 +585,7 @@ static void DrawFrameWindow (bool bPaintingWindow/*=false*/)
|
|||
|
||||
// DRAW THE CONTENTS OF THE EMULATED SCREEN
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
VideoDisplayLogo();
|
||||
GetVideo().DisplayLogo();
|
||||
else if (g_nAppMode == MODE_DEBUG)
|
||||
DebugDisplay();
|
||||
else
|
||||
|
@ -1064,7 +1064,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
CpuDestroy();
|
||||
MemDestroy();
|
||||
SpkrDestroy();
|
||||
WinVideoDestroy();
|
||||
GetVideo().Destroy();
|
||||
MB_Destroy();
|
||||
DeleteGdiObjects();
|
||||
DIMouse::DirectInputUninit(window); // NB. do before window is destroyed
|
||||
|
@ -1135,7 +1135,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
}
|
||||
|
||||
case WM_DISPLAYCHANGE:
|
||||
VideoReinitialize();
|
||||
GetVideo().VideoReinitialize();
|
||||
break;
|
||||
|
||||
case WM_DROPFILES:
|
||||
|
@ -1186,18 +1186,12 @@ LRESULT CALLBACK FrameWndProc (
|
|||
// lparam = modifiers: shift, ctrl, alt, win
|
||||
if (wparam == VK_SNAPSHOT_560)
|
||||
{
|
||||
#if _DEBUG
|
||||
// MessageBox( GetFrame().g_hFrameWindow, "Double 580x384 size!", "PrintScreen", MB_OK );
|
||||
#endif
|
||||
Video_TakeScreenShot( SCREENSHOT_560x384 );
|
||||
GetVideo().Video_TakeScreenShot( Video::SCREENSHOT_560x384 );
|
||||
}
|
||||
else
|
||||
if (wparam == VK_SNAPSHOT_280) // ( lparam & MOD_SHIFT )
|
||||
{
|
||||
#if _DEBUG
|
||||
// MessageBox( GetFrame().g_hFrameWindow, "Normal 280x192 size!", "PrintScreen", MB_OK );
|
||||
#endif
|
||||
Video_TakeScreenShot( SCREENSHOT_280x192 );
|
||||
GetVideo().Video_TakeScreenShot( Video::SCREENSHOT_280x192 );
|
||||
}
|
||||
else
|
||||
if (wparam == VK_SNAPSHOT_TEXT) // ( lparam & MOD_CONTROL )
|
||||
|
@ -1238,25 +1232,21 @@ LRESULT CALLBACK FrameWndProc (
|
|||
|
||||
if ( !KeybGetCtrlStatus() && !KeybGetShiftStatus() ) // F9
|
||||
{
|
||||
g_eVideoType++;
|
||||
if (g_eVideoType >= NUM_VIDEO_MODES)
|
||||
g_eVideoType = 0;
|
||||
GetVideo().IncVideoType();
|
||||
}
|
||||
else if ( !KeybGetCtrlStatus() && KeybGetShiftStatus() ) // SHIFT+F9
|
||||
{
|
||||
if (g_eVideoType <= 0)
|
||||
g_eVideoType = NUM_VIDEO_MODES;
|
||||
g_eVideoType--;
|
||||
GetVideo().DecVideoType();
|
||||
}
|
||||
else if ( KeybGetCtrlStatus() && KeybGetShiftStatus() ) // CTRL+SHIFT+F9
|
||||
{
|
||||
SetVideoStyle( (VideoStyle_e) (GetVideoStyle() ^ VS_HALF_SCANLINES) );
|
||||
GetVideo().SetVideoStyle( (VideoStyle_e) (GetVideo().GetVideoStyle() ^ VS_HALF_SCANLINES) );
|
||||
}
|
||||
|
||||
// TODO: Clean up code:FrameRefreshStatus(DRAW_TITLE) DrawStatusArea((HDC)0,DRAW_TITLE)
|
||||
DrawStatusArea( (HDC)0, DRAW_TITLE );
|
||||
|
||||
VideoReinitialize(false);
|
||||
GetVideo().VideoReinitialize(false);
|
||||
|
||||
if (g_nAppMode != MODE_LOGO)
|
||||
{
|
||||
|
@ -1264,23 +1254,23 @@ LRESULT CALLBACK FrameWndProc (
|
|||
{
|
||||
UINT debugVideoMode;
|
||||
if ( DebugGetVideoMode(&debugVideoMode) )
|
||||
VideoRefreshScreen(debugVideoMode, true);
|
||||
GetVideo().VideoRefreshScreen(debugVideoMode, true);
|
||||
else
|
||||
VideoRefreshScreen();
|
||||
GetVideo().VideoRefreshScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
VideoRefreshScreen();
|
||||
GetVideo().VideoRefreshScreen();
|
||||
}
|
||||
}
|
||||
|
||||
Config_Save_Video();
|
||||
GetVideo().Config_Save_Video();
|
||||
}
|
||||
else if (wparam == VK_F10)
|
||||
{
|
||||
if (g_Apple2Type == A2TYPE_APPLE2E || g_Apple2Type == A2TYPE_APPLE2EENHANCED || g_Apple2Type == A2TYPE_BASE64A)
|
||||
{
|
||||
SetVideoRomRockerSwitch( !GetVideoRomRockerSwitch() ); // F10: toggle rocker switch
|
||||
GetVideo().SetVideoRomRockerSwitch( !GetVideo().GetVideoRomRockerSwitch() ); // F10: toggle rocker switch
|
||||
NTSC_VideoInitAppleType();
|
||||
}
|
||||
else if (g_Apple2Type == A2TYPE_PRAVETS8A)
|
||||
|
@ -1819,7 +1809,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
HCURSOR oldcursor = SetCursor(LoadCursor(0,IDC_WAIT));
|
||||
g_nAppMode = MODE_BENCHMARK;
|
||||
VideoBenchmark();
|
||||
GetVideo().Benchmark();
|
||||
g_nAppMode = MODE_LOGO;
|
||||
ResetMachineState();
|
||||
SetCursor(oldcursor);
|
||||
|
@ -2258,12 +2248,12 @@ void SetFullScreenMode ()
|
|||
width = (FULLSCREEN_SCALE_TYPE)(monitor_info.rcMonitor.right - monitor_info.rcMonitor.left);
|
||||
height = (FULLSCREEN_SCALE_TYPE)(monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top );
|
||||
|
||||
scalex = width / GetFrameBufferBorderlessWidth();
|
||||
scaley = height / GetFrameBufferBorderlessHeight();
|
||||
scalex = width / GetVideo().GetFrameBufferBorderlessWidth();
|
||||
scaley = height / GetVideo().GetFrameBufferBorderlessHeight();
|
||||
|
||||
g_win_fullscreen_scale = (scalex <= scaley) ? scalex : scaley;
|
||||
g_win_fullscreen_offsetx = ((int)width - (int)(g_win_fullscreen_scale * GetFrameBufferBorderlessWidth())) / 2;
|
||||
g_win_fullscreen_offsety = ((int)height - (int)(g_win_fullscreen_scale * GetFrameBufferBorderlessHeight())) / 2;
|
||||
g_win_fullscreen_offsetx = ((int)width - (int)(g_win_fullscreen_scale * GetVideo().GetFrameBufferBorderlessWidth())) / 2;
|
||||
g_win_fullscreen_offsety = ((int)height - (int)(g_win_fullscreen_scale * GetVideo().GetFrameBufferBorderlessHeight())) / 2;
|
||||
SetWindowPos(GetFrame().g_hFrameWindow, NULL, left, top, (int)width, (int)height, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
||||
g_bIsFullScreen = true;
|
||||
|
||||
|
@ -2351,8 +2341,8 @@ int Win32Frame::SetViewportScale(int nNewScale, bool bForce /*=false*/)
|
|||
nNewScale = g_nMaxViewportScale;
|
||||
|
||||
g_nViewportScale = nNewScale;
|
||||
g_nViewportCX = g_nViewportScale * GetFrameBufferBorderlessWidth();
|
||||
g_nViewportCY = g_nViewportScale * GetFrameBufferBorderlessHeight();
|
||||
g_nViewportCX = g_nViewportScale * GetVideo().GetFrameBufferBorderlessWidth();
|
||||
g_nViewportCY = g_nViewportScale * GetVideo().GetFrameBufferBorderlessHeight();
|
||||
|
||||
return nNewScale;
|
||||
}
|
||||
|
@ -2468,8 +2458,8 @@ void FrameCreateWindow(void)
|
|||
int nOldViewportCX = g_nViewportCX;
|
||||
int nOldViewportCY = g_nViewportCY;
|
||||
|
||||
g_nViewportCX = GetFrameBufferBorderlessWidth() * 2;
|
||||
g_nViewportCY = GetFrameBufferBorderlessHeight() * 2;
|
||||
g_nViewportCX = GetVideo().GetFrameBufferBorderlessWidth() * 2;
|
||||
g_nViewportCY = GetVideo().GetFrameBufferBorderlessHeight() * 2;
|
||||
GetWidthHeight(nWidth, nHeight); // Probe with 2x dimensions
|
||||
|
||||
g_nViewportCX = nOldViewportCX;
|
||||
|
@ -2844,8 +2834,8 @@ bool Win32Frame::GetBestDisplayResolutionForFullScreen(UINT& bestWidth, UINT& be
|
|||
{
|
||||
if (width > it->first)
|
||||
{
|
||||
UINT scaleFactor = it->second / GetFrameBufferBorderlessHeight();
|
||||
if (it->first >= (GetFrameBufferBorderlessWidth() * scaleFactor))
|
||||
UINT scaleFactor = it->second / GetVideo().GetFrameBufferBorderlessHeight();
|
||||
if (it->first >= (GetVideo().GetFrameBufferBorderlessWidth() * scaleFactor))
|
||||
{
|
||||
width = it->first;
|
||||
}
|
||||
|
@ -2865,12 +2855,12 @@ bool Win32Frame::GetBestDisplayResolutionForFullScreen(UINT& bestWidth, UINT& be
|
|||
UINT tmpBestHeight = 0;
|
||||
for (VEC_PAIR::iterator it = vecDisplayResolutions.begin(); it!= vecDisplayResolutions.end(); ++it)
|
||||
{
|
||||
if ((it->second % GetFrameBufferBorderlessHeight()) == 0)
|
||||
if ((it->second % GetVideo().GetFrameBufferBorderlessHeight()) == 0)
|
||||
{
|
||||
if (it->second > tmpBestHeight)
|
||||
{
|
||||
UINT scaleFactor = it->second / GetFrameBufferBorderlessHeight();
|
||||
if (it->first >= (GetFrameBufferBorderlessWidth() * scaleFactor))
|
||||
UINT scaleFactor = it->second / GetVideo().GetFrameBufferBorderlessHeight();
|
||||
if (it->first >= (GetVideo().GetFrameBufferBorderlessWidth() * scaleFactor))
|
||||
{
|
||||
tmpBestWidth = it->first;
|
||||
tmpBestHeight = it->second;
|
||||
|
|
|
@ -33,7 +33,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Windows/WinFrame.h"
|
||||
#include "Windows/AppleWin.h"
|
||||
#include "Interface.h"
|
||||
#include "Video.h"
|
||||
#include "Core.h"
|
||||
#include "CPU.h"
|
||||
#include "Joystick.h"
|
||||
|
@ -44,13 +43,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
#include "../resource/resource.h"
|
||||
|
||||
static COLORREF customcolors[256]; // MONOCHROME is last custom color
|
||||
static HBITMAP g_hLogoBitmap;
|
||||
static HBITMAP g_hDeviceBitmap;
|
||||
static HDC g_hDeviceDC;
|
||||
static LPBITMAPINFO g_pFramebufferinfo = NULL;
|
||||
|
||||
static void videoCreateDIBSection()
|
||||
void WinVideo::videoCreateDIBSection(void)
|
||||
{
|
||||
// CREATE THE DEVICE CONTEXT
|
||||
HWND window = GetDesktopWindow();
|
||||
|
@ -74,18 +67,16 @@ static void videoCreateDIBSection()
|
|||
SelectObject(g_hDeviceDC, g_hDeviceBitmap);
|
||||
|
||||
// DRAW THE SOURCE IMAGE INTO THE SOURCE BIT BUFFER
|
||||
memset(g_pFramebufferbits, 0, GetFrameBufferWidth() * GetFrameBufferHeight() * sizeof(bgra_t));
|
||||
memset(GetFrameBuffer(), 0, GetFrameBufferWidth() * GetFrameBufferHeight() * sizeof(bgra_t));
|
||||
|
||||
// CREATE THE OFFSET TABLE FOR EACH SCAN LINE IN THE FRAME BUFFER
|
||||
NTSC_VideoInit(g_pFramebufferbits);
|
||||
NTSC_VideoInit(GetFrameBuffer());
|
||||
}
|
||||
|
||||
//
|
||||
// ----- ALL GLOBALLY ACCESSIBLE FUNCTIONS ARE BELOW THIS LINE -----
|
||||
//
|
||||
|
||||
void WinVideoInitialize()
|
||||
void WinVideo::Initialize(void)
|
||||
{
|
||||
Video::Initialize();
|
||||
|
||||
// RESET THE VIDEO MODE SWITCHES AND THE CHARACTER SET OFFSET
|
||||
VideoResetState();
|
||||
|
||||
|
@ -105,11 +96,14 @@ void WinVideoInitialize()
|
|||
g_pFramebufferinfo->bmiHeader.biClrUsed = 0;
|
||||
|
||||
videoCreateDIBSection();
|
||||
|
||||
#if 0
|
||||
DDInit(); // For WaitForVerticalBlank()
|
||||
#endif
|
||||
}
|
||||
|
||||
void WinVideoDestroy()
|
||||
void WinVideo::Destroy(void)
|
||||
{
|
||||
|
||||
// DESTROY BUFFERS
|
||||
delete [] g_pFramebufferinfo;
|
||||
g_pFramebufferinfo = NULL;
|
||||
|
@ -119,7 +113,7 @@ void WinVideoDestroy()
|
|||
DeleteObject(g_hDeviceBitmap);
|
||||
g_hDeviceDC = (HDC)0;
|
||||
g_hDeviceBitmap = (HBITMAP)0;
|
||||
g_pFramebufferbits = NULL;
|
||||
SetFrameBuffer(NULL);
|
||||
|
||||
// DESTROY LOGO
|
||||
if (g_hLogoBitmap) {
|
||||
|
@ -128,10 +122,15 @@ void WinVideoDestroy()
|
|||
}
|
||||
|
||||
NTSC_Destroy();
|
||||
|
||||
DDUninit();
|
||||
|
||||
Video::Destroy();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void VideoBenchmark () {
|
||||
void WinVideo::Benchmark(void)
|
||||
{
|
||||
_ASSERT(g_nAppMode == MODE_BENCHMARK);
|
||||
Sleep(500);
|
||||
|
||||
|
@ -151,7 +150,7 @@ void VideoBenchmark () {
|
|||
// SIMULATE THE ACTIVITY OF AN AVERAGE GAME
|
||||
DWORD totaltextfps = 0;
|
||||
|
||||
g_uVideoMode = VF_TEXT;
|
||||
SetVideoMode(VF_TEXT);
|
||||
memset(mem+0x400,0x14,0x400);
|
||||
GetFrame().VideoRedrawScreen();
|
||||
DWORD milliseconds = GetTickCount();
|
||||
|
@ -173,7 +172,7 @@ void VideoBenchmark () {
|
|||
// GOING ON, CHANGING HALF OF THE BYTES IN THE VIDEO BUFFER EACH FRAME TO
|
||||
// SIMULATE THE ACTIVITY OF AN AVERAGE GAME
|
||||
DWORD totalhiresfps = 0;
|
||||
g_uVideoMode = VF_HIRES;
|
||||
SetVideoMode(VF_HIRES);
|
||||
memset(mem+0x2000,0x14,0x2000);
|
||||
GetFrame().VideoRedrawScreen();
|
||||
milliseconds = GetTickCount();
|
||||
|
@ -285,7 +284,7 @@ void VideoBenchmark () {
|
|||
} while (GetTickCount() - milliseconds < 1000);
|
||||
|
||||
// DISPLAY THE RESULTS
|
||||
VideoDisplayLogo();
|
||||
DisplayLogo();
|
||||
TCHAR outstr[256];
|
||||
wsprintf(outstr,
|
||||
TEXT("Pure Video FPS:\t%u hires, %u text\n")
|
||||
|
@ -304,20 +303,21 @@ void VideoBenchmark () {
|
|||
MB_ICONINFORMATION | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
// This is called from PageConfig
|
||||
//===========================================================================
|
||||
void VideoChooseMonochromeColor ()
|
||||
|
||||
// This is called from PageConfig
|
||||
void WinVideo::ChooseMonochromeColor(void)
|
||||
{
|
||||
CHOOSECOLOR cc;
|
||||
memset(&cc, 0, sizeof(CHOOSECOLOR));
|
||||
cc.lStructSize = sizeof(CHOOSECOLOR);
|
||||
cc.hwndOwner = GetFrame().g_hFrameWindow;
|
||||
cc.rgbResult = g_nMonochromeRGB;
|
||||
cc.rgbResult = GetMonochromeRGB();
|
||||
cc.lpCustColors = customcolors + 1;
|
||||
cc.Flags = CC_RGBINIT | CC_SOLIDCOLOR;
|
||||
if (ChooseColor(&cc))
|
||||
{
|
||||
g_nMonochromeRGB = cc.rgbResult;
|
||||
SetMonochromeRGB(cc.rgbResult);
|
||||
VideoReinitialize();
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ void VideoChooseMonochromeColor ()
|
|||
|
||||
//===========================================================================
|
||||
|
||||
static void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale)
|
||||
void WinVideo::VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale)
|
||||
{
|
||||
HDC hSrcDC = CreateCompatibleDC( hDstDC );
|
||||
SelectObject( hSrcDC, g_hLogoBitmap );
|
||||
|
@ -347,7 +347,8 @@ static void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int sr
|
|||
}
|
||||
|
||||
//===========================================================================
|
||||
void VideoDisplayLogo ()
|
||||
|
||||
void WinVideo::DisplayLogo(void)
|
||||
{
|
||||
int nLogoX = 0, nLogoY = 0;
|
||||
int scale = GetViewportScale();
|
||||
|
@ -420,15 +421,13 @@ void VideoDisplayLogo ()
|
|||
|
||||
//===========================================================================
|
||||
|
||||
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit /*=false*/)
|
||||
void WinVideo::VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit /*=false*/)
|
||||
{
|
||||
static DWORD dwFullSpeedStartTime = 0;
|
||||
// static bool bValid = false;
|
||||
|
||||
if (bInit)
|
||||
{
|
||||
// Just entered full-speed mode
|
||||
// bValid = false;
|
||||
dwFullSpeedStartTime = GetTickCount();
|
||||
return;
|
||||
}
|
||||
|
@ -439,54 +438,12 @@ void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit /*=fal
|
|||
|
||||
dwFullSpeedStartTime += dwFullSpeedDuration;
|
||||
|
||||
//
|
||||
|
||||
#if 0
|
||||
static BYTE text_main[1024*2] = {0}; // page1 & 2
|
||||
static BYTE text_aux[1024*2] = {0}; // page1 & 2
|
||||
static BYTE hgr_main[8192*2] = {0}; // page1 & 2
|
||||
static BYTE hgr_aux[8192*2] = {0}; // page1 & 2
|
||||
|
||||
bool bRedraw = true; // Always redraw for bValid==false (ie. just entered full-speed mode)
|
||||
|
||||
if (bValid)
|
||||
{
|
||||
if ((g_uVideoMode&(VF_DHIRES|VF_HIRES|VF_TEXT|VF_MIXED)) == VF_HIRES)
|
||||
{
|
||||
// HIRES (not MIXED) - eg. AZTEC.DSK
|
||||
if ((g_uVideoMode&VF_PAGE2) == 0)
|
||||
bRedraw = memcmp(&hgr_main[0x0000], MemGetMainPtr(0x2000), 8192) != 0;
|
||||
else
|
||||
bRedraw = memcmp(&hgr_main[0x2000], MemGetMainPtr(0x4000), 8192) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bRedraw =
|
||||
(memcmp(text_main, MemGetMainPtr(0x400), sizeof(text_main)) != 0) ||
|
||||
(memcmp(text_aux, MemGetAuxPtr(0x400), sizeof(text_aux)) != 0) ||
|
||||
(memcmp(hgr_main, MemGetMainPtr(0x2000), sizeof(hgr_main)) != 0) ||
|
||||
(memcmp(hgr_aux, MemGetAuxPtr(0x2000), sizeof(hgr_aux)) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (bRedraw)
|
||||
VideoRedrawScreenAfterFullSpeed(dwCyclesThisFrame);
|
||||
|
||||
// Copy all video memory (+ screen holes)
|
||||
memcpy(text_main, MemGetMainPtr(0x400), sizeof(text_main));
|
||||
memcpy(text_aux, MemGetAuxPtr(0x400), sizeof(text_aux));
|
||||
memcpy(hgr_main, MemGetMainPtr(0x2000), sizeof(hgr_main));
|
||||
memcpy(hgr_aux, MemGetAuxPtr(0x2000), sizeof(hgr_aux));
|
||||
|
||||
bValid = true;
|
||||
#else
|
||||
VideoRedrawScreenAfterFullSpeed(dwCyclesThisFrame);
|
||||
#endif
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame)
|
||||
void WinVideo::VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame)
|
||||
{
|
||||
NTSC_VideoClockResync(dwCyclesThisFrame);
|
||||
GetFrame().VideoRedrawScreen(); // Better (no flicker) than using: NTSC_VideoReinitialize() or VideoReinitialize()
|
||||
|
@ -494,15 +451,7 @@ void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame)
|
|||
|
||||
//===========================================================================
|
||||
|
||||
void Win32Frame::VideoRedrawScreen (void)
|
||||
{
|
||||
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'GR,PAGE1,non-mixed' mode == 0x00.
|
||||
VideoRefreshScreen( g_uVideoMode, true );
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRedrawWholeScreen /* =false*/ )
|
||||
void WinVideo::VideoRefreshScreen(uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRedrawWholeScreen /* =false*/)
|
||||
{
|
||||
if (bRedrawWholeScreen || g_nAppMode == MODE_PAUSED)
|
||||
{
|
||||
|
@ -552,36 +501,31 @@ void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRe
|
|||
|
||||
//===========================================================================
|
||||
|
||||
#define MAX_DRAW_DEVICES 10
|
||||
|
||||
static char *draw_devices[MAX_DRAW_DEVICES];
|
||||
static GUID draw_device_guid[MAX_DRAW_DEVICES];
|
||||
static int num_draw_devices = 0;
|
||||
static LPDIRECTDRAW g_lpDD = NULL;
|
||||
|
||||
static BOOL CALLBACK DDEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext)
|
||||
BOOL CALLBACK WinVideo::DDEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext)
|
||||
{
|
||||
int i = num_draw_devices;
|
||||
WinVideo* obj = (WinVideo*)lpContext;
|
||||
|
||||
int i = obj->num_draw_devices;
|
||||
if (i == MAX_DRAW_DEVICES)
|
||||
return TRUE;
|
||||
if (lpGUID != NULL)
|
||||
memcpy(&draw_device_guid[i], lpGUID, sizeof (GUID));
|
||||
draw_devices[i] = _strdup(lpszDesc);
|
||||
memcpy(&(obj->draw_device_guid[i]), lpGUID, sizeof (GUID));
|
||||
obj->draw_devices[i] = _strdup(lpszDesc);
|
||||
|
||||
if (g_fh) fprintf(g_fh, "%d: %s - %s\n",i,lpszDesc,lpszDrvName);
|
||||
|
||||
num_draw_devices++;
|
||||
(obj->num_draw_devices)++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool DDInit(void)
|
||||
bool WinVideo::DDInit(void)
|
||||
{
|
||||
#ifdef NO_DIRECT_X
|
||||
|
||||
return false;
|
||||
|
||||
#else
|
||||
HRESULT hr = DirectDrawEnumerate((LPDDENUMCALLBACK)DDEnumProc, NULL);
|
||||
HRESULT hr = DirectDrawEnumerate((LPDDENUMCALLBACK)DDEnumProc, this);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
LogFileOutput("DSEnumerate failed (%08X)\n", hr);
|
||||
|
@ -617,7 +561,7 @@ bool DDInit(void)
|
|||
// From SoundCore.h
|
||||
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
||||
|
||||
void DDUninit(void)
|
||||
void WinVideo::DDUninit(void)
|
||||
{
|
||||
SAFE_RELEASE(g_lpDD);
|
||||
}
|
||||
|
@ -626,12 +570,22 @@ void DDUninit(void)
|
|||
|
||||
//===========================================================================
|
||||
|
||||
void Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename)
|
||||
void WinVideo::Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename)
|
||||
{
|
||||
_ASSERT(pScreenshotFilename);
|
||||
if (!pScreenshotFilename)
|
||||
return;
|
||||
|
||||
GetFrame().VideoRedrawScreen();
|
||||
Video_SaveScreenShot(SCREENSHOT_560x384, pScreenshotFilename);
|
||||
Video_SaveScreenShot(Video::SCREENSHOT_560x384, pScreenshotFilename);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//===========================================================================
|
||||
|
||||
// NB. Win32Frame, not WinVideo
|
||||
void Win32Frame::VideoRedrawScreen(void)
|
||||
{
|
||||
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'GR,PAGE1,non-mixed' mode == 0x00.
|
||||
GetVideo().VideoRefreshScreen( GetVideo().GetVideoMode(), true );
|
||||
}
|
||||
|
|
|
@ -1,18 +1,48 @@
|
|||
#pragma once
|
||||
|
||||
// Prototypes _______________________________________________________
|
||||
#include "Video.h"
|
||||
|
||||
void WinVideoInitialize();
|
||||
void WinVideoDestroy();
|
||||
class WinVideo : public Video
|
||||
{
|
||||
public:
|
||||
WinVideo()
|
||||
{
|
||||
g_pFramebufferinfo = NULL;
|
||||
num_draw_devices = 0;
|
||||
g_lpDD = NULL;
|
||||
}
|
||||
|
||||
void VideoBenchmark ();
|
||||
void VideoChooseMonochromeColor (); // FIXME: Should be moved to PageConfig and call VideoSetMonochromeColor()
|
||||
void VideoDisplayLogo ();
|
||||
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false);
|
||||
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
|
||||
void VideoRefreshScreen (uint32_t uRedrawWholeScreenVideoMode = 0, bool bRedrawWholeScreen = false);
|
||||
virtual ~WinVideo()
|
||||
{
|
||||
}
|
||||
|
||||
void Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename);
|
||||
virtual void Initialize(void);
|
||||
virtual void Destroy(void);
|
||||
|
||||
virtual void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false);
|
||||
virtual void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
|
||||
virtual void VideoRefreshScreen(uint32_t uRedrawWholeScreenVideoMode = 0, bool bRedrawWholeScreen = false);
|
||||
virtual void Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename);
|
||||
virtual void ChooseMonochromeColor(void);
|
||||
virtual void Benchmark(void);
|
||||
virtual void DisplayLogo(void);
|
||||
|
||||
private:
|
||||
void videoCreateDIBSection(void);
|
||||
void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale);
|
||||
static BOOL CALLBACK DDEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext);
|
||||
bool DDInit(void);
|
||||
void DDUninit(void);
|
||||
|
||||
COLORREF customcolors[256]; // MONOCHROME is last custom color
|
||||
HBITMAP g_hLogoBitmap;
|
||||
HBITMAP g_hDeviceBitmap;
|
||||
HDC g_hDeviceDC;
|
||||
LPBITMAPINFO g_pFramebufferinfo;
|
||||
|
||||
static const UINT MAX_DRAW_DEVICES = 10;
|
||||
char *draw_devices[MAX_DRAW_DEVICES];
|
||||
GUID draw_device_guid[MAX_DRAW_DEVICES];
|
||||
int num_draw_devices;
|
||||
LPDIRECTDRAW g_lpDD;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue