Skip mame bios/devices

This commit is contained in:
Rael Gugelmin Cunha 2018-05-09 22:29:46 -03:00
parent 6469ce2cbb
commit 065fd8edf1
8 changed files with 590 additions and 12 deletions

View file

@ -196,6 +196,16 @@ std::string FileData::getKey() {
return getFileName();
}
const bool FileData::isArcadeAsset()
{
const std::string stem = Utils::FileSystem::getStem(mPath);
return (
(mSystem && (mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO)))
&&
(MameNames::getInstance()->isBios(stem) || MameNames::getInstance()->isDevice(stem))
);
}
FileData* FileData::getSourceFileData()
{
return this;

View file

@ -61,6 +61,7 @@ public:
virtual inline void refreshMetadata() { return; };
virtual std::string getKey();
const bool isArcadeAsset();
inline std::string getFullPath() { return getPath(); };
inline std::string getFileName() { return Utils::FileSystem::getFileName(getPath()); };
virtual FileData* getSourceFileData();

View file

@ -48,7 +48,12 @@ FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType
}
FileData* file = new FileData(type, path, system->getSystemEnvData(), system);
treeNode->addChild(file);
// skipping arcade assets from gamelist
if(!file->isArcadeAsset())
{
treeNode->addChild(file);
}
return file;
}
@ -124,16 +129,17 @@ void parseGamelist(SystemData* system)
LOG(LogError) << "Error finding/creating FileData for \"" << path << "\", skipping.";
continue;
}
else if(!file->isArcadeAsset())
{
std::string defaultName = file->metadata.get("name");
file->metadata = MetaDataList::createFromXML(GAME_METADATA, fileNode, relativeTo);
//load the metadata
std::string defaultName = file->metadata.get("name");
file->metadata = MetaDataList::createFromXML(GAME_METADATA, fileNode, relativeTo);
//make sure name gets set if one didn't exist
if(file->metadata.get("name").empty())
file->metadata.set("name", defaultName);
//make sure name gets set if one didn't exist
if(file->metadata.get("name").empty())
file->metadata.set("name", defaultName);
file->metadata.resetChangedFlag();
file->metadata.resetChangedFlag();
}
}
}
}

View file

@ -112,8 +112,13 @@ void SystemData::populateFolder(FileData* folder)
continue;
FileData* newGame = new FileData(GAME, filePath, mEnvData, this);
folder->addChild(newGame);
isGame = true;
// preventing new arcade assets to be added
if(!newGame->isArcadeAsset())
{
folder->addChild(newGame);
isGame = true;
}
}
//add directories that also do not match an extension as folders

View file

@ -57,6 +57,50 @@ MameNames::MameNames()
NamePair namePair = { gameNode.child("mamename").text().get(), gameNode.child("realname").text().get() };
mNamePairs.push_back(namePair);
}
// Read bios
xmlpath = ResourceManager::getInstance()->getResourcePath(":/mamebioses.xml");
if(!Utils::FileSystem::exists(xmlpath))
return;
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
result = doc.load_file(xmlpath.c_str());
if(!result)
{
LOG(LogError) << "Error parsing XML file \"" << xmlpath << "\"!\n " << result.description();
return;
}
for(pugi::xml_node biosNode = doc.child("bios"); biosNode; biosNode = biosNode.next_sibling("bios"))
{
std::string bios = biosNode.text().get();
mMameBioses.push_back(bios);
}
// Read devices
xmlpath = ResourceManager::getInstance()->getResourcePath(":/mamedevices.xml");
if(!Utils::FileSystem::exists(xmlpath))
return;
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
result = doc.load_file(xmlpath.c_str());
if(!result)
{
LOG(LogError) << "Error parsing XML file \"" << xmlpath << "\"!\n " << result.description();
return;
}
for(pugi::xml_node deviceNode = doc.child("device"); deviceNode; deviceNode = deviceNode.next_sibling("device"))
{
std::string device = deviceNode.text().get();
mMameDevices.push_back(device);
}
} // MameNames
@ -83,3 +127,34 @@ std::string MameNames::getRealName(const std::string& _mameName)
return _mameName;
} // getRealName
const bool MameNames::isBios(const std::string& _biosName)
{
return MameNames::find(mMameBioses, _biosName);
} // isBios
const bool MameNames::isDevice(const std::string& _deviceName)
{
return MameNames::find(mMameDevices, _deviceName);
} // isDevice
const bool MameNames::find(std::vector<std::string> devices, const std::string& name)
{
size_t start = 0;
size_t end = devices.size();
while(start < end)
{
const size_t index = (start + end) / 2;
const int compare = strcmp(devices[index].c_str(), name.c_str());
if(compare < 0) start = index + 1;
else if( compare > 0) end = index;
else return true;
}
return false;
}

