1
0
Fork 0

Scaler rewrite for detecting changes

New scalers for tv3x, rgb2x, rgb3x, scan2x, scan3x
Only updaterect the changed parts in sdl
Add support for 15/16/32bpp modes
Add support for highres 4bpp modes
Rewrite of vga page handlers for most other modes
AVI capturing using zmbv codec


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2442
This commit is contained in:
Sjoerd van der Berg 2006-01-30 09:54:34 +00:00
parent 8cceb3b0e9
commit a9f5e6619b
4 changed files with 112 additions and 30 deletions

View file

@ -25,13 +25,26 @@ class Section;
enum OPL_Mode {
OPL_none,OPL_cms,OPL_opl2,OPL_dualopl2,OPL_opl3
};
#define CAPTURE_WAVE 0x01
#define CAPTURE_OPL 0x02
#define CAPTURE_MIDI 0x04
#define CAPTURE_IMAGE 0x08
#define CAPTURE_VIDEO 0x10
extern Bitu CaptureState;
void OPL_Init(Section* sec,OPL_Mode mode);
void CMS_Init(Section* sec);
void OPL_ShutDown(Section* sec);
void CMS_ShutDown(Section* sec);
extern Bit8u adlib_commandreg;
FILE * OpenCaptureFile(const char * type,const char * ext);
void CAPTURE_AddWave(Bit32u freq, Bit32u len, Bit16s * data);
#define CAPTURE_FLAG_DBLW 0x1
#define CAPTURE_FLAG_DBLH 0x2
void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, float fps, Bit8u * data, Bit8u * pal);
void CAPTURE_AddMidi(bool sysex, Bitu len, Bit8u * data);
#endif

View file

@ -19,13 +19,66 @@
#ifndef DOSBOX_RENDER_H
#define DOSBOX_RENDER_H
typedef void (* RENDER_Line_Handler)(const Bit8u * src);
#include "../src/gui/render_scalers.h"
void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,double ratio,bool dblw,bool dblh);
typedef struct {
struct {
Bit8u red;
Bit8u green;
Bit8u blue;
Bit8u unused;
} rgb[256];
union {
Bit16u b16[256];
Bit32u b32[256];
} lut;
bool modified[256];
Bitu first;
Bitu last;
bool changed;
} RenderPal_t;
typedef struct {
struct {
Bitu width;
Bitu height;
Bitu bpp;
bool dblw,dblh;
double ratio;
float fps;
} src;
struct {
Bitu count;
Bitu max;
} frameskip;
struct {
Bitu size;
scalerMode_t inMode;
scalerMode_t outMode;
scalerOperation_t op;
ScalerLineHandler_t currentHandler;
Bitu lineFlags;
bool clearCache;
ScalerLineHandler_t lineHandler;
ScalerCacheHandler_t cacheHandler;
Bitu blocks, lastBlock;
Bitu outPitch;
Bit8u *outWrite;
Bitu inHeight, inLine, outLine;
} scale;
RenderPal_t pal;
bool updating;
bool active;
bool aspect;
} Render_t;
extern Render_t render;
void RENDER_DrawLine( const void *src );
void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh);
bool RENDER_StartUpdate(void);
void RENDER_EndUpdate(void);
void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue);
extern RENDER_Line_Handler RENDER_DrawLine;
#endif

View file

