22 #ifndef SCI_ENGINE_VM_H 23 #define SCI_ENGINE_VM_H 27 #include "sci/engine/vm_types.h" 28 #include "sci/resource/resource.h" 30 #include "common/util.h" 37 class ResourceManager;
41 #define VM_STACK_SIZE 0x1000 44 #define SCRIPT_OBJECT_MAGIC_NUMBER 0x1234 47 #define SCRIPT_OBJECT_MAGIC_OFFSET (getSciVersion() < SCI_VERSION_1_1 ? -8 : 0) 50 #define CALL_SP_CARRY NULL 74 EXEC_STACK_TYPE_CALL = 0,
75 EXEC_STACK_TYPE_KERNEL = 1,
76 EXEC_STACK_TYPE_VARSELECTOR = 2
96 SegmentId local_segment;
98 Selector debugSelector;
100 int debugLocalCallOffset;
102 int debugKernelFunction;
103 int debugKernelSubFunction;
109 SegmentId localsSegment_,
reg_t pc_, Selector debugSelector_,
110 int debugKernelFunction_,
int debugKernelSubFunction_,
111 int debugExportId_,
int debugLocalCallOffset_,
int debugOrigin_,
112 ExecStackType type_) {
119 variables_argp = argp_;
121 if (localsSegment_ != kUninitializedSegment)
122 local_segment = localsSegment_;
124 local_segment = pc_.getSegment();
125 debugSelector = debugSelector_;
126 debugKernelFunction = debugKernelFunction_;
127 debugKernelSubFunction = debugKernelSubFunction_;
128 debugExportId = debugExportId_;
129 debugLocalCallOffset = debugLocalCallOffset_;
130 debugOrigin = debugOrigin_;
145 kGlobalVarCurrentRoom = 2,
148 kGlobalVarSounds = 8,
149 kGlobalVarPlanes = 10,
150 kGlobalVarCurrentRoomNo = 11,
151 kGlobalVarPreviousRoomNo = 12,
152 kGlobalVarNewRoomNo = 13,
153 kGlobalVarScore = 15,
154 kGlobalVarVersionNew = 27,
155 kGlobalVarVersionOld = 28,
156 kGlobalVarGK2MusicVolume = 76,
157 kGlobalVarPhant2SecondaryVolume = 76,
159 kGlobalVarFastCast = 84,
160 kGlobalVarMessageType = 90,
161 kGlobalVarTextSpeed = 94,
162 kGlobalVarGK1Music1 = 102,
163 kGlobalVarGK1Music2 = 103,
164 kGlobalVarRamaCatalogFile = 130,
165 kGlobalVarLSL6HiresGameFlags = 137,
166 kGlobalVarKQ7UpscaleVideos = 160,
167 kGlobalVarGK1NarratorMode = 166,
168 kGlobalVarRamaMusicVolume = 176,
169 kGlobalVarPhant1MusicVolume = 187,
170 kGlobalVarPhant1DACVolume = 188,
171 kGlobalVarLSL6MusicVolume = 194,
172 kGlobalVarGK1DAC1 = 207,
173 kGlobalVarPhant2CensorshipFlag = 207,
174 kGlobalVarGK1DAC2 = 208,
175 kGlobalVarLSL6HiresRestoreTextWindow = 210,
176 kGlobalVarGK1DAC3 = 211,
177 kGlobalVarShiversFlags = 211,
178 kGlobalVarTorinMusicVolume = 227,
179 kGlobalVarTorinSFXVolume = 228,
180 kGlobalVarTorinSpeechVolume = 229,
183 kGlobalVarPhant2MasterVolume = 236,
184 kGlobalVarPhant2ControlPanel = 250,
185 kGlobalVarShivers1Score = 349,
186 kGlobalVarQFG4Flags = 500,
187 kGlobalVarHoyle5MusicVolume = 897
330 void script_adjust_opcode_formats();
426 uint32
findOffset(
const int16 relOffset,
const Script *scr,
const uint32 pcOffset);
430 #endif // SCI_ENGINE_VM_H
reg_t reg
offset; script-relative offset, segment: 0 if not instantiated
Definition: vm.h:61
ExecStack * send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPtr sp, int framesize, StackPtr argp)
int script
number of the script the class is in, -1 for non-existing
Definition: vm.h:60
reg_t sendp
Pointer to the object containing the invoked method.
Definition: vm.h:81
reg_t objp
Pointer to the beginning of the current object.
Definition: vm.h:80
Definition: seg_manager.h:48
ExecStack * execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackPtr sp, reg_t calling_obj, uint16 argc, StackPtr argp)
SelectorType lookupSelector(SegManager *segMan, reg_t obj, Selector selectorid, ObjVarRef *varp, reg_t *fptr)
void run_vm(EngineState *s)
int readPMachineInstruction(const byte *src, byte &extOpcode, int16 opparams[4])
Definition: vm_types.h:39
uint32 findOffset(const int16 relOffset, const Script *scr, const uint32 pcOffset)
SelectorType
Definition: vm.h:53