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
29namespace Sci {
30
31enum 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
62extern const SciWorkaroundEntry arithmeticWorkarounds[];
63extern const SciWorkaroundEntry uninitializedReadWorkarounds[];
64extern const SciWorkaroundEntry uninitializedReadForParamWorkarounds[];
65extern const SciWorkaroundEntry kAbs_workarounds[];
66extern const SciWorkaroundEntry kAnimate_workarounds[];
67extern const SciWorkaroundEntry kCelHigh_workarounds[];
68extern const SciWorkaroundEntry kCelWide_workarounds[];
69extern const SciWorkaroundEntry kDeviceInfo_workarounds[];
70extern const SciWorkaroundEntry kDisplay_workarounds[];
71extern const SciWorkaroundEntry kDirLoop_workarounds[];
72extern const SciWorkaroundEntry kDisposeScript_workarounds[];
73extern const SciWorkaroundEntry kDoAudioResume_workarounds[];
74extern const SciWorkaroundEntry kDoSoundPlay_workarounds[];
75extern const SciWorkaroundEntry kDoSoundFade_workarounds[];
76extern const SciWorkaroundEntry kFileIOOpen_workarounds[];
77extern const SciWorkaroundEntry kFileIOCheckFreeSpace_workarounds[];
78extern const SciWorkaroundEntry kFileIOReadString_workarounds[];
79extern const SciWorkaroundEntry kFindKey_workarounds[];
80extern const SciWorkaroundEntry kFrameOut_workarounds[];
81extern const SciWorkaroundEntry kDeleteKey_workarounds[];
82extern const SciWorkaroundEntry kGetAngle_workarounds[];
83extern const SciWorkaroundEntry kGetCWD_workarounds[];
84extern const SciWorkaroundEntry kGetSaveFiles_workarounds[];
85extern const SciWorkaroundEntry kGraphDrawLine_workarounds[];
86extern const SciWorkaroundEntry kGraphSaveBox_workarounds[];
87extern const SciWorkaroundEntry kGraphRestoreBox_workarounds[];
88extern const SciWorkaroundEntry kGraphUpdateBox_workarounds[];
89extern const SciWorkaroundEntry kGraphFillBoxForeground_workarounds[];
90extern const SciWorkaroundEntry kGraphFillBoxAny_workarounds[];
91extern const SciWorkaroundEntry kGraphRedrawBox_workarounds[];
92extern const SciWorkaroundEntry kIsObject_workarounds[];
93extern const SciWorkaroundEntry kListAt_workarounds[];
94extern const SciWorkaroundEntry kLock_workarounds[];
95extern const SciWorkaroundEntry kMemory_workarounds[];
96extern const SciWorkaroundEntry kMoveCursor_workarounds[];
97extern const SciWorkaroundEntry kNewWindow_workarounds[];
98extern const SciWorkaroundEntry kPalVarySetVary_workarounds[];
99extern const SciWorkaroundEntry kPalVarySetPercent_workarounds[];
100extern const SciWorkaroundEntry kPalVarySetStart_workarounds[];
101extern const SciWorkaroundEntry kPalVaryMergeStart_workarounds[];
102extern const SciWorkaroundEntry kPlatform32_workarounds[];
103extern const SciWorkaroundEntry kRandom_workarounds[];
104extern const SciWorkaroundEntry kReadNumber_workarounds[];
105extern const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[];
106extern const SciWorkaroundEntry kSetCursor_workarounds[];
107extern const SciWorkaroundEntry kArraySetElements_workarounds[];
108extern const SciWorkaroundEntry kArrayFill_workarounds[];
109extern const SciWorkaroundEntry kSetPort_workarounds[];
110extern const SciWorkaroundEntry kStrAt_workarounds[];
111extern const SciWorkaroundEntry kStrCpy_workarounds[];
112extern const SciWorkaroundEntry kStrLen_workarounds[];
113extern const SciWorkaroundEntry kUnLoad_workarounds[];
114extern const SciWorkaroundEntry kWait_workarounds[];
115extern const SciWorkaroundEntry kStringNew_workarounds[];
116extern const SciWorkaroundEntry kScrollWindowAdd_workarounds[];
117
118extern SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciCallOrigin *trackOrigin);
119
120enum 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
127enum 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
160extern SciMessageWorkaroundSolution findMessageWorkaround(int module, byte noun, byte verb, byte cond, byte seq);
161extern ResourceId remapAudio36ResourceId(const ResourceId &resourceId);
162extern ResourceId remapSync36ResourceId(const ResourceId &resourceId);
163
164} // End of namespace Sci
165
166#endif // SCI_ENGINE_WORKAROUNDS_H
Definition: resource.h:161
Definition: console.h:28
kLanguage
Definition: sci.h:124
Definition: state.h:88
Definition: workarounds.h:147
Definition: workarounds.h:134
Definition: workarounds.h:49
Definition: workarounds.h:38