diff options
author | Torbjörn Andersson | 2003-11-18 08:17:36 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2003-11-18 08:17:36 +0000 |
commit | 50be85ac4293cc3d35655a71e02a689a0c8e8524 (patch) | |
tree | 9813ca85da0101657eee023eed34e7bc8d0a775d /sword2/startup.cpp | |
parent | c90d4c4e08e8946589c84a1281ca582e84946f8f (diff) | |
download | scummvm-rg350-50be85ac4293cc3d35655a71e02a689a0c8e8524.tar.gz scummvm-rg350-50be85ac4293cc3d35655a71e02a689a0c8e8524.tar.bz2 scummvm-rg350-50be85ac4293cc3d35655a71e02a689a0c8e8524.zip |
The readFile() function was only used once, for creating the debugger start
menu, and wasn't even necessary there so I've removed it. That means the
tony_gsdk.cpp file is no longer necessary. Sorry Tony, but at least you
still have your own debugger command! ;-)
svn-id: r11342
Diffstat (limited to 'sword2/startup.cpp')
-rw-r--r-- | sword2/startup.cpp | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/sword2/startup.cpp b/sword2/startup.cpp index d8ccd12089..f4b19dbce8 100644 --- a/sword2/startup.cpp +++ b/sword2/startup.cpp @@ -18,6 +18,7 @@ */ #include "common/stdafx.h" +#include "common/file.h" #include "sword2/sword2.h" namespace Sword2 { @@ -30,10 +31,9 @@ uint32 Logic::initStartMenu(void) { // We query each in turn and setup an array of start structures. // If the file doesn't exist then we say so and return a 0. - uint32 end; - mem *temp; + File fp; + uint32 pos = 0; - uint32 j = 0; char *raw_script; uint32 null_pc; @@ -45,30 +45,45 @@ uint32 Logic::initStartMenu(void) { debug(5, "initialising start menu"); - if (!(end = _vm->readFile("startup.inf", &temp, UID_temp))) { - debug(5, "Init_start_menu cannot open startup.inf"); - return 0; // meaning no start menu available + if (!fp.open("startup.inf")) { + warning("initStartMenu: cannot open startup.inf - the debugger won't have a start menu"); + return 0; } - // Ok, we've loaded in the startup.inf file which contains a list of - // all the files now extract the filenames + // The startup.inf file which contains a list of all the files. Now + // extract the filenames + + while (1) { + bool done = false; + + while (1) { + byte b = fp.readByte(); - do { - while (temp->ad[j] != 13) { // item must have an #0d0a - ascii_start_ids[_totalScreenManagers][pos] = temp->ad[j]; - j++; + if (fp.ioFailed()) { + done = true; + break; + } + + // Each item ends with CRLF + if (b == 13) { + fp.readByte(); + break; + } + + if (pos < 7) + ascii_start_ids[_totalScreenManagers][pos] = b; pos++; } + if (done) + break; + // NULL terminate our extracted string ascii_start_ids[_totalScreenManagers][pos] = 0; // reset position in current slot between entries pos = 0; - // past the 0a - j += 2; - // done another _totalScreenManagers++; @@ -76,7 +91,9 @@ uint32 Logic::initStartMenu(void) { debug(5, "WARNING MAX_starts exceeded!"); break; } - } while (j <end); + } + + fp.close(); // using this method the Gode generated resource.inf must have #0d0a // on the last entry @@ -88,8 +105,8 @@ uint32 Logic::initStartMenu(void) { // instance a startup could be set for later in the game where // specific vars are set - for (j = 0; j < _totalScreenManagers; j++) { - _startRes = atoi(ascii_start_ids[j]); + for (uint i = 0; i < _totalScreenManagers; i++) { + _startRes = atoi(ascii_start_ids[i]); debug(5, "+querying screen manager %d", _startRes); @@ -111,8 +128,6 @@ uint32 Logic::initStartMenu(void) { debug(5, "- resource %d invalid", _startRes); } - _vm->_memory->freeMemory(temp); - return 1; } |