Previous 15994 Revisions Next

r14646 Sunday 26th February, 2012 at 23:01:49 UTC by R. Belmont
Sync with MAME: allow multi-threaded CHDMAN on non-Windows (nw)
[src/osd/sdl]osdsdl.h sdlmain.c sdlos.h sdlos_macosx.c sdlos_os2.c sdlos_unix.c sdlos_win32.c sdlwork.c
[src/tools]chdman.c

src/tools/chdman.c
r14645r14646
5252#include <ctype.h>
5353#include <new>
5454
55#ifdef _WIN32
5655#define NUM_PROCESSORS_SUPPORTED 1
57#else
58#define NUM_PROCESSORS_SUPPORTED 0
59#endif
6056
61
6257//**************************************************************************
6358//  CONSTANTS & DEFINES
6459//**************************************************************************
r14645r14646
22402235         const cdrom_track_info &trackinfo = toc->tracks[tracknum];
22412236         output_track_metadata(cuemode, output_toc_file, tracknum, trackinfo, *output_bin_file_str, discoffs, outputoffs);
22422237
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
22432254         // resize the buffer for the track
2244         UINT32 output_frame_size = trackinfo.datasize + ((trackinfo.subtype != CD_SUB_NONE) ? trackinfo.subsize : 0);
22452255         buffer.resize((TEMP_BUFFER_SIZE / output_frame_size) * output_frame_size);
22462256
22472257         // now read and output the actual data
r14645r14646
22652275            discoffs++;
22662276
22672277            // read the subcode data
2268            if (trackinfo.subtype != CD_SUB_NONE)
2278            if ((trackinfo.subtype != CD_SUB_NONE) && (!cuemode))
22692279            {
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;
22722282            }
22732283
22742284            // write it out if we need to
src/osd/sdl/sdlos_macosx.c
r14645r14646
142142//  osd_num_processors
143143//============================================================
144144
145int osd_num_processors(void)
145int osd_get_num_processors(void)
146146{
147147   int processors = 1;
148148
src/osd/sdl/sdlos_win32.c
r14645r14646
160160//  osd_num_processors
161161//============================================================
162162
163int osd_num_processors(void)
163int osd_get_num_processors(void)
164164{
165165   SYSTEM_INFO info;
166166
src/osd/sdl/sdlos_os2.c
r14645r14646
175175//  osd_num_processors
176176//============================================================
177177
178int osd_num_processors(void)
178int osd_get_num_processors(void)
179179{
180180    ULONG numprocs = 1;
181181
src/osd/sdl/sdlos_unix.c
r14645r14646
6767//  osd_num_processors
6868//============================================================
6969
70int osd_num_processors(void)
70int osd_get_num_processors(void)
7171{
7272   int processors = 1;
7373
src/osd/sdl/sdlos.h
r14645r14646
2323
2424        Number of processors
2525-----------------------------------------------------------------------------*/
26int osd_num_processors(void);
26int osd_get_num_processors(void);
2727
2828
2929/*-----------------------------------------------------------------------------
src/osd/sdl/sdlwork.c
r14645r14646
1616 *        This is not really a sound solution.
1717 */
1818
19int sdl_num_processors = 0;
19int osd_num_processors = 0;
2020
2121#include "../osdmini/miniwork.c"
2222
r14645r14646
131131//  GLOBAL VARIABLES
132132//============================================================
133133
134int sdl_num_processors = 0;
134int osd_num_processors = 0;
135135
136136//============================================================
137137//  FUNCTION PROTOTYPES
r14645r14646
567567{
568568   char *procsoverride;
569569   int numprocs = 0;
570   int physprocs = osd_num_processors();
570   int physprocs = osd_get_num_processors();
571571
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);
574575   else
575576   {
576577      // if the OSDPROCESSORS environment variable is set, use that value if valid
r14645r14646
601602         if (index<2)
602603            mask = 0x01; /* main thread and io threads on cpu #0 */
603604         else
604            mask = (1 << (((index - 1) % (osd_num_processors() - 1)) + 1));
605            mask = (1 << (((index - 1) % (osd_get_num_processors() - 1)) + 1));
605606      }
606607      else
607608      {
src/osd/sdl/sdlmain.c
r14645r14646
609609   /* get number of processors */
610610   stemp = options.numprocessors();
611611
612   sdl_num_processors = 0;
612    osd_num_processors = 0;
613613
614614   if (strcmp(stemp, "auto") != 0)
615615   {
616      sdl_num_processors = atoi(stemp);
617      if (sdl_num_processors < 1)
616      osd_num_processors = atoi(stemp);
617      if (osd_num_processors < 1)
618618      {
619619         mame_printf_warning("Warning: numprocessors < 1 doesn't make much sense. Assuming auto ...\n");
620         sdl_num_processors = 0;
620         osd_num_processors = 0;
621621      }
622622   }
623623
src/osd/sdl/osdsdl.h
r14645r14646
269269//  sdlwork.c
270270//============================================================
271271
272extern int sdl_num_processors;
272extern int osd_num_processors;
273273
274274#endif

Previous 15994 Revisions Next


© 1998-2018 The MESS Team