-
Notifications
You must be signed in to change notification settings - Fork 5
/
WarningHooks.h
587 lines (516 loc) · 23.9 KB
/
WarningHooks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
#pragma once
/*
// Messages to fix/make more verbose
0x004AF7DB, // MASTERFILE: Invalid LOCK extra found in extra data list.
0x004AF88E, // MASTERFILE: Invalid TELEPORT extra found in extra data list.
0x004AFF52, // No occlusion plane for occlusion plane ref extra.
0x004B000E, // MASTERFILE: Unable to find portal linked reference %08X. Portal linked reference data will be removed.
0x004B023A, // MASTERFILE: Removing empty decal extra.
0x004B0482, // MASTERFILE: Removing empty reflector water extra.
0x004B04BA, // MASTERFILE: Removing empty lit water extra.
0x004BADDA, // MASTERFILE: Could not find linked door (%08X) in teleport data init.
0x004BAE57, // MASTERFILE: Linked door '%s' (%08X) in teleport data has no parent cell.
0x004ECC3C, // Invalid karma value found. Unable to fix.
0x0065A222, // MASTERFILE: Random teleport doors cannot have preexisting teleport data. Teleport data will be removed.
0x0065A24C, // MASTERFILE: Random door has no teleport marker.
0x0066E8DD, // MASTERFILE: Unable to load EffectItem '%s' in Actor Effect '%s'
0x0066E968, // MASTERFILE: Trying to load condition data with no effect item in Actor Effect '%s'.
0x0064FBA4, // Patrol point event script for point %s has text but has not been compiled.
// Messages to fix/make more verbose and add () to %08X
0x0066E926, // MASTERFILE: Unable to find EffectSetting %d in Actor Effect '%s'. <- can't find form id for this one easily
0x004AD024, // FORMS: Reference %s %08X has no parent save cell
0x004AF84A, // MASTERFILE: Unable to find key %08X for lock data. Lock will be removed.
0x004AF9C9, // MASTERFILE: Unable to find ownership owner form %08X. Ownership will be removed.
0x004AFA37, // MASTERFILE: Unable to find ownership condition global %08X. Ownership will be removed.
0x004AFA9C, // MASTERFILE: Unable to find poison %08X. Poison data will be removed.
0x004AFB01, // MASTERFILE: Unable to find cell climate %08X. Climate data will be removed.
0x004AFB66, // MASTERFILE: Unable to find cell imagespace %08X. ImageSpace data will be removed.
0x004AFBE3, // MASTERFILE: Unable to find cell acoustic space %08X. AcousticSpace data will be removed.
0x004AFC48, // MASTERFILE: Unable to find cell water type %08X. Water data will be removed.
0x004AFCAD, // MASTERFILE: Unable to find cell music type %08X. Music data will be removed.
0x004AFCF8, // MASTERFILE: Unable to find package start location cell %08X. Package start location extra data will be removed.
0x004AFD59, // MASTERFILE: Unable to find enable state parent %08X. Enable state parent data will be removed.
0x004AFDB7, // MASTERFILE: Enable state parent loop detected. Parent removed.
0x004AFE1E, // MASTERFILE: Unable to find random door teleport marker %08X. Random door teleport marker data will be removed.
0x004AFE7F, // MASTERFILE: Unable to find linked reference %08X. Linked reference data will be removed.
0x004AFF52, // No occlusion plane for occlusion plane ref extra.
0x004AFF85, // MASTERFILE: Unable to find occlusion plane reference %08X. Occlusion plane reference data will be removed.
0x004B000E, // MASTERFILE: Unable to find portal linked reference %08X. Portal linked reference data will be removed.
0x004B0043, // MASTERFILE: Both of portal %08X's linked rooms are the same (%08X). Attempting to fix.
0x004B006F, // MASTERFILE: Both of portal %08X's linked rooms are NULL.
0x004B0176, // MASTERFILE: Unable to find activate reference %08X.
0x004B023A, // MASTERFILE: Removing empty decal extra.
0x004B029F, // MASTERFILE: Unable to find merchant container %08X. Merchant container data will be removed.
0x004B0304, // MASTERFILE: Unable to find XMarker target %08X. XMarker target data will be removed.
0x004B0369, // Unable to find encounter zone %08X. Encounter zone data will be removed.
0x004B03CC, // MASTERFILE: Unable to find emittance source %08X. Emittance source data will be removed.
0x004B044A, // MASTERFILE: Unable to find multibound ref %08X used by reference %08X. Multibound ref data will be removed.
0x004B0482, // MASTERFILE: Removing empty reflector water extra.
0x004B04BA, // MASTERFILE: Removing empty lit water extra.
0x004B0525, // Unable to find ammo %08X. Ammo data will be removed.
0x004B05B0, // DOOR: Reference %s %08X has portal to navmesh %08X which is not found. Please finalize navmesh in cell %s %08X to resolve this.
0x004B5042, // FORMS: Form %08X no longer has an override, yet I'm trying to set it to %s
0x004D8B17, // FORMS: Addon Node %08X \"%s\" is trying to use index %i, but Addon Node %08X \"%s\" already uses that index. Addon Node %08X \"%s\" will be remapped to a new index.
0x004DBE40, // FORMS: Attempting to use existing form %s '%s' %08X as parent form for following child forms.
0x004E5BFB, // MASTERFILE: Old Destruction data found on form %08X %s. It needs to be resaved.
0x004FC904, // FORMS: SetFormID bashing entry in form ID map at %08X.\n\nForm basher: type %s_ID\n\nBashed form: %s
0x0054D0F1, // DEFAULT: Could not checkout form %08X during import
0x0054E11A, // DEFAULT: Bad Filter form %08X %s sent to BGSEntryPointPerkEntry::CheckConditionFilters.
0x00568CAE, // DEFAULT: Could not find faction rank #%i during import of faction %08X.
0x00568D17, // DEFAULT: Could not find faction %08X during import.
0x0057DB9F, // QUESTS: Could not find stage index %i in quest %08X during import.
0x0057DBC9, // QUESTS: Could not find stage item #%i during import of stage %i in quest %08X.
0x0057DC60, // QUESTS: Could not find quest %08X during import.
0x0057DF78, // FORMS: Could not check out form %08X during import
0x0057DFA4, // QUESTS: Could not find objective index %i in quest %08X during import.
0x0057DFB4, // QUESTS: Could not find quest %08X during import.
0x00594282, // DIALOGUE: Could not find response #%i during import of topic %08X.
0x00594292, // DIALOGUE: Could not find topic %08X during import.
0x005949AA, // FORMS: Info %08X under topic %08X no longer exists
0x00594A08, // MASTERFILE: Could not find named topic %08X during import.
0x005D3BC2, // MASTERFILE: Water type %08X could not be found on PlaceableWater %s (%08X)
0x005F1F60, // MODELS: LOD Mesh '%s' for object %08X '%s' could not be found.
0x005F799F, // DEFAULT: Could not checkout form %08X during import
0x00635159, // Reference %08X (%s) in cell %08X (%s) should not be refracted by auto water; the flag was reset.
0x006351EF, // Reference %08X (%s) in cell %08X (%s) should not be refracted by auto water; however, the flag could not be reset, as the reference is checked out by %s.
0x0064D6F3, // FORMS: Could not checkout form %08X.
0x00659A2F, // No collision object for placeable water object %08X.
0x00659A5A, // No shape for placeable water object %08X's collision object.
0x00659DC8, // MODELS: LOD Mesh '%s' for reference %08X '%s' in cell '%s' could not be found.
0x00659E05, // MODELS: LOD Mesh '%s' for reference %08X '%s' in cell '%s' (%d, %d) could not be found.
0x006A99FA, // PATHFINDING: Navmesh %08x Cell %s and Navmesh %08x Cell %s have at least one edge in common but are not connected. Are the navmeshes Finalized?
0x006AAA14, // PATHFINDING: Navmesh %08x Cell %s, has bad vertex X coordinate, Please regenerate
0x006AAA49, // PATHFINDING: Navmesh %08x Cell %s, has a large number of triangles, %d, please check and optimize
0x006AAAD3, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d, edge %d has bad Triangle index, Clearing the connection
0x006AAC0B, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d, has a downfacing normal, flipping the triangle
0x006AADDC, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d, edge %d has bad extra info index, Clearing extra info flag
0x006AB273, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d, edge %d has bad Portal (Navmesh %08x does not have a triangle index %d), Clearing the portal
0x006AB3C0, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d, edge %d has a Portal to a Navmesh (%08x) in a different Worldspace, Clearing the portal
0x006AB55A, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d is degenerate, Vertices 0 and 1 both use vertex index %d
0x006AB6B1, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d is degenerate, Vertices 0 and 2 both use vertex index %d
0x006AB7FF, // PATHFIDING: Navmesh %08x Cell %s, Triangle %d is degenerate, Vertices 1 and 2 both use vertex index %d
0x006AB99C, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d Edges 0 and 1 both point to the same triangle %d
0x006ABB12, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d Edges 0 and 2 both point to the same triangle %d
0x006ABC90, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d Edges 1 and 2 both point to the same triangle %d
0x006ABEC3, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d and %d have opposite normals but are linked
0x006AC044, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d Edge %d has a portal data to Triangle %d, but Triangle %d doesn't have any Portal info for its matching edge %d
0x006AC192, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d Edge %d Should have a link to Triangle %d, but doesn't
0x006AC2D4, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d Edge %d Should have a link to Triangle %d, but doesn't
0x006AC422, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d Edge %d Should have Portal information, but doesn't
0x006AC68E, // PATHFINDING: Navmesh %08x Cell %s, Triangle %d has a link to Triangle %d, but Triangle %d doesn't have the matching link
0x006AC820, // PATHFINDING: Navmesh %08x Cell %s, Triangles %d and %d are linked, but their vertices do not match
0x006AE630, // MASTERFILE: Did not find matching NavMeshInfo for NavMesh ID %08X in cell %s, Creating a temporary one
0x006AE6B6, // MASTERFILE: NavMesh ID %08X in cell %s is altered but not checked out to the current user.
0x006AEC8B, // NavMesh: Door reference %08X is not found but is linked to %s. Please finalize to resolve this.
0x006EB943, // PATHFINDING: NavMeshInfo %08x in cell %s, has no parent space, removing it from the map
0x006EB9E0, // PATHFINDING: NavMeshInfo %08x in cell %s, has no matching navmesh, removing it from the map
0x006EBA53, // PATHFINDING: NavMeshInfo %08x in cell %s, has a navmesh that is marked deleted, removing it from the map
0x006EBB25, // PATHFINDING: NavMeshInfo %08x in cell %s, has a portal with no navmesh, removing the portal
0x006EBC03, // PATHFINDING: NavMeshInfo %08x in cell %s, has a portal with no navmesh, removing the portal
0x006EBEF8, // PATHFINDING: NavMeshInfo %08x has a portal to NavMeshInfo %08x, but there is no triangle portal between the two, updating the NavMeshInfo
0x006EBFBC, // PATHFINDING: NavMeshInfo %08x has a portal to NavMeshInfo %08x, but there is no triangle portal between the two, updating the NavMeshInfo
0x006EC0C9, // PATHFINDING: NavMeshInfo %08x does not have a portal to NavMeshInfo %08x, but the navmesh does, updating the NavMeshInfo
0x006EC115, // PATHFINDING: NavMeshInfo %08x does not have a Door portal for door %08x, but the navmesh does, updating the NavMeshInfo
0x006EC165, // PATHFINDING: NavMeshInfo %08x has a portal to Door %08x, but the navmesh does not, updating the NavMeshInfo
0x006ED31A, // MASTERFILE: Could not find Parent Space with ID %08x for NavmeshInfo %08x
*/
static const char* messageCreateFileMapping = "This operation was not completed because CreateFileMapping failed to open file \"%s\" with error:\n%s\n\nExit other applications, restart the Construction Kit, and try again.";
static const char* messageCouldNotCheckoutForm = "FORMS: Could not checkout form (%08X) during import.";
static const char* messageBodyPartDataNotFound = "MASTERFILE: Could not find body part data (%08X) during import.";
static const char* messageAmmoNotFound = "MASTERFILE: Could not find ammo (%08X) during import.";
static const char* messageNavmeshTriangleDegenerate = "PATHFINDING: Navmesh (%08X) Cell %s, Triangle %d is degenerate, Vertices 1 and 2 both use vertex index %d";
static const char* messageMediaLocationController = "MASTERFILE: Could not find Media Location Controller (%08X) for Audio Marker (%08X) in extra data list.";
static const char* messagePotentiallyInvalidZValue = "CELLS: Potentially Invalid Z value (%.2f) on reference:\n%s";
static const char* messagePotentiallyInvalidXValue = "CELLS: Potentially Invalid X value (%.2f) on reference:\n%s";
static const char* messagePotentiallyInvalidYValue = "CELLS: Potentially Invalid Y value (%.2f) on reference:\n%s";
__HOOK hk_UnableToFindEnableStateParentMsgHook()
{
static const char* messageFormat = "MASTERFILE: Unable to find enable state parent %08X. Enable state parent data will be removed in ref (%08X).";
static const UInt32 kRetnAddr = 0x004AFD59;
__asm
{
mov eax, dword ptr ds : [ebp + 0x0C]
push eax
mov eax, dword ptr ss : [esp + 0x44]
push eax
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_UnableToFindPackageReferenceMsgHook()
{
static const char* messageFormat = "MASTERFILE: Unable to find Package Target Reference (%08X) on owner object \"%s\" (%08X).";
static const UInt32 kRetnAddr = 0x004A1687;
__asm
{
mov ecx, dword ptr ds : [ebp + 0x0C]
push ecx
mov ecx, dword ptr ss : [esp + 0x08]
push eax
push ecx
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_UnableToFindPackageLocationMsgHook()
{
static const char* messageFormat = "MASTERFILE: Unable to find Package Location Reference (%08X) on owner object \"%s\" (%08X).";
static const UInt32 kCallAddr = (UInt32)Console_Print2;
static const UInt32 kRetnAddr = 0x0049FCFB;
__asm
{
mov ecx, dword ptr ds : [ebp + 0x0C]
push ecx
mov ecx, dword ptr ss : [esp + 0x0C]
push eax
push ecx
push messageFormat
mov eax, kCallAddr
call eax
mov byte ptr ds : [edi] , 0
add esp, 0x10
jmp kRetnAddr
}
}
__HOOK hk_TryingToAccessLocalVariableInScriptMsgHook()
{
static const char* messageFormat = "SCRIPTS: Trying to access local variable %d in script '%s' (%08X) -- variable not found.\r\n";
static const UInt32 kRetnAddr = 0x005C2852;
static uint32_t kTemp;
__asm
{
mov kTemp, eax
mov eax, dword ptr ds : [ecx + 0x0C]
push eax
mov eax, kTemp
push eax
push esi
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_UnableToFindLinkedReferenceMsgHook()
{
static const char* messageFormat = "MASTERFILE: Unable to find linked reference (%08X). Linked reference data will be removed in ref (%08X).";
static const UInt32 kRetnAddr = 0x004AFE7F;
__asm
{
mov edx, dword ptr ds : [ebp + 0x0C]
push edx
mov edx, dword ptr ss : [esp + 0x4C]
push edx
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_CouldNotFindMediaLocationControllerMsgHook()
{
static const char* messageFormat = "MASTERFILE: Could not find MediaLocationController (%08X) for AudioMarker (%08X) in extra data list.";
static const UInt32 kRetnAddr = 0x004AF98C;
static uint32_t kTemp;
__asm
{
mov kTemp, edx
mov edx, dword ptr ds : [ebp + 0x0C]
push edx
mov edx, kTemp
push edx
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_ChunkAbnormallyTerminatedMsgHook()
{
static const char* messageFormat = "MASTERFILE: Chunk %c%c%c%c abnormally terminated TESObjectREFR::Load for ref (%08X).\n";
static const UInt32 kRetnAddr = 0x0064FF84;
__asm
{
mov ecx, dword ptr ds : [edi + 0x0C]
push ecx
mov ecx, eax
shr ecx, 0x18
push ecx
mov edx, eax
mov ecx, eax
sar edx, 0x10
and edx, 0xFF
push edx
sar ecx, 0x08
and ecx, 0xFF
push ecx
and eax, 0xFF
push eax
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_OnPackageBeginScriptNotCompiledMsgHook()
{
static const char* messageFormat = "MASTERFILE: %s (%08X)";
static const UInt32 kCallAddr = 0x00407120;
static const UInt32 kRetnAddr = 0x00496F3C;
__asm
{
mov eax, kCallAddr
call eax
mov ebx, dword ptr ds : [esi + 0x0C]
push ebx
mov ebx, dword ptr ss : [ebp + 0x58]
push ebx
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_OnPackageChangeScriptNotCompiledMsgHook()
{
static const char* messageFormat = "MASTERFILE: %s (%08X)";
static const UInt32 kCallAddr = 0x00407120;
static const UInt32 kRetnAddr = 0x00496F79;
__asm
{
mov eax, kCallAddr
call eax
mov ebx, dword ptr ds : [esi + 0x0C]
push ebx
mov ebx, dword ptr ss : [ebp + 0x58]
push ebx
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_OnPackageEndScriptNotCompiledMsgHook()
{
static const char* messageFormat = "MASTERFILE: %s (%08X)";
static const UInt32 kCallAddr = 0x00407120;
static const UInt32 kRetnAddr = 0x00496FB3;
__asm
{
mov eax, kCallAddr
call eax
mov ebx, dword ptr ds : [esi + 0x0C]
push ebx
mov ebx, dword ptr ss : [ebp + 0x58]
push ebx
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_ScriptHasTextButNotCompiledMsgHook()
{
static const char* messageFormat = "SCRIPTS: %s (%X08)";
static const UInt32 kCallAddr = 0x00407120;
static const UInt32 kRetnAddr = 0x005C36F1;
__asm
{
mov eax, kCallAddr
call eax
mov eax, [ebx + 0x0C]
push eax
mov ecx, dword ptr ss : [ebp - 0x20]
push ecx
push messageFormat
jmp kRetnAddr
}
}
__HOOK hk_RemoveEmptyLitWaterMsgHook()
{
static const char* messageFormat = "MASTERFILE: Removing empty lit water extra data in ref (%08X).";
static const UInt32 kRetnAddr = 0x004B044A;
__asm
{
mov ecx, [esp + 0x80]
push eax
mov eax, messageFormat
push eax
jmp kRetnAddr
}
}
__HOOK hk_EnableStateParentLoopMsgHook()
{
static const char* messageFormat = "MASTERFILE: Enable state parent loop detected in ref (%08X). Parent removed.";
static const UInt32 kRetnAddr = 0x004AFDB7;
static uint32_t kTemp;
__asm
{
mov kTemp, ecx
mov ecx, [esp + 0x04]
mov ecx, [ecx + 0x0C]
push ecx
mov eax, messageFormat
push eax
mov ecx, kTemp
jmp kRetnAddr
}
}
__HOOK hk_RemoveEmptyActivateParentMsgHook()
{
static const char* messageFormat = "MASTERFILE: Removing empty activate parent extra data in ref (%08X).";
static const UInt32 kRetnAddr = 0x004B0214;
static uint32_t kTemp;
__asm
{
mov kTemp, ecx
mov ecx, [esp + 0x04]
mov ecx, [ecx + 0x0C]
push ecx
mov eax, messageFormat
push eax
mov ecx, kTemp
jmp kRetnAddr
}
}
__HOOK hk_UnableToFindLeveledObjectMsgHook()
{
static const char* messageFormat = "Unable to find Leveled Object Form (%08X) for owner object \"%s\" (%08X).";
static const UInt32 kRetnAddr = 0x005004BB;
static uint32_t kTemp;
__asm
{
mov kTemp, eax
mov eax, [ebx + 0x0C]
push eax
mov eax, kTemp
push eax
push ecx
mov eax, messageFormat
push eax
jmp kRetnAddr
}
}
void DoScriptErrorWarning(char* errorMsg) {
Console_Print2("%s", errorMsg);
if (config.bScriptCompileWarningPopup) {
MessageBoxExA(NULL, errorMsg, "Script Compile Error", MB_ICONWARNING, NULL);
}
}
__HOOK hk_EnableScriptErrorsMsgHook()
{
static const UInt32 kRetnAddr = 0x005C57E7;
__asm
{
pushad
push eax
call DoScriptErrorWarning
add esp, 4
popad
mov dword ptr ss : [esp + 0x0120] , 0xFFFFFFFF
jmp kRetnAddr
}
}
__HOOK hk_UnableToFindPortalLinkedMsgHook()
{
static const UInt32 retnAddr = 0x4B000E;
static const char* msg = "MASTERFILE: Unable to find portal linked reference %08X for ref %08X. Portal linked reference data will be removed.";
_asm
{
push [ebp + 0xC] // form->refID
push msg
jmp retnAddr
}
}
__HOOK hk_RemovingEmptyReflectorWaterMsgHook()
{
static const UInt32 retnAddr = 0x4B0482;
static const char* msg = "MASTERFILE: Removing empty reflector water extra for ref (%08X).";
_asm
{
push [ebp + 0xC] // form->refID
push msg
jmp retnAddr
}
}
void WriteErrorMessageHooks()
{
// Fix message bugs/change message formatting - credit to roy
SafeWrite32(0x00468D13 + 1, (UInt32)messageCreateFileMapping);
SafeWrite32(0x00468DD8 + 1, (UInt32)messageCreateFileMapping);
SafeWrite32(0x005503A8 + 1, (UInt32)messageCouldNotCheckoutForm);
SafeWrite32(0x00547D47 + 1, (UInt32)messageCouldNotCheckoutForm);
SafeWrite32(0x005E0F41 + 1, (UInt32)messageCouldNotCheckoutForm);
SafeWrite32(0x00547D5B + 1, (UInt32)messageBodyPartDataNotFound);
SafeWrite32(0x005503B8 + 1, (UInt32)messageBodyPartDataNotFound);
SafeWrite32(0x005E0F51 + 1, (UInt32)messageAmmoNotFound);
SafeWrite32(0x005E0F5F + 1, (UInt32)messageAmmoNotFound);
SafeWrite32(0x006AB7FA + 1, (UInt32)messageNavmeshTriangleDegenerate);
SafeWrite32(0x0065A6C9 + 1, (UInt32)messagePotentiallyInvalidZValue);
SafeWrite32(0x0065A882 + 1, (UInt32)messagePotentiallyInvalidXValue);
SafeWrite32(0x0065A912 + 1, (UInt32)messagePotentiallyInvalidYValue);
// Warnings more verbose - credit to roy and jazzisparis
WriteRelJump(0x004B04B5, (UInt32)hk_RemoveEmptyLitWaterMsgHook);
SafeWrite8(0x004B04C1, 0x08);
WriteRelJump(0x004AFDB2, (UInt32)hk_EnableStateParentLoopMsgHook);
SafeWrite8(0x004AFDC2, 0x08);
SafeWrite8(0x004AFDBF, 0x18);
WriteRelJump(0x004B020F, (UInt32)hk_RemoveEmptyActivateParentMsgHook); // must be with EnableStateParentLoopMsgHook
WriteRelJump(0x005004B6, (UInt32)hk_UnableToFindLeveledObjectMsgHook);
SafeWrite16(0x005004B4, 0x9090);
SafeWrite8(0x005004C2, 0x10);
WriteRelJump(0x005C36EC, (UInt32)hk_ScriptHasTextButNotCompiledMsgHook);
SafeWrite32(0x005C36F1, 0x90909090);
SafeWrite8(0x005C36FC, 0x14);
WriteRelJump(0x00496F37, (UInt32)hk_OnPackageBeginScriptNotCompiledMsgHook);
SafeWrite32(0x00496F3C, 0x90909090);
SafeWrite8(0x00496F47, 0x14);
WriteRelJump(0x00496F74, (UInt32)hk_OnPackageChangeScriptNotCompiledMsgHook);
SafeWrite32(0x00496F79, 0x90909090);
SafeWrite8(0x00496F84, 0x14);
WriteRelJump(0x00496FAE, (UInt32)hk_OnPackageEndScriptNotCompiledMsgHook);
SafeWrite32(0x00496FB3, 0x90909090);
SafeWrite8(0x00496FBE, 0x14);
WriteRelJump(0x0064FF5B, (UInt32)hk_ChunkAbnormallyTerminatedMsgHook);
SafeWrite8(0x0064FF8B, 0x18);
WriteRelJump(0x004AF986, (UInt32)hk_CouldNotFindMediaLocationControllerMsgHook);
SafeWrite8(0x004AF98B, 0x90);
SafeWrite8(0x004AF993, 0x0C);
WriteRelJump(0x004AFE75, (UInt32)hk_UnableToFindLinkedReferenceMsgHook);
XUtil::PatchMemoryNop(0x004AFE7A, 5);
SafeWrite8(0x004AFE86, 0x0C);
WriteRelJump(0x005C284B, (UInt32)hk_TryingToAccessLocalVariableInScriptMsgHook);
SafeWrite16(0x005C2850, 0x9090);
SafeWrite8(0x005C2859, 0x10);
WriteRelJump(0x0049FCD5, (UInt32)hk_UnableToFindPackageLocationMsgHook);
WriteRelJump(0x004A167C, (UInt32)hk_UnableToFindPackageReferenceMsgHook);
SafeWrite8(0x004A168E, 0x10);
WriteRelJump(0x004AFD4F, (UInt32)hk_UnableToFindEnableStateParentMsgHook);
SafeWrite8(0x004AFD60, 0x0C);
// patch warning messages - credit to jazzisparis
for (UInt32 patchAddr : kPatch_Warnings1)
SafeWrite32(patchAddr + 1, (UInt32)Console_Print2);
for (UInt32 patchAddr : kPatch_Warnings2)
SafeWrite32(patchAddr + 6, (UInt32)Console_Print2);
for (UInt32 patchAddr : kPatch_Warnings3)
WriteRelCall(patchAddr, (UInt32)Console_Print2);
for (UInt32 patchAddr : kPatch_Warnings4)
WriteRelCall(patchAddr, (UInt32)Console_Print);
SafeWrite32(0x00C1A543 + 4, (UInt32)Console_Print2);
SafeWrite32(0x00C1A6DC + 1, (UInt32)Console_Print2);
if (config.bNoLODMeshMessage) {
// remove the MODELS: LOD Mesh ... messages
XUtil::PatchMemoryNop(0x659DC8, 5);
XUtil::PatchMemoryNop(0x659E05, 5);
}
if (config.bNoFactionReactionMessage) {
// DEFAULT: (Faction Reaction Error) Faction '%s' (%08X) is a Friend or Ally of Faction '%s' (%08X), but Faction '%s' (%08X) is not a Friend or Ally of Faction '%s' (%08X).
XUtil::PatchMemoryNop(0x00568979, 5);
}
// patch script editor messages - credit to roy
WriteRelJump(0x005C57E2, (UInt32)hk_EnableScriptErrorsMsgHook);
XUtil::PatchMemoryNop(0x005C57E7, 0x06);
WriteRelJump(0x4B0009, UInt32(hk_UnableToFindPortalLinkedMsgHook));
SafeWrite8(0x4B0019, 0xC); // add esp, 8 => add esp, 0xC for extra pushed arg
WriteRelJump(0x4B047D, UInt32(hk_RemovingEmptyReflectorWaterMsgHook));
SafeWrite8(0x4B0489, 0x8); // pop extra arg
// swap formID and editorID for consistency in LOD message
const char* LODMessage = "MODELS: LOD Mesh '%s' for object '%s' (%08X) could not be found.";
SafeWrite8(0x5F1F54, 0x56);
SafeWrite8(0x5F1F55, 0x50);
SafeWrite32(0x5F1F5C, UInt32(LODMessage));
const char* LODMessage2 = "MODELS: LOD Mesh '%s' for reference '%s' (%08X) in cell '%s' (%d, %d) could not be found.";
SafeWrite8(0x659DF9, 0x55);
SafeWrite8(0x659DFA, 0x50);
SafeWrite32(0x659E01, UInt32(LODMessage2));
const char* LODMessage3 = "MODELS: LOD Mesh '%s' for reference '%s' (%08X) in cell '%s' could not be found.";
SafeWrite8(0x659DBC, 0x55);
SafeWrite8(0x659DBD, 0x50);
SafeWrite32(0x659DC4, UInt32(LODMessage3));
}