Previous 15994 Revisions Next

r12656 Thursday 18th August, 2011 at 10:38:37 UTC by Miodrag Milanović
Fixed verifyroms so it display romsets for devices too as separate. (no whatsnew)
[src/emu]audit.c audit.h clifront.c

src/emu/clifront.c
r12655r12656
734734//  verifyroms - verify the ROM sets of one or
735735//  more games
736736//-------------------------------------------------
737extern int m_device_count;
738extern const device_type *s_devices_sorted[];
737739
738740void cli_frontend::verifyroms(const char *gamename)
739741{
r12655r12656
748750
749751   // iterate over drivers
750752   media_auditor auditor(drivlist);
753   UINT8* device_used = global_alloc_array_clear(UINT8, m_device_count);
751754   while (drivlist.next())
752755   {
753756      // audit the ROMs in this set
r12655r12656
755758
756759      // output the summary of the audit
757760      astring summary_string;
758      auditor.summarize(&summary_string);
761      auditor.summarize(drivlist.driver().name,&summary_string);
759762      mame_printf_info("%s", summary_string.cstr());
763      for (const rom_source *source = rom_first_source(drivlist.config()); source != NULL; source = rom_next_source(*source))
764      {
765         for(int i=0;i<m_device_count;i++) {
766               if (source->type() == *s_devices_sorted[i]) device_used[i] = 1;
767         }
768      }
760769
761770      // if not found, count that and leave it at that
762771      if (summary == media_auditor::NOTFOUND)
r12655r12656
794803         }
795804      }
796805   }
806   
807   drivlist.reset();
808   drivlist.next();
809   machine_config &config = drivlist.config();
810   device_t *owner = config.devicelist().first();
811   // check if all are listed, note that empty one is included
812   bool display_all = driver_list::total() == (drivlist.count()+1);
813   for(int i=0;i<m_device_count;i++) {
814      if (display_all || (device_used[i]!=0)) {
815         device_type type = *s_devices_sorted[i];
816         device_t *dev = (*type)(config, "dummy", owner, 0);
817         dev->config_complete();
818   
819         // audit the ROMs in this set
820         media_auditor::summary summary = auditor.audit_device(dev, AUDIT_VALIDATE_FAST);
797821
822         // output the summary of the audit
823         astring summary_string;
824         auditor.summarize(dev->shortname(),&summary_string);
825         mame_printf_info("%s", summary_string.cstr());
826
827         // if not found, count that and leave it at that
828         if (summary == media_auditor::NOTFOUND)
829            notfound++;
830
831         // else display information about what we discovered
832         else
833         {
834            mame_printf_info("romset %s ", dev->shortname());
835
836            // switch off of the result
837            switch (summary)
838            {
839               case media_auditor::INCORRECT:
840                  mame_printf_info("is bad\n");
841                  incorrect++;
842                  break;
843
844               case media_auditor::CORRECT:
845                  mame_printf_info("is good\n");
846                  correct++;
847                  break;
848
849               case media_auditor::BEST_AVAILABLE:
850                  mame_printf_info("is best available\n");
851                  correct++;
852                  break;
853
854               default:
855                  break;
856            }
857         }
858
859         global_free(dev);
860      }
861   }
862
863   global_free(device_used);
864   
798865   // clear out any cached files
799866   zip_file_cache_clear();
800867
r12655r12656
842909
843910      // output the summary of the audit
844911      astring summary_string;
845      auditor.summarize(&summary_string);
912      auditor.summarize(drivlist.driver().name,&summary_string);
846913      mame_printf_info("%s", summary_string.cstr());
847914
848915      // if not found, print a message and set the flag
src/emu/audit.c
r12655r12656
8383   int required = 0;
8484   int sharedFound = 0;
8585   int sharedRequired = 0;
86   for (const rom_source *source = rom_first_source(m_enumerator.config()); source != NULL; source = rom_next_source(*source))
86   //for (const rom_source *source = rom_first_source(m_enumerator.config()); source != NULL; source = rom_next_source(*source))
87   const rom_source *source = rom_first_source(m_enumerator.config());
8788   {
8889      // determine the search path for this source and iterate through the regions
8990      m_searchpath = source->searchpath();
r12655r12656
148149   }
149150
150151   // return a summary
151   return summarize();
152   return summarize(m_enumerator.driver().name);
152153}
153154
154155
155156//-------------------------------------------------
157//  audit_device - audit the device
158//-------------------------------------------------
159
160media_auditor::summary media_auditor::audit_device(device_t *device, const char *validation)
161{
162   // start fresh
163   m_record_list.reset();
164
165   // store validation for later
166   m_validation = validation;
167
168   // iterate over ROM sources and regions
169   int found = 0;
170   int required = 0;
171   // determine the search path for this source and iterate through the regions
172   m_searchpath = device->shortname();
173
174   // now iterate over regions and ROMs within
175   for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region))
176   {
177      for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
178      {
179         hash_collection hashes(ROM_GETHASHDATA(rom));
180         
181         // count the number of files with hashes
182         if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom))
183         {
184            required++;
185         }
186
187         // audit a file
188         audit_record *record = NULL;
189         if (ROMREGION_ISROMDATA(region))
190            record = audit_one_rom(rom);
191
192         // audit a disk
193         else if (ROMREGION_ISDISKDATA(region))
194            record = audit_one_disk(rom);
195
196         // count the number of files that are found.
197         if (record != NULL && (record->status() == audit_record::STATUS_GOOD || (record->status() == audit_record::STATUS_FOUND_INVALID && also_used_by_parent(record->actual_hashes(), record->actual_length()) < 0)))
198         {
199            found++;
200         }
201      }
202   }
203
204   // return a summary
205   return summarize(device->shortname());
206}
207
208
209//-------------------------------------------------
156210//  audit_samples - validate the samples for the
157211//  currently-enumerated driver
158212//-------------------------------------------------
r12655r12656
207261      return NOTFOUND;
208262
209263   // return a summary
210   return summarize();
264   return summarize(m_enumerator.driver().name);
211265}
212266
213267
r12655r12656
216270//  string format
217271//-------------------------------------------------
218272
219media_auditor::summary media_auditor::summarize(astring *string)
273media_auditor::summary media_auditor::summarize(const char *name, astring *string)
220274{
221275   // loop over records
222276   summary overall_status = CORRECT;
r12655r12656
231285      // output the game name, file name, and length (if applicable)
232286      if (string != NULL)
233287      {
234         string->catprintf("%-12s: %s", m_enumerator.driver().name, record->name());
288         string->catprintf("%-12s: %s", name, record->name());
235289         if (record->expected_length() > 0)
236290            string->catprintf(" (%d bytes)", record->expected_length());
237291         string->catprintf(" - ");
src/emu/audit.h
r12655r12656
169169
170170   // audit operations
171171   summary audit_media(const char *validation = AUDIT_VALIDATE_FULL);
172   summary audit_device(device_t *device, const char *validation = AUDIT_VALIDATE_FULL);
172173   summary audit_samples();
173   summary summarize(astring *output = NULL);
174   summary summarize(const char *name,astring *output = NULL);
174175
175176private:
176177   // internal helpers

Previous 15994 Revisions Next


© 1998-2018 The MESS Team