Video (API) cleanup and minor stuff. Oh, and the VNC files :P

This commit is contained in:
waltje
2017-10-14 13:38:05 -04:00
parent c350e79242
commit 3453a66f16
18 changed files with 412 additions and 165 deletions

View File

@@ -8,7 +8,7 @@
*
* Emulation of the old and new IBM CGA graphics cards.
*
* Version: @(#)vid_cga.c 1.0.4 2017/10/10
* Version: @(#)vid_cga.c 1.0.5 2017/10/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -74,13 +74,13 @@ void cga_out(uint16_t addr, uint8_t val, void *p)
cga->cgamode = val;
update_cga16_color(cga->cgamode);
}
#ifndef __unix
if ((cga->cgamode ^ val) & 1)
{
cga_palette = (cga->rgb_type << 1);
cgapal_rebuild();
}
#endif
cga->cgamode = val;
return;
case 0x3D9:
@@ -478,7 +478,7 @@ void *cga_standalone_init(device_t *info)
cga->snow_enabled = device_get_config_int("snow_enabled");
cga->vram = malloc(0x4000);
cga_comp_init(cga->revision);
timer_add(cga_poll, &cga->vidtime, TIMER_ALWAYS_ENABLED, cga);
mem_mapping_add(&cga->mapping, 0xb8000, 0x08000, cga_read, NULL, NULL, cga_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, cga);
@@ -486,12 +486,10 @@ void *cga_standalone_init(device_t *info)
overscan_x = overscan_y = 16;
#ifndef __unix
cga->rgb_type = device_get_config_int("rgb_type");
cga_palette = (cga->rgb_type << 1);
cgapal_rebuild();
#endif
return cga;
}
@@ -506,7 +504,7 @@ void cga_close(void *p)
void cga_speed_changed(void *p)
{
cga_t *cga = (cga_t *)p;
cga_recalctimings(cga);
}
@@ -540,7 +538,6 @@ static device_config_t cga_config[] =
}
}
},
#ifndef __unix
{
"rgb_type", "RGB type", CONFIG_SELECTION, "", 0,
{
@@ -564,7 +561,6 @@ static device_config_t cga_config[] =
}
}
},
#endif
{
"snow_enabled", "Snow emulation", CONFIG_BINARY, "", 1
},

View File

@@ -49,9 +49,7 @@ typedef struct cga_t
int revision;
int composite;
int snow_enabled;
#ifndef __unix
int rgb_type;
#endif
} cga_t;
void cga_init(cga_t *cga);

View File

@@ -8,7 +8,7 @@
*
* Hercules emulation.
*
* Version: @(#)vid_hercules.c 1.0.1 2017/10/10
* Version: @(#)vid_hercules.c 1.0.2 2017/10/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -362,14 +362,12 @@ void *hercules_init(device_t *info)
overscan_x = overscan_y = 0;
#ifndef __unix
cga_palette = device_get_config_int("rgb_type") << 1;
if (cga_palette > 6)
{
cga_palette = 0;
}
cgapal_rebuild();
#endif
return hercules;
}
@@ -389,7 +387,6 @@ void hercules_speed_changed(void *p)
hercules_recalctimings(hercules);
}
#ifndef __unix
static device_config_t hercules_config[] =
{
{
@@ -416,7 +413,6 @@ static device_config_t hercules_config[] =
"", "", -1
}
};
#endif
device_t hercules_device =
{
@@ -429,9 +425,5 @@ device_t hercules_device =
hercules_speed_changed,
NULL,
NULL,
#ifdef __unix
NULL
#else
hercules_config
#endif
};

View File

@@ -8,7 +8,7 @@
*
* MDA emulation.
*
* Version: @(#)vid_mda.c 1.0.1 2017/10/10
* Version: @(#)vid_mda.c 1.0.2 2017/10/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -311,14 +311,12 @@ void *mda_init(device_t *info)
overscan_x = overscan_y = 0;
#ifndef __unix
cga_palette = device_get_config_int("rgb_type") << 1;
if (cga_palette > 6)
{
cga_palette = 0;
}
cgapal_rebuild();
#endif
return mda;
}
@@ -338,7 +336,6 @@ void mda_speed_changed(void *p)
mda_recalctimings(mda);
}
#ifndef __unix
static device_config_t mda_config[] =
{
{
@@ -365,7 +362,6 @@ static device_config_t mda_config[] =
"", "", -1
}
};
#endif
device_t mda_device =
{
@@ -378,9 +374,5 @@ device_t mda_device =
mda_speed_changed,
NULL,
NULL,
#ifdef __unix
NULL
#else
mda_config
#endif
};

View File

@@ -40,7 +40,7 @@
* W = 3 bus clocks
* L = 4 bus clocks
*
* Version: @(#)video.c 1.0.1 2017/10/10
* Version: @(#)video.c 1.0.2 2017/10/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -196,8 +196,8 @@ static struct {
} blit_data;
void (*video_blit_memtoscreen_func)(int x, int y, int y1, int y2, int w, int h);
void (*video_blit_memtoscreen_8_func)(int x, int y, int w, int h);
static void (*memtoscreen_func)(int x, int y, int y1, int y2, int w, int h);
static void (*memtoscreen_8_func)(int x, int y, int w, int h);
static
@@ -208,9 +208,9 @@ void blit_thread(void *param)
thread_reset_event(blit_data.wake_blit_thread);
if (blit_data.blit8)
video_blit_memtoscreen_8_func(blit_data.x, blit_data.y, blit_data.w, blit_data.h);
memtoscreen_8_func(blit_data.x, blit_data.y, blit_data.w, blit_data.h);
else
video_blit_memtoscreen_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
memtoscreen_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
blit_data.busy = 0;
thread_set_event(blit_data.blit_complete);
@@ -218,6 +218,14 @@ void blit_thread(void *param)
}
void
video_setblit(void(*blit8)(int,int,int,int),void(*blit)(int,int,int,int,int,int))
{
memtoscreen_func = blit;
memtoscreen_8_func = blit8;
}
void
video_blit_complete(void)
{
@@ -556,10 +564,8 @@ video_reset(void)
{
pclog("Video_reset(rom=%i, gfx=%i)\n", romset, gfxcard);
#ifndef __unix
cga_palette = 0;
cgapal_rebuild();
#endif
/*
* Add and initialize the selected video card device.

View File

@@ -76,8 +76,6 @@ extern "C" {
/* Function handler pointers. */
extern void (*video_recalctimings)(void);
extern void (*video_blit_memtoscreen_func)(int x, int y, int y1, int y2, int w, int h);
extern void (*video_blit_memtoscreen_8_func)(int x, int y, int w, int h);
/* Table functions. */
@@ -94,8 +92,11 @@ extern char *video_get_internal_name(int card);
extern int video_get_video_from_internal_name(char *s);
extern void video_setblit(void(*blit8)(int,int,int,int),
void(*blit)(int,int,int,int,int,int));
extern void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
extern void video_blit_memtoscreen_8(int x, int y, int w, int h);
extern void video_blit_complete(void);
extern void video_wait_for_blit(void);
extern void video_wait_for_buffer(void);