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:
parent
ea1c37a8d3
commit
fa5503ef9a
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
extern PALETTEENTRY color_palette[256];
|
extern PALETTEENTRY *color_palette;
|
||||||
//extern WAVEFORMATEX wf;
|
//extern WAVEFORMATEX wf;
|
||||||
//extern int soundo;
|
//extern int soundo;
|
||||||
|
|
||||||
|
@ -250,23 +250,21 @@ static int avi_open(const char* filename, const BITMAPINFOHEADER* pbmih, const W
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//converts to 24bpp
|
||||||
static void do_video_conversion(const unsigned char* buffer)
|
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)*3);
|
||||||
// memset(avi_file->convert_buffer, 0, VIDEO_WIDTH*(avi_file->end_scanline-avi_file->start_scanline)*BPP);
|
|
||||||
|
|
||||||
buffer += avi_file->start_scanline * VIDEO_WIDTH;
|
buffer += avi_file->start_scanline * VIDEO_WIDTH;
|
||||||
|
|
||||||
int y;
|
for(int y=avi_file->start_scanline; y<avi_file->end_scanline; ++y)
|
||||||
for(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;
|
const uint8* prevbuf = buffer;
|
||||||
|
|
||||||
register int x;
|
for(int x=0; x<VIDEO_WIDTH; ++x)
|
||||||
for(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--;
|
*pix++ = *cp--;
|
||||||
*pix++ = *cp;
|
*pix++ = *cp;
|
||||||
|
|
|
@ -38,11 +38,11 @@ int disvaccel = 0; /* Disable video hardware acceleration. */
|
||||||
int fssync=0;
|
int fssync=0;
|
||||||
int winsync=0;
|
int winsync=0;
|
||||||
|
|
||||||
|
|
||||||
|
PALETTEENTRY *color_palette;
|
||||||
|
|
||||||
#ifdef _USE_SHARED_MEMORY_
|
#ifdef _USE_SHARED_MEMORY_
|
||||||
PALETTEENTRY *color_palette; // shared memory changes
|
|
||||||
HANDLE mapColorPalette;
|
HANDLE mapColorPalette;
|
||||||
#else
|
|
||||||
PALETTEENTRY color_palette[256];
|
|
||||||
#endif //_USE_SHARED_MEMORY_
|
#endif //_USE_SHARED_MEMORY_
|
||||||
|
|
||||||
static int PaletteChanged=0;
|
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)
|
static int InitializeDDraw(int fs)
|
||||||
{
|
{
|
||||||
#ifdef _USE_SHARED_MEMORY_
|
#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)
|
if(mapColorPalette == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
|
||||||
{
|
{
|
||||||
CloseHandle(mapColorPalette);
|
CloseHandle(mapColorPalette);
|
||||||
|
@ -110,7 +110,7 @@ static int InitializeDDraw(int fs)
|
||||||
else
|
else
|
||||||
color_palette = (PALETTEENTRY *)MapViewOfFile(mapColorPalette, FILE_MAP_WRITE, 0, 0, 0);
|
color_palette = (PALETTEENTRY *)MapViewOfFile(mapColorPalette, FILE_MAP_WRITE, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//(disvaccel&(1<<(fs?1:0)))?(GUID FAR *)DDCREATE_EMULATIONONLY:
|
//(disvaccel&(1<<(fs?1:0)))?(GUID FAR *)DDCREATE_EMULATIONONLY:
|
||||||
ddrval = DirectDrawCreate((disvaccel&(1<<(fs?1:0)))?(GUID FAR *)DDCREATE_EMULATIONONLY:NULL, &lpDD, NULL);
|
ddrval = DirectDrawCreate((disvaccel&(1<<(fs?1:0)))?(GUID FAR *)DDCREATE_EMULATIONONLY:NULL, &lpDD, NULL);
|
||||||
if (ddrval != DD_OK)
|
if (ddrval != DD_OK)
|
||||||
|
|
Loading…
Reference in New Issue