Previous 15994 Revisions Next

r12671 Saturday 20th August, 2011 at 09:47:03 UTC by Miodrag Milanović
cdrom - Fixed offset calculation thanks to mahlemiut (no whatsnew)
[src/lib/util]cdrom.c

src/lib/util/cdrom.c
r12670r12671
128128{   
129129   int i;
130130   cdrom_file *file;
131   UINT32 physofs, chdofs;   
131   UINT32 physofs;   
132132   
133133   /* allocate memory for the CD-ROM file */
134134   file = (cdrom_file *)malloc(sizeof(cdrom_file));
r12670r12671
162162   /* calculate the starting frame for each track, keeping in mind that CHDMAN
163163       pads tracks out with extra frames to fit hunk size boundries
164164    */
165   physofs = chdofs = 0;
165   physofs = 0;
166166   for (i = 0; i < file->cdtoc.numtrks; i++)
167167   {
168168      file->cdtoc.tracks[i].physframeofs = physofs;
169      file->cdtoc.tracks[i].chdframeofs = chdofs;
169      file->cdtoc.tracks[i].chdframeofs = 0;
170170
171171      physofs += file->cdtoc.tracks[i].frames;
172      chdofs  += file->cdtoc.tracks[i].frames;
173      chdofs  += file->cdtoc.tracks[i].extraframes;
174172
175173      LOG(("Track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d physofs %d chdofs %d\n", i+1,
176174         file->cdtoc.tracks[i].trktype,
r12670r12671
185183
186184   /* fill out dummy entries for the last track to help our search */
187185   file->cdtoc.tracks[i].physframeofs = physofs;
188   file->cdtoc.tracks[i].chdframeofs = chdofs;
186   file->cdtoc.tracks[i].chdframeofs = 0;
189187
190188   /* allocate a cache */
191189   file->cache = (UINT8 *)malloc(CD_FRAME_SIZE);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team