View file

@ -13,6 +13,8 @@ public:
static void deinit ();
static MameNames* getInstance();
std::string getRealName(const std::string& _mameName);
const bool isBios(const std::string& _biosName);
const bool isDevice(const std::string& _deviceName);
private:
@ -29,7 +31,11 @@ private:
static MameNames* sInstance;
namePairVector mNamePairs;
namePairVector mNamePairs;
std::vector<std::string> mMameBioses;
std::vector<std::string> mMameDevices;
const bool find(const std::vector<std::string> devices, const std::string& name);
}; // MameNames

71
resources/mamebioses.xml Normal file
View file

@ -0,0 +1,71 @@
<bios>3dobios</bios>
<bios>airlbios</bios>
<bios>aleck64</bios>
<bios>alg_bios</bios>
<bios>allied</bios>
<bios>ar_bios</bios>
<bios>aristmk5</bios>
<bios>aristmk6</bios>
<bios>atarisy1</bios>
<bios>awbios</bios>
<bios>bubsys</bios>
<bios>cdibios</bios>
<bios>cedmag</bios>
<bios>chihiro</bios>
<bios>coh1000a</bios>
<bios>coh1000c</bios>
<bios>coh1000t</bios>
<bios>coh1000w</bios>
<bios>coh1001l</bios>
<bios>coh1002e</bios>
<bios>coh1002m</bios>
<bios>coh1002v</bios>
<bios>coh3002c</bios>
<bios>coh3002t</bios>
<bios>crysbios</bios>
<bios>cubo</bios>
<bios>decocass</bios>
<bios>f355bios</bios>
<bios>f355dlx</bios>
<bios>galgbios</bios>
<bios>gp_110</bios>
<bios>gq863</bios>
<bios>gts1</bios>
<bios>gts1s</bios>
<bios>hikaru</bios>
<bios>hng64</bios>
<bios>hod2bios</bios>
<bios>isgsm</bios>
<bios>iteagle</bios>
<bios>konamigv</bios>
<bios>konamigx</bios>
<bios>kviper</bios>
<bios>lindbios</bios>
<bios>list.txt</bios>
<bios>macsbios</bios>
<bios>maxaflex</bios>
<bios>megaplay</bios>
<bios>megatech</bios>
<bios>naomi2</bios>
<bios>naomi</bios>
<bios>naomigd</bios>
<bios>neogeo</bios>
<bios>nss</bios>
<bios>pgm</bios>
<bios>playch10</bios>
<bios>pyson</bios>
<bios>sammymdl</bios>
<bios>segasp</bios>
<bios>sfcbox</bios>
<bios>shtzone</bios>
<bios>skns</bios>
<bios>stvbios</bios>
<bios>su2000</bios>
<bios>sys246</bios>
<bios>sys256</bios>
<bios>sys573</bios>
<bios>taitotz</bios>
<bios>tourvis</bios>
<bios>triforce</bios>
<bios>v4bios</bios>

404
resources/mamedevices.xml Normal file
View file

