Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
beetle-saturn-libretro
Commits
b65f9995
Commit
b65f9995
authored
Aug 15, 2016
by
Libretro-Admin
Browse files
Cleanups
parent
68a75379
Changes
9
Hide whitespace changes
Inline
Side-by-side
mednafen/Stream.h
View file @
b65f9995
...
...
@@ -33,12 +33,12 @@ class Stream
virtual
uint64_t
read
(
void
*
data
,
uint64_t
count
,
bool
error_on_eos
=
true
)
=
0
;
virtual
void
write
(
const
void
*
data
,
uint64_t
count
)
=
0
;
virtual
void
truncate
(
uint64_t
length
)
=
0
;
// Should have ftruncate()-like semantics; but avoid using it to extend files.
virtual
void
seek
(
int64_t
offset
,
int
whence
)
=
0
;
virtual
uint64_t
tell
(
void
)
=
0
;
virtual
uint64_t
size
(
void
)
=
0
;
virtual
void
truncate
(
uint64_t
length
)
=
0
;
// Should have ftruncate()-like semantics; but avoid using it to extend files.
virtual
void
flush
(
void
)
=
0
;
virtual
uint64_t
size
(
void
)
=
0
;
virtual
void
close
(
void
)
=
0
;
// Flushes(in the case of writeable streams) and closes the stream.
// Necessary since this operation can fail(running out of disk space, for instance),
// and throw an exception in the destructor would be a Bad Idea(TM).
...
...
mednafen/cdrom/CDAFReader.cpp
View file @
b65f9995
...
...
@@ -42,34 +42,12 @@ CDAFReader::~CDAFReader()
}
enum
CDAFReader
*
CDAFR_Open
(
Stream
*
fp
)
{
AUDIO_VORBIS
=
0
,
#ifdef HAVE_MPC
AUDIO_MPC
,
return
CDAFR_MPC_Open
(
fp
);
#else
return
CDAFR_Vorbis_Open
(
fp
);
#endif
AUDIO_LAST
};
CDAFReader
*
CDAFR_Open
(
Stream
*
fp
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
AUDIO_LAST
;
i
++
)
{
switch
(
i
)
{
case
AUDIO_VORBIS
:
return
CDAFR_Vorbis_Open
(
fp
);
#ifdef HAVE_MPC
case
AUDIO_MPC
:
return
CDAFR_MPC_Open
(
fp
);
#endif
default:
break
;
}
}
return
(
NULL
);
}
mednafen/cdrom/CDAccess.cpp
View file @
b65f9995
...
...
@@ -19,6 +19,9 @@
#include "CDAccess.h"
#include "CDAccess_Image.h"
#include "CDAccess_CCD.h"
#ifdef HAVE_PBP
#include "CDAccess_PBP.h"
#endif
CDAccess
::
CDAccess
()
{
...
...
@@ -32,13 +35,17 @@ CDAccess::~CDAccess()
CDAccess
*
CDAccess_Open
(
const
std
::
string
&
path
,
bool
image_memcache
)
{
CDAccess
*
ret
=
NULL
;
if
(
path
.
size
()
>=
4
&&
!
strcasecmp
(
path
.
c_str
()
+
path
.
size
()
-
4
,
".ccd"
))
ret
=
new
CDAccess_CCD
(
path
,
image_memcache
);
else
ret
=
new
CDAccess_Image
(
path
,
image_memcache
);
return
ret
;
CDAccess
*
ret
=
NULL
;
if
(
path
.
size
()
>=
4
&&
!
strcasecmp
(
path
.
c_str
()
+
path
.
size
()
-
4
,
".ccd"
))
ret
=
new
CDAccess_CCD
(
path
,
image_memcache
);
#ifdef HAVE_PBP
else
if
(
path
.
size
()
>=
4
&&
!
strcasecmp
(
path
.
c_str
()
+
path
.
size
()
-
4
,
".pbp"
))
ret
=
new
CDAccess_PBP
(
path
,
image_memcache
);
#endif
else
ret
=
new
CDAccess_Image
(
path
,
image_memcache
);
return
ret
;
}
mednafen/cdrom/CDAccess.h
View file @
b65f9995
...
...
@@ -12,7 +12,7 @@ class CDAccess
CDAccess
();
virtual
~
CDAccess
();
virtual
void
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
)
=
0
;
virtual
bool
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
)
=
0
;
// Returns false if the read wouldn't be "fast"(i.e. reading from a disk),
// or if the read can't be done in a thread-safe re-entrant manner.
...
...
@@ -20,7 +20,7 @@ class CDAccess
// Writes 96 bytes into pwbuf, and returns 'true' otherwise.
virtual
bool
Fast_Read_Raw_PW_TSRE
(
uint8_t
*
pwbuf
,
int32_t
lba
)
=
0
;
virtual
void
Read_TOC
(
TOC
*
toc
)
=
0
;
virtual
bool
Read_TOC
(
TOC
*
toc
)
=
0
;
private:
CDAccess
(
const
CDAccess
&
);
// No copy constructor.
...
...
mednafen/cdrom/CDAccess_CCD.cpp
View file @
b65f9995
...
...
@@ -400,24 +400,26 @@ CDAccess_CCD::~CDAccess_CCD()
delete
[]
sub_data
;
}
void
CDAccess_CCD
::
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
)
bool
CDAccess_CCD
::
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
)
{
if
(
lba
<
0
)
{
synth_udapp_sector_lba
(
0xFF
,
tocd
,
lba
,
0
,
buf
);
return
;
return
true
;
/* TODO/FIXME - see if we need to return false here? */
}
if
((
size_t
)
lba
>=
img_numsectors
)
{
synth_leadout_sector_lba
(
0xFF
,
tocd
,
lba
,
buf
);
return
;
return
true
;
/* TODO/FIXME - see if we need to return false here? */
}
img_stream
->
seek
(
lba
*
2352
,
SEEK_SET
);
img_stream
->
read
(
buf
,
2352
);
subpw_interleave
(
&
sub_data
[
lba
*
96
],
buf
+
2352
);
return
true
;
}
bool
CDAccess_CCD
::
Fast_Read_Raw_PW_TSRE
(
uint8_t
*
pwbuf
,
int32_t
lba
)
...
...
@@ -439,8 +441,9 @@ bool CDAccess_CCD::Fast_Read_Raw_PW_TSRE(uint8_t* pwbuf, int32_t lba)
return
true
;
}
void
CDAccess_CCD
::
Read_TOC
(
TOC
*
toc
)
bool
CDAccess_CCD
::
Read_TOC
(
TOC
*
toc
)
{
*
toc
=
tocd
;
return
true
;
}
mednafen/cdrom/CDAccess_CCD.h
View file @
b65f9995
...
...
@@ -31,11 +31,11 @@ class CDAccess_CCD : public CDAccess
CDAccess_CCD
(
const
std
::
string
&
path
,
bool
image_memcache
);
virtual
~
CDAccess_CCD
();
virtual
void
Read_Raw_Sector
(
uint8
*
buf
,
int32
lba
);
virtual
bool
Read_Raw_Sector
(
uint8
*
buf
,
int32
lba
);
virtual
bool
Fast_Read_Raw_PW_TSRE
(
uint8
*
pwbuf
,
int32
lba
);
virtual
void
Read_TOC
(
TOC
*
toc
);
virtual
bool
Read_TOC
(
TOC
*
toc
);
private:
...
...
mednafen/cdrom/CDAccess_Image.cpp
View file @
b65f9995
...
...
@@ -30,13 +30,15 @@
#include "../mednafen.h"
#include <s
ys/types
.h>
#include <s
tdint
.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <memory>
#include <retro_stat.h>
#include "../general.h"
#include "../mednafen-endian.h"
#include "../FileStream.h"
...
...
@@ -1020,7 +1022,7 @@ CDAccess_Image::~CDAccess_Image()
Cleanup
();
}
void
CDAccess_Image
::
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
)
bool
CDAccess_Image
::
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
)
{
uint8_t
SimuQ
[
0xC
];
int32_t
track
;
...
...
@@ -1053,7 +1055,7 @@ void CDAccess_Image::Read_Raw_Sector(uint8_t *buf, int32_t lba)
}
synth_leadout_sector_lba
(
data_synth_mode
,
toc
,
lba
,
buf
);
return
;
return
true
;
}
//
//
...
...
@@ -1180,6 +1182,8 @@ void CDAccess_Image::Read_Raw_Sector(uint8_t *buf, int32_t lba)
ct
->
fp
->
read
(
buf
+
2352
,
96
);
}
}
// end if audible part of audio track read.
return
true
;
}
bool
CDAccess_Image
::
Fast_Read_Raw_PW_TSRE
(
uint8_t
*
pwbuf
,
int32_t
lba
)
...
...
@@ -1325,9 +1329,10 @@ int32_t CDAccess_Image::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
return
track
;
}
void
CDAccess_Image
::
Read_TOC
(
TOC
*
rtoc
)
bool
CDAccess_Image
::
Read_TOC
(
TOC
*
rtoc
)
{
*
rtoc
=
toc
;
return
true
;
}
void
CDAccess_Image
::
GenerateTOC
(
void
)
...
...
mednafen/cdrom/CDAccess_Image.h
View file @
b65f9995
...
...
@@ -58,11 +58,11 @@ class CDAccess_Image : public CDAccess
CDAccess_Image
(
const
std
::
string
&
path
,
bool
image_memcache
);
virtual
~
CDAccess_Image
();
virtual
void
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
);
virtual
bool
Read_Raw_Sector
(
uint8_t
*
buf
,
int32_t
lba
);
virtual
bool
Fast_Read_Raw_PW_TSRE
(
uint8_t
*
pwbuf
,
int32_t
lba
);
virtual
void
Read_TOC
(
TOC
*
toc
);
virtual
bool
Read_TOC
(
TOC
*
toc
);
private:
...
...
mednafen/cdrom/scsicd.cpp
View file @
b65f9995
...
...
@@ -18,7 +18,6 @@
#include <mednafen/mednafen.h>
#include <math.h>
#include <algorithm>
#include <trio/trio.h>
#include "scsicd.h"
#include "cdromif.h"
#include "SimpleFIFO.h"
...
...
@@ -28,8 +27,6 @@
#include <emmintrin.h>
#endif
using
namespace
CDUtility
;
static
uint32_t
CD_DATA_TRANSFER_RATE
;
static
uint32_t
System_Clock
;
static
void
(
*
CDIRQCallback
)(
int
);
...
...
@@ -173,7 +170,7 @@ static cdda_t cdda;
static
SimpleFIFO
<
uint8_t
>
*
din
=
NULL
;
static
CDUtility
::
TOC
toc
;
static
TOC
toc
;
static
uint32_t
read_sec_start
;
static
uint32_t
read_sec
;
...
...
@@ -2876,11 +2873,11 @@ uint32_t SCSICD_Run(scsicd_timestamp_t system_timestamp)
log_buffer
[
0
]
=
0
;
lb_pos
=
trio_
snprintf
(
log_buffer
,
1024
,
"Command: %02x, %s%s "
,
cd
.
command_buffer
[
0
],
cmd_info_ptr
->
pretty_name
?
cmd_info_ptr
->
pretty_name
:
"!!BAD COMMAND!!"
,
lb_pos
=
snprintf
(
log_buffer
,
1024
,
"Command: %02x, %s%s "
,
cd
.
command_buffer
[
0
],
cmd_info_ptr
->
pretty_name
?
cmd_info_ptr
->
pretty_name
:
"!!BAD COMMAND!!"
,
(
cmd_info_ptr
->
flags
&
SCF_UNTESTED
)
?
"(UNTESTED)"
:
""
);
for
(
int
i
=
0
;
i
<
RequiredCDBLen
[
cd
.
command_buffer
[
0
]
>>
4
];
i
++
)
lb_pos
+=
trio_
snprintf
(
log_buffer
+
lb_pos
,
1024
-
lb_pos
,
"%02x "
,
cd
.
command_buffer
[
i
]);
lb_pos
+=
snprintf
(
log_buffer
+
lb_pos
,
1024
-
lb_pos
,
"%02x "
,
cd
.
command_buffer
[
i
]);
SCSILog
(
"SCSI"
,
"%s"
,
log_buffer
);
//puts(log_buffer);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment