diff options
author | 2012-05-26 11:15:14 +0000 | |
---|---|---|
committer | 2012-05-26 11:15:14 +0000 | |
commit | 35bed5a154ec4dc23b77d33c926e61832f7edd8c (patch) | |
tree | 13e95bc6d9a04e6c1f3be291844594871798ebe0 | |
parent | 8f37cc10ced5a97245507eace1befd0fba1ab9ea (diff) |
Revert some changes committed by accident. No WN.
-rw-r--r-- | src/emu/cpu/adsp2100/2100ops.c | 32 | ||||
-rw-r--r-- | src/emu/drawgfx.c | 16 | ||||
-rw-r--r-- | src/emu/drawgfxm.h | 9 | ||||
-rw-r--r-- | src/emu/render.c | 6 | ||||
-rw-r--r-- | src/emu/screen.c | 978 | ||||
-rw-r--r-- | src/emu/screen.h | 114 | ||||
-rw-r--r-- | src/emu/ui.c | 241 |
7 files changed, 24 insertions, 1372 deletions
diff --git a/src/emu/cpu/adsp2100/2100ops.c b/src/emu/cpu/adsp2100/2100ops.c index fba03fc88f4..0c14e8f7b15 100644 --- a/src/emu/cpu/adsp2100/2100ops.c +++ b/src/emu/cpu/adsp2100/2100ops.c @@ -112,7 +112,7 @@ inline void adsp21xx_device::update_mstat() inline UINT32 adsp21xx_device::pc_stack_top() { - if (EXPECTED(m_pc_sp > 0)) + if (m_pc_sp > 0) return m_pc_stack[m_pc_sp - 1]; else return m_pc_stack[0]; @@ -120,7 +120,7 @@ inline UINT32 adsp21xx_device::pc_stack_top() inline void adsp21xx_device::set_pc_stack_top(UINT32 top) { - if (EXPECTED(m_pc_sp > 0)) + if (m_pc_sp > 0) m_pc_stack[m_pc_sp - 1] = top; else m_pc_stack[0] = top; @@ -128,7 +128,7 @@ inline void adsp21xx_device::set_pc_stack_top(UINT32 top) inline void adsp21xx_device::pc_stack_push() { - if (EXPECTED(m_pc_sp < PC_STACK_DEPTH)) + if (m_pc_sp < PC_STACK_DEPTH) { m_pc_stack[m_pc_sp] = m_pc; m_pc_sp++; @@ -140,7 +140,7 @@ inline void adsp21xx_device::pc_stack_push() inline void adsp21xx_device::pc_stack_push_val(UINT32 val) { - if (EXPECTED(m_pc_sp < PC_STACK_DEPTH)) + if (m_pc_sp < PC_STACK_DEPTH) { m_pc_stack[m_pc_sp] = val; m_pc_sp++; @@ -152,10 +152,10 @@ inline void adsp21xx_device::pc_stack_push_val(UINT32 val) inline void adsp21xx_device::pc_stack_pop() { - if (EXPECTED(m_pc_sp > 0)) + if (m_pc_sp > 0) { m_pc_sp--; - if (UNEXPECTED(m_pc_sp == 0)) + if (m_pc_sp == 0) m_sstat |= PC_EMPTY; } m_pc = m_pc_stack[m_pc_sp]; @@ -163,7 +163,7 @@ inline void adsp21xx_device::pc_stack_pop() inline UINT32 adsp21xx_device::pc_stack_pop_val() { - if (EXPECTED(m_pc_sp > 0)) + if (m_pc_sp > 0) { m_pc_sp--; if (m_pc_sp == 0) @@ -179,7 +179,7 @@ inline UINT32 adsp21xx_device::pc_stack_pop_val() inline UINT32 adsp21xx_device::cntr_stack_top() { - if (EXPECTED(m_cntr_sp > 0)) + if (m_cntr_sp > 0) return m_cntr_stack[m_cntr_sp - 1]; else return m_cntr_stack[0]; @@ -187,7 +187,7 @@ inline UINT32 adsp21xx_device::cntr_stack_top() inline void adsp21xx_device::cntr_stack_push() { - if (EXPECTED(m_cntr_sp < CNTR_STACK_DEPTH)) + if (m_cntr_sp < CNTR_STACK_DEPTH) { m_cntr_stack[m_cntr_sp] = m_cntr; m_cntr_sp++; @@ -199,7 +199,7 @@ inline void adsp21xx_device::cntr_stack_push() inline void adsp21xx_device::cntr_stack_pop() { - if (EXPECTED(m_cntr_sp > 0)) + if (m_cntr_sp > 0) { m_cntr_sp--; if (m_cntr_sp == 0) @@ -215,7 +215,7 @@ inline void adsp21xx_device::cntr_stack_pop() inline UINT32 adsp21xx_device::loop_stack_top() { - if (EXPECTED(m_loop_sp > 0)) + if (m_loop_sp > 0) return m_loop_stack[m_loop_sp - 1]; else return m_loop_stack[0]; @@ -223,7 +223,7 @@ inline UINT32 adsp21xx_device::loop_stack_top() inline void adsp21xx_device::loop_stack_push(UINT32 value) { - if (EXPECTED(m_loop_sp < LOOP_STACK_DEPTH)) + if (m_loop_sp < LOOP_STACK_DEPTH) { m_loop_stack[m_loop_sp] = value; m_loop_sp++; @@ -237,10 +237,10 @@ inline void adsp21xx_device::loop_stack_push(UINT32 value) inline void adsp21xx_device::loop_stack_pop() { - if (EXPECTED(m_loop_sp > 0)) + if (m_loop_sp > 0) { m_loop_sp--; - if (UNEXPECTED(m_loop_sp == 0)) + if (m_loop_sp == 0) { m_loop = 0xffff; m_loop_condition = 0; @@ -261,7 +261,7 @@ inline void adsp21xx_device::loop_stack_pop() inline void adsp21xx_device::stat_stack_push() { - if (EXPECTED(m_stat_sp < STAT_STACK_DEPTH)) + if (m_stat_sp < STAT_STACK_DEPTH) { m_stat_stack[m_stat_sp][0] = m_mstat; m_stat_stack[m_stat_sp][1] = m_imask; @@ -275,7 +275,7 @@ inline void adsp21xx_device::stat_stack_push() inline void adsp21xx_device::stat_stack_pop() { - if (EXPECTED(m_stat_sp > 0)) + if (m_stat_sp > 0) { m_stat_sp--; if (m_stat_sp == 0) diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c index e097d963461..3d23dcbbad5 100644 --- a/src/emu/drawgfx.c +++ b/src/emu/drawgfx.c @@ -495,7 +495,6 @@ void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_e // special case invalid pens to opaque if (transpen > 0xff) return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); -// int palbase; // use pen usage to optimize code %= gfx->total_elements; @@ -527,11 +526,6 @@ void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_e // use pen usage to optimize code %= gfx->total_elements; - color %= gfx->total_colors; - int palbase = gfx->color_base + gfx->color_granularity * color; - const pen_t *paldata = &gfx->machine().pens[palbase]; - - /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) { // fully transparent; do nothing @@ -544,14 +538,10 @@ void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_e return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); } - /* render based on dest bitmap depth */ + // render + const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; DECLARE_NO_PRIORITY; - if (dest.format() == BITMAP_FORMAT_IND16) - DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_IND16, NO_PRIORITY); - else if (dest.bpp() == 16) - DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); - else - DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); + DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); } diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index 156a6b3afe1..a6e68c6b133 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -139,15 +139,6 @@ do \ } \ while (0) \ -#define PIXEL_OP_REMAP_TRANSPEN_IND16(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - (DEST) = srcdata + palbase; \ -} \ -while (0) \ - #define PIXEL_OP_REMAP_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ diff --git a/src/emu/render.c b/src/emu/render.c index 78a208cbd01..b72bc2a2d6b 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -434,7 +434,7 @@ void render_texture::release() void render_texture::set_bitmap(bitmap_t &bitmap, const rectangle &sbounds, texture_format format) { - //assert(bitmap.cliprect().contains(sbounds)); + assert(bitmap.cliprect().contains(sbounds)); // ensure we have a valid palette for palettized modes if (format == TEXFORMAT_PALETTE16 || format == TEXFORMAT_PALETTEA16) @@ -1377,10 +1377,7 @@ render_primitive_list &render_target::get_primitives() // if there is no associated element, it must be a screen element if (curitem->screen() != NULL) - { add_container_primitives(list, item_xform, curitem->screen()->container(), blendmode); - curitem->screen()->set_render_size((int) item_xform.xscale, (int) item_xform.yscale); - } else add_element_primitives(list, item_xform, *curitem->element(), curitem->state(), blendmode); } @@ -1743,6 +1740,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const prim->bounds.x1 = render_round_nearest(container_xform.xoffs + bounds.x1 * container_xform.xscale); prim->bounds.y1 = render_round_nearest(container_xform.yoffs + bounds.y1 * container_xform.yscale); } + // compute the color of the primitive prim->color.r = container_xform.color.r * curitem->color().r; prim->color.g = container_xform.color.g * curitem->color().g; diff --git a/src/emu/screen.c b/src/emu/screen.c index 5c8c445491e..a819d84b351 100644 --- a/src/emu/screen.c +++ b/src/emu/screen.c @@ -51,7 +51,6 @@ #define VERBOSE (0) #define LOG_PARTIAL_UPDATES(x) do { if (VERBOSE) logerror x; } while (0) -//#define USE_MONITOR (1) //************************************************************************** @@ -105,10 +104,6 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev m_partial_updates_this_frame(0) { memset(m_texture, 0, sizeof(m_texture)); - - m_render_width = m_width; - m_render_height = m_height; - } @@ -475,13 +470,6 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a machine().video().update_refresh_speed(); } -const rectangle &screen_device::visible_area() const -{ - if (0 && m_crt.type() != crt_monitor::PASSTHROUGHX) - return m_crt.get_visible(); - else - return m_visarea; -} //------------------------------------------------- // reset_origin - reset the timing such that the @@ -530,20 +518,9 @@ void screen_device::realloc_screen_bitmaps() for (auto_bitmap_item *item = m_auto_bitmap_list.first(); item != NULL; item = item->next()) item->m_bitmap.resize(effwidth, effheight); - // set up textures - - if (m_crt.type() != crt_monitor::PASSTHROUGHX) - { - m_crt.resize(m_width, m_height); - rectangle crt_vis = m_crt.get_visible(); - m_texture[0]->set_bitmap(m_crt.final_bitmap(0), crt_vis, TEXFORMAT_RGB32); - m_texture[1]->set_bitmap(m_crt.final_bitmap(1), crt_vis, TEXFORMAT_RGB32); - } - else - { + // re-set up textures m_texture[0]->set_bitmap(m_bitmap[0], m_visarea, m_bitmap[0].texformat()); m_texture[1]->set_bitmap(m_bitmap[1], m_visarea, m_bitmap[1].texformat()); - } } @@ -882,25 +859,10 @@ bool screen_device::update_quads() // only update if empty and not a vector game; otherwise assume the driver did it directly if (m_type != SCREEN_TYPE_VECTOR && (machine().config().m_video_attributes & VIDEO_SELF_RENDER) == 0) { - if (m_crt.type() != crt_monitor::PASSTHROUGHX) - { - m_crt.resize(m_render_width, m_render_height); - m_crt.process(machine(), m_bitmap[m_curbitmap], m_curbitmap, m_visarea); - } - // if we're not skipping the frame and if the screen actually changed, then update the texture if (!machine().video().skip_this_frame() && m_changed) { - if (m_crt.type() != crt_monitor::PASSTHROUGHX) - { - rectangle fixedvis = m_crt.get_visible(); - m_texture[m_curbitmap]->set_bitmap(m_crt.final_bitmap(m_curbitmap), fixedvis, TEXFORMAT_RGB32); - } - else - { - m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], m_visarea, m_bitmap[m_curbitmap].texformat()); - } - + m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], m_visarea, m_bitmap[m_curbitmap].texformat()); m_curtexture = m_curbitmap; m_curbitmap = 1 - m_curbitmap; } @@ -1084,939 +1046,3 @@ void screen_device::load_effect_overlay(const char *filename) else mame_printf_warning("Unable to load effect PNG file '%s'\n", fullname.cstr()); } - -void screen_device::set_render_size(int width, int height) -{ - if (width<=4096 && height <=4096) - { - m_render_width = width; - m_render_height = height; - } -} - -//------------------------------------------------- -// The 3x3 matrix class -//------------------------------------------------- - -class vec3d -{ - friend class mat33d; -public: - vec3d() - { - } - vec3d(double a0, double a1, double a2) - { - a[0] = a0; - a[1] = a1; - a[2] = a2; - } - void set(double a0, double a1, double a2) - { - a[0] = a0; - a[1] = a1; - a[2] = a2; - } - double elem(int row) - { - return a[row]; - } - - void dump(void) - { - printf("%10.4f %10.4f %10.4f\n", a[0], a[1], a[2]); - } -protected: - double a[3]; -}; - -class mat33d -{ -public: - - void setConst(double val) - { - for (int i=0;i<3;i++) - for (int j=0;j<3; j++) - a[i][j] = val; - } - - void multScalar(double val) - { - for (int i=0;i<3;i++) - for (int j=0;j<3; j++) - a[i][j] = a[i][j]*val; - } - - void copyFrom(mat33d &src) - { - for (int i=0;i<3;i++) - for (int j=0;j<3; j++) - a[i][j] = src.a[i][j]; - } - - double det(void) - { - // a11(a33a22-a32a23)-a21(a33a12-a32a13)+a31(a23a12-a22a13) - return a[0][0] * (a[2][2]*a[1][1] - a[2][1]*a[1][2]) - - a[1][0] * (a[2][2]*a[0][1] - a[2][1]*a[0][2]) - + a[2][0] * (a[1][2]*a[0][1] - a[1][1]*a[0][2]); - } - - void invert(void) - { - mat33d ret; - double temdet = det(); - - //| a11 a12 a13 |-1 | a33a22-a32a23 -(a33a12-a32a13) a23a12-a22a13 | - //| a21 a22 a23 | = 1/DET * | -(a33a21-a31a23) a33a11-a31a13 -(a23a11-a21a13) | - //| a31 a32 a33 | | a32a21-a31a22 -(a32a11-a31a12) a22a11-a21a12 | - - - ret.a[0][0] = a[2][2]*a[1][1]-a[2][1]*a[1][2]; - ret.a[0][1] = -(a[2][2]*a[0][1]-a[2][1]*a[0][2]); - ret.a[0][2] = a[1][2]*a[0][1]-a[1][1]*a[0][2]; - ret.a[1][0] = -(a[2][2]*a[1][0]-a[2][0]*a[1][2]); - ret.a[1][1] = a[2][2]*a[0][0]-a[2][0]*a[0][2]; - ret.a[1][2] = -(a[1][2]*a[0][0]-a[1][0]*a[0][2]); - ret.a[2][0] = a[2][1]*a[1][0]-a[2][0]*a[1][1]; - ret.a[2][1] = -(a[2][1]*a[0][0]-a[2][0]*a[0][1]); - ret.a[2][2] = a[1][1]*a[0][0]-a[1][0]*a[0][1]; - copyFrom(ret); - multScalar(1.0f / temdet); - } - - void multVec(vec3d &r, vec3d &v) - { - for (int row = 0; row < 3; row++) - { - r.a[row] = a[row][0] * v.a[0] + a[row][1] * v.a[1] + a[row][2] * v.a[2]; - } - } - - void setRow(int row, double c0, double c1, double c2) - { - a[row][0] = c0; - a[row][1] = c1; - a[row][2] = c2; - } - - void setCol(int col, double r0, double r1, double r2) - { - a[0][col] = r0; - a[1][col] = r1; - a[2][col] = r2; - } - - double elem(int row, int col) - { - return a[row][col]; - } - - mat33d() - { - setConst(0.0f); - } - -protected: - double a[3][3]; -}; - -//------------------------------------------------- -// The monitor class -//------------------------------------------------- - -typedef struct -{ - const char *desc; - double xr, yr, xg, yg, xb, yb, xw, yw, gamma; -} CIE_Chroma_t; - -/* - * White points below use CIE 1964 - */ - -static const CIE_Chroma_t CIE_Mons[] = -{ - { "Guru", 0.57585, 0.34435, 0.28773, 0.55582, 0.18631,0.10346, 0.3138, 0.3310, 2.2 }, // D65 - //{ "Short-Persistence", 0.61, 0.35, 0.29, 0.59, 0.15, 0.063 }, // N/A N/A [Foley96, p. 583] - //{ "Long-Persistence", 0.62, 0.33, 0.21, 0.685, 0.15, 0.063 }, // N/A N/A [Foley96, p. 583] - //CCIR 601-1 is the old NTSC standard. Now called Rec 601-1. - { "NTSC", 0.67, 0.33, 0.21, 0.71, 0.14, 0.08, 0.3104, 0.319, 2.2 }, // 1ILLUMINANT_C [Walker98] - { "EBU", 0.64, 0.33, 0.30, 0.60, 0.15, 0.06, 0.3138, 0.3310, 2.4 }, // D65 [Walker98] - // (all monitors except 21, " Mitsubishi p/n 65532) - { "Dell", 0.625, 0.340, 0.275, 0.605, 0.150, 0.065, 0.280, 0.315, 2.2 }, // 9300K [Dell, E-mail, 12 Jan 99] - { "SMPTE", 0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3138, 0.3310, 2.2 }, // D65 [Walker98] - { "P22 NEC C400", 0.610, 0.350, 0.307, 0.595, 0.150, 0.065, 0.280, 0.315, 2.2 }, // [NEC98], 9300 K Gamma = 2.2 - { "P22 KDS VS19", 0.625, 0.340, 0.285, 0.605, 0.150, 0.065, 0.281, 0.311, 2.2 }, // - { "High Brightness LED",0.700, 0.300, 0.170, 0.700, 0.130, 0.075, 0.310, 0.320, 2.2 }, // Nichia Corporation - { "sRGB", 0.64, 0.33, 0.30, 0.60, 0.15, 0.06, 0.3138, 0.3310, 2.4 }, // D65 - { "Couriersud", 0.633, 0.336, 0.279, 0.598, 0.149, 0.073, 0.327, 0.355, 2.4 }, - - { NULL } -}; - -/* - * Calculate the RGB to CIE matrix ... - */ - -static void calc_mat(CIE_Chroma_t cie, mat33d &m) -{ - mat33d ms; - vec3d vwhite; - vec3d s; - - ms.setCol(0, cie.xr / cie.yr, 1.0, (1.0f - cie.xr - cie.yr) / cie.yr); - ms.setCol(1, cie.xg / cie.yg, 1.0, (1.0f - cie.xg - cie.yg) / cie.yg); - ms.setCol(2, cie.xb / cie.yb, 1.0, (1.0f - cie.xb - cie.yb) / cie.yb); - - ms.invert(); - - vwhite.set(cie.xw / cie.yw, 1.0, (1.0f - cie.xw - cie.yw) / cie.yw); - ms.multVec(s, vwhite); - - m.setCol(0, s.elem(0) * cie.xr / cie.yr, s.elem(0) * 1.0, s.elem(0) * (1.0f - cie.xr - cie.yr) / cie.yr); - m.setCol(1, s.elem(1) * cie.xg / cie.yg, s.elem(1) * 1.0, s.elem(1) * (1.0f - cie.xg - cie.yg) / cie.yg); - m.setCol(2, s.elem(2) * cie.xb / cie.yb, s.elem(2) * 1.0, s.elem(2) * (1.0f - cie.xb - cie.yb) / cie.yb); -} - -static double src_gamma(double v, double g) -{ - return pow(v, g ); -} - -static double srgb_gamma(double v) -{ - return v; - if ( v > 0.0031308 ) - return 1.055 * ( pow(v, 1.0f / 2.4f ) ) - 0.055; - else - return 12.92 * v; -} - -static rgb_t vec_to_rgb_t(vec3d v) -{ - return MAKE_RGB( - rgb_clamp((INT32) (srgb_gamma(v.elem(0)) * 255.0f)), - rgb_clamp((INT32) (srgb_gamma(v.elem(1)) * 255.0f)), - rgb_clamp((INT32) (srgb_gamma(v.elem(2)) * 255.0f)) - ); -} - -static void CIE_xy_to_rgbA(CIE_Chroma_t cie, rgb_t *base_r, rgb_t *base_g, rgb_t *base_b) -{ - mat33d rgb_to_cie; - mat33d cie_to_rgb; - vec3d tt, tn; - - tt.set(1,1,1); - - calc_mat(cie, rgb_to_cie); - rgb_to_cie.multVec(tn, tt); - tn.dump(); - - cie_to_rgb.setRow(0, 3.2406, -1.5372, -0.4986); - cie_to_rgb.setRow(1, -0.9689, 1.8758, 0.0415); - cie_to_rgb.setRow(2, 0.0557, -0.2040, 1.0570); - - for (int i = 0; i < 768; i++) - { - vec3d v_r, v_g, v_b, v_cie, v_rgb; - double val = src_gamma((double) i / 256.0f, cie.gamma); - - /* desaturate colors for more brightness for val > 1.0 - * at the expense of accuracy - */ - - double val2 = (val < 1.0) ? 0 : (val - 1.0) * 0.25; - v_r.set(val, val2, val2); - v_g.set(val2, val, val2); - v_b.set(val2, val2, val); - - rgb_to_cie.multVec(v_cie, v_r); - cie_to_rgb.multVec(v_rgb, v_cie); - base_r[i] = vec_to_rgb_t(v_rgb); - - if (i == 256) - { - printf("val %10.4f", val); - v_rgb.dump(); - } - - - rgb_to_cie.multVec(v_cie, v_g); - cie_to_rgb.multVec(v_rgb, v_cie); - base_g[i] = vec_to_rgb_t(v_rgb); - if (i == 256) - { - printf("val %10.4f", val); - v_rgb.dump(); - } - - rgb_to_cie.multVec(v_cie, v_b); - cie_to_rgb.multVec(v_rgb, v_cie); - base_b[i] = vec_to_rgb_t(v_rgb); - if (i == 256) - { - printf("val %10.4f", val); - v_rgb.dump(); - } - - } -} - - -void crt_monitor::set_param(crt_monitor_param ¶m) { - m_param = param; - - CIE_xy_to_rgbA(CIE_Mons[m_param.source_cie], base_red, base_green, base_blue); - - for (int i=0; i<256; i++) - { - m_exp[i] = 255.0f * (1.0f - exp(-(double) i / 255.0f * (double) (m_param.bandwidth * m_param.bandwidth) / 4096.0f)); - //printf("%d %d\n", i, m_exp[i]); - } -} - - -crt_monitor::crt_monitor(void) - : m_amplifier_r(NULL), m_amplifier_g(NULL), m_amplifier_b(NULL) -{ - m_param.r_off = -256 * 3 / 10; - m_param.g_off = -256 * 3 / 10; - m_param.b_off = -256 * 3 / 10; - m_param.r_gain = 256 * 11 / 10; - m_param.g_gain = 256 * 11 / 10; - m_param.b_gain = 256 * 11 / 10; - m_param.bandwidth = 255 * 32 / 100; - m_param.focus = 255 * 21 / 100 ; - m_param.decay = 255 * 30 / 100; - m_param.source_cie = 0; - - //m_param.m_type = CROMA_CLEAR; - //m_param.m_type = SHADOW_MASK; - m_param.m_type = PASSTHROUGHX; - - set_param(m_param); - m_horz_pixel = 0; - m_vert_pixel = 0; - resize(288*11/8 * 3, 288*11/8 * 3 / 4 * 3); - -} - -crt_monitor::~crt_monitor(void) -{ - free_bitmaps(); -} - -void crt_monitor::free_bitmaps(void) -{ - if (m_amplifier_r != NULL) - global_free(m_amplifier_r); - if (m_amplifier_g != NULL) - global_free(m_amplifier_g); - if (m_amplifier_b != NULL) - global_free(m_amplifier_b); -#if 0 - // FIXME: should be done automatically ? - if (m_mask_bm != NULL) - bitmap_free(m_mask_bm); - if (m_phos_bm[0] != NULL) - bitmap_free(m_phos_bm[0]); - if (m_phos_bm[1] != NULL) - bitmap_free(m_phos_bm[1]); -#endif -} - -void crt_monitor::resize(int new_width, int new_height) -{ - int scal_width; - int scal_height; - int adj = (m_param.m_type == SHADOW_MASK) ? 6 : 0; - - //printf("new %d %d\n", new_width, new_height); - - if (new_width > new_height) - { - scal_width = (new_width - adj) / 3; - scal_height = (new_height - adj) / 3; - } - else - { - scal_height = (new_width - adj) / 3; - scal_width = (new_height - adj) / 3; - int temp = new_height; - new_height = new_width; - new_width = temp; - } - - - if (scal_width == m_horz_pixel || scal_width <= 0) - return; - - int vis_height = 2048; // be safe(scal_height + 3); - int do_realloc = (scal_width > m_horz_pixel); - - m_horz_pixel = scal_width; - m_vert_pixel = m_horz_pixel * 3 / 4; - - - if (0 && m_param.m_type == SHADOW_MASK) - { - m_width = new_width; //m_horz_pixel * 3 + 6; - m_height = new_height;//m_vert_pixel * 3 + 6; - m_visible.min_x = 3; - m_visible.min_y = 3; - m_visible.max_x = m_width - 4; - m_visible.max_y = m_height - 4; - } - else - { - m_width = new_width; //m_horz_pixel * 3 + 6; - m_height = new_height;//m_vert_pixel * 3 + 6; - m_visible.min_x = 0; - m_visible.min_y = 0; - m_visible.max_x = m_width -1; - m_visible.max_y = m_height - 1; - } - - if (0 || do_realloc) - { - //free_bitmaps(); - - printf("realloc %d %d\n", m_width, m_height); - m_amplifier_r = global_alloc_array(INT16, m_horz_pixel * vis_height); - m_amplifier_g = global_alloc_array(INT16, m_horz_pixel * vis_height); - m_amplifier_b = global_alloc_array(INT16, m_horz_pixel * vis_height); - - m_mask_bm.allocate(m_width, m_height); - m_phos_bm[0].allocate(m_width, m_height); - m_phos_bm[1].allocate(m_width, m_height); - -#if 0 - bitmap_fill(m_phos_bm[0], NULL, 0); - bitmap_fill(m_phos_bm[1], NULL, 0); -#endif - } -} - - -INLINE rgb_t bpixel(running_machine &machine, bitmap_t &bm, int y, int x) -{ - //return machine-> pens[*((UINT16 *) bm->base + y * bm->rowpixels + x)]; - - if (bm.format() == BITMAP_FORMAT_RGB32) - return bm.pixt<rgb_t>(y, x); - else - return palette_get_color(machine, bm.pixt<UINT16>(y, x)); - - //return *((UINT16 *) bm->base + y * bm->rowpixels + x); -} -#if 1 - -INLINE void set_chan(INT16 *pix, int val, int w) -{ -#if 1 - if (val-*pix>0) - *pix += ((val-*pix)*w)>>8; -#else - int nv = (val * w) >> 8; - if (nv > *pix) - *pix = nv; -#endif - -} - -void crt_monitor::scale_and_bandwith(running_machine &machine, bitmap_t &bm_src, const rectangle &cliprect) -{ - int y,w,x; - - for (y = cliprect.min_y - 1; y <= cliprect.max_y + 1; y++) - { - INT16 *dst_r = m_amplifier_r + (y - cliprect.min_y + 1) * m_horz_pixel; - INT16 *dst_g = m_amplifier_g + (y - cliprect.min_y + 1) * m_horz_pixel; - INT16 *dst_b = m_amplifier_b + (y - cliprect.min_y + 1) * m_horz_pixel; - for (x=0;x<m_horz_pixel;x++) - { - dst_r[x] = (dst_r[x] * m_param.decay)>>8; - dst_g[x] = (dst_g[x] * m_param.decay)>>8; - dst_b[x] = (dst_b[x] * m_param.decay)>>8; - } - } - - w = MAX((cliprect.max_x - cliprect.min_x/* + 1*/), m_horz_pixel); - int x_add_s = (cliprect.max_x - cliprect.min_x /*+ 1*/) * 16384 / w; - int x_add_d = 16384 * m_horz_pixel / w;; - - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - { - int r = 0; - int g = 0; - int b = 0; - int rn = 0; - int bn = 0; - int gn = 0; - int lx_d = -1; - int time_r; - - INT16 *dst_r = m_amplifier_r + (y - cliprect.min_y + 1) * m_horz_pixel; - INT16 *dst_g = m_amplifier_g + (y - cliprect.min_y + 1) * m_horz_pixel; - INT16 *dst_b = m_amplifier_b + (y - cliprect.min_y + 1) * m_horz_pixel; - - int sx_s = cliprect.min_x * 16384; - int sx_d = 0; - time_r = 0; - for (x=0; x<w; x++) - { - rgb_t src = bpixel(machine, bm_src, y, (sx_s >> 14)); - int x_d = (sx_d >> 14); - int frac = (sx_s & 16383) >> 6; - - int bandwidth1; - int bandwidth0; - if (frac>time_r) - bandwidth1 = m_exp[(frac-time_r)]; - else - { - bandwidth1 = m_exp[(255 - time_r)]; - bandwidth0 = 255- bandwidth1; - r = (r * bandwidth0 + rn * bandwidth1) >> 8; - g = (g * bandwidth0 + gn * bandwidth1) >> 8; - b = (b * bandwidth0 + bn * bandwidth1) >> 8; - bandwidth1 = m_exp[(frac)]; - } - time_r = frac; - rn = ((MAX((int)RGB_RED(src) - m_param.r_off, 0) * m_param.r_gain) >> 8); - gn = ((MAX((int)RGB_GREEN(src) - m_param.g_off, 0) * m_param.g_gain) >> 8); - bn = ((MAX((int)RGB_BLUE(src) - m_param.b_off, 0) * m_param.b_gain ) >> 8); - bandwidth0 = 255- bandwidth1; - - r = (r * bandwidth0 + rn * bandwidth1) >> 8; - g = (g * bandwidth0 + gn * bandwidth1) >> 8; - b = (b * bandwidth0 + bn * bandwidth1) >> 8; - - if (x_d>lx_d) - { - set_chan(&dst_r[x_d], r, 255); - set_chan(&dst_g[x_d], g, 255); - set_chan(&dst_b[x_d], b, 255); - - set_chan(&dst_r[x_d-m_horz_pixel], r, m_param.focus); - set_chan(&dst_g[x_d-m_horz_pixel], g, m_param.focus); - set_chan(&dst_b[x_d-m_horz_pixel], b, m_param.focus); - - set_chan(&dst_r[x_d+m_horz_pixel], r, m_param.focus); - set_chan(&dst_g[x_d+m_horz_pixel], g, m_param.focus); - set_chan(&dst_b[x_d+m_horz_pixel], b, m_param.focus); - lx_d = x_d; - } - - sx_s += x_add_s; - sx_d += x_add_d; - } - } -} -#else -void crt_monitor::scale_and_bandwith(running_machine *machine, bitmap_t *bm_src, const rectangle *cliprect) -{ - int x; - int y; - int bandwidth0 = m_param.bandwidth; - int bandwidth1 = 256 - bandwidth0; - UINT16 tr[4*1024]; - UINT16 tg[4*1024]; - UINT16 tb[4*1024]; - - int x_add = (cliprect.max_x - cliprect.min_x + 1) * 1024 * 4/ (m_horz_pixel); - - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - { - int r = 0; - int g = 0; - int b = 0; - - /* bandwidth first ! */ - for (x=cliprect.min_x*4; x<=cliprect.max_x*4; x++) - { - rgb_t src = bpixel(machine, bm_src, y, x/4); - - r = (r * bandwidth0 + ((MAX((int)RGB_RED(src) - m_param.r_off, 0) * m_param.r_gain) >> 8) * bandwidth1) >> 8; - g = (g * bandwidth0 + ((MAX((int)RGB_GREEN(src) - m_param.g_off, 0) * m_param.g_gain) >> 8) * bandwidth1) >> 8; - b = (b * bandwidth0 + ((MAX((int)RGB_BLUE(src) - m_param.b_off, 0) * m_param.b_gain ) >> 8) * bandwidth1) >> 8; - - tr[x] = r; - tg[x] = g; - tb[x] = b; - } - - int sx = cliprect.min_x * 1024 * 4; - - INT16 *dst_r = m_amplifier_r + (y - cliprect.min_y) * m_horz_pixel; - INT16 *dst_g = m_amplifier_g + (y - cliprect.min_y) * m_horz_pixel; - INT16 *dst_b = m_amplifier_b + (y - cliprect.min_y) * m_horz_pixel; - - /* doing a linear interpolation is an approximation, - * however should suffice here. - */ - for (x = 0; x < m_horz_pixel; x++) - { - UINT16 frac = (sx & 0x3ff)>>2; - UINT16 xw = sx >> 10; - - frac = 0; - - *dst_r++ = (tr[xw] * (256-frac) + tr[xw+1] * frac)>>8; - *dst_g++ = (tg[xw] * (256-frac) + tg[xw+1] * frac)>>8; - *dst_b++ = (tb[xw] * (256-frac) + tb[xw+1] * frac)>>8; - - sx += x_add; - } - } -} -#endif - -void crt_monitor::copyonly(bitmap_rgb32 &bm_dst, rectangle &clip) -{ - int x; - int y; - - int sy = 0; - int s_add = (clip.max_y - clip.min_y + 1) * 256 / (m_visible.max_y - m_visible.min_y + 1) ; - - for (y = m_visible.min_y; y <= m_visible.max_y; y++) - { - rgb_t *dst = (rgb_t *) bm_dst.raw_pixptr(y, 0); - for (x = m_visible.min_x; x <= m_visible.max_x; x++) - { - int offset = (sy >> 8) * m_horz_pixel + ((x-m_visible.min_x) / 3); - UINT8 r = MIN(255, m_amplifier_r[offset]); - UINT8 g = MIN(255, m_amplifier_g[offset]); - UINT8 b = MIN(255, m_amplifier_b[offset]); - dst[0] = MAKE_RGB(r, g, b); - dst++; - } - sy += s_add; - } -} - -INLINE void set_pixel(rgb_t *pix, int r, int g, int b) -{ - int rn = r; - int gn = g; - int bn = b; - - *pix = MAKE_RGB( - (rgb_clamp((int)RGB_RED(*pix) + rn)), - (rgb_clamp((int)RGB_GREEN(*pix) + gn)), - (rgb_clamp((int)RGB_BLUE(*pix) + bn)) - ); -} - -INLINE void set_pixela(rgb_t *pix, rgb_t val, int w) -{ - UINT8 rn = RGB_RED(val); - UINT8 gn = RGB_GREEN(val); - UINT8 bn = RGB_BLUE(val); - - UINT8 ro = RGB_RED(*pix); - UINT8 go = RGB_GREEN(*pix); - UINT8 bo = RGB_BLUE(*pix); - - if (rn-ro>0) - ro += ((rn-ro)*w)>>8; - if (gn-go>0) - go += ((gn-go)*w)>>8; - if (bn-bo>0) - bo += ((bn-bo)*w)>>8; - - *pix = MAKE_RGB(ro, go, bo); -} - -void crt_monitor::copy_shadow_mask(bitmap_rgb32 &bm_dst, const rectangle &clip) -{ - int gainv[3] = { 100, 100, 100}; - int sy = 0; - int s_add = (clip.max_y - clip.min_y + 1) * 16384 / (m_visible.max_y - m_visible.min_y + 1) ; - - int x; - int y; - - gainv[1] = 255; - gainv[0] = m_param.focus; - gainv[2] = m_param.focus; - - for (y = m_visible.min_y+3; y <= m_visible.max_y-4; y++) - { - rgb_t *dst0 = (rgb_t *) bm_dst.raw_pixptr(y, m_visible.min_x); - rgb_t *dst1 = (rgb_t *) bm_dst.raw_pixptr(y + 1, m_visible.min_x); - int gaina = gainv[y % 3]; - - for (x = m_visible.min_x+3; x <= m_visible.max_x-4; x+=3) - { - int offset = ((sy + 8191) >> 14) * m_horz_pixel + (((y & 1) == 0) ? (x-m_visible.min_x) / 3 : (2*(x-m_visible.min_x)-3) / 6) ; - - int rn = (m_amplifier_r[offset] * gaina)>>8; - int gn = (m_amplifier_g[offset] * gaina)>>8; - int bn = (m_amplifier_b[offset] * gaina)>>8; -#if 0 - int r_ov = MAX(rn - 255, 0); - int g_ov = MAX(gn - 255, 0); - int b_ov = MAX(bn - 255, 0); - - if ((y & 1) == 0) - { - set_pixel(dst0 - 1, r_ov, 0, 0); - set_pixel(dst0 + 0, rn, g_ov, b_ov); - set_pixel(dst0 + 1, r_ov, gn, b_ov); - set_pixel(dst0 + 2, 0, g_ov, 0); - set_pixel(dst1 + 0, 0, 0, b_ov); - set_pixel(dst1 + 1, r_ov, g_ov, bn); - set_pixel(dst1 + 2, 0, 0, b_ov); - } - else - { - set_pixel(dst0 - 2, r_ov, 0, 0); - set_pixel(dst0 - 1, rn, g_ov, b_ov); - set_pixel(dst0 + 0, r_ov, gn, b_ov); - set_pixel(dst0 + 1, 0, g_ov, 0); - set_pixel(dst1 - 2, 0, 0, b_ov); - set_pixel(dst1 - 1, r_ov, g_ov, bn); - set_pixel(dst1 - 0, 0, 0, b_ov); - } -#else - if ((y & 1) == 0) - { - *(dst0 + 0) = base_red[rn]; - *(dst0 + 1) = base_green[gn]; - *(dst1 + 1) = base_blue[bn]; - } - else - { - *(dst0 - 1) = base_red[rn]; - *(dst0 + 0) = base_green[gn]; - *(dst1 - 1) = base_blue[bn]; - } -#endif - dst1 += 3; - dst0 += 3; - } - sy += s_add; - } -} - -void crt_monitor::copy_chroma(bitmap_rgb32 &bm_dst, const rectangle &clip) -{ -#if 1 - int gainv[4][2] = { - { 256 / 4, 256 }, - { 256, 256 }, - { 256, 256 / 4 }, - { 256, 256 } - }; -#else - int gainv[4][2] = { - { m_param.focus, 256 }, - { m_param.focus, m_param.focus }, - { 256, m_param.focus }, - { m_param.focus, m_param.focus } - }; -#endif - int sy = 0; - int s_add = (clip.max_y - clip.min_y + 1) * 16384 / (m_visible.max_y - m_visible.min_y + 1) ; - - int x; - int y; - - //gainv[0][0] = m_param.focus; - //gainv[1][0] = m_param.focus; - - for (y = m_visible.min_y; y <= m_visible.max_y; y++) - { - rgb_t *dst0 = (rgb_t *) bm_dst.raw_pixptr(y, m_visible.min_x); - rgb_t *dstm1 = dst0 - 3 * bm_dst.rowpixels(); - rgb_t *dstp1 = dst0 + 3 * bm_dst.rowpixels(); - - for (x = m_visible.min_x; x <= m_visible.max_x; x+=3) - { - int offset = (((sy + 8191) >> 14)+1) * m_horz_pixel + (x-m_visible.min_x) / 3; - int gaina = gainv[y & 3][((x-m_visible.min_x)/3) & 1]; - - int rn = (m_amplifier_r[offset] * gaina)>>8; - int gn = (m_amplifier_g[offset] * gaina)>>8; - int bn = (m_amplifier_b[offset] * gaina)>>8; - - -#if 0 - int blank=0; - - if ((((x / 3) & 1) == 0) && ((y % 4) == 0)) - blank = 1; - else if ((((x / 3) & 1) == 1) && ((y % 4) == 2)) - blank = 1; - - if (!blank) - { -#endif -#if 0 - int r_ov = MAX(rn - 255, 0); - int g_ov = MAX(gn - 255, 0); - int b_ov = MAX(bn - 255, 0); - - set_pixel(dst0 - 1, r_ov, 0, 0); - set_pixel(dst0 + 0, rn, g_ov, 0); - set_pixel(dst0 + 1, 0, gn, b_ov); - set_pixel(dst0 + 2, 0, 0, bn); -#elif 0 - int r_ov = MAX(rn - 255, 0); - int g_ov = MAX(gn - 255, 0); - int b_ov = MAX(bn - 255, 0); - - set_pixel(dst0 + 0, rn, r_ov, r_ov); - set_pixel(dst0 + 1, g_ov, gn, g_ov); - set_pixel(dst0 + 2, b_ov, b_ov, bn); -#elif 0 - int frac1 = (sy & 16383)>>6; - int frac = (255-frac1); - int rn1 = (m_amplifier_r[offset+m_horz_pixel] * gaina)>>8; - int gn1 = (m_amplifier_g[offset+m_horz_pixel] * gaina)>>8; - int bn1 = (m_amplifier_b[offset+m_horz_pixel] * gaina)>>8; - - *(dst0+0) = base_red[(rn*frac+rn1*frac1)>>8]; - *(dst0+1) = base_green[(gn*frac+gn1*frac1)>>8]; - *(dst0+2) = base_blue[(bn*frac+bn1*frac1)>>8]; -#elif 1 - *(dst0+0) = base_red[rn]; - *(dst0+1) = base_green[gn]; - *(dst0+2) = base_blue[bn]; -#elif 1 - set_pixela(dst0 , base_red[rn],192); - set_pixela(dst0+1, base_green[gn],192); - set_pixela(dst0+2, base_blue[bn],192); - if (m_param.focus > 0) - { - set_pixela(dstm1 , base_red[rn],m_param.focus); - set_pixela(dstm1+1, base_green[gn],m_param.focus); - set_pixela(dstm1+2, base_blue[bn],m_param.focus); - set_pixela(dstp1 , base_red[rn],m_param.focus); - set_pixela(dstp1+1, base_green[gn],m_param.focus); - set_pixela(dstp1+2, base_blue[bn],m_param.focus); -#if 0 - set_pixela(dst0-3, base_red[rn],m_param.focus); - set_pixela(dst0-2, base_green[gn],m_param.focus); - set_pixela(dst0-1, base_blue[bn],m_param.focus); - set_pixela(dst0+3, base_red[rn],m_param.focus); - set_pixela(dst0+4, base_green[gn],m_param.focus); - set_pixela(dst0+5, base_blue[bn],m_param.focus); -#endif - } - -#else - /* looks horrible */ - int r = RGB_RED(base_red[rn]) + RGB_RED(base_green[gn]) + RGB_RED(base_blue[bn]); - int g = RGB_GREEN(base_red[rn]) + RGB_GREEN(base_green[gn]) + RGB_GREEN(base_blue[bn]); - int b = RGB_BLUE(base_red[rn]) + RGB_BLUE(base_green[gn]) + RGB_BLUE(base_blue[bn]); - - rgb_t c = MAKE_RGB(rgb_clamp(r), rgb_clamp(g), rgb_clamp(b)); - *(dst0+0) = c; - *(dst0+1) = c; - *(dst0+2) = c; -#endif -// } - dst0 += 3; - dstm1 += 3; - dstp1 += 3; - } - sy += s_add; - } -} - -void crt_monitor::phosphor(bitmap_rgb32 &bm_dst, bitmap_rgb32 &bm_phos, bitmap_rgb32 &bm_src, const rectangle &cliprect) -{ - const int phos_decay = m_param.decay; - - const int phos_red_decay = phos_decay; - const int phos_green_decay = phos_decay; - const int phos_blue_decay = phos_decay; - - //int phos_red_decay1 = 256 - phos_red_decay; - //int phos_green_decay1 = 256 - phos_green_decay; - //int phos_blue_decay1 = 256 - phos_blue_decay; - - int x; - int y; - - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - { - rgb_t *src = (rgb_t *) bm_src.raw_pixptr(y, cliprect.min_x); - rgb_t *sp = (rgb_t *) bm_phos.raw_pixptr(y, cliprect.min_x); - rgb_t *dst = (rgb_t *) bm_dst.raw_pixptr(y, cliprect.min_x); - - for (x = cliprect.min_x; x <= cliprect.max_x; x++) - { -#if 0 - int r = ((int)RGB_RED(*src) * phos_red_decay1 + (int)RGB_RED(*sp) * phos_red_decay) >> 8; - int g = ((int)RGB_GREEN(*src) * phos_green_decay1 + (int)RGB_GREEN(*sp) * phos_green_decay) >> 8;; - int b = ((int)RGB_BLUE(*src) * phos_blue_decay1 + (int)RGB_BLUE(*sp) * phos_blue_decay) >> 8; -#else - int r = ((int)RGB_RED(*sp) * phos_red_decay) >> 8; - int g = ((int)RGB_GREEN(*sp) * phos_green_decay) >> 8;; - int b = ((int)RGB_BLUE(*sp) * phos_blue_decay) >> 8; - int r1 = RGB_RED(*src); - int g1 = RGB_GREEN(*src); - int b1 = RGB_BLUE(*src); - if (r1 > r) r = r1; - if (g1 > g) g = g1; - if (b1 > b) b = b1; -#endif - *dst = MAKE_RGB(r, g, b); - - src++; sp++; dst++; - } - } -} - -void crt_monitor::process(running_machine &machine, screen_bitmap &src_bm, int cur_bm, rectangle &clip) -{ - bitmap_rgb32 *temp = (0 && m_param.decay > 0) ? &m_mask_bm : &m_phos_bm[cur_bm]; - - switch (m_param.m_type) - { - case PASSTHROUGHX: - break; - case SHADOW_MASK: - scale_and_bandwith(machine, src_bm, clip); - temp->fill(0); - copy_shadow_mask(*temp, clip ); - break; - case CROMA_CLEAR: - scale_and_bandwith(machine, src_bm, clip); - temp->fill(0); - copy_chroma(*temp, clip ); - break; - //case APERTURE_GRILLE: - //break; - } - if (m_param.m_type != PASSTHROUGHX) - { - if (0 && m_param.decay > 0) - phosphor(m_phos_bm[cur_bm],m_phos_bm[1-cur_bm], m_mask_bm, m_visible); - } -} - -int crt_monitor::get_cie_count(void) -{ - int num = 0; - const CIE_Chroma_t *t = &CIE_Mons[0]; - - while (t->desc !=NULL) - { - t++; - num++; - } - return num; -} - -const char * crt_monitor::get_cie_name(void) -{ - return CIE_Mons[m_param.source_cie].desc; -} diff --git a/src/emu/screen.h b/src/emu/screen.h index 76b1c43cedc..c89f227c1b7 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -156,104 +156,6 @@ typedef device_delegate<UINT32 (screen_device &, bitmap_rgb32 &, const rectangle typedef device_delegate<void (screen_device &, bool)> screen_vblank_delegate; -// ======================> monitor_device - - -class crt_monitor -{ -public: - - typedef enum - { - PASSTHROUGHX = 0, // PASSTHROUGH somewhere defined in win32 environment - SHADOW_MASK = 1, - CROMA_CLEAR = 2, -// APERTURE_GRILLE, - } crt_monitor_type; - - typedef struct - { - crt_monitor_type m_type; - INT16 r_off; - INT16 g_off; - INT16 b_off; - UINT16 r_gain; - UINT16 b_gain; - UINT16 g_gain; - UINT16 focus; - UINT16 decay; - UINT16 bandwidth; - UINT8 source_cie; - } crt_monitor_param; - - crt_monitor(void); - ~crt_monitor(void); - - void resize(int new_width, int new_height); - - bitmap_t &final_bitmap(int cur_bm) { return m_phos_bm[cur_bm]; } - - void get_param(crt_monitor_param ¶m) { param = m_param; } - void set_param(crt_monitor_param ¶m); - - crt_monitor_type type(void) const { return m_param.m_type; } - //void set_type(crt_monitor_type new_type) { m_type = new_type; } - - //void set_horz_pixel(int num) { m_horz_pixel = num; } - - void process(running_machine &machine, screen_bitmap &src_bm, int cur_bm, rectangle &clip); - - const rectangle &get_visible() const { return m_visible; } - - int get_cie_count(void); - const char * get_cie_name(void); - - int get_type_count(void) { return 3; } - const char * get_type_name(void) - { - switch (m_param.m_type) - { - case PASSTHROUGHX: - return "Passthrough"; - case CROMA_CLEAR: - return "Croma Clear"; - case SHADOW_MASK: - return "Shadow Mask"; - } - return ""; - } - - -private: - INT16 * m_amplifier_r; - INT16 * m_amplifier_g; - INT16 * m_amplifier_b; - bitmap_rgb32 m_mask_bm; - bitmap_rgb32 m_phos_bm[2]; - - crt_monitor_param m_param; - rectangle m_visible; - //rectangle m_src_visible; - - int m_vert_pixel; - int m_horz_pixel; - int m_width; - int m_height; - - void free_bitmaps(void); - void scale_and_bandwith(running_machine &machine, bitmap_t &bm_src, const rectangle &cliprect); - void copyonly(bitmap_rgb32 &bm_dst, rectangle &clip); - void copy_shadow_mask(bitmap_rgb32 &bm_dst, const rectangle &clip); - void copy_chroma(bitmap_rgb32 &bm_dst, const rectangle &clip); - void phosphor(bitmap_rgb32 &bm_dst, bitmap_rgb32 &bm_phos, bitmap_rgb32 &bm_src, const rectangle &cliprect); - - rgb_t base_red[768]; - rgb_t base_green[768]; - rgb_t base_blue[768]; - int m_exp[256]; -}; - - // ======================> screen_device class screen_device : public device_t @@ -269,7 +171,7 @@ public: screen_type_enum screen_type() const { return m_type; } int width() const { return m_width; } int height() const { return m_height; } - const rectangle &visible_area() const;// { return m_visarea; } + const rectangle &visible_area() const { return m_visarea; } const rectangle &cliprect() const { return m_bitmap[0].cliprect(); } bool oldstyle_vblank_supplied() const { return m_oldstyle_vblank_supplied; } attoseconds_t refresh_attoseconds() const { return m_refresh; } @@ -322,8 +224,6 @@ public: void update_now(); void reset_partial_updates(); - void set_render_size(int width, int height); - // additional helpers void register_vblank_callback(vblank_state_delegate vblank_callback); void register_screen_bitmap(bitmap_t &bitmap); @@ -333,10 +233,6 @@ public: bool update_quads(); void update_burnin(); - // access to crt - - crt_monitor &crt(void) { return m_crt; } - // globally accessible constants static const int DEFAULT_FRAME_RATE = 60; static const attotime DEFAULT_FRAME_PERIOD; @@ -410,10 +306,6 @@ private: UINT64 m_frame_number; // the current frame number UINT32 m_partial_updates_this_frame;// partial update counter this frame - // render size - INT32 m_render_width; - INT32 m_render_height; - // VBLANK callbacks class callback_item { @@ -441,10 +333,6 @@ private: bitmap_t & m_bitmap; }; simple_list<auto_bitmap_item> m_auto_bitmap_list; // list of registered bitmaps - - // monitor emulation - - crt_monitor m_crt; }; // device type definition diff --git a/src/emu/ui.c b/src/emu/ui.c index 5de1b6441a4..648c6b4236d 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -160,20 +160,6 @@ static INT32 slider_overyoffset(running_machine &machine, void *arg, astring *st static INT32 slider_flicker(running_machine &machine, void *arg, astring *string, INT32 newval); static INT32 slider_beam(running_machine &machine, void *arg, astring *string, INT32 newval); static char *slider_get_screen_desc(screen_device &screen); - -static INT32 slider_crt_red_off(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_green_off(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_blue_off(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_red_gain(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_green_gain(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_blue_gain(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_decay(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_bandwidth(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_focus(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_cie(running_machine &machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crt_type(running_machine &machine, void *arg, astring *string, INT32 newval); - - #ifdef MAME_DEBUG static INT32 slider_crossscale(running_machine &machine, void *arg, astring *string, INT32 newval); static INT32 slider_crossoffset(running_machine &machine, void *arg, astring *string, INT32 newval); @@ -1783,54 +1769,6 @@ static slider_state *slider_init(running_machine &machine) break; } - screen_device_iterator iter(machine.root_device()); - for (screen_device *screen = iter.first(); screen != NULL; screen = iter.next()) - if (screen->screen_type() != SCREEN_TYPE_VECTOR) - { - void *param = (void *)screen; - - string.printf("%s Red Offset", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, -256, 0, 256, 5, slider_crt_red_off, param); - tailptr = &(*tailptr)->next; - string.printf("%s Green Offset", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, -256, 0, 256, 5, slider_crt_green_off, param); - tailptr = &(*tailptr)->next; - string.printf("%s Blue Offset", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, -256, 0, 256, 5, slider_crt_blue_off, param); - tailptr = &(*tailptr)->next; - - string.printf("%s Red Gain", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 256, 767, 5, slider_crt_red_gain, param); - tailptr = &(*tailptr)->next; - string.printf("%s Green Gain", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 256, 767, 5, slider_crt_green_gain, param); - tailptr = &(*tailptr)->next; - string.printf("%s Blue Gain", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 256, 767, 5, slider_crt_blue_gain, param); - tailptr = &(*tailptr)->next; - - string.printf("%s Phosphor decay", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 0, 256, 5, slider_crt_decay, param); - tailptr = &(*tailptr)->next; - - string.printf("%s Bandwidth", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 0, 256, 5, slider_crt_bandwidth, param); - tailptr = &(*tailptr)->next; - - string.printf("%s Focus", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 256, 256, 5, slider_crt_focus, param); - tailptr = &(*tailptr)->next; - - string.printf("%s CIE", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 0, screen->crt().get_cie_count()-1, 1, slider_crt_cie, param); - tailptr = &(*tailptr)->next; - - string.printf("%s Monitor type", slider_get_screen_desc(*screen)); - *tailptr = slider_alloc(machine, string, 0, 0, screen->crt().get_type_count()-1, 1, slider_crt_type, param); - tailptr = &(*tailptr)->next; - - } - #ifdef MAME_DEBUG /* add crosshair adjusters */ for (port = machine.ioport().first_port(); port != NULL; port = port->next()) @@ -1850,185 +1788,6 @@ static slider_state *slider_init(running_machine &machine) return listhead; } -/*------------------------------------------------- - slider_crt_* - CRT Monitor sliders --------------------------------------------------*/ - -static INT32 slider_crt_red_off(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.r_off = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.r_off / 256.0f); - return param.r_off; -} - -static INT32 slider_crt_green_off(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.g_off = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.g_off / 256.0f); - return param.g_off; -} - -static INT32 slider_crt_blue_off(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.b_off = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.b_off / 256.0f); - return param.b_off; -} - -static INT32 slider_crt_red_gain(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.r_gain = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.r_gain / 256.0f); - return param.r_gain; -} - -static INT32 slider_crt_green_gain(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.g_gain = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.g_gain / 256.0f); - return param.g_gain; -} - -static INT32 slider_crt_blue_gain(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.b_gain = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.b_gain / 256.0f); - return param.b_gain; -} - -static INT32 slider_crt_decay(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.decay = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.decay / 256.0f); - return param.decay; -} - -static INT32 slider_crt_bandwidth(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.bandwidth = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.bandwidth / 256.0f); - return param.bandwidth; -} - -static INT32 slider_crt_focus(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.focus = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%.2f", (double) param.focus / 256.0f); - return param.focus; -} - -static INT32 slider_crt_cie(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.source_cie = newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%s", screen->crt().get_cie_name()); - return param.source_cie; -} - -static INT32 slider_crt_type(running_machine &machine, void *arg, astring *string, INT32 newval) -{ - screen_device *screen = reinterpret_cast<screen_device *>(arg); - crt_monitor::crt_monitor_param param; - - screen->crt().get_param(param); - if (newval != SLIDER_NOCHANGE) - { - param.m_type = (crt_monitor::crt_monitor_type) newval; - screen->crt().set_param(param); - } - if (string != NULL) - string->printf("%s", screen->crt().get_type_name()); - return param.m_type; -} /*------------------------------------------------- slider_volume - global volume slider callback |