@ -23,17 +23,19 @@
#include "dosbox.h"
#endif
class PageHandler;
enum VGAModes {
M_CGA2,M_CGA4,
M_EGA16,
M_VGA,
M_LIN8,
M_CGA2, M_CGA4,
M_EGA, M_VGA,
M_LIN4, M_LIN8, M_LIN15, M_LIN16, M_LIN32,
M_TEXT,
M_HERC_GFX,M_HERC_TEXT,
M_CGA16,M_TANDY2,M_TANDY4,M_TANDY16,M_TANDY_TEXT,
M_HERC_GFX, M_HERC_TEXT,
M_CGA16, M_TANDY2, M_TANDY4, M_TANDY16, M_TANDY_TEXT,
M_ERROR,
};
#define CLK_25 25175
#define CLK_28 28322
@ -86,7 +88,6 @@ typedef struct {
Bit32u full_not_enable_set_reset;
Bit32u full_enable_set_reset;
Bit32u full_enable_and_set_reset;
} VGA_Config;
typedef struct {
@ -291,10 +292,20 @@ union VGA_Memory {
Bit8u linear[512*1024*4];
Bit8u paged[512*1024][4];
VGA_Latch latched[512*1024];
};
};
typedef struct {
Bit32u page;
Bit32u addr;
Bit32u mask;
PageHandler *handler;
} VGA_LFB;
#define VGA_CHANGE_SHIFT 9
typedef Bit8u VGA_Changed[(2*1024*1024) >> VGA_CHANGE_SHIFT];
typedef struct {
VGAModes mode; /* The mode the vga system is in */
VGAModes lastmode;
Bit8u misc_output;
VGA_Draw draw;
VGA_Config config;
@ -311,6 +322,8 @@ typedef struct {
VGA_TANDY tandy;
VGA_OTHER other;
VGA_Memory mem;
VGA_LFB lfb;
VGA_Changed changed;
Bit8u * gfxmem_start;
} VGA_Type;
@ -351,6 +364,13 @@ void VGA_SetCGA4Table(Bit8u val0,Bit8u val1,Bit8u val2,Bit8u val3);
void VGA_ActivateHardwareCursor(void);
void VGA_KillDrawing(void);
/* S3 Functions */
Bitu SVGA_S3_GetClock(void);
void SVGA_S3_WriteCRTC(Bitu reg,Bitu val,Bitu iolen);
Bitu SVGA_S3_ReadCRTC(Bitu reg,Bitu iolen);
void SVGA_S3_WriteSEQ(Bitu reg,Bitu val,Bitu iolen);
Bitu SVGA_S3_ReadSEQ(Bitu reg,Bitu iolen);
extern VGA_Type vga;
extern Bit32u ExpandTable[256];

View file

@ -19,7 +19,7 @@
#ifndef DOSBOX_VIDEO_H
#define DOSBOX_VIDEO_H
typedef void (* GFX_ResetCallBack)(void);
typedef void (* GFX_ResetCallBack)( bool stopIt );
struct GFX_PalEntry {
Bit8u r;
@ -28,39 +28,35 @@ struct GFX_PalEntry {
Bit8u unused;
};
#define CAN_8 0x0001
#define CAN_16 0x0002
#define CAN_32 0x0004
#define GFX_CAN_8 0x0001
#define GFX_CAN_15 0x0002
#define GFX_CAN_16 0x0004
#define GFX_CAN_32 0x0008
#define CAN_ALL (CAN_8|CAN_16|CAN_32)
#define GFX_LOVE_8 0x0010
#define GFX_LOVE_15 0x0020
#define GFX_LOVE_16 0x0040
#define GFX_LOVE_32 0x0080
#define LOVE_8 0x0010
#define LOVE_16 0x0020
#define LOVE_32 0x0040
#define GFX_RGBONLY 0x0100
#define NEED_RGB 0x0100
#define DONT_ASPECT 0x0200
#define GFX_SCALING 0x1000
#define GFX_HARDWARE 0x2000
#define HAVE_SCALING 0x1000
enum GFX_Modes {
GFX_8,GFX_15,GFX_16,GFX_32,GFX_NONE,
};
#define GFX_CAN_RANDOM 0x4000 //If the interface can also do random access surface
void GFX_Events(void);
void GFX_SetPalette(Bitu start,Bitu count,GFX_PalEntry * entries);
Bitu GFX_GetBestMode(Bitu flags);
Bitu GFX_GetRGB(Bit8u red,Bit8u green,Bit8u blue);
GFX_Modes GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,GFX_ResetCallBack cb_reset);
Bitu GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,GFX_ResetCallBack cb_reset);
void GFX_ResetScreen(void);
void GFX_Start(void);
void GFX_Stop(void);
void GFX_SwitchFullScreen(void);
bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch);
void GFX_EndUpdate(void);
void GFX_EndUpdate( const Bit16u *changedLines );
/* Mouse related */
void GFX_CaptureMouse(void);