+\r
+\r
+/***********************************************************/\r
+\r
+void mp3_start_play(FILE *f, int pos) // pos is 0-1023\r
+{\r
+ int byte_offs = 0;\r
+\r
+ if (!(currentConfig.EmuOpt&0x800)) { // cdda disabled?\r
+ return;\r
+ }\r
+\r
+ if (loaded_mp3 != f)\r
+ {\r
+ printf("loading mp3... "); fflush(stdout);\r
+ fseek(f, 0, SEEK_SET);\r
+ fread(mp3_mem, 1, MP3_SIZE_MAX, f);\r
+ if (feof(f)) printf("done.\n");\r
+ else printf("done. mp3 too large, not all data loaded.\n");\r
+ shared_ctl->mp3_len = ftell(f);\r
+ loaded_mp3 = f;\r
+ }\r
+\r
+ // seek..\r
+ if (pos) {\r
+ byte_offs = (shared_ctl->mp3_len << 6) >> 10;\r
+ byte_offs *= pos;\r
+ byte_offs >>= 6;\r
+ }\r
+ printf("mp3 pos1024: %i, byte_offs %i/%i\n", pos, byte_offs, shared_ctl->mp3_len);\r
+\r
+ shared_ctl->mp3_offs = byte_offs;\r
+\r
+ // reset buffer pointers..\r
+ mp3_samples_ready = mp3_buffer_offs = mp3_play_bufsel = 0;\r
+ shared_ctl->mp3_buffsel = 1; // will change to 0 on first decode\r
+}\r
+\r
+\r
+int mp3_get_offset(void)\r
+{\r
+ int offs1024 = 0;\r
+ int cdda_on;\r
+\r
+ cdda_on = (PicoMCD & 1) && (currentConfig.EmuOpt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) &&\r
+ (Pico_mcd->scd.Status_CDC & 1) && loaded_mp3 && shared_ctl->mp3_offs < shared_ctl->mp3_len;\r
+\r
+ if (cdda_on) {\r
+ offs1024 = shared_ctl->mp3_offs << 7;\r
+ offs1024 /= shared_ctl->mp3_len;\r
+ offs1024 <<= 3;\r
+ }\r
+ printf("offs1024=%i (%i/%i)\n", offs1024, shared_ctl->mp3_offs, shared_ctl->mp3_len);\r
+\r
+ return offs1024;\r
+}\r
+\r
+\r