1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00

Improve dfbinimage2 plugin CD handling (seeking, fix TOC parsing)

This commit is contained in:
Ganael LAPLANCHE 2011-07-15 12:37:24 +00:00
parent 4612e12df6
commit 53cf19d422
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=277748
3 changed files with 7 additions and 13 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= pcsxr
PORTVERSION= 1.9.92.r68256
PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= http://contribs.martymac.org/FreeBSD-ports/distfiles/ \
LOCAL/martymac

View File

@ -1,5 +1,5 @@
--- plugins/dfbinimage2/FileInterface.cpp.orig 2008-08-24 14:27:09.000000000 +0000
+++ plugins/dfbinimage2/FileInterface.cpp 2010-04-22 06:01:39.002592019 +0000
--- plugins/dfbinimage2/FileInterface.cpp.orig 2011-07-01 06:50:32.771525631 +0200
+++ plugins/dfbinimage2/FileInterface.cpp 2011-07-01 08:34:37.050364589 +0200
@@ -35,7 +35,9 @@
#include <fcntl.h>
#include <sys/stat.h>
@ -32,22 +32,15 @@
bufferPos.setMSF(MSFTime(255,255,255));
}
@@ -482,9 +484,16 @@
@@ -482,9 +484,9 @@
char *buf = (char*)fileBuffer;
int cnt;
for(cnt = 0; cnt < bufferFrames; cnt++) {
- memcpy(buf, seekTime.getMSFbuf(), 3);
- if(ioctl(theFd, CDROMREADRAW, buf)<0)
- break;
+ if (lseek(theFd,
+ seekTime.getMSF().m() * bytesPerMinute +
+ seekTime.getMSF().s() * bytesPerSecond +
+ seekTime.getMSF().f() * bytesPerFrame,
+ SEEK_SET) == -1) {
+ return;
+ }
+ if (read(theFd, buf, bytesPerFrame) == -1) {
+ return;
+ if (pread(theFd, buf, bytesPerFrame, seekTime.getAbsoluteFrame() * bytesPerFrame) != bytesPerFrame) {
+ break;
+ }
buf += bytesPerFrame;
seekTime += CDTime(0,0,1);

View File

@ -16,7 +16,7 @@
- struct cdrom_tochdr tocHdr;
- if(ioctl(theFd, CDROMREADTOCHDR, &tocHdr) < 0) {
+ struct ioc_toc_header tocHdr;
+ if(ioctl(theFd, CDIOREADTOCENTRY, &tocHdr) < 0) {
+ if(ioctl(theFd, CDIOREADTOCHEADER, &tocHdr) < 0) {
close(theFd);
Exception e(std::string("Cannot read TOC: ") + cuename);
THROW(e);