MAMEWorld >> News
View all threads Index   Flat Mode Flat  

Haze
Reged: 09/23/03
Posts: 5245
Send PM
Re: Haze WIP
10/20/18 11:38 PM


> What output ports are available on the devices?
>
> Do you mind sharing your current toRGB algorithm?

it hooks up with AV cables, usually single channel of audio (although some have two)

Algorithm is just one I found with a 'free to use anywhere' license.


Code:



double xavix_state::hue2rgb(double p, double q, double t)
{
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6.0f) return p + (q - p) * 6 * t;
if (t < 1 / 2.0f) return q;
if (t < 2 / 3.0f) return p + (q - p) * (2 / 3.0f - t) * 6;
return p;
}


void xavix_state::handle_palette(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// not verified
int offs = 0;
for (int index = 0; index < 257; index++)
{
uint16_t dat;

if (index < 256)
{
dat = m_palram_sh[offs];
dat |= m_palram_l[offs] << 8;
}
else
{
dat = m_colmix_sh[0];
dat |= m_colmix_l[0] << 8;
}

offs++;

int l_raw = (dat & 0x1f00) >> 8;
int sl_raw =(dat & 0x00e0) >> 5;
int h_raw = (dat & 0x001f) >> 0;

//if (h_raw > 24)
// logerror("hraw >24 (%02x)\n", h_raw);

//if (l_raw > 17)
// logerror("lraw >17 (%02x)\n", l_raw);

//if (sl_raw > 7)
// logerror("sl_raw >5 (%02x)\n", sl_raw);

double l = (double)l_raw / 17.0f;
double s = (double)sl_raw / 7.0f;
double h = (double)h_raw / 24.0f;

double r, g, b;

if (s == 0) {
r = g = b = l; // greyscale
}
else {
double q = l < 0.5f ? l * (1 + s) : l + s - l * s;
double p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3.0f);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3.0f);
}

int r_real = r * 255.0f;
int g_real = g * 255.0f;
int b_real = b * 255.0f;

m_palette->set_pen_color(index, r_real, g_real, b_real);

}
}








Entire thread
Subject Posted by Posted on
* Haze WIP ClawGrip 10/20/18 11:06 AM
. * Re: Haze WIP Foxhack  10/20/18 08:46 PM
. * Re: Haze WIP anikom15  10/20/18 09:02 PM
. * Re: Haze WIP Haze  10/20/18 09:57 PM
. * Re: Haze WIP anikom15  10/20/18 11:07 PM
. * Re: Haze WIP Haze  10/20/18 11:38 PM
. * Re: Haze WIP anikom15  10/21/18 12:59 AM
. * Re: Haze WIP Foxhack  10/20/18 10:07 PM
. * Re: Haze WIP Asure  10/20/18 12:52 PM
. * Re: Haze WIP gregf  10/20/18 12:11 PM

Extra information Permissions
Moderator:  John IV, Robbbert, Tafoid 
0 registered and 319 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 918