More cleanups, preparing for multi-language.

This commit is contained in:
waltje
2017-11-19 03:15:29 -05:00
parent 181bca1644
commit 44b8824552
22 changed files with 1605 additions and 1421 deletions

View File

@@ -84,26 +84,21 @@ static int tris = 0;
static uint64_t status_time = 0;
typedef union int_float
{
typedef union {
uint32_t i;
float f;
} int_float;
typedef struct rgb_t
{
typedef struct {
uint8_t b, g, r;
uint8_t pad;
} rgb_t;
typedef struct rgba8_t
{
} rgbp_t;
typedef struct {
uint8_t b, g, r, a;
} rgba8_t;
typedef union rgba_u
{
struct
{
typedef union {
struct {
uint8_t b, g, r, a;
} rgba;
uint32_t u;
@@ -175,7 +170,7 @@ typedef struct voodoo_params_t
uint32_t fbzColorPath;
uint32_t fogMode;
rgb_t fogColor;
rgbp_t fogColor;
struct
{
uint8_t fog, dfog;
@@ -401,9 +396,9 @@ typedef struct voodoo_t
int dst_stride;
} blt;
rgb_t clutData[33];
rgbp_t clutData[33];
int clutData_dirty;
rgb_t clutData256[256];
rgbp_t clutData256[256];
uint32_t video_16to32[0x10000];
uint8_t dirty_line[1024];

View File

@@ -6,13 +6,11 @@
*/
#ifdef __linux__
#include <sys/mman.h>
#include <unistd.h>
# include <sys/mman.h>
# include <unistd.h>
#endif
#if WIN64
#define BITMAP windows_BITMAP
#include <windows.h>
#undef BITMAP
# include <windows.h>
#endif
#include <xmmintrin.h>

View File

@@ -6,13 +6,11 @@
*/
#ifdef __linux__
#include <sys/mman.h>
#include <unistd.h>
# include <sys/mman.h>
# include <unistd.h>
#endif
#if defined WIN32 || defined _WIN32 || defined _WIN32
#define BITMAP windows_BITMAP
#include <windows.h>
#undef BITMAP
# include <windows.h>
#endif
#include <xmmintrin.h>

View File

@@ -40,7 +40,7 @@
* W = 3 bus clocks
* L = 4 bus clocks
*
* Version: @(#)video.c 1.0.9 2017/11/05
* Version: @(#)video.c 1.0.10 2017/11/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -73,9 +73,9 @@ enum {
};
BITMAP *screen = NULL;
BITMAP *buffer= NULL,
*buffer32= NULL;
bitmap_t *screen = NULL,
*buffer = NULL,
*buffer32 = NULL;
uint8_t fontdat[256][8]; /* IBM CGA font */
uint8_t fontdatm[256][16]; /* IBM MDA font */
uint8_t fontdatw[512][32]; /* Wyse700 font */
@@ -414,7 +414,7 @@ calc_16to32(int c)
void
hline(BITMAP *b, int x1, int y, int x2, uint32_t col)
hline(bitmap_t *b, int x1, int y, int x2, uint32_t col)
{
if (y < 0 || y >= buffer->h)
return;
@@ -427,19 +427,19 @@ hline(BITMAP *b, int x1, int y, int x2, uint32_t col)
void
blit(BITMAP *src, BITMAP *dst, int x1, int y1, int x2, int y2, int xs, int ys)
blit(bitmap_t *src, bitmap_t *dst, int x1, int y1, int x2, int y2, int xs, int ys)
{
}
void
stretch_blit(BITMAP *src, BITMAP *dst, int x1, int y1, int xs1, int ys1, int x2, int y2, int xs2, int ys2)
stretch_blit(bitmap_t *src, bitmap_t *dst, int x1, int y1, int xs1, int ys1, int x2, int y2, int xs2, int ys2)
{
}
void
rectfill(BITMAP *b, int x1, int y1, int x2, int y2, uint32_t col)
rectfill(bitmap_t *b, int x1, int y1, int x2, int y2, uint32_t col)
{
}
@@ -451,15 +451,18 @@ set_palette(PALETTE p)
void
destroy_bitmap(BITMAP *b)
destroy_bitmap(bitmap_t *b)
{
if (b->dat != NULL)
free(b->dat);
free(b);
}
BITMAP *
bitmap_t *
create_bitmap(int x, int y)
{
BITMAP *b = malloc(sizeof(BITMAP) + (y * sizeof(uint8_t *)));
bitmap_t *b = malloc(sizeof(bitmap_t) + (y * sizeof(uint8_t *)));
int c;
b->dat = malloc(x * y * 4);

View File

@@ -8,7 +8,7 @@
*
* Definitions for the video controller module.
*
* Version: @(#)video.h 1.0.3 2017/11/05
* Version: @(#)video.h 1.0.4 2017/11/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -125,13 +125,13 @@ typedef struct {
int w, h;
uint8_t *dat;
uint8_t *line[];
} BITMAP;
} bitmap_t;
typedef struct {
uint8_t r, g, b;
} RGB;
} rgb_t;
typedef RGB PALETTE[256];
typedef rgb_t PALETTE[256];
extern int gfx_present[GFX_MAX];
@@ -139,7 +139,7 @@ extern int egareads,
egawrites;
extern int changeframecount;
extern BITMAP *screen,
extern bitmap_t *screen,
*buffer,
*buffer32;
extern PALETTE cgapal,
@@ -203,10 +203,10 @@ extern void video_blit_complete(void);
extern void video_wait_for_blit(void);
extern void video_wait_for_buffer(void);
extern BITMAP *create_bitmap(int w, int h);
extern void destroy_bitmap(BITMAP *b);
extern bitmap_t *create_bitmap(int w, int h);
extern void destroy_bitmap(bitmap_t *b);
extern void cgapal_rebuild(void);
extern void hline(BITMAP *b, int x1, int y, int x2, uint32_t col);
extern void hline(bitmap_t *b, int x1, int y, int x2, uint32_t col);
extern void updatewindowsize(int x, int y);
extern void video_init(void);