aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxcd
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2022-10-11 11:46:24 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2022-10-11 11:46:24 +0200
commite0e608855b9b2e83a92047294e1f5a242ff51e88 (patch)
tree07179b68e215eb353042a1eb24c0a6ef9b50346d /libpsn00b/psxcd
parent3f859332c8e345ef3a35e24ab8ee3617cb477df7 (diff)
downloadpsn00bsdk-e0e608855b9b2e83a92047294e1f5a242ff51e88.tar.gz
Replace DEBUG macro with standard NDEBUG macro
Diffstat (limited to 'libpsn00b/psxcd')
-rw-r--r--libpsn00b/psxcd/isofs.c15
-rw-r--r--libpsn00b/psxcd/psxcd.c32
2 files changed, 22 insertions, 25 deletions
diff --git a/libpsn00b/psxcd/isofs.c b/libpsn00b/psxcd/isofs.c
index 6755d3f..fb1f6c9 100644
--- a/libpsn00b/psxcd/isofs.c
+++ b/libpsn00b/psxcd/isofs.c
@@ -7,13 +7,10 @@
#include "psxcd.h"
#include "isofs.h"
-// Uncommend to enable debug output
-//#define DEBUG
-
-#ifdef DEBUG
-#define _LOG(...) printf(__VA_ARGS__)
-#else
+#ifdef NDEBUG
#define _LOG(...)
+#else
+#define _LOG(...) printf(__VA_ARGS__)
#endif
#define DEFAULT_PATH_SEP '\\'
@@ -215,7 +212,7 @@ static int _CdReadIsoDirectory(int lba)
return 0;
}
-#ifdef DEBUG
+#ifndef NDEBUG
static void dump_directory(void)
{
@@ -479,7 +476,7 @@ CdlFILE *CdSearchFile(CdlFILE *fp, const char *filename)
// Get number of directories in path table
num_dirs = get_pathtable_entry(0, NULL, NULL);
-#ifdef DEBUG
+#ifndef NDEBUG
_LOG("psxcd: Directories in path table: %d\n", num_dirs);
rbuff = resolve_pathtable_path(num_dirs-1, tpath_rbuff+127);
@@ -536,7 +533,7 @@ CdlFILE *CdSearchFile(CdlFILE *fp, const char *filename)
strcat(fp->name, ";1");
}
-#ifdef DEBUG
+#ifndef NDEBUG
dump_directory();
#endif
diff --git a/libpsn00b/psxcd/psxcd.c b/libpsn00b/psxcd/psxcd.c
index ac93376..65dea48 100644
--- a/libpsn00b/psxcd/psxcd.c
+++ b/libpsn00b/psxcd/psxcd.c
@@ -20,10 +20,10 @@ volatile int _cd_last_sector_count;
int _cd_media_changed;
-#ifdef DEBUG
-#define _LOG(...) printf(__VA_ARGS__)
-#else
+#ifdef NDEBUG
#define _LOG(...)
+#else
+#define _LOG(...) printf(__VA_ARGS__)
#endif
void _cd_init(void);
@@ -88,7 +88,7 @@ int CdControlB(unsigned char com, const void *param, unsigned char *result)
int CdControlF(unsigned char com, const void *param)
{
int param_len=0;
-
+
// Command specific parameters
switch(com)
{
@@ -116,21 +116,21 @@ int CdControlF(unsigned char com, const void *param)
break;
case CdlGetTD:
param_len = 1;
+ break;
+ case CdlReadN:
+ case CdlReadS:
+ case CdlSeekL:
+ case CdlSeekP:
+ if( param )
+ {
+ _cd_control(CdlSetloc, param, 3);
+ _cd_last_setloc = *((CdlLOC*)param);
+ }
}
-
- // Issue Setloc if parameters are specified on CdlReadN and CdlReadS
- if( ( com == CdlReadN ) || ( com == CdlReadS ) )
- {
- if( param )
- {
- _cd_control(CdlSetloc, param, 3);
- _cd_last_setloc = *((CdlLOC*)param);
- }
- }
-
+
// Issue CD command
_cd_control(com, param, param_len);
-
+
return 1;
}