From 4e77db816167e553017405fc751e56e0a6650ffe Mon Sep 17 00:00:00 2001 From: ponchio Date: Thu, 21 Oct 2004 12:19:52 +0000 Subject: [PATCH] Fixed rambuffer. --- apps/nexus/patchserver.cpp | 15 ++++++--------- apps/nexus/patchserver.h | 8 ++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/apps/nexus/patchserver.cpp b/apps/nexus/patchserver.cpp index 79bfc602..c012717c 100644 --- a/apps/nexus/patchserver.cpp +++ b/apps/nexus/patchserver.cpp @@ -15,8 +15,7 @@ bool PatchServer::Create(const std::string &filename, signature = sig; chunk_size = csize; - if(ram_size == 0) ram_size = 128000000; - ram_size = rsize/chunk_size; + ram_size = rsize/chunk_size + 1; ram_used = 0; vbo_size = 0; vbo_used = 0; @@ -26,7 +25,7 @@ bool PatchServer::Create(const std::string &filename, ram_flushed = 0; lru.clear(); - return File::Create(filename); + return MFile::Create(filename); } bool PatchServer::Load(const std::string &filename, Signature sig, @@ -34,11 +33,9 @@ bool PatchServer::Load(const std::string &filename, Signature sig, unsigned int rsize) { signature = sig; - chunk_size = csize; + chunk_size = csize/chunk_size + 1; - if(ram_size == 0) ram_size = 128000000; - ram_size = rsize/chunk_size; - + ram_size = rsize/chunk_size + 1; ram_used = 0; vbo_size = 0; vbo_used = 0; @@ -48,12 +45,12 @@ bool PatchServer::Load(const std::string &filename, Signature sig, ram_flushed = 0; lru.clear(); - return File::Load(filename, readonly); + return MFile::Load(filename, readonly); } void PatchServer::Close() { FlushAll(); - File::Close(); + MFile::Close(); } //TODO add error checking. diff --git a/apps/nexus/patchserver.h b/apps/nexus/patchserver.h index c9da64a6..a039d6f6 100644 --- a/apps/nexus/patchserver.h +++ b/apps/nexus/patchserver.h @@ -2,7 +2,7 @@ #define NXS_PATCH_SERVER_H #include "patch.h" -#include "file.h" +#include "mfile.h" #include @@ -15,7 +15,7 @@ struct PatchEntry { unsigned int lru_pos; }; -class PatchServer: public File { +class PatchServer: public MFile { public: struct PTime { @@ -51,10 +51,10 @@ class PatchServer: public File { PatchServer(): chunk_size(1024), ram_size(128000000), vbo_size(32000000) {} bool Create(const std::string &filename, Signature signature, - unsigned int chunk_size, unsigned int ram_size = 0); + unsigned int chunk_size, unsigned int ram_size = 128000000); bool Load(const std::string &filename, Signature sig, unsigned int chunk_size, bool readonly, - unsigned int ram_size = 0); + unsigned int ram_size = 128000000); void Close();