merge remote-tracking branch 'notaz/master'
[pcsx_rearmed.git] / libpcsxcore / cdriso.c
index dca64fa..6f59579 100644 (file)
 #include "cdriso.h"
 #include "ppf.h"
 
+#include <errno.h>
+#include <zlib.h>
+
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN
 #include <process.h>
 #include <windows.h>
 #define strcasecmp _stricmp
-#define usleep(x) Sleep((x) / 1000)
+#define usleep(x) (Sleep((x) / 1000))
 #else
 #include <pthread.h>
 #include <sys/time.h>
 #include <unistd.h>
 #endif
-#include <errno.h>
-#include <zlib.h>
 
 #define OFF_T_MSB ((off_t)1 << (sizeof(off_t) * 8 - 1))
 
@@ -225,7 +226,9 @@ static void *playthread(void *param)
                        do {
                                ret = SPU_playCDDAchannel((short *)sndbuffer, s);
                                if (ret == 0x7761)
+            {
                                        usleep(6 * 1000);
+            }
                        } while (ret == 0x7761 && playing); // rearmed_wait
                }
 
@@ -236,7 +239,9 @@ static void *playthread(void *param)
                        // HACK: stop feeding data while emu is paused
                        extern int stop;
                        while (stop && playing)
+         {
                                usleep(10000);
+         }
 
                        now = GetTickCount();
                        osleep = t - now;
@@ -560,20 +565,15 @@ static int parsecue(const char *isofile) {
                        if (t != 1)
                                sscanf(linebuf, " FILE %255s", tmpb);
 
-                       // absolute path?
-                       ti[numtracks + 1].handle = fopen(tmpb, "rb");
-                       if (ti[numtracks + 1].handle == NULL) {
-                               // relative to .cue?
-                               tmp = strrchr(tmpb, '\\');
-                               if (tmp == NULL)
-                                       tmp = strrchr(tmpb, '/');
-                               if (tmp != NULL)
-                                       tmp++;
-                               else
-                                       tmp = tmpb;
-                               strncpy(incue_fname, tmp, incue_max_len);
-                               ti[numtracks + 1].handle = fopen(filepath, "rb");
-                       }
+                       tmp = strrchr(tmpb, '\\');
+                       if (tmp == NULL)
+                               tmp = strrchr(tmpb, '/');
+                       if (tmp != NULL)
+                               tmp++;
+                       else
+                               tmp = tmpb;
+                       strncpy(incue_fname, tmp, incue_max_len);
+                       ti[numtracks + 1].handle = fopen(filepath, "rb");
 
                        // update global offset if this is not first file in this .cue
                        if (numtracks + 1 > 1) {