mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-01 14:41:33 +00:00
Added test cmd-line switch: -screenshot-and-exit <file.bmp>
This commit is contained in:
parent
4d9a3edd48
commit
ffa41e35cc
|
@ -1179,6 +1179,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
int newVideoType = -1;
|
||||
int newVideoStyleEnableMask = 0;
|
||||
int newVideoStyleDisableMask = 0;
|
||||
LPSTR szScreenshotFilename = NULL;
|
||||
|
||||
while (*lpCmdLine)
|
||||
{
|
||||
|
@ -1415,6 +1416,11 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
{
|
||||
newVideoStyleDisableMask = VS_COLOR_VERTICAL_BLEND;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-screenshot-and-exit") == 0) // GH#616: For testing - Use in combination with -load-state
|
||||
{
|
||||
szScreenshotFilename = GetCurrArg(lpNextArg);
|
||||
lpNextArg = GetNextArg(lpNextArg);
|
||||
}
|
||||
else // unsupported
|
||||
{
|
||||
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
|
||||
|
@ -1655,6 +1661,12 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
LogFileOutput("Main: Snapshot_Startup()\n");
|
||||
}
|
||||
|
||||
if (szScreenshotFilename)
|
||||
{
|
||||
Video_RedrawAndTakeScreenShot(szScreenshotFilename);
|
||||
bShutdown = true;
|
||||
}
|
||||
|
||||
if (bShutdown)
|
||||
{
|
||||
PostMessage(g_hFrameWindow, WM_DESTROY, 0, 0); // Close everything down
|
||||
|
|
|
@ -127,7 +127,7 @@ static const bool g_bVideoScannerNTSC = true; // NTSC video scanning (or PAL)
|
|||
bool g_bShowPrintScreenWarningDialog = true;
|
||||
void Util_MakeScreenShotFileName( char *pFinalFileName_ );
|
||||
bool Util_TestScreenShotFileName( const char *pFileName );
|
||||
void Video_SaveScreenShot( const char *pScreenShotFileName, const VideoScreenShot_e ScreenShotType );
|
||||
void Video_SaveScreenShot( const VideoScreenShot_e ScreenShotType, const char *pScreenShotFileName );
|
||||
void Video_MakeScreenShot( FILE *pFile, const VideoScreenShot_e ScreenShotType );
|
||||
void videoCreateDIBSection();
|
||||
|
||||
|
@ -959,10 +959,20 @@ void Video_TakeScreenShot( const VideoScreenShot_e ScreenShotType )
|
|||
g_nLastScreenShot++;
|
||||
}
|
||||
|
||||
Video_SaveScreenShot( sScreenShotFileName, ScreenShotType );
|
||||
Video_SaveScreenShot( ScreenShotType, sScreenShotFileName );
|
||||
g_nLastScreenShot++;
|
||||
}
|
||||
|
||||
void Video_RedrawAndTakeScreenShot( const char* pScreenshotFilename )
|
||||
{
|
||||
_ASSERT(pScreenshotFilename);
|
||||
if (!pScreenshotFilename)
|
||||
return;
|
||||
|
||||
VideoRedrawScreen();
|
||||
Video_SaveScreenShot( SCREENSHOT_560x384, pScreenshotFilename );
|
||||
}
|
||||
|
||||
WinBmpHeader_t g_tBmpHeader;
|
||||
|
||||
#if SCREENSHOT_TGA
|
||||
|
@ -1121,7 +1131,7 @@ static void Video_MakeScreenShot(FILE *pFile, const VideoScreenShot_e ScreenShot
|
|||
}
|
||||
|
||||
//===========================================================================
|
||||
static void Video_SaveScreenShot( const char *pScreenShotFileName, const VideoScreenShot_e ScreenShotType )
|
||||
static void Video_SaveScreenShot( const VideoScreenShot_e ScreenShotType, const char *pScreenShotFileName )
|
||||
{
|
||||
FILE *pFile = fopen( pScreenShotFileName, "wb" );
|
||||
if( pFile )
|
||||
|
|
|
@ -204,7 +204,8 @@ enum VideoScreenShot_e
|
|||
SCREENSHOT_560x384 = 0,
|
||||
SCREENSHOT_280x192
|
||||
};
|
||||
void Video_TakeScreenShot( VideoScreenShot_e iScreenShotType );
|
||||
void Video_TakeScreenShot( VideoScreenShot_e ScreenShotType );
|
||||
void Video_RedrawAndTakeScreenShot( const char* pScreenshotFilename );
|
||||
void Video_SetBitmapHeader( WinBmpHeader_t *pBmp, int nWidth, int nHeight, int nBitsPerPixel );
|
||||
|
||||
BYTE VideoSetMode(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
|
||||
|
|
Loading…
Reference in New Issue
Block a user