Major code change pushed

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: Major code change pushed

Postby Bart » Fri Mar 31, 2017 6:10 am

Ian wrote:What's the point of parent/child roms?
Surely each should just stand on their own?

And the current build crashes when loading harley on this line
[](File::ptr_t a, File::ptr_t b) { return a->filename < b->filename; });

I think the error is saying you need to sort the files


It actually brings down the program with an exception or something? Works for me. What is the actual error printed? I suspect this is MSVC non-compliance with the C++11 spec again and that it's having trouble with lambdas. If that's the case, try the following:

Right above IdentifyCompleteGamesInZipArchive(), define this comparator function:

Code: Select all
bool GameLoader::CompareFilesByName(const File::ptr_t &a, const File::ptr_t &b)
{
  return a->filename < b->filename;
}


Add it to GameLoader.hpp as a static, private method:

Code: Select all
static bool CompareFilesByName(const File::ptr_t &a,const File::ptr_t &b);


And then replace the lambda with it:

Code: Select all
for (auto &v: files_found_per_game)
  {
      auto &files_found = v.second;
      auto &files_required = files_required_per_game[v.first];
      auto &files_missing = files_missing_per_game[v.first];
      std::set_difference(
        files_required.begin(), files_required.end(),
        files_found.begin(), files_found.end(),
        std::inserter(files_missing, files_missing.end()),
        CompareFilesByName);
        //[](File::ptr_t a, File::ptr_t b) { return a->filename < b->filename; });
  }


Does that help?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Major code change pushed

Postby Bart » Fri Mar 31, 2017 6:13 am

Ian wrote:What's the point of parent/child roms?
Surely each should just stand on their own?


I don't have the MAME official ROM set unfortunately, so I should look more closely into how they distribute their ROMs, but my understanding is that child ROM sets do not include their parents' files. Until now, Supermodel has required that users combine them into one set, which is a bit silly.

If you look at Games.xml, you'll notice that scudp differs from scud by only a few files. Likewise for scuda, etc. I think customarily, the ROMs are distributed only with the changed files, and MAME loads the rest from the parent set. I wanted to add support for this to Supermodel because I recall in the past having to manually merge ROM files.

That said, Supermodel still supports a completely merged ROM set (scudp and scud in the same file will cause scudp to be loaded).
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Major code change pushed

Postby Ian » Fri Mar 31, 2017 6:17 am

I'll test non lambda version later when I have some time
However this is the track trace

http://i.imgur.com/xvm2GTb.png
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Major code change pushed

Postby Bart » Fri Mar 31, 2017 6:20 am

CiroConsentino wrote:Ok, no worries.
Will you be able to put all parent ROMs into the child set ? This way you can have only scuda.zip and not have scud.zip


Supermodel only supports a single parent (which is fine for Model 3 as far as I know). Supermodel requires that any games inside of a zip file are complete, meaning all of the ROMs in their XML section are there. For a child set, this does not include the parent ROMs of course. So what I mean is, for example:

- Game Foo (parent) has 10 ROMs
- Game Bar (child of Foo) has 2 ROMs

Let's say you have combined.zip which contains 12 ROMs (10 from Foo, 2 from Bar). This is okay. Likewise, you can have Foo.zip with 10 Foo ROMs and Bar.zip with 2 Bar ROMs. This is also okay.

What is *not* okay is:

Foo.zip with 11 ROMs (10 Foo ROMs, 1 Bar ROM) and Bar.zip with just 1 of its ROMs. Supermodel will not be able to resolve this. I *could* add code to handle such situations but prefer not to because it's rather silly.

Supermodel checks for "complete" games, where complete means that the zip file contains all of the ROMs defined in a game's XML spec. If it finds anything that is incomplete, it will print error messages listing all the missing files for that game.

So if you have scuda.zip with all of scud's ROMs plus only *one* scuda ROM, you will get an error message for each missing scuda ROM.

But, most of these errors are non-fatal. If there are complete games in the ROM set, Supermodel will pick just one and load it. That is because I don't allow zip files and games to be specified separately (e.g., "supermodel romset.zip scud" is not valid) -- I just assume that the zip file specified on the command line is the ROM set the user intends to load and provide some logic for the unexpected case of users having merged their ROMs in some weird way.

One more question: can a ROM from the child set (scuda) be present in the parent set (scud) or they must be only in the child set? ... MAME calls it merged set.


