aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-09-17 09:36:52 +0000
committerFilippos Karapetis2009-09-17 09:36:52 +0000
commitdce185ba8b3566e16763d07fd1a690eff4eae3e2 (patch)
tree359118b624a1bedcb24757998b0844d4d82a8dc4
parent4c824775593047ab987c925e448bfa7ae23cdc8f (diff)
downloadscummvm-rg350-dce185ba8b3566e16763d07fd1a690eff4eae3e2.tar.gz
scummvm-rg350-dce185ba8b3566e16763d07fd1a690eff4eae3e2.tar.bz2
scummvm-rg350-dce185ba8b3566e16763d07fd1a690eff4eae3e2.zip
Made script_lookup_export() a method of SegManager
svn-id: r44140
-rw-r--r--engines/sci/detection.cpp2
-rw-r--r--engines/sci/engine/game.cpp2
-rw-r--r--engines/sci/engine/seg_manager.h5
-rw-r--r--engines/sci/engine/vm.cpp5
-rw-r--r--engines/sci/engine/vm.h9
5 files changed, 7 insertions, 16 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 6dc28d74c2..b44f494a00 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -309,7 +309,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
delete resMan;
return 0;
}
- reg_t game_obj = script_lookup_export(segMan, 0, 0);
+ reg_t game_obj = segMan->lookupScriptExport(0, 0);
const char *gameName = segMan->getObjectName(game_obj);
debug(2, "Detected ID: \"%s\" at %04x:%04x", gameName, PRINT_REG(game_obj));
s_fallbackDesc.desc.gameid = convertSierraGameId(gameName, &s_fallbackDesc.desc.flags);
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index d87814f10a..4da3814e30 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -454,7 +454,7 @@ int game_init(EngineState *s) {
// script_dissect(0, s->_selectorNames);
// The first entry in the export table of script 0 points to the game object
- s->game_obj = script_lookup_export(s->segMan, 0, 0);
+ s->game_obj = s->segMan->lookupScriptExport(0, 0);
uint32 gameFlags = 0; // unused
s->_gameName = convertSierraGameId(s->segMan->getObjectName(s->game_obj), &gameFlags);
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index e3d6099f1e..114c7ff175 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -106,6 +106,11 @@ public:
*/
SegmentId getScriptSegment(int script_nr, ScriptLoadType load);
+ reg_t lookupScriptExport(int script_nr, int export_index) {
+ SegmentId seg = getScriptSegment(script_nr, SCRIPT_GET_DONT_LOAD);
+ return make_reg(seg, validateExportFunc(export_index, seg));
+ }
+
// TODO: document this
reg_t getClassAddress(int classnr, ScriptLoadType lock, reg_t caller);
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 617016f3e6..bc0c441869 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1501,11 +1501,6 @@ SelectorType lookup_selector(SegManager *segMan, reg_t obj_location, Selector se
return _lookup_selector_function(segMan, obj_location.segment, obj, selector_id, fptr);
}
-reg_t script_lookup_export(SegManager *segMan, int script_nr, int export_index) {
- SegmentId seg = segMan->getScriptSegment(script_nr, SCRIPT_GET_DONT_LOAD);
- return make_reg(seg, segMan->validateExportFunc(export_index, seg));
-}
-
#define INST_LOOKUP_CLASS(id) ((id == 0xffff)? NULL_REG : segMan->getClassAddress(id, SCRIPT_GET_LOCK, reg))
int script_instantiate_common(ResourceManager *resMan, SegManager *segMan, int script_nr, Resource **script, Resource **heap, int *was_new) {
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index f2d51fafb1..56fbb0bd64 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -441,15 +441,6 @@ SelectorType lookup_selector(SegManager *segMan, reg_t obj, Selector selectorid,
ObjVarRef *varp, reg_t *fptr);
/**
- * Looks up an entry of the exports table of a script
- * @param[in] segMan The segment manager
- * @param[in] script_nr The script to look up in
- * @param[out] export_index The index of the export entry to look up
- * @return The handle
- */
-reg_t script_lookup_export(SegManager *segMan, int script_nr, int export_index);
-
-/**
* Makes sure that a script and its superclasses get loaded to the heap.
* If the script already has been loaded, only the number of lockers is
* increased. All scripts containing superclasses of this script are loaded