trunk/src/emu/fileio.c
| r243496 | r243497 | |
| 141 | 141 | emu_file::emu_file(UINT32 openflags) |
| 142 | 142 | : m_file(NULL), |
| 143 | 143 | m_iterator(""), |
| 144 | | m_mediapaths(""), |
| 145 | 144 | m_crc(0), |
| 146 | 145 | m_openflags(openflags), |
| 147 | 146 | m_zipfile(NULL), |
| 148 | 147 | m_ziplength(0), |
| 149 | 148 | m__7zfile(NULL), |
| 150 | 149 | m__7zlength(0), |
| 151 | | m_remove_on_close(false), |
| 152 | | m_restrict_to_mediapath(false) |
| 150 | m_remove_on_close(false) |
| 153 | 151 | { |
| 154 | 152 | // sanity check the open flags |
| 155 | 153 | if ((m_openflags & OPEN_FLAG_HAS_CRC) && (m_openflags & OPEN_FLAG_WRITE)) |
| r243496 | r243497 | |
| 159 | 157 | emu_file::emu_file(const char *searchpath, UINT32 openflags) |
| 160 | 158 | : m_file(NULL), |
| 161 | 159 | m_iterator(searchpath), |
| 162 | | m_mediapaths(searchpath), |
| 163 | 160 | m_crc(0), |
| 164 | 161 | m_openflags(openflags), |
| 165 | 162 | m_zipfile(NULL), |
| 166 | 163 | m_ziplength(0), |
| 167 | 164 | m__7zfile(NULL), |
| 168 | 165 | m__7zlength(0), |
| 169 | | m_remove_on_close(false), |
| 170 | | m_restrict_to_mediapath(false) |
| 166 | m_remove_on_close(false) |
| 171 | 167 | { |
| 172 | 168 | // sanity check the open flags |
| 173 | 169 | if ((m_openflags & OPEN_FLAG_HAS_CRC) && (m_openflags & OPEN_FLAG_WRITE)) |
| r243496 | r243497 | |
| 358 | 354 | { |
| 359 | 355 | astring tempfullpath = m_fullpath; |
| 360 | 356 | |
| 361 | | filerr = attempt_zipped(); |
| 357 | filerr = attempt__7zped(); |
| 362 | 358 | if (filerr == FILERR_NONE) |
| 363 | 359 | break; |
| 364 | 360 | |
| 365 | 361 | m_fullpath = tempfullpath; |
| 366 | 362 | |
| 367 | | filerr = attempt__7zped(); |
| 363 | filerr = attempt_zipped(); |
| 368 | 364 | if (filerr == FILERR_NONE) |
| 369 | 365 | break; |
| 366 | |
| 367 | |
| 370 | 368 | } |
| 371 | 369 | } |
| 372 | 370 | return filerr; |
| r243496 | r243497 | |
| 652 | 650 | } |
| 653 | 651 | |
| 654 | 652 | |
| 655 | | //------------------------------------------------- |
| 656 | | // part_of_mediapath - checks if 'path' is part of |
| 657 | | // any media path |
| 658 | | //------------------------------------------------- |
| 659 | 653 | |
| 660 | | bool emu_file::part_of_mediapath(astring path) |
| 661 | | { |
| 662 | | bool result = false; |
| 663 | | astring mediapath; |
| 664 | | m_mediapaths.reset(); |
| 665 | | while (m_mediapaths.next(mediapath, NULL) && !result) |
| 666 | | if (path.cmpsubstr(mediapath, 0, mediapath.len())) |
| 667 | | result = true; |
| 668 | | return result; |
| 669 | | } |
| 670 | | |
| 671 | 654 | //------------------------------------------------- |
| 672 | 655 | // attempt_zipped - attempt to open a ZIPped file |
| 673 | 656 | //------------------------------------------------- |
| r243496 | r243497 | |
| 684 | 667 | if (dirsep == -1) |
| 685 | 668 | return FILERR_NOT_FOUND; |
| 686 | 669 | |
| 687 | | if (restrict_to_mediapath()) |
| 688 | | if ( !part_of_mediapath(m_fullpath) ) |
| 689 | | return FILERR_NOT_FOUND; |
| 690 | | |
| 691 | 670 | // insert the part from the right of the separator into the head of the filename |
| 692 | 671 | if (filename.len() > 0) |
| 693 | 672 | filename.ins(0, "/"); |
| r243496 | r243497 | |
| 819 | 798 | if (dirsep == -1) |
| 820 | 799 | return FILERR_NOT_FOUND; |
| 821 | 800 | |
| 822 | | if (restrict_to_mediapath()) |
| 823 | | if ( !part_of_mediapath(m_fullpath) ) |
| 824 | | return FILERR_NOT_FOUND; |
| 825 | | |
| 826 | 801 | // insert the part from the right of the separator into the head of the filename |
| 827 | 802 | if (filename.len() > 0) |
| 828 | 803 | filename.ins(0, "/"); |
trunk/src/emu/fileio.h
| r243496 | r243497 | |
| 97 | 97 | const char *fullpath() const { return m_fullpath; } |
| 98 | 98 | UINT32 openflags() const { return m_openflags; } |
| 99 | 99 | hash_collection &hashes(const char *types); |
| 100 | | bool restrict_to_mediapath() { return m_restrict_to_mediapath; } |
| 101 | | bool part_of_mediapath(astring path); |
| 102 | 100 | |
| 103 | 101 | // setters |
| 104 | 102 | void remove_on_close() { m_remove_on_close = true; } |
| 105 | 103 | void set_openflags(UINT32 openflags) { assert(m_file == NULL); m_openflags = openflags; } |
| 106 | | void set_restrict_to_mediapath(bool rtmp = true) { m_restrict_to_mediapath = rtmp; } |
| 107 | 104 | |
| 108 | 105 | // open/close |
| 109 | 106 | file_error open(const char *name); |
| r243496 | r243497 | |
| 154 | 151 | astring m_fullpath; // full filename |
| 155 | 152 | core_file * m_file; // core file pointer |
| 156 | 153 | path_iterator m_iterator; // iterator for paths |
| 157 | | path_iterator m_mediapaths; // media-path iterator |
| 158 | | UINT32 m_crc; // file's CRC |
| 154 | UINT32 m_crc; // iterator for paths |
| 159 | 155 | UINT32 m_openflags; // flags we used for the open |
| 160 | 156 | hash_collection m_hashes; // collection of hashes |
| 161 | 157 | |
| r243496 | r243497 | |
| 168 | 164 | UINT64 m__7zlength; // 7Z file length |
| 169 | 165 | |
| 170 | 166 | bool m_remove_on_close; // flag: remove the file when closing |
| 171 | | bool m_restrict_to_mediapath; // flag: restrict to paths inside the media-path |
| 172 | 167 | }; |
| 173 | 168 | |
| 174 | 169 | |
trunk/src/mame/drivers/igs_m027.c
| r243496 | r243497 | |
| 61 | 61 | DECLARE_DRIVER_INIT(gonefsh2); |
| 62 | 62 | DECLARE_DRIVER_INIT(sddz); |
| 63 | 63 | DECLARE_DRIVER_INIT(hauntedh); |
| 64 | | DECLARE_DRIVER_INIT(bigd2); |
| 64 | DECLARE_DRIVER_INIT(zhongguo); |
| 65 | 65 | DECLARE_DRIVER_INIT(klxyj); |
| 66 | 66 | DECLARE_DRIVER_INIT(fearless); |
| 67 | 67 | TILE_GET_INFO_MEMBER(get_tx_tilemap_tile_info); |
| r243496 | r243497 | |
| 569 | 569 | |
| 570 | 570 | /* |
| 571 | 571 | |
| 572 | | Big D2 |
| 572 | Zhong Guo Chu Da D |
| 573 | 573 | IGS, 2000 |
| 574 | 574 | |
| 575 | 575 | PCB Layout |
| r243496 | r243497 | |
| 612 | 612 | |
| 613 | 613 | */ |
| 614 | 614 | |
| 615 | | ROM_START( bigd2 ) |
| 615 | ROM_START( zhongguo ) |
| 616 | 616 | ROM_REGION( 0x04000, "maincpu", 0 ) |
| 617 | 617 | /* Internal rom of IGS027A ARM based MCU */ |
| 618 | | ROM_LOAD( "bigd2_igs027a", 0x00000, 0x4000, NO_DUMP ) |
| 618 | ROM_LOAD( "zhongguo_igs027a", 0x00000, 0x4000, NO_DUMP ) |
| 619 | 619 | |
| 620 | 620 | ROM_REGION( 0x80000, "user1", 0 ) // external ARM data / prg |
| 621 | 621 | ROM_LOAD( "p2600.u10", 0x000000, 0x80000, CRC(9ad34135) SHA1(54717753d1296efe49946369fd4a27181f19dbc0) ) |
| r243496 | r243497 | |
| 953 | 953 | pgm_create_dummy_internal_arm_region(); |
| 954 | 954 | } |
| 955 | 955 | |
| 956 | | DRIVER_INIT_MEMBER(igs_m027_state,bigd2) |
| 956 | DRIVER_INIT_MEMBER(igs_m027_state,zhongguo) |
| 957 | 957 | { |
| 958 | | big2_decrypt(machine()); |
| 958 | zhongguo_decrypt(machine()); |
| 959 | 959 | //sdwx_gfx_decrypt(machine()); |
| 960 | 960 | pgm_create_dummy_internal_arm_region(); |
| 961 | 961 | } |
| r243496 | r243497 | |
| 968 | 968 | |
| 969 | 969 | GAME( 2002, sdwx, 0, igs_majhong, sdwx, igs_m027_state, sdwx, ROT0, "IGS", "Sheng Dan Wu Xian", GAME_IS_SKELETON ) // aka Christmas 5 Line? |
| 970 | 970 | GAME( 200?, sddz, 0, igs_majhong, sdwx, igs_m027_state, sddz, ROT0, "IGS", "Super Dou Di Zhu", GAME_IS_SKELETON ) |
| 971 | | GAME( 2000, bigd2, 0, igs_majhong, sdwx, igs_m027_state, bigd2, ROT0, "IGS", "Big D2", GAME_IS_SKELETON ) |
| 971 | GAME( 2000, zhongguo, 0, igs_majhong, sdwx, igs_m027_state, zhongguo, ROT0, "IGS", "Zhong Guo Chu Da D", GAME_IS_SKELETON ) |
| 972 | 972 | GAME( 200?, lhzb3, 0, igs_majhong, sdwx, igs_m027_state, lhzb3, ROT0, "IGS", "Long Hu Zheng Ba 3", GAME_IS_SKELETON ) |
| 973 | 973 | GAME( 200?, lhzb4, 0, igs_majhong, sdwx, igs_m027_state, lhzb4, ROT0, "IGS", "Long Hu Zheng Ba 4", GAME_IS_SKELETON ) |
| 974 | 974 | GAME( 200?, klxyj, 0, igs_majhong, sdwx, igs_m027_state, klxyj, ROT0, "IGS", "Kuai Le Xi You Ji", GAME_IS_SKELETON ) |