They can be merged but please, please tell me that MAME does not allow partial merging (e.g. all of parent set + a few child ROMs in one zip file, remainder of child ROMs in second zip file)? I was hoping not to have to worry about that case.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Major code change pushed

Postby Bart » Fri Mar 31, 2017 6:23 am

Ian wrote:I'll test non lambda version later when I have some time
However this is the track trace

http://i.imgur.com/xvm2GTb.png


Ahhh. Ok. Interesting. MSVC might be doing the right thing here for once and GCC is wrong (or silently fails). The set is indeed not ordered by the sorting criteria that I want to use, it is instead ordered by pointer value. Okay. I'll think of a fix. I think I just have to either write my own set_difference (these sets will be tiny, so it can just be an O(N^2) thing) or I can transfer the sets to vectors, sort them by filename using my lambda, and then call set_difference to produce an output set. set_difference works on vector inputs.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Major code change pushed

Postby Bart » Fri Mar 31, 2017 7:36 am

One thing to add about ROMs: as before, Supermodel continues to be insensitive to file names, with two exceptions detailed below. If the MAME team decides to go on a ROM re-naming spree, Supermodel will generally be unaffected (this happened in the past, I think, when the ROM set definitions for Model 3 were cleaned up in MAME).

1. When a child ROM set is detected and the parent is not present in the same zip file, it will assume that the parent zip file is named the same as the MAME set name. Otherwise, zip files can be named however you like regardless of what ROM set is inside.

2. Individual ROM names are unimportant because Supermodel searches for files by CRC. The sole exception is if the Games.xml entry does not specify a CRC. Then the file name is actually used. I added this to more easily support loading of homebrew ROMs (such as those I produced when running experiments on the actual board). ROM file names should still be unique, however, because they are used to print error messages.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Major code change pushed

Postby Ian » Fri Mar 31, 2017 8:11 am

HarryTuttle wrote:Sorry Bart to respond so late, very busy weeks are coming at work and time dedicated to code and post here is mostly confined in the weekends or at late night...

Bart wrote:Are there any remaining issues preventing you from building, Harry?

It's all ok now :) All I had to do was to change <BlockFile.h> and now compiles flawlessly. I'm just testing it a little bit before submitting spotlight & fog changes. I'm planning to do it by this weekend.

In fact I was planning to do that a week ago, but since the last major changes in repository I had to re-sync all my changed files to the new tree. However now it's done.


For small changes? Just as easy to simply copy and paste the code here. I know it's a headache with the source tree constantly changing.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Major code change pushed

Postby HarryTuttle » Fri Mar 31, 2017 8:18 am

Bart wrote:By the way, my new config system makes one of the things you had added work automatically: InputSystem can be specified in the config file. Inputs themselves are still global (in fact, I enforce this explicitly for a number of reasons), but the input system can now be specified in the config file as either global or per-game.


Yeah, saw that. I just removed some cruft from my patches :)
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Major code change pushed

Postby CiroConsentino » Fri Mar 31, 2017 9:54 am

They can be merged but please, please tell me that MAME does not allow partial merging (e.g. all of parent set + a few child ROMs in one zip file, remainder of child ROMs in second zip file)? I was hoping not to have to worry about that case.

yes, it does. I think that's a nightmare but you can have partially merged sets. But hey, you don't need to support partial merged sets in Supermodel.

I really hate partial merged sets...have the child.zip with ROMs and have some child ROMs in the parent set. you either have all child ROMs in the parent set or have all child ROMs in the child set.
CiroConsentino
 
Posts: 20
Joined: Sun Sep 25, 2011 4:50 am
Location: Brazil

Re: Major code change pushed

Postby Bart » Fri Mar 31, 2017 10:31 am

CiroConsentino wrote:
They can be merged but please, please tell me that MAME does not allow partial merging (e.g. all of parent set + a few child ROMs in one zip file, remainder of child ROMs in second zip file)? I was hoping not to have to worry about that case.

yes, it does. I think that's a nightmare but you can have partially merged sets. But hey, you don't need to support partial merged sets in Supermodel.

I really hate partial merged sets...have the child.zip with ROMs and have some child ROMs in the parent set. you either have all child ROMs in the parent set or have all child ROMs in the child set.


Got it. No partial merging for Supermodel. I could support it in the future -- the ROM loading could be improved to be even more generic/flexible -- but I've received few complaints as-is about ROM sets to date, so I can't imagine anyone caring about this for now.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

PreviousNext

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest

cron