mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 14:50:17 +00:00
Removed the screenshot code. (The SDL backend already has the ability to
make screenshots.) svn-id: r10382
This commit is contained in:
parent
f2f5f9a9af
commit
bef1facdbc
@ -169,189 +169,6 @@ int32 EraseBackBuffer( void ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int32 SaveScreenShot(uint8 *buffer, uint8 *palette)
|
||||
{
|
||||
|
||||
static uint16 pcxCount = 0;
|
||||
int virtualWidth;
|
||||
int pix;
|
||||
int keyPix;
|
||||
int line;
|
||||
int i;
|
||||
int runLength;
|
||||
char filename[80];
|
||||
unsigned char ch;
|
||||
unsigned char *pcxData;
|
||||
unsigned char pal[256*3];
|
||||
FILE *fp;
|
||||
_pcxHeader pcxHead;
|
||||
|
||||
sprintf(filename, "snap%.4d.pcx", pcxCount);
|
||||
|
||||
fp = fopen(filename, "wb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
sprintf(filename, "c:\\snap%.4d.pcx", pcxCount);
|
||||
fp = fopen(filename, "wb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
pcxCount += 1;
|
||||
|
||||
// Set up and write the header
|
||||
pcxHead.manufacturer = 0x0a;
|
||||
pcxHead.version = 5;
|
||||
pcxHead.encoding = 1;
|
||||
pcxHead.bitsPerPixel = 8;
|
||||
pcxHead.xmin = 0;
|
||||
pcxHead.ymin = 0;
|
||||
pcxHead.xmax = 639;
|
||||
pcxHead.ymax = 479;
|
||||
pcxHead.hres = 72;
|
||||
pcxHead.vres = 72;
|
||||
pcxHead.reserved = 0;
|
||||
pcxHead.colourPlanes = 1;
|
||||
pcxHead.bytesPerLine = 640;
|
||||
pcxHead.paletteType = 1;
|
||||
fwrite(&pcxHead , sizeof(pcxHead), 1, fp);
|
||||
|
||||
// The simplest job is to write out the entire file as a series of single units
|
||||
|
||||
virtualWidth = 640;
|
||||
// char *pcxDataBase = buffer; //GetBitMap() + (GetHeight()-1)* virtualWidth ;
|
||||
for (line = 0 ; line < 480; line++)
|
||||
{
|
||||
pcxData = (unsigned char *)buffer; //pcxDataBase;
|
||||
|
||||
// Look to compress this line of 'width' pixels
|
||||
pix = 0;
|
||||
while (pix < 640)
|
||||
{ // Look for some run length coding
|
||||
keyPix = pcxData[pix++];
|
||||
runLength = 1;
|
||||
while ( (pix < 640) && (keyPix == pcxData[pix]) )
|
||||
{ runLength++;
|
||||
pix++;
|
||||
}
|
||||
while (runLength > 1)
|
||||
{ // We have a run length bit. Runs are a maximum of 0x3f
|
||||
int lRun = runLength > 0x3f ? 0x3f : runLength;
|
||||
runLength -= lRun;
|
||||
lRun |= 0xc0;
|
||||
ch = (unsigned char) lRun;
|
||||
fwrite(&ch, 1, 1, fp);
|
||||
ch = (unsigned char) keyPix;
|
||||
fwrite(&ch, 1, 1, fp);
|
||||
// fFile.WriteChar(lRun);
|
||||
// fFile.WriteChar(keyPix);
|
||||
}
|
||||
if (runLength)
|
||||
{ // Single pixel. If its <= 0x3f it goes straight in, otherwise it is a single run length
|
||||
if (keyPix < 0xc0)
|
||||
{
|
||||
ch = (unsigned char) keyPix;
|
||||
fwrite(&ch, 1, 1, fp);
|
||||
// fFile.WriteChar(keyPix);
|
||||
}
|
||||
else
|
||||
{
|
||||
ch = 0xc1;
|
||||
fwrite(&ch, 1, 1, fp);
|
||||
ch = (unsigned char) keyPix;
|
||||
fwrite(&ch, 1, 1, fp);
|
||||
// fFile.WriteChar(0xc1);
|
||||
// fFile.WriteChar(keyPix);
|
||||
}
|
||||
}
|
||||
}
|
||||
// pcxDataBase -= virtualWidth;
|
||||
buffer += virtualWidth;
|
||||
}
|
||||
|
||||
// Convert and write out the palette
|
||||
// StringClass sPal(768);
|
||||
// unsigned char *pal = palette;
|
||||
// for (int count = 0 ; count < 256 ; count++)
|
||||
// { *(pal++) = bmi.bmiColors[count].rgbRed;
|
||||
// *(pal++) = bmi.bmiColors[count].rgbGreen;
|
||||
// *(pal++) = bmi.bmiColors[count].rgbBlue;
|
||||
// }
|
||||
ch = 0x0c;
|
||||
fwrite(&ch, 1, 1, fp);
|
||||
|
||||
for (i=0; i<256*3; i++)
|
||||
{
|
||||
pal[i] = *((unsigned char *) palette + i);
|
||||
}
|
||||
|
||||
// fFile.WriteChar(0x0c);
|
||||
fwrite(pal, 256*3, 1, fp);
|
||||
// if (fFile.Write(sPal , 768)!=768)
|
||||
// return(-1);
|
||||
fclose(fp);
|
||||
|
||||
return(1);
|
||||
|
||||
}
|
||||
|
||||
int32 GrabScreenShot(void) {
|
||||
warning("stub GrabScreenShot");
|
||||
/*
|
||||
uint8 *screenGrabBuffer;
|
||||
uint8 *palette;
|
||||
DDSURFACEDESC ddsd;
|
||||
HRESULT hr;
|
||||
int32 i;
|
||||
|
||||
|
||||
screenGrabBuffer = (uint8 *) malloc(screenWide * screenDeep);
|
||||
if (screenGrabBuffer == NULL)
|
||||
return(RDERR_OUTOFMEMORY);
|
||||
|
||||
ddsd.dwSize = sizeof(DDSURFACEDESC);
|
||||
hr = IDirectDrawSurface2_Lock(lpPrimarySurface, NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
||||
if (hr != DD_OK)
|
||||
{
|
||||
free(screenGrabBuffer);
|
||||
return(RDERR_LOCKFAILED);
|
||||
}
|
||||
|
||||
for (i=0; i<screenDeep; i++)
|
||||
{
|
||||
memcpy(screenGrabBuffer + i * screenWide, (uint8 *) ddsd.lpSurface + ddsd.lPitch * i, screenWide);
|
||||
}
|
||||
IDirectDrawSurface2_Unlock(lpPrimarySurface, ddsd.lpSurface);
|
||||
|
||||
|
||||
palette = (uint8 *) malloc(256 * 3);
|
||||
if (palette == NULL)
|
||||
{
|
||||
free(screenGrabBuffer);
|
||||
return(RDERR_OUTOFMEMORY);
|
||||
}
|
||||
|
||||
for (i=0; i<256; i++)
|
||||
{
|
||||
palette[i*3] = palCopy[i][0];
|
||||
palette[i*3+1] = palCopy[i][1];
|
||||
palette[i*3+2] = palCopy[i][2];
|
||||
}
|
||||
|
||||
hr = SaveScreenShot(screenGrabBuffer,palette);
|
||||
|
||||
|
||||
free(palette);
|
||||
free(screenGrabBuffer);
|
||||
*/
|
||||
return(RD_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32 NextSmackerFrame(void) {
|
||||
warning("stub NextSmackerFrame");
|
||||
return(RD_OK);
|
||||
|
@ -1323,7 +1323,6 @@ extern void ClearShadowFx(void);
|
||||
extern void SetShadowFx(void);
|
||||
extern int32 GetRenderType(void);
|
||||
extern int32 PlaySmacker(char *filename, _movieTextObject *textObjects[], uint8 *musicOut);
|
||||
extern int32 GrabScreenShot(void);
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -149,12 +149,7 @@ void Sword2State::parseEvents() {
|
||||
|
||||
while (_system->poll_event(&event)) {
|
||||
switch(event.event_code) {
|
||||
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags==OSystem::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'w')
|
||||
GrabScreenShot();
|
||||
}
|
||||
WriteKey(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
|
@ -342,8 +342,10 @@ void Sword2State::go() {
|
||||
ServiceWindows();
|
||||
|
||||
#ifdef _SWORD2_DEBUG
|
||||
if (grabbingSequences && !console_status)
|
||||
GrabScreenShot();
|
||||
// FIXME: If we want this, we should re-work it to use the backend's
|
||||
// screenshot functionality.
|
||||
// if (grabbingSequences && !console_status)
|
||||
// GrabScreenShot();
|
||||
#endif
|
||||
|
||||
// if we are closing down the game, break out of main game loop
|
||||
|
Loading…
Reference in New Issue
Block a user