aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Hamm2002-02-27 22:48:55 +0000
committerVincent Hamm2002-02-27 22:48:55 +0000
commit71a97abfc235656647235ccd76687d2fd0b2333d (patch)
tree2035bb177b139c0abf5784a69c74ecf3ab42b9ee
parent9a6ac48c0fbef25f152c97360d34ce1066df351a (diff)
downloadscummvm-rg350-71a97abfc235656647235ccd76687d2fd0b2333d.tar.gz
scummvm-rg350-71a97abfc235656647235ccd76687d2fd0b2333d.tar.bz2
scummvm-rg350-71a97abfc235656647235ccd76687d2fd0b2333d.zip
Added an option to specify the game data path
svn-id: r3636
-rw-r--r--resource.cpp8
-rw-r--r--scumm.h1
-rw-r--r--scummvm.cpp12
-rw-r--r--sound.cpp8
4 files changed, 21 insertions, 8 deletions
diff --git a/resource.cpp b/resource.cpp
index 8cf84106ac..f0c1329a3f 100644
--- a/resource.cpp
+++ b/resource.cpp
@@ -64,9 +64,9 @@ void Scumm::openRoom(int room) {
}
if (!(_features & GF_SMALL_HEADER)) {
if(_features & GF_AFTER_V7)
- sprintf(buf, "%s.la%d", _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf, "%s%s.la%d", _gameDataPath, _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
else
- sprintf(buf, "%s.%.3d", _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf, "%s%s.%.3d", _gameDataPath, _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
_encbyte = (_features & GF_USE_KEY) ? 0x69 : 0;
} else if(!(_features & GF_SMALL_NAMES)) {
if(room==0 || room>=900) {
@@ -78,11 +78,11 @@ void Scumm::openRoom(int room) {
askForDisk(buf);
} else {
- sprintf(buf, "%s//disk%.2d.lec",_exe_name,res.roomno[rtRoom][room]);
+ sprintf(buf, "%sdisk%.2d.lec",_gameDataPath,res.roomno[rtRoom][room]);
_encbyte = 0x69;
}
} else {
- sprintf(buf, "%s//%.2d.lfl",_exe_name,room);
+ sprintf(buf, "%s%.2d.lfl",_gameDataPath,room);
if(_features & GF_OLD_BUNDLE)
_encbyte = 0xFF;
else
diff --git a/scumm.h b/scumm.h
index 9a14a1bbd0..16da3fae42 100644
--- a/scumm.h
+++ b/scumm.h
@@ -806,6 +806,7 @@ struct Scumm {
void *_fileHandle;
void *_sfxFile;
char *_exe_name;
+ char *_gameDataPath;
byte _saveLoadFlag;
byte _saveLoadSlot;
diff --git a/scummvm.cpp b/scummvm.cpp
index e6b23a1b20..e99a2992a7 100644
--- a/scummvm.cpp
+++ b/scummvm.cpp
@@ -22,6 +22,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "gui.h"
+#include "string.h"
void Scumm::initRandSeeds() {
_randSeed1 = 0xA943DE35;
@@ -192,6 +193,8 @@ void Scumm::scummMain(int argc, char **argv) {
_maxHeapThreshold = 450000;
_minHeapThreshold = 400000;
+
+ _gameDataPath = NULL;
parseCommandLine(argc, argv);
@@ -203,6 +206,10 @@ void Scumm::scummMain(int argc, char **argv) {
_features = GF_DEFAULT;
}
+ if (!_gameDataPath) {
+ warning("No path was provided. Assuming that data file are in the current directory");
+ }
+
if(_features & GF_AFTER_V7)
setupScummVarsNew();
else
@@ -401,12 +408,15 @@ void Scumm::parseCommandLine(int argc, char **argv) {
case 'v':
printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " " __TIME__ "\n");
exit(1);
+ case 'p':
+ _gameDataPath = argv[++i];
+ break;
default:
ShowHelpAndExit:;
printf(
"ScummVM - Scumm Interpreter\n"
"Syntax:\n"
- "\tscummvm [-b<num>] game\n"
+ "\tscummvm [-b<num>] [-p path] game\n"
"Flags:\n"
"\tb<num> - start in that room\n"
"\tf - fullscreen mode\n");
diff --git a/sound.cpp b/sound.cpp
index 0cd740b82b..e9afac77a7 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -376,10 +376,12 @@ void *Scumm::openSfxFile() {
* That way, you can keep .sou files for multiple games in the
* same directory */
- sprintf(buf, "%s.sou", _exe_name);
+ sprintf(buf, "%s%s.sou", _gameDataPath, _exe_name);
file = fopen(buf, "rb");
- if (!file)
- file = fopen("monster.sou", "rb");
+ if (!file) {
+ sprintf(buf, "%smonster.sou", _gameDataPath, _exe_name);
+ file = fopen(buf, "rb");
+ }
return file;
}