@ -0,0 +1,404 @@
<device>22vp931</device>
<device>3c505</device>
<device>a1cass</device>
<device>a2091</device>
<device>a2ap16</device>
<device>a2ap16a</device>
<device>a2aplcrd</device>
<device>a2cffa02</device>
<device>a2cffa2</device>
<device>a2corvus</device>
<device>a2diskii</device>
<device>a2diskiing</device>
<device>a2hsscsi</device>
<device>a2iwm_flop</device>
<device>a2memexp</device>
<device>a2mouse</device>
<device>a2pic</device>
<device>a2ramfac</device>
<device>a2scsi</device>
<device>a2ssc</device>
<device>a2swyft</device>
<device>a2thunpl</device>
<device>a2tmstho</device>
<device>a2ultrme</device>
<device>a2ulttrm</device>
<device>a2vidtrm</device>
<device>a2vtc1</device>
<device>a2vtc2</device>
<device>a2vulcan</device>
<device>a2vulgld</device>
<device>a2zipdrv</device>
<device>a3fdc</device>
<device>a590</device>
<device>abc1600mac</device>
<device>abc1600mover</device>
<device>abc55</device>
<device>abc77</device>
<device>abc800kb</device>
<device>abc830</device>
<device>abc832</device>
<device>abc834</device>
<device>abc838</device>
<device>abc99</device>
<device>abc_fd2</device>
<device>abc_hdc</device>
<device>abc_mem</device>
<device>abcsio</device>
<device>adam_ddp</device>
<device>adam_fdc</device>
<device>adam_kb</device>
<device>adam_prn</device>
<device>adam_spi</device>
<device>aga</device>
<device>aga_pc200</device>
<device>aha1542</device>
<device>alto2_cpu</device>
<device>amiga_ar1</device>
<device>amiga_ar2</device>
<device>amiga_ar3</device>
<device>amigakbd</device>
<device>ap2000</device>
<device>at_keybc</device>
<device>bbc_acorn1770</device>
<device>bbc_acorn8271</device>
<device>bbc_cumana1</device>
<device>bbc_cumana2</device>
<device>bbc_opus1770</device>
<device>bbc_opus2791</device>
<device>bbc_opus2793</device>
<device>bbc_opus3</device>
<device>bbc_weddb2</device>
<device>bbc_weddb3</device>
<device>betadisk</device>
<device>bml3kanji</device>
<device>bml3mp1802</device>
<device>bml3mp1805</device>
<device>bsmt2000</device>
<device>buddha</device>
<device>bw2_ramcard</device>
<device>c1526</device>
<device>c1540</device>
<device>c1541</device>
<device>c1541c</device>
<device>c1541dd</device>
<device>c1541ii</device>
<device>c1541pd</device>
<device>c1541pdc</device>
<device>c1551</device>
<device>c1563</device>
<device>c1570</device>
<device>c1571</device>
<device>c1581</device>
<device>c2031</device>
<device>c2040</device>
<device>c2040fdc</device>
<device>c3040</device>
<device>c4023</device>
<device>c4040</device>
<device>c64_cs</device>
<device>c64_fcc</device>
<device>c64_mscr</device>
<device>c64_nl10</device>
<device>c64_supercpu</device>
<device>c64_xl80</device>
<device>c8050</device>
<device>c8050fdc</device>
<device>c8250</device>
<device>c8250lp</device>
<device>c8280</device>
<device>cbm2_hrga</device>
<device>cbm2_hrgb</device>
<device>cbm8000_hsg_a</device>
<device>cbm8000_hsg_b</device>
<device>cffa1</device>
<device>cga</device>
<device>cga_iskr1030m</device>
<device>cga_iskr1031</device>
<device>cga_m24</device>
<device>cga_mc1502</device>
<device>cga_poisk2</device>
<device>cgenie_fdc</device>
<device>clgd542x</device>
<device>cmdhd</device>
<device>coco3_hdb1</device>
<device>coco_fdc</device>
<device>coco_fdc_v11</device>
<device>compiskb</device>
<device>comx_clm</device>
<device>comx_eb</device>
<device>comx_epr</device>
<device>comx_fd</device>
<device>comx_pl80</device>
<device>comx_prn</device>
<device>comx_thm</device>
<device>cp400_fdc</device>
<device>cpc_brunword4</device>
<device>cpc_ddi1</device>
<device>cpc_dkspeech</device>
<device>cpc_hd20</device>
<device>cpc_mf2</device>
<device>cpc_ser</device>
<device>cpc_serams</device>
<device>cpc_smartwatch</device>
<device>cpc_ssa1</device>
<device>cpc_transtape</device>
<device>crvfdc01</device>
<device>crvfdc02</device>
<device>csd1</device>
<device>cuda</device>
<device>d2fdc</device>
<device>d9060</device>
<device>d9090</device>
<device>dectalk_isa</device>
<device>dj2db</device>
<device>djdma</device>
<device>dm_clgd5430</device>
<device>dms3d2kp</device>
<device>dmv_k220</device>
<device>dmv_k230</device>
<device>dmv_k231</device>
<device>dmv_k235</device>
<device>dmv_k806</device>
<device>dmv_keyb</device>
<device>dragon_fdc</device>
<device>dsp1bleg</device>
<device>dsp1leg</device>
<device>dsp1leg_hi</device>
<device>dsp2leg</device>
<device>dsp3leg</device>
<device>dsp4leg</device>
<device>e01</device>
<device>e01s</device>
<device>ec1840_0002</device>
<device>ec1841_0002</device>
<device>ef9365</device>
<device>ega</device>
<device>egret</device>
<device>electron_m2105</device>
<device>electron_plus3</device>
<device>ep64_exdos</device>
<device>epson_pf10</device>
<device>epson_tf20</device>
<device>et4000</device>
<device>ex800</device>
<device>fc_disksys</device>
<device>fd2000</device>
<device>fd4000</device>
<device>fdc344</device>
<device>fdcmag</device>
<device>filetto_cga</device>
<device>finalchs</device>
<device>fsd1</device>
<device>fsd2</device>
<device>gfxultra</device>
<device>gfxultrp</device>
<device>gic</device>
<device>grip</device>
<device>hardbox</device>
<device>hd44780_a00</device>
<device>hd61830</device>
<device>hdc</device>
<device>hdc_ec1841</device>
<device>hp98034</device>
<device>hp98035</device>
<device>ibm_mfc</device>
<device>ibm_vga</device>
<device>ie15_keyboard</device>
<device>imi5000h</device>
<device>indusgt</device>
<device>interpod</device>
<device>intv_ecs</device>
<device>intv_voice</device>
<device>iq151_disc2</device>
<device>iq151_minigraf</device>
<device>iq151_ms151a</device>
<device>iq151_video32</device>
<device>iq151_video64</device>
<device>isa_hercules</device>
<device>isa_ibm_mda</device>
<device>isa_ibm_pgc</device>
<device>isbc_215g</device>
<device>jasmin</device>
<device>jvs13551</device>
<device>k573dio</device>
<device>k573mcr</device>
<device>k573msu</device>
<device>k573npu</device>
<device>k7659kb</device>
<device>kb_3270pc</device>
<device>kb_ec1841</device>
<device>kb_iskr1030</device>
<device>kb_pcat84</device>
<device>kb_pcxt83</device>
<device>kc_d004</device>
<device>kc_d004gide</device>
<device>keytronic_pc3270</device>
<device>km035</device>
<device>ks0066_f05</device>
<device>laserfdc</device>
<device>ldv1000</device>
<device>list.txt</device>
<device>lk201</device>
<device>lux10828</device>
<device>lux21046</device>
<device>lux21056</device>
<device>lx800</device>
<device>lx810l</device>
<device>m1comm</device>
<device>m20_8086</device>
<device>m24_kbd</device>
<device>m24_z8000</device>
<device>m50458</device>
<device>mach64</device>
<device>mackbd</device>
<device>mc1502_rom</device>
<device>microdisc</device>
<device>midssio</device>
<device>mie</device>
<device>minichif</device>
<device>mm1kb</device>
<device>mpu401</device>
<device>ms7004</device>
<device>ms_natural</device>
<device>mshark</device>
<device>msm6222b</device>
<device>msx_cart_bm_012</device>
<device>msx_cart_sfg01</device>
<device>msx_cart_sfg05</device>
<device>msx_moonsound</device>
<device>namco50</device>
<device>namco51</device>
<device>namco52</device>
<device>namco53</device>
<device>namco54</device>
<device>namco62</device>
<device>namcoc69</device>
<device>namcoc70</device>
<device>namcoc74</device>
<device>namcoc75</device>
<device>namcoc76</device>
<device>nb_48gc</device>
<device>nb_824gc</device>
<device>nb_aenet</device>
<device>nb_amc3b</device>
<device>nb_cb264</device>
<device>nb_image</device>
<device>nb_m2hr</device>
<device>nb_m2vc</device>
<device>nb_rtpd</device>
<device>nb_sp8s3</device>
<device>nb_spdq</device>
<device>nb_vikbw</device>
<device>nb_wspt</device>
<device>newbrain_eim</device>
<device>newbrain_fdc</device>
<device>nmk004</device>
<device>nsmdsa</device>
<device>nsmdsad</device>
<device>o2_voice</device>
<device>p1_fdc</device>
<device>p1_hdc</device>
<device>p1_rom</device>
<device>p72</device>
<device>pc1512kb</device>
<device>pc1640_iga</device>
<device>pcd_kbd</device>
<device>pcd_video</device>
<device>pcx_video</device>
<device>pd3_30hr</device>
<device>pd3_c264</device>
<device>pd3_lviw</device>
<device>pd3_mclr</device>
<device>pd3_pc16</device>
<device>pdc</device>
<device>pds_sefp</device>
<device>pet_softbox</device>
<device>pet_superpet</device>
<device>pr8210</device>
<device>psx_cd</device>
<device>ql_cumanafdi</device>
<device>ql_gold</device>
<device>ql_kdi</device>
<device>ql_mhd</device>
<device>ql_mpfdi</device>
<device>ql_opdbm</device>
<device>ql_pcmlqdi</device>
<device>ql_qdisc</device>
<device>ql_qplus4</device>
<device>ql_qubide</device>
<device>ql_sdisk</device>
<device>ql_sqboard256</device>
<device>ql_sqboard512</device>
<device>ql_sqmouse512</device>
<device>ql_sqmouse</device>
<device>ql_trump256</device>
<device>ql_trump512</device>
<device>ql_trump768</device>
<device>ql_trump</device>
<device>qsound</device>
<device>s1410</device>
<device>s3_764</device>
<device>s3virge</device>
<device>s3virgedx</device>
<device>saa5050</device>
<device>saa5052</device>
<device>sb16</device>
<device>sdtandy_fdc</device>
<device>sed1200</device>
<device>segadimm</device>
<device>serbox</device>
<device>seta10leg</device>
<device>seta11leg</device>
<device>sfd1001</device>
<device>side116</device>
<device>simutrek</device>
<device>slutprov</device>
<device>sns_rom_sgb2</device>
<device>sns_rom_sgb</device>
<device>spc1000_fdd_exp</device>
<device>stereo_fx</device>
<device>stic</device>
<device>sv603</device>
<device>sx1541</device>
<device>t5182</device>
<device>tetriskr_cga</device>
<device>tgui9680</device>
<device>ti99_bwg</device>
<device>ti99_evpc</device>
<device>ti99_fdc</device>
<device>ti99_gkracker</device>
<device>ti99_hfdc</device>
<device>ti99_myarcmem</device>
<device>ti99_pcode</device>
<device>ti99_rs232</device>
<device>ti99_speech</device>
<device>tiki100_8088</device>
<device>tms32031</device>
<device>tms32032</device>
<device>tvc_hbf</device>
<device>uni800</device>
<device>unidisk</device>
<device>upd7220</device>
<device>vic1515</device>
<device>vic1520</device>
<device>vic20_fe3</device>
<device>victor9k_fdc</device>
<device>victor9kb</device>
<device>votrax</device>
<device>vp700</device>
<device>vz_rs232</device>
<device>vz_rtty</device>
<device>wangpc_lic</device>
<device>wangpc_rtc</device>
<device>wangpc_wdc</device>
<device>wangpckb</device>
<device>wd1002a_wx1</device>
<device>wdxt_gen</device>
<device>wordpro</device>
<device>wyse700</device>
<device>x68k_cz6bs1</device>
<device>x820kb</device>
<device>xtide</device>
<device>ym2608</device>