diff --git a/AppleWin/source/Applewin.cpp b/AppleWin/source/Applewin.cpp index 8122397a..fb288198 100644 --- a/AppleWin/source/Applewin.cpp +++ b/AppleWin/source/Applewin.cpp @@ -459,9 +459,9 @@ void LoadConfiguration () HD_SetEnabled(dwTmp ? true : false); 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); - 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); 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)); - Snapshot_SetFilename(szFilename); // If not in Registry than default will be used + RegLoadString(TEXT(REG_CONFIG),TEXT(REGVALUE_SAVESTATE_FILENAME),1,szFilename,sizeof(szFilename)); + 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 - RegLoadString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,g_sCurrentDir,MAX_PATH); - SetCurrentImageDir(); - - char szUthernetInt[MAX_PATH] = {0}; - RegLoadString(TEXT("Configuration"),TEXT("Uthernet Interface"),1,szUthernetInt,MAX_PATH); - update_tfe_interface(szUthernetInt,NULL); + // Current/Starting Dir is the "root" of where the user keeps his disk images + RegLoadString(TEXT(REG_PREFS),TEXT(REGVALUE_PREF_START_DIR),1,g_sCurrentDir,MAX_PATH); + SetCurrentImageDir(); + 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() { - BOOL bStatus = RegisterHotKey( + BOOL bStatus = true; + + bStatus &= RegisterHotKey( g_hFrameWindow , // HWND hWnd - VK_SNAPSHOT , // int id (user/custom id) + VK_SNAPSHOT_560 , // int id (user/custom id) 0 , // UINT fsModifiers 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) { MessageBox( g_hFrameWindow, "Unable to capture PrintScreen key", "Warning", MB_OK ); diff --git a/AppleWin/source/Common.h b/AppleWin/source/Common.h index 96a6f670..fa922232 100644 --- a/AppleWin/source/Common.h +++ b/AppleWin/source/Common.h @@ -75,6 +75,7 @@ enum AppMode_e #define SAVE(a,b) RegSaveValue(TEXT("Configuration"),a,1,b) // Configuration +#define REG_CONFIG "Configuration" #define REGVALUE_APPLE2_TYPE "Apple2 Type" #define REGVALUE_SPKR_VOLUME "Speaker Volume" #define REGVALUE_MB_VOLUME "Mockingboard Volume" @@ -96,12 +97,17 @@ enum AppMode_e #define REGVALUE_Z80_IN_SLOT5 "Z80 in slot 5" // Preferences +#define REG_PREFS "Preferences" #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_RESTART WM_USER+2 #define WM_USER_SAVESTATE WM_USER+3 #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 diff --git a/AppleWin/source/Disk.cpp b/AppleWin/source/Disk.cpp index d7a39892..e2e06259 100644 --- a/AppleWin/source/Disk.cpp +++ b/AppleWin/source/Disk.cpp @@ -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 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 -#if (LOG_DISK_ENABLED) && !defined(_VC71) - #define LOG_DISK(format, ...) LOG(format, __VA_ARGS__) +#if (LOG_DISK_ENABLED) + #if !defined(_VC71) + #define LOG_DISK(format, ...) LOG(format, __VA_ARGS__) + #else + #define LOG_DISK LogOutput + #endif #else - #define LOG_DISK(...) + #if !defined(_VC71) + #define LOG_DISK(...) + #else + #define LOG_DISK(x) + #endif #endif // Public _________________________________________________________________________________________ BOOL enhancedisk = 1; + // dynamic array of strings string DiskPathFilename[]; - + bool bSaveDiskImage = true; + // Private ________________________________________________________________________________________ const int MAX_DISK_IMAGE_NAME = 15; @@ -89,6 +99,49 @@ static void ReadTrack (int drive); static void RemoveDisk (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 () { DWORD modechange = (floppymotoron && !g_aFloppyDisk[currdrive].spinning); @@ -207,7 +260,7 @@ static void ReadTrack (int iDrive) 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( pFloppy->imagehandle, @@ -245,6 +298,9 @@ static void RemoveDisk (int iDrive) memset( pFloppy->imagename, 0, MAX_DISK_IMAGE_NAME+1 ); memset( pFloppy->fullname , 0, MAX_DISK_FULL_NAME +1 ); DiskPathFilename[iDrive] = ""; + + Disk_SaveLastDiskImage( iDrive ); + Video_ResetScreenshotCounter( NULL ); } //=========================================================================== @@ -344,8 +400,13 @@ static BYTE __stdcall DiskControlStepper (WORD, WORD address, BYTE, BYTE, ULONG) //=========================================================================== void DiskDestroy () { + bSaveDiskImage = false; RemoveDisk(0); + + bSaveDiskImage = false; RemoveDisk(1); + + bSaveDiskImage = true; } //=========================================================================== @@ -406,17 +467,15 @@ void DiskInitialize () TCHAR imagefilename[MAX_PATH]; _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) - RemoveDisk(drive); + RemoveDisk(iDrive); ZeroMemory(fptr,sizeof(Disk_t )); fptr->writeprotected = writeprotected; @@ -429,9 +488,18 @@ int DiskInsert (int drive, LPCTSTR imagefilename, BOOL writeprotected, BOOL crea if (error == IMAGE_ERROR_NONE) { 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; } @@ -564,24 +632,26 @@ void DiskSelectImage (int drive, LPSTR pszFilename) ofn.Flags = OFN_PATHMUSTEXIST; ofn.lpstrTitle = title; - if (GetOpenFileName(&ofn)) - { - if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension]) - _tcscat(filename,TEXT(".DSK")); + if (GetOpenFileName(&ofn)) + { + if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension]) + _tcscat(filename,TEXT(".DSK")); - int error = DiskInsert(drive,filename,ofn.Flags & OFN_READONLY,1); - if (!error) - { - DiskPathFilename[drive] = filename; - filename[ofn.nFileOffset] = 0; - if (_tcsicmp(directory,filename)) - RegSaveString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,filename); - } - else - { - DiskNotifyInvalidImage(filename,error); + int error = DiskInsert(drive,filename,ofn.Flags & OFN_READONLY,1); + if (!error) + { + DiskPathFilename[drive] = filename; + filename[ofn.nFileOffset] = 0; + if (_tcsicmp(directory,filename)) + { + RegSaveString(TEXT(REG_PREFS),TEXT(REGVALUE_PREF_START_DIR),1,filename); + } + } + else + { + DiskNotifyInvalidImage(filename,error); + } } - } } //=========================================================================== diff --git a/AppleWin/source/Disk.h b/AppleWin/source/Disk.h index 9bb34c78..deb16fc0 100644 --- a/AppleWin/source/Disk.h +++ b/AppleWin/source/Disk.h @@ -39,3 +39,6 @@ bool DiskDriveSwap(); void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot); DWORD DiskGetSnapshot(SS_CARD_DISK2* pSS, DWORD dwSlot); DWORD DiskSetSnapshot(SS_CARD_DISK2* pSS, DWORD dwSlot); + +void Disk_LoadLastDiskImage( int iDrive ); +void Disk_SaveLastDiskImage( int iDrive ); diff --git a/AppleWin/source/Frame.cpp b/AppleWin/source/Frame.cpp index f5d97038..a3b75ea0 100644 --- a/AppleWin/source/Frame.cpp +++ b/AppleWin/source/Frame.cpp @@ -32,18 +32,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "..\resource\resource.h" #include -#define ENABLE_MENU 0 +//#define ENABLE_MENU 0 // Magic numbers (used by FrameCreateWindow to calc width/height): #define MAGICX 5 // 3D border between Apple window & Emulator's RHS buttons #define MAGICY 5 // 3D border between Apple window & Title bar -#define VIEWPORTCX 560 -#if ENABLE_MENU -#define VIEWPORTCY 400 -#else -#define VIEWPORTCY 384 -#endif +#define VIEWPORTCX FRAMEBUFFER_W +#define VIEWPORTCY FRAMEBUFFER_H + #define BUTTONX (VIEWPORTCX + VIEWPORTX*2) #define BUTTONY 0 #define BUTTONCX 45 @@ -704,9 +701,23 @@ LRESULT CALLBACK FrameWndProc ( case WM_HOTKEY: // wparam = user id // 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; diff --git a/AppleWin/source/Frame.h b/AppleWin/source/Frame.h index 20469167..8a58290a 100644 --- a/AppleWin/source/Frame.h +++ b/AppleWin/source/Frame.h @@ -6,6 +6,11 @@ enum {NOT_ASCII=0, ASCII}; #define VIEWPORTX 5 #define VIEWPORTY 5 +// 560 = Double Hi-Res +// 384 = Doule Scan Line +#define FRAMEBUFFER_W 560 +#define FRAMEBUFFER_H 384 + // Win32 extern HWND g_hFrameWindow; extern HDC g_hFrameDC; diff --git a/AppleWin/source/PropertySheetPage.cpp b/AppleWin/source/PropertySheetPage.cpp index 62044cf9..1fb72cb4 100644 --- a/AppleWin/source/PropertySheetPage.cpp +++ b/AppleWin/source/PropertySheetPage.cpp @@ -1011,10 +1011,10 @@ static void SaveStateUpdate() { 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]) - RegSaveString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,g_szSSNewDirectory); + RegSaveString(TEXT(REG_PREFS),REGVALUE_PREF_START_DIR,1,g_szSSNewDirectory); } } diff --git a/AppleWin/source/Registry.cpp b/AppleWin/source/Registry.cpp index 72a077b5..e3cdb7d7 100644 --- a/AppleWin/source/Registry.cpp +++ b/AppleWin/source/Registry.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //=========================================================================== BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars) { - BOOL success = 0; + int success = 0; TCHAR fullkeyname[256]; wsprintf(fullkeyname, TEXT("Software\\AppleWin\\CurrentVersion\\%s"), diff --git a/AppleWin/source/Video.cpp b/AppleWin/source/Video.cpp index 6602fe6c..33ae1569 100644 --- a/AppleWin/source/Video.cpp +++ b/AppleWin/source/Video.cpp @@ -195,8 +195,7 @@ static HDC g_hDeviceDC; static LPBYTE g_pFramebufferbits; static LPBITMAPINFO g_pFramebufferinfo; -const int MAX_FRAME_Y = 384; // 192 scan lines * 2x zoom = 384 -static LPBYTE frameoffsettable[384]; +static LPBYTE frameoffsettable[FRAMEBUFFER_H]; static LPBYTE g_pHiresBank1; static LPBYTE g_pHiresBank0; HBITMAP g_hLogoBitmap; @@ -212,7 +211,7 @@ static LPBYTE g_pTextBank0; // Main // For tv emulation g_nAppMode // 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 WORD colormixmap[6][6][6]; // @@ -261,7 +260,8 @@ void DrawTextSource (HDC dc); bool g_bDisplayPrintScreenFileName = false; void Util_MakeScreenShotFileName( char *pFinalFileName_ ); bool Util_TestScreenShotFileName( const char *pFileName ); -void Video_TakeScreenShot(); +// true = 280x192 +// false = 560x384 void Video_SaveScreenShot( const char *pScreenShotFileName ); void Video_MakeScreenShot( FILE *pFile ); @@ -1474,7 +1474,9 @@ BOOL VideoApparentlyDirty () if (SW_MIXED || g_VideoForceFullRedraw) 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; while (length--) if (*(memdirty+(address++)) & 2) @@ -1487,7 +1489,7 @@ BOOL VideoApparentlyDirty () // Scan visible text page for any flashing chars 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): // . Skip 8-char holes in TEXT @@ -1817,16 +1819,12 @@ void VideoDestroy () { //=========================================================================== 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 ); SelectObject( hSrcDC, g_hLogoBitmap ); BitBlt( hDstDC, // hdcDest 0, 0, // nXDest, nYDest - 560, 384, // nWidth, nHeight // HACK: HARD-CODED + FRAMEBUFFER_W, FRAMEBUFFER_H, // nWidth, nHeight hSrcDC, // hdcSrc 0, 0, // nXSrc, nYSrc SRCCOPY // dwRop @@ -1850,7 +1848,7 @@ void VideoDisplayLogo () { { SelectObject(hFrameDC,brush); 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 @@ -1918,8 +1916,8 @@ void VideoInitialize () { PAGE_READWRITE); ZeroMemory(g_pFramebufferinfo,sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)); g_pFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - g_pFramebufferinfo->bmiHeader.biWidth = 560; - g_pFramebufferinfo->bmiHeader.biHeight = 384; + g_pFramebufferinfo->bmiHeader.biWidth = FRAMEBUFFER_W; + g_pFramebufferinfo->bmiHeader.biHeight = FRAMEBUFFER_H; g_pFramebufferinfo->bmiHeader.biPlanes = 1; g_pFramebufferinfo->bmiHeader.biBitCount = 8; g_pFramebufferinfo->bmiHeader.biClrUsed = 256; @@ -1979,10 +1977,10 @@ void _Video_Dirty() //=========================================================================== void _Video_SetupBanks( bool bBank2 ) { - g_pHiresBank1 = MemGetAuxPtr (0x2000 << bBank2); - g_pHiresBank0 = MemGetMainPtr(0x2000 << bBank2); - g_pTextBank1 = MemGetAuxPtr (0x400 << bBank2); - g_pTextBank0 = MemGetMainPtr(0x400 << bBank2); + g_pHiresBank1 = MemGetAuxPtr (0x2000 << (int)bBank2); + g_pHiresBank0 = MemGetMainPtr(0x2000 << (int)bBank2); + g_pTextBank1 = MemGetAuxPtr (0x400 << (int)bBank2); + g_pTextBank0 = MemGetMainPtr(0x400 << (int)bBank2); } //=========================================================================== @@ -2015,7 +2013,7 @@ void VideoRefreshScreen () { void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed ) { LPBYTE addr = g_pFramebufferbits; - LONG pitch = 560; + LONG pitch = FRAMEBUFFER_W; HDC framedc = FrameGetVideoDC(&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 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(); } #else @@ -2094,7 +2092,7 @@ void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed ) else remainingdirty = 1; 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; while ((y+height < 24) && celldirty[startx][y+height] @@ -2105,7 +2103,7 @@ void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed ) g_hDeviceDC,start,ypixel,SRCCOPY); while (height--) { int loop = startx; - while (loop < x+(xpixel == 560)) + while (loop < x+(xpixel == FRAMEBUFFER_W)) celldirty[loop++][y+height] = 0; } start = -1; @@ -2445,19 +2443,31 @@ bool VideoGetVbl(const DWORD uExecutedCycles) #define SCREENSHOT_TGA 0 // alias for nSuffixScreenShotFileName -static int nLastScreenShot = 0; +static int g_nLastScreenShot = 0; const int nMaxScreenShot = 999999999; + +static int g_iScreenshotType; +static char *g_pLastDiskImageName = NULL; + //const int nMaxScreenShot = 2; +//=========================================================================== +void Video_ResetScreenshotCounter( char *pImageName ) +{ + g_nLastScreenShot = 0; + g_pLastDiskImageName = pImageName; +} + //=========================================================================== 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 - sprintf( pFinalFileName_, "%s%09d.bmp", sPrefixScreenShotFileName, nLastScreenShot ); + sprintf( pFinalFileName_, "%s_%09d.bmp", pPrefixFileName, g_nLastScreenShot ); #endif #if SCREENSHOT_TGA - sprintf( pFinalFileName_, "%s%09d.tga", sPrefixScreenShotFileName, nLastScreenShot ); + sprintf( pFinalFileName_, "%s%09d.tga", pPrefixFileName, g_nLastScreenShot ); #endif } @@ -2476,19 +2486,21 @@ bool Util_TestScreenShotFileName( const char *pFileName ) } //=========================================================================== -void Video_TakeScreenShot() +void Video_TakeScreenShot( int iScreenShotType ) { char sScreenShotFileName[ MAX_PATH ]; + g_iScreenshotType = iScreenShotType; + // find last screenshot filename so we don't overwrite the existing user ones bool bExists = true; 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 ); MessageBox( NULL, sScreenShotFileName, "Warning", MB_OK ); - nLastScreenShot = 0; + g_nLastScreenShot = 0; return; } @@ -2498,11 +2510,11 @@ void Video_TakeScreenShot() { break; } - nLastScreenShot++; + g_nLastScreenShot++; } Video_SaveScreenShot( sScreenShotFileName ); - nLastScreenShot++; + g_nLastScreenShot++; } @@ -2595,8 +2607,8 @@ void Video_MakeScreenShot(FILE *pFile) g_tBmpHeader.nReserved2 = 0; g_tBmpHeader.nOffsetData = sizeof(WinBmpHeader_t) + (256 * sizeof(bgra_t)); g_tBmpHeader.nStructSize = 0x28; // sizeof( WinBmpHeader_t ); - g_tBmpHeader.nWidthPixels = 560; - g_tBmpHeader.nHeightPixels = MAX_FRAME_Y; + g_tBmpHeader.nWidthPixels = g_iScreenshotType ? FRAMEBUFFER_W/2 :FRAMEBUFFER_W; + g_tBmpHeader.nHeightPixels = g_iScreenshotType ? FRAMEBUFFER_H/2 : FRAMEBUFFER_H; g_tBmpHeader.nPlanes = 1; g_tBmpHeader.nBitsPerPixel = 8; 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 pSrc = ((u8*)g_pFramebufferbits); 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 #if SCREENSHOT_TGA @@ -2638,8 +2674,8 @@ void Video_MakeScreenShot(FILE *pFile) memset( (void*)pHeader, 0, sizeof( TargaHeader_t ) ); pHeader->iImageType = TARGA_RGB; - pHeader->nWidthPixels = 580; - pHeader->nHeightPixels = MAX_FRAME_Y; + pHeader->nWidthPixels = FRAMEBUFFER_W; + pHeader->nHeightPixels = FRAMEBUFFER_H; pHeader->nBitsPerPixel = 24; #endif // SCREENSHOT_TGA diff --git a/AppleWin/source/Video.h b/AppleWin/source/Video.h index 2059ce90..a4f56c40 100644 --- a/AppleWin/source/Video.h +++ b/AppleWin/source/Video.h @@ -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 UpdateDHiResCell (int x, int y, int xpixel, int ypixel, int offset); - - 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 VideoCheckVbl (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);