mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Merge branch 'master' of https://github.com/mamedev/mame.git
This commit is contained in:
commit
ce5bd9a3d2
@ -40,7 +40,7 @@ end
|
||||
}
|
||||
|
||||
|
||||
project("tests")
|
||||
project("mametests")
|
||||
uuid ("66d4c639-196b-4065-a411-7ee9266564f5")
|
||||
kind "ConsoleApp"
|
||||
|
||||
@ -70,11 +70,13 @@ project("tests")
|
||||
includedirs {
|
||||
MAME_DIR .. "3rdparty/googletest/googletest/include",
|
||||
MAME_DIR .. "src/osd",
|
||||
MAME_DIR .. "src/emu",
|
||||
MAME_DIR .. "src/lib/util",
|
||||
}
|
||||
|
||||
files {
|
||||
MAME_DIR .. "tests/main.cpp",
|
||||
MAME_DIR .. "tests/lib/util/corestr.cpp",
|
||||
MAME_DIR .. "tests/emu/attotime.cpp",
|
||||
}
|
||||
|
||||
|
@ -15,19 +15,20 @@
|
||||
|
||||
project("romcmp")
|
||||
uuid ("1b40275b-194c-497b-8abd-9338775a21b8")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
links {
|
||||
"utils",
|
||||
"expat",
|
||||
"7z",
|
||||
"ocore_" .. _OPTIONS["osd"],
|
||||
}
|
||||
|
||||
@ -64,13 +65,13 @@ strip()
|
||||
|
||||
project("chdman")
|
||||
uuid ("7d948868-42db-432a-9bb5-70ce5c5f4620")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -126,13 +127,13 @@ strip()
|
||||
|
||||
project("jedutil")
|
||||
uuid ("bda60edb-f7f5-489f-b232-23d33c43dda1")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -175,13 +176,13 @@ strip()
|
||||
|
||||
project("unidasm")
|
||||
uuid ("65f81d3b-299a-4b08-a3fa-d5241afa9fd1")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -189,7 +190,7 @@ links {
|
||||
"dasm",
|
||||
"utils",
|
||||
"expat",
|
||||
"7z",
|
||||
"7z",
|
||||
"ocore_" .. _OPTIONS["osd"],
|
||||
}
|
||||
|
||||
@ -238,20 +239,20 @@ strip()
|
||||
|
||||
project("ldresample")
|
||||
uuid ("3401561a-4407-4e13-9c6d-c0801330f7cc")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
links {
|
||||
"utils",
|
||||
"expat",
|
||||
"7z",
|
||||
"7z",
|
||||
"ocore_" .. _OPTIONS["osd"],
|
||||
}
|
||||
|
||||
@ -299,20 +300,20 @@ strip()
|
||||
|
||||
project("ldverify")
|
||||
uuid ("3e66560d-b928-4227-928b-eadd0a10f00a")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
links {
|
||||
"utils",
|
||||
"expat",
|
||||
"7z",
|
||||
"7z",
|
||||
"ocore_" .. _OPTIONS["osd"],
|
||||
}
|
||||
|
||||
@ -360,13 +361,13 @@ strip()
|
||||
|
||||
project("regrep")
|
||||
uuid ("7f6de580-d800-4e8d-bed6-9fc86829584d")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -409,13 +410,13 @@ strip()
|
||||
|
||||
project("srcclean")
|
||||
uuid ("4dd58139-313a-42c5-965d-f378bdeed220")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -458,13 +459,13 @@ strip()
|
||||
|
||||
project("src2html")
|
||||
uuid ("b31e963a-09ef-4696-acbd-e663e35ce6f7")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -507,13 +508,13 @@ strip()
|
||||
|
||||
project("split")
|
||||
uuid ("8ef6ff18-3199-4cc2-afd0-d64033070faa")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -567,13 +568,13 @@ strip()
|
||||
|
||||
project("pngcmp")
|
||||
uuid ("61f647d9-b129-409b-9c62-8acf98ed39be")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -616,13 +617,13 @@ strip()
|
||||
|
||||
project("nltool")
|
||||
uuid ("853a03b7-fa37-41a8-8250-0dc23dd935d6")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -678,13 +679,13 @@ strip()
|
||||
|
||||
project("nlwav")
|
||||
uuid ("7c5396d1-2a1a-4c93-bed6-6b8fa182054a")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -718,13 +719,13 @@ strip()
|
||||
|
||||
project("castool")
|
||||
uuid ("7d9ed428-e2ba-4448-832d-d882a64d5c22")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -758,7 +759,7 @@ end
|
||||
|
||||
includedirs {
|
||||
MAME_DIR .. "src/osd",
|
||||
MAME_DIR .. "src/lib",
|
||||
MAME_DIR .. "src/lib",
|
||||
MAME_DIR .. "src/lib/util",
|
||||
}
|
||||
|
||||
@ -780,13 +781,13 @@ strip()
|
||||
|
||||
project("floptool")
|
||||
uuid ("85d8e3a6-1661-4ac9-8c21-281d20cbaf5b")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -821,7 +822,7 @@ end
|
||||
|
||||
includedirs {
|
||||
MAME_DIR .. "src/osd",
|
||||
MAME_DIR .. "src/lib",
|
||||
MAME_DIR .. "src/lib",
|
||||
MAME_DIR .. "src/lib/util",
|
||||
}
|
||||
|
||||
@ -843,13 +844,13 @@ strip()
|
||||
|
||||
project("imgtool")
|
||||
uuid ("f3707807-e587-4297-a5d8-bc98f3d0b1ca")
|
||||
kind "ConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
|
||||
flags {
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
"Symbols", -- always include minimum symbols for executables
|
||||
}
|
||||
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
if _OPTIONS["SEPARATE_BIN"]~="1" then
|
||||
targetdir(MAME_DIR)
|
||||
end
|
||||
|
||||
@ -884,10 +885,10 @@ end
|
||||
|
||||
includedirs {
|
||||
MAME_DIR .. "src/osd",
|
||||
MAME_DIR .. "src/lib",
|
||||
MAME_DIR .. "src/lib",
|
||||
MAME_DIR .. "src/lib/util",
|
||||
MAME_DIR .. "3rdparty/zlib",
|
||||
MAME_DIR .. "src/tools/imgtool",
|
||||
MAME_DIR .. "src/tools/imgtool",
|
||||
}
|
||||
|
||||
files {
|
||||
@ -908,21 +909,21 @@ files {
|
||||
MAME_DIR .. "src/tools/imgtool/imgtool.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/imgtool.h",
|
||||
MAME_DIR .. "src/tools/imgtool/imgterrs.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/imgterrs.h",
|
||||
MAME_DIR .. "src/tools/imgtool/imghd.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/imgterrs.h",
|
||||
MAME_DIR .. "src/tools/imgtool/imghd.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/imghd.h",
|
||||
MAME_DIR .. "src/tools/imgtool/charconv.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/charconv.h",
|
||||
MAME_DIR .. "src/tools/imgtool/formats/vt_dsk.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/formats/vt_dsk.h",
|
||||
MAME_DIR .. "src/tools/imgtool/formats/coco_dsk.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/formats/coco_dsk.h",
|
||||
MAME_DIR .. "src/tools/imgtool/formats/coco_dsk.h",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/amiga.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/macbin.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/rsdos.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/os9.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/mac.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/ti99.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/ti99.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/ti990hd.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/concept.cpp",
|
||||
MAME_DIR .. "src/tools/imgtool/modules/fat.cpp",
|
||||
|
@ -2245,43 +2245,46 @@ rpk_socket::rpk_socket(const char* id, int length, UINT8* contents)
|
||||
/*
|
||||
Locate a file in the ZIP container
|
||||
*/
|
||||
const zip_file::file_header* rpk_reader::find_file(zip_file &zip, const char *filename, UINT32 crc)
|
||||
int rpk_reader::find_file(util::archive_file &zip, const char *filename, UINT32 crc)
|
||||
{
|
||||
const zip_file::file_header *header;
|
||||
for (header = zip.first_file(); header != nullptr; header = zip.next_file())
|
||||
for (int header = zip.first_file(); header >= 0; header = zip.next_file())
|
||||
{
|
||||
// We don't check for CRC == 0.
|
||||
if (crc != 0)
|
||||
// Ignore directories
|
||||
if (!zip.current_is_directory())
|
||||
{
|
||||
// if the CRC and name both match, we're good
|
||||
// if the CRC matches and the name doesn't, we're still good
|
||||
if (header->crc == crc)
|
||||
return header;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (core_stricmp(header->filename, filename)==0)
|
||||
// We don't check for CRC == 0.
|
||||
if (crc != 0)
|
||||
{
|
||||
return header;
|
||||
// if the CRC and name both match, we're good
|
||||
// if the CRC matches and the name doesn't, we're still good
|
||||
if (zip.current_crc() == crc)
|
||||
return header;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (core_stricmp(zip.current_name().c_str(), filename) == 0)
|
||||
{
|
||||
return header;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
Load a rom resource and put it in a pcb socket instance.
|
||||
*/
|
||||
rpk_socket* rpk_reader::load_rom_resource(zip_file &zip, xml_data_node* rom_resource_node, const char* socketname)
|
||||
rpk_socket* rpk_reader::load_rom_resource(util::archive_file &zip, xml_data_node* rom_resource_node, const char* socketname)
|
||||
{
|
||||
const char* file;
|
||||
const char* crcstr;
|
||||
const char* sha1;
|
||||
zip_file::error ziperr;
|
||||
util::archive_file::error ziperr;
|
||||
UINT32 crc;
|
||||
int length;
|
||||
UINT8* contents;
|
||||
const zip_file::file_header *header;
|
||||
int header;
|
||||
|
||||
// find the file attribute (required)
|
||||
file = xml_get_attribute_string(rom_resource_node, "file", nullptr);
|
||||
@ -2301,9 +2304,9 @@ rpk_socket* rpk_reader::load_rom_resource(zip_file &zip, xml_data_node* rom_reso
|
||||
crc = strtoul(crcstr, nullptr, 16);
|
||||
header = find_file(zip, file, crc);
|
||||
}
|
||||
if (header == nullptr) throw rpk_exception(RPK_INVALID_FILE_REF, "File not found or CRC check failed");
|
||||
if (header < 0) throw rpk_exception(RPK_INVALID_FILE_REF, "File not found or CRC check failed");
|
||||
|
||||
length = header->uncompressed_length;
|
||||
length = zip.current_uncompressed_length();
|
||||
|
||||
// Allocate storage
|
||||
contents = global_alloc_array_clear<UINT8>(length);
|
||||
@ -2311,9 +2314,9 @@ rpk_socket* rpk_reader::load_rom_resource(zip_file &zip, xml_data_node* rom_reso
|
||||
|
||||
// and unzip file from the zip file
|
||||
ziperr = zip.decompress(contents, length);
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
if (ziperr != util::archive_file::error::NONE)
|
||||
{
|
||||
if (ziperr == zip_file::error::UNSUPPORTED) throw rpk_exception(RPK_ZIP_UNSUPPORTED);
|
||||
if (ziperr == util::archive_file::error::UNSUPPORTED) throw rpk_exception(RPK_ZIP_UNSUPPORTED);
|
||||
else throw rpk_exception(RPK_ZIP_ERROR);
|
||||
}
|
||||
|
||||
@ -2414,15 +2417,14 @@ rpk_socket* rpk_reader::load_ram_resource(emu_options &options, xml_data_node* r
|
||||
|
||||
rpk* rpk_reader::open(emu_options &options, const char *filename, const char *system_name)
|
||||
{
|
||||
zip_file::error ziperr;
|
||||
util::archive_file::error ziperr;
|
||||
|
||||
const zip_file::file_header *header;
|
||||
const char *pcb_type;
|
||||
const char *id;
|
||||
const char *uses_name;
|
||||
const char *resource_name;
|
||||
|
||||
zip_file::ptr zipfile;
|
||||
util::archive_file::ptr zipfile;
|
||||
|
||||
std::vector<char> layout_text;
|
||||
xml_data_node *layout_xml = nullptr;
|
||||
@ -2442,25 +2444,24 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy
|
||||
try
|
||||
{
|
||||
/* open the ZIP file */
|
||||
ziperr = zip_file::open(filename, zipfile);
|
||||
if (ziperr != zip_file::error::NONE) throw rpk_exception(RPK_NOT_ZIP_FORMAT);
|
||||
ziperr = util::archive_file::open_zip(filename, zipfile);
|
||||
if (ziperr != util::archive_file::error::NONE) throw rpk_exception(RPK_NOT_ZIP_FORMAT);
|
||||
|
||||
/* find the layout.xml file */
|
||||
header = find_file(*zipfile, "layout.xml", 0);
|
||||
if (header == nullptr) throw rpk_exception(RPK_MISSING_LAYOUT);
|
||||
if (find_file(*zipfile, "layout.xml", 0) < 0) throw rpk_exception(RPK_MISSING_LAYOUT);
|
||||
|
||||
/* reserve space for the layout file contents (+1 for the termination) */
|
||||
layout_text.resize(header->uncompressed_length + 1);
|
||||
layout_text.resize(zipfile->current_uncompressed_length() + 1);
|
||||
|
||||
/* uncompress the layout text */
|
||||
ziperr = zipfile->decompress(&layout_text[0], header->uncompressed_length);
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
ziperr = zipfile->decompress(&layout_text[0], zipfile->current_uncompressed_length());
|
||||
if (ziperr != util::archive_file::error::NONE)
|
||||
{
|
||||
if (ziperr == zip_file::error::UNSUPPORTED) throw rpk_exception(RPK_ZIP_UNSUPPORTED);
|
||||
if (ziperr == util::archive_file::error::UNSUPPORTED) throw rpk_exception(RPK_ZIP_UNSUPPORTED);
|
||||
else throw rpk_exception(RPK_ZIP_ERROR);
|
||||
}
|
||||
|
||||
layout_text[header->uncompressed_length] = '\0'; // Null-terminate
|
||||
layout_text[zipfile->current_uncompressed_length()] = '\0'; // Null-terminate
|
||||
|
||||
/* parse the layout text */
|
||||
layout_xml = xml_string_read(&layout_text[0], nullptr);
|
||||
|
@ -454,10 +454,10 @@ public:
|
||||
rpk *open(emu_options &options, const char *filename, const char *system_name);
|
||||
|
||||
private:
|
||||
const zip_file::file_header* find_file(zip_file &zip, const char *filename, UINT32 crc);
|
||||
rpk_socket* load_rom_resource(zip_file &zip, xml_data_node* rom_resource_node, const char* socketname);
|
||||
rpk_socket* load_ram_resource(emu_options &options, xml_data_node* ram_resource_node, const char* socketname, const char* system_name);
|
||||
const pcb_type* m_types;
|
||||
int find_file(util::archive_file &zip, const char *filename, UINT32 crc);
|
||||
rpk_socket* load_rom_resource(util::archive_file &zip, xml_data_node* rom_resource_node, const char* socketname);
|
||||
rpk_socket* load_ram_resource(emu_options &options, xml_data_node* ram_resource_node, const char* socketname, const char* system_name);
|
||||
const pcb_type* m_types;
|
||||
};
|
||||
|
||||
class rpk
|
||||
|
@ -365,7 +365,7 @@ floppy_image_format_t *floppy_image_device::identify(std::string filename)
|
||||
util::core_file::ptr fd;
|
||||
std::string revised_path;
|
||||
|
||||
osd_file::error err = zippath_fopen(filename.c_str(), OPEN_FLAG_READ, fd, revised_path);
|
||||
osd_file::error err = util::zippath_fopen(filename.c_str(), OPEN_FLAG_READ, fd, revised_path);
|
||||
if(err != osd_file::error::NONE) {
|
||||
seterror(IMAGE_ERROR_INVALIDIMAGE, "Unable to open the image file");
|
||||
return nullptr;
|
||||
@ -1004,7 +1004,7 @@ void ui_menu_control_floppy_image::hook_load(std::string filename, bool softlist
|
||||
std::string tmp_path;
|
||||
util::core_file::ptr tmp_file;
|
||||
/* attempt to open the file for writing but *without* create */
|
||||
filerr = zippath_fopen(filename.c_str(), OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path);
|
||||
filerr = util::zippath_fopen(filename.c_str(), OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path);
|
||||
if(filerr == osd_file::error::NONE)
|
||||
tmp_file.reset();
|
||||
else
|
||||
@ -1048,7 +1048,7 @@ void ui_menu_control_floppy_image::handle()
|
||||
state = START_FILE;
|
||||
handle();
|
||||
} else {
|
||||
zippath_combine(output_filename, current_directory.c_str(), current_file.c_str());
|
||||
util::zippath_combine(output_filename, current_directory.c_str(), current_file.c_str());
|
||||
output_format = format_array[submenu_result];
|
||||
do_load_create();
|
||||
ui_menu::stack_pop(machine());
|
||||
|
@ -1913,8 +1913,8 @@ void h63484_device::video_registers_w(int offset)
|
||||
|
||||
READ16_MEMBER( h63484_device::status_r )
|
||||
{
|
||||
// kothello is coded so that upper byte of this is 0xff otherwise no gfxs are copied.
|
||||
return m_sr | 0xff00;
|
||||
// kothello is coded so that upper byte of this should be 0xff (tests with jc opcode). Maybe it's just unconnected?
|
||||
return m_sr | 0xff00;
|
||||
}
|
||||
|
||||
READ16_MEMBER( h63484_device::data_r )
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "audit.h"
|
||||
#include "info.h"
|
||||
#include "unzip.h"
|
||||
#include "un7z.h"
|
||||
#include "validity.h"
|
||||
#include "sound/samples.h"
|
||||
#include "cliopts.h"
|
||||
@ -266,7 +265,7 @@ int cli_frontend::execute(int argc, char **argv)
|
||||
m_result = MAMERR_FATALERROR;
|
||||
}
|
||||
|
||||
_7z_file::cache_clear();
|
||||
util::archive_file::cache_clear();
|
||||
global_free(manager);
|
||||
|
||||
return m_result;
|
||||
@ -1000,7 +999,7 @@ void cli_frontend::verifyroms(const char *gamename)
|
||||
}
|
||||
|
||||
// clear out any cached files
|
||||
zip_file::cache_clear();
|
||||
util::archive_file::cache_clear();
|
||||
|
||||
// return an error if none found
|
||||
if (matched == 0)
|
||||
@ -1092,7 +1091,7 @@ void cli_frontend::verifysamples(const char *gamename)
|
||||
}
|
||||
|
||||
// clear out any cached files
|
||||
zip_file::cache_clear();
|
||||
util::archive_file::cache_clear();
|
||||
|
||||
// return an error if none found
|
||||
if (matched == 0)
|
||||
@ -1407,7 +1406,7 @@ void cli_frontend::verifysoftware(const char *gamename)
|
||||
}
|
||||
|
||||
// clear out any cached files
|
||||
zip_file::cache_clear();
|
||||
util::archive_file::cache_clear();
|
||||
|
||||
// return an error if none found
|
||||
if (matched == 0)
|
||||
@ -1529,7 +1528,7 @@ void cli_frontend::verifysoftlist(const char *gamename)
|
||||
}
|
||||
|
||||
// clear out any cached files
|
||||
zip_file::cache_clear();
|
||||
util::archive_file::cache_clear();
|
||||
|
||||
// return an error if none found
|
||||
if (matched == 0)
|
||||
@ -1758,28 +1757,32 @@ void media_identifier::identify(const char *filename)
|
||||
}
|
||||
|
||||
// if that failed, and the filename ends with .zip, identify as a ZIP file
|
||||
if (core_filename_ends_with(filename, ".7z"))
|
||||
if (core_filename_ends_with(filename, ".7z") || core_filename_ends_with(filename, ".zip"))
|
||||
{
|
||||
// first attempt to examine it as a valid _7Z file
|
||||
_7z_file::ptr _7z;
|
||||
_7z_file::error _7zerr = _7z_file::open(filename, _7z);
|
||||
if (_7zerr == _7z_file::error::NONE && _7z != nullptr)
|
||||
util::archive_file::ptr archive;
|
||||
util::archive_file::error err;
|
||||
if (core_filename_ends_with(filename, ".7z"))
|
||||
err = util::archive_file::open_7z(filename, archive);
|
||||
else
|
||||
err = util::archive_file::open_zip(filename, archive);
|
||||
if ((err == util::archive_file::error::NONE) && archive)
|
||||
{
|
||||
std::vector<std::uint8_t> data;
|
||||
|
||||
// loop over entries in the .7z, skipping empty files and directories
|
||||
for (int i = _7z->first_file(); i >= 0; i = _7z->next_file())
|
||||
for (int i = archive->first_file(); i >= 0; i = archive->next_file())
|
||||
{
|
||||
const std::uint64_t length(_7z->current_uncompressed_length());
|
||||
if ((length != 0) && (std::uint32_t(length) == length))
|
||||
const std::uint64_t length(archive->current_uncompressed_length());
|
||||
if (!archive->current_is_directory() && (length != 0) && (std::uint32_t(length) == length))
|
||||
{
|
||||
// decompress data into RAM and identify it
|
||||
try
|
||||
{
|
||||
data.resize(std::size_t(length));
|
||||
_7zerr = _7z->decompress(&data[0], std::uint32_t(length));
|
||||
if (_7zerr == _7z_file::error::NONE)
|
||||
identify_data(_7z->current_name().c_str(), &data[0], length);
|
||||
err = archive->decompress(&data[0], std::uint32_t(length));
|
||||
if (err == util::archive_file::error::NONE)
|
||||
identify_data(archive->current_name().c_str(), &data[0], length);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -1791,31 +1794,8 @@ void media_identifier::identify(const char *filename)
|
||||
}
|
||||
|
||||
// clear out any cached files
|
||||
_7z.reset();
|
||||
_7z_file::cache_clear();
|
||||
}
|
||||
else if (core_filename_ends_with(filename, ".zip"))
|
||||
{
|
||||
// first attempt to examine it as a valid ZIP file
|
||||
zip_file::ptr zip = nullptr;
|
||||
zip_file::error ziperr = zip_file::open(filename, zip);
|
||||
if (ziperr == zip_file::error::NONE && zip != nullptr)
|
||||
{
|
||||
// loop over entries in the ZIP, skipping empty files and directories
|
||||
for (const zip_file::file_header *entry = zip->first_file(); entry != nullptr; entry = zip->next_file())
|
||||
if (entry->uncompressed_length != 0)
|
||||
{
|
||||
// decompress data into RAM and identify it
|
||||
dynamic_buffer data(entry->uncompressed_length);
|
||||
ziperr = zip->decompress(&data[0], entry->uncompressed_length);
|
||||
if (ziperr == zip_file::error::NONE)
|
||||
identify_data(entry->filename, &data[0], entry->uncompressed_length);
|
||||
}
|
||||
}
|
||||
|
||||
// clear out any cached files
|
||||
zip.reset();
|
||||
zip_file::cache_clear();
|
||||
archive.reset();
|
||||
util::archive_file::cache_clear();
|
||||
}
|
||||
|
||||
// otherwise, identify as a raw file
|
||||
|
@ -1872,6 +1872,7 @@ static void execute_dump(running_machine &machine, int ref, int params, const ch
|
||||
for (i = offset; i <= endoffset; i += 16)
|
||||
{
|
||||
output.clear();
|
||||
output.rdbuf()->clear();
|
||||
|
||||
/* print the address */
|
||||
util::stream_format(output, "%0*X: ", space->logaddrchars(), (UINT32)space->byte_to_address(i));
|
||||
@ -2306,6 +2307,7 @@ static void execute_cheatlist(running_machine &machine, int ref, int params, con
|
||||
{
|
||||
active_cheat++;
|
||||
output.clear();
|
||||
output.rdbuf()->clear();
|
||||
stream_format(
|
||||
output,
|
||||
" <cheat desc=\"Possibility %d : %0*X (%0*X)\">\n"
|
||||
@ -2516,6 +2518,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch
|
||||
offs_t tempaddr;
|
||||
int numbytes = 0;
|
||||
output.clear();
|
||||
output.rdbuf()->clear();
|
||||
|
||||
/* print the address */
|
||||
stream_format(output, "%0*X: ", space->logaddrchars(), (UINT32)space->byte_to_address(pcbyte));
|
||||
|
@ -240,6 +240,7 @@ void debug_view_breakpoints::view_update()
|
||||
if (m_visible.y > 0)
|
||||
{
|
||||
linebuf.clear();
|
||||
linebuf.rdbuf()->clear();
|
||||
linebuf << "ID";
|
||||
if (m_sortType == &cIndexAscending) linebuf.put('\\');
|
||||
else if (m_sortType == &cIndexDescending) linebuf.put('/');
|
||||
@ -282,6 +283,7 @@ void debug_view_breakpoints::view_update()
|
||||
device_debug::breakpoint *const bp = m_buffer[bpi];
|
||||
|
||||
linebuf.clear();
|
||||
linebuf.rdbuf()->clear();
|
||||
util::stream_format(linebuf, "%2X", bp->index());
|
||||
pad_ostream_to_length(linebuf, tableBreaks[0]);
|
||||
linebuf.put(bp->enabled() ? 'X' : 'O');
|
||||
|
@ -266,6 +266,7 @@ void debug_view_watchpoints::view_update()
|
||||
if (m_visible.y > 0)
|
||||
{
|
||||
linebuf.clear();
|
||||
linebuf.rdbuf()->clear();
|
||||
linebuf << "ID";
|
||||
if (m_sortType == &cIndexAscending) linebuf.put('\\');
|
||||
else if (m_sortType == &cIndexDescending) linebuf.put('/');
|
||||
@ -317,6 +318,7 @@ void debug_view_watchpoints::view_update()
|
||||
device_debug::watchpoint *const wp = m_buffer[wpi];
|
||||
|
||||
linebuf.clear();
|
||||
linebuf.rdbuf()->clear();
|
||||
util::stream_format(linebuf, "%2X", wp->index());
|
||||
pad_ostream_to_length(linebuf, tableBreaks[0]);
|
||||
linebuf.put(wp->enabled() ? 'X' : 'O');
|
||||
|
@ -158,7 +158,7 @@ void device_image_interface::device_compute_hash(hash_collection &hashes, const
|
||||
image_error_t device_image_interface::set_image_filename(const char *filename)
|
||||
{
|
||||
m_image_name = filename;
|
||||
zippath_parent(m_working_directory, filename);
|
||||
util::zippath_parent(m_working_directory, filename);
|
||||
m_basename.assign(m_image_name);
|
||||
|
||||
size_t loc1 = m_image_name.find_last_of('\\');
|
||||
@ -319,7 +319,7 @@ bool device_image_interface::try_change_working_directory(const char *subdir)
|
||||
|
||||
/* did we successfully identify the directory? */
|
||||
if (success)
|
||||
zippath_combine(m_working_directory, m_working_directory.c_str(), subdir);
|
||||
util::zippath_combine(m_working_directory, m_working_directory.c_str(), subdir);
|
||||
|
||||
return success;
|
||||
}
|
||||
@ -611,7 +611,7 @@ image_error_t device_image_interface::load_image_by_path(UINT32 open_flags, cons
|
||||
std::string revised_path;
|
||||
|
||||
/* attempt to read the file */
|
||||
auto const filerr = zippath_fopen(path, open_flags, m_file, revised_path);
|
||||
auto const filerr = util::zippath_fopen(path, open_flags, m_file, revised_path);
|
||||
|
||||
/* did the open succeed? */
|
||||
switch(filerr)
|
||||
@ -663,7 +663,7 @@ int device_image_interface::reopen_for_write(const char *path)
|
||||
std::string revised_path;
|
||||
|
||||
/* attempt to open the file for writing*/
|
||||
auto const filerr = zippath_fopen(path, OPEN_FLAG_READ|OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, m_file, revised_path);
|
||||
auto const filerr = util::zippath_fopen(path, OPEN_FLAG_READ|OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, m_file, revised_path);
|
||||
|
||||
/* did the open succeed? */
|
||||
switch(filerr)
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "unzip.h"
|
||||
#include "un7z.h"
|
||||
#include "fileio.h"
|
||||
|
||||
|
||||
@ -146,8 +145,6 @@ emu_file::emu_file(UINT32 openflags)
|
||||
m_openflags(openflags),
|
||||
m_zipfile(nullptr),
|
||||
m_ziplength(0),
|
||||
m__7zfile(),
|
||||
m__7zlength(0),
|
||||
m_remove_on_close(false),
|
||||
m_restrict_to_mediapath(false)
|
||||
{
|
||||
@ -164,8 +161,6 @@ emu_file::emu_file(const char *searchpath, UINT32 openflags)
|
||||
m_openflags(openflags),
|
||||
m_zipfile(nullptr),
|
||||
m_ziplength(0),
|
||||
m__7zfile(),
|
||||
m__7zlength(0),
|
||||
m_remove_on_close(false),
|
||||
m_restrict_to_mediapath(false)
|
||||
{
|
||||
@ -228,12 +223,6 @@ hash_collection &emu_file::hashes(const char *types)
|
||||
return m_hashes;
|
||||
|
||||
// if we have ZIP data, just hash that directly
|
||||
if (!m__7zdata.empty())
|
||||
{
|
||||
m_hashes.compute(&m__7zdata[0], m__7zdata.size(), needed.c_str());
|
||||
return m_hashes;
|
||||
}
|
||||
|
||||
if (!m_zipdata.empty())
|
||||
{
|
||||
m_hashes.compute(&m_zipdata[0], m_zipdata.size(), needed.c_str());
|
||||
@ -338,7 +327,7 @@ osd_file::error emu_file::open_next()
|
||||
while (m_iterator.next(m_fullpath, m_filename.c_str()))
|
||||
{
|
||||
// attempt to open the file directly
|
||||
filerr = util::core_file::open(m_fullpath.c_str(), m_openflags, m_file);
|
||||
filerr = util::core_file::open(m_fullpath, m_openflags, m_file);
|
||||
if (filerr == osd_file::error::NONE)
|
||||
break;
|
||||
|
||||
@ -386,11 +375,9 @@ osd_file::error emu_file::open_ram(const void *data, UINT32 length)
|
||||
void emu_file::close()
|
||||
{
|
||||
// close files and free memory
|
||||
m__7zfile.reset();
|
||||
m_zipfile.reset();
|
||||
m_file.reset();
|
||||
|
||||
m__7zdata.clear();
|
||||
m_zipdata.clear();
|
||||
|
||||
if (m_remove_on_close)
|
||||
@ -423,10 +410,7 @@ osd_file::error emu_file::compress(int level)
|
||||
bool emu_file::compressed_file_ready(void)
|
||||
{
|
||||
// load the ZIP file now if we haven't yet
|
||||
if (m__7zfile != nullptr && load__7zped_file() != osd_file::error::NONE)
|
||||
return true;
|
||||
|
||||
if (m_zipfile != nullptr && load_zipped_file() != osd_file::error::NONE)
|
||||
if (m_zipfile && (load_zipped_file() != osd_file::error::NONE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -493,9 +477,6 @@ bool emu_file::eof()
|
||||
UINT64 emu_file::size()
|
||||
{
|
||||
// use the ZIP length if present
|
||||
if (m__7zfile != nullptr)
|
||||
return m__7zlength;
|
||||
|
||||
if (m_zipfile != nullptr)
|
||||
return m_ziplength;
|
||||
|
||||
@ -676,44 +657,37 @@ osd_file::error emu_file::attempt_zipped()
|
||||
m_fullpath = m_fullpath.substr(0, dirsep).append(".zip");
|
||||
|
||||
// attempt to open the ZIP file
|
||||
zip_file::ptr zip;
|
||||
zip_file::error ziperr = zip_file::open(m_fullpath, zip);
|
||||
util::archive_file::ptr zip;
|
||||
util::archive_file::error ziperr = util::archive_file::open_zip(m_fullpath, zip);
|
||||
|
||||
// chop the .zip back off the filename before continuing
|
||||
m_fullpath = m_fullpath.substr(0, dirsep);
|
||||
|
||||
// if we failed to open this file, continue scanning
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
if (ziperr != util::archive_file::error::NONE)
|
||||
continue;
|
||||
|
||||
int header = -1;
|
||||
|
||||
// see if we can find a file with the right name and (if available) crc
|
||||
const zip_file::file_header *header;
|
||||
for (header = zip->first_file(); header != nullptr; header = zip->next_file())
|
||||
if (zip_filename_match(*header, filename) && (!(m_openflags & OPEN_FLAG_HAS_CRC) || header->crc == m_crc))
|
||||
break;
|
||||
if (m_openflags & OPEN_FLAG_HAS_CRC) header = zip->search(m_crc, filename);
|
||||
|
||||
// if that failed, look for a file with the right crc, but the wrong filename
|
||||
if (header == nullptr && (m_openflags & OPEN_FLAG_HAS_CRC))
|
||||
for (header = zip->first_file(); header != nullptr; header = zip->next_file())
|
||||
if (header->crc == m_crc && !zip_header_is_path(*header))
|
||||
break;
|
||||
if (header < 0 && (m_openflags & OPEN_FLAG_HAS_CRC)) header = zip->search(m_crc);
|
||||
|
||||
// if that failed, look for a file with the right name; reporting a bad checksum
|
||||
// is more helpful and less confusing than reporting "rom not found"
|
||||
if (header == nullptr)
|
||||
for (header = zip->first_file(); header != nullptr; header = zip->next_file())
|
||||
if (zip_filename_match(*header, filename))
|
||||
break;
|
||||
if (header < 0) header = zip->search(filename);
|
||||
|
||||
// if we got it, read the data
|
||||
if (header != nullptr)
|
||||
if (header >= 0)
|
||||
{
|
||||
m_zipfile = std::move(zip);
|
||||
m_ziplength = header->uncompressed_length;
|
||||
m_ziplength = m_zipfile->current_uncompressed_length();
|
||||
|
||||
// build a hash with just the CRC
|
||||
m_hashes.reset();
|
||||
m_hashes.add_crc(header->crc);
|
||||
m_hashes.add_crc(m_zipfile->current_crc());
|
||||
return (m_openflags & OPEN_FLAG_NO_PRELOAD) ? osd_file::error::NONE : load_zipped_file();
|
||||
}
|
||||
|
||||
@ -723,64 +697,6 @@ osd_file::error emu_file::attempt_zipped()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// load_zipped_file - load a ZIPped file
|
||||
//-------------------------------------------------
|
||||
|
||||
osd_file::error emu_file::load_zipped_file()
|
||||
{
|
||||
assert(m_file == nullptr);
|
||||
assert(m_zipdata.empty());
|
||||
assert(m_zipfile != nullptr);
|
||||
|
||||
// allocate some memory
|
||||
m_zipdata.resize(m_ziplength);
|
||||
|
||||
// read the data into our buffer and return
|
||||
zip_file::error ziperr = m_zipfile->decompress(&m_zipdata[0], m_zipdata.size());
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
{
|
||||
m_zipdata.clear();
|
||||
return osd_file::error::FAILURE;
|
||||
}
|
||||
|
||||
// convert to RAM file
|
||||
osd_file::error filerr = util::core_file::open_ram(&m_zipdata[0], m_zipdata.size(), m_openflags, m_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
m_zipdata.clear();
|
||||
return osd_file::error::FAILURE;
|
||||
}
|
||||
|
||||
// close out the ZIP file
|
||||
m_zipfile.reset();
|
||||
return osd_file::error::NONE;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// zip_filename_match - compare zip filename
|
||||
// to expected filename, ignoring any directory
|
||||
//-------------------------------------------------
|
||||
|
||||
bool emu_file::zip_filename_match(const zip_file::file_header &header, const std::string &filename)
|
||||
{
|
||||
const char *zipfile = header.filename + header.filename_length - filename.length();
|
||||
return (zipfile >= header.filename && core_stricmp(filename.c_str(),zipfile) == 0 && (zipfile == header.filename || zipfile[-1] == '/'));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// zip_header_is_path - check whether filename
|
||||
// in header is a path
|
||||
//-------------------------------------------------
|
||||
|
||||
bool emu_file::zip_header_is_path(const zip_file::file_header &header)
|
||||
{
|
||||
const char *zipfile = header.filename + header.filename_length - 1;
|
||||
return (zipfile >= header.filename && zipfile[0] == '/');
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// attempt__7zped - attempt to open a .7z file
|
||||
//-------------------------------------------------
|
||||
@ -810,14 +726,14 @@ osd_file::error emu_file::attempt__7zped()
|
||||
m_fullpath = m_fullpath.substr(0, dirsep).append(".7z");
|
||||
|
||||
// attempt to open the _7Z file
|
||||
_7z_file::ptr _7z;
|
||||
_7z_file::error _7zerr = _7z_file::open(m_fullpath, _7z);
|
||||
util::archive_file::ptr _7z;
|
||||
util::archive_file::error _7zerr = util::archive_file::open_7z(m_fullpath, _7z);
|
||||
|
||||
// chop the ._7z back off the filename before continuing
|
||||
m_fullpath = m_fullpath.substr(0, dirsep);
|
||||
|
||||
// if we failed to open this file, continue scanning
|
||||
if (_7zerr != _7z_file::error::NONE)
|
||||
if (_7zerr != util::archive_file::error::NONE)
|
||||
continue;
|
||||
|
||||
int fileno = -1;
|
||||
@ -826,21 +742,21 @@ osd_file::error emu_file::attempt__7zped()
|
||||
if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z->search(m_crc, filename);
|
||||
|
||||
// if that failed, look for a file with the right crc, but the wrong filename
|
||||
if ((fileno == -1) && (m_openflags & OPEN_FLAG_HAS_CRC)) fileno = _7z->search(m_crc);
|
||||
if ((fileno < 0) && (m_openflags & OPEN_FLAG_HAS_CRC)) fileno = _7z->search(m_crc);
|
||||
|
||||
// if that failed, look for a file with the right name; reporting a bad checksum
|
||||
// is more helpful and less confusing than reporting "rom not found"
|
||||
if (fileno == -1) fileno = _7z->search(filename);
|
||||
if (fileno < 0) fileno = _7z->search(filename);
|
||||
|
||||
if (fileno != -1)
|
||||
if (fileno >= 0)
|
||||
{
|
||||
m__7zfile = std::move(_7z);
|
||||
m__7zlength = m__7zfile->current_uncompressed_length();
|
||||
m_zipfile = std::move(_7z);
|
||||
m_ziplength = m_zipfile->current_uncompressed_length();
|
||||
|
||||
// build a hash with just the CRC
|
||||
m_hashes.reset();
|
||||
m_hashes.add_crc(m__7zfile->current_crc());
|
||||
return (m_openflags & OPEN_FLAG_NO_PRELOAD) ? osd_file::error::NONE : load__7zped_file();
|
||||
m_hashes.add_crc(m_zipfile->current_crc());
|
||||
return (m_openflags & OPEN_FLAG_NO_PRELOAD) ? osd_file::error::NONE : load_zipped_file();
|
||||
}
|
||||
|
||||
// close up the _7Z file and try the next level
|
||||
@ -850,35 +766,35 @@ osd_file::error emu_file::attempt__7zped()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// load__7zped_file - load a _7Zped file
|
||||
// load_zipped_file - load a ZIPped file
|
||||
//-------------------------------------------------
|
||||
|
||||
osd_file::error emu_file::load__7zped_file()
|
||||
osd_file::error emu_file::load_zipped_file()
|
||||
{
|
||||
assert(m_file == nullptr);
|
||||
assert(m__7zdata.empty());
|
||||
assert(m__7zfile);
|
||||
assert(m_zipdata.empty());
|
||||
assert(m_zipfile);
|
||||
|
||||
// allocate some memory
|
||||
m__7zdata.resize(m__7zlength);
|
||||
m_zipdata.resize(m_ziplength);
|
||||
|
||||
// read the data into our buffer and return
|
||||
_7z_file::error _7zerr = m__7zfile->decompress(&m__7zdata[0], m__7zdata.size());
|
||||
if (_7zerr != _7z_file::error::NONE)
|
||||
auto const ziperr = m_zipfile->decompress(&m_zipdata[0], m_zipdata.size());
|
||||
if (ziperr != util::archive_file::error::NONE)
|
||||
{
|
||||
m__7zdata.clear();
|
||||
m_zipdata.clear();
|
||||
return osd_file::error::FAILURE;
|
||||
}
|
||||
|
||||
// convert to RAM file
|
||||
osd_file::error filerr = util::core_file::open_ram(&m__7zdata[0], m__7zdata.size(), m_openflags, m_file);
|
||||
osd_file::error filerr = util::core_file::open_ram(&m_zipdata[0], m_zipdata.size(), m_openflags, m_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
m__7zdata.clear();
|
||||
m_zipdata.clear();
|
||||
return osd_file::error::FAILURE;
|
||||
}
|
||||
|
||||
// close out the _7Z file
|
||||
m__7zfile.reset();
|
||||
// close out the ZIP file
|
||||
m_zipfile.reset();
|
||||
return osd_file::error::NONE;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "corefile.h"
|
||||
#include "hash.h"
|
||||
#include "unzip.h"
|
||||
|
||||
// some systems use macros for getc/putc rather than functions
|
||||
#ifdef getc
|
||||
@ -27,7 +26,7 @@
|
||||
//**************************************************************************
|
||||
|
||||
// forward declarations
|
||||
class _7z_file;
|
||||
namespace util { class archive_file; }
|
||||
|
||||
// ======================> path_iterator
|
||||
|
||||
@ -146,12 +145,8 @@ private:
|
||||
|
||||
// internal helpers
|
||||
osd_file::error attempt_zipped();
|
||||
osd_file::error load_zipped_file();
|
||||
bool zip_filename_match(const zip_file::file_header &header, const std::string &filename);
|
||||
bool zip_header_is_path(const zip_file::file_header &header);
|
||||
|
||||
osd_file::error attempt__7zped();
|
||||
osd_file::error load__7zped_file();
|
||||
osd_file::error load_zipped_file();
|
||||
|
||||
// internal state
|
||||
std::string m_filename; // original filename provided
|
||||
@ -163,14 +158,10 @@ private:
|
||||
UINT32 m_openflags; // flags we used for the open
|
||||
hash_collection m_hashes; // collection of hashes
|
||||
|
||||
zip_file::ptr m_zipfile; // ZIP file pointer
|
||||
std::unique_ptr<util::archive_file> m_zipfile; // ZIP file pointer
|
||||
dynamic_buffer m_zipdata; // ZIP file data
|
||||
UINT64 m_ziplength; // ZIP file length
|
||||
|
||||
std::unique_ptr<_7z_file> m__7zfile; // 7Z file pointer
|
||||
dynamic_buffer m__7zdata; // 7Z file data
|
||||
UINT64 m__7zlength; // 7Z file length
|
||||
|
||||
bool m_remove_on_close; // flag: remove the file when closing
|
||||
bool m_restrict_to_mediapath; // flag: restrict to paths inside the media-path
|
||||
};
|
||||
|
@ -440,7 +440,7 @@ int running_machine::run(bool firstrun)
|
||||
|
||||
// call all exit callbacks registered
|
||||
call_notifiers(MACHINE_NOTIFY_EXIT);
|
||||
zip_file::cache_clear();
|
||||
util::archive_file::cache_clear();
|
||||
|
||||
// close the logfile
|
||||
m_logfile.reset();
|
||||
|
@ -474,7 +474,7 @@ ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_dirent
|
||||
}
|
||||
|
||||
// determine the full path
|
||||
zippath_combine(buffer, m_current_directory.c_str(), dirent->name);
|
||||
util::zippath_combine(buffer, m_current_directory.c_str(), dirent->name);
|
||||
|
||||
// create the file selector entry
|
||||
entry = append_entry(
|
||||
@ -535,7 +535,7 @@ void ui_menu_file_selector::append_entry_menu_item(const file_selector_entry *en
|
||||
|
||||
void ui_menu_file_selector::populate()
|
||||
{
|
||||
zippath_directory *directory = nullptr;
|
||||
util::zippath_directory *directory = nullptr;
|
||||
osd_file::error err;
|
||||
const osd_directory_entry *dirent;
|
||||
const file_selector_entry *entry;
|
||||
@ -545,7 +545,7 @@ void ui_menu_file_selector::populate()
|
||||
const char *path = m_current_directory.c_str();
|
||||
|
||||
// open the directory
|
||||
err = zippath_opendir(path, &directory);
|
||||
err = util::zippath_opendir(path, &directory);
|
||||
|
||||
// clear out the menu entries
|
||||
m_entrylist = nullptr;
|
||||
@ -581,7 +581,7 @@ void ui_menu_file_selector::populate()
|
||||
// build the menu for each item
|
||||
if (err == osd_file::error::NONE)
|
||||
{
|
||||
while((dirent = zippath_readdir(directory)) != nullptr)
|
||||
while((dirent = util::zippath_readdir(directory)) != nullptr)
|
||||
{
|
||||
// append a dirent entry
|
||||
entry = append_dirent_entry(dirent);
|
||||
@ -611,7 +611,7 @@ void ui_menu_file_selector::populate()
|
||||
customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
|
||||
if (directory != nullptr)
|
||||
zippath_closedir(directory);
|
||||
util::zippath_closedir(directory);
|
||||
}
|
||||
|
||||
|
||||
@ -656,7 +656,7 @@ void ui_menu_file_selector::handle()
|
||||
case SELECTOR_ENTRY_TYPE_DRIVE:
|
||||
case SELECTOR_ENTRY_TYPE_DIRECTORY:
|
||||
// drive/directory - first check the path
|
||||
err = zippath_opendir(entry->fullpath, nullptr);
|
||||
err = util::zippath_opendir(entry->fullpath, nullptr);
|
||||
if (err != osd_file::error::NONE)
|
||||
{
|
||||
// this path is problematic; present the user with an error and bail
|
||||
|
@ -59,12 +59,12 @@ ui_menu_control_device_image::ui_menu_control_device_image(running_machine &mach
|
||||
if (image->exists())
|
||||
{
|
||||
current_file.assign(image->filename());
|
||||
zippath_parent(current_directory, current_file.c_str());
|
||||
util::zippath_parent(current_directory, current_file.c_str());
|
||||
} else
|
||||
current_directory.assign(image->working_directory());
|
||||
|
||||
/* check to see if the path exists; if not clear it */
|
||||
if (zippath_opendir(current_directory.c_str(), nullptr) != osd_file::error::NONE)
|
||||
if (util::zippath_opendir(current_directory.c_str(), nullptr) != osd_file::error::NONE)
|
||||
current_directory.clear();
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@ void ui_menu_control_device_image::test_create(bool &can_create, bool &need_conf
|
||||
osd_dir_entry_type file_type;
|
||||
|
||||
/* assemble the full path */
|
||||
zippath_combine(path, current_directory.c_str(), current_file.c_str());
|
||||
util::zippath_combine(path, current_directory.c_str(), current_file.c_str());
|
||||
|
||||
/* does a file or a directory exist at the path */
|
||||
entry = osd_stat(path.c_str());
|
||||
@ -183,11 +183,11 @@ void ui_menu_control_device_image::handle()
|
||||
case START_FILE: {
|
||||
bool can_create = false;
|
||||
if(image->is_creatable()) {
|
||||
zippath_directory *directory = nullptr;
|
||||
osd_file::error err = zippath_opendir(current_directory.c_str(), &directory);
|
||||
can_create = err == osd_file::error::NONE && !zippath_is_zip(directory);
|
||||
util::zippath_directory *directory = nullptr;
|
||||
osd_file::error err = util::zippath_opendir(current_directory.c_str(), &directory);
|
||||
can_create = err == osd_file::error::NONE && !util::zippath_is_zip(directory);
|
||||
if(directory)
|
||||
zippath_closedir(directory);
|
||||
util::zippath_closedir(directory);
|
||||
}
|
||||
submenu_result = -1;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_file_selector>(machine(), container, image, current_directory, current_file, true, image->image_interface()!=nullptr, can_create, &submenu_result));
|
||||
@ -335,7 +335,7 @@ void ui_menu_control_device_image::handle()
|
||||
|
||||
case DO_CREATE: {
|
||||
std::string path;
|
||||
zippath_combine(path, current_directory.c_str(), current_file.c_str());
|
||||
util::zippath_combine(path, current_directory.c_str(), current_file.c_str());
|
||||
int err = image->create(path.c_str(), nullptr, nullptr);
|
||||
if (err != 0)
|
||||
machine().popmessage("Error: %s", image->error());
|
||||
|
@ -195,8 +195,8 @@ chd_file *ldplayer_state::get_disc()
|
||||
{
|
||||
// open the file itself via our search path
|
||||
emu_file image_file(machine().options().media_path(), OPEN_FLAG_READ);
|
||||
file_error filerr = image_file.open(dir->name);
|
||||
if (filerr == FILERR_NONE)
|
||||
osd_file::error filerr = image_file.open(dir->name);
|
||||
if (filerr == osd_file::error::NONE)
|
||||
{
|
||||
std::string fullpath(image_file.fullpath());
|
||||
image_file.close();
|
||||
|
@ -244,7 +244,7 @@ cdrom_file *cdrom_open(const char *inputfile)
|
||||
|
||||
for (i = 0; i < file->cdtoc.numtrks; i++)
|
||||
{
|
||||
osd_file::error filerr = util::core_file::open(file->track_info.track[i].fname.c_str(), OPEN_FLAG_READ, file->fhandle[i]);
|
||||
osd_file::error filerr = util::core_file::open(file->track_info.track[i].fname, OPEN_FLAG_READ, file->fhandle[i]);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
fprintf(stderr, "Unable to open file: %s\n", file->track_info.track[i].fname.c_str());
|
||||
|
@ -1084,7 +1084,7 @@ osd_file::error core_osd_file::osd_or_zlib_write(void const *buffer, std::uint64
|
||||
return an error code
|
||||
-------------------------------------------------*/
|
||||
|
||||
osd_file::error core_file::open(char const *filename, std::uint32_t openflags, ptr &file)
|
||||
osd_file::error core_file::open(std::string const &filename, std::uint32_t openflags, ptr &file)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1190,7 +1190,7 @@ core_file::~core_file()
|
||||
pointer
|
||||
-------------------------------------------------*/
|
||||
|
||||
osd_file::error core_file::load(char const *filename, void **data, std::uint32_t &length)
|
||||
osd_file::error core_file::load(std::string const &filename, void **data, std::uint32_t &length)
|
||||
{
|
||||
ptr file;
|
||||
|
||||
@ -1219,7 +1219,7 @@ osd_file::error core_file::load(char const *filename, void **data, std::uint32_t
|
||||
return osd_file::error::NONE;
|
||||
}
|
||||
|
||||
osd_file::error core_file::load(char const *filename, dynamic_buffer &data)
|
||||
osd_file::error core_file::load(std::string const &filename, dynamic_buffer &data)
|
||||
{
|
||||
ptr file;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
// ----- file open/close -----
|
||||
|
||||
// open a file with the specified filename
|
||||
static osd_file::error open(const char *filename, std::uint32_t openflags, ptr &file);
|
||||
static osd_file::error open(std::string const &filename, std::uint32_t openflags, ptr &file);
|
||||
|
||||
// open a RAM-based "file" using the given data and length (read-only)
|
||||
static osd_file::error open_ram(const void *data, std::size_t length, std::uint32_t openflags, ptr &file);
|
||||
@ -100,8 +100,8 @@ public:
|
||||
virtual const void *buffer() = 0;
|
||||
|
||||
// open a file with the specified filename, read it into memory, and return a pointer
|
||||
static osd_file::error load(const char *filename, void **data, std::uint32_t &length);
|
||||
static osd_file::error load(const char *filename, dynamic_buffer &data);
|
||||
static osd_file::error load(std::string const &filename, void **data, std::uint32_t &length);
|
||||
static osd_file::error load(std::string const &filename, dynamic_buffer &data);
|
||||
|
||||
|
||||
// ----- file write -----
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// this is based on unzip.c, with modifications needed to use the 7zip library
|
||||
|
||||
#include "un7z.h"
|
||||
#include "unzip.h"
|
||||
|
||||
#include "corestr.h"
|
||||
#include "unicode.h"
|
||||
@ -19,15 +19,18 @@
|
||||
#include "lzma/C/7zCrc.h"
|
||||
#include "lzma/C/7zVersion.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace util {
|
||||
namespace {
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
@ -98,6 +101,7 @@ public:
|
||||
|
||||
static ptr find_cached(const std::string &filename)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_cache_mutex);
|
||||
for (std::size_t cachenum = 0; cachenum < s_cache.size(); cachenum++)
|
||||
{
|
||||
// if we have a valid entry and it matches our filename, use it and remove from the cache
|
||||
@ -114,10 +118,11 @@ public:
|
||||
static void cache_clear()
|
||||
{
|
||||
// clear call cache entries
|
||||
std::lock_guard<std::mutex> guard(s_cache_mutex);
|
||||
for (std::size_t cachenum = 0; cachenum < s_cache.size(); s_cache[cachenum++].reset()) { }
|
||||
}
|
||||
|
||||
_7z_file::error initialize();
|
||||
archive_file::error initialize();
|
||||
|
||||
int first_file() { return search(0, 0, std::string(), false, false); }
|
||||
int next_file() { return (m_curr_file_idx < 0) ? -1 : search(m_curr_file_idx + 1, 0, std::string(), false, false); }
|
||||
@ -126,11 +131,12 @@ public:
|
||||
int search(const std::string &filename) { return search(0, 0, filename, false, true); }
|
||||
int search(std::uint32_t crc, const std::string &filename) { return search(0, crc, filename, true, true); }
|
||||
|
||||
bool current_is_directory() const { return m_curr_is_dir; }
|
||||
const std::string ¤t_name() const { return m_curr_name; }
|
||||
std::uint64_t current_uncompressed_length() const { return m_curr_length; }
|
||||
std::uint32_t current_crc() const { return m_curr_crc; }
|
||||
|
||||
_7z_file::error decompress(void *buffer, std::uint32_t length);
|
||||
archive_file::error decompress(void *buffer, std::uint32_t length);
|
||||
|
||||
private:
|
||||
m7z_file_impl(const m7z_file_impl &) = delete;
|
||||
@ -143,10 +149,12 @@ private:
|
||||
|
||||
static constexpr std::size_t CACHE_SIZE = 8;
|
||||
static std::array<ptr, CACHE_SIZE> s_cache;
|
||||
static std::mutex s_cache_mutex;
|
||||
|
||||
const std::string m_filename; // copy of _7Z filename (for caching)
|
||||
|
||||
int m_curr_file_idx; // current file index
|
||||
bool m_curr_is_dir; // current file is directory
|
||||
std::string m_curr_name; // current file name
|
||||
std::uint64_t m_curr_length; // current file uncompressed length
|
||||
std::uint32_t m_curr_crc; // current file crc
|
||||
@ -170,7 +178,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class m7z_file_wrapper : public _7z_file
|
||||
class m7z_file_wrapper : public archive_file
|
||||
{
|
||||
public:
|
||||
m7z_file_wrapper(m7z_file_impl::ptr &&impl) : m_impl(std::move(impl)) { assert(m_impl); }
|
||||
@ -183,6 +191,7 @@ public:
|
||||
virtual int search(const std::string &filename) override { return m_impl->search(filename); }
|
||||
virtual int search(std::uint32_t crc, const std::string &filename) override { return m_impl->search(crc, filename); }
|
||||
|
||||
virtual bool current_is_directory() const override { return m_impl->current_is_directory(); }
|
||||
virtual const std::string ¤t_name() const override { return m_impl->current_name(); }
|
||||
virtual std::uint64_t current_uncompressed_length() const override { return m_impl->current_uncompressed_length(); }
|
||||
virtual std::uint32_t current_crc() const override { return m_impl->current_crc(); }
|
||||
@ -200,6 +209,7 @@ private:
|
||||
***************************************************************************/
|
||||
|
||||
std::array<m7z_file_impl::ptr, m7z_file_impl::CACHE_SIZE> m7z_file_impl::s_cache;
|
||||
std::mutex m7z_file_impl::s_cache_mutex;
|
||||
|
||||
|
||||
|
||||
@ -250,6 +260,7 @@ CFileInStream::CFileInStream()
|
||||
m7z_file_impl::m7z_file_impl(const std::string &filename)
|
||||
: m_filename(filename)
|
||||
, m_curr_file_idx(-1)
|
||||
, m_curr_is_dir(false)
|
||||
, m_curr_name()
|
||||
, m_curr_length(0)
|
||||
, m_curr_crc(0)
|
||||
@ -269,11 +280,11 @@ m7z_file_impl::m7z_file_impl(const std::string &filename)
|
||||
}
|
||||
|
||||
|
||||
_7z_file::error m7z_file_impl::initialize()
|
||||
archive_file::error m7z_file_impl::initialize()
|
||||
{
|
||||
osd_file::error const err = osd_file::open(m_filename, OPEN_FLAG_READ, m_archive_stream.osdfile, m_archive_stream.length);
|
||||
if (err != osd_file::error::NONE)
|
||||
return _7z_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
|
||||
LookToRead_CreateVTable(&m_look_stream, False);
|
||||
m_look_stream.realStream = &m_archive_stream;
|
||||
@ -286,9 +297,9 @@ _7z_file::error m7z_file_impl::initialize()
|
||||
|
||||
SRes const res = SzArEx_Open(&m_db, &m_look_stream.s, &m_alloc_imp, &m_alloc_temp_imp);
|
||||
if (res != SZ_OK)
|
||||
return _7z_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
|
||||
return _7z_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -305,6 +316,7 @@ void m7z_file_impl::close(ptr &&archive)
|
||||
archive->m_archive_stream.osdfile.reset();
|
||||
|
||||
// find the first NULL entry in the cache
|
||||
std::lock_guard<std::mutex> guard(s_cache_mutex);
|
||||
std::size_t cachenum;
|
||||
for (cachenum = 0; cachenum < s_cache.size(); cachenum++)
|
||||
if (!s_cache[cachenum])
|
||||
@ -331,7 +343,7 @@ void m7z_file_impl::close(ptr &&archive)
|
||||
from a _7Z into the target buffer
|
||||
-------------------------------------------------*/
|
||||
|
||||
_7z_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length)
|
||||
archive_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length)
|
||||
{
|
||||
// make sure the file is open..
|
||||
if (!m_archive_stream.osdfile)
|
||||
@ -339,7 +351,7 @@ _7z_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length)
|
||||
m_archive_stream.currfpos = 0;
|
||||
osd_file::error const err = osd_file::open(m_filename, OPEN_FLAG_READ, m_archive_stream.osdfile, m_archive_stream.length);
|
||||
if (err != osd_file::error::NONE)
|
||||
return _7z_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
}
|
||||
|
||||
size_t offset = 0;
|
||||
@ -353,11 +365,11 @@ _7z_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length)
|
||||
&m_alloc_imp, &m_alloc_temp_imp);
|
||||
|
||||
if (res != SZ_OK)
|
||||
return _7z_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
|
||||
std::memcpy(buffer, m_out_buffer + offset, length);
|
||||
|
||||
return _7z_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -367,25 +379,22 @@ int m7z_file_impl::search(int i, std::uint32_t search_crc, const std::string &se
|
||||
{
|
||||
const CSzFileItem &f(m_db.db.Files[i]);
|
||||
|
||||
// if it's a directory entry we don't care about it..
|
||||
if (!f.IsDir)
|
||||
make_utf8_name(i);
|
||||
const std::uint64_t size(f.Size);
|
||||
const std::uint32_t crc(f.Crc);
|
||||
const bool crcmatch(crc == search_crc);
|
||||
const bool namematch(!core_stricmp(search_filename.c_str(), &m_utf8_buf[0]));
|
||||
|
||||
const bool found = ((!matchcrc && !matchname) || !f.IsDir) && (!matchcrc || crcmatch) && (!matchname || namematch);
|
||||
if (found)
|
||||
{
|
||||
make_utf8_name(i);
|
||||
const std::uint64_t size(f.Size);
|
||||
const std::uint32_t crc(f.Crc);
|
||||
const bool crcmatch(crc == search_crc);
|
||||
const bool namematch(core_stricmp(search_filename.c_str(), &m_utf8_buf[0]) == 0);
|
||||
m_curr_file_idx = i;
|
||||
m_curr_is_dir = bool(f.IsDir);
|
||||
m_curr_name = &m_utf8_buf[0];
|
||||
m_curr_length = size;
|
||||
m_curr_crc = crc;
|
||||
|
||||
const bool found = (!matchcrc || crcmatch) && (!matchname || namematch);
|
||||
if (found)
|
||||
{
|
||||
m_curr_file_idx = i;
|
||||
m_curr_name = &m_utf8_buf[0];
|
||||
m_curr_length = size;
|
||||
m_curr_crc = crc;
|
||||
|
||||
return i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,17 +441,13 @@ void m7z_file_impl::make_utf8_name(int index)
|
||||
assert(out_pos < m_utf8_buf.size());
|
||||
}
|
||||
m_utf8_buf[out_pos++] = '\0';
|
||||
m_utf8_buf.resize(out_pos);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
_7z_file::~_7z_file()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
_7z_file::error _7z_file::open(const std::string &filename, ptr &result)
|
||||
archive_file::error archive_file::open_7z(const std::string &filename, ptr &result)
|
||||
{
|
||||
// ensure we start with a NULL result
|
||||
result.reset();
|
||||
@ -477,7 +482,10 @@ _7z_file::error _7z_file::open(const std::string &filename, ptr &result)
|
||||
cache and free all memory
|
||||
-------------------------------------------------*/
|
||||
|
||||
void _7z_file::cache_clear()
|
||||
void m7z_file_cache_clear()
|
||||
{
|
||||
// This is a trampoline called from unzip.cpp to avoid the need to have the zip and 7zip code in one file
|
||||
m7z_file_impl::cache_clear();
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
|
@ -1,83 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Aaron Giles, Vas Crabb
|
||||
/***************************************************************************
|
||||
|
||||
un7z.h
|
||||
|
||||
7z file management.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
// this is based on unzip.h, with modifications needed to use the 7zip library
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef MAME_LIB_UTIL_UN7Z_H
|
||||
#define MAME_LIB_UTIL_UN7Z_H
|
||||
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
// describes an open _7Z file
|
||||
class _7z_file
|
||||
{
|
||||
public:
|
||||
|
||||
// Error types
|
||||
enum class error
|
||||
{
|
||||
NONE = 0,
|
||||
OUT_OF_MEMORY,
|
||||
FILE_ERROR,
|
||||
BAD_SIGNATURE,
|
||||
DECOMPRESS_ERROR,
|
||||
FILE_TRUNCATED,
|
||||
FILE_CORRUPT,
|
||||
UNSUPPORTED,
|
||||
BUFFER_TOO_SMALL
|
||||
};
|
||||
|
||||
typedef std::unique_ptr<_7z_file> ptr;
|
||||
|
||||
|
||||
virtual ~_7z_file();
|
||||
|
||||
/* ----- 7Z file access ----- */
|
||||
|
||||
// open a 7Z file and parse its central directory
|
||||
static error open(const std::string &filename, ptr &result);
|
||||
|
||||
// clear out all open 7Z files from the cache
|
||||
static void cache_clear();
|
||||
|
||||
|
||||
/* ----- contained file access ----- */
|
||||
|
||||
// iterating over files
|
||||
virtual int first_file() = 0;
|
||||
virtual int next_file() = 0;
|
||||
|
||||
// find a file index by crc, filename or both
|
||||
virtual int search(std::uint32_t crc) = 0;
|
||||
virtual int search(const std::string &filename) = 0;
|
||||
virtual int search(std::uint32_t crc, const std::string &filename) = 0;
|
||||
|
||||
// information on most recently found file
|
||||
virtual const std::string ¤t_name() const = 0;
|
||||
virtual std::uint64_t current_uncompressed_length() const = 0;
|
||||
virtual std::uint32_t current_crc() const = 0;
|
||||
|
||||
// decompress the most recently found file in the _7Z
|
||||
virtual error decompress(void *buffer, std::uint32_t length) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // MAME_LIB_UTIL_UN7Z_H
|
@ -8,21 +8,25 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "unzip.h"
|
||||
|
||||
#include "corestr.h"
|
||||
#include "osdcore.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
|
||||
|
||||
namespace util {
|
||||
namespace {
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
@ -71,29 +75,8 @@ namespace {
|
||||
#define ZIPCRC 0x0e
|
||||
#define ZIPSIZE 0x12
|
||||
#define ZIPUNCMP 0x16
|
||||
|
||||
/**
|
||||
* @def ZIPFNLN
|
||||
*
|
||||
* @brief A macro that defines zipfnln.
|
||||
*/
|
||||
|
||||
#define ZIPFNLN 0x1a
|
||||
|
||||
/**
|
||||
* @def ZIPXTRALN
|
||||
*
|
||||
* @brief A macro that defines zipxtraln.
|
||||
*/
|
||||
|
||||
#define ZIPXTRALN 0x1c
|
||||
|
||||
/**
|
||||
* @def ZIPNAME
|
||||
*
|
||||
* @brief A macro that defines zipname.
|
||||
*/
|
||||
|
||||
#define ZIPNAME 0x1e
|
||||
|
||||
|
||||
@ -115,6 +98,8 @@ public:
|
||||
, m_cd()
|
||||
, m_cd_pos(0)
|
||||
, m_header()
|
||||
, m_curr_is_dir(false)
|
||||
, m_curr_name()
|
||||
, m_buffer()
|
||||
{
|
||||
std::memset(&m_header, 0, sizeof(m_header));
|
||||
@ -123,6 +108,7 @@ public:
|
||||
|
||||
static ptr find_cached(const std::string &filename)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_cache_mutex);
|
||||
for (std::size_t cachenum = 0; cachenum < s_cache.size(); cachenum++)
|
||||
{
|
||||
// if we have a valid entry and it matches our filename, use it and remove from the cache
|
||||
@ -139,37 +125,65 @@ public:
|
||||
static void cache_clear()
|
||||
{
|
||||
// clear call cache entries
|
||||
std::lock_guard<std::mutex> guard(s_cache_mutex);
|
||||
for (std::size_t cachenum = 0; cachenum < s_cache.size(); s_cache[cachenum++].reset()) { }
|
||||
}
|
||||
|
||||
zip_file::error initialize()
|
||||
archive_file::error initialize()
|
||||
{
|
||||
// read ecd data
|
||||
auto const ziperr = read_ecd();
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
if (ziperr != archive_file::error::NONE)
|
||||
return ziperr;
|
||||
|
||||
// verify that we can work with this zipfile (no disk spanning allowed)
|
||||
if ((m_ecd.disk_number != m_ecd.cd_start_disk_number) || (m_ecd.cd_disk_entries != m_ecd.cd_total_entries))
|
||||
return zip_file::error::UNSUPPORTED;
|
||||
return archive_file::error::UNSUPPORTED;
|
||||
|
||||
// allocate memory for the central directory
|
||||
try { m_cd.resize(m_ecd.cd_size + 1); }
|
||||
catch (...) { return zip_file::error::OUT_OF_MEMORY; }
|
||||
catch (...) { return archive_file::error::OUT_OF_MEMORY; }
|
||||
|
||||
// read the central directory
|
||||
std::uint32_t read_length;
|
||||
auto const filerr = m_file->read(&m_cd[0], m_ecd.cd_start_disk_offset, m_ecd.cd_size, read_length);
|
||||
if ((filerr != osd_file::error::NONE) || (read_length != m_ecd.cd_size))
|
||||
return (filerr == osd_file::error::NONE) ? zip_file::error::FILE_TRUNCATED : zip_file::error::FILE_ERROR;
|
||||
return (filerr == osd_file::error::NONE) ? archive_file::error::FILE_TRUNCATED : archive_file::error::FILE_ERROR;
|
||||
|
||||
return zip_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
// contained file access
|
||||
const zip_file::file_header *first_file();
|
||||
const zip_file::file_header *next_file();
|
||||
zip_file::error decompress(void *buffer, std::uint32_t length);
|
||||
int first_file()
|
||||
{
|
||||
m_cd_pos = 0;
|
||||
return search(0, std::string(), false, false);
|
||||
}
|
||||
int next_file()
|
||||
{
|
||||
return search(0, std::string(), false, false);
|
||||
}
|
||||
int search(std::uint32_t crc)
|
||||
{
|
||||
m_cd_pos = 0;
|
||||
return search(crc, std::string(), true, false);
|
||||
}
|
||||
int search(const std::string &filename)
|
||||
{
|
||||
m_cd_pos = 0;
|
||||
return search(0, filename, false, true);
|
||||
}
|
||||
int search(std::uint32_t crc, const std::string &filename)
|
||||
{
|
||||
m_cd_pos = 0;
|
||||
return search(crc, filename, true, true);
|
||||
}
|
||||
|
||||
bool current_is_directory() const { return m_curr_is_dir; }
|
||||
const std::string ¤t_name() const { return m_curr_name; }
|
||||
std::uint64_t current_uncompressed_length() const { return m_header.uncompressed_length; }
|
||||
std::uint32_t current_crc() const { return m_header.crc; }
|
||||
|
||||
archive_file::error decompress(void *buffer, std::uint32_t length);
|
||||
|
||||
private:
|
||||
zip_file_impl(const zip_file_impl &) = delete;
|
||||
@ -177,30 +191,47 @@ private:
|
||||
zip_file_impl &operator=(const zip_file_impl &) = delete;
|
||||
zip_file_impl &operator=(zip_file_impl &&) = delete;
|
||||
|
||||
zip_file::error reopen()
|
||||
int search(std::uint32_t search_crc, const std::string &search_filename, bool matchcrc, bool matchname);
|
||||
|
||||
archive_file::error reopen()
|
||||
{
|
||||
if (!m_file)
|
||||
{
|
||||
auto const filerr = osd_file::open(m_filename, OPEN_FLAG_READ, m_file, m_length);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
return zip_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
}
|
||||
return zip_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
// ZIP file parsing
|
||||
zip_file::error read_ecd();
|
||||
zip_file::error get_compressed_data_offset(std::uint64_t &offset);
|
||||
archive_file::error read_ecd();
|
||||
archive_file::error get_compressed_data_offset(std::uint64_t &offset);
|
||||
|
||||
// decompression interfaces
|
||||
zip_file::error decompress_data_type_0(std::uint64_t offset, void *buffer, std::uint32_t length);
|
||||
zip_file::error decompress_data_type_8(std::uint64_t offset, void *buffer, std::uint32_t length);
|
||||
archive_file::error decompress_data_type_0(std::uint64_t offset, void *buffer, std::uint32_t length);
|
||||
archive_file::error decompress_data_type_8(std::uint64_t offset, void *buffer, std::uint32_t length);
|
||||
|
||||
struct file_header_int : zip_file::file_header
|
||||
struct file_header
|
||||
{
|
||||
std::uint8_t * raw; // pointer to the raw data
|
||||
std::uint32_t rawlength; // length of the raw data
|
||||
std::uint8_t saved; // saved byte from after filename
|
||||
std::uint32_t signature; // central file header signature
|
||||
std::uint16_t version_created; // version made by
|
||||
std::uint16_t version_needed; // version needed to extract
|
||||
std::uint16_t bit_flag; // general purpose bit flag
|
||||
std::uint16_t compression; // compression method
|
||||
std::uint16_t file_time; // last mod file time
|
||||
std::uint16_t file_date; // last mod file date
|
||||
std::uint32_t crc; // crc-32
|
||||
std::uint32_t compressed_length; // compressed size
|
||||
std::uint32_t uncompressed_length; // uncompressed size
|
||||
std::uint16_t filename_length; // filename length
|
||||
std::uint16_t extra_field_length; // extra field length
|
||||
std::uint16_t file_comment_length; // file comment length
|
||||
std::uint16_t start_disk_number; // disk number start
|
||||
std::uint16_t internal_attributes; // internal file attributes
|
||||
std::uint32_t external_attributes; // external file attributes
|
||||
std::uint32_t local_header_offset; // relative offset of local header
|
||||
const char * filename; // filename
|
||||
};
|
||||
|
||||
// contains extracted end of central directory information
|
||||
@ -220,9 +251,10 @@ private:
|
||||
std::uint32_t rawlength; // length of the raw data
|
||||
};
|
||||
|
||||
static constexpr std::size_t DECOMPRESS_BUFSIZE = 16384;
|
||||
static constexpr std::size_t CACHE_SIZE = 8; // number of open files to cache
|
||||
static std::array<ptr, CACHE_SIZE> s_cache;
|
||||
static constexpr std::size_t DECOMPRESS_BUFSIZE = 16384;
|
||||
static constexpr std::size_t CACHE_SIZE = 8; // number of open files to cache
|
||||
static std::array<ptr, CACHE_SIZE> s_cache;
|
||||
static std::mutex s_cache_mutex;
|
||||
|
||||
const std::string m_filename; // copy of ZIP filename (for caching)
|
||||
osd_file::ptr m_file; // OSD file handle
|
||||
@ -232,20 +264,32 @@ private:
|
||||
|
||||
std::vector<std::uint8_t> m_cd; // central directory raw data
|
||||
std::uint32_t m_cd_pos; // position in central directory
|
||||
file_header_int m_header; // current file header
|
||||
file_header m_header; // current file header
|
||||
bool m_curr_is_dir; // current file is directory
|
||||
std::string m_curr_name; // current file name
|
||||
|
||||
std::array<std::uint8_t, DECOMPRESS_BUFSIZE> m_buffer; // buffer for decompression
|
||||
};
|
||||
|
||||
|
||||
class zip_file_wrapper : public zip_file
|
||||
class zip_file_wrapper : public archive_file
|
||||
{
|
||||
public:
|
||||
zip_file_wrapper(zip_file_impl::ptr &&impl) : m_impl(std::move(impl)) { assert(m_impl); }
|
||||
virtual ~zip_file_wrapper() { zip_file_impl::close(std::move(m_impl)); }
|
||||
|
||||
virtual const file_header *first_file() override { return m_impl->first_file(); }
|
||||
virtual const file_header *next_file() override { return m_impl->next_file(); }
|
||||
virtual int first_file() override { return m_impl->first_file(); }
|
||||
virtual int next_file() override { return m_impl->next_file(); }
|
||||
|
||||
virtual int search(std::uint32_t crc) override { return m_impl->search(crc); }
|
||||
virtual int search(const std::string &filename) override { return m_impl->search(filename); }
|
||||
virtual int search(std::uint32_t crc, const std::string &filename) override { return m_impl->search(crc, filename); }
|
||||
|
||||
virtual bool current_is_directory() const override { return m_impl->current_is_directory(); }
|
||||
virtual const std::string ¤t_name() const override { return m_impl->current_name(); }
|
||||
virtual std::uint64_t current_uncompressed_length() const override { return m_impl->current_uncompressed_length(); }
|
||||
virtual std::uint32_t current_crc() const override { return m_impl->current_crc(); }
|
||||
|
||||
virtual error decompress(void *buffer, std::uint32_t length) override { return m_impl->decompress(buffer, length); }
|
||||
|
||||
private:
|
||||
@ -268,7 +312,7 @@ private:
|
||||
* @return The word.
|
||||
*/
|
||||
|
||||
inline UINT16 read_word(UINT8 *buf)
|
||||
inline std::uint16_t read_word(std::uint8_t const *buf)
|
||||
{
|
||||
return (buf[1] << 8) | buf[0];
|
||||
}
|
||||
@ -283,7 +327,7 @@ inline UINT16 read_word(UINT8 *buf)
|
||||
* @return The double word.
|
||||
*/
|
||||
|
||||
inline UINT32 read_dword(UINT8 *buf)
|
||||
inline std::uint32_t read_dword(std::uint8_t const *buf)
|
||||
{
|
||||
return (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
|
||||
}
|
||||
@ -296,6 +340,7 @@ inline UINT32 read_dword(UINT8 *buf)
|
||||
|
||||
/** @brief The zip cache[ zip cache size]. */
|
||||
std::array<zip_file_impl::ptr, zip_file_impl::CACHE_SIZE> zip_file_impl::s_cache;
|
||||
std::mutex zip_file_impl::s_cache_mutex;
|
||||
|
||||
|
||||
|
||||
@ -320,6 +365,7 @@ void zip_file_impl::close(ptr &&zip)
|
||||
zip->m_file.reset();
|
||||
|
||||
// find the first NULL entry in the cache
|
||||
std::lock_guard<std::mutex> guard(s_cache_mutex);
|
||||
std::size_t cachenum;
|
||||
for (cachenum = 0; cachenum < s_cache.size(); cachenum++)
|
||||
if (!s_cache[cachenum])
|
||||
@ -345,88 +391,63 @@ void zip_file_impl::close(ptr &&zip)
|
||||
in the ZIP
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn const zip_file_header *zip_file_first_file(zip_file *zip)
|
||||
*
|
||||
* @brief Zip file first file.
|
||||
*
|
||||
* @param [in,out] zip If non-null, the zip.
|
||||
*
|
||||
* @return null if it fails, else a zip_file_header*.
|
||||
*/
|
||||
|
||||
const zip_file::file_header *zip_file_impl::first_file()
|
||||
{
|
||||
/* reset the position and go from there */
|
||||
m_cd_pos = 0;
|
||||
return next_file();
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
zip_file_next_entry - return the next entry
|
||||
in the ZIP
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn const zip_file_header *zip_file_next_file(zip_file *zip)
|
||||
*
|
||||
* @brief Zip file next file.
|
||||
*
|
||||
* @param [in,out] zip If non-null, the zip.
|
||||
*
|
||||
* @return null if it fails, else a zip_file_header*.
|
||||
*/
|
||||
|
||||
const zip_file::file_header *zip_file_impl::next_file()
|
||||
int zip_file_impl::search(std::uint32_t search_crc, const std::string &search_filename, bool matchcrc, bool matchname)
|
||||
{
|
||||
// fix up any modified data
|
||||
if (m_header.raw)
|
||||
{
|
||||
m_header.raw[ZIPCFN + m_header.filename_length] = m_header.saved;
|
||||
m_header.raw = nullptr;
|
||||
}
|
||||
|
||||
// if we're at or past the end, we're done
|
||||
if (m_cd_pos >= m_ecd.cd_size)
|
||||
return nullptr;
|
||||
std::string filename;
|
||||
while (m_cd_pos <= m_ecd.cd_size)
|
||||
{
|
||||
// extract file header info
|
||||
std::uint8_t const *const raw = &m_cd[0] + m_cd_pos;
|
||||
m_header.signature = read_dword(raw + ZIPCENSIG);
|
||||
m_header.version_created = read_word (raw + ZIPCVER);
|
||||
m_header.version_needed = read_word (raw + ZIPCVXT);
|
||||
m_header.bit_flag = read_word (raw + ZIPCFLG);
|
||||
m_header.compression = read_word (raw + ZIPCMTHD);
|
||||
m_header.file_time = read_word (raw + ZIPCTIM);
|
||||
m_header.file_date = read_word (raw + ZIPCDAT);
|
||||
m_header.crc = read_dword(raw + ZIPCCRC);
|
||||
m_header.compressed_length = read_dword(raw + ZIPCSIZ);
|
||||
m_header.uncompressed_length = read_dword(raw + ZIPCUNC);
|
||||
m_header.filename_length = read_word (raw + ZIPCFNL);
|
||||
m_header.extra_field_length = read_word (raw + ZIPCXTL);
|
||||
m_header.file_comment_length = read_word (raw + ZIPCCML);
|
||||
m_header.start_disk_number = read_word (raw + ZIPDSK);
|
||||
m_header.internal_attributes = read_word (raw + ZIPINT);
|
||||
m_header.external_attributes = read_dword(raw + ZIPEXT);
|
||||
m_header.local_header_offset = read_dword(raw + ZIPOFST);
|
||||
m_header.filename = reinterpret_cast<const char *>(raw + ZIPCFN);
|
||||
|
||||
// extract file header info
|
||||
m_header.raw = &m_cd[0] + m_cd_pos;
|
||||
m_header.rawlength = ZIPCFN;
|
||||
m_header.signature = read_dword(m_header.raw + ZIPCENSIG);
|
||||
m_header.version_created = read_word (m_header.raw + ZIPCVER);
|
||||
m_header.version_needed = read_word (m_header.raw + ZIPCVXT);
|
||||
m_header.bit_flag = read_word (m_header.raw + ZIPCFLG);
|
||||
m_header.compression = read_word (m_header.raw + ZIPCMTHD);
|
||||
m_header.file_time = read_word (m_header.raw + ZIPCTIM);
|
||||
m_header.file_date = read_word (m_header.raw + ZIPCDAT);
|
||||
m_header.crc = read_dword(m_header.raw + ZIPCCRC);
|
||||
m_header.compressed_length = read_dword(m_header.raw + ZIPCSIZ);
|
||||
m_header.uncompressed_length = read_dword(m_header.raw + ZIPCUNC);
|
||||
m_header.filename_length = read_word (m_header.raw + ZIPCFNL);
|
||||
m_header.extra_field_length = read_word (m_header.raw + ZIPCXTL);
|
||||
m_header.file_comment_length = read_word (m_header.raw + ZIPCCML);
|
||||
m_header.start_disk_number = read_word (m_header.raw + ZIPDSK);
|
||||
m_header.internal_attributes = read_word (m_header.raw + ZIPINT);
|
||||
m_header.external_attributes = read_dword(m_header.raw + ZIPEXT);
|
||||
m_header.local_header_offset = read_dword(m_header.raw + ZIPOFST);
|
||||
m_header.filename = reinterpret_cast<const char *>(m_header.raw + ZIPCFN);
|
||||
// make sure we have enough data
|
||||
std::uint32_t const rawlength = ZIPCFN + m_header.filename_length + m_header.extra_field_length + m_header.file_comment_length;
|
||||
if ((m_cd_pos + rawlength) > m_ecd.cd_size)
|
||||
break;
|
||||
|
||||
// make sure we have enough data
|
||||
m_header.rawlength += m_header.filename_length;
|
||||
m_header.rawlength += m_header.extra_field_length;
|
||||
m_header.rawlength += m_header.file_comment_length;
|
||||
if (m_cd_pos + m_header.rawlength > m_ecd.cd_size)
|
||||
return nullptr;
|
||||
// advance the position
|
||||
m_cd_pos += rawlength;
|
||||
|
||||
// NULL terminate the filename
|
||||
m_header.saved = m_header.raw[ZIPCFN + m_header.filename_length];
|
||||
m_header.raw[ZIPCFN + m_header.filename_length] = 0;
|
||||
// copy the filename filename
|
||||
bool const is_dir((m_header.filename_length > 0) && (m_header.filename[m_header.filename_length - 1] == '/'));
|
||||
filename.assign(m_header.filename, m_header.filename_length - (is_dir ? 1 : 0));
|
||||
|
||||
// advance the position
|
||||
m_cd_pos += m_header.rawlength;
|
||||
return &m_header;
|
||||
// check to see if it matches query
|
||||
bool const crcmatch(search_crc == m_header.crc);
|
||||
const bool namematch(!core_stricmp(search_filename.c_str(), filename.c_str()));
|
||||
|
||||
bool const found = ((!matchcrc && !matchname) || !is_dir) && (!matchcrc || crcmatch) && (!matchname || namematch);
|
||||
if (found)
|
||||
{
|
||||
m_curr_is_dir = is_dir;
|
||||
m_curr_name = std::move(filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -447,22 +468,22 @@ const zip_file::file_header *zip_file_impl::next_file()
|
||||
* @return A zip_error.
|
||||
*/
|
||||
|
||||
zip_file::error zip_file_impl::decompress(void *buffer, UINT32 length)
|
||||
archive_file::error zip_file_impl::decompress(void *buffer, std::uint32_t length)
|
||||
{
|
||||
zip_file::error ziperr;
|
||||
archive_file::error ziperr;
|
||||
std::uint64_t offset;
|
||||
|
||||
// if we don't have enough buffer, error
|
||||
if (length < m_header.uncompressed_length)
|
||||
return zip_file::error::BUFFER_TOO_SMALL;
|
||||
return archive_file::error::BUFFER_TOO_SMALL;
|
||||
|
||||
// make sure the info in the header aligns with what we know
|
||||
if (m_header.start_disk_number != m_ecd.disk_number)
|
||||
return zip_file::error::UNSUPPORTED;
|
||||
return archive_file::error::UNSUPPORTED;
|
||||
|
||||
// get the compressed data offset
|
||||
ziperr = get_compressed_data_offset(offset);
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
if (ziperr != archive_file::error::NONE)
|
||||
return ziperr;
|
||||
|
||||
// handle compression types
|
||||
@ -477,7 +498,7 @@ zip_file::error zip_file_impl::decompress(void *buffer, UINT32 length)
|
||||
break;
|
||||
|
||||
default:
|
||||
ziperr = zip_file::error::UNSUPPORTED;
|
||||
ziperr = archive_file::error::UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
return ziperr;
|
||||
@ -503,11 +524,11 @@ zip_file::error zip_file_impl::decompress(void *buffer, UINT32 length)
|
||||
* @return The ecd.
|
||||
*/
|
||||
|
||||
zip_file::error zip_file_impl::read_ecd()
|
||||
archive_file::error zip_file_impl::read_ecd()
|
||||
{
|
||||
// make sure the file handle is open
|
||||
auto const ziperr = reopen();
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
if (ziperr != archive_file::error::NONE)
|
||||
return ziperr;
|
||||
|
||||
// we may need multiple tries
|
||||
@ -521,13 +542,13 @@ zip_file::error zip_file_impl::read_ecd()
|
||||
// allocate buffer
|
||||
std::unique_ptr<std::uint8_t []> buffer;
|
||||
try { buffer.reset(new std::uint8_t[buflen + 1]); }
|
||||
catch (...) { return zip_file::error::OUT_OF_MEMORY; }
|
||||
catch (...) { return archive_file::error::OUT_OF_MEMORY; }
|
||||
|
||||
// read in one buffers' worth of data
|
||||
std::uint32_t read_length;
|
||||
auto const error = m_file->read(&buffer[0], m_length - buflen, buflen, read_length);
|
||||
if (error != osd_file::error::NONE || read_length != buflen)
|
||||
return zip_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
|
||||
// find the ECD signature
|
||||
std::int32_t offset;
|
||||
@ -556,16 +577,16 @@ zip_file::error zip_file_impl::read_ecd()
|
||||
m_ecd.cd_start_disk_offset = read_dword(&m_ecd.raw[ZIPEOFST]);
|
||||
m_ecd.comment_length = read_word (&m_ecd.raw[ZIPECOML]);
|
||||
m_ecd.comment = reinterpret_cast<const char *>(&m_ecd.raw[ZIPECOM]);
|
||||
return zip_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
// didn't find it; free this buffer and expand our search
|
||||
if (buflen < m_length)
|
||||
buflen *= 2;
|
||||
else
|
||||
return zip_file::error::BAD_SIGNATURE;
|
||||
return archive_file::error::BAD_SIGNATURE;
|
||||
}
|
||||
return zip_file::error::OUT_OF_MEMORY;
|
||||
return archive_file::error::OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
@ -585,25 +606,25 @@ zip_file::error zip_file_impl::read_ecd()
|
||||
* @return The compressed data offset.
|
||||
*/
|
||||
|
||||
zip_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &offset)
|
||||
archive_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &offset)
|
||||
{
|
||||
// make sure the file handle is open
|
||||
auto const ziperr = reopen();
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
if (ziperr != archive_file::error::NONE)
|
||||
return ziperr;
|
||||
|
||||
// now go read the fixed-sized part of the local file header
|
||||
std::uint32_t read_length;
|
||||
auto const error = m_file->read(&m_buffer[0], m_header.local_header_offset, ZIPNAME, read_length);
|
||||
if (error != osd_file::error::NONE || read_length != ZIPNAME)
|
||||
return (error == osd_file::error::NONE) ? zip_file::error::FILE_TRUNCATED : zip_file::error::FILE_ERROR;
|
||||
return (error == osd_file::error::NONE) ? archive_file::error::FILE_TRUNCATED : archive_file::error::FILE_ERROR;
|
||||
|
||||
/* compute the final offset */
|
||||
offset = m_header.local_header_offset + ZIPNAME;
|
||||
offset += read_word(&m_buffer[ZIPFNLN]);
|
||||
offset += read_word(&m_buffer[ZIPXTRALN]);
|
||||
|
||||
return zip_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -630,18 +651,18 @@ zip_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &offset)
|
||||
* @return A zip_error.
|
||||
*/
|
||||
|
||||
zip_file::error zip_file_impl::decompress_data_type_0(std::uint64_t offset, void *buffer, std::uint32_t length)
|
||||
archive_file::error zip_file_impl::decompress_data_type_0(std::uint64_t offset, void *buffer, std::uint32_t length)
|
||||
{
|
||||
std::uint32_t read_length;
|
||||
|
||||
// the data is uncompressed; just read it
|
||||
auto const filerr = m_file->read(buffer, offset, m_header.compressed_length, read_length);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
return zip_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
else if (read_length != m_header.compressed_length)
|
||||
return zip_file::error::FILE_TRUNCATED;
|
||||
return archive_file::error::FILE_TRUNCATED;
|
||||
else
|
||||
return zip_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -663,14 +684,14 @@ zip_file::error zip_file_impl::decompress_data_type_0(std::uint64_t offset, void
|
||||
* @return A zip_error.
|
||||
*/
|
||||
|
||||
zip_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void *buffer, std::uint32_t length)
|
||||
archive_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void *buffer, std::uint32_t length)
|
||||
{
|
||||
std::uint32_t input_remaining = m_header.compressed_length;
|
||||
int zerr;
|
||||
|
||||
// make sure we don't need a newer mechanism
|
||||
if (m_header.version_needed > 0x14)
|
||||
return zip_file::error::UNSUPPORTED;
|
||||
return archive_file::error::UNSUPPORTED;
|
||||
|
||||
/* reset the stream */
|
||||
z_stream stream;
|
||||
@ -681,7 +702,7 @@ zip_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void
|
||||
// initialize the decompressor
|
||||
zerr = inflateInit2(&stream, -MAX_WBITS);
|
||||
if (zerr != Z_OK)
|
||||
return zip_file::error::DECOMPRESS_ERROR;
|
||||
return archive_file::error::DECOMPRESS_ERROR;
|
||||
|
||||
// loop until we're done
|
||||
while (1)
|
||||
@ -692,7 +713,7 @@ zip_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
inflateEnd(&stream);
|
||||
return zip_file::error::FILE_ERROR;
|
||||
return archive_file::error::FILE_ERROR;
|
||||
}
|
||||
offset += read_length;
|
||||
|
||||
@ -700,7 +721,7 @@ zip_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void
|
||||
if (read_length == 0 && input_remaining > 0)
|
||||
{
|
||||
inflateEnd(&stream);
|
||||
return zip_file::error::FILE_TRUNCATED;
|
||||
return archive_file::error::FILE_TRUNCATED;
|
||||
}
|
||||
|
||||
// fill out the input data
|
||||
@ -719,26 +740,34 @@ zip_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void
|
||||
if (zerr != Z_OK)
|
||||
{
|
||||
inflateEnd(&stream);
|
||||
return zip_file::error::DECOMPRESS_ERROR;
|
||||
return archive_file::error::DECOMPRESS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// finish decompression
|
||||
zerr = inflateEnd(&stream);
|
||||
if (zerr != Z_OK)
|
||||
return zip_file::error::DECOMPRESS_ERROR;
|
||||
return archive_file::error::DECOMPRESS_ERROR;
|
||||
|
||||
/* if anything looks funny, report an error */
|
||||
if (stream.avail_out > 0 || input_remaining > 0)
|
||||
return zip_file::error::DECOMPRESS_ERROR;
|
||||
return archive_file::error::DECOMPRESS_ERROR;
|
||||
|
||||
return zip_file::error::NONE;
|
||||
return archive_file::error::NONE;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
un7z.cpp TRAMPOLINES
|
||||
***************************************************************************/
|
||||
|
||||
void m7z_file_cache_clear();
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
ZIP FILE ACCESS
|
||||
***************************************************************************/
|
||||
@ -758,10 +787,10 @@ zip_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void
|
||||
* @return A zip_error.
|
||||
*/
|
||||
|
||||
zip_file::error zip_file::open(const std::string &filename, ptr &zip)
|
||||
archive_file::error archive_file::open_zip(const std::string &filename, ptr &result)
|
||||
{
|
||||
// ensure we start with a NULL result
|
||||
zip.reset();
|
||||
result.reset();
|
||||
|
||||
// see if we are in the cache, and reopen if so
|
||||
zip_file_impl::ptr newimpl(zip_file_impl::find_cached(filename));
|
||||
@ -777,7 +806,7 @@ zip_file::error zip_file::open(const std::string &filename, ptr &zip)
|
||||
|
||||
try
|
||||
{
|
||||
zip = std::make_unique<zip_file_wrapper>(std::move(newimpl));
|
||||
result = std::make_unique<zip_file_wrapper>(std::move(newimpl));
|
||||
return error::NONE;
|
||||
}
|
||||
catch (...)
|
||||
@ -793,18 +822,15 @@ zip_file::error zip_file::open(const std::string &filename, ptr &zip)
|
||||
cache and free all memory
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn void zip_file_cache_clear(void)
|
||||
*
|
||||
* @brief Zip file cache clear.
|
||||
*/
|
||||
|
||||
void zip_file::cache_clear()
|
||||
void archive_file::cache_clear()
|
||||
{
|
||||
zip_file_impl::cache_clear();
|
||||
m7z_file_cache_clear();
|
||||
}
|
||||
|
||||
|
||||
zip_file::~zip_file()
|
||||
archive_file::~archive_file()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
unzip.h
|
||||
|
||||
ZIP file management.
|
||||
archive file management.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -20,12 +20,14 @@
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace util {
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
// describes an open ZIP file
|
||||
class zip_file
|
||||
// describes an open archive file
|
||||
class archive_file
|
||||
{
|
||||
public:
|
||||
|
||||
@ -43,55 +45,45 @@ public:
|
||||
BUFFER_TOO_SMALL
|
||||
};
|
||||
|
||||
// contains extracted file header information
|
||||
struct file_header
|
||||
{
|
||||
std::uint32_t signature; // central file header signature
|
||||
std::uint16_t version_created; // version made by
|
||||
std::uint16_t version_needed; // version needed to extract
|
||||
std::uint16_t bit_flag; // general purpose bit flag
|
||||
std::uint16_t compression; // compression method
|
||||
std::uint16_t file_time; // last mod file time
|
||||
std::uint16_t file_date; // last mod file date
|
||||
std::uint32_t crc; // crc-32
|
||||
std::uint32_t compressed_length; // compressed size
|
||||
std::uint32_t uncompressed_length; // uncompressed size
|
||||
std::uint16_t filename_length; // filename length
|
||||
std::uint16_t extra_field_length; // extra field length
|
||||
std::uint16_t file_comment_length; // file comment length
|
||||
std::uint16_t start_disk_number; // disk number start
|
||||
std::uint16_t internal_attributes; // internal file attributes
|
||||
std::uint32_t external_attributes; // external file attributes
|
||||
std::uint32_t local_header_offset; // relative offset of local header
|
||||
const char * filename; // filename
|
||||
};
|
||||
|
||||
typedef std::unique_ptr<zip_file> ptr;
|
||||
typedef std::unique_ptr<archive_file> ptr;
|
||||
|
||||
|
||||
/* ----- ZIP file access ----- */
|
||||
/* ----- archive file access ----- */
|
||||
|
||||
// open a ZIP file and parse its central directory
|
||||
static error open(const std::string &filename, ptr &zip);
|
||||
static error open_zip(const std::string &filename, ptr &zip);
|
||||
|
||||
// close a ZIP file (may actually be left open due to caching)
|
||||
virtual ~zip_file();
|
||||
// open a 7Z file and parse its central directory
|
||||
static error open_7z(const std::string &filename, ptr &result);
|
||||
|
||||
// clear out all open ZIP files from the cache
|
||||
// close an archive file (may actually be left open due to caching)
|
||||
virtual ~archive_file();
|
||||
|
||||
// clear out all open files from the cache
|
||||
static void cache_clear();
|
||||
|
||||
|
||||
/* ----- contained file access ----- */
|
||||
|
||||
// find the first file in the ZIP
|
||||
virtual const file_header *first_file() = 0;
|
||||
// iterating over files - returns negative on reaching end
|
||||
virtual int first_file() = 0;
|
||||
virtual int next_file() = 0;
|
||||
|
||||
// find the next file in the ZIP
|
||||
virtual const file_header *next_file() = 0;
|
||||
// find a file index by crc, filename or both - returns non-negative on match
|
||||
virtual int search(std::uint32_t crc) = 0;
|
||||
virtual int search(const std::string &filename) = 0;
|
||||
virtual int search(std::uint32_t crc, const std::string &filename) = 0;
|
||||
|
||||
// information on most recently found file
|
||||
virtual bool current_is_directory() const = 0;
|
||||
virtual const std::string ¤t_name() const = 0;
|
||||
virtual std::uint64_t current_uncompressed_length() const = 0;
|
||||
virtual std::uint32_t current_crc() const = 0;
|
||||
|
||||
// decompress the most recently found file in the ZIP
|
||||
virtual error decompress(void *buffer, std::uint32_t length) = 0;
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
|
||||
#endif // MAME_LIB_UTIL_UNZIP_H
|
||||
|
@ -320,11 +320,10 @@ public:
|
||||
basic_ivectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
|
||||
basic_ivectorstream(vector_type &&content, std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(std::move(content), mode) { }
|
||||
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return reinterpret_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_istream<CharT, Traits>::rdbuf()); }
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_istream<CharT, Traits>::rdbuf()); }
|
||||
vector_type const &vec() const { return rdbuf()->vec(); }
|
||||
void vec(const vector_type &content) { rdbuf()->vec(content); }
|
||||
void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
|
||||
basic_ivectorstream &clear() { rdbuf()->clear(); return *this; }
|
||||
|
||||
void swap(basic_ivectorstream &that) { std::basic_istream<CharT, Traits>::swap(that); rdbuf()->swap(*that.rdbuf()); }
|
||||
|
||||
@ -342,12 +341,11 @@ public:
|
||||
basic_ovectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::out) : std::basic_ostream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
|
||||
basic_ovectorstream(vector_type &&content, std::ios_base::openmode mode = std::ios_base::out) : std::basic_ostream<CharT, Traits>(&m_rdbuf), m_rdbuf(std::move(content), mode) { }
|
||||
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return reinterpret_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_ostream<CharT, Traits>::rdbuf()); }
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_ostream<CharT, Traits>::rdbuf()); }
|
||||
|
||||
vector_type const &vec() const { return rdbuf()->vec(); }
|
||||
void vec(const vector_type &content) { rdbuf()->vec(content); }
|
||||
void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
|
||||
basic_ovectorstream &clear() { rdbuf()->clear(); return *this; }
|
||||
basic_ovectorstream &reserve(typename vector_type::size_type size) { rdbuf()->reserve(size); return *this; }
|
||||
|
||||
void swap(basic_ovectorstream &that) { std::basic_ostream<CharT, Traits>::swap(that); rdbuf()->swap(*that.rdbuf()); }
|
||||
@ -366,12 +364,11 @@ public:
|
||||
basic_vectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_iostream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
|
||||
basic_vectorstream(vector_type &&content, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_iostream<CharT, Traits>(&m_rdbuf), m_rdbuf(std::move(content), mode) { }
|
||||
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return reinterpret_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_iostream<CharT, Traits>::rdbuf()); }
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_iostream<CharT, Traits>::rdbuf()); }
|
||||
|
||||
vector_type const &vec() const { return rdbuf()->vec(); }
|
||||
void vec(const vector_type &content) { rdbuf()->vec(content); }
|
||||
void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
|
||||
basic_vectorstream &clear() { rdbuf()->clear(); return *this; }
|
||||
basic_vectorstream &reserve(typename vector_type::size_type size) { rdbuf()->reserve(size); return *this; }
|
||||
|
||||
void swap(basic_vectorstream &that) { std::basic_iostream<CharT, Traits>::swap(that); rdbuf()->swap(*that.rdbuf()); }
|
||||
|
@ -8,15 +8,19 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
#include <assert.h>
|
||||
#include "zippath.h"
|
||||
#include "unzip.h"
|
||||
#include "corestr.h"
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <new>
|
||||
|
||||
|
||||
namespace util {
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
@ -66,7 +70,7 @@ public:
|
||||
/** @brief true to called zip first. */
|
||||
bool called_zip_first;
|
||||
/** @brief The zipfile. */
|
||||
zip_file::ptr zipfile;
|
||||
archive_file::ptr zipfile;
|
||||
/** @brief The zipprefix. */
|
||||
std::string zipprefix;
|
||||
/** @brief The returned dirlist. */
|
||||
@ -78,10 +82,10 @@ public:
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static const zip_file::file_header *zippath_find_sub_path(zip_file &zipfile, const char *subpath, osd_dir_entry_type *type);
|
||||
static int is_zip_file(const char *path);
|
||||
static int is_zip_file_separator(char c);
|
||||
static int is_7z_file(const char *path);
|
||||
static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpath, osd_dir_entry_type &type);
|
||||
static bool is_zip_file(std::string const &path);
|
||||
static bool is_zip_file_separator(char c);
|
||||
static bool is_7z_file(std::string const &path);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -148,29 +152,15 @@ static void parse_parent_path(const char *path, int *beginpos, int *endpos)
|
||||
zippath_parent - retrieves the parent directory
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn std::string &zippath_parent(std::string &dst, const char *path)
|
||||
*
|
||||
* @brief Zippath parent.
|
||||
*
|
||||
* @param [in,out] dst Destination for the.
|
||||
* @param path Full pathname of the file.
|
||||
*
|
||||
* @return A std::string&
|
||||
*/
|
||||
|
||||
std::string &zippath_parent(std::string &dst, const char *path)
|
||||
{
|
||||
int pos;
|
||||
parse_parent_path(path, &pos, nullptr);
|
||||
|
||||
/* return the result */
|
||||
if (pos >= 0) {
|
||||
if (pos >= 0)
|
||||
dst.assign(path, pos + 1);
|
||||
}
|
||||
else {
|
||||
else
|
||||
dst.clear();
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
@ -255,7 +245,7 @@ std::string &zippath_combine(std::string &dst, const char *path1, const char *pa
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn static osd_file::error file_error_from_zip_error(zip_file::error ziperr)
|
||||
* @fn static osd_file::error file_error_from_zip_error(archive_file::error ziperr)
|
||||
*
|
||||
* @brief File error from zip error.
|
||||
*
|
||||
@ -264,26 +254,26 @@ std::string &zippath_combine(std::string &dst, const char *path1, const char *pa
|
||||
* @return A osd_file::error.
|
||||
*/
|
||||
|
||||
static osd_file::error file_error_from_zip_error(zip_file::error ziperr)
|
||||
static osd_file::error file_error_from_zip_error(archive_file::error ziperr)
|
||||
{
|
||||
osd_file::error filerr;
|
||||
switch(ziperr)
|
||||
{
|
||||
case zip_file::error::NONE:
|
||||
case archive_file::error::NONE:
|
||||
filerr = osd_file::error::NONE;
|
||||
break;
|
||||
case zip_file::error::OUT_OF_MEMORY:
|
||||
case archive_file::error::OUT_OF_MEMORY:
|
||||
filerr = osd_file::error::OUT_OF_MEMORY;
|
||||
break;
|
||||
case zip_file::error::BAD_SIGNATURE:
|
||||
case zip_file::error::DECOMPRESS_ERROR:
|
||||
case zip_file::error::FILE_TRUNCATED:
|
||||
case zip_file::error::FILE_CORRUPT:
|
||||
case zip_file::error::UNSUPPORTED:
|
||||
case zip_file::error::FILE_ERROR:
|
||||
case archive_file::error::BAD_SIGNATURE:
|
||||
case archive_file::error::DECOMPRESS_ERROR:
|
||||
case archive_file::error::FILE_TRUNCATED:
|
||||
case archive_file::error::FILE_CORRUPT:
|
||||
case archive_file::error::UNSUPPORTED:
|
||||
case archive_file::error::FILE_ERROR:
|
||||
filerr = osd_file::error::INVALID_DATA;
|
||||
break;
|
||||
case zip_file::error::BUFFER_TOO_SMALL:
|
||||
case archive_file::error::BUFFER_TOO_SMALL:
|
||||
default:
|
||||
filerr = osd_file::error::FAILURE;
|
||||
break;
|
||||
@ -298,7 +288,7 @@ static osd_file::error file_error_from_zip_error(zip_file::error ziperr)
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn static osd_file::error create_core_file_from_zip(zip_file *zip, const zip_file_header *header, util::core_file::ptr &file)
|
||||
* @fn static osd_file::error create_core_file_from_zip(archive_file *zip, util::core_file::ptr &file)
|
||||
*
|
||||
* @brief Creates core file from zip.
|
||||
*
|
||||
@ -309,27 +299,27 @@ static osd_file::error file_error_from_zip_error(zip_file::error ziperr)
|
||||
* @return The new core file from zip.
|
||||
*/
|
||||
|
||||
static osd_file::error create_core_file_from_zip(zip_file &zip, const zip_file::file_header *header, util::core_file::ptr &file)
|
||||
static osd_file::error create_core_file_from_zip(archive_file &zip, util::core_file::ptr &file)
|
||||
{
|
||||
osd_file::error filerr;
|
||||
zip_file::error ziperr;
|
||||
archive_file::error ziperr;
|
||||
void *ptr;
|
||||
|
||||
ptr = malloc(header->uncompressed_length);
|
||||
ptr = malloc(zip.current_uncompressed_length());
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
filerr = osd_file::error::OUT_OF_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ziperr = zip.decompress(ptr, header->uncompressed_length);
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
ziperr = zip.decompress(ptr, zip.current_uncompressed_length());
|
||||
if (ziperr != archive_file::error::NONE)
|
||||
{
|
||||
filerr = file_error_from_zip_error(ziperr);
|
||||
goto done;
|
||||
}
|
||||
|
||||
filerr = util::core_file::open_ram_copy(ptr, header->uncompressed_length, OPEN_FLAG_READ, file);
|
||||
filerr = util::core_file::open_ram_copy(ptr, zip.current_uncompressed_length(), OPEN_FLAG_READ, file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
goto done;
|
||||
|
||||
@ -360,9 +350,9 @@ done:
|
||||
osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path)
|
||||
{
|
||||
osd_file::error filerr = osd_file::error::NOT_FOUND;
|
||||
zip_file::error ziperr;
|
||||
zip_file::ptr zip;
|
||||
const zip_file::file_header *header;
|
||||
archive_file::error ziperr;
|
||||
archive_file::ptr zip;
|
||||
int header;
|
||||
osd_dir_entry_type entry_type;
|
||||
int len;
|
||||
|
||||
@ -376,11 +366,11 @@ osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core
|
||||
&& ((openflags == OPEN_FLAG_READ) || (subpath.length() == 0)))
|
||||
{
|
||||
/* is the mainpath a ZIP path? */
|
||||
if (is_zip_file(mainpath.c_str()))
|
||||
if (is_zip_file(mainpath) || is_7z_file(mainpath))
|
||||
{
|
||||
/* this file might be a zip file - lets take a look */
|
||||
ziperr = zip_file::open(mainpath, zip);
|
||||
if (ziperr == zip_file::error::NONE)
|
||||
ziperr = is_zip_file(mainpath) ? archive_file::open_zip(mainpath, zip) : archive_file::open_7z(mainpath, zip);
|
||||
if (ziperr == archive_file::error::NONE)
|
||||
{
|
||||
/* it is a zip file - error if we're not opening for reading */
|
||||
if (openflags != OPEN_FLAG_READ)
|
||||
@ -390,34 +380,29 @@ osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core
|
||||
}
|
||||
|
||||
if (subpath.length() > 0)
|
||||
header = zippath_find_sub_path(*zip, subpath.c_str(), &entry_type);
|
||||
header = zippath_find_sub_path(*zip, subpath, entry_type);
|
||||
else
|
||||
header = zip->first_file();
|
||||
|
||||
if (header == nullptr)
|
||||
if (header < 0)
|
||||
{
|
||||
filerr = osd_file::error::NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* attempt to read the file */
|
||||
filerr = create_core_file_from_zip(*zip, header, file);
|
||||
filerr = create_core_file_from_zip(*zip, file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
goto done;
|
||||
|
||||
/* update subpath, if appropriate */
|
||||
if (subpath.length() == 0)
|
||||
subpath.assign(header->filename);
|
||||
subpath.assign(zip->current_name());
|
||||
|
||||
/* we're done */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else if (is_7z_file(mainpath.c_str()))
|
||||
{
|
||||
filerr = osd_file::error::INVALID_DATA;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (subpath.length() == 0)
|
||||
filerr = util::core_file::open(filename, openflags, file);
|
||||
@ -523,10 +508,10 @@ static int is_root(const char *path)
|
||||
* @return An int.
|
||||
*/
|
||||
|
||||
static int is_7z_file(const char *path)
|
||||
static bool is_7z_file(std::string const &path)
|
||||
{
|
||||
const char *s = strrchr(path, '.');
|
||||
return (s != nullptr) && !core_stricmp(s, ".7z");
|
||||
auto const s = path.rfind('.');
|
||||
return (std::string::npos != s) && !core_stricmp(path.c_str() + s, ".7z");
|
||||
}
|
||||
|
||||
|
||||
@ -535,20 +520,10 @@ static int is_7z_file(const char *path)
|
||||
ZIP file
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn static int is_zip_file(const char *path)
|
||||
*
|
||||
* @brief Is zip file.
|
||||
*
|
||||
* @param path Full pathname of the file.
|
||||
*
|
||||
* @return An int.
|
||||
*/
|
||||
|
||||
static int is_zip_file(const char *path)
|
||||
static bool is_zip_file(std::string const &path)
|
||||
{
|
||||
const char *s = strrchr(path, '.');
|
||||
return (s != nullptr) && !core_stricmp(s, ".zip");
|
||||
auto const s = path.rfind('.');
|
||||
return (std::string::npos != s) && !core_stricmp(path.c_str() + s, ".zip");
|
||||
}
|
||||
|
||||
|
||||
@ -568,7 +543,7 @@ static int is_zip_file(const char *path)
|
||||
* @return An int.
|
||||
*/
|
||||
|
||||
static int is_zip_file_separator(char c)
|
||||
static bool is_zip_file_separator(char c)
|
||||
{
|
||||
return (c == '/') || (c == '\\');
|
||||
}
|
||||
@ -590,7 +565,7 @@ static int is_zip_file_separator(char c)
|
||||
* @return An int.
|
||||
*/
|
||||
|
||||
static int is_zip_path_separator(char c)
|
||||
static bool is_zip_path_separator(char c)
|
||||
{
|
||||
return is_zip_file_separator(c) || is_path_separator(c);
|
||||
}
|
||||
@ -613,38 +588,35 @@ static int is_zip_path_separator(char c)
|
||||
* @return A char.
|
||||
*/
|
||||
|
||||
static char next_path_char(const char *s, int *pos)
|
||||
static char next_path_char(std::string const &s, std::string::size_type &pos)
|
||||
{
|
||||
char result;
|
||||
|
||||
/* skip over any initial separators */
|
||||
if (*pos == 0)
|
||||
// skip over any initial separators
|
||||
if (pos == 0)
|
||||
{
|
||||
while(is_zip_file_separator(s[*pos]))
|
||||
(*pos)++;
|
||||
while ((pos < s.length()) && is_zip_file_separator(s[pos]))
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* are we at a path separator? */
|
||||
if (is_zip_file_separator(s[*pos]))
|
||||
// are we at a path separator?
|
||||
if (pos == s.length())
|
||||
{
|
||||
/* skip over path separators */
|
||||
while(is_zip_file_separator(s[*pos]))
|
||||
(*pos)++;
|
||||
|
||||
/* normalize as '/' */
|
||||
result = '/';
|
||||
// return NUL
|
||||
return '\0';
|
||||
}
|
||||
else if (s[*pos] != '\0')
|
||||
else if (is_zip_file_separator(s[pos]))
|
||||
{
|
||||
/* return character */
|
||||
result = tolower(s[(*pos)++]);
|
||||
// skip over path separators
|
||||
while((pos < s.length()) && is_zip_file_separator(s[pos]))
|
||||
pos++;
|
||||
|
||||
// normalize as '/'
|
||||
return '/';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* return NUL */
|
||||
result = '\0';
|
||||
// return character
|
||||
return std::tolower(s[pos++]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -656,7 +628,7 @@ static char next_path_char(const char *s, int *pos)
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const char *subpath, osd_dir_entry_type *type)
|
||||
* @fn static const zip_file_header *zippath_find_sub_path(archive_file *zipfile, const char *subpath, osd_dir_entry_type *type)
|
||||
*
|
||||
* @brief Zippath find sub path.
|
||||
*
|
||||
@ -667,50 +639,36 @@ static char next_path_char(const char *s, int *pos)
|
||||
* @return null if it fails, else a zip_file_header*.
|
||||
*/
|
||||
|
||||
static const zip_file::file_header *zippath_find_sub_path(zip_file &zipfile, const char *subpath, osd_dir_entry_type *type)
|
||||
static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpath, osd_dir_entry_type &type)
|
||||
{
|
||||
int i, j;
|
||||
char c1, c2, last_char;
|
||||
const zip_file::file_header *header;
|
||||
|
||||
for (header = zipfile.first_file(); header != nullptr; header = zipfile.next_file())
|
||||
for (int header = zipfile.first_file(); header >= 0; header = zipfile.next_file())
|
||||
{
|
||||
/* special case */
|
||||
if (subpath == nullptr)
|
||||
std::string::size_type i = 0, j = 0;
|
||||
char c1, c2;
|
||||
do
|
||||
{
|
||||
if (type != nullptr)
|
||||
*type = ENTTYPE_FILE;
|
||||
return header;
|
||||
c1 = next_path_char(zipfile.current_name(), i);
|
||||
c2 = next_path_char(subpath, j);
|
||||
}
|
||||
while ((c1 == c2) && c1 && c2);
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
last_char = '/';
|
||||
while(((c1 = next_path_char(header->filename, &i)) == (c2 = next_path_char(subpath, &j))) &&
|
||||
( c1 != '\0' && c2 != '\0' ))
|
||||
last_char = c2;
|
||||
|
||||
|
||||
if (c2 == '\0')
|
||||
if (!c2 || ((c2 == '/') && !(c2 = next_path_char(subpath, j))))
|
||||
{
|
||||
if (c1 == '\0')
|
||||
if (!c1)
|
||||
{
|
||||
if (type != nullptr)
|
||||
*type = ENTTYPE_FILE;
|
||||
type = zipfile.current_is_directory() ? ENTTYPE_DIR : ENTTYPE_FILE;
|
||||
return header;
|
||||
}
|
||||
else if ((last_char == '/') || (c1 == '/'))
|
||||
else if ((c1 == '/') || (i <= 1U))
|
||||
{
|
||||
if (type != nullptr)
|
||||
*type = ENTTYPE_DIR;
|
||||
type = ENTTYPE_DIR;
|
||||
return header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type != nullptr)
|
||||
*type = ENTTYPE_NONE;
|
||||
return nullptr;
|
||||
type = ENTTYPE_NONE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -721,7 +679,7 @@ static const zip_file::file_header *zippath_find_sub_path(zip_file &zipfile, con
|
||||
-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @fn static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file *&zipfile, std::string &newpath)
|
||||
* @fn static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, archive_file *&zipfile, std::string &newpath)
|
||||
*
|
||||
* @brief Zippath resolve.
|
||||
*
|
||||
@ -733,94 +691,78 @@ static const zip_file::file_header *zippath_find_sub_path(zip_file &zipfile, con
|
||||
* @return A osd_file::error.
|
||||
*/
|
||||
|
||||
static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file::ptr &zipfile, std::string &newpath)
|
||||
static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, archive_file::ptr &zipfile, std::string &newpath)
|
||||
{
|
||||
osd_file::error err;
|
||||
osd_directory_entry *current_entry = nullptr;
|
||||
osd_dir_entry_type current_entry_type;
|
||||
int went_up = FALSE;
|
||||
int i;
|
||||
|
||||
newpath.clear();
|
||||
|
||||
/* be conservative */
|
||||
// be conservative
|
||||
entry_type = ENTTYPE_NONE;
|
||||
zipfile.reset();
|
||||
|
||||
std::string apath(path);
|
||||
std::string apath_trimmed;
|
||||
osd_dir_entry_type current_entry_type;
|
||||
bool went_up = false;
|
||||
do
|
||||
{
|
||||
/* trim the path of trailing path separators */
|
||||
i = apath.length();
|
||||
while (i > 1 && is_path_separator(apath[i - 1]))
|
||||
// trim the path of trailing path separators
|
||||
auto i = apath.length();
|
||||
while ((i > 1) && is_path_separator(apath[i - 1]))
|
||||
i--;
|
||||
apath = apath.substr(0, i);
|
||||
apath_trimmed.assign(apath);
|
||||
apath.resize(i);
|
||||
apath_trimmed = apath;
|
||||
|
||||
/* stat the path */
|
||||
current_entry = osd_stat(apath_trimmed.c_str());
|
||||
// stat the path
|
||||
std::unique_ptr<osd_directory_entry, void (*)(void *)> current_entry(osd_stat(apath_trimmed), &osd_free);
|
||||
|
||||
/* did we find anything? */
|
||||
if (current_entry != nullptr)
|
||||
// did we find anything?
|
||||
if (current_entry)
|
||||
{
|
||||
/* get the entry type and free the stat entry */
|
||||
// get the entry type and free the stat entry
|
||||
current_entry_type = current_entry->type;
|
||||
osd_free(current_entry);
|
||||
current_entry = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if we have not found the file or directory, go up */
|
||||
// if we have not found the file or directory, go up
|
||||
current_entry_type = ENTTYPE_NONE;
|
||||
went_up = TRUE;
|
||||
went_up = true;
|
||||
std::string parent;
|
||||
apath.assign(zippath_parent(parent, apath.c_str()));
|
||||
apath = zippath_parent(parent, apath.c_str());
|
||||
}
|
||||
}
|
||||
while (current_entry_type == ENTTYPE_NONE && !is_root(apath.c_str()));
|
||||
while ((current_entry_type == ENTTYPE_NONE) && !is_root(apath.c_str()));
|
||||
|
||||
/* if we did not find anything, then error out */
|
||||
// if we did not find anything, then error out
|
||||
if (current_entry_type == ENTTYPE_NONE)
|
||||
{
|
||||
err = osd_file::error::NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
return osd_file::error::NOT_FOUND;
|
||||
|
||||
/* is this file a ZIP file? */
|
||||
if ((current_entry_type == ENTTYPE_FILE) && is_zip_file(apath_trimmed.c_str())
|
||||
&& (zip_file::open(apath_trimmed, zipfile) == zip_file::error::NONE))
|
||||
// is this file a ZIP file?
|
||||
if ((current_entry_type == ENTTYPE_FILE) &&
|
||||
((is_zip_file(apath_trimmed) && (archive_file::open_zip(apath_trimmed, zipfile) == archive_file::error::NONE)) ||
|
||||
(is_7z_file(apath_trimmed) && (archive_file::open_7z(apath_trimmed, zipfile) == archive_file::error::NONE))))
|
||||
{
|
||||
i = strlen(path + apath.length());
|
||||
while (i > 0 && is_zip_path_separator(path[apath.length() + i - 1]))
|
||||
auto i = strlen(path + apath.length());
|
||||
while ((i > 0) && is_zip_path_separator(path[apath.length() + i - 1]))
|
||||
i--;
|
||||
newpath.assign(path + apath.length(), i);
|
||||
|
||||
/* this was a true ZIP path - attempt to identify the type of path */
|
||||
zippath_find_sub_path(*zipfile, newpath.c_str(), ¤t_entry_type);
|
||||
// this was a true ZIP path - attempt to identify the type of path
|
||||
zippath_find_sub_path(*zipfile, newpath, current_entry_type);
|
||||
if (current_entry_type == ENTTYPE_NONE)
|
||||
{
|
||||
err = osd_file::error::NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
return osd_file::error::NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this was a normal path */
|
||||
// this was a normal path
|
||||
if (went_up)
|
||||
{
|
||||
err = osd_file::error::NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
newpath.assign(path);
|
||||
return osd_file::error::NOT_FOUND;
|
||||
|
||||
newpath = path;
|
||||
}
|
||||
|
||||
/* success! */
|
||||
// success!
|
||||
entry_type = current_entry_type;
|
||||
err = osd_file::error::NONE;
|
||||
|
||||
done:
|
||||
return err;
|
||||
return osd_file::error::NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -868,11 +810,11 @@ osd_file::error zippath_opendir(const char *path, zippath_directory **directory)
|
||||
}
|
||||
|
||||
/* was the result a ZIP? */
|
||||
if (result->zipfile == nullptr)
|
||||
if (!result->zipfile)
|
||||
{
|
||||
/* a conventional directory */
|
||||
result->directory = osd_opendir(path);
|
||||
if (result->directory == nullptr)
|
||||
if (!result->directory)
|
||||
{
|
||||
err = osd_file::error::FAILURE;
|
||||
goto done;
|
||||
@ -943,20 +885,27 @@ void zippath_closedir(zippath_directory *directory)
|
||||
* @return null if it fails, else the relative path.
|
||||
*/
|
||||
|
||||
static const char *get_relative_path(zippath_directory *directory, const zip_file::file_header *header)
|
||||
static const char *get_relative_path(zippath_directory const &directory)
|
||||
{
|
||||
const char *result = nullptr;
|
||||
int len = directory->zipprefix.length();
|
||||
|
||||
if ((len <= strlen(header->filename))
|
||||
&& !strncmp(directory->zipprefix.c_str(), header->filename, len))
|
||||
auto len = directory.zipprefix.length();
|
||||
const char *prefix = directory.zipprefix.c_str();
|
||||
while (is_zip_file_separator(*prefix))
|
||||
{
|
||||
result = &header->filename[len];
|
||||
while(is_zip_file_separator(*result))
|
||||
result++;
|
||||
len--;
|
||||
prefix++;
|
||||
}
|
||||
|
||||
return result;
|
||||
if ((len <= directory.zipfile->current_name().length()) &&
|
||||
!strncmp(prefix, directory.zipfile->current_name().c_str(), len))
|
||||
{
|
||||
const char *result = &directory.zipfile->current_name().c_str()[len];
|
||||
while (is_zip_file_separator(*result))
|
||||
result++;
|
||||
|
||||
return *result ? result : nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -977,7 +926,7 @@ static const char *get_relative_path(zippath_directory *directory, const zip_fil
|
||||
const osd_directory_entry *zippath_readdir(zippath_directory *directory)
|
||||
{
|
||||
const osd_directory_entry *result = nullptr;
|
||||
const zip_file::file_header *header;
|
||||
int header;
|
||||
const char *relpath;
|
||||
const char *separator;
|
||||
const char *s;
|
||||
@ -992,7 +941,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
|
||||
directory->returned_entry.type = ENTTYPE_DIR;
|
||||
result = &directory->returned_entry;
|
||||
}
|
||||
else if (directory->directory != nullptr)
|
||||
else if (directory->directory)
|
||||
{
|
||||
/* a normal directory read */
|
||||
do
|
||||
@ -1002,7 +951,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
|
||||
while((result != nullptr) && (!strcmp(result->name, ".") || !strcmp(result->name, "..")));
|
||||
|
||||
/* special case - is this entry a ZIP file? if so we need to return it as a "directory" */
|
||||
if ((result != nullptr) && is_zip_file(result->name))
|
||||
if ((result != nullptr) && (is_zip_file(result->name) || is_7z_file(result->name)))
|
||||
{
|
||||
/* copy; but change the entry type */
|
||||
directory->returned_entry = *result;
|
||||
@ -1010,7 +959,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
|
||||
result = &directory->returned_entry;
|
||||
}
|
||||
}
|
||||
else if (directory->zipfile != nullptr)
|
||||
else if (directory->zipfile)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -1024,7 +973,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
|
||||
directory->called_zip_first = true;
|
||||
relpath = nullptr;
|
||||
}
|
||||
while((header != nullptr) && ((relpath = get_relative_path(directory, header)) == nullptr));
|
||||
while((header >= 0) && ((relpath = get_relative_path(*directory)) == nullptr));
|
||||
|
||||
if (relpath != nullptr)
|
||||
{
|
||||
@ -1063,7 +1012,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
|
||||
memset(&directory->returned_entry, 0, sizeof(directory->returned_entry));
|
||||
directory->returned_entry.name = relpath;
|
||||
directory->returned_entry.type = ENTTYPE_FILE;
|
||||
directory->returned_entry.size = header->uncompressed_length;
|
||||
directory->returned_entry.size = directory->zipfile->current_uncompressed_length();
|
||||
result = &directory->returned_entry;
|
||||
}
|
||||
}
|
||||
@ -1094,3 +1043,5 @@ int zippath_is_zip(zippath_directory *directory)
|
||||
{
|
||||
return directory->zipfile != nullptr;
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
|
@ -10,14 +10,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ZIPPATH_H__
|
||||
#define __ZIPPATH_H__
|
||||
#ifndef MAME_LIB_UTIL_ZIPPATH_H
|
||||
#define MAME_LIB_UTIL_ZIPPATH_H
|
||||
|
||||
#include "corefile.h"
|
||||
#include <string>
|
||||
#include "unzip.h"
|
||||
|
||||
|
||||
namespace util {
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
@ -62,6 +64,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory);
|
||||
/* returns TRUE if this path is a ZIP path or FALSE if not */
|
||||
int zippath_is_zip(zippath_directory *directory);
|
||||
|
||||
} // namespace util
|
||||
|
||||
|
||||
#endif /* __ZIPPATH_H__ */
|
||||
#endif /* MAME_LIB_UTIL_ZIPPATH_H */
|
||||
|
@ -22,13 +22,11 @@ for details on this encryption scheme
|
||||
|
||||
/* notes / todo:
|
||||
|
||||
Decrypt Space Position Somehow (not something I
|
||||
can do)
|
||||
Unknown Reads / Writes
|
||||
Whats the Prom for? nothing important?
|
||||
Is the level order correct?
|
||||
the progress sprite on the side of the screen re-appears at the bottom when you get
|
||||
to the top, but the wrap-around is needed for other things, actual game bug?
|
||||
Angel Kids service mode doesn't seem to work, did it ever?
|
||||
|
||||
*/
|
||||
|
||||
@ -130,7 +128,7 @@ Dumped by Chackn
|
||||
#include "machine/segacrp2.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "includes/angelkds.h"
|
||||
|
||||
#include "machine/i8255.h"
|
||||
|
||||
|
||||
|
||||
@ -146,37 +144,8 @@ WRITE8_MEMBER(angelkds_state::angelkds_cpu_bank_write)
|
||||
}
|
||||
|
||||
|
||||
/*** Fake Inputs
|
||||
|
||||
these make the game a bit easier for testing purposes
|
||||
|
||||
*/
|
||||
|
||||
#define FAKEINPUTS 0
|
||||
|
||||
#if FAKEINPUTS
|
||||
|
||||
READ8_MEMBER(angelkds_state::angelkds_input_r)
|
||||
{
|
||||
int fake;
|
||||
static const char *const portnames[] = { "I81", "I82" };
|
||||
static const char *const fakenames[] = { "FAKE1", "FAKE2" };
|
||||
|
||||
fake = ioport(fakenames[offset])->read();
|
||||
|
||||
return ((fake & 0x01) ? fake : ioport(portnames[offset])->read());
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
READ8_MEMBER(angelkds_state::angelkds_input_r)
|
||||
{
|
||||
static const char *const portnames[] = { "I81", "I82" };
|
||||
|
||||
return ioport(portnames[offset])->read();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*** Memory Structures
|
||||
|
||||
@ -202,7 +171,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, angelkds_state )
|
||||
AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(angelkds_bgbotvideoram_w) AM_SHARE("bgbotvideoram") /* Bottom Half of Screen */
|
||||
AM_RANGE(0xe800, 0xebff) AM_RAM_WRITE(angelkds_txvideoram_w) AM_SHARE("txvideoram")
|
||||
AM_RANGE(0xec00, 0xecff) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0xed00, 0xeeff) AM_RAM_WRITE(angelkds_paletteram_w) AM_SHARE("paletteram")
|
||||
AM_RANGE(0xed00, 0xedff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
|
||||
AM_RANGE(0xee00, 0xeeff) AM_RAM_DEVWRITE("palette", palette_device, write_ext) AM_SHARE("palette_ext")
|
||||
AM_RANGE(0xef00, 0xefff) AM_RAM
|
||||
AM_RANGE(0xf000, 0xf000) AM_WRITE(angelkds_bgtopbank_write)
|
||||
AM_RANGE(0xf001, 0xf001) AM_WRITE(angelkds_bgtopscroll_write)
|
||||
@ -220,17 +190,17 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( main_portmap, AS_IO, 8, angelkds_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_WRITENOP // 00 on start-up, not again
|
||||
AM_RANGE(0x42, 0x42) AM_WRITE(angelkds_cpu_bank_write)
|
||||
AM_RANGE(0x43, 0x43) AM_WRITENOP // 9a on start-up, not again
|
||||
AM_RANGE(0x40, 0x40) AM_READ_PORT("I40") /* "Coinage" Dip Switches */
|
||||
AM_RANGE(0x41, 0x41) AM_READ_PORT("I41") /* Other Dip Switches */
|
||||
AM_RANGE(0x42, 0x42) AM_READ_PORT("I42") /* Players inputs (not needed ?) */
|
||||
AM_RANGE(0x80, 0x80) AM_READ_PORT("I80") /* System inputs */
|
||||
AM_RANGE(0x81, 0x82) AM_READ(angelkds_input_r) /* Players inputs */
|
||||
AM_RANGE(0x83, 0x83) AM_WRITENOP // 9b on start-up, not again
|
||||
|
||||
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
|
||||
AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
|
||||
|
||||
AM_RANGE(0xc0, 0xc3) AM_READWRITE(angelkds_main_sound_r, angelkds_main_sound_w) // 02 various points
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* sub cpu */
|
||||
|
||||
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, angelkds_state )
|
||||
@ -261,16 +231,6 @@ ADDRESS_MAP_END
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(player) PORT_8WAY \
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(player) PORT_8WAY
|
||||
|
||||
#define ANGELDSK_FAKE_PLAYERS_INPUT( player ) \
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(player) /* To enter initials */ \
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Unused */ \
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) PORT_8WAY \
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(player) PORT_8WAY \
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) PORT_8WAY \
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) PORT_8WAY \
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(player) /* To shorten the rope and */ \
|
||||
/* move right in hiscores table */
|
||||
|
||||
|
||||
static INPUT_PORTS_START( angelkds )
|
||||
/*
|
||||
@ -339,15 +299,6 @@ static INPUT_PORTS_START( angelkds )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) )
|
||||
|
||||
PORT_START("I42") /* inport $42 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // duplicated IPT_JOYSTICK_LEFTRIGHT
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_8WAY // duplicated IPT_JOYSTICK_LEFTRIGHT
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_8WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("I80") /* inport $80 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
@ -365,23 +316,6 @@ static INPUT_PORTS_START( angelkds )
|
||||
PORT_START("I82") /* inport $82 */
|
||||
ANGELDSK_PLAYERS_INPUT( 2 )
|
||||
|
||||
#if FAKEINPUTS
|
||||
|
||||
/* Fake inputs to allow to play the game with 1 joystick instead of 2 */
|
||||
PORT_START("FAKE1")
|
||||
PORT_DIPNAME( 0x01, 0x00, "FAKE (for debug) Joysticks (Player 1)" )
|
||||
PORT_DIPSETTING( 0x01, "1" )
|
||||
PORT_DIPSETTING( 0x00, "2" )
|
||||
ANGELDSK_FAKE_PLAYERS_INPUT( 1 )
|
||||
|
||||
PORT_START("FAKE2")
|
||||
PORT_DIPNAME( 0x01, 0x00, "FAKE (for debug) Joysticks (Player 2)" )
|
||||
PORT_DIPSETTING( 0x01, "1" )
|
||||
PORT_DIPSETTING( 0x00, "2" )
|
||||
ANGELDSK_FAKE_PLAYERS_INPUT( 2 )
|
||||
|
||||
#endif
|
||||
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( spcpostn )
|
||||
@ -443,16 +377,6 @@ static INPUT_PORTS_START( spcpostn )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) /* Listed as "Unused" */
|
||||
|
||||
PORT_START("I42") /* inport $42 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("I80") /* inport $80 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
|
||||
@ -601,6 +525,16 @@ static MACHINE_CONFIG_START( angelkds, angelkds_state )
|
||||
MCFG_CPU_PROGRAM_MAP(sub_map)
|
||||
MCFG_CPU_IO_MAP(sub_portmap)
|
||||
|
||||
MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
|
||||
MCFG_I8255_IN_PORTA_CB(IOPORT("I40"))
|
||||
MCFG_I8255_IN_PORTB_CB(IOPORT("I41"))
|
||||
MCFG_I8255_IN_PORTC_CB(READ8(angelkds_state, angeklds_ff_r)) // or left inputs don't work
|
||||
MCFG_I8255_OUT_PORTC_CB(WRITE8(angelkds_state, angelkds_cpu_bank_write))
|
||||
|
||||
MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0)
|
||||
MCFG_I8255_IN_PORTA_CB(IOPORT("I80"))
|
||||
MCFG_I8255_IN_PORTB_CB(IOPORT("I81"))
|
||||
MCFG_I8255_IN_PORTC_CB(IOPORT("I82"))
|
||||
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
|
||||
|
||||
@ -615,6 +549,7 @@ static MACHINE_CONFIG_START( angelkds, angelkds_state )
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", angelkds)
|
||||
MCFG_PALETTE_ADD("palette", 0x100)
|
||||
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
|
||||
|
||||
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
@ -657,7 +592,7 @@ ROM_START( angelkds )
|
||||
ROM_REGION( 0x8000, "maincpu", 0 )
|
||||
ROM_LOAD( "11428.c10", 0x00000, 0x08000, CRC(90daacd2) SHA1(7e50ad1cbed0c1e6bad04ef1611cad25538c905f) )
|
||||
|
||||
ROM_REGION( 0x20000, "user1", 0 ) /* Banked Code */
|
||||
ROM_REGION( 0x40000, "user1", 0 ) /* Banked Code */
|
||||
ROM_LOAD( "11424.c1", 0x00000, 0x08000, CRC(b55997f6) SHA1(7ed746becac1851f39591f1fdbeff64aa97d6206) )
|
||||
ROM_LOAD( "11425.c2", 0x08000, 0x08000, CRC(299359de) SHA1(f531dd3bfe6f64e9e043cb4f85d5657455241dc7) )
|
||||
ROM_LOAD( "11426.c3", 0x10000, 0x08000, CRC(5fad8bd3) SHA1(4d865342eb10dcfb779eee4ac1e159bb9ec140cb) )
|
||||
@ -704,7 +639,7 @@ ROM_START( spcpostn )
|
||||
ROM_REGION( 0x8000, "maincpu", 0 ) /* D317-0005 (NEC Z80 Custom) */
|
||||
ROM_LOAD( "epr10125.c10", 0x00000, 0x08000, CRC(bffd38c6) SHA1(af02907124343ddecd21439d25f1ebb81ef9f51a) ) /* encrypted */
|
||||
|
||||
ROM_REGION( 0x28000, "user1", 0 ) /* Banked Code */
|
||||
ROM_REGION( 0x40000, "user1", 0 ) /* Banked Code */
|
||||
ROM_LOAD( "epr10120.c1", 0x00000, 0x08000, CRC(d6399f99) SHA1(4c7d19a8798e5a10b688bf793ca74f5170fd9b51) )
|
||||
ROM_LOAD( "epr10121.c2", 0x08000, 0x08000, CRC(d4861560) SHA1(74d28c36a08880abbd3c398cc3e990e8986caccb) )
|
||||
ROM_LOAD( "epr10122.c3", 0x10000, 0x08000, CRC(7a1bff1b) SHA1(e1bda8430fd632c1813dd78e0f210a358e1b0d2f) )
|
||||
@ -740,7 +675,7 @@ ROM_END
|
||||
DRIVER_INIT_MEMBER(angelkds_state,angelkds)
|
||||
{
|
||||
UINT8 *RAM = memregion("user1")->base();
|
||||
membank("bank1")->configure_entries(0, 8, &RAM[0x0000], 0x4000);
|
||||
membank("bank1")->configure_entries(0, 16, &RAM[0x0000], 0x4000);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(angelkds_state,spcpostn)
|
||||
@ -750,7 +685,7 @@ DRIVER_INIT_MEMBER(angelkds_state,spcpostn)
|
||||
// 317-0005
|
||||
sega_decode_317(memregion("maincpu")->base(), m_decrypted_opcodes, 1);
|
||||
|
||||
membank("bank1")->configure_entries(0, 10, &RAM[0x0000], 0x4000);
|
||||
membank("bank1")->configure_entries(0, 16, &RAM[0x0000], 0x4000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,6 +4,14 @@
|
||||
|
||||
Car Jamboree
|
||||
Omori Electric CAD (OEC) 1983
|
||||
|
||||
TODO:
|
||||
- colors are wrong
|
||||
- sprite priorities?
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
PCB sketch:
|
||||
|
||||
c14 c.d19
|
||||
c13 c.d18 c10
|
||||
|
@ -89,11 +89,14 @@ WRITE16_MEMBER(hh_sm510_state::lcd_segment_w)
|
||||
|
||||
if (state != m_lcd_output_cache[index])
|
||||
{
|
||||
// output to x.y, where x = row a/b/bs/c*4 + H1-4, y = seg1-16
|
||||
// output to row.seg.H, where:
|
||||
// row = row a/b/bs/c (0/1/2/3)
|
||||
// seg = seg 1-16 (0-15)
|
||||
// H = H1-H4 (0-3)
|
||||
char buf[0x10];
|
||||
sprintf(buf, "%d.%d", offset, seg);
|
||||
sprintf(buf, "%d.%d.%d", offset >> 2, seg, offset & 3);
|
||||
output().set_value(buf, state);
|
||||
|
||||
|
||||
m_lcd_output_cache[index] = state;
|
||||
}
|
||||
}
|
||||
|
@ -84,34 +84,11 @@ ADDRESS_MAP_END
|
||||
PORT_BIT( bit, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(text) PORT_CODE(key1)
|
||||
|
||||
static INPUT_PORTS_START( pcat_dyn )
|
||||
PORT_START("pc_keyboard_0")
|
||||
PORT_BIT ( 0x0001, 0x0000, IPT_UNUSED ) /* unused scancode 0 */
|
||||
AT_KEYB_HELPER( 0x0002, "Esc", KEYCODE_Q ) /* Esc 01 81 */
|
||||
|
||||
PORT_START("pc_keyboard_1")
|
||||
AT_KEYB_HELPER( 0x0020, "Y", KEYCODE_Y ) /* Y 15 95 */
|
||||
AT_KEYB_HELPER( 0x1000, "Enter", KEYCODE_ENTER ) /* Enter 1C 9C */
|
||||
|
||||
PORT_START("pc_keyboard_2")
|
||||
|
||||
PORT_START("pc_keyboard_3")
|
||||
AT_KEYB_HELPER( 0x0002, "N", KEYCODE_N ) /* N 31 B1 */
|
||||
AT_KEYB_HELPER( 0x0800, "F1", KEYCODE_S ) /* F1 3B BB */
|
||||
|
||||
PORT_START("pc_keyboard_4")
|
||||
|
||||
PORT_START("pc_keyboard_5")
|
||||
|
||||
PORT_START("pc_keyboard_6")
|
||||
AT_KEYB_HELPER( 0x0040, "(MF2)Cursor Up", KEYCODE_UP ) /* Up 67 e7 */
|
||||
AT_KEYB_HELPER( 0x0080, "(MF2)Page Up", KEYCODE_PGUP ) /* Page Up 68 e8 */
|
||||
AT_KEYB_HELPER( 0x0100, "(MF2)Cursor Left", KEYCODE_LEFT ) /* Left 69 e9 */
|
||||
AT_KEYB_HELPER( 0x0200, "(MF2)Cursor Right", KEYCODE_RIGHT ) /* Right 6a ea */
|
||||
AT_KEYB_HELPER( 0x0800, "(MF2)Cursor Down", KEYCODE_DOWN ) /* Down 6c ec */
|
||||
AT_KEYB_HELPER( 0x1000, "(MF2)Page Down", KEYCODE_PGDN ) /* Page Down 6d ed */
|
||||
AT_KEYB_HELPER( 0x4000, "Del", KEYCODE_A ) /* Delete 6f ef */
|
||||
|
||||
PORT_START("pc_keyboard_7")
|
||||
// 8 -- Bookkeeping
|
||||
// L -- Coin
|
||||
// M,N,Numpad 6 -- Hang
|
||||
// Enter,Numpad 4 -- 5 Credits
|
||||
PORT_INCLUDE(at_keyboard)
|
||||
INPUT_PORTS_END
|
||||
|
||||
static SLOT_INTERFACE_START(pcat_dyn_com)
|
||||
@ -182,7 +159,7 @@ ROM_START(toursol)
|
||||
ROM_LOAD("sol.u21", 0x00000, 0x40000, CRC(e97724d9) SHA1(995b89d129c371b815c6b498093bd1bbf9fd8755))
|
||||
ROM_LOAD("sol.u22", 0x40000, 0x40000, CRC(69d42f50) SHA1(737fe62f3827b00b4f6f3b72ef6c7b6740947e95))
|
||||
ROM_LOAD("sol.u23", 0x80000, 0x40000, CRC(d1e39bd4) SHA1(39c7ee43cddb53fba0f7c0572ddc40289c4edd07))
|
||||
ROM_LOAD("sol.u24", 0xa0000, 0x40000, CRC(555341e0) SHA1(81fee576728855e234ff7aae06f54ae9705c3ab5))
|
||||
ROM_LOAD("sol.u24", 0xc0000, 0x40000, CRC(555341e0) SHA1(81fee576728855e234ff7aae06f54ae9705c3ab5))
|
||||
ROM_LOAD("sol.u28", 0xe0000, 0x02000, CRC(c9374d50) SHA1(49173bc69f70bb2a7e8af9d03e2538b34aa881d8))
|
||||
ROM_FILL(0x2a3e6, 1, 0xeb) // skip prot(?) check
|
||||
|
||||
@ -203,7 +180,7 @@ ROM_START(toursol1)
|
||||
ROM_LOAD("prom.0", 0x00000, 0x40000, CRC(f26ce73f) SHA1(5516c31aa18716a47f46e412fc273ae8784d2061))
|
||||
ROM_LOAD("prom.1", 0x40000, 0x40000, CRC(8f96e2a8) SHA1(bc3ce8b99e6ff40e355df2c3f797f1fe88b3b219))
|
||||
ROM_LOAD("prom.2", 0x80000, 0x40000, CRC(8b0ac5cf) SHA1(1c2b6a53c9ff4d18a5227d899facbbc719f40205))
|
||||
ROM_LOAD("prom.3", 0xa0000, 0x40000, CRC(9352e965) SHA1(2bfb647ec27c60a8c821fdf7483199e1a444cea8))
|
||||
ROM_LOAD("prom.3", 0xc0000, 0x40000, CRC(9352e965) SHA1(2bfb647ec27c60a8c821fdf7483199e1a444cea8))
|
||||
ROM_LOAD("prom.7", 0xe0000, 0x02000, CRC(154c8092) SHA1(4439ee82f36d5d5c334494ba7bb4848e839213a7))
|
||||
|
||||
ROM_REGION(128, "rtc", 0)
|
||||
|
@ -15,11 +15,9 @@ public:
|
||||
m_bgbotvideoram(*this, "bgbotvideoram"),
|
||||
m_txvideoram(*this, "txvideoram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_paletteram(*this, "paletteram"),
|
||||
m_subcpu(*this, "sub"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_decrypted_opcodes(*this, "decrypted_opcodes") { }
|
||||
|
||||
/* memory pointers */
|
||||
@ -27,7 +25,6 @@ public:
|
||||
required_shared_ptr<UINT8> m_bgbotvideoram;
|
||||
required_shared_ptr<UINT8> m_txvideoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_paletteram;
|
||||
|
||||
tilemap_t *m_tx_tilemap;
|
||||
tilemap_t *m_bgbot_tilemap;
|
||||
@ -42,8 +39,8 @@ public:
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_subcpu;
|
||||
DECLARE_READ8_MEMBER(angeklds_ff_r) { return 0xff; };
|
||||
DECLARE_WRITE8_MEMBER(angelkds_cpu_bank_write);
|
||||
DECLARE_READ8_MEMBER(angelkds_input_r);
|
||||
DECLARE_WRITE8_MEMBER(angelkds_main_sound_w);
|
||||
DECLARE_READ8_MEMBER(angelkds_main_sound_r);
|
||||
DECLARE_WRITE8_MEMBER(angelkds_sub_sound_w);
|
||||
@ -57,7 +54,6 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(angelkds_bgbotbank_write);
|
||||
DECLARE_WRITE8_MEMBER(angelkds_bgbotscroll_write);
|
||||
DECLARE_WRITE8_MEMBER(angelkds_layer_ctrl_write);
|
||||
DECLARE_WRITE8_MEMBER(angelkds_paletteram_w);
|
||||
DECLARE_DRIVER_INIT(angelkds);
|
||||
DECLARE_DRIVER_INIT(spcpostn);
|
||||
TILE_GET_INFO_MEMBER(get_tx_tile_info);
|
||||
@ -71,6 +67,5 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(irqhandler);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
optional_shared_ptr<UINT8> m_decrypted_opcodes;
|
||||
};
|
||||
|
@ -22,280 +22,287 @@
|
||||
<bounds left="0" right="64" top="0" bottom="64" />
|
||||
</bezel>
|
||||
|
||||
<!-- max 16*16 matrix -->
|
||||
<!-- max 4*16*4 matrix -->
|
||||
|
||||
<bezel name="0.0" element="led"><bounds x="0" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="0.1" element="led"><bounds x="0" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="0.2" element="led"><bounds x="0" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="0.3" element="led"><bounds x="0" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="0.4" element="led"><bounds x="0" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="0.5" element="led"><bounds x="0" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="0.6" element="led"><bounds x="0" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="0.7" element="led"><bounds x="0" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="0.8" element="led"><bounds x="0" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="0.9" element="led"><bounds x="0" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="0.10" element="led"><bounds x="0" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="0.11" element="led"><bounds x="0" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="0.12" element="led"><bounds x="0" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="0.13" element="led"><bounds x="0" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="0.14" element="led"><bounds x="0" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="0.15" element="led"><bounds x="0" y="30" width="1" height="1" /></bezel>
|
||||
<!-- a -->
|
||||
|
||||
<bezel name="1.0" element="led"><bounds x="2" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="1.1" element="led"><bounds x="2" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="1.2" element="led"><bounds x="2" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="1.3" element="led"><bounds x="2" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="1.4" element="led"><bounds x="2" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="1.5" element="led"><bounds x="2" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="1.6" element="led"><bounds x="2" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="1.7" element="led"><bounds x="2" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="1.8" element="led"><bounds x="2" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="1.9" element="led"><bounds x="2" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="1.10" element="led"><bounds x="2" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="1.11" element="led"><bounds x="2" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="1.12" element="led"><bounds x="2" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="1.13" element="led"><bounds x="2" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="1.14" element="led"><bounds x="2" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="1.15" element="led"><bounds x="2" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="0.0.0" element="led"><bounds x="0" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="0.1.0" element="led"><bounds x="0" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="0.2.0" element="led"><bounds x="0" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="0.3.0" element="led"><bounds x="0" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="0.4.0" element="led"><bounds x="0" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="0.5.0" element="led"><bounds x="0" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="0.6.0" element="led"><bounds x="0" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="0.7.0" element="led"><bounds x="0" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="0.8.0" element="led"><bounds x="0" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="0.9.0" element="led"><bounds x="0" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="0.10.0" element="led"><bounds x="0" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="0.11.0" element="led"><bounds x="0" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="0.12.0" element="led"><bounds x="0" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="0.13.0" element="led"><bounds x="0" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="0.14.0" element="led"><bounds x="0" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="0.15.0" element="led"><bounds x="0" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="2.0" element="led"><bounds x="4" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="2.1" element="led"><bounds x="4" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="2.2" element="led"><bounds x="4" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="2.3" element="led"><bounds x="4" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="2.4" element="led"><bounds x="4" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="2.5" element="led"><bounds x="4" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="2.6" element="led"><bounds x="4" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="2.7" element="led"><bounds x="4" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="2.8" element="led"><bounds x="4" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="2.9" element="led"><bounds x="4" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="2.10" element="led"><bounds x="4" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="2.11" element="led"><bounds x="4" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="2.12" element="led"><bounds x="4" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="2.13" element="led"><bounds x="4" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="2.14" element="led"><bounds x="4" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="2.15" element="led"><bounds x="4" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="0.0.1" element="led"><bounds x="2" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="0.1.1" element="led"><bounds x="2" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="0.2.1" element="led"><bounds x="2" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="0.3.1" element="led"><bounds x="2" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="0.4.1" element="led"><bounds x="2" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="0.5.1" element="led"><bounds x="2" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="0.6.1" element="led"><bounds x="2" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="0.7.1" element="led"><bounds x="2" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="0.8.1" element="led"><bounds x="2" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="0.9.1" element="led"><bounds x="2" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="0.10.1" element="led"><bounds x="2" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="0.11.1" element="led"><bounds x="2" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="0.12.1" element="led"><bounds x="2" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="0.13.1" element="led"><bounds x="2" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="0.14.1" element="led"><bounds x="2" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="0.15.1" element="led"><bounds x="2" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="3.0" element="led"><bounds x="6" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="3.1" element="led"><bounds x="6" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="3.2" element="led"><bounds x="6" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="3.3" element="led"><bounds x="6" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="3.4" element="led"><bounds x="6" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="3.5" element="led"><bounds x="6" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="3.6" element="led"><bounds x="6" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="3.7" element="led"><bounds x="6" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="3.8" element="led"><bounds x="6" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="3.9" element="led"><bounds x="6" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="3.10" element="led"><bounds x="6" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="3.11" element="led"><bounds x="6" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="3.12" element="led"><bounds x="6" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="3.13" element="led"><bounds x="6" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="3.14" element="led"><bounds x="6" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="3.15" element="led"><bounds x="6" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="0.0.2" element="led"><bounds x="4" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="0.1.2" element="led"><bounds x="4" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="0.2.2" element="led"><bounds x="4" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="0.3.2" element="led"><bounds x="4" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="0.4.2" element="led"><bounds x="4" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="0.5.2" element="led"><bounds x="4" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="0.6.2" element="led"><bounds x="4" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="0.7.2" element="led"><bounds x="4" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="0.8.2" element="led"><bounds x="4" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="0.9.2" element="led"><bounds x="4" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="0.10.2" element="led"><bounds x="4" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="0.11.2" element="led"><bounds x="4" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="0.12.2" element="led"><bounds x="4" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="0.13.2" element="led"><bounds x="4" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="0.14.2" element="led"><bounds x="4" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="0.15.2" element="led"><bounds x="4" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="4.0" element="led"><bounds x="8" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="4.1" element="led"><bounds x="8" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="4.2" element="led"><bounds x="8" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="4.3" element="led"><bounds x="8" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="4.4" element="led"><bounds x="8" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="4.5" element="led"><bounds x="8" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="4.6" element="led"><bounds x="8" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="4.7" element="led"><bounds x="8" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="4.8" element="led"><bounds x="8" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="4.9" element="led"><bounds x="8" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="4.10" element="led"><bounds x="8" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="4.11" element="led"><bounds x="8" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="4.12" element="led"><bounds x="8" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="4.13" element="led"><bounds x="8" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="4.14" element="led"><bounds x="8" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="4.15" element="led"><bounds x="8" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="0.0.3" element="led"><bounds x="6" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="0.1.3" element="led"><bounds x="6" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="0.2.3" element="led"><bounds x="6" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="0.3.3" element="led"><bounds x="6" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="0.4.3" element="led"><bounds x="6" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="0.5.3" element="led"><bounds x="6" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="0.6.3" element="led"><bounds x="6" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="0.7.3" element="led"><bounds x="6" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="0.8.3" element="led"><bounds x="6" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="0.9.3" element="led"><bounds x="6" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="0.10.3" element="led"><bounds x="6" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="0.11.3" element="led"><bounds x="6" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="0.12.3" element="led"><bounds x="6" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="0.13.3" element="led"><bounds x="6" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="0.14.3" element="led"><bounds x="6" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="0.15.3" element="led"><bounds x="6" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="5.0" element="led"><bounds x="10" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="5.1" element="led"><bounds x="10" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="5.2" element="led"><bounds x="10" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="5.3" element="led"><bounds x="10" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="5.4" element="led"><bounds x="10" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="5.5" element="led"><bounds x="10" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="5.6" element="led"><bounds x="10" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="5.7" element="led"><bounds x="10" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="5.8" element="led"><bounds x="10" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="5.9" element="led"><bounds x="10" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="5.10" element="led"><bounds x="10" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="5.11" element="led"><bounds x="10" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="5.12" element="led"><bounds x="10" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="5.13" element="led"><bounds x="10" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="5.14" element="led"><bounds x="10" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="5.15" element="led"><bounds x="10" y="30" width="1" height="1" /></bezel>
|
||||
<!-- b -->
|
||||
|
||||
<bezel name="6.0" element="led"><bounds x="12" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="6.1" element="led"><bounds x="12" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="6.2" element="led"><bounds x="12" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="6.3" element="led"><bounds x="12" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="6.4" element="led"><bounds x="12" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="6.5" element="led"><bounds x="12" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="6.6" element="led"><bounds x="12" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="6.7" element="led"><bounds x="12" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="6.8" element="led"><bounds x="12" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="6.9" element="led"><bounds x="12" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="6.10" element="led"><bounds x="12" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="6.11" element="led"><bounds x="12" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="6.12" element="led"><bounds x="12" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="6.13" element="led"><bounds x="12" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="6.14" element="led"><bounds x="12" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="6.15" element="led"><bounds x="12" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="1.0.0" element="led"><bounds x="10" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="1.1.0" element="led"><bounds x="10" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="1.2.0" element="led"><bounds x="10" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="1.3.0" element="led"><bounds x="10" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="1.4.0" element="led"><bounds x="10" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="1.5.0" element="led"><bounds x="10" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="1.6.0" element="led"><bounds x="10" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="1.7.0" element="led"><bounds x="10" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="1.8.0" element="led"><bounds x="10" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="1.9.0" element="led"><bounds x="10" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="1.10.0" element="led"><bounds x="10" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="1.11.0" element="led"><bounds x="10" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="1.12.0" element="led"><bounds x="10" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="1.13.0" element="led"><bounds x="10" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="1.14.0" element="led"><bounds x="10" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="1.15.0" element="led"><bounds x="10" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="7.0" element="led"><bounds x="14" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="7.1" element="led"><bounds x="14" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="7.2" element="led"><bounds x="14" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="7.3" element="led"><bounds x="14" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="7.4" element="led"><bounds x="14" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="7.5" element="led"><bounds x="14" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="7.6" element="led"><bounds x="14" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="7.7" element="led"><bounds x="14" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="7.8" element="led"><bounds x="14" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="7.9" element="led"><bounds x="14" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="7.10" element="led"><bounds x="14" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="7.11" element="led"><bounds x="14" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="7.12" element="led"><bounds x="14" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="7.13" element="led"><bounds x="14" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="7.14" element="led"><bounds x="14" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="7.15" element="led"><bounds x="14" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="1.0.1" element="led"><bounds x="12" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="1.1.1" element="led"><bounds x="12" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="1.2.1" element="led"><bounds x="12" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="1.3.1" element="led"><bounds x="12" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="1.4.1" element="led"><bounds x="12" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="1.5.1" element="led"><bounds x="12" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="1.6.1" element="led"><bounds x="12" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="1.7.1" element="led"><bounds x="12" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="1.8.1" element="led"><bounds x="12" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="1.9.1" element="led"><bounds x="12" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="1.10.1" element="led"><bounds x="12" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="1.11.1" element="led"><bounds x="12" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="1.12.1" element="led"><bounds x="12" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="1.13.1" element="led"><bounds x="12" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="1.14.1" element="led"><bounds x="12" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="1.15.1" element="led"><bounds x="12" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="8.0" element="led"><bounds x="16" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="8.1" element="led"><bounds x="16" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="8.2" element="led"><bounds x="16" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="8.3" element="led"><bounds x="16" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="8.4" element="led"><bounds x="16" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="8.5" element="led"><bounds x="16" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="8.6" element="led"><bounds x="16" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="8.7" element="led"><bounds x="16" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="8.8" element="led"><bounds x="16" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="8.9" element="led"><bounds x="16" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="8.10" element="led"><bounds x="16" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="8.11" element="led"><bounds x="16" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="8.12" element="led"><bounds x="16" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="8.13" element="led"><bounds x="16" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="8.14" element="led"><bounds x="16" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="8.15" element="led"><bounds x="16" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="1.0.2" element="led"><bounds x="14" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="1.1.2" element="led"><bounds x="14" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="1.2.2" element="led"><bounds x="14" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="1.3.2" element="led"><bounds x="14" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="1.4.2" element="led"><bounds x="14" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="1.5.2" element="led"><bounds x="14" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="1.6.2" element="led"><bounds x="14" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="1.7.2" element="led"><bounds x="14" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="1.8.2" element="led"><bounds x="14" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="1.9.2" element="led"><bounds x="14" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="1.10.2" element="led"><bounds x="14" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="1.11.2" element="led"><bounds x="14" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="1.12.2" element="led"><bounds x="14" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="1.13.2" element="led"><bounds x="14" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="1.14.2" element="led"><bounds x="14" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="1.15.2" element="led"><bounds x="14" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="9.0" element="led"><bounds x="18" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="9.1" element="led"><bounds x="18" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="9.2" element="led"><bounds x="18" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="9.3" element="led"><bounds x="18" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="9.4" element="led"><bounds x="18" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="9.5" element="led"><bounds x="18" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="9.6" element="led"><bounds x="18" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="9.7" element="led"><bounds x="18" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="9.8" element="led"><bounds x="18" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="9.9" element="led"><bounds x="18" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="9.10" element="led"><bounds x="18" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="9.11" element="led"><bounds x="18" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="9.12" element="led"><bounds x="18" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="9.13" element="led"><bounds x="18" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="9.14" element="led"><bounds x="18" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="9.15" element="led"><bounds x="18" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="1.0.3" element="led"><bounds x="16" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="1.1.3" element="led"><bounds x="16" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="1.2.3" element="led"><bounds x="16" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="1.3.3" element="led"><bounds x="16" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="1.4.3" element="led"><bounds x="16" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="1.5.3" element="led"><bounds x="16" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="1.6.3" element="led"><bounds x="16" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="1.7.3" element="led"><bounds x="16" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="1.8.3" element="led"><bounds x="16" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="1.9.3" element="led"><bounds x="16" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="1.10.3" element="led"><bounds x="16" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="1.11.3" element="led"><bounds x="16" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="1.12.3" element="led"><bounds x="16" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="1.13.3" element="led"><bounds x="16" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="1.14.3" element="led"><bounds x="16" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="1.15.3" element="led"><bounds x="16" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="10.0" element="led"><bounds x="20" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="10.1" element="led"><bounds x="20" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="10.2" element="led"><bounds x="20" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="10.3" element="led"><bounds x="20" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="10.4" element="led"><bounds x="20" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="10.5" element="led"><bounds x="20" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="10.6" element="led"><bounds x="20" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="10.7" element="led"><bounds x="20" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="10.8" element="led"><bounds x="20" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="10.9" element="led"><bounds x="20" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="10.10" element="led"><bounds x="20" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="10.11" element="led"><bounds x="20" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="10.12" element="led"><bounds x="20" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="10.13" element="led"><bounds x="20" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="10.14" element="led"><bounds x="20" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="10.15" element="led"><bounds x="20" y="30" width="1" height="1" /></bezel>
|
||||
<!-- bs -->
|
||||
|
||||
<bezel name="11.0" element="led"><bounds x="22" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="11.1" element="led"><bounds x="22" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="11.2" element="led"><bounds x="22" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="11.3" element="led"><bounds x="22" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="11.4" element="led"><bounds x="22" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="11.5" element="led"><bounds x="22" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="11.6" element="led"><bounds x="22" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="11.7" element="led"><bounds x="22" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="11.8" element="led"><bounds x="22" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="11.9" element="led"><bounds x="22" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="11.10" element="led"><bounds x="22" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="11.11" element="led"><bounds x="22" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="11.12" element="led"><bounds x="22" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="11.13" element="led"><bounds x="22" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="11.14" element="led"><bounds x="22" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="11.15" element="led"><bounds x="22" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="2.0.0" element="led"><bounds x="20" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="2.1.0" element="led"><bounds x="20" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="2.2.0" element="led"><bounds x="20" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="2.3.0" element="led"><bounds x="20" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="2.4.0" element="led"><bounds x="20" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="2.5.0" element="led"><bounds x="20" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="2.6.0" element="led"><bounds x="20" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="2.7.0" element="led"><bounds x="20" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="2.8.0" element="led"><bounds x="20" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="2.9.0" element="led"><bounds x="20" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="2.10.0" element="led"><bounds x="20" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="2.11.0" element="led"><bounds x="20" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="2.12.0" element="led"><bounds x="20" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="2.13.0" element="led"><bounds x="20" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="2.14.0" element="led"><bounds x="20" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="2.15.0" element="led"><bounds x="20" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="12.0" element="led"><bounds x="24" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="12.1" element="led"><bounds x="24" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="12.2" element="led"><bounds x="24" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="12.3" element="led"><bounds x="24" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="12.4" element="led"><bounds x="24" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="12.5" element="led"><bounds x="24" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="12.6" element="led"><bounds x="24" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="12.7" element="led"><bounds x="24" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="12.8" element="led"><bounds x="24" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="12.9" element="led"><bounds x="24" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="12.10" element="led"><bounds x="24" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="12.11" element="led"><bounds x="24" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="12.12" element="led"><bounds x="24" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="12.13" element="led"><bounds x="24" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="12.14" element="led"><bounds x="24" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="12.15" element="led"><bounds x="24" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="2.0.1" element="led"><bounds x="22" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="2.1.1" element="led"><bounds x="22" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="2.2.1" element="led"><bounds x="22" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="2.3.1" element="led"><bounds x="22" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="2.4.1" element="led"><bounds x="22" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="2.5.1" element="led"><bounds x="22" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="2.6.1" element="led"><bounds x="22" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="2.7.1" element="led"><bounds x="22" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="2.8.1" element="led"><bounds x="22" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="2.9.1" element="led"><bounds x="22" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="2.10.1" element="led"><bounds x="22" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="2.11.1" element="led"><bounds x="22" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="2.12.1" element="led"><bounds x="22" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="2.13.1" element="led"><bounds x="22" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="2.14.1" element="led"><bounds x="22" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="2.15.1" element="led"><bounds x="22" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="13.0" element="led"><bounds x="26" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="13.1" element="led"><bounds x="26" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="13.2" element="led"><bounds x="26" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="13.3" element="led"><bounds x="26" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="13.4" element="led"><bounds x="26" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="13.5" element="led"><bounds x="26" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="13.6" element="led"><bounds x="26" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="13.7" element="led"><bounds x="26" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="13.8" element="led"><bounds x="26" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="13.9" element="led"><bounds x="26" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="13.10" element="led"><bounds x="26" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="13.11" element="led"><bounds x="26" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="13.12" element="led"><bounds x="26" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="13.13" element="led"><bounds x="26" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="13.14" element="led"><bounds x="26" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="13.15" element="led"><bounds x="26" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="2.0.2" element="led"><bounds x="24" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="2.1.2" element="led"><bounds x="24" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="2.2.2" element="led"><bounds x="24" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="2.3.2" element="led"><bounds x="24" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="2.4.2" element="led"><bounds x="24" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="2.5.2" element="led"><bounds x="24" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="2.6.2" element="led"><bounds x="24" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="2.7.2" element="led"><bounds x="24" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="2.8.2" element="led"><bounds x="24" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="2.9.2" element="led"><bounds x="24" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="2.10.2" element="led"><bounds x="24" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="2.11.2" element="led"><bounds x="24" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="2.12.2" element="led"><bounds x="24" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="2.13.2" element="led"><bounds x="24" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="2.14.2" element="led"><bounds x="24" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="2.15.2" element="led"><bounds x="24" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="14.0" element="led"><bounds x="28" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="14.1" element="led"><bounds x="28" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="14.2" element="led"><bounds x="28" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="14.3" element="led"><bounds x="28" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="14.4" element="led"><bounds x="28" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="14.5" element="led"><bounds x="28" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="14.6" element="led"><bounds x="28" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="14.7" element="led"><bounds x="28" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="14.8" element="led"><bounds x="28" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="14.9" element="led"><bounds x="28" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="14.10" element="led"><bounds x="28" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="14.11" element="led"><bounds x="28" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="14.12" element="led"><bounds x="28" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="14.13" element="led"><bounds x="28" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="14.14" element="led"><bounds x="28" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="14.15" element="led"><bounds x="28" y="30" width="1" height="1" /></bezel>
|
||||
<bezel name="2.0.3" element="led"><bounds x="26" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="2.1.3" element="led"><bounds x="26" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="2.2.3" element="led"><bounds x="26" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="2.3.3" element="led"><bounds x="26" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="2.4.3" element="led"><bounds x="26" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="2.5.3" element="led"><bounds x="26" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="2.6.3" element="led"><bounds x="26" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="2.7.3" element="led"><bounds x="26" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="2.8.3" element="led"><bounds x="26" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="2.9.3" element="led"><bounds x="26" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="2.10.3" element="led"><bounds x="26" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="2.11.3" element="led"><bounds x="26" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="2.12.3" element="led"><bounds x="26" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="2.13.3" element="led"><bounds x="26" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="2.14.3" element="led"><bounds x="26" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="2.15.3" element="led"><bounds x="26" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="15.0" element="led"><bounds x="30" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="15.1" element="led"><bounds x="30" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="15.2" element="led"><bounds x="30" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="15.3" element="led"><bounds x="30" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="15.4" element="led"><bounds x="30" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="15.5" element="led"><bounds x="30" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="15.6" element="led"><bounds x="30" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="15.7" element="led"><bounds x="30" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="15.8" element="led"><bounds x="30" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="15.9" element="led"><bounds x="30" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="15.10" element="led"><bounds x="30" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="15.11" element="led"><bounds x="30" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="15.12" element="led"><bounds x="30" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="15.13" element="led"><bounds x="30" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="15.14" element="led"><bounds x="30" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="15.15" element="led"><bounds x="30" y="30" width="1" height="1" /></bezel>
|
||||
<!-- c -->
|
||||
|
||||
<bezel name="3.0.0" element="led"><bounds x="30" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="3.1.0" element="led"><bounds x="30" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="3.2.0" element="led"><bounds x="30" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="3.3.0" element="led"><bounds x="30" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="3.4.0" element="led"><bounds x="30" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="3.5.0" element="led"><bounds x="30" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="3.6.0" element="led"><bounds x="30" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="3.7.0" element="led"><bounds x="30" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="3.8.0" element="led"><bounds x="30" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="3.9.0" element="led"><bounds x="30" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="3.10.0" element="led"><bounds x="30" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="3.11.0" element="led"><bounds x="30" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="3.12.0" element="led"><bounds x="30" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="3.13.0" element="led"><bounds x="30" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="3.14.0" element="led"><bounds x="30" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="3.15.0" element="led"><bounds x="30" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="3.0.1" element="led"><bounds x="32" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="3.1.1" element="led"><bounds x="32" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="3.2.1" element="led"><bounds x="32" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="3.3.1" element="led"><bounds x="32" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="3.4.1" element="led"><bounds x="32" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="3.5.1" element="led"><bounds x="32" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="3.6.1" element="led"><bounds x="32" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="3.7.1" element="led"><bounds x="32" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="3.8.1" element="led"><bounds x="32" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="3.9.1" element="led"><bounds x="32" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="3.10.1" element="led"><bounds x="32" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="3.11.1" element="led"><bounds x="32" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="3.12.1" element="led"><bounds x="32" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="3.13.1" element="led"><bounds x="32" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="3.14.1" element="led"><bounds x="32" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="3.15.1" element="led"><bounds x="32" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="3.0.2" element="led"><bounds x="34" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="3.1.2" element="led"><bounds x="34" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="3.2.2" element="led"><bounds x="34" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="3.3.2" element="led"><bounds x="34" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="3.4.2" element="led"><bounds x="34" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="3.5.2" element="led"><bounds x="34" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="3.6.2" element="led"><bounds x="34" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="3.7.2" element="led"><bounds x="34" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="3.8.2" element="led"><bounds x="34" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="3.9.2" element="led"><bounds x="34" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="3.10.2" element="led"><bounds x="34" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="3.11.2" element="led"><bounds x="34" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="3.12.2" element="led"><bounds x="34" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="3.13.2" element="led"><bounds x="34" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="3.14.2" element="led"><bounds x="34" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="3.15.2" element="led"><bounds x="34" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="3.0.3" element="led"><bounds x="36" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="3.1.3" element="led"><bounds x="36" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="3.2.3" element="led"><bounds x="36" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="3.3.3" element="led"><bounds x="36" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="3.4.3" element="led"><bounds x="36" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="3.5.3" element="led"><bounds x="36" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="3.6.3" element="led"><bounds x="36" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="3.7.3" element="led"><bounds x="36" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="3.8.3" element="led"><bounds x="36" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="3.9.3" element="led"><bounds x="36" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="3.10.3" element="led"><bounds x="36" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="3.11.3" element="led"><bounds x="36" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="3.12.3" element="led"><bounds x="36" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="3.13.3" element="led"><bounds x="36" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="3.14.3" element="led"><bounds x="36" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="3.15.3" element="led"><bounds x="36" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
</view>
|
||||
</mamelayout>
|
||||
|
@ -213,22 +213,6 @@ void angelkds_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
|
||||
}
|
||||
|
||||
|
||||
/*** Palette Handling
|
||||
|
||||
4 bits of Red, 4 bits of Green, 4 bits of Blue
|
||||
|
||||
*/
|
||||
|
||||
WRITE8_MEMBER(angelkds_state::angelkds_paletteram_w)
|
||||
{
|
||||
int no;
|
||||
|
||||
m_paletteram[offset] = data;
|
||||
|
||||
no = offset & 0xff;
|
||||
m_palette->set_pen_color(no, pal4bit(m_paletteram[no]), pal4bit(m_paletteram[no]>>4), pal4bit(m_paletteram[no + 0x100]));
|
||||
}
|
||||
|
||||
/*** Video Start & Update
|
||||
|
||||
*/
|
||||
|
@ -203,10 +203,8 @@ osd_font_sdl::TTF_Font_ptr osd_font_sdl::TTF_OpenFont_Magic(std::string const &n
|
||||
auto const bytes_read = file.read(buffer, sizeof(buffer));
|
||||
file.close();
|
||||
|
||||
if ((bytes_read >= sizeof(ttf_magic)) && !std::memcmp(buffer, ttf_magic, sizeof(ttf_magic)))
|
||||
return TTF_Font_ptr(TTF_OpenFont(name.c_str(), POINT_SIZE), &TTF_CloseFont);
|
||||
|
||||
if (((bytes_read >= sizeof(ttc1_magic)) && !std::memcmp(buffer, ttc1_magic, sizeof(ttc1_magic))) ||
|
||||
if (((bytes_read >= sizeof(ttf_magic)) && !std::memcmp(buffer, ttf_magic, sizeof(ttf_magic))) ||
|
||||
((bytes_read >= sizeof(ttc1_magic)) && !std::memcmp(buffer, ttc1_magic, sizeof(ttc1_magic))) ||
|
||||
((bytes_read >= sizeof(ttc2_magic)) && !std::memcmp(buffer, ttc2_magic, sizeof(ttc2_magic))))
|
||||
return TTF_Font_ptr(TTF_OpenFontIndex(name.c_str(), POINT_SIZE, index), &TTF_CloseFont);
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ public:
|
||||
{
|
||||
m_file.reset();
|
||||
m_lastfile = m_info.track[tracknum].fname;
|
||||
osd_file::error filerr = util::core_file::open(m_lastfile.c_str(), OPEN_FLAG_READ, m_file);
|
||||
osd_file::error filerr = util::core_file::open(m_lastfile, OPEN_FLAG_READ, m_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Error opening input file (%s)'", m_lastfile.c_str());
|
||||
}
|
||||
@ -1574,7 +1574,7 @@ static void do_create_raw(parameters_t ¶ms)
|
||||
auto input_file_str = params.find(OPTION_INPUT);
|
||||
if (input_file_str != params.end())
|
||||
{
|
||||
osd_file::error filerr = util::core_file::open(input_file_str->second->c_str(), OPEN_FLAG_READ, input_file);
|
||||
osd_file::error filerr = util::core_file::open(*input_file_str->second, OPEN_FLAG_READ, input_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Unable to open file (%s)", input_file_str->second->c_str());
|
||||
}
|
||||
@ -1671,7 +1671,7 @@ static void do_create_hd(parameters_t ¶ms)
|
||||
auto input_file_str = params.find(OPTION_INPUT);
|
||||
if (input_file_str != params.end())
|
||||
{
|
||||
osd_file::error filerr = util::core_file::open(input_file_str->second->c_str(), OPEN_FLAG_READ, input_file);
|
||||
osd_file::error filerr = util::core_file::open(*input_file_str->second, OPEN_FLAG_READ, input_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Unable to open file (%s)", input_file_str->second->c_str());
|
||||
}
|
||||
@ -2240,7 +2240,7 @@ static void do_extract_raw(parameters_t ¶ms)
|
||||
try
|
||||
{
|
||||
// process output file
|
||||
osd_file::error filerr = util::core_file::open(output_file_str->second->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_file);
|
||||
osd_file::error filerr = util::core_file::open(*output_file_str->second, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Unable to open file (%s)", output_file_str->second->c_str());
|
||||
|
||||
@ -2345,14 +2345,14 @@ static void do_extract_cd(parameters_t ¶ms)
|
||||
}
|
||||
|
||||
// process output file
|
||||
osd_file::error filerr = util::core_file::open(output_file_str->second->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, output_toc_file);
|
||||
osd_file::error filerr = util::core_file::open(*output_file_str->second, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, output_toc_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Unable to open file (%s)", output_file_str->second->c_str());
|
||||
|
||||
// process output BIN file
|
||||
if (mode != MODE_GDI)
|
||||
{
|
||||
filerr = util::core_file::open(output_bin_file_str->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_bin_file);
|
||||
filerr = util::core_file::open(*output_bin_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_bin_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Unable to open file (%s)", output_bin_file_str->c_str());
|
||||
}
|
||||
@ -2388,7 +2388,7 @@ static void do_extract_cd(parameters_t ¶ms)
|
||||
|
||||
output_bin_file.reset();
|
||||
|
||||
filerr = util::core_file::open(trackbin_name.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_bin_file);
|
||||
filerr = util::core_file::open(trackbin_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_bin_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Unable to open file (%s)", trackbin_name.c_str());
|
||||
|
||||
@ -2795,7 +2795,7 @@ static void do_dump_metadata(parameters_t ¶ms)
|
||||
// create the file
|
||||
if (output_file_str != params.end())
|
||||
{
|
||||
osd_file::error filerr = util::core_file::open(output_file_str->second->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_file);
|
||||
osd_file::error filerr = util::core_file::open(*output_file_str->second, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, output_file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
report_error(1, "Unable to open file (%s)", output_file_str->second->c_str());
|
||||
|
||||
|
@ -104,24 +104,23 @@ static imgtool_stream *stream_open_zip(const char *zipname, const char *subname,
|
||||
|
||||
imgfile->imgtype = IMG_MEM;
|
||||
|
||||
zip_file::ptr z;
|
||||
const zip_file::file_header *zipent = nullptr;
|
||||
zip_file::open(zipname, z);
|
||||
util::archive_file::ptr z;
|
||||
util::archive_file::open_zip(zipname, z);
|
||||
if (!z)
|
||||
return nullptr;
|
||||
|
||||
zipent = z->first_file();
|
||||
while (zipent && subname && strcmp(subname, zipent->filename))
|
||||
int zipent = z->first_file();
|
||||
while ((zipent >= 0) && subname && strcmp(subname, z->current_name().c_str()))
|
||||
zipent = z->next_file();
|
||||
if (!zipent)
|
||||
if (zipent < 0)
|
||||
return nullptr;
|
||||
|
||||
imgfile->filesize = zipent->uncompressed_length;
|
||||
imgfile->buffer = reinterpret_cast<std::uint8_t *>(malloc(zipent->uncompressed_length));
|
||||
imgfile->filesize = z->current_uncompressed_length();
|
||||
imgfile->buffer = reinterpret_cast<std::uint8_t *>(malloc(z->current_uncompressed_length()));
|
||||
if (!imgfile->buffer)
|
||||
return nullptr;
|
||||
|
||||
if (z->decompress(imgfile->buffer, zipent->uncompressed_length) != zip_file::error::NONE)
|
||||
if (z->decompress(imgfile->buffer, z->current_uncompressed_length()) != util::archive_file::error::NONE)
|
||||
return nullptr;
|
||||
|
||||
return imgfile.release();
|
||||
|
@ -80,7 +80,7 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img
|
||||
int x, y;
|
||||
|
||||
/* open the source image */
|
||||
filerr = util::core_file::open(imgfile1.c_str(), OPEN_FLAG_READ, file);
|
||||
filerr = util::core_file::open(imgfile1, OPEN_FLAG_READ, file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
printf("Could not open %s (%d)\n", imgfile1.c_str(), int(filerr));
|
||||
@ -97,7 +97,7 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img
|
||||
}
|
||||
|
||||
/* open the source image */
|
||||
filerr = util::core_file::open(imgfile2.c_str(), OPEN_FLAG_READ, file);
|
||||
filerr = util::core_file::open(imgfile2, OPEN_FLAG_READ, file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
printf("Could not open %s (%d)\n", imgfile2.c_str(), int(filerr));
|
||||
@ -170,7 +170,7 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img
|
||||
}
|
||||
|
||||
/* write the final PNG */
|
||||
filerr = util::core_file::open(outfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, file);
|
||||
filerr = util::core_file::open(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
printf("Could not open %s (%d)\n", outfilename.c_str(), int(filerr));
|
||||
|
@ -565,7 +565,7 @@ static util::core_file::ptr create_file_and_output_header(std::string &filename,
|
||||
util::core_file::ptr file;
|
||||
|
||||
/* create the indexfile */
|
||||
if (util::core_file::open(filename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, file) != osd_file::error::NONE)
|
||||
if (util::core_file::open(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, file) != osd_file::error::NONE)
|
||||
return util::core_file::ptr();
|
||||
|
||||
/* print a header */
|
||||
@ -735,7 +735,7 @@ static int compare_screenshots(summary_file *curfile)
|
||||
fullname = string_format("%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", lists[listnum].dir, curfile->name);
|
||||
|
||||
/* open the file */
|
||||
filerr = util::core_file::open(fullname.c_str(), OPEN_FLAG_READ, file);
|
||||
filerr = util::core_file::open(fullname, OPEN_FLAG_READ, file);
|
||||
|
||||
/* if that failed, look in the old location */
|
||||
if (filerr != osd_file::error::NONE)
|
||||
@ -744,7 +744,7 @@ static int compare_screenshots(summary_file *curfile)
|
||||
fullname = string_format("%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "_%s.png", lists[listnum].dir, curfile->name);
|
||||
|
||||
/* open the file */
|
||||
filerr = util::core_file::open(fullname.c_str(), OPEN_FLAG_READ, file);
|
||||
filerr = util::core_file::open(fullname, OPEN_FLAG_READ, file);
|
||||
}
|
||||
|
||||
/* if that worked, load the file */
|
||||
@ -853,7 +853,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
|
||||
tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str());
|
||||
|
||||
/* open the source image */
|
||||
filerr = util::core_file::open(tempname.c_str(), OPEN_FLAG_READ, file);
|
||||
filerr = util::core_file::open(tempname, OPEN_FLAG_READ, file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
goto error;
|
||||
|
||||
@ -925,7 +925,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
|
||||
}
|
||||
|
||||
/* write the final PNG */
|
||||
filerr = util::core_file::open(dstfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, file);
|
||||
filerr = util::core_file::open(dstfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, file);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
goto error;
|
||||
pngerr = png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr);
|
||||
|
@ -490,43 +490,45 @@ static int load_files(int i, int *found, const char *path)
|
||||
/* if not, try to open as a ZIP file */
|
||||
else
|
||||
{
|
||||
zip_file::ptr zip;
|
||||
const zip_file::file_header* zipent;
|
||||
zip_file::error ziperr;
|
||||
util::archive_file::ptr zip;
|
||||
|
||||
/* wasn't a directory, so try to open it as a zip file */
|
||||
ziperr = zip_file::open(path, zip);
|
||||
if (ziperr != zip_file::error::NONE)
|
||||
if ((util::archive_file::open_zip(path, zip) != util::archive_file::error::NONE) &&
|
||||
(util::archive_file::open_7z(path, zip) != util::archive_file::error::NONE))
|
||||
{
|
||||
printf("Error, cannot open zip file '%s' !\n", path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* load all files in zip file */
|
||||
for (zipent = zip->first_file(); zipent != nullptr; zipent = zip->next_file())
|
||||
for (int zipent = zip->first_file(); zipent >= 0; zipent = zip->next_file())
|
||||
{
|
||||
if (zip->current_is_directory()) continue;
|
||||
|
||||
int size;
|
||||
|
||||
size = zipent->uncompressed_length;
|
||||
size = zip->current_uncompressed_length();
|
||||
while (size && (size & 1) == 0) size >>= 1;
|
||||
if (zipent->uncompressed_length == 0) // || (size & ~1))
|
||||
if (zip->current_uncompressed_length() == 0) // || (size & ~1))
|
||||
{
|
||||
printf("%-23s %-23s ignored (not a ROM)\n",
|
||||
i ? "" : zipent->filename, i ? zipent->filename : "");
|
||||
i ? "" : zip->current_name().c_str(), i ? zip->current_name().c_str() : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileinfo *file = &files[i][found[i]];
|
||||
const char *delim = strrchr(zipent->filename,'/');
|
||||
const char *delim = strrchr(zip->current_name().c_str(), '/');
|
||||
|
||||
if (delim)
|
||||
strcpy (file->name,delim+1);
|
||||
else
|
||||
strcpy(file->name,zipent->filename);
|
||||
file->size = zipent->uncompressed_length;
|
||||
strcpy(file->name,zip->current_name().c_str());
|
||||
file->size = zip->current_uncompressed_length();
|
||||
if ((file->buf = (unsigned char *)malloc(file->size)) == nullptr)
|
||||
printf("%s: out of memory!\n",file->name);
|
||||
else
|
||||
{
|
||||
if (zip->decompress(file->buf, file->size) != zip_file::error::NONE)
|
||||
if (zip->decompress(file->buf, file->size) != util::archive_file::error::NONE)
|
||||
{
|
||||
free(file->buf);
|
||||
file->buf = nullptr;
|
||||
@ -743,6 +745,6 @@ int CLIB_DECL main(int argc,char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
zip_file::cache_clear();
|
||||
util::archive_file::cache_clear();
|
||||
return 0;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi
|
||||
splitfilename.assign(basename).append(".split");
|
||||
|
||||
// create the split file
|
||||
filerr = util::core_file::open(splitfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, splitfile);
|
||||
filerr = util::core_file::open(splitfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, splitfile);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
fprintf(stderr, "Fatal error: unable to create split file '%s'\n", splitfilename.c_str());
|
||||
@ -155,7 +155,7 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi
|
||||
outfilename = string_format("%s.%03d", basename, partnum);
|
||||
|
||||
// create it
|
||||
filerr = util::core_file::open(outfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, outfile);
|
||||
filerr = util::core_file::open(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, outfile);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
printf("\n");
|
||||
@ -267,7 +267,7 @@ static int join_file(const char *filename, const char *outname, int write_output
|
||||
if (write_output)
|
||||
{
|
||||
// don't overwrite the original!
|
||||
filerr = util::core_file::open(outfilename.c_str(), OPEN_FLAG_READ, outfile);
|
||||
filerr = util::core_file::open(outfilename, OPEN_FLAG_READ, outfile);
|
||||
if (filerr == osd_file::error::NONE)
|
||||
{
|
||||
outfile.reset();
|
||||
@ -276,7 +276,7 @@ static int join_file(const char *filename, const char *outname, int write_output
|
||||
}
|
||||
|
||||
// open the output for write
|
||||
filerr = util::core_file::open(outfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, outfile);
|
||||
filerr = util::core_file::open(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, outfile);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
fprintf(stderr, "Fatal error: unable to create file '%s'\n", outfilename.c_str());
|
||||
|
@ -517,7 +517,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, std::stri
|
||||
|
||||
// open the source file
|
||||
util::core_file::ptr src;
|
||||
if (util::core_file::open(srcfile.c_str(), OPEN_FLAG_READ, src) != osd_file::error::NONE)
|
||||
if (util::core_file::open(srcfile, OPEN_FLAG_READ, src) != osd_file::error::NONE)
|
||||
{
|
||||
fprintf(stderr, "Unable to read file '%s'\n", srcfile.c_str());
|
||||
return 1;
|
||||
@ -732,7 +732,7 @@ static util::core_file::ptr create_file_and_output_header(std::string &filename,
|
||||
{
|
||||
// create the indexfile
|
||||
util::core_file::ptr file;
|
||||
if (util::core_file::open(filename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, file) != osd_file::error::NONE)
|
||||
if (util::core_file::open(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, file) != osd_file::error::NONE)
|
||||
return util::core_file::ptr();
|
||||
|
||||
// print a header
|
||||
@ -865,7 +865,7 @@ static bool find_include_file(std::string &srcincpath, int srcrootlen, int dstro
|
||||
|
||||
// see if we can open it
|
||||
util::core_file::ptr testfile;
|
||||
if (util::core_file::open(srcincpath.c_str(), OPEN_FLAG_READ, testfile) == osd_file::error::NONE)
|
||||
if (util::core_file::open(srcincpath, OPEN_FLAG_READ, testfile) == osd_file::error::NONE)
|
||||
{
|
||||
// close the file
|
||||
testfile.reset();
|
||||
|
10
tests/emu/attotime.cpp
Normal file
10
tests/emu/attotime.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "emucore.h"
|
||||
#include "eminline.h"
|
||||
#include "attotime.h"
|
||||
|
||||
TEST(attotime,as_attoseconds)
|
||||
{
|
||||
attotime value = attotime::from_seconds(1);
|
||||
EXPECT_EQ(1000000000000000000, value.as_attoseconds());
|
||||
}
|
Loading…
Reference in New Issue
Block a user