ScummVM API documentation
kernel.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SCI_ENGINE_KERNEL_H
23 #define SCI_ENGINE_KERNEL_H
24 
25 #include "common/scummsys.h"
26 #include "common/debug.h"
27 #include "common/rect.h"
28 #include "common/str-array.h"
29 
30 #include "sci/engine/selector.h"
31 #include "sci/engine/vm_types.h" // for reg_t
32 #include "sci/engine/vm.h"
33 
34 namespace Sci {
35 
42 struct Node; // from segment.h
43 struct List; // from segment.h
44 struct SelectorCache; // from selector.h
45 struct SciWorkaroundEntry; // from workarounds.h
46 
102 
103 //#define DEBUG_PARSER // enable for parser debugging
104 
105 // ---- Kernel signatures -----------------------------------------------------
106 
107 // Kernel functions that have been added for ScummVM script patches to call
108 enum {
109  kScummVMSleepId = 0xe0, // sleeps for a delay while remaining responsive
110 #ifdef ENABLE_SCI32
111  kScummVMSaveLoadId = 0xe1 // launches ScummVM's save/load dialog
112 #endif
113 };
114 
115 // internal kernel signature data
116 enum {
117  SIG_TYPE_NULL = 0x01, // may be 0:0 [0]
118  SIG_TYPE_INTEGER = 0x02, // may be 0:* [i], automatically also allows null
119  SIG_TYPE_UNINITIALIZED = 0x04, // may be FFFF:* -> not allowable, only used for comparison
120  SIG_TYPE_OBJECT = 0x08, // may be object [o]
121  SIG_TYPE_REFERENCE = 0x10, // may be reference [r]
122  SIG_TYPE_LIST = 0x20, // may be list [l]
123  SIG_TYPE_NODE = 0x40, // may be node [n]
124  SIG_TYPE_ERROR = 0x80, // happens, when there is a identification error - only used for comparison
125  SIG_IS_INVALID = 0x100, // ptr is invalid [!] -> invalid offset
126  SIG_IS_OPTIONAL = 0x200, // is optional
127  SIG_NEEDS_MORE = 0x400, // needs at least one additional parameter following
128  SIG_MORE_MAY_FOLLOW = 0x800 // may have more parameters of the same type following
129 };
130 
131 // this does not include SIG_TYPE_UNINITIALIZED, because we can not allow uninitialized values anywhere
132 #define SIG_MAYBE_ANY (SIG_TYPE_NULL | SIG_TYPE_INTEGER | SIG_TYPE_OBJECT | SIG_TYPE_REFERENCE | SIG_TYPE_LIST | SIG_TYPE_NODE)
133 
134 // ----------------------------------------------------------------------------
135 
136 /* Generic description: */
137 typedef reg_t KernelFunctionCall(EngineState *s, int argc, reg_t *argv);
138 
140  KernelFunctionCall *function;
141  const char *name;
142  uint16 *signature;
143  const SciWorkaroundEntry *workarounds;
144  bool debugLogging;
145  bool debugBreakpoint;
146 };
147 
149  KernelFunctionCall *function;
150  const char *name;
151  uint16 *signature;
152  const SciWorkaroundEntry *workarounds;
153  KernelSubFunction *subFunctions;
154  uint16 subFunctionCount;
155 };
156 
157 class Kernel {
158 public:
162  Kernel(ResourceManager *resMan, SegManager *segMan);
163  ~Kernel();
164 
165  uint getSelectorNamesSize() const;
166  const Common::String &getSelectorName(uint selector);
167  int findKernelFuncPos(Common::String kernelFuncName);
168 
169  uint getKernelNamesSize() const;
170  const Common::String &getKernelName(uint number) const;
171  Common::String getKernelName(uint number, uint subFunction) const;
172 
178  int findSelector(const char *selectorName) const;
179 
180  // Script dissection/dumping functions
181  void dissectScript(int scriptNumber, Vocabulary *vocab);
182  void dumpScriptObject(const SciSpan<const byte> &script, SciSpan<const byte> object);
183  void dumpScriptClass(const SciSpan<const byte> &script, SciSpan<const byte> clazz);
184 
187  KernelFunctionArray _kernelFuncs;
199  bool signatureMatch(const uint16 *sig, int argc, const reg_t *argv);
200 
201  // Prints out debug information in case a signature check fails
202  void signatureDebug(Common::String &signatureDetails, const uint16 *sig, int argc, const reg_t *argv);
203 
211  uint16 findRegType(reg_t reg);
212 
213  /******************** Text functionality ********************/
226  Common::String lookupText(reg_t address, int index);
227 
236  void loadKernelNames(GameFeatures *features);
237 
238 private:
242  void loadSelectorNames();
243 
248  Common::StringArray checkStaticSelectorNames();
249 
253  void findSpecificSelectors(Common::StringArray &selectorNames);
254 
258  void mapSelectors();
259 
263  void mapFunctions(GameFeatures *features);
264 
265  ResourceManager *_resMan;
266  SegManager *_segMan;
267 
268  // Kernel-related lists
269  Common::StringArray _selectorNames;
270  Common::StringArray _kernelNames;
271 
272  const Common::String _invalid;
273 };
274 
275 /******************** Kernel functions ********************/
276 
277 reg_t kStrLen(EngineState *s, int argc, reg_t *argv);
278 reg_t kGetFarText(EngineState *s, int argc, reg_t *argv);
279 reg_t kReadNumber(EngineState *s, int argc, reg_t *argv);
280 reg_t kStrCat(EngineState *s, int argc, reg_t *argv);
281 reg_t kStrCmp(EngineState *s, int argc, reg_t *argv);
282 reg_t kSetSynonyms(EngineState *s, int argc, reg_t *argv);
283 reg_t kLock(EngineState *s, int argc, reg_t *argv);
284 reg_t kPalette(EngineState *s, int argc, reg_t *argv);
285 reg_t kPalVary(EngineState *s, int argc, reg_t *argv);
286 reg_t kAssertPalette(EngineState *s, int argc, reg_t *argv);
287 reg_t kPortrait(EngineState *s, int argc, reg_t *argv);
288 reg_t kNumCels(EngineState *s, int argc, reg_t *argv);
289 reg_t kNumLoops(EngineState *s, int argc, reg_t *argv);
290 reg_t kDrawCel(EngineState *s, int argc, reg_t *argv);
291 reg_t kCoordPri(EngineState *s, int argc, reg_t *argv);
292 reg_t kPriCoord(EngineState *s, int argc, reg_t *argv);
293 reg_t kShakeScreen(EngineState *s, int argc, reg_t *argv);
294 reg_t kSetCursor(EngineState *s, int argc, reg_t *argv);
295 reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv);
296 reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv);
297 reg_t kOnControl(EngineState *s, int argc, reg_t *argv);
298 reg_t kDrawPic(EngineState *s, int argc, reg_t *argv);
299 reg_t kGetPort(EngineState *s, int argc, reg_t *argv);
300 reg_t kSetPort(EngineState *s, int argc, reg_t *argv);
301 reg_t kNewWindow(EngineState *s, int argc, reg_t *argv);
302 reg_t kDisposeWindow(EngineState *s, int argc, reg_t *argv);
303 reg_t kCelWide(EngineState *s, int argc, reg_t *argv);
304 reg_t kCelHigh(EngineState *s, int argc, reg_t *argv);
305 reg_t kSetJump(EngineState *s, int argc, reg_t *argv);
306 reg_t kDirLoop(EngineState *s, int argc, reg_t *argv);
307 reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv);
308 reg_t kGetAngle(EngineState *s, int argc, reg_t *argv);
309 reg_t kGetDistance(EngineState *s, int argc, reg_t *argv);
310 reg_t kRandom(EngineState *s, int argc, reg_t *argv);
311 reg_t kAbs(EngineState *s, int argc, reg_t *argv);
312 reg_t kSqrt(EngineState *s, int argc, reg_t *argv);
313 reg_t kTimesSin(EngineState *s, int argc, reg_t *argv);
314 reg_t kTimesCos(EngineState *s, int argc, reg_t *argv);
315 reg_t kCosMult(EngineState *s, int argc, reg_t *argv);
316 reg_t kSinMult(EngineState *s, int argc, reg_t *argv);
317 reg_t kTimesTan(EngineState *s, int argc, reg_t *argv);
318 reg_t kTimesCot(EngineState *s, int argc, reg_t *argv);
319 reg_t kCosDiv(EngineState *s, int argc, reg_t *argv);
320 reg_t kSinDiv(EngineState *s, int argc, reg_t *argv);
321 reg_t kValidPath(EngineState *s, int argc, reg_t *argv);
322 reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv);
323 reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv);
324 reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv);
325 reg_t kWait(EngineState *s, int argc, reg_t *argv);
326 reg_t kRestartGame16(EngineState *s, int argc, reg_t *argv);
327 reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv);
328 reg_t kGetEvent(EngineState *s, int argc, reg_t *argv);
329 reg_t kCheckFreeSpace(EngineState *s, int argc, reg_t *argv);
330 reg_t kFlushResources(EngineState *s, int argc, reg_t *argv);
331 reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv);
332 reg_t kSetDebug(EngineState *s, int argc, reg_t *argv);
333 reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv);
334 reg_t kSaveGame(EngineState *s, int argc, reg_t *argv);
335 reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv);
336 reg_t kFileIO(EngineState *s, int argc, reg_t *argv);
337 reg_t kGetTime(EngineState *s, int argc, reg_t *argv);
338 reg_t kHaveMouse(EngineState *s, int argc, reg_t *argv);
339 reg_t kJoystick(EngineState *s, int argc, reg_t *argv);
340 reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv);
341 reg_t kGetCWD(EngineState *s, int argc, reg_t *argv);
342 reg_t kSort(EngineState *s, int argc, reg_t *argv);
343 reg_t kStrEnd(EngineState *s, int argc, reg_t *argv);
344 reg_t kMemory(EngineState *s, int argc, reg_t *argv);
345 reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv);
346 reg_t kParse(EngineState *s, int argc, reg_t *argv);
347 reg_t kSaid(EngineState *s, int argc, reg_t *argv);
348 reg_t kStrCpy(EngineState *s, int argc, reg_t *argv);
349 reg_t kStrAt(EngineState *s, int argc, reg_t *argv);
350 reg_t kEditControl(EngineState *s, int argc, reg_t *argv);
351 reg_t kDrawControl(EngineState *s, int argc, reg_t *argv);
352 reg_t kHiliteControl(EngineState *s, int argc, reg_t *argv);
353 reg_t kClone(EngineState *s, int argc, reg_t *argv);
354 reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv);
355 reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv);
356 reg_t kCantBeHere(EngineState *s, int argc, reg_t *argv);
357 reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv);
358 reg_t kInitBresen(EngineState *s, int argc, reg_t *argv);
359 reg_t kDoBresen(EngineState *s, int argc, reg_t *argv);
360 reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv);
361 reg_t kAddToPic(EngineState *s, int argc, reg_t *argv);
362 reg_t kAnimate(EngineState *s, int argc, reg_t *argv);
363 reg_t kDisplay(EngineState *s, int argc, reg_t *argv);
364 reg_t kGraph(EngineState *s, int argc, reg_t *argv);
365 reg_t kFormat(EngineState *s, int argc, reg_t *argv);
366 reg_t kDoSound(EngineState *s, int argc, reg_t *argv);
367 reg_t kAddMenu(EngineState *s, int argc, reg_t *argv);
368 reg_t kSetMenu(EngineState *s, int argc, reg_t *argv);
369 reg_t kGetMenu(EngineState *s, int argc, reg_t *argv);
370 reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv);
371 reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv);
372 reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv);
373 
374 reg_t kLoad(EngineState *s, int argc, reg_t *argv);
375 reg_t kUnLoad(EngineState *s, int argc, reg_t *argv);
376 reg_t kScriptID(EngineState *s, int argc, reg_t *argv);
377 reg_t kDisposeScript(EngineState *s, int argc, reg_t *argv);
378 reg_t kIsObject(EngineState *s, int argc, reg_t *argv);
379 reg_t kRespondsTo(EngineState *s, int argc, reg_t *argv);
380 reg_t kNewList(EngineState *s, int argc, reg_t *argv);
381 reg_t kDisposeList(EngineState *s, int argc, reg_t *argv);
382 reg_t kNewNode(EngineState *s, int argc, reg_t *argv);
383 reg_t kFirstNode(EngineState *s, int argc, reg_t *argv);
384 reg_t kLastNode(EngineState *s, int argc, reg_t *argv);
385 reg_t kEmptyList(EngineState *s, int argc, reg_t *argv);
386 reg_t kNextNode(EngineState *s, int argc, reg_t *argv);
387 reg_t kPrevNode(EngineState *s, int argc, reg_t *argv);
388 reg_t kNodeValue(EngineState *s, int argc, reg_t *argv);
389 reg_t kAddAfter(EngineState *s, int argc, reg_t *argv);
390 reg_t kAddToFront(EngineState *s, int argc, reg_t *argv);
391 reg_t kAddToEnd(EngineState *s, int argc, reg_t *argv);
392 reg_t kFindKey(EngineState *s, int argc, reg_t *argv);
393 reg_t kDeleteKey(EngineState *s, int argc, reg_t *argv);
394 reg_t kMemoryInfo(EngineState *s, int argc, reg_t *argv);
395 reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv);
396 reg_t kTextSize(EngineState *s, int argc, reg_t *argv);
397 reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv);
398 reg_t kGetMessage(EngineState *s, int argc, reg_t *argv);
399 reg_t kMessage(EngineState *s, int argc, reg_t *argv);
400 reg_t kDoAudio(EngineState *s, int argc, reg_t *argv);
401 reg_t kDoSync(EngineState *s, int argc, reg_t *argv);
402 reg_t kMemorySegment(EngineState *s, int argc, reg_t *argv);
403 reg_t kIntersections(EngineState *s, int argc, reg_t *argv);
404 reg_t kMergePoly(EngineState *s, int argc, reg_t *argv);
405 reg_t kResCheck(EngineState *s, int argc, reg_t *argv);
406 reg_t kSetQuitStr(EngineState *s, int argc, reg_t *argv);
407 reg_t kShowMovie(EngineState *s, int argc, reg_t *argv);
408 reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv);
409 reg_t kStrSplit(EngineState *s, int argc, reg_t *argv);
410 reg_t kPlatform(EngineState *s, int argc, reg_t *argv);
411 reg_t kTextColors(EngineState *s, int argc, reg_t *argv);
412 reg_t kTextFonts(EngineState *s, int argc, reg_t *argv);
413 reg_t kShow(EngineState *s, int argc, reg_t *argv);
414 reg_t kRemapColors(EngineState *s, int argc, reg_t *argv);
415 reg_t kRemapColorsKawa(EngineState *s, int argc, reg_t *argv);
416 reg_t kDummy(EngineState *s, int argc, reg_t *argv);
417 reg_t kEmpty(EngineState *s, int argc, reg_t *argv);
418 reg_t kStub(EngineState *s, int argc, reg_t *argv);
419 reg_t kStubNull(EngineState *s, int argc, reg_t *argv);
420 reg_t kKawaHacks(EngineState *s, int argc, reg_t *argv);
421 reg_t kKawaDbugStr(EngineState *s, int argc, reg_t *argv);
422 
423 #ifdef ENABLE_SCI32
424 // SCI2 Kernel Functions
425 reg_t kSetCursor32(EngineState *s, int argc, reg_t *argv);
426 reg_t kSetNowSeen32(EngineState *s, int argc, reg_t *argv);
427 reg_t kBaseSetter32(EngineState *s, int argc, reg_t *argv);
428 reg_t kShakeScreen32(EngineState *s, int argc, reg_t *argv);
429 reg_t kPlatform32(EngineState *s, int argc, reg_t *argv);
430 reg_t kGlobalToLocal32(EngineState *s, int argc, reg_t *argv);
431 reg_t kLocalToGlobal32(EngineState *s, int argc, reg_t *argv);
432 
433 reg_t kDoAudio32(EngineState *s, int argc, reg_t *argv);
434 reg_t kDoAudioInit(EngineState *s, int argc, reg_t *argv);
435 reg_t kDoAudioWaitForPlay(EngineState *s, int argc, reg_t *argv);
436 reg_t kDoAudioPlay(EngineState *s, int argc, reg_t *argv);
437 reg_t kDoAudioStop(EngineState *s, int argc, reg_t *argv);
438 reg_t kDoAudioPause(EngineState *s, int argc, reg_t *argv);
439 reg_t kDoAudioResume(EngineState *s, int argc, reg_t *argv);
440 reg_t kDoAudioPosition(EngineState *s, int argc, reg_t *argv);
441 reg_t kDoAudioRate(EngineState *s, int argc, reg_t *argv);
442 reg_t kDoAudioVolume(EngineState *s, int argc, reg_t *argv);
443 reg_t kDoAudioGetCapability(EngineState *s, int argc, reg_t *argv);
444 reg_t kDoAudioBitDepth(EngineState *s, int argc, reg_t *argv);
445 reg_t kDoAudioDistort(EngineState *s, int argc, reg_t *argv);
446 reg_t kDoAudioMixing(EngineState *s, int argc, reg_t *argv);
447 reg_t kDoAudioChannels(EngineState *s, int argc, reg_t *argv);
448 reg_t kDoAudioPreload(EngineState *s, int argc, reg_t *argv);
449 reg_t kDoAudioFade(EngineState *s, int argc, reg_t *argv);
450 reg_t kDoAudioHasSignal(EngineState *s, int argc, reg_t *argv);
451 reg_t kDoAudioSetLoop(EngineState *s, int argc, reg_t *argv);
452 reg_t kDoAudioPan(EngineState *s, int argc, reg_t *argv);
453 reg_t kDoAudioPanOff(EngineState *s, int argc, reg_t *argv);
454 
455 reg_t kRobot(EngineState *s, int argc, reg_t *argv);
456 reg_t kRobotOpen(EngineState *s, int argc, reg_t *argv);
457 reg_t kRobotShowFrame(EngineState *s, int argc, reg_t *argv);
458 reg_t kRobotGetFrameSize(EngineState *s, int argc, reg_t *argv);
459 reg_t kRobotPlay(EngineState *s, int argc, reg_t *argv);
460 reg_t kRobotGetIsFinished(EngineState *s, int argc, reg_t *argv);
461 reg_t kRobotGetIsInitialized(EngineState *s, int argc, reg_t *argv);
462 reg_t kRobotClose(EngineState *s, int argc, reg_t *argv);
463 reg_t kRobotGetCue(EngineState *s, int argc, reg_t *argv);
464 reg_t kRobotPause(EngineState *s, int argc, reg_t *argv);
465 reg_t kRobotGetFrameNo(EngineState *s, int argc, reg_t *argv);
466 reg_t kRobotSetPriority(EngineState *s, int argc, reg_t *argv);
467 
468 reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv);
469 reg_t kPlayVMDOpen(EngineState *s, int argc, reg_t *argv);
470 reg_t kPlayVMDInit(EngineState *s, int argc, reg_t *argv);
471 reg_t kPlayVMDClose(EngineState *s, int argc, reg_t *argv);
472 reg_t kPlayVMDIgnorePalettes(EngineState *s, int argc, reg_t *argv);
473 reg_t kPlayVMDGetStatus(EngineState *s, int argc, reg_t *argv);
474 reg_t kPlayVMDPlayUntilEvent(EngineState *s, int argc, reg_t *argv);
475 reg_t kPlayVMDShowCursor(EngineState *s, int argc, reg_t *argv);
476 reg_t kPlayVMDStartBlob(EngineState *s, int argc, reg_t *argv);
477 reg_t kPlayVMDStopBlobs(EngineState *s, int argc, reg_t *argv);
478 reg_t kPlayVMDAddBlob(EngineState *s, int argc, reg_t *argv);
479 reg_t kPlayVMDDeleteBlob(EngineState *s, int argc, reg_t *argv);
480 reg_t kPlayVMDSetBlackoutArea(EngineState *s, int argc, reg_t *argv);
481 reg_t kPlayVMDRestrictPalette(EngineState *s, int argc, reg_t *argv);
482 reg_t kPlayVMDSetPlane(EngineState *s, int argc, reg_t *argv);
483 
484 reg_t kShowMovie32(EngineState *s, int argc, reg_t *argv);
485 reg_t kShowMovieWin(EngineState *s, int argc, reg_t *argv);
486 reg_t kShowMovieWinOpen(EngineState *s, int argc, reg_t *argv);
487 reg_t kShowMovieWinInit(EngineState *s, int argc, reg_t *argv);
488 reg_t kShowMovieWinPlay(EngineState *s, int argc, reg_t *argv);
489 reg_t kShowMovieWinClose(EngineState *s, int argc, reg_t *argv);
490 reg_t kShowMovieWinCue(EngineState *s, int argc, reg_t *argv);
491 reg_t kShowMovieWinGetDuration(EngineState *s, int argc, reg_t *argv);
492 reg_t kShowMovieWinPlayUntilEvent(EngineState *s, int argc, reg_t *argv);
493 reg_t kShowMovieWinInitDouble(EngineState *s, int argc, reg_t *argv);
494 
495 reg_t kSave(EngineState *s, int argc, reg_t *argv);
496 reg_t kSaveGame32(EngineState *s, int argc, reg_t *argv);
497 reg_t kRestoreGame32(EngineState *s, int argc, reg_t *argv);
498 reg_t kGetSaveFiles32(EngineState *s, int argc, reg_t *argv);
499 reg_t kCheckSaveGame32(EngineState *s, int argc, reg_t *argv);
500 reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv);
501 reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv);
502 
503 reg_t kSetHotRectangles(EngineState *s, int argc, reg_t *argv);
504 reg_t kIsHiRes(EngineState *s, int argc, reg_t *argv);
505 reg_t kListAt(EngineState *s, int argc, reg_t *argv);
506 
507 reg_t kArray(EngineState *s, int argc, reg_t *argv);
508 reg_t kArrayNew(EngineState *s, int argc, reg_t *argv);
509 reg_t kArrayGetSize(EngineState *s, int argc, reg_t *argv);
510 reg_t kArrayGetElement(EngineState *s, int argc, reg_t *argv);
511 reg_t kArraySetElements(EngineState *s, int argc, reg_t *argv);
512 reg_t kArrayFree(EngineState *s, int argc, reg_t *argv);
513 reg_t kArrayFill(EngineState *s, int argc, reg_t *argv);
514 reg_t kArrayCopy(EngineState *s, int argc, reg_t *argv);
515 reg_t kArrayCompare(EngineState *s, int argc, reg_t *argv);
516 reg_t kArrayDuplicate(EngineState *s, int argc, reg_t *argv);
517 reg_t kArrayGetData(EngineState *s, int argc, reg_t *argv);
518 reg_t kArrayByteCopy(EngineState *s, int argc, reg_t *argv);
519 
520 reg_t kString(EngineState *s, int argc, reg_t *argv);
521 reg_t kStringNew(EngineState *s, int argc, reg_t *argv);
522 reg_t kStringGetChar(EngineState *s, int argc, reg_t *argv);
523 reg_t kStringFree(EngineState *s, int argc, reg_t *argv);
524 reg_t kStringCompare(EngineState *s, int argc, reg_t *argv);
525 reg_t kStringLength(EngineState *s, int argc, reg_t *argv);
526 reg_t kStringFormat(EngineState *s, int argc, reg_t *argv);
527 reg_t kStringFormatAt(EngineState *s, int argc, reg_t *argv);
528 reg_t kStringToInteger(EngineState *s, int argc, reg_t *argv);
529 reg_t kStringTrim(EngineState *s, int argc, reg_t *argv);
530 reg_t kStringToUpperCase(EngineState *s, int argc, reg_t *argv);
531 reg_t kStringToLowerCase(EngineState *s, int argc, reg_t *argv);
532 reg_t kStringReplaceSubstring(EngineState *s, int argc, reg_t *argv);
533 reg_t kStringReplaceSubstringEx(EngineState *s, int argc, reg_t *argv);
534 
535 reg_t kScrollWindowCreate(EngineState *s, int argc, reg_t *argv);
536 reg_t kScrollWindowAdd(EngineState *s, int argc, reg_t *argv);
537 reg_t kScrollWindowPageUp(EngineState *s, int argc, reg_t *argv);
538 reg_t kScrollWindowPageDown(EngineState *s, int argc, reg_t *argv);
539 reg_t kScrollWindowUpArrow(EngineState *s, int argc, reg_t *argv);
540 reg_t kScrollWindowDownArrow(EngineState *s, int argc, reg_t *argv);
541 reg_t kScrollWindowHome(EngineState *s, int argc, reg_t *argv);
542 reg_t kScrollWindowEnd(EngineState *s, int argc, reg_t *argv);
543 reg_t kScrollWindowWhere(EngineState *s, int argc, reg_t *argv);
544 reg_t kScrollWindowGo(EngineState *s, int argc, reg_t *argv);
545 reg_t kScrollWindowModify(EngineState *s, int argc, reg_t *argv);
546 reg_t kScrollWindowHide(EngineState *s, int argc, reg_t *argv);
547 reg_t kScrollWindowShow(EngineState *s, int argc, reg_t *argv);
548 reg_t kScrollWindowDestroy(EngineState *s, int argc, reg_t *argv);
549 
550 reg_t kMulDiv(EngineState *s, int argc, reg_t *argv);
551 
552 reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv);
553 reg_t kRemapColorsOff(EngineState *s, int argc, reg_t *argv);
554 reg_t kRemapColorsByRange(EngineState *s, int argc, reg_t *argv);
555 reg_t kRemapColorsByPercent(EngineState *s, int argc, reg_t *argv);
556 reg_t kRemapColorsToGray(EngineState *s, int argc, reg_t *argv);
557 reg_t kRemapColorsToPercentGray(EngineState *s, int argc, reg_t *argv);
558 reg_t kRemapColorsBlockRange(EngineState *s, int argc, reg_t *argv);
559 
560 reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv);
561 reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv);
562 reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv);
563 
564 reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv);
565 reg_t kBitmap(EngineState *s, int argc, reg_t *argv);
566 reg_t kBitmapCreate(EngineState *s, int argc, reg_t *argv);
567 reg_t kBitmapDestroy(EngineState *s, int argc, reg_t *argv);
568 reg_t kBitmapDrawView(EngineState *s, int argc, reg_t *argv);
569 reg_t kBitmapDrawText(EngineState *s, int argc, reg_t *argv);
570 reg_t kBitmapDrawColor(EngineState *s, int argc, reg_t *argv);
571 reg_t kBitmapSetOrigin(EngineState *s, int argc, reg_t *argv);
572 reg_t kBitmapCreateFromView(EngineState *s, int argc, reg_t *argv);
573 reg_t kBitmapGetInfo(EngineState *s, int argc, reg_t *argv);
574 
575 reg_t kAddPlane(EngineState *s, int argc, reg_t *argv);
576 reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv);
577 reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv);
578 reg_t kMovePlaneItems(EngineState *s, int argc, reg_t *argv);
579 reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv);
580 reg_t kSetPalStyleRange(EngineState *s, int argc, reg_t *argv);
581 reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv);
582 reg_t kFrameOut(EngineState *s, int argc, reg_t *argv);
583 reg_t kCelHigh32(EngineState *s, int argc, reg_t *argv);
584 reg_t kCelWide32(EngineState *s, int argc, reg_t *argv);
585 
586 reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv); // kOnMe for SCI2, kIsOnMe for SCI2.1
587 reg_t kInPolygon(EngineState *s, int argc, reg_t *argv);
588 reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv);
589 
590 reg_t kListIndexOf(EngineState *s, int argc, reg_t *argv);
591 reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv);
592 reg_t kListFirstTrue(EngineState *s, int argc, reg_t *argv);
593 reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv);
594 reg_t kListSort(EngineState *s, int argc, reg_t *argv);
595 
596 reg_t kEditText(EngineState *s, int argc, reg_t *argv);
597 reg_t kInputText(EngineState *s, int argc, reg_t *argv);
598 reg_t kSetScroll(EngineState *s, int argc, reg_t *argv);
599 
600 reg_t kPaletteSetFromResource32(EngineState *s, int argc, reg_t *argv);
601 reg_t kPaletteFindColor32(EngineState *s, int argc, reg_t *argv);
602 reg_t kPaletteSetFade(EngineState *s, int argc, reg_t *argv);
603 reg_t kPaletteSetGamma(EngineState *s, int argc, reg_t *argv);
604 
605 reg_t kPalCycle(EngineState *s, int argc, reg_t *argv);
606 reg_t kPalCycleSetCycle(EngineState *s, int argc, reg_t *argv);
607 reg_t kPalCycleDoCycle(EngineState *s, int argc, reg_t *argv);
608 reg_t kPalCyclePause(EngineState *s, int argc, reg_t *argv);
609 reg_t kPalCycleOn(EngineState *s, int argc, reg_t *argv);
610 reg_t kPalCycleOff(EngineState *s, int argc, reg_t *argv);
611 
612 reg_t kPalVarySetVary(EngineState *s, int argc, reg_t *argv);
613 reg_t kPalVarySetPercent(EngineState *s, int argc, reg_t *argv);
614 reg_t kPalVaryGetPercent(EngineState *s, int argc, reg_t *argv);
615 reg_t kPalVaryOff(EngineState *s, int argc, reg_t *argv);
616 reg_t kPalVaryMergeTarget(EngineState *s, int argc, reg_t *argv);
617 reg_t kPalVarySetTime(EngineState *s, int argc, reg_t *argv);
618 reg_t kPalVarySetTarget(EngineState *s, int argc, reg_t *argv);
619 reg_t kPalVarySetStart(EngineState *s, int argc, reg_t *argv);
620 reg_t kPalVaryMergeStart(EngineState *s, int argc, reg_t *argv);
621 
622 // SCI2.1 Kernel Functions
623 reg_t kMorphOn(EngineState *s, int argc, reg_t *argv);
624 reg_t kText(EngineState *s, int argc, reg_t *argv);
625 reg_t kTextSize32(EngineState *s, int argc, reg_t *argv);
626 reg_t kTextWidth(EngineState *s, int argc, reg_t *argv);
627 reg_t kList(EngineState *s, int argc, reg_t *argv);
628 reg_t kCD(EngineState *s, int argc, reg_t *argv);
629 reg_t kCheckCD(EngineState *s, int argc, reg_t *argv);
630 reg_t kGetSavedCD(EngineState *s, int argc, reg_t *argv);
631 reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv);
632 reg_t kAddBefore(EngineState *s, int argc, reg_t *argv);
633 reg_t kMoveToFront(EngineState *s, int argc, reg_t *argv);
634 reg_t kMoveToEnd(EngineState *s, int argc, reg_t *argv);
635 reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv);
636 reg_t kWinHelp(EngineState *s, int argc, reg_t *argv);
637 reg_t kMessageBox(EngineState *s, int argc, reg_t *argv);
638 reg_t kGetConfig(EngineState *s, int argc, reg_t *argv);
639 reg_t kGetSierraProfileInt(EngineState *s, int argc, reg_t *argv);
640 reg_t kPrintDebug(EngineState *s, int argc, reg_t *argv);
641 
642 reg_t kCelInfo(EngineState *s, int argc, reg_t *argv);
643 reg_t kCelInfoGetOriginX(EngineState *s, int argc, reg_t *argv);
644 reg_t kCelInfoGetOriginY(EngineState *s, int argc, reg_t *argv);
645 reg_t kCelInfoGetPixel(EngineState *s, int argc, reg_t *argv);
646 reg_t kCelLink(EngineState *s, int argc, reg_t *argv);
647 reg_t kCelLinkGetX(EngineState *s, int argc, reg_t *argv);
648 reg_t kCelLinkGetY(EngineState *s, int argc, reg_t *argv);
649 
650 reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv);
651 reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv);
652 reg_t kPointSize(EngineState *s, int argc, reg_t *argv);
653 reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv);
654 reg_t kFont(EngineState *s, int argc, reg_t *argv);
655 reg_t kAddLine(EngineState *s, int argc, reg_t *argv);
656 reg_t kUpdateLine(EngineState *s, int argc, reg_t *argv);
657 reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv);
658 
659 reg_t kWinDLL(EngineState *s, int argc, reg_t *argv);
660 
661 // SCI 2.1 Middle Mac modified kDoSound
662 reg_t kDoSoundMac32(EngineState *s, int argc, reg_t *argv);
663 
664 // SCI3 Kernel functions
665 reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv);
666 reg_t kPlayDuckPlay(EngineState *s, int argc, reg_t *argv);
667 reg_t kPlayDuckSetFrameOut(EngineState *s, int argc, reg_t *argv);
668 reg_t kPlayDuckOpen(EngineState *s, int argc, reg_t *argv);
669 reg_t kPlayDuckClose(EngineState *s, int argc, reg_t *argv);
670 reg_t kPlayDuckSetVolume(EngineState *s, int argc, reg_t *argv);
671 reg_t kWebConnect(EngineState *s, int argc, reg_t *argv);
672 reg_t kWinExec(EngineState *s, int argc, reg_t *argv);
673 #endif
674 
675 reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
676 reg_t kDoSoundPlay(EngineState *s, int argc, reg_t *argv);
677 reg_t kDoSoundDispose(EngineState *s, int argc, reg_t *argv);
678 reg_t kDoSoundMute(EngineState *s, int argc, reg_t *argv);
679 reg_t kDoSoundStop(EngineState *s, int argc, reg_t *argv);
680 reg_t kDoSoundStopAll(EngineState *s, int argc, reg_t *argv);
681 reg_t kDoSoundPause(EngineState *s, int argc, reg_t *argv);
682 reg_t kDoSoundResumeAfterRestore(EngineState *s, int argc, reg_t *argv);
683 reg_t kDoSoundMasterVolume(EngineState *s, int argc, reg_t *argv);
684 reg_t kDoSoundUpdate(EngineState *s, int argc, reg_t *argv);
685 reg_t kDoSoundFade(EngineState *s, int argc, reg_t *argv);
686 reg_t kDoSoundGetPolyphony(EngineState *s, int argc, reg_t *argv);
687 reg_t kDoSoundUpdateCues(EngineState *s, int argc, reg_t *argv);
688 reg_t kDoSoundSendMidi(EngineState *s, int argc, reg_t *argv);
689 reg_t kDoSoundGlobalReverb(EngineState *s, int argc, reg_t *argv);
690 reg_t kDoSoundSetHold(EngineState *s, int argc, reg_t *argv);
691 reg_t kDoSoundGetAudioCapability(EngineState *s, int argc, reg_t *argv);
692 reg_t kDoSoundSuspend(EngineState *s, int argc, reg_t *argv);
693 reg_t kDoSoundSetVolume(EngineState *s, int argc, reg_t *argv);
694 reg_t kDoSoundSetPriority(EngineState *s, int argc, reg_t *argv);
695 reg_t kDoSoundSetLoop(EngineState *s, int argc, reg_t *argv);
696 
697 reg_t kGraphGetColorCount(EngineState *s, int argc, reg_t *argv);
698 reg_t kGraphDrawLine(EngineState *s, int argc, reg_t *argv);
699 reg_t kGraphSaveBox(EngineState *s, int argc, reg_t *argv);
700 reg_t kGraphRestoreBox(EngineState *s, int argc, reg_t *argv);
701 reg_t kGraphFillBoxBackground(EngineState *s, int argc, reg_t *argv);
702 reg_t kGraphFillBoxForeground(EngineState *s, int argc, reg_t *argv);
703 reg_t kGraphFillBoxAny(EngineState *s, int argc, reg_t *argv);
704 reg_t kGraphUpdateBox(EngineState *s, int argc, reg_t *argv);
705 reg_t kGraphRedrawBox(EngineState *s, int argc, reg_t *argv);
706 reg_t kGraphAdjustPriority(EngineState *s, int argc, reg_t *argv);
707 reg_t kGraphSaveUpscaledHiresBox(EngineState *s, int argc, reg_t *argv);
708 
709 reg_t kPalVaryInit(EngineState *s, int argc, reg_t *argv);
710 reg_t kPalVaryReverse(EngineState *s, int argc, reg_t *argv);
711 reg_t kPalVaryGetCurrentStep(EngineState *s, int argc, reg_t *argv);
712 reg_t kPalVaryDeinit(EngineState *s, int argc, reg_t *argv);
713 reg_t kPalVaryChangeTarget(EngineState *s, int argc, reg_t *argv);
714 reg_t kPalVaryChangeTicks(EngineState *s, int argc, reg_t *argv);
715 reg_t kPalVaryPauseResume(EngineState *s, int argc, reg_t *argv);
716 
717 reg_t kPaletteSetFromResource(EngineState *s, int argc, reg_t *argv);
718 reg_t kPaletteSetFlag(EngineState *s, int argc, reg_t *argv);
719 reg_t kPaletteUnsetFlag(EngineState *s, int argc, reg_t *argv);
720 reg_t kPaletteSetIntensity(EngineState *s, int argc, reg_t *argv);
721 reg_t kPaletteFindColor(EngineState *s, int argc, reg_t *argv);
722 reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv);
723 reg_t kPaletteSave(EngineState *s, int argc, reg_t *argv);
724 reg_t kPaletteRestore(EngineState *s, int argc, reg_t *argv);
725 
726 reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv);
727 reg_t kFileIOClose(EngineState *s, int argc, reg_t *argv);
728 reg_t kFileIOReadRaw(EngineState *s, int argc, reg_t *argv);
729 reg_t kFileIOWriteRaw(EngineState *s, int argc, reg_t *argv);
730 reg_t kFileIOUnlink(EngineState *s, int argc, reg_t *argv);
731 reg_t kFileIOReadString(EngineState *s, int argc, reg_t *argv);
732 reg_t kFileIOWriteString(EngineState *s, int argc, reg_t *argv);
733 reg_t kFileIOSeek(EngineState *s, int argc, reg_t *argv);
734 reg_t kFileIOFindFirst(EngineState *s, int argc, reg_t *argv);
735 reg_t kFileIOFindNext(EngineState *s, int argc, reg_t *argv);
736 reg_t kFileIOExists(EngineState *s, int argc, reg_t *argv);
737 reg_t kFileIORename(EngineState *s, int argc, reg_t *argv);
738 reg_t kFileIOCopy(EngineState *s, int argc, reg_t *argv);
739 #ifdef ENABLE_SCI32
740 reg_t kFileIOReadByte(EngineState *s, int argc, reg_t *argv);
741 reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv);
742 reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv);
743 reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv);
744 reg_t kFileIOGetCWD(EngineState *s, int argc, reg_t *argv);
745 reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv);
746 #endif
747 
748 // Custom ScummVM kernel functions
749 reg_t kScummVMSleep(EngineState *s, int argc, reg_t *argv);
750 #ifdef ENABLE_SCI32
751 reg_t kScummVMSaveLoad(EngineState *s, int argc, reg_t *argv);
752 #endif
753 
756 } // End of namespace Sci
757 
758 #endif // SCI_ENGINE_KERNEL_H
Definition: state.h:100
Definition: str.h:59
Definition: kernel.h:148
Definition: kernel.h:157
Definition: selector.h:33
Definition: vocabulary.h:189
KernelFunctionArray _kernelFuncs
Definition: kernel.h:187
Definition: resource.h:327
Definition: workarounds.h:49
Definition: kernel.h:139
SelectorCache _selectorCache
Definition: kernel.h:185
Definition: console.h:28
Definition: seg_manager.h:48
Definition: lobject.h:332
Definition: features.h:56
Definition: vm_types.h:39