ScummVM API documentation
workarounds.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_WORKAROUNDS_H
23 #define SCI_ENGINE_WORKAROUNDS_H
24 
25 #include "sci/engine/vm_types.h"
26 #include "sci/engine/state.h"
27 #include "sci/sci.h"
28 
29 namespace Sci {
30 
31 enum SciWorkaroundType {
32  WORKAROUND_NONE, // only used by terminator or when no workaround was found
33  WORKAROUND_IGNORE, // ignore kernel call
34  WORKAROUND_STILLCALL, // still do kernel call
35  WORKAROUND_FAKE // fake kernel call / replace temp value / fake opcode
36 };
37 
39  SciWorkaroundType type;
40  uint16 value;
41 };
42 
50  SciGameId gameId;
51  int roomNr;
52  int scriptNr;
53  int16 inheritanceLevel;
54  const char *objectName;
55  const char *methodName;
56  const uint16 *localCallSignature;
57  int fromIndex;
58  int toIndex;
59  SciWorkaroundSolution newValue;
60 };
61 
62 extern const SciWorkaroundEntry arithmeticWorkarounds[];
63 extern const SciWorkaroundEntry uninitializedReadWorkarounds[];
64 extern const SciWorkaroundEntry uninitializedReadForParamWorkarounds[];
65 extern const SciWorkaroundEntry kAbs_workarounds[];
66 extern const SciWorkaroundEntry kAnimate_workarounds[];
67 extern const SciWorkaroundEntry kCelHigh_workarounds[];
68 extern const SciWorkaroundEntry kCelWide_workarounds[];
69 extern const SciWorkaroundEntry kDeviceInfo_workarounds[];
70 extern const SciWorkaroundEntry kDisplay_workarounds[];
71 extern const SciWorkaroundEntry kDirLoop_workarounds[];
72 extern const SciWorkaroundEntry kDisposeScript_workarounds[];
73 extern const SciWorkaroundEntry kDoAudioResume_workarounds[];
74 extern const SciWorkaroundEntry kDoSoundPlay_workarounds[];
75 extern const SciWorkaroundEntry kDoSoundFade_workarounds[];
76 extern const SciWorkaroundEntry kFileIOOpen_workarounds[];
77 extern const SciWorkaroundEntry kFileIOCheckFreeSpace_workarounds[];
78 extern const SciWorkaroundEntry kFileIOReadString_workarounds[];
79 extern const SciWorkaroundEntry kFindKey_workarounds[];
80 extern const SciWorkaroundEntry kFrameOut_workarounds[];
81 extern const SciWorkaroundEntry kDeleteKey_workarounds[];
82 extern const SciWorkaroundEntry kGetAngle_workarounds[];
83 extern const SciWorkaroundEntry kGetCWD_workarounds[];
84 extern const SciWorkaroundEntry kGetSaveFiles_workarounds[];
85 extern const SciWorkaroundEntry kGraphDrawLine_workarounds[];
86 extern const SciWorkaroundEntry kGraphSaveBox_workarounds[];
87 extern const SciWorkaroundEntry kGraphRestoreBox_workarounds[];
88 extern const SciWorkaroundEntry kGraphUpdateBox_workarounds[];
89 extern const SciWorkaroundEntry kGraphFillBoxForeground_workarounds[];
90 extern const SciWorkaroundEntry kGraphFillBoxAny_workarounds[];
91 extern const SciWorkaroundEntry kGraphRedrawBox_workarounds[];
92 extern const SciWorkaroundEntry kIsObject_workarounds[];
93 extern const SciWorkaroundEntry kListAt_workarounds[];
94 extern const SciWorkaroundEntry kLock_workarounds[];
95 extern const SciWorkaroundEntry kMemory_workarounds[];
96 extern const SciWorkaroundEntry kMoveCursor_workarounds[];
97 extern const SciWorkaroundEntry kNewWindow_workarounds[];
98 extern const SciWorkaroundEntry kPalVarySetVary_workarounds[];
99 extern const SciWorkaroundEntry kPalVarySetPercent_workarounds[];
100 extern const SciWorkaroundEntry kPalVarySetStart_workarounds[];
101 extern const SciWorkaroundEntry kPalVaryMergeStart_workarounds[];
102 extern const SciWorkaroundEntry kPlatform32_workarounds[];
103 extern const SciWorkaroundEntry kRandom_workarounds[];
104 extern const SciWorkaroundEntry kReadNumber_workarounds[];
105 extern const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[];
106 extern const SciWorkaroundEntry kSetCursor_workarounds[];
107 extern const SciWorkaroundEntry kArraySetElements_workarounds[];
108 extern const SciWorkaroundEntry kArrayFill_workarounds[];
109 extern const SciWorkaroundEntry kSetPort_workarounds[];
110 extern const SciWorkaroundEntry kStrAt_workarounds[];
111 extern const SciWorkaroundEntry kStrCpy_workarounds[];
112 extern const SciWorkaroundEntry kStrLen_workarounds[];
113 extern const SciWorkaroundEntry kUnLoad_workarounds[];
114 extern const SciWorkaroundEntry kWait_workarounds[];
115 extern const SciWorkaroundEntry kStringNew_workarounds[];
116 extern const SciWorkaroundEntry kScrollWindowAdd_workarounds[];
117 
118 extern SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciCallOrigin *trackOrigin);
119 
120 enum SciMessageWorkaroundType {
121  MSG_WORKAROUND_NONE, // only used by terminator or when no workaround was found
122  MSG_WORKAROUND_REMAP, // use a different tuple instead
123  MSG_WORKAROUND_FAKE, // use a hard-coded response
124  MSG_WORKAROUND_EXTRACT // use text from a different record, optionally a substring
125 };
126 
127 enum SciMedia : uint {
128  SCI_MEDIA_ALL,
129  SCI_MEDIA_FLOPPY,
130  SCI_MEDIA_CD,
131  SCI_MEDIA_MAC, // mac floppy
132 };
133 
135  SciMessageWorkaroundType type;
136  int module;
137  byte noun;
138  byte verb;
139  byte cond;
140  byte seq;
141  byte talker;
142  uint32 substringIndex;
143  uint32 substringLength;
144  const char *text;
145 };
146 
148  SciGameId gameId;
149  SciMedia media;
150  kLanguage language;
151  int roomNumber;
152  int module;
153  byte noun;
154  byte verb;
155  byte cond;
156  byte seq;
158 };
159 
160 extern SciMessageWorkaroundSolution findMessageWorkaround(int module, byte noun, byte verb, byte cond, byte seq);
161 extern ResourceId remapAudio36ResourceId(const ResourceId &resourceId);
162 extern ResourceId remapSync36ResourceId(const ResourceId &resourceId);
163 
164 } // End of namespace Sci
165 
166 #endif // SCI_ENGINE_WORKAROUNDS_H
Definition: workarounds.h:147
Definition: workarounds.h:38
Definition: workarounds.h:134
Definition: workarounds.h:49
kLanguage
Definition: sci.h:124
Definition: console.h:28
Definition: state.h:88
Definition: resource.h:161