1.15.0.3 changes

This commit is contained in:
mpohoreski 2008-08-31 04:31:35 +00:00
parent 17d59aeed0
commit 40a33661d3
10 changed files with 239 additions and 93 deletions

View File

@ -459,9 +459,9 @@ void LoadConfiguration ()
HD_SetEnabled(dwTmp ? true : false); HD_SetEnabled(dwTmp ? true : false);
char szHDFilename[MAX_PATH] = {0}; char szHDFilename[MAX_PATH] = {0};
if(RegLoadString(TEXT("Configuration"), TEXT(REGVALUE_HDD_IMAGE1), 1, szHDFilename, sizeof(szHDFilename))) if(RegLoadString(TEXT(REG_CONFIG), TEXT(REGVALUE_HDD_IMAGE1), 1, szHDFilename, sizeof(szHDFilename)))
HD_InsertDisk2(0, szHDFilename); HD_InsertDisk2(0, szHDFilename);
if(RegLoadString(TEXT("Configuration"), TEXT(REGVALUE_HDD_IMAGE2), 1, szHDFilename, sizeof(szHDFilename))) if(RegLoadString(TEXT(REG_CONFIG), TEXT(REGVALUE_HDD_IMAGE2), 1, szHDFilename, sizeof(szHDFilename)))
HD_InsertDisk2(1, szHDFilename); HD_InsertDisk2(1, szHDFilename);
if(LOAD(TEXT(REGVALUE_PDL_XTRIM), &dwTmp)) if(LOAD(TEXT(REGVALUE_PDL_XTRIM), &dwTmp))
@ -495,19 +495,21 @@ void LoadConfiguration ()
// //
char szFilename[MAX_PATH] = {0}; char szFilename[MAX_PATH] = {0};
RegLoadString(TEXT("Configuration"),TEXT(REGVALUE_SAVESTATE_FILENAME),1,szFilename,sizeof(szFilename)); RegLoadString(TEXT(REG_CONFIG),TEXT(REGVALUE_SAVESTATE_FILENAME),1,szFilename,sizeof(szFilename));
Snapshot_SetFilename(szFilename); // If not in Registry than default will be used Snapshot_SetFilename(szFilename); // If not in Registry than default will be used
// Current/Starting Dir is the "root" of where the user keeps his disk images // Current/Starting Dir is the "root" of where the user keeps his disk images
RegLoadString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,g_sCurrentDir,MAX_PATH); RegLoadString(TEXT(REG_PREFS),TEXT(REGVALUE_PREF_START_DIR),1,g_sCurrentDir,MAX_PATH);
SetCurrentImageDir(); SetCurrentImageDir();
char szUthernetInt[MAX_PATH] = {0};
RegLoadString(TEXT("Configuration"),TEXT("Uthernet Interface"),1,szUthernetInt,MAX_PATH);
update_tfe_interface(szUthernetInt,NULL);
Disk_LoadLastDiskImage(0);
Disk_LoadLastDiskImage(1);
char szUthernetInt[MAX_PATH] = {0};
RegLoadString(TEXT(REG_CONFIG),TEXT("Uthernet Interface"),1,szUthernetInt,MAX_PATH);
update_tfe_interface(szUthernetInt,NULL);
} }
//=========================================================================== //===========================================================================
@ -567,13 +569,22 @@ void RegisterExtensions ()
//=========================================================================== //===========================================================================
void AppleWin_RegisterHotKeys() void AppleWin_RegisterHotKeys()
{ {
BOOL bStatus = RegisterHotKey( BOOL bStatus = true;
bStatus &= RegisterHotKey(
g_hFrameWindow , // HWND hWnd g_hFrameWindow , // HWND hWnd
VK_SNAPSHOT , // int id (user/custom id) VK_SNAPSHOT_560 , // int id (user/custom id)
0 , // UINT fsModifiers 0 , // UINT fsModifiers
VK_SNAPSHOT // UINT vk = PrintScreen VK_SNAPSHOT // UINT vk = PrintScreen
); );
bStatus &= RegisterHotKey(
g_hFrameWindow , // HWND hWnd
VK_SNAPSHOT_280, // int id (user/custom id)
MOD_SHIFT , // UINT fsModifiers
VK_SNAPSHOT // UINT vk = PrintScreen
);
if (! bStatus) if (! bStatus)
{ {
MessageBox( g_hFrameWindow, "Unable to capture PrintScreen key", "Warning", MB_OK ); MessageBox( g_hFrameWindow, "Unable to capture PrintScreen key", "Warning", MB_OK );

View File

@ -75,6 +75,7 @@ enum AppMode_e
#define SAVE(a,b) RegSaveValue(TEXT("Configuration"),a,1,b) #define SAVE(a,b) RegSaveValue(TEXT("Configuration"),a,1,b)
// Configuration // Configuration
#define REG_CONFIG "Configuration"
#define REGVALUE_APPLE2_TYPE "Apple2 Type" #define REGVALUE_APPLE2_TYPE "Apple2 Type"
#define REGVALUE_SPKR_VOLUME "Speaker Volume" #define REGVALUE_SPKR_VOLUME "Speaker Volume"
#define REGVALUE_MB_VOLUME "Mockingboard Volume" #define REGVALUE_MB_VOLUME "Mockingboard Volume"
@ -96,12 +97,17 @@ enum AppMode_e
#define REGVALUE_Z80_IN_SLOT5 "Z80 in slot 5" #define REGVALUE_Z80_IN_SLOT5 "Z80 in slot 5"
// Preferences // Preferences
#define REG_PREFS "Preferences"
#define REGVALUE_PREF_START_DIR "Starting Directory" #define REGVALUE_PREF_START_DIR "Starting Directory"
#define REGVALUE_PREF_LAST_DISK_1 "Last Disk Image 1"
#define REGVALUE_PREF_LAST_DISK_2 "Last Disk Image 2"
#define WM_USER_BENCHMARK WM_USER+1 #define WM_USER_BENCHMARK WM_USER+1
#define WM_USER_RESTART WM_USER+2 #define WM_USER_RESTART WM_USER+2
#define WM_USER_SAVESTATE WM_USER+3 #define WM_USER_SAVESTATE WM_USER+3
#define WM_USER_LOADSTATE WM_USER+4 #define WM_USER_LOADSTATE WM_USER+4
#define VK_SNAPSHOT_560 WM_USER+5
#define VK_SNAPSHOT_280 WM_USER+6
enum eSOUNDCARDTYPE {SC_UNINIT=0, SC_NONE, SC_MOCKINGBOARD, SC_PHASOR}; // Apple soundcard type enum eSOUNDCARDTYPE {SC_UNINIT=0, SC_NONE, SC_MOCKINGBOARD, SC_PHASOR}; // Apple soundcard type

View File

@ -38,20 +38,30 @@ static BYTE __stdcall DiskSetLatchValue (WORD pc, WORD addr, BYTE bWrite, BYTE d
static BYTE __stdcall DiskSetReadMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft); static BYTE __stdcall DiskSetReadMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
static BYTE __stdcall DiskSetWriteMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft); static BYTE __stdcall DiskSetWriteMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
#define LOG_DISK_ENABLED 1 #define LOG_DISK_ENABLED 0
// __VA_ARGS__ not supported on MSVC++ .NET 7.x // __VA_ARGS__ not supported on MSVC++ .NET 7.x
#if (LOG_DISK_ENABLED) && !defined(_VC71) #if (LOG_DISK_ENABLED)
#define LOG_DISK(format, ...) LOG(format, __VA_ARGS__) #if !defined(_VC71)
#define LOG_DISK(format, ...) LOG(format, __VA_ARGS__)
#else
#define LOG_DISK LogOutput
#endif
#else #else
#define LOG_DISK(...) #if !defined(_VC71)
#define LOG_DISK(...)
#else
#define LOG_DISK(x)
#endif
#endif #endif
// Public _________________________________________________________________________________________ // Public _________________________________________________________________________________________
BOOL enhancedisk = 1; BOOL enhancedisk = 1;
// dynamic array of strings
string DiskPathFilename[]; string DiskPathFilename[];
bool bSaveDiskImage = true;
// Private ________________________________________________________________________________________ // Private ________________________________________________________________________________________
const int MAX_DISK_IMAGE_NAME = 15; const int MAX_DISK_IMAGE_NAME = 15;
@ -89,6 +99,49 @@ static void ReadTrack (int drive);
static void RemoveDisk (int drive); static void RemoveDisk (int drive);
static void WriteTrack (int drive); static void WriteTrack (int drive);
// ________________________________________________________________________________________________
//===========================================================================
void Disk_LoadLastDiskImage( int iDrive )
{
char sFilePath[ MAX_PATH + 1];
sFilePath[0] = 0;
char *pRegKey = (!iDrive)
? REGVALUE_PREF_LAST_DISK_1
: REGVALUE_PREF_LAST_DISK_2;
if( RegLoadString(TEXT(REG_PREFS),pRegKey,1,sFilePath,MAX_PATH) )
{
sFilePath[ MAX_PATH ] = 0;
DiskPathFilename[ iDrive ] = sFilePath;
const char *pFileName = DiskPathFilename[iDrive].c_str();
#if _DEBUG
// MessageBox(NULL,pFileName,pRegKey,MB_OK);
#endif
// _tcscat(imagefilename,TEXT("MASTER.DSK")); // TODO: Should remember last disk by user
bSaveDiskImage = false;
DiskInsert(iDrive,pFileName,0,0);
bSaveDiskImage = true;
}
//else MessageBox(NULL,"Reg Key/Value not found",pRegKey,MB_OK);
}
//===========================================================================
void Disk_SaveLastDiskImage( int iDrive )
{
const char *pFileName = DiskPathFilename[iDrive].c_str();
if( bSaveDiskImage )
{
if( !iDrive )
RegSaveString(TEXT(REG_PREFS),REGVALUE_PREF_LAST_DISK_1,1,pFileName );
else
RegSaveString(TEXT(REG_PREFS),REGVALUE_PREF_LAST_DISK_2,1,pFileName );
}
}
//=========================================================================== //===========================================================================
void CheckSpinning () { void CheckSpinning () {
DWORD modechange = (floppymotoron && !g_aFloppyDisk[currdrive].spinning); DWORD modechange = (floppymotoron && !g_aFloppyDisk[currdrive].spinning);
@ -207,7 +260,7 @@ static void ReadTrack (int iDrive)
if (pFloppy->trackimage && pFloppy->imagehandle) if (pFloppy->trackimage && pFloppy->imagehandle)
{ {
LOG_DISK("read track %2X%s\r", pFloppy->track, (pFloppy->phase & 1) ? ".5" : ""); LOG_DISK("read track %2X%s\r", pFloppy->track, (pFloppy->phase & 1) ? ".5" : "");
ImageReadTrack( ImageReadTrack(
pFloppy->imagehandle, pFloppy->imagehandle,
@ -245,6 +298,9 @@ static void RemoveDisk (int iDrive)
memset( pFloppy->imagename, 0, MAX_DISK_IMAGE_NAME+1 ); memset( pFloppy->imagename, 0, MAX_DISK_IMAGE_NAME+1 );
memset( pFloppy->fullname , 0, MAX_DISK_FULL_NAME +1 ); memset( pFloppy->fullname , 0, MAX_DISK_FULL_NAME +1 );
DiskPathFilename[iDrive] = ""; DiskPathFilename[iDrive] = "";
Disk_SaveLastDiskImage( iDrive );
Video_ResetScreenshotCounter( NULL );
} }
//=========================================================================== //===========================================================================
@ -344,8 +400,13 @@ static BYTE __stdcall DiskControlStepper (WORD, WORD address, BYTE, BYTE, ULONG)
//=========================================================================== //===========================================================================
void DiskDestroy () void DiskDestroy ()
{ {
bSaveDiskImage = false;
RemoveDisk(0); RemoveDisk(0);
bSaveDiskImage = false;
RemoveDisk(1); RemoveDisk(1);
bSaveDiskImage = true;
} }
//=========================================================================== //===========================================================================
@ -406,17 +467,15 @@ void DiskInitialize ()
TCHAR imagefilename[MAX_PATH]; TCHAR imagefilename[MAX_PATH];
_tcscpy(imagefilename,g_sProgramDir); _tcscpy(imagefilename,g_sProgramDir);
_tcscat(imagefilename,TEXT("MASTER.DSK")); // TODO: Should remember last disk by user
DiskInsert(0,imagefilename,0,0);
} }
//=========================================================================== //===========================================================================
int DiskInsert (int drive, LPCTSTR imagefilename, BOOL writeprotected, BOOL createifnecessary) int DiskInsert (int iDrive, LPCTSTR imagefilename, BOOL writeprotected, BOOL createifnecessary)
{ {
Disk_t * fptr = &g_aFloppyDisk[drive]; Disk_t * fptr = &g_aFloppyDisk[iDrive];
if (fptr->imagehandle) if (fptr->imagehandle)
RemoveDisk(drive); RemoveDisk(iDrive);
ZeroMemory(fptr,sizeof(Disk_t )); ZeroMemory(fptr,sizeof(Disk_t ));
fptr->writeprotected = writeprotected; fptr->writeprotected = writeprotected;
@ -429,9 +488,18 @@ int DiskInsert (int drive, LPCTSTR imagefilename, BOOL writeprotected, BOOL crea
if (error == IMAGE_ERROR_NONE) if (error == IMAGE_ERROR_NONE)
{ {
GetImageTitle(imagefilename,fptr); GetImageTitle(imagefilename,fptr);
DiskPathFilename[drive]= imagefilename; DiskPathFilename[iDrive]= imagefilename;
//MessageBox( NULL, imagefilename, fptr->imagename, MB_OK );
Video_ResetScreenshotCounter( fptr->imagename );
}
else
{
Video_ResetScreenshotCounter( NULL );
} }
Disk_SaveLastDiskImage( iDrive );
return error; return error;
} }
@ -564,24 +632,26 @@ void DiskSelectImage (int drive, LPSTR pszFilename)
ofn.Flags = OFN_PATHMUSTEXIST; ofn.Flags = OFN_PATHMUSTEXIST;
ofn.lpstrTitle = title; ofn.lpstrTitle = title;
if (GetOpenFileName(&ofn)) if (GetOpenFileName(&ofn))
{ {
if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension]) if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension])
_tcscat(filename,TEXT(".DSK")); _tcscat(filename,TEXT(".DSK"));
int error = DiskInsert(drive,filename,ofn.Flags & OFN_READONLY,1); int error = DiskInsert(drive,filename,ofn.Flags & OFN_READONLY,1);
if (!error) if (!error)
{ {
DiskPathFilename[drive] = filename; DiskPathFilename[drive] = filename;
filename[ofn.nFileOffset] = 0; filename[ofn.nFileOffset] = 0;
if (_tcsicmp(directory,filename)) if (_tcsicmp(directory,filename))
RegSaveString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,filename); {
} RegSaveString(TEXT(REG_PREFS),TEXT(REGVALUE_PREF_START_DIR),1,filename);
else }
{ }
DiskNotifyInvalidImage(filename,error); else
{
DiskNotifyInvalidImage(filename,error);
}
} }
}
} }
//=========================================================================== //===========================================================================

