Fix bdc loading and fullpath TTF loading

This commit is contained in:
Vas Crabb 2016-03-20 20:44:07 +11:00
parent 7cd40eb58d
commit 83298818e3

View File

@ -133,24 +133,6 @@ render_font::render_font(render_manager &manager, const char *filename)
// if this is an OSD font, we're done
if (filename != nullptr)
{
// attempt to open the cached version of the font
{
emu_file cachefile(manager.machine().options().font_path(), OPEN_FLAG_READ);
osd_file::error filerr = cachefile.open(filename);
if (filerr == osd_file::error::NONE)
{
// if we have a cached version, load it
bool result = load_cached(cachefile, 0);
// if that worked, we're done
if (result)
{
render_font_command_glyph();
return;
}
}
}
m_osdfont = manager.machine().osd().font_alloc();
if (m_osdfont)
{
@ -171,12 +153,31 @@ render_font::render_font(render_manager &manager, const char *filename)
if (filename != nullptr && core_stricmp(filename, "default") == 0)
filename = "ui.bdf";
// attempt to open the cached version of the font
if (filename != nullptr)
{
emu_file cachefile(manager.machine().options().font_path(), OPEN_FLAG_READ);
osd_file::error const filerr = cachefile.open(filename);
if (filerr == osd_file::error::NONE)
{
// if we have a cached version, load it
bool const result = load_cached(cachefile, 0);
// if that worked, we're done
if (result)
{
render_font_command_glyph();
return;
}
}
}
// attempt to load the cached version of the font first
if (filename != nullptr && load_cached_bdf(filename))
{
//mamep: allocate command glyph font
render_font_command_glyph();
return;
//mamep: allocate command glyph font
render_font_command_glyph();
return;
}
// load the raw data instead
@ -677,7 +678,7 @@ bool render_font::load_cached(emu_file &file, UINT32 hash)
// validate the header
if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't')
return false;
if (header[4] != (UINT8)(hash >> 24) || header[5] != (UINT8)(hash >> 16) || header[6] != (UINT8)(hash >> 8) || header[7] != (UINT8)hash)
if (hash && (header[4] != (UINT8)(hash >> 24) || header[5] != (UINT8)(hash >> 16) || header[6] != (UINT8)(hash >> 8) || header[7] != (UINT8)hash))
return false;
m_height = (header[8] << 8) | header[9];
m_scale = 1.0f / (float)m_height;