Hook up CGA composite controls to rest of the emulator
This commit is contained in:
@@ -788,6 +788,8 @@ cga_standalone_init(UNUSED(const device_t *info))
|
||||
break;
|
||||
}
|
||||
|
||||
monitors[monitor_index_global].mon_composite = !!cga->composite;
|
||||
|
||||
return cga;
|
||||
}
|
||||
|
||||
|
||||
@@ -361,6 +361,8 @@ colorplus_standalone_init(UNUSED(const device_t *info))
|
||||
lpt_port_setup(colorplus->lpt, LPT_MDA_ADDR);
|
||||
lpt_set_3bc_used(1);
|
||||
|
||||
monitors[monitor_index_global].mon_composite = colorplus->cga.composite;
|
||||
|
||||
return colorplus;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,12 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/vid_cga.h>
|
||||
#include <86box/vid_cga_comp.h>
|
||||
#include <86box/thread.h>
|
||||
|
||||
int CGA_Composite_Table[1024];
|
||||
|
||||
static mutex_t* cga_comp_mutex = NULL;
|
||||
|
||||
static double brightness = 0;
|
||||
static double contrast = 100;
|
||||
static double saturation = 100;
|
||||
@@ -69,23 +72,30 @@ static double intensity[4] = {
|
||||
|
||||
#define NEW_CGA(c, i, r, g, b) (((c) / 0.72) * 0.29 + ((i) / 0.28) * 0.32 + ((r) / 0.28) * 0.1 + ((g) / 0.28) * 0.22 + ((b) / 0.28) * 0.07)
|
||||
|
||||
double mode_brightness;
|
||||
double mode_contrast;
|
||||
double mode_hue;
|
||||
double min_v;
|
||||
double max_v;
|
||||
volatile double mode_brightness;
|
||||
volatile double mode_contrast;
|
||||
volatile double mode_hue;
|
||||
volatile double min_v;
|
||||
volatile double max_v;
|
||||
|
||||
double video_ri;
|
||||
double video_rq;
|
||||
double video_gi;
|
||||
double video_gq;
|
||||
double video_bi;
|
||||
double video_bq;
|
||||
int video_sharpness;
|
||||
int tandy_mode_control = 0;
|
||||
volatile double video_ri;
|
||||
volatile double video_rq;
|
||||
volatile double video_gi;
|
||||
volatile double video_gq;
|
||||
volatile double video_bi;
|
||||
volatile double video_bq;
|
||||
volatile int video_sharpness;
|
||||
|
||||
static bool new_cga = 0;
|
||||
|
||||
static uint8_t current_cgamode = 0;
|
||||
|
||||
int vid_cga_comp_brightness = 0;
|
||||
int vid_cga_comp_sharpness = 0;
|
||||
int vid_cga_comp_hue = 0;
|
||||
int vid_cga_comp_saturation = 100;
|
||||
int vid_cga_comp_contrast = 100;
|
||||
|
||||
void
|
||||
update_cga16_color(uint8_t cgamode)
|
||||
{
|
||||
@@ -109,6 +119,14 @@ update_cga16_color(uint8_t cgamode)
|
||||
static const double bi = -1.1069;
|
||||
static const double bq = 1.7046;
|
||||
|
||||
if (!cga_comp_mutex)
|
||||
cga_comp_mutex = thread_create_mutex();
|
||||
|
||||
if (is_cpu_thread)
|
||||
thread_wait_mutex(cga_comp_mutex);
|
||||
|
||||
current_cgamode = cgamode;
|
||||
|
||||
if (!new_cga) {
|
||||
min_v = chroma_multiplexer[0] + intensity[0];
|
||||
max_v = chroma_multiplexer[255] + intensity[3];
|
||||
@@ -170,6 +188,9 @@ update_cga16_color(uint8_t cgamode)
|
||||
video_bi = (int) (bi * iq_adjust_i + bq * iq_adjust_q);
|
||||
video_bq = (int) (-bi * iq_adjust_q + bq * iq_adjust_i);
|
||||
video_sharpness = (int) (sharpness * 256 / 100);
|
||||
|
||||
if (is_cpu_thread)
|
||||
thread_release_mutex(cga_comp_mutex);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
@@ -369,17 +390,41 @@ DecreaseSharpness(uint8_t cgamode)
|
||||
update_cga16_color(cgamode);
|
||||
}
|
||||
|
||||
void
|
||||
cga_comp_reload(int new_brightness, int new_saturation, int new_sharpness, int new_hue, int new_contrast)
|
||||
{
|
||||
if (!cga_comp_mutex)
|
||||
cga_comp_mutex = thread_create_mutex();
|
||||
|
||||
if (!is_cpu_thread)
|
||||
thread_wait_mutex(cga_comp_mutex);
|
||||
|
||||
brightness = new_brightness;
|
||||
contrast = new_contrast;
|
||||
saturation = new_saturation;
|
||||
sharpness = new_sharpness;
|
||||
hue_offset = new_hue;
|
||||
|
||||
update_cga16_color(current_cgamode);
|
||||
|
||||
if (!is_cpu_thread)
|
||||
thread_release_mutex(cga_comp_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
cga_comp_init(int revision)
|
||||
{
|
||||
if (!cga_comp_mutex)
|
||||
cga_comp_mutex = thread_create_mutex();
|
||||
|
||||
new_cga = revision;
|
||||
|
||||
/* Making sure this gets reset after reset. */
|
||||
brightness = 0;
|
||||
contrast = 100;
|
||||
saturation = 100;
|
||||
sharpness = 0;
|
||||
hue_offset = 0;
|
||||
brightness = vid_cga_comp_brightness;
|
||||
contrast = vid_cga_comp_contrast;
|
||||
saturation = vid_cga_comp_saturation;
|
||||
sharpness = vid_cga_comp_sharpness;
|
||||
hue_offset = vid_cga_comp_hue;
|
||||
|
||||
update_cga16_color(0);
|
||||
}
|
||||
|
||||
@@ -457,6 +457,8 @@ compaq_cga_init(const device_t *info)
|
||||
|
||||
dev->crtc[9] = 13;
|
||||
|
||||
monitors[monitor_index_global].mon_composite = !!dev->composite;
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
@@ -838,6 +838,8 @@ quadcolor_standalone_init(UNUSED(const device_t *info))
|
||||
break;
|
||||
}
|
||||
|
||||
monitors[monitor_index_global].mon_composite = !!quadcolor->composite;
|
||||
|
||||
return quadcolor;
|
||||
}
|
||||
|
||||
|
||||
@@ -1055,6 +1055,8 @@ v6355_standalone_init(const device_t *info) {
|
||||
break;
|
||||
}
|
||||
|
||||
monitors[monitor_index_global].mon_composite = (v6355->display_type == V6355_COMPOSITE);
|
||||
|
||||
return v6355;
|
||||
}
|
||||
|
||||
|
||||
@@ -719,4 +719,6 @@ pcjr_vid_init(pcjr_t *pcjr)
|
||||
else
|
||||
cga_palette = (display_type << 1);
|
||||
cgapal_rebuild();
|
||||
|
||||
monitors[monitor_index_global].mon_composite = !!pcjr->composite;
|
||||
}
|
||||
|
||||
@@ -334,6 +334,7 @@ video_prepare(void)
|
||||
video_inform_monitor(VIDEO_FLAG_TYPE_SPECIAL, &timing_default, i);
|
||||
|
||||
monitors[i].mon_interlace = 0;
|
||||
monitors[i].mon_composite = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -762,6 +762,8 @@ tandy_vid_init(tandy_t *dev)
|
||||
tandy_vid_in, NULL, NULL, tandy_vid_out, NULL, NULL, dev);
|
||||
|
||||
dev->vid = vid;
|
||||
|
||||
monitors[monitor_index_global].mon_composite = !!vid->composite;
|
||||
}
|
||||
|
||||
const device_config_t vid_config[] = {
|
||||
|
||||
Reference in New Issue
Block a user