aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ps2
diff options
context:
space:
mode:
authorMax Horn2009-11-23 22:28:44 +0000
committerMax Horn2009-11-23 22:28:44 +0000
commit6312da6d13b15c4b71f324c0106c8883ee024f45 (patch)
tree3f24440ce25d80777d6b68df0fa5acbece90b983 /backends/platform/ps2
parent68ebbf9022357b4a01063fe7354957c8df296346 (diff)
downloadscummvm-rg350-6312da6d13b15c4b71f324c0106c8883ee024f45.tar.gz
scummvm-rg350-6312da6d13b15c4b71f324c0106c8883ee024f45.tar.bz2
scummvm-rg350-6312da6d13b15c4b71f324c0106c8883ee024f45.zip
PS2: cleanup
svn-id: r46105
Diffstat (limited to 'backends/platform/ps2')
-rw-r--r--backends/platform/ps2/DmaPipe.cpp4
-rw-r--r--backends/platform/ps2/DmaPipe.h2
-rw-r--r--backends/platform/ps2/fileio.cpp24
-rw-r--r--backends/platform/ps2/fileio.h23
4 files changed, 20 insertions, 33 deletions
diff --git a/backends/platform/ps2/DmaPipe.cpp b/backends/platform/ps2/DmaPipe.cpp
index 2b50d10d1f..f3fbdb2c73 100644
--- a/backends/platform/ps2/DmaPipe.cpp
+++ b/backends/platform/ps2/DmaPipe.cpp
@@ -27,8 +27,8 @@
#include <kernel.h>
#include <malloc.h>
-#include "DmaPipe.h"
-#include "GsDefs.h"
+#include "backends/platform/ps2/DmaPipe.h"
+#include "backends/platform/ps2/GsDefs.h"
class SinglePipe {
public:
diff --git a/backends/platform/ps2/DmaPipe.h b/backends/platform/ps2/DmaPipe.h
index 6c770c03b0..2b71747cc2 100644
--- a/backends/platform/ps2/DmaPipe.h
+++ b/backends/platform/ps2/DmaPipe.h
@@ -28,7 +28,7 @@
#ifndef __DMAPIPE_H__
#define __DMAPIPE_H__
-#include "sysdefs.h"
+#include "backends/platform/ps2/sysdefs.h"
#include "backends/platform/ps2/GsDefs.h"
class SinglePipe;
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index 017286dc45..b0c3ce68e4 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -30,24 +30,16 @@
#include <fileio.h>
#include <assert.h>
#include <string.h>
-#include "backends/platform/ps2/asyncfio.h"
-#include "engines/engine.h"
-#include "common/file.h"
-#include "eecodyvdfs.h"
+
#include "common/config-manager.h"
+#include "common/file.h"
+#include "engines/engine.h"
+#include "backends/platform/ps2/asyncfio.h"
+#include "backends/platform/ps2/eecodyvdfs.h"
#include "backends/platform/ps2/ps2debug.h"
#include "backends/platform/ps2/systemps2.h"
#define __PS2_FILE_SEMA__ 1
-// #define __PS2_FILE_DEBUG 1
-// #define __PS2_CACHE_DEBUG__ 1
-
-#define PS2_CACHE_MAX (128 * 1024)
-#define PS2_CACHE_CHK (16 * 1024)
-
-extern OSystem_PS2 *g_systemPs2;
-
-uint32 _rseek;
AsyncFio fio;
@@ -60,8 +52,6 @@ Ps2File::Ps2File(void) {
_eof = false;
_err = false;
- // _cache = (uint8 *)malloc(PS2_CACHE_MAX);
-
_cacheBuf = (uint8*)memalign(64, CACHE_SIZE * 2);
_cacheOpRunning = 0;
@@ -96,7 +86,6 @@ Ps2File::~Ps2File(void) {
printf("close [%d] - sync'd = %d\n", _fd, r);
}
- // free(_cache);
free(_cacheBuf);
#ifdef __PS2_FILE_SEMA__
@@ -237,7 +226,6 @@ int Ps2File::seek(int32 offset, int origin) {
#ifdef __PS2_FILE_SEMA__
WaitSema(_sema);
#endif
- _rseek = 0;
int seekDest;
int res = -1;
switch (origin) {
@@ -255,7 +243,7 @@ int Ps2File::seek(int32 offset, int origin) {
break;
}
if ((seekDest >= 0) && (seekDest <= (int)_fileSize)) {
- // _rseek = fio.sync(_fd);
+ // uint32 _rseek = fio.sync(_fd);
_filePos = seekDest;
// fio.seek(_fd, _filePos, SEEK_SET);
// fio.sync(_fd);
diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h
index 6838162e06..e3b1a98db9 100644
--- a/backends/platform/ps2/fileio.h
+++ b/backends/platform/ps2/fileio.h
@@ -26,22 +26,21 @@
#ifndef __PS2FILE_IO__
#define __PS2FILE_IO__
-typedef unsigned long uint64;
-typedef signed long int64;
-
#include <stdio.h>
#include "common/scummsys.h"
+enum {
+ CACHE_SIZE = 2048 * 32,
+ MAX_READ_STEP = 2048 * 16,
+ MAX_CACHED_FILES = 6,
+ CACHE_READ_THRESHOLD = 16 * 2048,
+ CACHE_FILL_MIN = 2048 * 24,
+ READ_ALIGN = 64, // align all reads to the size of an EE cache line
+ READ_ALIGN_MASK = READ_ALIGN - 1
+};
-#define CACHE_SIZE (2048 * 32)
-#define MAX_READ_STEP (2048 * 16)
-#define MAX_CACHED_FILES 6
-#define CACHE_READ_THRESHOLD (16 * 2048)
-#define CACHE_FILL_MIN (2048 * 24)
-#define READ_ALIGN 64 // align all reads to the size of an EE cache line
-#define READ_ALIGN_MASK (READ_ALIGN - 1)
-
-
+// TODO: Make this a subclass of SeekableReadStream & WriteStream
+// See also StdioStream.
class Ps2File {
public:
Ps2File(void);