Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip mame bios/devices #432

Merged
merged 1 commit into from Nov 19, 2018
Merged

Skip mame bios/devices #432

merged 1 commit into from Nov 19, 2018

Conversation

raelgc
Copy link

@raelgc raelgc commented May 10, 2018

New attempt as now mame files were moved to external files.

@raelgc
Copy link
Author

raelgc commented May 10, 2018

@joolswills New attempt after the my old PR #329, when mame stuff was hardcoded.

@joolswills
Copy link
Member

I'm happy to merge this if others are.

@tomaz82
Copy link
Collaborator

tomaz82 commented May 10, 2018

I'm not, first off it has changes that is pure code style changes, to one that is not matching how ES style is.
It has missing newline at the end of both xml files, the fast manual search function that is used for the mamenames is not used for the asset, it uses the slower std::find. And that's just the ones I found after a quick 20 second look.

I would advice against a merge until all these issues are adressed.

@joolswills
Copy link
Member

Sorry. I missed the styling issues - I agree with your comments @tomaz82

@@ -112,7 +112,8 @@ void SystemData::populateFolder(FileData* folder)
continue;

FileData* newGame = new FileData(GAME, filePath, mEnvData, this);
folder->addChild(newGame);
if(!newGame->isArcadeAsset())
folder->addChild(newGame);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

std::string xmlpath = ResourceManager::getInstance()->getResourcePath(":/mamenames.xml");

if(!Utils::FileSystem::exists(xmlpath))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated whitespace changes.

<device>dmv_k235</device>
<device>mc1502_rom</device>
<device>ql_pcmlqdi</device>
<device>gfxultrp</device>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no newlines at eof in xmls

