Commit MetaInfo

Revision11da07d1e0833bbc9b4927812bf3c599c9a76080 (tree)
Time2017-05-20 04:05:21
AuthorFace
CommiterFace

Log Message

OrbiterExtensions: made record event 2016 compatible

Change Summary

Incremental Difference

diff -r 68acde8d80e3 -r 11da07d1e083 Orbitersdk/samples/AscensionUltra/VirtualDockingTunnel.cpp
--- a/Orbitersdk/samples/AscensionUltra/VirtualDockingTunnel.cpp Sun Feb 14 11:09:16 2016 +0100
+++ b/Orbitersdk/samples/AscensionUltra/VirtualDockingTunnel.cpp Fri May 19 21:05:21 2017 +0200
@@ -12,6 +12,8 @@
1212 #define VESSELSTRUCTOFFSET_RECORDING 0x0D32
1313 #define CODEOFFSET_INTERNALRECORDEVENTADDRESS 0xC
1414 #define HOOKS 2
15+#define VERSIONS 2 // 0..2010, 1..2016
16+#define ORBITER2016 160828 // 28th August 2016
1517
1618 // ==============================================================
1719 // Global variables
@@ -44,10 +46,16 @@
4446 void *g_InternalRecordEvent;
4547
4648 DWORD g_Hook;
47-byte g_Original[HOOKS][9]=
49+byte g_Original[VERSIONS][HOOKS][9]=
4850 {
49- {0x8b,0x44,0x24,0x04,0x8b,0x40,0x48,0xc2,0x04},
50- {0x8B,0x09,0x80,0xB9,0x32,0x0D,0x00,0x00,0x00}
51+ {
52+ {0x8b,0x44,0x24,0x04,0x8b,0x40,0x48,0xc2,0x04},
53+ {0x8B,0x09,0x80,0xB9,0x32,0x0D,0x00,0x00,0x00}
54+ },
55+ {
56+ {0x8b,0x44,0x24,0x04,0x8b,0x40,0x48,0xc2,0x04},
57+ {0x8B,0x09,0x80,0xB9,0x22,0x0E,0x00,0x00,0x00}
58+ }
5159 };
5260
5361 //The following arrays are:
@@ -211,7 +219,8 @@
211219 }
212220 p.pointer=(void *)&g_Hook;
213221
214- if (memcmp((void *)g_Original[hook], address, 9)!=0) return -2;
222+ int version = oapiGetOrbiterVersion()<ORBITER2016?0:1;
223+ if (memcmp((void *)g_Original[version][hook], address, 9)!=0) return -2;
215224 for(int i=0;i<4;i++) g_Code[hook][5+i] = p.bytes[i];
216225
217226 return WriteCode(address, (void *)g_Code[hook], 9)*10;
@@ -259,8 +268,9 @@
259268 }
260269 break;
261270 }
271+ int version = oapiGetOrbiterVersion()<ORBITER2016?0:1;
262272 if (memcmp((void *)g_Code[hook], address, 9)!=0) return -2;
263- WriteCode(address, (void *)g_Original[hook], 9);
273+ WriteCode(address, (void *)g_Original[version][hook], 9);
264274
265275 switch(hook)
266276 {
Show on old repository browser