View File

@ -39,3 +39,6 @@ bool DiskDriveSwap();
void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot); void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot);
DWORD DiskGetSnapshot(SS_CARD_DISK2* pSS, DWORD dwSlot); DWORD DiskGetSnapshot(SS_CARD_DISK2* pSS, DWORD dwSlot);
DWORD DiskSetSnapshot(SS_CARD_DISK2* pSS, DWORD dwSlot); DWORD DiskSetSnapshot(SS_CARD_DISK2* pSS, DWORD dwSlot);
void Disk_LoadLastDiskImage( int iDrive );
void Disk_SaveLastDiskImage( int iDrive );

View File

@ -32,18 +32,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "..\resource\resource.h" #include "..\resource\resource.h"
#include <sys/stat.h> #include <sys/stat.h>
#define ENABLE_MENU 0 //#define ENABLE_MENU 0
// Magic numbers (used by FrameCreateWindow to calc width/height): // Magic numbers (used by FrameCreateWindow to calc width/height):
#define MAGICX 5 // 3D border between Apple window & Emulator's RHS buttons #define MAGICX 5 // 3D border between Apple window & Emulator's RHS buttons
#define MAGICY 5 // 3D border between Apple window & Title bar #define MAGICY 5 // 3D border between Apple window & Title bar
#define VIEWPORTCX 560 #define VIEWPORTCX FRAMEBUFFER_W
#if ENABLE_MENU #define VIEWPORTCY FRAMEBUFFER_H
#define VIEWPORTCY 400
#else
#define VIEWPORTCY 384
#endif
#define BUTTONX (VIEWPORTCX + VIEWPORTX*2) #define BUTTONX (VIEWPORTCX + VIEWPORTX*2)
#define BUTTONY 0 #define BUTTONY 0
#define BUTTONCX 45 #define BUTTONCX 45
@ -704,9 +701,23 @@ LRESULT CALLBACK FrameWndProc (
case WM_HOTKEY: case WM_HOTKEY:
// wparam = user id // wparam = user id
// lparam = modifiers: shift, ctrl, alt, win // lparam = modifiers: shift, ctrl, alt, win
if (wparam == VK_SNAPSHOT) if (wparam == VK_SNAPSHOT_560)
{ {
Video_TakeScreenShot(); #if _DEBUG
// MessageBox( NULL, "Double 580x384 size!", "PrintScreen", MB_OK );
#endif
Video_TakeScreenShot( SCREENSHOT_560x384 );
}
else
if (wparam == VK_SNAPSHOT_280)
{
if( lparam & MOD_SHIFT)
{
#if _DEBUG
// MessageBox( NULL, "Normal 280x192 size!", "PrintScreen", MB_OK );
#endif
}
Video_TakeScreenShot( SCREENSHOT_280x192 );
} }
break; break;

View File

@ -6,6 +6,11 @@ enum {NOT_ASCII=0, ASCII};
#define VIEWPORTX 5 #define VIEWPORTX 5
#define VIEWPORTY 5 #define VIEWPORTY 5
// 560 = Double Hi-Res
// 384 = Doule Scan Line
#define FRAMEBUFFER_W 560
#define FRAMEBUFFER_H 384
// Win32 // Win32
extern HWND g_hFrameWindow; extern HWND g_hFrameWindow;
extern HDC g_hFrameDC; extern HDC g_hFrameDC;

View File

@ -1011,10 +1011,10 @@ static void SaveStateUpdate()
{ {
Snapshot_SetFilename(g_szSSNewFilename); Snapshot_SetFilename(g_szSSNewFilename);
RegSaveString(TEXT("Configuration"),REGVALUE_SAVESTATE_FILENAME,1,Snapshot_GetFilename()); RegSaveString(TEXT(REG_CONFIG),REGVALUE_SAVESTATE_FILENAME,1,Snapshot_GetFilename());
if(g_szSSNewDirectory[0]) if(g_szSSNewDirectory[0])
RegSaveString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,g_szSSNewDirectory); RegSaveString(TEXT(REG_PREFS),REGVALUE_PREF_START_DIR,1,g_szSSNewDirectory);
} }
} }

