aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sludge/detection.cpp3
-rw-r--r--engines/sludge/language.cpp4
-rw-r--r--engines/sludge/language.h4
-rw-r--r--engines/sludge/main_loop.cpp57
-rw-r--r--engines/sludge/main_loop.h2
-rw-r--r--engines/sludge/sludge.cpp2
-rw-r--r--engines/sludge/sludge.h2
-rw-r--r--engines/sludge/sludger.cpp4
-rw-r--r--engines/sludge/sludger.h4
9 files changed, 17 insertions, 65 deletions
diff --git a/engines/sludge/detection.cpp b/engines/sludge/detection.cpp
index 423246ec2c..69e202cfb0 100644
--- a/engines/sludge/detection.cpp
+++ b/engines/sludge/detection.cpp
@@ -37,6 +37,9 @@ int SludgeEngine::getGameType() const { return _gameDescription->gameType; }
const char *SludgeEngine::getGameId() const { return _gameDescription->desc.gameId;}
uint32 SludgeEngine::getFeatures() const { return _gameDescription->desc.flags; }
Common::Language SludgeEngine::getLanguage() const { return _gameDescription->desc.language; }
+const char *SludgeEngine::getGameFile() const {
+ return _gameDescription->desc.filesDescriptions[0].fileName;
+}
} // End of namespace Sludge
diff --git a/engines/sludge/language.cpp b/engines/sludge/language.cpp
index 1aff3942fc..b0b3a8e1c0 100644
--- a/engines/sludge/language.cpp
+++ b/engines/sludge/language.cpp
@@ -81,7 +81,7 @@ char *getPrefsFilename(char *filename) {
return joined;
}
-void readIniFile(char *filename) {
+void readIniFile(const char *filename) {
char *langName = getPrefsFilename(copyString(filename));
@@ -161,7 +161,7 @@ void readIniFile(char *filename) {
fd.close();
}
-void saveIniFile(char *filename) {
+void saveIniFile(const char *filename) {
#if 0
char *langName = getPrefsFilename(copyString(filename));
FILE *fp = fopen(langName, "wt");
diff --git a/engines/sludge/language.h b/engines/sludge/language.h
index 033633b7e5..85d50bbb26 100644
--- a/engines/sludge/language.h
+++ b/engines/sludge/language.h
@@ -41,8 +41,8 @@ struct settingsStruct {
extern settingsStruct gameSettings;
-void readIniFile(char *filename);
-void saveIniFile(char *filename);
+void readIniFile(const char *filename);
+void saveIniFile(const char *filename);
int getLanguageForFileB();
void makeLanguageTable(Common::File *table);
diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index ebeedf974b..7498ab271d 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -295,7 +295,7 @@ void checkInput() {
#endif
}
-int main_loop(char *filename)
+int main_loop(const char *filename)
#if 0
try
#endif
@@ -304,62 +304,9 @@ int main_loop(char *filename)
winWidth = 640;
winHeight = 480;
- char *sludgeFile;
-
-#if 0
- time_t t;
- srand((unsigned) time(&t));
-
- // bundleFolder is used to look for the game file
- // and later to find the shader programs
-#ifdef __APPLE__
- // bundleFolder is set in applicationDidFinishLaunching.
-#elif defined __unix__
- bundleFolder = copyString(DATADIR); // DATADIR is defined in the Makefile.
-#else
- bundleFolder = copyString(argv[0]);
- int lastSlash = -1;
- for (int i = 0; bundleFolder[i]; i ++) {
- if (bundleFolder[i] == PATHSLASH) lastSlash = i;
- }
- bundleFolder[lastSlash + 1] = NULL;
-#endif
-
-#endif
-
- sludgeFile = filename;
- if (!sludgeFile) {
- sludgeFile = joinStrings(bundleFolder, "gamedata.slg");
- if (!(fileExists(sludgeFile))) {
- delete sludgeFile;
- sludgeFile = joinStrings(bundleFolder, "gamedata");
- if (!(fileExists(sludgeFile))) {
-#if 0
- sludgeFile = grabFileName();
-#endif
- }
- }
- }
-
-#if 0
-#if defined __unix__ && !(defined __APPLE__)
- if (!fileExists(sludgeFile)) {
- fprintf(stderr, "Game file not found.\n");
- printCmdlineUsage();
+ if (!initSludge(filename)) {
return 0;
}
-#endif
-#endif
-
- // The player pressed cancel in the file selection dialogue,
- // so we should quit now.
- if (!sludgeFile)
- return 0;
-
- // OK, so we DO want to start up, then...
- setGameFilePath(sludgeFile);
- if (!initSludge(sludgeFile))
- return 0;
#if 0
/* Initialize the SDL library */
diff --git a/engines/sludge/main_loop.h b/engines/sludge/main_loop.h
index 7ea58813d6..b287c8105e 100644
--- a/engines/sludge/main_loop.h
+++ b/engines/sludge/main_loop.h
@@ -24,7 +24,7 @@
namespace Sludge {
-int main_loop(char *filename);
+int main_loop(const char *filename);
} // End of namespace Sludge
diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index 725478c8db..6ea4b7ba4b 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -70,7 +70,7 @@ Common::Error SludgeEngine::run() {
_console = new SludgeConsole(this);
// debug log
- main_loop("Welcome.slg");
+ main_loop(getGameFile());
return Common::kNoError;
}
diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h
index a4e96c70cf..57544828b0 100644
--- a/engines/sludge/sludge.h
+++ b/engines/sludge/sludge.h
@@ -58,6 +58,8 @@ public:
uint32 getFeatures() const;
Common::Language getLanguage() const;
+ const char *getGameFile() const;
+
const SludgeGameDescription *_gameDescription;
private:
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index ea716266d8..70f818060b 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -135,7 +135,7 @@ void saveHandlers(Common::WriteStream *stream) {
stream->writeUint16BE(currentEvents->spaceFunction);
}
-Common::File *openAndVerify(char *filename, char extra1, char extra2,
+Common::File *openAndVerify(const char *filename, char extra1, char extra2,
const char *er, int &fileVersion) {
Common::File *fp = new Common::File();
if (!fp->open(filename)) {
@@ -186,7 +186,7 @@ Common::File *openAndVerify(char *filename, char extra1, char extra2,
return fp;
}
-bool initSludge(char *filename) {
+bool initSludge(const char *filename) {
int a = 0;
mouseCursorAnim = makeNullAnim();
diff --git a/engines/sludge/sludger.h b/engines/sludge/sludger.h
index 840af9e409..6234e591c2 100644
--- a/engines/sludge/sludger.h
+++ b/engines/sludge/sludger.h
@@ -76,7 +76,7 @@ struct inputType {
extern unsigned char *gameIcon;
extern int iconW, iconH;
-bool initSludge(char *);
+bool initSludge(const char *);
void sludgeDisplay();
int startNewFunctionNum(unsigned int, unsigned int, loadedFunction *, variableStack*&, bool = true);
bool handleInput();
@@ -87,7 +87,7 @@ void saveHandlers(Common::WriteStream *stream);
void finishFunction(loadedFunction *fun);
void abortFunction(loadedFunction *fun);
-Common::File *openAndVerify(char *filename, char extra1, char extra2, const char *er, int &fileVersion);
+Common::File *openAndVerify(const char *filename, char extra1, char extra2, const char *er, int &fileVersion);
void freezeSubs();
void unfreezeSubs();