Page 1 of 1

Ubuntu mame info display glitches (with bugfix)

Posted: Fri Mar 10, 2017 10:22 pm
by walterclaus
Hello,

I am compiling my own mame binaries for linux. In one of the last
releases since mame-0.175 there was a regression introduced when
the 'General Info' screen is displayed. See here:

http://imgur.com/a/FY8bM

All space chars between keys and values are displayed as strange
white rectangles. There is code in frontend/mame/ui/selgame.cpp,
which right-aligns the values with UTF HAIR spaces.
When the UTF HAIR spaces are substituted with normal spaces,
the display looks correct again (even if the right column is not
always exactly pixel aligned).

This patch might break the display on other operating systems,
so it is no general solution. I would be happy if someone had
a better advice to fix this:

Code: Select all

--- src/frontend/mame/ui/selgame.cpp.s01        2017-03-07 00:01:33.029814487 +0100
+++ src/frontend/mame/ui/selgame.cpp            2017-03-07 00:01:53.438366785 +0100
@@ -1310,7 +1310,7 @@

        std::istringstream istr(str.str());
        std::string line;
-       float spacewid = ui().get_char_width(0x200a);
+       float spacewid = ui().get_char_width(0x0020);
        str.clear();
        str.seekp(0);
        str << "#jp\n";
@@ -1323,7 +1323,7 @@
                newstr.reserve((nspace * 3) + line.length());
                newstr.append(line.substr(0, line.find(':')));
                for(int i = 0; i < nspace; i++)
-                       newstr.append("\xE2\x80\x8A");
+                       newstr.append("\x20");
                str << newstr.append(line.substr(line.find(':') + 1, line.npos)).append("\n");
        }
        buffer = str.str();
There is another issue on linux since mame introduced the lua
data-plugin for dat-file loading in one of the last releases:
- mame will only show the mameinfo dat screen. All other
info screens like history.dat are not found.
- and also all '\r'-characters in the info texts are displayed
as the same white boxes like in the first issue above.

All dat-File distributions encode the files with '\r\n' line
delimiters. When the load_dat.lua script is changed to remove
the '\r' from the info-tags and the info-text, all info-dialogs
are displayed correctly again.

Just remove the history.db file after this fix, so that mame
regenerates it from the available dat-files on the next start:

Code: Select all

--- plugins/data/load_dat.lua.s01       2017-03-06 21:48:29.573670022 +0100
+++ plugins/data/load_dat.lua           2017-03-07 00:00:08.035514288 +0100
@@ -109,7 +109,7 @@
                        local function iter()
                                local tag1, tag2, data, start, inblock = false
                                while not data do
-                                       local spos, epos, match = buffer:find("\n($[^\n]*)", pos)
+                                       local spos, epos, match = buffer:find("\n($[^\r\n]*)", pos)
                                        if not spos then
                                                return nil
                                        end
@@ -127,6 +127,7 @@
                                        end
                                        pos = epos
                                end
+                               data = data:gsub("\r\n", "\n")
                                return tag1, tag2, data
                        end
                        return iter
Another solution for this problem might be to remove the '\r'-chars
from the dat-files on unix after downloading them and before the
history.db is generated. But this would complicate the handling of
dat-file updates..