aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins/files.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/hopkins/files.cpp')
-rw-r--r--engines/hopkins/files.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp
index 2390ebbdf8..6620f2878c 100644
--- a/engines/hopkins/files.cpp
+++ b/engines/hopkins/files.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -25,6 +25,7 @@
#include "hopkins/hopkins.h"
#include "hopkins/globals.h"
+#include "common/config-manager.h"
#include "common/system.h"
#include "common/debug.h"
#include "common/file.h"
@@ -50,12 +51,13 @@ byte *FileManager::loadFile(const Common::String &file) {
// Allocate space for the file contents
size_t filesize = f.size();
- byte *data = _vm->_globals->allocMemory(filesize);
+ byte *data = _vm->_globals->allocMemory(filesize+1);
if (!data)
error("Error allocating space for file being loaded - %s", file.c_str());
readStream(f, data, filesize);
f.close();
+ data[filesize] = '\0';
return data;
}
@@ -68,20 +70,11 @@ int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes
}
/**
- * Initialize censorship based on blood.dat file
+ * The original censorship was based on blood.dat file.
+ * It's now using the config manager and a per-engine GUI option.
*/
void FileManager::initCensorship() {
- _vm->_globals->_censorshipFl = false;
-
- // If file doesn't exist, fallback to uncensored
- if (fileExists("BLOOD.DAT")) {
- char *data = (char *)loadFile("BLOOD.DAT");
-
- if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K'))
- _vm->_globals->_censorshipFl = true;
-
- _vm->_globals->freeMemory((byte *)data);
- }
+ _vm->_globals->_censorshipFl = ConfMan.getBool("enable_gore");
}
/**