src/tools/chdman.c
| r14645 | r14646 | |
| 52 | 52 | #include <ctype.h> |
| 53 | 53 | #include <new> |
| 54 | 54 | |
| 55 | | #ifdef _WIN32 |
| 56 | 55 | #define NUM_PROCESSORS_SUPPORTED 1 |
| 57 | | #else |
| 58 | | #define NUM_PROCESSORS_SUPPORTED 0 |
| 59 | | #endif |
| 60 | 56 | |
| 61 | | |
| 62 | 57 | //************************************************************************** |
| 63 | 58 | // CONSTANTS & DEFINES |
| 64 | 59 | //************************************************************************** |
| r14645 | r14646 | |
| 2240 | 2235 | const cdrom_track_info &trackinfo = toc->tracks[tracknum]; |
| 2241 | 2236 | output_track_metadata(cuemode, output_toc_file, tracknum, trackinfo, *output_bin_file_str, discoffs, outputoffs); |
| 2242 | 2237 | |
| 2238 | UINT32 output_frame_size; |
| 2239 | |
| 2240 | // If this is bin/cue output and the CHD contains subdata, warn the user and don't include |
| 2241 | // the subdata size in the buffer calculation. |
| 2242 | if ((trackinfo.subtype != CD_SUB_NONE) && (cuemode)) |
| 2243 | { |
| 2244 | printf("Warning: Track %d has subcode data. bin/cue format cannot contain subcode data and it will be omitted.\n", tracknum+1); |
| 2245 | printf(" : This may affect usage of the output image. Use bin/toc output to keep all data.\n"); |
| 2246 | |
| 2247 | output_frame_size = trackinfo.datasize; |
| 2248 | } |
| 2249 | else |
| 2250 | { |
| 2251 | output_frame_size = trackinfo.datasize + ((trackinfo.subtype != CD_SUB_NONE) ? trackinfo.subsize : 0); |
| 2252 | } |
| 2253 | |
| 2243 | 2254 | // resize the buffer for the track |
| 2244 | | UINT32 output_frame_size = trackinfo.datasize + ((trackinfo.subtype != CD_SUB_NONE) ? trackinfo.subsize : 0); |
| 2245 | 2255 | buffer.resize((TEMP_BUFFER_SIZE / output_frame_size) * output_frame_size); |
| 2246 | 2256 | |
| 2247 | 2257 | // now read and output the actual data |
| r14645 | r14646 | |
| 2265 | 2275 | discoffs++; |
| 2266 | 2276 | |
| 2267 | 2277 | // read the subcode data |
| 2268 | | if (trackinfo.subtype != CD_SUB_NONE) |
| 2278 | if ((trackinfo.subtype != CD_SUB_NONE) && (!cuemode)) |
| 2269 | 2279 | { |
| 2270 | | cdrom_read_subcode(cdrom, cdrom_get_track_start(cdrom, tracknum) + frame, &buffer[bufferoffs]); |
| 2271 | | bufferoffs += trackinfo.subsize; |
| 2280 | cdrom_read_subcode(cdrom, cdrom_get_track_start(cdrom, tracknum) + frame, &buffer[bufferoffs]); |
| 2281 | bufferoffs += trackinfo.subsize; |
| 2272 | 2282 | } |
| 2273 | 2283 | |
| 2274 | 2284 | // write it out if we need to |
src/osd/sdl/sdlwork.c
| r14645 | r14646 | |
| 16 | 16 | * This is not really a sound solution. |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | | int sdl_num_processors = 0; |
| 19 | int osd_num_processors = 0; |
| 20 | 20 | |
| 21 | 21 | #include "../osdmini/miniwork.c" |
| 22 | 22 | |
| r14645 | r14646 | |
| 131 | 131 | // GLOBAL VARIABLES |
| 132 | 132 | //============================================================ |
| 133 | 133 | |
| 134 | | int sdl_num_processors = 0; |
| 134 | int osd_num_processors = 0; |
| 135 | 135 | |
| 136 | 136 | //============================================================ |
| 137 | 137 | // FUNCTION PROTOTYPES |
| r14645 | r14646 | |
| 567 | 567 | { |
| 568 | 568 | char *procsoverride; |
| 569 | 569 | int numprocs = 0; |
| 570 | | int physprocs = osd_num_processors(); |
| 570 | int physprocs = osd_get_num_processors(); |
| 571 | 571 | |
| 572 | | if (sdl_num_processors > 0) |
| 573 | | return MIN(4 * physprocs, sdl_num_processors); |
| 572 | // osd_num_processors == 0 for 'auto' |
| 573 | if (osd_num_processors > 0) |
| 574 | return MIN(4 * physprocs, osd_num_processors); |
| 574 | 575 | else |
| 575 | 576 | { |
| 576 | 577 | // if the OSDPROCESSORS environment variable is set, use that value if valid |
| r14645 | r14646 | |
| 601 | 602 | if (index<2) |
| 602 | 603 | mask = 0x01; /* main thread and io threads on cpu #0 */ |
| 603 | 604 | else |
| 604 | | mask = (1 << (((index - 1) % (osd_num_processors() - 1)) + 1)); |
| 605 | mask = (1 << (((index - 1) % (osd_get_num_processors() - 1)) + 1)); |
| 605 | 606 | } |
| 606 | 607 | else |
| 607 | 608 | { |
src/osd/sdl/sdlmain.c
| r14645 | r14646 | |
| 609 | 609 | /* get number of processors */ |
| 610 | 610 | stemp = options.numprocessors(); |
| 611 | 611 | |
| 612 | | sdl_num_processors = 0; |
| 612 | osd_num_processors = 0; |
| 613 | 613 | |
| 614 | 614 | if (strcmp(stemp, "auto") != 0) |
| 615 | 615 | { |
| 616 | | sdl_num_processors = atoi(stemp); |
| 617 | | if (sdl_num_processors < 1) |
| 616 | osd_num_processors = atoi(stemp); |
| 617 | if (osd_num_processors < 1) |
| 618 | 618 | { |
| 619 | 619 | mame_printf_warning("Warning: numprocessors < 1 doesn't make much sense. Assuming auto ...\n"); |
| 620 | | sdl_num_processors = 0; |
| 620 | osd_num_processors = 0; |
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | |