[Scummvm-cvs-logs] SF.net SVN: scummvm: [23437] scummvm/branches/branch-0-9-0
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Thu Jul 20 22:37:40 CEST 2006
Revision: 23437
http://svn.sourceforge.net/scummvm/?rev=23437&view=rev
Author: eriktorbjorn
Date: 2006-07-08 13:26:13 -0700 (Sat, 08 Jul 2006)
Log Message:
-----------
Backported the more robust handling of the startup.inf file. This should be
completely safe, as the file is optional.
Modified Paths:
--------------
scummvm/branches/branch-0-9-0/NEWS
scummvm/branches/branch-0-9-0/engines/sword2/startup.cpp
Modified: scummvm/branches/branch-0-9-0/NEWS
===================================================================
--- scummvm/branches/branch-0-9-0/NEWS 2006-07-08 20:20:55 UTC (rev 23436)
+++ scummvm/branches/branch-0-9-0/NEWS 2006-07-08 20:26:13 UTC (rev 23437)
@@ -5,6 +5,9 @@
SCUMM:
- Improved support for international versions of HE games.
+ Broken Sword 2
+ - More robust handling of the optional startup.inf file.
+
PSP Port:
- Fixed crashes during scrolling scenes in certain SCUMM games.
- Added saving of thumbnail in SCUMM savegames.
Modified: scummvm/branches/branch-0-9-0/engines/sword2/startup.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/sword2/startup.cpp 2006-07-08 20:20:55 UTC (rev 23436)
+++ scummvm/branches/branch-0-9-0/engines/sword2/startup.cpp 2006-07-08 20:26:13 UTC (rev 23437)
@@ -60,8 +60,34 @@
int start_ids[MAX_starts];
char buf[10];
+ int lineno = 0;
+
while (fp.readLine(buf, sizeof(buf))) {
- start_ids[_totalScreenManagers] = atoi(buf);
+ char *errptr;
+ int id;
+
+ lineno++;
+ id = strtol(buf, &errptr, 10);
+
+ if (*errptr) {
+ warning("startup.inf:%d: Invalid string '%s'", lineno, buf);
+ continue;
+ }
+
+ if (!_resman->checkValid(id)) {
+ warning("startup.inf:%d: Invalid resource %d", lineno, id);
+ continue;
+ }
+
+ if (_resman->fetchType(id) != SCREEN_MANAGER) {
+ byte name[NAME_LEN];
+
+ warning("startup.inf:%d: '%s' (%d) is not a screen manager", lineno, _resman->fetchName(id, name), id);
+ continue;
+ }
+
+ start_ids[_totalScreenManagers] = id;
+
if (++_totalScreenManagers >= MAX_starts) {
warning("Too many entries in startup.inf");
break;
@@ -86,17 +112,10 @@
debug(2, "Querying screen manager %d", _startRes);
// Open each one and run through the interpreter. Script 0 is
- // the query request script
+ // the query request script. We have already made reasonably
+ // sure the resource is ok.
- // if the resource number is within range & it's not a null
- // resource
- // - need to check in case un-built sections included in
- // start list
-
- if (_resman->checkValid(_startRes)) {
- _logic->runResScript(_startRes, 0);
- } else
- warning("Start menu resource %d invalid", _startRes);
+ _logic->runResScript(_startRes, 0);
}
return 1;
More information about the Scummvm-git-logs
mailing list