fix for avi files not writing with any video (probably a problem leftover from the merge, shared memory buffer not declared the same way as it was externed in another module)

This commit is contained in:
zeromus 2007-08-30 07:47:20 +00:00
parent ea1c37a8d3
commit fa5503ef9a
2 changed files with 12 additions and 14 deletions

View File

@ -4,7 +4,7 @@
#include "common.h"
extern PALETTEENTRY color_palette[256];
extern PALETTEENTRY *color_palette;
//extern WAVEFORMATEX wf;
//extern int soundo;
@ -250,23 +250,21 @@ static int avi_open(const char* filename, const BITMAPINFOHEADER* pbmih, const W
return result;
}
//converts to 24bpp
static void do_video_conversion(const unsigned char* buffer)
{
#define BPP (3) // 24-bit
// memset(avi_file->convert_buffer, 0, VIDEO_WIDTH*(avi_file->end_scanline-avi_file->start_scanline)*BPP);
// memset(avi_file->convert_buffer, 0, VIDEO_WIDTH*(avi_file->end_scanline-avi_file->start_scanline)*3);
buffer += avi_file->start_scanline * VIDEO_WIDTH;
int y;
for(y=avi_file->start_scanline; y<avi_file->end_scanline; ++y)
for(int y=avi_file->start_scanline; y<avi_file->end_scanline; ++y)
{
uint8* pix = avi_file->convert_buffer + (avi_file->end_scanline-1-y)*VIDEO_WIDTH*BPP;
uint8* pix = avi_file->convert_buffer + (avi_file->end_scanline-1-y)*VIDEO_WIDTH*3;
const uint8* prevbuf = buffer;
register int x;
for(x=0; x<VIDEO_WIDTH; ++x)
for(int x=0; x<VIDEO_WIDTH; ++x)
{
register const char* cp = (const char*)(color_palette + *buffer++)+2;
uint8 *cp = (uint8*)(color_palette + *buffer++)+2;
*pix++ = *cp--;
*pix++ = *cp--;
*pix++ = *cp;

View File

@ -38,11 +38,11 @@ int disvaccel = 0; /* Disable video hardware acceleration. */
int fssync=0;
int winsync=0;
PALETTEENTRY *color_palette;
#ifdef _USE_SHARED_MEMORY_
PALETTEENTRY *color_palette; // shared memory changes
HANDLE mapColorPalette;
#else
PALETTEENTRY color_palette[256];
#endif //_USE_SHARED_MEMORY_
static int PaletteChanged=0;
@ -100,7 +100,7 @@ void FCEUD_GetPalette(unsigned char i, unsigned char *r, unsigned char *g, unsig
static int InitializeDDraw(int fs)
{
#ifdef _USE_SHARED_MEMORY_
mapColorPalette = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, 256 * sizeof(PALETTEENTRY),"fceu.ColorPalette");
mapColorPalette = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE, 0, 256 * sizeof(PALETTEENTRY),"fceu.ColorPalette");
if(mapColorPalette == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
{
CloseHandle(mapColorPalette);
@ -110,7 +110,7 @@ static int InitializeDDraw(int fs)
else
color_palette = (PALETTEENTRY *)MapViewOfFile(mapColorPalette, FILE_MAP_WRITE, 0, 0, 0);
#endif
//(disvaccel&(1<<(fs?1:0)))?(GUID FAR *)DDCREATE_EMULATIONONLY:
ddrval = DirectDrawCreate((disvaccel&(1<<(fs?1:0)))?(GUID FAR *)DDCREATE_EMULATIONONLY:NULL, &lpDD, NULL);
if (ddrval != DD_OK)