View File

@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//=========================================================================== //===========================================================================
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser,
LPTSTR buffer, DWORD chars) { LPTSTR buffer, DWORD chars) {
BOOL success = 0; int success = 0;
TCHAR fullkeyname[256]; TCHAR fullkeyname[256];
wsprintf(fullkeyname, wsprintf(fullkeyname,
TEXT("Software\\AppleWin\\CurrentVersion\\%s"), TEXT("Software\\AppleWin\\CurrentVersion\\%s"),

View File

@ -195,8 +195,7 @@ static HDC g_hDeviceDC;
static LPBYTE g_pFramebufferbits; static LPBYTE g_pFramebufferbits;
static LPBITMAPINFO g_pFramebufferinfo; static LPBITMAPINFO g_pFramebufferinfo;
const int MAX_FRAME_Y = 384; // 192 scan lines * 2x zoom = 384 static LPBYTE frameoffsettable[FRAMEBUFFER_H];
static LPBYTE frameoffsettable[384];
static LPBYTE g_pHiresBank1; static LPBYTE g_pHiresBank1;
static LPBYTE g_pHiresBank0; static LPBYTE g_pHiresBank0;
HBITMAP g_hLogoBitmap; HBITMAP g_hLogoBitmap;
@ -212,7 +211,7 @@ static LPBYTE g_pTextBank0; // Main
// For tv emulation g_nAppMode // For tv emulation g_nAppMode
// 2 extra scan lines on bottom? // 2 extra scan lines on bottom?
static BYTE hgrpixelmatrix[280][192 + 2 * HGR_MATRIX_YOFFSET]; static BYTE hgrpixelmatrix[FRAMEBUFFER_W/2][FRAMEBUFFER_H/2 + 2 * HGR_MATRIX_YOFFSET];
static BYTE colormixbuffer[6]; static BYTE colormixbuffer[6];
static WORD colormixmap[6][6][6]; static WORD colormixmap[6][6][6];
// //
@ -261,7 +260,8 @@ void DrawTextSource (HDC dc);
bool g_bDisplayPrintScreenFileName = false; bool g_bDisplayPrintScreenFileName = false;
void Util_MakeScreenShotFileName( char *pFinalFileName_ ); void Util_MakeScreenShotFileName( char *pFinalFileName_ );
bool Util_TestScreenShotFileName( const char *pFileName ); bool Util_TestScreenShotFileName( const char *pFileName );
void Video_TakeScreenShot(); // true = 280x192
// false = 560x384
void Video_SaveScreenShot( const char *pScreenShotFileName ); void Video_SaveScreenShot( const char *pScreenShotFileName );
void Video_MakeScreenShot( FILE *pFile ); void Video_MakeScreenShot( FILE *pFile );
@ -1474,7 +1474,9 @@ BOOL VideoApparentlyDirty ()
if (SW_MIXED || g_VideoForceFullRedraw) if (SW_MIXED || g_VideoForceFullRedraw)
return 1; return 1;
DWORD address = (SW_HIRES && !SW_TEXT) ? (0x20 << g_bVideoDisplayPage2) : (0x4 << g_bVideoDisplayPage2); DWORD address = (SW_HIRES && !SW_TEXT)
? (0x20 << (int)g_bVideoDisplayPage2)
: (0x04 << (int)g_bVideoDisplayPage2);
DWORD length = (SW_HIRES && !SW_TEXT) ? 0x20 : 0x4; DWORD length = (SW_HIRES && !SW_TEXT) ? 0x20 : 0x4;
while (length--) while (length--)
if (*(memdirty+(address++)) & 2) if (*(memdirty+(address++)) & 2)
@ -1487,7 +1489,7 @@ BOOL VideoApparentlyDirty ()
// Scan visible text page for any flashing chars // Scan visible text page for any flashing chars
if((SW_TEXT || SW_MIXED) && (g_nAltCharSetOffset == 0)) if((SW_TEXT || SW_MIXED) && (g_nAltCharSetOffset == 0))
{ {
BYTE* pnMemText = MemGetMainPtr(0x400 << g_bVideoDisplayPage2); BYTE* pnMemText = MemGetMainPtr(0x400 << (int)g_bVideoDisplayPage2);
// Scan 8 long-lines of 120 chars (at 128 char offsets): // Scan 8 long-lines of 120 chars (at 128 char offsets):
// . Skip 8-char holes in TEXT // . Skip 8-char holes in TEXT
@ -1817,16 +1819,12 @@ void VideoDestroy () {
//=========================================================================== //===========================================================================
void VideoDrawLogoBitmap ( HDC hDstDC ) void VideoDrawLogoBitmap ( HDC hDstDC )
{ {
// HDC memdc = CreateCompatibleDC(framedc);
// SelectObject(memdc,g_hLogoBitmap);
// BitBlt(framedc,0,0,560,384,memdc,0,0,SRCCOPY);
// DeleteDC(memdc);
HDC hSrcDC = CreateCompatibleDC( hDstDC ); HDC hSrcDC = CreateCompatibleDC( hDstDC );
SelectObject( hSrcDC, g_hLogoBitmap ); SelectObject( hSrcDC, g_hLogoBitmap );
BitBlt( BitBlt(
hDstDC, // hdcDest hDstDC, // hdcDest
0, 0, // nXDest, nYDest 0, 0, // nXDest, nYDest
560, 384, // nWidth, nHeight // HACK: HARD-CODED FRAMEBUFFER_W, FRAMEBUFFER_H, // nWidth, nHeight
hSrcDC, // hdcSrc hSrcDC, // hdcSrc
0, 0, // nXSrc, nYSrc 0, 0, // nXSrc, nYSrc
SRCCOPY // dwRop SRCCOPY // dwRop
@ -1850,7 +1848,7 @@ void VideoDisplayLogo () {
{ {
SelectObject(hFrameDC,brush); SelectObject(hFrameDC,brush);
SelectObject(hFrameDC,GetStockObject(NULL_PEN)); SelectObject(hFrameDC,GetStockObject(NULL_PEN));
Rectangle(hFrameDC,0,0,560+1,384+1); Rectangle(hFrameDC,0,0,FRAMEBUFFER_W+1,FRAMEBUFFER_H+1);
} }
// DRAW THE VERSION NUMBER // DRAW THE VERSION NUMBER
@ -1918,8 +1916,8 @@ void VideoInitialize () {
PAGE_READWRITE); PAGE_READWRITE);
ZeroMemory(g_pFramebufferinfo,sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)); ZeroMemory(g_pFramebufferinfo,sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD));
g_pFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); g_pFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
g_pFramebufferinfo->bmiHeader.biWidth = 560; g_pFramebufferinfo->bmiHeader.biWidth = FRAMEBUFFER_W;
g_pFramebufferinfo->bmiHeader.biHeight = 384; g_pFramebufferinfo->bmiHeader.biHeight = FRAMEBUFFER_H;
g_pFramebufferinfo->bmiHeader.biPlanes = 1; g_pFramebufferinfo->bmiHeader.biPlanes = 1;
g_pFramebufferinfo->bmiHeader.biBitCount = 8; g_pFramebufferinfo->bmiHeader.biBitCount = 8;
g_pFramebufferinfo->bmiHeader.biClrUsed = 256; g_pFramebufferinfo->bmiHeader.biClrUsed = 256;
@ -1979,10 +1977,10 @@ void _Video_Dirty()
//=========================================================================== //===========================================================================
void _Video_SetupBanks( bool bBank2 ) void _Video_SetupBanks( bool bBank2 )
{ {
g_pHiresBank1 = MemGetAuxPtr (0x2000 << bBank2); g_pHiresBank1 = MemGetAuxPtr (0x2000 << (int)bBank2);
g_pHiresBank0 = MemGetMainPtr(0x2000 << bBank2); g_pHiresBank0 = MemGetMainPtr(0x2000 << (int)bBank2);
g_pTextBank1 = MemGetAuxPtr (0x400 << bBank2); g_pTextBank1 = MemGetAuxPtr (0x400 << (int)bBank2);
g_pTextBank0 = MemGetMainPtr(0x400 << bBank2); g_pTextBank0 = MemGetMainPtr(0x400 << (int)bBank2);
} }
//=========================================================================== //===========================================================================
@ -2015,7 +2013,7 @@ void VideoRefreshScreen () {
void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed ) void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed )
{ {
LPBYTE addr = g_pFramebufferbits; LPBYTE addr = g_pFramebufferbits;
LONG pitch = 560; LONG pitch = FRAMEBUFFER_W;
HDC framedc = FrameGetVideoDC(&addr,&pitch); HDC framedc = FrameGetVideoDC(&addr,&pitch);
CreateFrameOffsetTable(addr,pitch); CreateFrameOffsetTable(addr,pitch);
@ -2062,7 +2060,7 @@ void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed )
// . Oliver Schmidt gets a flickering mouse cursor with this code // . Oliver Schmidt gets a flickering mouse cursor with this code
if (framedc && anydirty) if (framedc && anydirty)
{ {
BitBlt(framedc,0,0,560,384,g_hDeviceDC,0,0,SRCCOPY); BitBlt(framedc,0,0,FRAMEBUFFER_W,FRAMEBUFFER_H,g_hDeviceDC,0,0,SRCCOPY);
GdiFlush(); GdiFlush();
} }
#else #else
@ -2094,7 +2092,7 @@ void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed )
else else
remainingdirty = 1; remainingdirty = 1;
if ((start >= 0) && !celldirty[x][y]) { if ((start >= 0) && !celldirty[x][y]) {
if ((x - startx > 1) || ((x == 39) && (xpixel == 560))) { if ((x - startx > 1) || ((x == 39) && (xpixel == FRAMEBUFFER_W))) {
int height = 1; int height = 1;
while ((y+height < 24) while ((y+height < 24)
&& celldirty[startx][y+height] && celldirty[startx][y+height]
@ -2105,7 +2103,7 @@ void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed )
g_hDeviceDC,start,ypixel,SRCCOPY); g_hDeviceDC,start,ypixel,SRCCOPY);
while (height--) { while (height--) {
int loop = startx; int loop = startx;
while (loop < x+(xpixel == 560)) while (loop < x+(xpixel == FRAMEBUFFER_W))
celldirty[loop++][y+height] = 0; celldirty[loop++][y+height] = 0;
} }
start = -1; start = -1;
@ -2445,19 +2443,31 @@ bool VideoGetVbl(const DWORD uExecutedCycles)
#define SCREENSHOT_TGA 0 #define SCREENSHOT_TGA 0
// alias for nSuffixScreenShotFileName // alias for nSuffixScreenShotFileName
static int nLastScreenShot = 0; static int g_nLastScreenShot = 0;
const int nMaxScreenShot = 999999999; const int nMaxScreenShot = 999999999;
static int g_iScreenshotType;
static char *g_pLastDiskImageName = NULL;
//const int nMaxScreenShot = 2; //const int nMaxScreenShot = 2;
//===========================================================================
void Video_ResetScreenshotCounter( char *pImageName )
{
g_nLastScreenShot = 0;
g_pLastDiskImageName = pImageName;
}
//=========================================================================== //===========================================================================
void Util_MakeScreenShotFileName( char *pFinalFileName_ ) void Util_MakeScreenShotFileName( char *pFinalFileName_ )
{ {
const char sPrefixScreenShotFileName[] = "AppleWin_ScreenShot_"; char sPrefixScreenShotFileName[ 256 ] = "AppleWin_ScreenShot";
char *pPrefixFileName = g_pLastDiskImageName ? g_pLastDiskImageName : sPrefixScreenShotFileName;
#if SCREENSHOT_BMP #if SCREENSHOT_BMP
sprintf( pFinalFileName_, "%s%09d.bmp", sPrefixScreenShotFileName, nLastScreenShot ); sprintf( pFinalFileName_, "%s_%09d.bmp", pPrefixFileName, g_nLastScreenShot );
#endif #endif
#if SCREENSHOT_TGA #if SCREENSHOT_TGA
sprintf( pFinalFileName_, "%s%09d.tga", sPrefixScreenShotFileName, nLastScreenShot ); sprintf( pFinalFileName_, "%s%09d.tga", pPrefixFileName, g_nLastScreenShot );
#endif #endif
} }
@ -2476,19 +2486,21 @@ bool Util_TestScreenShotFileName( const char *pFileName )
} }
//=========================================================================== //===========================================================================
void Video_TakeScreenShot() void Video_TakeScreenShot( int iScreenShotType )
{ {
char sScreenShotFileName[ MAX_PATH ]; char sScreenShotFileName[ MAX_PATH ];
g_iScreenshotType = iScreenShotType;
// find last screenshot filename so we don't overwrite the existing user ones // find last screenshot filename so we don't overwrite the existing user ones
bool bExists = true; bool bExists = true;
while( bExists ) while( bExists )
{ {
if (nLastScreenShot > nMaxScreenShot) // Holy Crap! User has maxed the number of screenshots!? if (g_nLastScreenShot > nMaxScreenShot) // Holy Crap! User has maxed the number of screenshots!?
{ {
sprintf( sScreenShotFileName, "You have more then %d screenshot filenames! They will no longer be saved.\n\nEither move some of your screenshots or increase the maximum in video.cpp\n", nMaxScreenShot ); sprintf( sScreenShotFileName, "You have more then %d screenshot filenames! They will no longer be saved.\n\nEither move some of your screenshots or increase the maximum in video.cpp\n", nMaxScreenShot );
MessageBox( NULL, sScreenShotFileName, "Warning", MB_OK ); MessageBox( NULL, sScreenShotFileName, "Warning", MB_OK );
nLastScreenShot = 0; g_nLastScreenShot = 0;
return; return;
} }
@ -2498,11 +2510,11 @@ void Video_TakeScreenShot()
{ {
break; break;
} }
nLastScreenShot++; g_nLastScreenShot++;
} }
Video_SaveScreenShot( sScreenShotFileName ); Video_SaveScreenShot( sScreenShotFileName );
nLastScreenShot++; g_nLastScreenShot++;
} }
@ -2595,8 +2607,8 @@ void Video_MakeScreenShot(FILE *pFile)
g_tBmpHeader.nReserved2 = 0; g_tBmpHeader.nReserved2 = 0;
g_tBmpHeader.nOffsetData = sizeof(WinBmpHeader_t) + (256 * sizeof(bgra_t)); g_tBmpHeader.nOffsetData = sizeof(WinBmpHeader_t) + (256 * sizeof(bgra_t));
g_tBmpHeader.nStructSize = 0x28; // sizeof( WinBmpHeader_t ); g_tBmpHeader.nStructSize = 0x28; // sizeof( WinBmpHeader_t );
g_tBmpHeader.nWidthPixels = 560; g_tBmpHeader.nWidthPixels = g_iScreenshotType ? FRAMEBUFFER_W/2 :FRAMEBUFFER_W;
g_tBmpHeader.nHeightPixels = MAX_FRAME_Y; g_tBmpHeader.nHeightPixels = g_iScreenshotType ? FRAMEBUFFER_H/2 : FRAMEBUFFER_H;
g_tBmpHeader.nPlanes = 1; g_tBmpHeader.nPlanes = 1;
g_tBmpHeader.nBitsPerPixel = 8; g_tBmpHeader.nBitsPerPixel = 8;
g_tBmpHeader.nCompression = BI_RGB; g_tBmpHeader.nCompression = BI_RGB;
@ -2630,7 +2642,31 @@ void Video_MakeScreenShot(FILE *pFile)
// @reference: "Storing an Image" http://msdn.microsoft.com/en-us/library/ms532340(VS.85).aspx // @reference: "Storing an Image" http://msdn.microsoft.com/en-us/library/ms532340(VS.85).aspx
pSrc = ((u8*)g_pFramebufferbits); pSrc = ((u8*)g_pFramebufferbits);
nLen = g_tBmpHeader.nWidthPixels * g_tBmpHeader.nHeightPixels * g_tBmpHeader.nBitsPerPixel / 8; nLen = g_tBmpHeader.nWidthPixels * g_tBmpHeader.nHeightPixels * g_tBmpHeader.nBitsPerPixel / 8;
fwrite( pSrc, nLen, 1, pFile );
if( g_iScreenshotType == SCREENSHOT_280x192 )
{
u8 aScanLine[ 280 ];
u8 *pDst;
// HACK HACK HACK -- authentic mode zero's out odd rows, force to a scanline that has data
pSrc += FRAMEBUFFER_W;
for( int y = 0; y < FRAMEBUFFER_H/2; y++ )
{
pDst = aScanLine;
for( int x = 0; x < FRAMEBUFFER_W/2; x++ )
{
*pDst++ = *pSrc;
pSrc += 2; // skip odd pixels
}
fwrite( aScanLine, FRAMEBUFFER_W/2, 1, pFile );
pSrc += FRAMEBUFFER_W; // scan lines doubled - skip odd ones
}
}
else
{
fwrite( pSrc, nLen, 1, pFile );
}
#endif // SCREENSHOT_BMP #endif // SCREENSHOT_BMP
#if SCREENSHOT_TGA #if SCREENSHOT_TGA
@ -2638,8 +2674,8 @@ void Video_MakeScreenShot(FILE *pFile)
memset( (void*)pHeader, 0, sizeof( TargaHeader_t ) ); memset( (void*)pHeader, 0, sizeof( TargaHeader_t ) );
pHeader->iImageType = TARGA_RGB; pHeader->iImageType = TARGA_RGB;
pHeader->nWidthPixels = 580; pHeader->nWidthPixels = FRAMEBUFFER_W;
pHeader->nHeightPixels = MAX_FRAME_Y; pHeader->nHeightPixels = FRAMEBUFFER_H;
pHeader->nBitsPerPixel = 24; pHeader->nBitsPerPixel = 24;
#endif // SCREENSHOT_TGA #endif // SCREENSHOT_TGA

View File

@ -87,10 +87,14 @@ bool UpdateDLoResCell (int x, int y, int xpixel, int ypixel, int offset);
bool UpdateHiResCell (int x, int y, int xpixel, int ypixel, int offset); bool UpdateHiResCell (int x, int y, int xpixel, int ypixel, int offset);
bool UpdateDHiResCell (int x, int y, int xpixel, int ypixel, int offset); bool UpdateDHiResCell (int x, int y, int xpixel, int ypixel, int offset);
extern bool g_bDisplayPrintScreenFileName; extern bool g_bDisplayPrintScreenFileName;
void Video_TakeScreenShot(); void Video_ResetScreenshotCounter( char *pDiskImageFileName );
enum VideoScreenShot_e
{
SCREENSHOT_560x384 = 0,
SCREENSHOT_280x192
};
void Video_TakeScreenShot( int iScreenShotType );
BYTE __stdcall VideoCheckMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft); BYTE __stdcall VideoCheckMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
BYTE __stdcall VideoCheckVbl (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft); BYTE __stdcall VideoCheckVbl (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);