static void deinit ();
static MameNames* getInstance();
const bool isAsset (const std::string& _mameName);
std::string getRealName(const std::string& _mameName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for styling changes here. if you think the indent is wrong, it can be done as a separate later commit.

@raelgc
Copy link
Author

raelgc commented May 10, 2018

Oh my, for some reason atom gone crazy with tabs (it should replace by 2 spaces). Let me fix all pointed issues.

@joolswills
Copy link
Member

Using tabs is correct for the ES sources.

@raelgc
Copy link
Author

raelgc commented May 10, 2018

While working in the fix, I can see the existing mamenames.xml has no newline at eof. Should I add to it too?

@raelgc
Copy link
Author

raelgc commented May 10, 2018

@tomaz82 Why not, then, use the standard std::binary_search instead of a manual search?

@raelgc raelgc force-pushed the master branch 3 times, most recently from 258aeee to 93956ab Compare May 10, 2018 21:03
@raelgc
Copy link
Author

raelgc commented May 10, 2018

Ok, I've made all requested fixes using gedit as editor.

@tomaz82
Copy link
Collaborator

tomaz82 commented May 10, 2018

@raelgc because that "standard" std::binary_search still requires algorithm included ( which most likely will include even more headers ) which is pointless when we have a fast search algorithm there already.

@raelgc
Copy link
Author

raelgc commented May 10, 2018

But we already have algorithm included in other files. Why should I write my own binary search when the standard c++ has a good one, in a library already included in the system?

@tomaz82
Copy link
Collaborator

tomaz82 commented May 11, 2018

I never said you should write your own, I said you should use the one VERY similar to the one we have in getRealName, it's your way of thinking about code that had ES take 50+ minutes to compile on the RPi3 before I optimized it down to less than 10 minutes.

@raelgc
Copy link
Author

raelgc commented May 11, 2018

Interesting @tomaz82, I was not aware of the compilation time. Thanks for explaining. It's a really fare argument!

In defense of the algorithm, I just used because it was used in other files. But following your advice, I'll replace by a manual a binary search. For this, I'll need to sort the Mame assets vector (as I'm combining the bios xml and the devices xml). To avoid std::sort, should I merge them in just one file?

Just to share: for someone using Atom and the breaking styling: I gone to Preferences > Editor and disable Atomic Soft Tabs (it makes the cursor jumps throw white-spaces like tabs, so you'll think you have tabs) and Soft Tabs (it tries to guess when use tabs vs spacing, but for me it was replacing the tabs for white-spaces).

@tomaz82
Copy link
Collaborator

tomaz82 commented May 11, 2018

@raelgc I understand, but what other files do, doesn't affect the compiletime of this file.
Looking at it more closely, I'd keep the 2 xml's entirely separated, even when stored as vectors, and make 2 functions ( isDevice and isBios ) instead of the isAsset,

@raelgc
Copy link
Author

raelgc commented May 11, 2018

@tomaz82 Sure, I'll work on this.

@raelgc
Copy link
Author

raelgc commented May 11, 2018

@tomaz82 Just pushed the separated list for bios and device! :)

@raelgc
Copy link
Author

raelgc commented Jun 5, 2018

@joolswills and @tomaz82: is it good to go now?

@raelgc
Copy link
Author

raelgc commented Jun 25, 2018

@pjft Do you mind to test and give any feedback?

Expected result is to not see mame devices in the gamelist, by example, neogeo.zip in mame/neogeo/arcade gamelist.

@pjft
Copy link
Collaborator

pjft commented Jun 26, 2018

Hi. I don't have much time this week, apologies. I'll give it a go when I have the chance, but I suspect the main feedback here/green light would have to come from @tomaz82 as he's the one who had specific concerns about the code and libraries being used. I see you're still including , which I believe was one of the concerns @tomaz82 raised, unless I missed something else here.

@tomaz82
Copy link
Collaborator

tomaz82 commented Jun 26, 2018

I'm still waiting for the requested changes

@raelgc
Copy link
Author

raelgc commented Jun 26, 2018

@tomaz82 Just removed algorithm library. I've separated the 2 lists like you requested in a previous commit.

@pjft
Copy link
Collaborator

pjft commented Jun 29, 2018

So, I had a few moments today and compiled this and tested.

Still, the BIOS files still show up on my arcade set. Am I meant to enable one option? At least neogeo.zip and pgm.zip show up.

@pjft
Copy link
Collaborator

pjft commented Jul 17, 2018

Well, see if it could be applied in a single place then - I'm not especially fond of the idea of duplicating logic unless really necessary.

Thanks.

@raelgc
Copy link
Author

raelgc commented Jul 20, 2018

@pjft I just pushed a change to prevent arcade assets get read from gamelist.xml. When you have some free time, please, can you test again?

@@ -128,11 +133,11 @@ void parseGamelist(SystemData* system)
//load the metadata
std::string defaultName = file->metadata.get("name");
file->metadata = MetaDataList::createFromXML(GAME_METADATA, fileNode, relativeTo);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary whitespace added

//make sure name gets set if one didn't exist
if(file->metadata.get("name").empty())
file->metadata.set("name", defaultName);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary whitespace added

if(!newGame->isArcadeAsset())
{
folder->addChild(newGame);
isGame = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing tabs

@raelgc
Copy link
Author

raelgc commented Jul 25, 2018

@jrassa Just made the requested changes.

@pjft
Copy link
Collaborator

pjft commented Jul 27, 2018

Hi!

I'm so sorry for the delay, and also for the update. For some reason, they are still showing.

I'm running the binary from commit

baa9cff

from 2 days ago :/

The resources from the gamelists are still showing somehow - at least neogeo.zip and pgm.zip .

@raelgc
Copy link
Author

raelgc commented Jul 30, 2018

@pjft Sounds like I'm still missing some other entry points.

Any chance your ES is configured to something different than the default? I mean, a filter applied from our tests on the improved Kids mode, something like that?

@pjft
Copy link
Collaborator

pjft commented Jul 30, 2018

I don't expect that to be the case, but I'll look into it in the coming days and get back to you.

@raelgc
Copy link
Author

raelgc commented Jul 30, 2018

@pjft Just to share: I tested both cases (mame assets outside the gamelist), and later manually added assets in the gamelist.xml. Both with a fresh retropie install (and they worked) in 2 different machines.

Just wondering which is the difference between our setups. For this reason I'm mentioning the filters. But of course, can be other features.

const bool FileData::isArcadeAsset()
{
const std::string stem = Utils::FileSystem::getStem(mPath);
return (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing space here, it seems?

treeNode->addChild(file);

// skipping arcade assets from gamelist
if(!treeNode->isArcadeAsset())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that in my scenario, it does not go through here.

treeNode->addChild(file);

// skipping arcade assets from gamelist
if(!treeNode->isArcadeAsset())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's your error. treeNode will be the parent folder in this case. You probably want to run this check against "file", which is the newly-created file.

That being said, I'm not fully comfortable with the idea of even creating a FileData object if we're going to discard it - I'd rather only create it if we're going to use it, otherwise make sure to return NULL - and see if we don't crash.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjft First: thank you for your time and patience.

I just pushed the requested changes but not yet the NULL return (before double check with you).

If I return NULL, it'll not crash, but it'll produce this output:

lvl0: Error finding/creating FileData for "/home/rael/RetroPie/roms/neogeo/neogeo.zip", skipping.`

Returning the FileData, no error output.

How should I proceed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave a definitive answer for others to chime in on, but in my perspective I'm not wholly bothered by that warning. The alternative is to create FileData objects that are dangling without a parent, take up memory, and never get explicitly removed. I'd imagine there'd be some edge case where that'd come and bite us back.

But if anyone else has any recommendation or preference, I'd happily take that.

raelgc added a commit to raelgc/EmulationStation that referenced this pull request Sep 10, 2018
@raelgc
Copy link
Author

raelgc commented Sep 10, 2018

@pjft Sorry for the long time away from this. But how about now? I'm avoiding the error message and avoiding create any additional metadata with the FileData when it's an arcade asset.

@pjft
Copy link
Collaborator

pjft commented Sep 14, 2018

Seems to work well, from my brief testing.

@raelgc
Copy link
Author

raelgc commented Sep 18, 2018

@tomaz82 and @joolswills I think we're good to go now (i.e., I've addressed all issues pointed by you guys, thanks for that).

@raelgc
Copy link
Author

raelgc commented Oct 30, 2018

@joolswills: in the last weeks, I just got playing with settings and thinking about you've said about performance and focus on Raspberry devices. And probably today the only "annoying" BIOS we have displayed in the gamelist is usually neogeo.zip, which can be moved to the ~/Retropie/BIOS folder (at least for lr-fbalpha).

So, in a second moment, I'm no more inclined to include all this overhead that my PR will produce just to handle few files we can easily get hidden.

What do you think?

@dankcushions
Copy link
Member

i still think the PR is a good idea. all other ways of hiding BIOS files need manual intervention from the user.

neogeo.zip is needed in the roms folder for MAME cores, and it's not the only BIOS file needed in MAME - 2003 also needs skns, pgm, and taitofx1. later versions of MAME will have need even more BIOS files.

fbalpha has neogeo.zip (which can be hidden via the BIOS folder, but that requires manual intervention by the user, and knowledge of that niche behaviour), but it also requires isgsm, nmk004, pgm, skns, and ym2608.

@raelgc
Copy link
Author

raelgc commented Nov 4, 2018

Well, in any case, I just squashed the commits.

@joolswills
Copy link
Member

I'm going to merge this unless anyone has an issue

@joolswills
Copy link
Member

Thanks for your work on this.

@joolswills joolswills merged commit bf02819 into RetroPie:master Nov 19, 2018
Yaoh pushed a commit to Yaoh/EmulationStation that referenced this pull request Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants