From 791460bd0356ebd25021b55d7573c7c9005752ae Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 16 Jun 2016 23:46:59 +0200 Subject: [PATCH 01/42] removed goto:s and somewhat simplified the readabaility --- src/mame/drivers/halleys.cpp | 494 ++++++++++++++++------------------- 1 file changed, 224 insertions(+), 270 deletions(-) diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp index 45fcde5b1f4..fa5401fa6fc 100644 --- a/src/mame/drivers/halleys.cpp +++ b/src/mame/drivers/halleys.cpp @@ -435,76 +435,69 @@ if (0) { bank = ((code & BANKBIT0) | (color & BANKBIT1)) << 8; pal_ptr = m_internal_palette.get(); - // the crossroad of fate - if (code & BGLAYER || command & 7) goto COMMAND_MODE; - - - // reject off-screen objects - if (flags & MIRROR_Y) { flags |= FLIP_Y; y -= (h - 1); } - if (flags & MIRROR_X) { flags |= FLIP_X; x -= (w - 1); } - if (y > VIS_MAXY || (y + h) <= VIS_MINY) return; - if (x > VIS_MAXX || (x + w) <= VIS_MINX) return; - - - // clip objects against the visible area - yclip = y; xclip = x; hclip = h; wclip = w; - src_yskip = src_xskip = 0; - if (yclip < VIS_MINY) { src_yskip = VIS_MINY - yclip; yclip = VIS_MINY; hclip -= src_yskip; } - if (yclip + hclip > VIS_MAXY+1) { hclip = VIS_MAXY+1 - yclip; } - if (xclip < VIS_MINX) { src_xskip = VIS_MINX - xclip; xclip = VIS_MINX; wclip -= src_xskip; } - if (xclip + wclip > VIS_MAXX+1) { wclip = VIS_MAXX+1 - xclip; } - dst_skip = (yclip << SCREEN_WIDTH_L2) + xclip; - - - // adjust orientations - eax = 0; - if (flags & (S1_REV | S2_REV)) { flags ^= FLIP_Y | FLIP_X; eax -= w * h - 8; } - - if (flags & FLIP_Y) + if (!(code & BGLAYER || command & 7)) { - eax += w * (h - 1); - src_yskip = -src_yskip; - src_dy = (flags & FLIP_X) ? -w + wclip : -w - wclip; + // reject off-screen objects + if (flags & MIRROR_Y) { flags |= FLIP_Y; y -= (h - 1); } + if (flags & MIRROR_X) { flags |= FLIP_X; x -= (w - 1); } + if (y > VIS_MAXY || (y + h) <= VIS_MINY) return; + if (x > VIS_MAXX || (x + w) <= VIS_MINX) return; - } - else src_dy = (flags & FLIP_X) ? w + wclip : w - wclip; + // clip objects against the visible area + yclip = y; xclip = x; hclip = h; wclip = w; + src_yskip = src_xskip = 0; + if (yclip < VIS_MINY) { src_yskip = VIS_MINY - yclip; yclip = VIS_MINY; hclip -= src_yskip; } + if (yclip + hclip > VIS_MAXY+1) { hclip = VIS_MAXY+1 - yclip; } + if (xclip < VIS_MINX) { src_xskip = VIS_MINX - xclip; xclip = VIS_MINX; wclip -= src_xskip; } + if (xclip + wclip > VIS_MAXX+1) { wclip = VIS_MAXX+1 - xclip; } + dst_skip = (yclip << SCREEN_WIDTH_L2) + xclip; - if (flags & FLIP_X) - { - eax += w - 1; - src_xskip = -src_xskip; - src_dx = -1; - } - else src_dx = 1; + // adjust orientations + eax = 0; + if (flags & (S1_REV | S2_REV)) { flags ^= FLIP_Y | FLIP_X; eax -= w * h - 8; } + if (flags & FLIP_Y) + { + eax += w * (h - 1); + src_yskip = -src_yskip; + src_dy = (flags & FLIP_X) ? -w + wclip : -w - wclip; + } + else src_dy = (flags & FLIP_X) ? w + wclip : w - wclip; - // calculate entry points and loop constants - src1_ptr = m_gfx_plane02 + ((bank + src1)<<3) + eax; - src2_ptr = m_gfx_plane13 + ((bank + src2)<<3) + eax; + if (flags & FLIP_X) + { + eax += w - 1; + src_xskip = -src_xskip; + src_dx = -1; + } + else src_dx = 1; - if (!(flags & (S1_IDLE | S2_IDLE))) - { - eax = src_yskip * w + src_xskip; - src1_ptr += eax; - src2_ptr += eax; - } - else src_dy = src_dx = 0; + // calculate entry points and loop constants + src1_ptr = m_gfx_plane02 + ((bank + src1)<<3) + eax; + src2_ptr = m_gfx_plane13 + ((bank + src2)<<3) + eax; - dst_ptr = m_render_layer[layer] + dst_skip; + if (!(flags & (S1_IDLE | S2_IDLE))) + { + eax = src_yskip * w + src_xskip; + src1_ptr += eax; + src2_ptr += eax; + } + else src_dy = src_dx = 0; + dst_ptr = m_render_layer[layer] + dst_skip; - // look up pen values and set rendering flags - pen0 = code>>3 & 0x10; - pen1 = 0; - if (command == EFX1) { flags |= BACKMODE; pen0 |= SP_2BACK; } - if (src1 == src2) - { - flags |= SINGLE_PEN; - eax = (UINT32)penxlat[color & PENCOLOR]; - if (eax) pen1 = pen0 + eax; - } - else if (color & PENCOLOR) flags |= RGB_MASK; + // look up pen values and set rendering flags + pen0 = code>>3 & 0x10; + pen1 = 0; + if (command == EFX1) { flags |= BACKMODE; pen0 |= SP_2BACK; } + if (src1 == src2) + { + flags |= SINGLE_PEN; + eax = (UINT32)penxlat[color & PENCOLOR]; + if (eax) pen1 = pen0 + eax; + } + else if (color & PENCOLOR) flags |= RGB_MASK; //-------------------------------------------------------------------------- @@ -518,224 +511,213 @@ if (0) { //-------------------------------------------------------------------------- - // multi-pen block or transparent blit - if ((flags & (SINGLE_PEN | RGB_MASK | COLOR_ON)) == COLOR_ON) - { - if (!(flags & IGNORE_0)) BLOCK_WIPE_COMMON - - dst_ptr += wclip; - ecx = wclip = -wclip; - edx = src_dx; - - if (flags & PPCD_ON) goto COLLISION_MODE; - - al = ah = (UINT8)pen0; - - if (!(flags & BACKMODE)) + // multi-pen block or transparent blit + if ((flags & (SINGLE_PEN | RGB_MASK | COLOR_ON)) == COLOR_ON) { - do { - do { - al |= *src1_ptr; - src1_ptr += edx; - al |= *src2_ptr; - src2_ptr += edx; - if (al & 0xf) { dst_ptr[ecx] = (UINT16)al; al = ah;} + if (!(flags & IGNORE_0)) BLOCK_WIPE_COMMON + + dst_ptr += wclip; + ecx = wclip = -wclip; + edx = src_dx; + + if (!(flags & PPCD_ON)) + { + al = ah = (UINT8)pen0; + + if (!(flags & BACKMODE)) + { + do { + do { + al |= *src1_ptr; + src1_ptr += edx; + al |= *src2_ptr; + src2_ptr += edx; + if (al & 0xf) { dst_ptr[ecx] = (UINT16)al; al = ah;} + } + while (++ecx); + ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; + } + while (--hclip); } - while (++ecx); - ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; - } - while (--hclip); - } - else - { - do { - do { - al |= *src1_ptr; - src1_ptr += edx; - al |= *src2_ptr; - src2_ptr += edx; - if (al & 0xf) { dst_ptr[ecx] = (UINT16)al | SP_2BACK; al = ah; } + else + { + do { + do { + al |= *src1_ptr; + src1_ptr += edx; + al |= *src2_ptr; + src2_ptr += edx; + if (al & 0xf) { dst_ptr[ecx] = (UINT16)al | SP_2BACK; al = ah; } + } + while (++ecx); + ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; + } + while (--hclip); } - while (++ecx); - ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; + return; } - while (--hclip); - } - return; - - - COLLISION_MODE: - - ax = 0; - if (group) - { - do { + ax = 0; + if (group) + { do { - al = *src1_ptr; - src1_ptr += edx; - al |= *src2_ptr; - src2_ptr += edx; - if (al & 0xf) { dst_ptr[ecx] = (UINT16)al | SP_COLLD; } // set collision flag on group one pixels + do { + al = *src1_ptr; + src1_ptr += edx; + al |= *src2_ptr; + src2_ptr += edx; + if (al & 0xf) { dst_ptr[ecx] = (UINT16)al | SP_COLLD; } // set collision flag on group one pixels + } + while (++ecx); + ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; } - while (++ecx); - ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; + while (--hclip); } - while (--hclip); - } - else - { - do { + else + { do { - al = *src1_ptr; - src1_ptr += edx; - al |= *src2_ptr; - src2_ptr += edx; - if (al & 0xf) { ax |= dst_ptr[ecx]; dst_ptr[ecx] = (UINT16)al; } // combine collision flags in ax + do { + al = *src1_ptr; + src1_ptr += edx; + al |= *src2_ptr; + src2_ptr += edx; + if (al & 0xf) { ax |= dst_ptr[ecx]; dst_ptr[ecx] = (UINT16)al; } // combine collision flags in ax + } + while (++ecx); + ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; } - while (++ecx); - ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; + while (--hclip); } - while (--hclip); - } - // update collision list if object collided with the other group - if (status & ACTIVE && ax & SP_COLLD) - { - m_collision_list[m_collision_count & (MAX_SPRITES-1)] = offset; - m_collision_count++; + // update collision list if object collided with the other group + if (status & ACTIVE && ax & SP_COLLD) + { + m_collision_list[m_collision_count & (MAX_SPRITES-1)] = offset; + m_collision_count++; - #if HALLEYS_DEBUG - popmessage("ID:%02x CC:%3d", offset, m_collision_count); - #endif - } - - } else + #if HALLEYS_DEBUG + popmessage("ID:%02x CC:%3d", offset, m_collision_count); + #endif + } + } else //-------------------------------------------------------------------------- - // multi-pen, RGB masked block or transparent blit - if ((flags & (RGB_MASK | COLOR_ON)) == RGB_MASK + COLOR_ON) - { - if (!(flags & IGNORE_0)) BLOCK_WIPE_COMMON + // multi-pen, RGB masked block or transparent blit + if ((flags & (RGB_MASK | COLOR_ON)) == RGB_MASK + COLOR_ON) + { + if (!(flags & IGNORE_0)) BLOCK_WIPE_COMMON + dst_ptr += wclip; + ecx = wclip = -wclip; + al = ah = (UINT8)pen0; + ebx = rgbmask[color & PENCOLOR] | 0xffffff00; - dst_ptr += wclip; - ecx = wclip = -wclip; - al = ah = (UINT8)pen0; - ebx = rgbmask[color & PENCOLOR] | 0xffffff00; - - do { do { - al |= *src1_ptr; - src1_ptr += src_dx; - al |= *src2_ptr; - src2_ptr += src_dx; - if (al & 0xf) { edx = (UINT32)al; al = ah; dst_ptr[ecx] = pal_ptr[edx] & ebx; } + do { + al |= *src1_ptr; + src1_ptr += src_dx; + al |= *src2_ptr; + src2_ptr += src_dx; + if (al & 0xf) { edx = (UINT32)al; al = ah; dst_ptr[ecx] = pal_ptr[edx] & ebx; } + } + while (++ecx); + ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; } - while (++ecx); - ecx = wclip; src1_ptr += src_dy; src2_ptr += src_dy; dst_ptr += SCREEN_WIDTH; - } - while (--hclip); - - } else + while (--hclip); + } else //-------------------------------------------------------------------------- // single-pen block or transparent blit - if ((flags & (SINGLE_PEN | COLOR_ON)) == SINGLE_PEN + COLOR_ON) - { - if (!(flags & IGNORE_0)) BLOCK_WIPE_COMMON + if ((flags & (SINGLE_PEN | COLOR_ON)) == SINGLE_PEN + COLOR_ON) + { + if (!(flags & IGNORE_0)) BLOCK_WIPE_COMMON + dst_ptr += wclip; + ebx = hclip; + ecx = wclip = -wclip; + edx = src_dx; + ax = (UINT16)pen1; - dst_ptr += wclip; - ebx = hclip; - ecx = wclip = -wclip; - edx = src_dx; - ax = (UINT16)pen1; - - do { do { - if (*src1_ptr) dst_ptr[ecx] = ax; - src1_ptr += edx; - } - while (++ecx); + do { + if (*src1_ptr) dst_ptr[ecx] = ax; + src1_ptr += edx; + } + while (++ecx); + ecx = wclip; + src1_ptr += src_dy; + dst_ptr += SCREEN_WIDTH; + } + while (--ebx); + } else + +//-------------------------------------------------------------------------- + + // transparent wipe + if ((flags & (IGNORE_0 | COLOR_ON)) == IGNORE_0) + { + dst_ptr += wclip; + wclip = -wclip; ecx = wclip; - src1_ptr += src_dy; - dst_ptr += SCREEN_WIDTH; - } - while (--ebx); + edx = src_dx; - } else - -//-------------------------------------------------------------------------- - - // transparent wipe - if ((flags & (IGNORE_0 | COLOR_ON)) == IGNORE_0) - { - dst_ptr += wclip; - wclip = -wclip; - ecx = wclip; - edx = src_dx; - - if (flags & PPCD_ON && !group) - { - // preserve collision flags when wiping group zero objects - do { + if (flags & PPCD_ON && !group) + { + // preserve collision flags when wiping group zero objects do { - al = *src1_ptr; - ah = *src2_ptr; - src1_ptr += edx; - src2_ptr += edx; - if (al | ah) dst_ptr[ecx] &= SP_COLLD; - } - while (++ecx); + do { + al = *src1_ptr; + ah = *src2_ptr; + src1_ptr += edx; + src2_ptr += edx; + if (al | ah) dst_ptr[ecx] &= SP_COLLD; + } + while (++ecx); - ecx = wclip; - src1_ptr += src_dy; - src2_ptr += src_dy; - dst_ptr += SCREEN_WIDTH; + ecx = wclip; + src1_ptr += src_dy; + src2_ptr += src_dy; + dst_ptr += SCREEN_WIDTH; + } + while (--hclip); } - while (--hclip); - } - else - { - do { + else + { do { - al = *src1_ptr; - ah = *src2_ptr; - src1_ptr += edx; - src2_ptr += edx; - if (al | ah) dst_ptr[ecx] = 0; + do { + al = *src1_ptr; + ah = *src2_ptr; + src1_ptr += edx; + src2_ptr += edx; + if (al | ah) dst_ptr[ecx] = 0; + } + while (++ecx); + + ecx = wclip; + src1_ptr += src_dy; + src2_ptr += src_dy; + dst_ptr += SCREEN_WIDTH; } - while (++ecx); - - ecx = wclip; - src1_ptr += src_dy; - src2_ptr += src_dy; - dst_ptr += SCREEN_WIDTH; + while (--hclip); } - while (--hclip); - } - - } else + } else //-------------------------------------------------------------------------- - // block wipe - if ((flags & (IGNORE_0 | COLOR_ON)) == 0) BLOCK_WIPE_COMMON + // block wipe + if ((flags & (IGNORE_0 | COLOR_ON)) == 0) BLOCK_WIPE_COMMON //-------------------------------------------------------------------------- - // End of Standard Mode - return; + // End of Standard Mode + return; //-------------------------------------------------------------------------- - -COMMAND_MODE: + } #define GFX_HI 0x10000 - // reject illegal blits and adjust parameters if (command) { @@ -1435,7 +1417,6 @@ void halleys_state::copy_fixed_xp(bitmap_ind16 &bitmap, UINT16 *source) while (--edx); } - void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, UINT16 *source) { UINT16 *esi, *edi; @@ -1447,49 +1428,23 @@ void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, UINT16 *source) dst_pitch = bitmap.rowpixels(); ecx = -CLIP_W; edx = CLIP_H; - do { do { ax = esi[ecx]; bx = esi[ecx+1]; - if (!(ax)) goto SKIP0; - if (!(ax&SP_2BACK)) goto DRAW0; - if (edi[ecx ]) goto SKIP0; - DRAW0: edi[ecx ] = ax; SKIP0: ax = esi[ecx+2]; - if (!(bx)) goto SKIP1; - if (!(bx&SP_2BACK)) goto DRAW1; - if (edi[ecx+1]) goto SKIP1; - DRAW1: edi[ecx+1] = bx; SKIP1: bx = esi[ecx+3]; + if (!(ax & SP_2BACK) || !edi[ecx + 0]) edi[ecx + 0] = ax; ax = esi[ecx + 2]; + if (!(bx & SP_2BACK) || !edi[ecx + 1]) edi[ecx + 1] = bx; bx = esi[ecx + 3]; - if (!(ax)) goto SKIP2; - if (!(ax&SP_2BACK)) goto DRAW2; - if (edi[ecx+2]) goto SKIP2; - DRAW2: edi[ecx+2] = ax; SKIP2: ax = esi[ecx+4]; - if (!(bx)) goto SKIP3; - if (!(bx&SP_2BACK)) goto DRAW3; - if (edi[ecx+3]) goto SKIP3; - DRAW3: edi[ecx+3] = bx; SKIP3: bx = esi[ecx+5]; + if (!(ax & SP_2BACK) || !edi[ecx + 2]) edi[ecx + 2] = ax; ax = esi[ecx + 4]; + if (!(bx & SP_2BACK) || !edi[ecx + 3]) edi[ecx + 3] = bx; bx = esi[ecx + 5]; - if (!(ax)) goto SKIP4; - if (!(ax&SP_2BACK)) goto DRAW4; - if (edi[ecx+4]) goto SKIP4; - DRAW4: edi[ecx+4] = ax; SKIP4: ax = esi[ecx+6]; - if (!(bx)) goto SKIP5; - if (!(bx&SP_2BACK)) goto DRAW5; - if (edi[ecx+5]) goto SKIP5; - DRAW5: edi[ecx+5] = bx; SKIP5: bx = esi[ecx+7]; + if (!(ax & SP_2BACK) || !edi[ecx + 4]) edi[ecx + 4] = ax; ax = esi[ecx + 6]; + if (!(bx & SP_2BACK) || !edi[ecx + 5]) edi[ecx + 5] = bx; bx = esi[ecx + 7]; - if (!(ax)) goto SKIP6; - if (!(ax&SP_2BACK)) goto DRAW6; - if (edi[ecx+6]) goto SKIP6; - DRAW6: edi[ecx+6] = ax; SKIP6: - if (!(bx)) continue; - if (!(bx&SP_2BACK)) goto DRAW7; - if (edi[ecx+7]) continue; - DRAW7: edi[ecx+7] = bx; - } - while (ecx += 8); + if (!(ax & SP_2BACK) || !edi[ecx + 6]) edi[ecx + 6] = ax; + if (!(bx & SP_2BACK) || !edi[ecx + 7]) edi[ecx + 7] = bx; + } while (ecx += 8); ecx = -CLIP_W; esi += SCREEN_WIDTH; @@ -1498,7 +1453,6 @@ void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, UINT16 *source) while (--edx); } - void halleys_state::filter_bitmap(bitmap_ind16 &bitmap, int mask) { int dst_pitch; From efe0ac66cdecdb6e1838088692d84f3ce1ce2bf7 Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Fri, 17 Jun 2016 03:06:58 +0200 Subject: [PATCH 02/42] starfall is back --- src/mame/drivers/halleys.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp index fa5401fa6fc..02d9af55983 100644 --- a/src/mame/drivers/halleys.cpp +++ b/src/mame/drivers/halleys.cpp @@ -1433,17 +1433,17 @@ void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, UINT16 *source) ax = esi[ecx]; bx = esi[ecx+1]; - if (!(ax & SP_2BACK) || !edi[ecx + 0]) edi[ecx + 0] = ax; ax = esi[ecx + 2]; - if (!(bx & SP_2BACK) || !edi[ecx + 1]) edi[ecx + 1] = bx; bx = esi[ecx + 3]; + if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 0]) edi[ecx + 0] = ax; ax = esi[ecx + 2]; + if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 1]) edi[ecx + 1] = bx; bx = esi[ecx + 3]; - if (!(ax & SP_2BACK) || !edi[ecx + 2]) edi[ecx + 2] = ax; ax = esi[ecx + 4]; - if (!(bx & SP_2BACK) || !edi[ecx + 3]) edi[ecx + 3] = bx; bx = esi[ecx + 5]; + if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 2]) edi[ecx + 2] = ax; ax = esi[ecx + 4]; + if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 3]) edi[ecx + 3] = bx; bx = esi[ecx + 5]; - if (!(ax & SP_2BACK) || !edi[ecx + 4]) edi[ecx + 4] = ax; ax = esi[ecx + 6]; - if (!(bx & SP_2BACK) || !edi[ecx + 5]) edi[ecx + 5] = bx; bx = esi[ecx + 7]; + if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 4]) edi[ecx + 4] = ax; ax = esi[ecx + 6]; + if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 5]) edi[ecx + 5] = bx; bx = esi[ecx + 7]; - if (!(ax & SP_2BACK) || !edi[ecx + 6]) edi[ecx + 6] = ax; - if (!(bx & SP_2BACK) || !edi[ecx + 7]) edi[ecx + 7] = bx; + if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 6]) edi[ecx + 6] = ax; + if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 7]) edi[ecx + 7] = bx; } while (ecx += 8); ecx = -CLIP_W; From eb6361d3146e6cecd6f732ada432a9ed30590ca0 Mon Sep 17 00:00:00 2001 From: Bavarese Date: Sat, 18 Jun 2016 09:26:45 +0200 Subject: [PATCH 03/42] Update vtvideo.cpp Remove detection code in dc012_w (DC012 write register; offset $0c). --- src/mame/video/vtvideo.cpp | 75 +++++++++++--------------------------- 1 file changed, 22 insertions(+), 53 deletions(-) diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp index c182bd05bb0..cea29595dc2 100644 --- a/src/mame/video/vtvideo.cpp +++ b/src/mame/video/vtvideo.cpp @@ -231,74 +231,36 @@ READ8_MEMBER(vt100_video_device::lba7_r) return m_lba7; } - // Also used by Rainbow-100 ************ WRITE8_MEMBER(vt100_video_device::dc012_w) { // Writes to [10C] and [0C] are treated differently // - see 3.1.3.9.5 DC012 Programming Information (PC-100 spec) - - // MHFU is disabled by writing 00 to port 010C. - - // Code recognition is abysmal - sorry for that. - if (data == 0) + if ((offset & 0x100) && (data == 0) ) // MHFU is disabled by writing 00 to port 010C. { - UINT8 *rom = machine().root_device().memregion("maincpu")->base(); - if (rom != nullptr) - { - UINT32 PC = space.device().safe_pc(); - if ((rom[ PC - 1] == 0xe6) && - (rom[ PC ] == 0x0c) - ) - { - // OUT 0C,al < DO NOTHING > - } - else - { - //UINT8 magic1= rom[PC - 1]; - //printf("\n PC %05x - MHFU MAGIC -1 %02x\n", PC, magic1); - //UINT8 magic2 = rom[PC - 2]; - //printf("\n PC %05x - MHFU MAGIC -2 %02x\n", PC, magic2); - //if (VERBOSE) - - //if(1 ) - if ((rom[PC - 2] == 0x0C) && - (rom[PC - 1] == 0x01) - ) - { - if (MHFU_FLAG == true) - printf("MHFU *** DISABLED *** %05x \n", PC); - - MHFU_FLAG = false; - MHFU_counter = 0; - } - } - - } // DATA == 0 ONLY .... - + if (MHFU_FLAG == true) + printf("MHFU *** DISABLED *** \n"); + MHFU_FLAG = false; + MHFU_counter = 0; // ? } else { - //if (VERBOSE) if (MHFU_FLAG == false) printf("MHFU ___ENABLED___ %05x \n", space.device().safe_pc()); - // RESET MHFU_FLAG = true; - MHFU_counter = 0; + MHFU_counter = 0; } if (!(data & 0x08)) { if (!(data & 0x04)) { - m_scroll_latch_valid = false; // LSB is written first. - // set lower part scroll - m_scroll_latch = data & 0x03; + m_scroll_latch_valid = false; + m_scroll_latch = data & 0x03; // LSB is written first. } - else + else // set MSB of scroll_latch { - // set higher part scroll m_scroll_latch = (m_scroll_latch & 0x03) | ((data & 0x03) << 2); m_scroll_latch_valid = true; } @@ -883,16 +845,23 @@ int rainbow_video_device::MHFU(int ASK) return MHFU_FLAG; case -1: // -1: increment IF ENABLED, return counter value (=> Rainbow.c) - if (MHFU_FLAG == true) - MHFU_counter++; + //if (MHFU_FLAG == true) + if (MHFU_counter < 255) + MHFU_counter++; + + case -2: return MHFU_counter; + case -250: // -250 : RESET counter (NOTHING ELSE!) + MHFU_counter = 0; + return MHFU_FLAG; + case -100: // -100 : RESET and ENABLE MHFU counter MHFU_counter = 0; - if(1) //if (VERBOSE) + if(0) //if (VERBOSE) printf("-100 MHFU * reset and ENABLE * \n"); - if(1) // if (VERBOSE) + if(0) // if (VERBOSE) { if (MHFU_FLAG == false) printf("-100 MHFU ___ENABLED___\n"); @@ -904,10 +873,10 @@ int rainbow_video_device::MHFU(int ASK) case -200: // -200 : RESET and DISABLE MHFU MHFU_counter = 0; - if(1) //if (VERBOSE) + if(0) //if (VERBOSE) { if (MHFU_FLAG == true) - printf("MHFU *** DISABLED *** \n"); + printf("MHFU *** DISABLED ***xxx \n"); } MHFU_FLAG = false; From 1702c3fc97777ed980a4f72e2f17564f2d5fd679 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 18 Jun 2016 10:51:06 -0400 Subject: [PATCH 04/42] Suppress 'no matching space' debugger error when disassembling CPUs without decrypted opcodes --- src/emu/debug/debugcmd.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index ad1359baa28..deb154601ac 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -2332,7 +2332,9 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[]) return; if (!validate_cpu_space_parameter((params > 4) ? param[4] : nullptr, AS_PROGRAM, space)) return; - if (!validate_cpu_space_parameter((params > 4) ? param[4] : nullptr, AS_DECRYPTED_OPCODES, decrypted_space)) + if (space->device().memory().has_space(AS_DECRYPTED_OPCODES)) + decrypted_space = &space->device().memory().space(AS_DECRYPTED_OPCODES); + else decrypted_space = space; /* determine the width of the bytes */ @@ -2520,7 +2522,9 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] address_space *space, *decrypted_space; if (!validate_cpu_space_parameter((params > 0) ? param[0] : nullptr, AS_PROGRAM, space)) return; - if (!validate_cpu_space_parameter((params > 0) ? param[0] : nullptr, AS_DECRYPTED_OPCODES, decrypted_space)) + if (space->device().memory().has_space(AS_DECRYPTED_OPCODES)) + decrypted_space = &space->device().memory().space(AS_DECRYPTED_OPCODES); + else decrypted_space = space; UINT64 count = device_debug::HISTORY_SIZE; From c3b7a9e470b8a8675e2c14a6aad1e56eb431cac9 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sat, 18 Jun 2016 10:07:48 -0400 Subject: [PATCH 05/42] word_wrapping::TRUNCATE was completely broken; this fixes it --- src/frontend/mame/ui/text.cpp | 17 ++++++++++------- src/frontend/mame/ui/text.h | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/frontend/mame/ui/text.cpp b/src/frontend/mame/ui/text.cpp index c029c410ff4..e4d61dc1238 100644 --- a/src/frontend/mame/ui/text.cpp +++ b/src/frontend/mame/ui/text.cpp @@ -78,7 +78,7 @@ CORE IMPLEMENTATION //------------------------------------------------- text_layout::text_layout(render_font &font, float xscale, float yscale, float width, text_layout::text_justify justify, text_layout::word_wrapping wrap) - : m_font(font), m_xscale(xscale), m_yscale(yscale), m_width(width), m_justify(justify), m_wrap(wrap), m_current_line(nullptr), m_last_break(0), m_text_position(0) + : m_font(font), m_xscale(xscale), m_yscale(yscale), m_width(width), m_justify(justify), m_wrap(wrap), m_current_line(nullptr), m_last_break(0), m_text_position(0), m_truncating(false) { } @@ -90,7 +90,7 @@ text_layout::text_layout(render_font &font, float xscale, float yscale, float wi text_layout::text_layout(text_layout &&that) : m_font(that.m_font), m_xscale(that.m_xscale), m_yscale(that.m_yscale), m_width(that.m_width), m_justify(that.m_justify), m_wrap(that.m_wrap), m_lines(std::move(that.m_lines)), - m_current_line(that.m_current_line), m_last_break(that.m_last_break), m_text_position(that.m_text_position) + m_current_line(that.m_current_line), m_last_break(that.m_last_break), m_text_position(that.m_text_position), m_truncating(false) { } @@ -162,7 +162,7 @@ void text_layout::add_text(const char *text, const char_style &style) update_maximum_line_width(); m_current_line = nullptr; } - else + else if (!m_truncating) { // if we hit a space, remember the location and width *without* the space if (is_space_character(ch)) @@ -250,6 +250,7 @@ void text_layout::start_new_line(text_layout::text_justify justify, float height update_maximum_line_width(); m_current_line = new_line.get(); m_last_break = 0; + m_truncating = false; // append it m_lines.push_back(std::move(new_line)); @@ -272,6 +273,8 @@ float text_layout::get_char_width(unicode_char ch, float size) void text_layout::truncate_wrap() { + const unicode_char elipsis = 0x2026; + // for now, lets assume that we're only truncating the last character size_t truncate_position = m_current_line->character_count() - 1; const auto& truncate_char = m_current_line->character(truncate_position); @@ -285,7 +288,7 @@ void text_layout::truncate_wrap() source.span = 0; // figure out how wide an elipsis is - float elipsis_width = 3 * get_char_width('.', style.size); + float elipsis_width = get_char_width(elipsis, style.size); // where should we really truncate from? while (truncate_position > 0 && m_current_line->character(truncate_position).xoffset + elipsis_width < width()) @@ -295,10 +298,10 @@ void text_layout::truncate_wrap() m_current_line->truncate(truncate_position); // and append the elipsis - m_current_line->add_character('.', style, source); + m_current_line->add_character(elipsis, style, source); - // finally start a new line - start_new_line(m_current_line->justify(), style.size); + // take note that we are truncating; supress new characters + m_truncating = true; } diff --git a/src/frontend/mame/ui/text.h b/src/frontend/mame/ui/text.h index 791aff9b112..d39f40bd4e0 100644 --- a/src/frontend/mame/ui/text.h +++ b/src/frontend/mame/ui/text.h @@ -145,6 +145,7 @@ private: line *m_current_line; size_t m_last_break; size_t m_text_position; + bool m_truncating; // methods void add_text(const char *text, const char_style &style); From bee55557f0fbd043fa7fdbdbefe83b9face76e20 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sat, 18 Jun 2016 11:20:54 -0400 Subject: [PATCH 06/42] Encapsulated methods that draw UI elements like fps counter, profiler etc --- src/frontend/mame/ui/ui.cpp | 72 +++++++++++++++++++++++++++---------- src/frontend/mame/ui/ui.h | 4 +++ 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index 21759412710..1213db4aa6d 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -1169,6 +1169,52 @@ void mame_ui_manager::paste() } +//------------------------------------------------- +// draw_fps_counter +//------------------------------------------------- + +void mame_ui_manager::draw_fps_counter(render_container *container) +{ + draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, + JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr); +} + + +//------------------------------------------------- +// draw_timecode_counter +//------------------------------------------------- + +void mame_ui_manager::draw_timecode_counter(render_container *container) +{ + std::string tempstring; + draw_text_full(container, machine().video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, + JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0, 0xf0, 0x10, 0x10), rgb_t::black, nullptr, nullptr); +} + + +//------------------------------------------------- +// draw_timecode_total +//------------------------------------------------- + +void mame_ui_manager::draw_timecode_total(render_container *container) +{ + std::string tempstring; + draw_text_full(container, machine().video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, + JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0, 0x10, 0xf0, 0x10), rgb_t::black, nullptr, nullptr); +} + + +//------------------------------------------------- +// draw_profiler +//------------------------------------------------- + +void mame_ui_manager::draw_profiler(render_container *container) +{ + const char *text = g_profiler.text(machine()); + draw_text_full(container, text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr); +} + + //------------------------------------------------- // image_handler_ingame - execute display // callback function for each image device @@ -1204,31 +1250,19 @@ UINT32 mame_ui_manager::handler_ingame(render_container *container) // first draw the FPS counter if (show_fps_counter()) - { - draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, - JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr); - } + draw_fps_counter(container); // Show the duration of current part (intro or gameplay or extra) - if (show_timecode_counter()) { - std::string tempstring; - draw_text_full(container, machine().video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, - JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0xf0,0x10,0x10), rgb_t::black, nullptr, nullptr); - } - // Show the total time elapsed for the video preview (all parts intro, gameplay, extras) - if (show_timecode_total()) { - std::string tempstring; - draw_text_full(container, machine().video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, - JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0x10,0xf0,0x10), rgb_t::black, nullptr, nullptr); - } + if (show_timecode_counter()) + draw_timecode_counter(container); + // Show the total time elapsed for the video preview (all parts intro, gameplay, extras) + if (show_timecode_total()) + draw_timecode_total(container); // draw the profiler if visible if (show_profiler()) - { - const char *text = g_profiler.text(machine()); - draw_text_full(container, text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr); - } + draw_profiler(container); // if we're single-stepping, pause now if (single_step()) diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h index f518535f054..99247508810 100644 --- a/src/frontend/mame/ui/ui.h +++ b/src/frontend/mame/ui/ui.h @@ -248,6 +248,10 @@ public: void increase_frameskip(); void decrease_frameskip(); void request_quit(); + void draw_fps_counter(render_container *container); + void draw_timecode_counter(render_container *container); + void draw_timecode_total(render_container *container); + void draw_profiler(render_container *container); // print the game info string into a buffer std::string &game_info_astring(std::string &str); From 290ec20fda9874ecd7049584dc72fa053caee910 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sat, 18 Jun 2016 11:12:16 -0400 Subject: [PATCH 07/42] Use ui::text_layout::text_layout and ui::text_layout::word_wrapping enums --- src/frontend/mame/cheat.cpp | 18 +++--- src/frontend/mame/cheat.h | 17 ++--- src/frontend/mame/luaengine.cpp | 8 +-- src/frontend/mame/ui/auditmenu.cpp | 2 +- src/frontend/mame/ui/custmenu.cpp | 16 ++--- src/frontend/mame/ui/custui.cpp | 88 +++++++++++++------------- src/frontend/mame/ui/datmenu.cpp | 22 +++---- src/frontend/mame/ui/dirmenu.cpp | 40 ++++++------ src/frontend/mame/ui/inputmap.cpp | 6 +- src/frontend/mame/ui/menu.cpp | 57 +++++++++-------- src/frontend/mame/ui/miscmenu.cpp | 16 ++--- src/frontend/mame/ui/optsmenu.cpp | 8 +-- src/frontend/mame/ui/selector.cpp | 16 ++--- src/frontend/mame/ui/selgame.cpp | 76 +++++++++++----------- src/frontend/mame/ui/selsoft.cpp | 58 ++++++++--------- src/frontend/mame/ui/simpleselgame.cpp | 18 +++--- src/frontend/mame/ui/sliders.cpp | 4 +- src/frontend/mame/ui/sndmenu.cpp | 8 +-- src/frontend/mame/ui/submenu.cpp | 16 ++--- src/frontend/mame/ui/ui.cpp | 36 +++++------ src/frontend/mame/ui/ui.h | 35 +++------- 21 files changed, 275 insertions(+), 290 deletions(-) diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp index 1e2167f9176..6d1a6455026 100644 --- a/src/frontend/mame/cheat.cpp +++ b/src/frontend/mame/cheat.cpp @@ -430,12 +430,12 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s // extract other attributes m_line = xml_get_attribute_int(&entrynode, "line", 0); - m_justify = JUSTIFY_LEFT; + m_justify = ui::text_layout::LEFT; const char *align = xml_get_attribute_string(&entrynode, "align", "left"); if (strcmp(align, "center") == 0) - m_justify = JUSTIFY_CENTER; + m_justify = ui::text_layout::CENTER; else if (strcmp(align, "right") == 0) - m_justify = JUSTIFY_RIGHT; + m_justify = ui::text_layout::RIGHT; else if (strcmp(align, "left") != 0) throw emu_fatalerror("%s.xml(%d): invalid alignment '%s' specified\n", filename, entrynode.line, align); @@ -509,7 +509,7 @@ void cheat_script::script_entry::execute(cheat_manager &manager, UINT64 &arginde curarg += arg->values(argindex, ¶ms[curarg]); // generate the astring - manager.get_output_astring(m_line, m_justify) = string_format(m_format, + manager.get_output_string(m_line, m_justify) = string_format(m_format, (UINT32)params[0], (UINT32)params[1], (UINT32)params[2], (UINT32)params[3], (UINT32)params[4], (UINT32)params[5], (UINT32)params[6], (UINT32)params[7], (UINT32)params[8], (UINT32)params[9], (UINT32)params[10], (UINT32)params[11], @@ -545,9 +545,9 @@ void cheat_script::script_entry::save(emu_file &cheatfile) const cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str()); if (m_line != 0) cheatfile.printf(" line=\"%d\"", m_line); - if (m_justify == JUSTIFY_CENTER) + if (m_justify == ui::text_layout::CENTER) cheatfile.printf(" align=\"center\""); - else if (m_justify == JUSTIFY_RIGHT) + else if (m_justify == ui::text_layout::RIGHT) cheatfile.printf(" align=\"right\""); if (m_arglist.size() == 0) cheatfile.printf(" />\n"); @@ -1236,19 +1236,19 @@ void cheat_manager::render_text(mame_ui_manager &mui, render_container &containe // output the text mui.draw_text_full(&container, m_output[linenum].c_str(), 0.0f, (float)linenum * mui.get_line_height(), 1.0f, - m_justify[linenum], WRAP_NEVER, DRAW_OPAQUE, + m_justify[linenum], ui::text_layout::NEVER, mame_ui_manager::OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr); } } //------------------------------------------------- -// get_output_astring - return a reference to +// get_output_string - return a reference to // the given row's string, and set the // justification //------------------------------------------------- -std::string &cheat_manager::get_output_astring(int row, int justify) +std::string &cheat_manager::get_output_string(int row, ui::text_layout::text_justify justify) { // if the row is not specified, grab the next one if (row == 0) diff --git a/src/frontend/mame/cheat.h b/src/frontend/mame/cheat.h index 80851653d13..f69e3dfd94c 100644 --- a/src/frontend/mame/cheat.h +++ b/src/frontend/mame/cheat.h @@ -15,6 +15,7 @@ #include "debug/express.h" #include "debug/debugcpu.h" +#include "ui/text.h" //************************************************************************** @@ -174,12 +175,12 @@ private: void validate_format(const char *filename, int line); // internal state - parsed_expression m_condition; // condition under which this is executed - parsed_expression m_expression; // expression to execute - std::string m_format; // string format to print - std::vector> m_arglist; // list of arguments - INT8 m_line; // which line to print on - UINT8 m_justify; // justification when printing + parsed_expression m_condition; // condition under which this is executed + parsed_expression m_expression; // expression to execute + std::string m_format; // string format to print + std::vector> m_arglist; // list of arguments + INT8 m_line; // which line to print on + ui::text_layout::text_justify m_justify; // justification when printing // constants static const int MAX_ARGUMENTS = 32; @@ -288,7 +289,7 @@ public: void render_text(mame_ui_manager &mui, render_container &container); // output helpers - std::string &get_output_astring(int row, int justify); + std::string &get_output_string(int row, ui::text_layout::text_justify justify); // global helpers static std::string quote_expression(const parsed_expression &expression); @@ -305,7 +306,7 @@ private: std::vector> m_cheatlist; // cheat list UINT64 m_framecount; // frame count std::vector m_output; // array of output strings - std::vector m_justify; // justification for each string + std::vector m_justify; // justification for each string UINT8 m_numlines; // number of lines available for output INT8 m_lastline; // last line used for output bool m_disabled; // true if the cheat engine is disabled diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index ec61f96fe30..dade6bc99f3 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -1490,7 +1490,7 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L) // retrieve all parameters int sc_width = sc->visible_area().width(); int sc_height = sc->visible_area().height(); - int justify = JUSTIFY_LEFT; + auto justify = ui::text_layout::LEFT; float y, x = 0; if(lua_isnumber(L, 2)) { @@ -1501,9 +1501,9 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L) { std::string just_str = lua_tostring(L, 2); if(just_str == "right") - justify = JUSTIFY_RIGHT; + justify = ui::text_layout::RIGHT; else if(just_str == "center") - justify = JUSTIFY_CENTER; + justify = ui::text_layout::CENTER; y = lua_tonumber(L, 3); } const char *msg = luaL_checkstring(L,4); @@ -1516,7 +1516,7 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L) // draw the text render_container &rc = sc->container(); mame_machine_manager::instance()->ui().draw_text_full(&rc, msg, x, y, (1.0f - x), - justify, WRAP_WORD, DRAW_NORMAL, textcolor, + justify, ui::text_layout::WORD, mame_ui_manager::NORMAL, textcolor, bgcolor, nullptr, nullptr); return 0; } diff --git a/src/frontend/mame/ui/auditmenu.cpp b/src/frontend/mame/ui/auditmenu.cpp index 9a6a47c8fc8..5da65f597c9 100644 --- a/src/frontend/mame/ui/auditmenu.cpp +++ b/src/frontend/mame/ui/auditmenu.cpp @@ -114,7 +114,7 @@ void menu_audit::handle() if (m_first) { - ui().draw_text_box(container, _("Audit in progress..."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR); + ui().draw_text_box(container, _("Audit in progress..."), ui::text_layout::CENTER, 0.5f, 0.5f, UI_GREEN_COLOR); m_first = false; return; } diff --git a/src/frontend/mame/ui/custmenu.cpp b/src/frontend/mame/ui/custmenu.cpp index 62a12d3ac99..67c056be682 100644 --- a/src/frontend/mame/ui/custmenu.cpp +++ b/src/frontend/mame/ui/custmenu.cpp @@ -210,8 +210,8 @@ void menu_custom_filter::custom_render(void *selectedref, float top, float botto float width; // get the size of the text - ui().draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; float maxwidth = MAX(width, origx2 - origx1); @@ -230,8 +230,8 @@ void menu_custom_filter::custom_render(void *selectedref, float top, float botto y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } //------------------------------------------------- @@ -525,8 +525,8 @@ void menu_swcustom_filter::custom_render(void *selectedref, float top, float bot float width; // get the size of the text - ui().draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; float maxwidth = MAX(width, origx2 - origx1); @@ -545,8 +545,8 @@ void menu_swcustom_filter::custom_render(void *selectedref, float top, float bot y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } //------------------------------------------------- diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp index e033f022356..95a5ead8a8b 100644 --- a/src/frontend/mame/ui/custui.cpp +++ b/src/frontend/mame/ui/custui.cpp @@ -165,8 +165,8 @@ void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, f { float width; - ui().draw_text_full(container, _("Custom UI Settings"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Custom UI Settings"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -185,8 +185,8 @@ void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Custom UI Settings"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Custom UI Settings"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } //------------------------------------------------- @@ -381,8 +381,8 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo // top text std::string topbuf(_("UI Fonts Settings")); - ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -401,15 +401,15 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); if ((FPTR)selectedref == INFOS_SIZE) { topbuf = _("Sample text - Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr, m_info_size); + ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr, m_info_size); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(origx2 - origx1, width); @@ -428,8 +428,8 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, m_info_size); + ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, m_info_size); } } @@ -539,8 +539,8 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f // top text std::string topbuf(_("UI Colors Settings")); - ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -559,16 +559,16 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // bottom text // get the text for 'UI Select' std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); topbuf = string_format(_("Double click or press %1$s to change the color value"), ui_select_text); - ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -587,14 +587,14 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // compute maxwidth topbuf = _("Menu Preview"); - ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); maxwidth = width + 2.0f * UI_BOX_LR_BORDER; std::string sampletxt[5]; @@ -607,8 +607,8 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f for (auto & elem: sampletxt) { - ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); } @@ -629,8 +629,8 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f y2 -= UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // compute our bounds for menu preview x1 -= UI_BOX_LR_BORDER; @@ -647,30 +647,30 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw normal text - ui().draw_text_full(container, sampletxt[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_TEXT_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + ui().draw_text_full(container, sampletxt[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, m_color_table[MUI_TEXT_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw subitem text - ui().draw_text_full(container, sampletxt[1].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_SUBITEM_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + ui().draw_text_full(container, sampletxt[1].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, m_color_table[MUI_SUBITEM_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw selected text highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_SELECTED_BG_COLOR].color); - ui().draw_text_full(container, sampletxt[2].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_SELECTED_COLOR].color, m_color_table[MUI_SELECTED_BG_COLOR].color, nullptr, nullptr); + ui().draw_text_full(container, sampletxt[2].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, m_color_table[MUI_SELECTED_COLOR].color, m_color_table[MUI_SELECTED_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw mouse over text highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_MOUSEOVER_BG_COLOR].color); - ui().draw_text_full(container, sampletxt[3].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_MOUSEOVER_COLOR].color, m_color_table[MUI_MOUSEOVER_BG_COLOR].color, nullptr, nullptr); + ui().draw_text_full(container, sampletxt[3].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, m_color_table[MUI_MOUSEOVER_COLOR].color, m_color_table[MUI_MOUSEOVER_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw clone text - ui().draw_text_full(container, sampletxt[4].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_CLONE_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + ui().draw_text_full(container, sampletxt[4].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, m_color_table[MUI_CLONE_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); } @@ -880,8 +880,8 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa // top text std::string topbuf = std::string(m_title).append(_(" - ARGB Settings")); - ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -900,13 +900,13 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); std::string sampletxt(_("Color preview =")); maxwidth = origx2 - origx1; - ui().draw_text_full(container, sampletxt.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, sampletxt.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -925,8 +925,8 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa y1 += UI_BOX_TB_BORDER; // draw the normal text - ui().draw_text_full(container, sampletxt.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, rgb_t::white, rgb_t::black, nullptr, nullptr); + ui().draw_text_full(container, sampletxt.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, rgb_t::white, rgb_t::black, nullptr, nullptr); float t_x2 = x1 - UI_BOX_LR_BORDER + maxwidth; x1 = x2 + 2.0f * UI_BOX_LR_BORDER; diff --git a/src/frontend/mame/ui/datmenu.cpp b/src/frontend/mame/ui/datmenu.cpp index a3a29b76116..5aa43f74a39 100644 --- a/src/frontend/mame/ui/datmenu.cpp +++ b/src/frontend/mame/ui/datmenu.cpp @@ -129,8 +129,8 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f float width; std::string driver = (m_issoft == true) ? m_swinfo->longname : m_driver->description; - ui().draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -148,14 +148,14 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f x2 -= UI_BOX_LR_BORDER; y1 += UI_BOX_TB_BORDER; - ui().draw_text_full(container, driver.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, driver.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); maxwidth = 0; for (auto & elem : m_items_list) { - ui().draw_text_full(container, elem.label.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, elem.label.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); maxwidth += width; } @@ -180,13 +180,13 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f x1 += space; rgb_t fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR; rgb_t bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; - ui().draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, DRAW_NONE, fcolor, bcolor, &width, nullptr); + ui().draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NONE, fcolor, bcolor, &width, nullptr); if (bcolor != UI_TEXT_BG_COLOR) ui().draw_textured_box(container, x1 - (space / 2), y1, x1 + width + (space / 2), y2, bcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); - ui().draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, DRAW_NORMAL, fcolor, bcolor, &width, nullptr); + ui().draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fcolor, bcolor, &width, nullptr); x1 += width + space; ++x; } @@ -194,7 +194,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f // bottom std::string revision; revision.assign(_("Revision: ")).append(m_items_list[m_actual].revision); - ui().draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(origx2 - origx1, width); @@ -213,8 +213,8 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, revision.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, revision.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } //------------------------------------------------- diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp index 420e3d8aac9..359d6d63420 100644 --- a/src/frontend/mame/ui/dirmenu.cpp +++ b/src/frontend/mame/ui/dirmenu.cpp @@ -118,8 +118,8 @@ void menu_directory::custom_render(void *selectedref, float top, float bottom, f float width; // get the size of the text - ui().draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; float maxwidth = MAX(width, origx2 - origx1); @@ -138,8 +138,8 @@ void menu_directory::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Folders Setup"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Folders Setup"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } /************************************************** @@ -217,13 +217,13 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott for (auto & elem : m_folders) { - ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; maxwidth = MAX(maxwidth, width); } // get the size of the text - ui().draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; maxwidth = MAX(width, maxwidth); @@ -242,8 +242,8 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // compute our bounds x1 = 0.5f - 0.5f * maxwidth; @@ -262,8 +262,8 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott // draw the text within it for (auto & elem : m_folders) { - ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); y1 += lineh; } @@ -506,8 +506,8 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b // get the size of the text for (auto & elem : tempbuf) { - ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; maxwidth = MAX(width, maxwidth); } @@ -529,16 +529,16 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b // draw the text within it for (auto & elem : tempbuf) { - ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); y1 = y1 + ui().get_line_height(); } // bottom text tempbuf[0] = _("Press TAB to set"); - ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -557,8 +557,8 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } @@ -643,7 +643,7 @@ void menu_remove_folder::custom_render(void *selectedref, float top, float botto std::string tempbuf = string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name)); // get the size of the text - ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; float maxwidth = MAX(width, origx2 - origx1); @@ -662,7 +662,7 @@ void menu_remove_folder::custom_render(void *selectedref, float top, float botto y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, + ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp index 766ce7cd05c..0762db03a9e 100644 --- a/src/frontend/mame/ui/inputmap.cpp +++ b/src/frontend/mame/ui/inputmap.cpp @@ -694,9 +694,9 @@ void menu_settings_dip_switches::custom_render_one(float x1, float y1, float x2, 0, y1 + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT) / 2, x1 - ui().get_string_width(" "), - JUSTIFY_RIGHT, - WRAP_NEVER, - DRAW_NORMAL, + ui::text_layout::RIGHT, + ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA), nullptr , diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index 997683d1a98..7be233208b4 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -503,7 +503,7 @@ void menu::draw(UINT32 flags, float origx0, float origy0) if (ui().show_fps_counter()) { ui().draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, - JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr); + ui::text_layout::RIGHT, ui::text_layout::WORD, mame_ui_manager::OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr); } bool const customonly = (flags & PROCESS_CUSTOM_ONLY); @@ -695,7 +695,7 @@ void menu::draw(UINT32 flags, float origx0, float origy0) container->add_line(visible_left + visible_width - ((visible_width - heading_width) / 2) + UI_BOX_LR_BORDER, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); } // otherwise, draw the item on the left and the subitem text on the right @@ -707,7 +707,7 @@ void menu::draw(UINT32 flags, float origx0, float origy0) // draw the left-side text ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, &item_width, nullptr); + ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, &item_width, nullptr); // give 2 spaces worth of padding item_width += 2.0f * gutter_width; @@ -732,7 +732,7 @@ void menu::draw(UINT32 flags, float origx0, float origy0) // draw the subitem right-justified ui().draw_text_full(container, subitem_text, effective_left + item_width, line_y, effective_width - item_width, - JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, nullptr); + ui::text_layout::RIGHT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, nullptr); // apply arrows if (itemnum == selected && (pitem.flags & FLAG_LEFT_ARROW)) @@ -771,7 +771,7 @@ void menu::draw(UINT32 flags, float origx0, float origy0) // compute the multi-line target width/height ui().draw_text_full(container, pitem.subtext, 0, 0, visible_width * 0.75f, - JUSTIFY_RIGHT, WRAP_WORD, DRAW_NONE, rgb_t::white, rgb_t::black, &target_width, &target_height); + ui::text_layout::RIGHT, ui::text_layout::WORD, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &target_width, &target_height); // determine the target location target_x = visible_left + visible_width - target_width - UI_BOX_LR_BORDER; @@ -785,8 +785,9 @@ void menu::draw(UINT32 flags, float origx0, float origy0) target_x + target_width + UI_BOX_LR_BORDER, target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? UI_SELECTED_BG_COLOR : UI_BACKGROUND_COLOR); + ui().draw_text_full(container, pitem.subtext, target_x, target_y, target_width, - JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); + ui::text_layout::RIGHT, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); } // if there is something special to add, do it by calling the virtual method @@ -815,7 +816,7 @@ void menu::draw_text_box() // compute the multi-line target width/height ui().draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER - 2.0f * gutter_width, - JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, rgb_t::white, rgb_t::black, &target_width, &target_height); + ui::text_layout::LEFT, ui::text_layout::WORD, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &target_width, &target_height); target_height += 2.0f * line_height; if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER) target_height = floorf((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height; @@ -845,7 +846,7 @@ void menu::draw_text_box() target_y + target_height + UI_BOX_TB_BORDER, (item[0].flags & FLAG_REDTEXT) ? UI_RED_COLOR : UI_BACKGROUND_COLOR); ui().draw_text_full(container, text, target_x, target_y, target_width, - JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui::text_layout::LEFT, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // draw the "return to prior menu" text with a hilight behind it highlight(container, @@ -855,7 +856,7 @@ void menu::draw_text_box() target_y + target_height, UI_SELECTED_BG_COLOR); ui().draw_text_full(container, backtext, target_x, target_y + target_height - line_height, target_width, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); // artificially set the hover to the last item so a double-click exits hover = item.size() - 1; @@ -1592,8 +1593,8 @@ void menu::draw_select_game(UINT32 flags) space = ud_arrow_width * 1.5f; } - ui().draw_text_full(container, pitem.text, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE, - DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); + ui().draw_text_full(container, pitem.text, effective_left + space, line_y, effective_width - space, ui::text_layout::LEFT, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); } else { @@ -1602,16 +1603,16 @@ void menu::draw_select_game(UINT32 flags) // compute right space for subitem ui().draw_text_full(container, pitem.subtext, effective_left, line_y, ui().get_string_width(pitem.subtext), - JUSTIFY_RIGHT, WRAP_NEVER, DRAW_NONE, item_invert ? fgcolor3 : fgcolor, bgcolor, &subitem_width, nullptr); + ui::text_layout::RIGHT, ui::text_layout::NEVER, mame_ui_manager::NONE, item_invert ? fgcolor3 : fgcolor, bgcolor, &subitem_width, nullptr); subitem_width += gutter_width; // draw the item left-justified ui().draw_text_full(container, pitem.text, effective_left, line_y, effective_width - subitem_width, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, &item_width, nullptr); + ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, &item_width, nullptr); // draw the subitem right-justified ui().draw_text_full(container, pitem.subtext, effective_left + item_width, line_y, effective_width - item_width, - JUSTIFY_RIGHT, WRAP_NEVER, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); + ui::text_layout::RIGHT, ui::text_layout::NEVER, mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); } } @@ -1648,8 +1649,8 @@ void menu::draw_select_game(UINT32 flags) container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height, UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); else - ui().draw_text_full(container, pitem.text, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui().draw_text_full(container, pitem.text, effective_left, line, effective_width, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); line += line_height; } @@ -2199,7 +2200,7 @@ float menu::draw_right_box_title(float x1, float y1, float x2, float y2) bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); ui().draw_text_full(container, buffer[cells].c_str(), x1 + UI_LINE_WIDTH, y1, midl - UI_LINE_WIDTH, - JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); + ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); x1 += midl; } @@ -2223,8 +2224,8 @@ std::string menu::arts_render_common(float origx1, float origy1, float origx2, f // apply title to right panel for (int x = FIRST_VIEW; x < LAST_VIEW; x++) { - ui().draw_text_full(container, _(arts_info[x].first), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, - WRAP_TRUNCATE, DRAW_NONE, rgb_t::white, rgb_t::black, &txt_lenght, nullptr); + ui().draw_text_full(container, _(arts_info[x].first), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, + ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &txt_lenght, nullptr); txt_lenght += 0.01f; title_size = MAX(txt_lenght, title_size); } @@ -2242,8 +2243,8 @@ std::string menu::arts_render_common(float origx1, float origy1, float origx2, f ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f), origy1 + line_height, bgcolor, rgb_t(43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); - ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size); + ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size); draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curimage_view, FIRST_VIEW, LAST_VIEW, title_size); @@ -2297,7 +2298,7 @@ void menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software) hover = HOVER_B_FAV + z; color = rgb_t::white; float ypos = y2 + ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; - ui().draw_text_box(container, _(hover_msg[z]), JUSTIFY_CENTER, 0.5f, ypos, UI_BACKGROUND_COLOR); + ui().draw_text_box(container, _(hover_msg[z]), ui::text_layout::CENTER, 0.5f, ypos, UI_BACKGROUND_COLOR); } container->add_quad(x1, y1, x2, y2, color, t_texture[z], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); @@ -2732,7 +2733,7 @@ void menu::draw_palette_menu() // if we don't have a subitem, just draw the string centered else if (pitem.subtext == nullptr) ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); // otherwise, draw the item on the left and the subitem text on the right else @@ -2742,7 +2743,7 @@ void menu::draw_palette_menu() // draw the left-side text ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); // give 2 spaces worth of padding float subitem_width = ui().get_string_width("FF00FF00"); @@ -2867,8 +2868,8 @@ void menu::draw_dats_menu() // draw dats text else if (pitem.subtext == nullptr) { - ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, JUSTIFY_LEFT, WRAP_NEVER, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, ui::text_layout::LEFT, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); } } @@ -2892,8 +2893,8 @@ void menu::draw_dats_menu() else { highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor); - ui().draw_text_full(container, itemtext, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui().draw_text_full(container, itemtext, effective_left, line, effective_width, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); } line += line_height; } diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index b17ff5fefa8..4e243f8ea8f 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -813,8 +813,8 @@ void menu_machine_configure::custom_render(void *selectedref, float top, float b for (auto & elem : text) { - ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); } @@ -836,8 +836,8 @@ void menu_machine_configure::custom_render(void *selectedref, float top, float b // draw the text within it for (auto & elem : text) { - ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); y1 += ui().get_line_height(); } } @@ -957,8 +957,8 @@ void menu_plugins_configure::custom_render(void *selectedref, float top, float b { float width; - ui().draw_text_full(container, _("Plugins"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Plugins"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -977,8 +977,8 @@ void menu_plugins_configure::custom_render(void *selectedref, float top, float b y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Plugins"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Plugins"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } } // namespace ui diff --git a/src/frontend/mame/ui/optsmenu.cpp b/src/frontend/mame/ui/optsmenu.cpp index e0d3e2ff663..6872c3498da 100644 --- a/src/frontend/mame/ui/optsmenu.cpp +++ b/src/frontend/mame/ui/optsmenu.cpp @@ -297,8 +297,8 @@ void menu_game_options::populate() void menu_game_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui().draw_text_full(container, _("Settings"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Settings"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -317,8 +317,8 @@ void menu_game_options::custom_render(void *selectedref, float top, float bottom y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Settings"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Settings"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } diff --git a/src/frontend/mame/ui/selector.cpp b/src/frontend/mame/ui/selector.cpp index 502dab9bbc8..e1f05e6e47d 100644 --- a/src/frontend/mame/ui/selector.cpp +++ b/src/frontend/mame/ui/selector.cpp @@ -168,8 +168,8 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl std::string tempbuf = std::string(_("Selection List - Search: ")).append(m_search).append("_"); // get the size of the text - ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; float maxwidth = MAX(width, origx2 - origx1); @@ -188,16 +188,16 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // bottom text // get the text for 'UI Select' std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); tempbuf = string_format(_("Double click or press %1$s to select"), ui_select_text); - ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -216,8 +216,8 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } //------------------------------------------------- diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index e53164433ed..37ec5915885 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -464,7 +464,7 @@ void menu_select_game::handle() // if we're in an error state, overlay an error message if (ui_error) ui().draw_text_box(container, _("The selected machine is missing one or more required ROM or CHD images. " - "Please select a different machine.\n\nPress any key to continue."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); + "Please select a different machine.\n\nPress any key to continue."), ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR); // handle filters selection from key shortcuts if (check_filter) @@ -801,8 +801,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom, // get the size of the text for (int line = 0; line < 2; ++line) { - ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(width, maxwidth); } @@ -830,8 +830,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom, // draw the text within it for (int line = 0; line < 2; ++line) { - ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); y1 += ui().get_line_height(); } @@ -956,8 +956,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom, for (auto & elem : tempbuf) { - ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); } @@ -989,8 +989,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom, // draw all lines for (auto & elem : tempbuf) { - ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); y1 += ui().get_line_height(); } } @@ -1905,8 +1905,8 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2) convert_command_glyph(str); } - ui().draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, JUSTIFY_LEFT, WRAP_NEVER, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); + ui().draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); y1 += line_height_max; } @@ -2014,8 +2014,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy for (int x = UI_FIRST_LOAD; x < UI_LAST_LOAD; ++x) { - ui().draw_text_full(container, _(dats_info[x]), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, - WRAP_NEVER, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr); + ui().draw_text_full(container, _(dats_info[x]), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, + ui::text_layout::NEVER, mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr); txt_length += 0.01f; title_size = (std::max)(txt_length, title_size); } @@ -2039,8 +2039,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f), origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); - ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, - WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size); + ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, + ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size); draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, UI_FIRST_LOAD, UI_LAST_LOAD, title_size); @@ -2076,8 +2076,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy if (buffer.empty()) { - ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, JUSTIFY_CENTER, - WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER, + ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); return; } else if (ui_globals::curdats_view != UI_STORY_LOAD && ui_globals::curdats_view != UI_COMMAND_LOAD) @@ -2115,8 +2115,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy size_t last_underscore = tempbuf.find_last_of("_"); if (last_underscore == std::string::npos) { - ui().draw_text_full(container, tempbuf.c_str(), origx1, oy1, origx2 - origx1, JUSTIFY_CENTER, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2); + ui().draw_text_full(container, tempbuf.c_str(), origx1, oy1, origx2 - origx1, ui::text_layout::CENTER, + ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2); } else { @@ -2127,11 +2127,11 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy float item_width; ui().draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &item_width, nullptr, tmp_size2); + ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &item_width, nullptr, tmp_size2); ui().draw_text_full(container, last_part.c_str(), effective_left + item_width, oy1, - origx2 - origx1 - 2.0f * gutter_width - item_width, JUSTIFY_RIGHT, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2); + origx2 - origx1 - 2.0f * gutter_width - item_width, ui::text_layout::RIGHT, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2); } } @@ -2150,19 +2150,19 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy std::string first_part(tempbuf.substr(0, first_dspace)); std::string last_part(tempbuf.substr(first_dspace + 1)); strtrimspace(last_part); - ui().draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, JUSTIFY_LEFT, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); + ui().draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, ui::text_layout::LEFT, + ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); ui().draw_text_full(container, last_part.c_str(), effective_left, oy1, origx2 - origx1 - 2.0f * gutter_width, - JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); + ui::text_layout::RIGHT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); } else - ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); + ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT, + ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); } else - ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT, + ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); oy1 += (line_height * text_size); } @@ -2179,8 +2179,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy // apply title to right panel if (soft->usage.empty()) { - ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); ui_globals::cur_sw_dats_view = 0; } else @@ -2193,8 +2193,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy for (auto & elem: t_text) { - ui().draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr); + ui().draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr); txt_length += 0.01f; title_size = (std::max)(txt_length, title_size); } @@ -2214,7 +2214,7 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); ui().draw_text_full(container, t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::cur_sw_dats_view, 0, 1, title_size); } @@ -2237,8 +2237,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy if (buffer.empty()) { - ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, JUSTIFY_CENTER, - WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER, + ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); return; } else @@ -2264,8 +2264,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy else if (r == r_visible_lines - 1 && itemline != totallines - 1) info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); else - ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT, + ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); oy1 += (line_height * text_size); } diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index fa68affb36a..95f89bcb8dd 100644 --- a/src/frontend/mame/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -375,7 +375,7 @@ void menu_select_software::handle() if (ui_error) ui().draw_text_box(container, _("The selected software is missing one or more required files. " "Please select a different software.\n\nPress any key to continue."), - JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); + ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR); // handle filters selection from key shortcuts if (check_filter) @@ -688,8 +688,8 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot for (int line = 0; line < 3; ++line) { - ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(width, maxwidth); } @@ -717,8 +717,8 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot // draw the text within it for (int line = 0; line < 3; ++line) { - ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); y1 += ui().get_line_height(); } @@ -837,8 +837,8 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot for (auto & elem : tempbuf) { - ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); } @@ -870,8 +870,8 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot // draw all lines for (auto & elem : tempbuf) { - ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); y1 += ui().get_line_height(); } } @@ -1488,8 +1488,8 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float convert_command_glyph(str); } - ui().draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, JUSTIFY_LEFT, WRAP_NEVER, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); + ui().draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); y1 += line_height; } @@ -1567,8 +1567,8 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o { float title_size = 0.0f; - ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &title_size, nullptr); + ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &title_size, nullptr); title_size += 0.01f; rgb_t fgcolor = UI_TEXT_COLOR; @@ -1585,8 +1585,8 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f), origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); - ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); ui_globals::cur_sw_dats_view = 0; } else @@ -1599,8 +1599,8 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o for (auto & elem : t_text) { - ui().draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); + ui().draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); txt_lenght += 0.01f; title_size = MAX(txt_lenght, title_size); } @@ -1625,7 +1625,7 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); ui().draw_text_full(container, t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, - JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size); + ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size); draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::cur_sw_dats_view, 0, 1, title_size); } @@ -1648,8 +1648,8 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o if (buffer.empty()) { - ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, JUSTIFY_CENTER, - WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER, + ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); return; } else @@ -1677,7 +1677,7 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); else ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, + ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); oy1 += (line_height * text_size); } @@ -1986,8 +1986,8 @@ void software_parts::handle() void software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui().draw_text_full(container, _("Software part selection:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Software part selection:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -2006,8 +2006,8 @@ void software_parts::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Software part selection:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Software part selection:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } //------------------------------------------------- @@ -2127,8 +2127,8 @@ void bios_selection::handle() void bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui().draw_text_full(container, _("Bios selection:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Bios selection:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -2147,8 +2147,8 @@ void bios_selection::custom_render(void *selectedref, float top, float bottom, f y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Bios selection:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Bios selection:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } } // namespace ui diff --git a/src/frontend/mame/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp index 19cbbe5941f..e2ca4ff6d55 100644 --- a/src/frontend/mame/ui/simpleselgame.cpp +++ b/src/frontend/mame/ui/simpleselgame.cpp @@ -136,7 +136,7 @@ void simple_menu_select_game::handle() ui().draw_text_box(container, "The selected game is missing one or more required ROM or CHD images. " "Please select a different game.\n\nPress any key to continue.", - JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); + ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR); } @@ -298,8 +298,8 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float tempbuf[0] = _("Type name or select: (random)"); // get the size of the text - ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(width, origx2 - origx1); @@ -318,8 +318,8 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // determine the text to render below driver = ((FPTR)selectedref > skip_main_items) ? (const game_driver *)selectedref : nullptr; @@ -388,8 +388,8 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float maxwidth = origx2 - origx1; for (line = 0; line < 4; line++) { - ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); } @@ -418,8 +418,8 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float // draw all lines for (line = 0; line < 4; line++) { - ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); y1 += ui().get_line_height(); } } diff --git a/src/frontend/mame/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp index 55227f28854..31904c73a02 100644 --- a/src/frontend/mame/ui/sliders.cpp +++ b/src/frontend/mame/ui/sliders.cpp @@ -226,7 +226,7 @@ void menu_sliders::custom_render(void *selectedref, float top, float bottom, flo // determine the text height ui().draw_text_full(container, tempstring.c_str(), 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, rgb_t::white, rgb_t::black, nullptr, &text_height); + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, nullptr, &text_height); // draw the thermometer bar_left = x1 + UI_BOX_LR_BORDER; @@ -253,7 +253,7 @@ void menu_sliders::custom_render(void *selectedref, float top, float bottom, flo // draw the actual text ui().draw_text_full(container, tempstring.c_str(), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, - JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, &text_height); + ui::text_layout::CENTER, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, &text_height); } } diff --git a/src/frontend/mame/ui/sndmenu.cpp b/src/frontend/mame/ui/sndmenu.cpp index 486c3ad53a6..72c5068c3ac 100644 --- a/src/frontend/mame/ui/sndmenu.cpp +++ b/src/frontend/mame/ui/sndmenu.cpp @@ -146,8 +146,8 @@ void menu_sound_options::populate() void menu_sound_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui().draw_text_full(container, _("Sound Options"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _("Sound Options"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -166,8 +166,8 @@ void menu_sound_options::custom_render(void *selectedref, float top, float botto y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _("Sound Options"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _("Sound Options"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } } // namespace ui diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp index 2d93b7cc4f0..6cabf4e784a 100644 --- a/src/frontend/mame/ui/submenu.cpp +++ b/src/frontend/mame/ui/submenu.cpp @@ -414,8 +414,8 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or { float width; - ui().draw_text_full(container, _(m_options[0].description), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr); + ui().draw_text_full(container, _(m_options[0].description), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -434,16 +434,16 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or y1 += UI_BOX_TB_BORDER; // draw the text within it - ui().draw_text_full(container, _(m_options[0].description), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + ui().draw_text_full(container, _(m_options[0].description), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); if (selectedref != nullptr) { option &selected_sm_option = *reinterpret_cast