src/mess/climess.c
| r7711 | r7712 | |
| 115 | 115 | games |
| 116 | 116 | TODO: Avoid outputting lists more than once. |
| 117 | 117 | TODO: Add DTD. |
| 118 | TODO: Add all information read from the source files |
| 118 | 119 | -------------------------------------------------*/ |
| 119 | 120 | |
| 120 | 121 | int info_listsoftware(core_options *options, const char *gamename) |
| r7711 | r7712 | |
| 141 | 142 | |
| 142 | 143 | for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ ) |
| 143 | 144 | { |
| 144 | | if ( swlist->list_name[i] ) |
| 145 | if ( swlist->list_name[i] && *swlist->list_name[i] ) |
| 145 | 146 | { |
| 146 | 147 | fprintf(out, "\t<softwarelist name=\"%s\">\n", swlist->list_name[i] ); |
| 147 | 148 | |
| 148 | 149 | software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL ); |
| 149 | 150 | |
| 150 | | for ( software_info *swinfo = software_list_first( list ); swinfo != NULL; swinfo = software_list_next( list ) ) |
| 151 | if ( list ) |
| 151 | 152 | { |
| 152 | | fprintf( out, "\t\t<software name=\"%s\"", swinfo->shortname ); |
| 153 | | if ( swinfo->supported == SOFTWARE_SUPPORTED_PARTIAL ) |
| 154 | | fprintf( out, " supported=\"partial\"" ); |
| 155 | | if ( swinfo->supported == SOFTWARE_SUPPORTED_NO ) |
| 156 | | fprintf( out, " supported=\"no\"" ); |
| 157 | | fprintf( out, ">\n" ); |
| 158 | | fprintf( out, "\t\t\t<description>%s</description>\n", xml_normalize_string(swinfo->longname) ); |
| 159 | | fprintf( out, "\t\t\t<year>%s</year>\n", xml_normalize_string( swinfo->year ) ); |
| 160 | | fprintf( out, "\t\t\t<publisher>%s</publisher>\n", xml_normalize_string( swinfo->publisher ) ); |
| 161 | | |
| 162 | | for ( software_part *part = software_find_part( swinfo, NULL, NULL ); part != NULL; part = software_part_next( part ) ) |
| 153 | for ( software_info *swinfo = software_list_first( list ); swinfo != NULL; swinfo = software_list_next( list ) ) |
| 163 | 154 | { |
| 164 | | fprintf( out, "\t\t\t<part name=\"%s\"", part->name ); |
| 165 | | if ( part->interface_ ) |
| 166 | | fprintf( out, " interface=\"%s\"", part->interface_ ); |
| 167 | | if ( part->feature ) |
| 168 | | fprintf( out, " features=\"%s\"", part->feature ); |
| 169 | | fprintf( out, ">\n"); |
| 155 | fprintf( out, "\t\t<software name=\"%s\"", swinfo->shortname ); |
| 156 | if ( swinfo->supported == SOFTWARE_SUPPORTED_PARTIAL ) |
| 157 | fprintf( out, " supported=\"partial\"" ); |
| 158 | if ( swinfo->supported == SOFTWARE_SUPPORTED_NO ) |
| 159 | fprintf( out, " supported=\"no\"" ); |
| 160 | fprintf( out, ">\n" ); |
| 161 | fprintf( out, "\t\t\t<description>%s</description>\n", xml_normalize_string(swinfo->longname) ); |
| 162 | fprintf( out, "\t\t\t<year>%s</year>\n", xml_normalize_string( swinfo->year ) ); |
| 163 | fprintf( out, "\t\t\t<publisher>%s</publisher>\n", xml_normalize_string( swinfo->publisher ) ); |
| 170 | 164 | |
| 171 | | /* TODO: display rom region information */ |
| 172 | | for ( const rom_entry *region = part->romdata; region; region = rom_next_region( region ) ) |
| 165 | for ( software_part *part = software_find_part( swinfo, NULL, NULL ); part != NULL; part = software_part_next( part ) ) |
| 173 | 166 | { |
| 174 | | fprintf( out, "\t\t\t\t<dataarea name=\"%s\" size=\"%x\">\n", ROMREGION_GETTAG(region), ROMREGION_GETLENGTH(region) ); |
| 167 | fprintf( out, "\t\t\t<part name=\"%s\"", part->name ); |
| 168 | if ( part->interface_ ) |
| 169 | fprintf( out, " interface=\"%s\"", part->interface_ ); |
| 170 | if ( part->feature ) |
| 171 | fprintf( out, " features=\"%s\"", part->feature ); |
| 172 | fprintf( out, ">\n"); |
| 175 | 173 | |
| 176 | | for ( const rom_entry *rom = rom_first_file( region ); rom; rom = rom_next_file( rom ) ) |
| 174 | /* TODO: display rom region information */ |
| 175 | for ( const rom_entry *region = part->romdata; region; region = rom_next_region( region ) ) |
| 177 | 176 | { |
| 178 | | if ( ROMENTRY_ISFILE(rom) ) |
| 177 | fprintf( out, "\t\t\t\t<dataarea name=\"%s\" size=\"%x\">\n", ROMREGION_GETTAG(region), ROMREGION_GETLENGTH(region) ); |
| 178 | |
| 179 | for ( const rom_entry *rom = rom_first_file( region ); rom; rom = rom_next_file( rom ) ) |
| 179 | 180 | { |
| 180 | | fprintf( out, "\t\t\t\t\t<rom name=\"%s\" size=\"%d\"", ROM_GETNAME(rom), ROM_GETLENGTH(rom) ); |
| 181 | | |
| 182 | | /* dump checksum information only if there is a known dump */ |
| 183 | | if (!hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) |
| 181 | if ( ROMENTRY_ISFILE(rom) ) |
| 184 | 182 | { |
| 185 | | char checksum[HASH_BUF_SIZE]; |
| 186 | | int hashtype; |
| 183 | fprintf( out, "\t\t\t\t\t<rom name=\"%s\" size=\"%d\"", ROM_GETNAME(rom), ROM_GETLENGTH(rom) ); |
| 187 | 184 | |
| 188 | | /* iterate over hash function types and print out their values */ |
| 189 | | for (hashtype = 0; hashtype < HASH_NUM_FUNCTIONS; hashtype++) |
| 190 | | if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), 1 << hashtype, checksum)) |
| 191 | | fprintf(out, " %s=\"%s\"", hash_function_name(1 << hashtype), checksum); |
| 185 | /* dump checksum information only if there is a known dump */ |
| 186 | if (!hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) |
| 187 | { |
| 188 | char checksum[HASH_BUF_SIZE]; |
| 189 | int hashtype; |
| 190 | |
| 191 | /* iterate over hash function types and print out their values */ |
| 192 | for (hashtype = 0; hashtype < HASH_NUM_FUNCTIONS; hashtype++) |
| 193 | if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), 1 << hashtype, checksum)) |
| 194 | fprintf(out, " %s=\"%s\"", hash_function_name(1 << hashtype), checksum); |
| 195 | } |
| 196 | |
| 197 | fprintf( out, " offset=\"%x\" />\n", ROM_GETOFFSET(rom) ); |
| 192 | 198 | } |
| 199 | } |
| 193 | 200 | |
| 194 | | fprintf( out, " offset=\"%x\" />\n", ROM_GETOFFSET(rom) ); |
| 195 | | } |
| 201 | fprintf( out, "\t\t\t\t</datearea>\n" ); |
| 196 | 202 | } |
| 197 | 203 | |
| 198 | | fprintf( out, "\t\t\t\t</datearea>\n" ); |
| 204 | fprintf( out, "\t\t\t</part>\n" ); |
| 199 | 205 | } |
| 200 | 206 | |
| 201 | | fprintf( out, "\t\t\t</part>\n" ); |
| 207 | fprintf( out, "\t\t</software>\n" ); |
| 202 | 208 | } |
| 203 | 209 | |
| 204 | | fprintf( out, "\t\t</software>\n" ); |
| 210 | software_list_close( list ); |
| 205 | 211 | } |
| 206 | 212 | |
| 207 | | software_list_close( list ); |
| 208 | | |
| 209 | 213 | fprintf(out, "\t</softwarelist>\n" ); |
| 210 | 214 | } |
| 211 | 215 | } |