diff --git a/Binary/win32/Data/font_ansi.bin b/Binary/win32/Data/font_ansi.bin
new file mode 100644
index 0000000000..33b20041cc
Binary files /dev/null and b/Binary/win32/Data/font_ansi.bin differ
diff --git a/Binary/win32/Data/font_sjis.bin b/Binary/win32/Data/font_sjis.bin
new file mode 100644
index 0000000000..c8d25fdcd0
Binary files /dev/null and b/Binary/win32/Data/font_sjis.bin differ
diff --git a/Binary/win32/Patches/GMSE01.ini b/Binary/win32/Patches/GMSE01.ini
new file mode 100644
index 0000000000..4cece7a9c8
--- /dev/null
+++ b/Binary/win32/Patches/GMSE01.ini
@@ -0,0 +1,155 @@
+[OnFrame]
+
+[ActionReplay]
+All Shines
+00E60AE1 18000000
+045708E8 FFFFFFFF
+045708EC FFFFFFFF
+045708F0 FFFFFFFF
+
+Open all levels and nozzles
+00E60AE0 18000000
+04570958 FFFFFFFF
+0457095C FFFFFFFF
+
+8 red coins(press L & B)
+00E61642 18000000
+0A3FBBF4 00000240
+025709DE 00000008
+
+Infinite hover time
+00E61520 18000000
+042640BC 60000000
+
+Infinite water
+00E6151F 18000000
+04263F58 38002710
+042635B0 60000000
+
+Infinite health
+00E60ADF 18000000
+424057F4 00040009
+
++99 lives
+00E60ADE 18000000
+00570967 00000063
+
++Test Level
+00B86425 08000000
+043E9710 00000C01
+
++Low Gravity
+00B809F5 08000000
+4240E12C 05003E00
+
+Jesus Mode A.K.A. Walk on Water D-Pad Up/Down = On/Off
+00B813BC 08000000
+04002F00 3C608041
+04002F04 8063E12C
+04002F08 80C3FFCC
+04002F0C 2C060000
+04002F10 4D820020
+04002F14 C2660008
+04002F18 EE852824
+04002F1C EE93A02A
+04002F20 FC019840
+04002F24 4C800020
+04002F28 FC20A090
+04002F2C 38C00008
+04002F30 90C30248
+04002F34 4E800020
+0A404454 00000008
+04189854 4BE796AC
+0A404454 00000004
+04189854 4E800020
+
++Do Not Have To Move Before Triple Jump
+00B819B3 08000000
+4240E10C 06B00000
+
+Spin Jump Gravity - Really Slow Fall
+00B86E48 08000000
+4240E10C 058E3D00
+
+Spin Jump Gravity - Almost No Fall
+00B8369D 08000000
+4240E10C 058E0000
+
+Spin Jump Gravity - Fall Really Fast
+00B86350 08000000
+4240E10C 058E4200
+
+Spin Jump Gravity - Normal Speed
+00B80454 08000000
+4240E10C 058E3EB3
+
++Insane heat waves Crazy colors everywhere!
+00B80485 08000000
+043AA070 41200000
+
+Double vision heat wave (narrow)
+00B856EB 08000000
+043AA070 3F600000
+
+Double vision heat wave (wide)
+00B85C4A 08000000
+043AA070 3F400000
+
+Use only one of following two. Vanish point visual distortion
+00B842EC 08000000
+043AB304 3E000000
+
+Hard to select file, activators will work if you add them.. Camera is far out
+00B82579 08000000
+043AB304 3F000000
+
+X textures
+00B80A69 08000000
+043DB210 41200000
+
+
+Y textures
+00B80605 08000000
+043DB224 41200000
+
+
+Z textures
+00B86358 08000000
+043DB238 41200000
+
+
+Strangely distorted people
+00B82C96 08000000
+0440CC24 3F900000
+
+Mute game
+00B87829 08000000
+04417248 00000000
+
+Magnify camera
+00B87EB7 08000000
+04417690 3F900000
+
+Warped camera view
+00B851AB 08000000
+044176A8 3E000000
+
+Poorly Shaded Mario
+00B87DA5 08000000
+044176FC 00000000
+
+Nozzle Modifier Press the buttons below to switch to another nozzle. You must have your nozzle set to squirt for it to work. You will never use another nozzle box again!! Just kidding.B+D-Pad Up:Rocket NozzleB+D-Pad Left:Turbo NozzleB+D-Pad Right:Hover NozzleB+D-Pad Down:Jump Nozzle
+
+00B83682 08000000
+0A404454 00000208
+04269F50 3BE00001
+0A404454 00000204
+04269F50 3BE00002
+0A404454 00000201
+04269F50 3BE00005
+0A404454 00000202
+04269F50 3BE00004
+
+Always Green Yoshi
+00B80C27 08000000
+405F3A90 04AE4C00
diff --git a/Binary/win32/Patches/GZLE01.ini b/Binary/win32/Patches/GZLE01.ini
new file mode 100644
index 0000000000..045345c891
--- /dev/null
+++ b/Binary/win32/Patches/GZLE01.ini
@@ -0,0 +1,420 @@
+[OnFrame]
+0x802904b4=dword:0x4E800020 #Fix item hang
+
+# WARNING - cheats may screw up your save games
+# 0x803C4C09=byte:0x50 #Max health
+# 0x803C4C0B=byte:0x50 #Current health
+
+# Hidden dungeon
+# 0x803C9D44=dword:0x000000FF
+# 0x803C9D48=dword:0x485F7465
+# 0x803C9D4C=dword:0x73740000
+
+# Snow test room
+# 0x803C9D44=dword:0x000000FF
+# 0x803C9D48=dword:0x49546573
+# 0x803C9D4C=dword:0x74363200
+
+#only supports decrypted AR codes
+
+[ActionReplay]
+# Use GCNCrypt to decrypt large chunks of codes found online, and paste here.
+# Add a + to the name to activate.
+# Codes by GCNHacker87 (yes we forgot to ask permission)
++Master Code (useless)
+01E0197D 88000000
+C4323EA8 0000FF00
+
+Shadow Link
+01E05E82 08000000
+041926B8 60000000
+423BCDA0 00BCFFFF
+423BCDA0 00BDFF87
+403BCDA0 00017E3F
+
+Stuff at the top right of the screen is not visible
+01E00EFA 08000000
+903ED848 00000000
+023F633C 00028000
+003F710A 00000080
+003F713A 00000080
+003F715E 00000080
+403BB494 00106A80
+403BB498 002F5080
+00000000 40000000
+
+Super Hookshot
+01E03C97 08000000
+043F9DFC 48420B00
+040F1E68 28030001
+043F9E00 43008700
+0A3ED84A 00000140
+040F2898 3C000000
+123ED84A 00000140
+040F2898 8001004C
+
++Teleport to Fire Mountain up R Y
+01E05660 08000000
+4A3ED84A 00000828
+043E440C 482F85A1
+043E4414 C7EA36FD
+
+Hold A to swim fast
+01E0712B 08000000
+0A3ED84A 00000100
+0435D548 44610000
+123ED84A 00000100
+0435D548 41900000
+
++Run/Swim/Crawl fast Hold A
+01E06820 08000000
+4A3ED84A 00000100
+0435CEEC 42480000
+0435D548 44610000
+523ED84A 00000100
+0435CEEC 41880000
+0435D548 41900000
+0A3ED84A 00000120
+0435DB94 42800000
+123ED84A 00000120
+0435DB94 40400000
+
+(m)
+01E0197D 88000000
+C4323EA8 0000FF00
+
+Max Health
+01E0197E 08000000
+003C4C09 00000050
+
+Infinite Health
+01E0197F 08000000
+003C4C0B 00000050
+
+Full Nintendo Gallery
+01E01A3B 08000000
+003C5260 00000001
+023C52AC 0003FFFF
+023C52B8 0005FFFF
+003C52C8 000000FF
+023C52DC 0000FFFF
+
+Small energy sword
+01E058C4 08000000
+0435DF6C 004A004A
+
+Full energy Sword
+01E03B23 08000000
+0435DF6C 004C004C
+
+HookShot Head/beam sword
+01E064B0 08000000
+0435DF6C 004C001E
+
+Normal/no glow
+01E042B7 08000000
+0435DF6C 00460046
+
+Jesus Mode aka WalkOnWater
+01E071C7 08000000
+04004010 2C070003
+04004014 C01EFFA0
+04004018 4182000C
+0400401C C01F008C
+04004020 4809EF60
+04004024 FC16A840
+04004028 C2DEFFA4
+0400402C 4182FFF0
+04004030 4809EF54
+04004048 281E5787
+0400404C 4081001C
+04004050 FC010040
+04004054 4080000C
+04004058 D2BEFFA0
+0400405C 4800000C
+04004060 C2DEFF9C
+04004064 D03EFFA0
+04004068 EC210028
+0400406C 48138FB8
+043C5E44 04071987
+040A2F7C 4BF61094
+0413D020 4BEC7028
+
+Use anything indoors
+01E01C68 08000000
+0020485F 0000007E
+
+Sink or Swim A+D-pad down sink B+D-pad down swim
+01E00949 08000000
+0A3ED84A 00000104
+0435D560 50000000
+0A3ED84A 00000204
+0435D560 42B40000
+
+Jump to a ledge at any height
+01E05CFA 08000000
+0435D734 469C4000
+
+Very Fast on Ladders (May have to barly tap forward on joystick inorder to get on vein walls)
+01E01534 08000000
+00000000 8435DB18
+41200000 00040002
+0435DB38 7F7FFFFF
+
+Extra deku leaf controls (Y makes you rise, Z keeps you at your current height, X wind pulls you instead of push, to stop it from rising you must close and reopen the leaf quickly)
+01E04637 08000000
+0A3ED84A 00000800
+0435DC90 40700000
+0A3ED84A 00000010
+0435DC90 00000000
+0A3ED84A 00000400
+0435DCA4 C1200000
+4A3ED84A 00000000
+0435DC90 C0000000
+0435DCA4 41166666
+
+Roll further
+01E05AB9 08000000
+0435D3D0 40000000
+
+Instead of rolling, you glide
+01E05AAE 08000000
+0435D3CC 45500000
+
+#DON'T USE ANY OF THE FOLLOWING CODES UNTIL AFTER MEETING THE DRAGON BOAT
+Max Magic
+01E01983 08000000
+003C4C1B 00000020
+
+Infinite Magic
+01E01984 08000000
+003C4C1C 00000020
+
+Can Carry 1000 Rupees
+01E01985 08000000
+003C4C1A 00000001
+
+Can Carry 5000 Rupees
+01E01986 08000000
+003C4C1A 00000002
+
+Always Have 1000 Rupees
+01E01987 08000000
+023C4C0C 000003E8
+
+Always Have 5000 Rupees
+01E01988 08000000
+023C4C0C 00001388
+
+Link Can Swim Forever
+01E01989 08000000
+023CA76E 00000384
+
+Have All Songs
+01E0198A 08000000
+003C4CC5 0000003F
+
+Have Hero's Sword
+01E0198B 08000000
+003C4C16 00000038
+003C4CBC 00000001
+
+Have Mirror Shield
+01E0198C 08000000
+003C4C17 0000003C
+003C4CBD 00000003
+
+Have Telescope
+01E0198D 08000000
+003C4C44 00000020
+
+Have Sail
+01E0198E 08000000
+003C4C45 00000078
+
+Have Wind Waker
+01E0198F 08000000
+003C4C46 00000022
+
+Have Grappling Hook
+01E01990 08000000
+003C4C47 00000025
+
+Have Boomerang
+01E01991 08000000
+003C4C49 0000002D
+
+Have Deku Leaf
+01E01992 08000000
+003C4C4A 00000034
+
+Have Tingle Tuner
+01E01993 08000000
+003C4C4B 00000021
+
+Have DX Camera
+01E01994 08000000
+003C4C4C 00000026
+
+Have Iron Boots
+01E01995 08000000
+003C4C4D 00000029
+
+Have Magic Shielding
+01E01996 08000000
+003C4C4E 0000002A
+
+Have Bow And All Arrows
+01E01997 08000000
+003C4C50 00000036
+
+Have Bombs
+01E01998 08000000
+003C4C51 00000031
+
+Have Hookshot
+01E01999 08000000
+003C4C57 0000002F
+
+Have Megaton Hammer
+01E0199A 08000000
+003C4C58 00000033
+
+Have Bottle 1
+01E0199B 08000000
+003C4C52 00000050
+
+Have Bottle 2
+01E0199C 08000000
+003C4C53 00000050
+
+Have Bottle 2 With Fairy
+01E01ACC 08000000
+003C4C53 00000057
+
+Have Bottle 3
+01E0199D 08000000
+003C4C54 00000050
+
+Have Bottle 3 With Blue Potion
+01E01ACD 08000000
+003C4C54 00000053
+
+Have Bottle 4
+01E0199E 08000000
+003C4C55 00000050
+
+Have Spoils Bag
+01E0199F 08000000
+003C4C48 00000024
+
+Have Bait Bag
+01E019A0 08000000
+003C4C4F 0000002C
+
+Have Delivery Bag
+01E019A1 08000000
+003C4C56 00000030
+
+Infinite Berry Feed
+01E019A2 08000000
+003C4C86 00000082
+003C4CAC 00000009
+
+Infinite Pear Feed
+01E019A3 08000000
+003C4C87 00000083
+003C4CAD 00000009
+
+Max Red Chu Jelly
+01E019A4 08000000
+003C4C7E 00000049
+003C4CA4 00000063
+
+Max Green Chu Jelly
+01E019A5 08000000
+003C4C83 0000004A
+003C4CA5 00000063
+
+Max Blue Chu Jelly
+01E019A6 08000000
+003C4C85 0000004B
+003C4CA6 00000063
+
+Max Joy Pendants
+01E019A7 08000000
+003C4C7F 0000001F
+003C4CA7 00000063
+
+Max Skull Necklaces
+01E019A8 08000000
+003C4C80 00000045
+003C4CA8 00000063
+
+Max Knight's Crest
+01E019A9 08000000
+003C4C81 00000048
+003C4CA9 00000063
+
+Max Boko Baba Seeds
+01E019AA 08000000
+003C4C82 00000046
+003C4CAA 00000063
+
+Max Golden Feathers
+01E019AB 08000000
+003C4C84 00000047
+003C4CAB 00000063
+
+Can Carry 99 Arrows
+01E019AC 08000000
+003C4C77 00000063
+
+Can Carry 99 Bombs
+01E019AD 08000000
+003C4C78 00000063
+
+Infinite Arrows
+01E019AE 08000000
+003C4C71 00000063
+
+Infinite Bombs
+01E019AF 08000000
+003C4C72 00000063
+
+Have Fully Detailed Map
+01E019B0 08000000
+023C4D0C 00170303
+003C4D3C 00000003
+
+Have All Quest Maps
+01E019B1 08000000
+023C4CDC 0003FFFF
+
+All Triforce Maps Translated
+01E019B2 08000000
+003C4D4D 000000FF
+
+Fully Charged Master Sword DON'T USE THIS CODE UNTIL YOU HAVE THE MASTER SWORD
+01E01A3E 08000000
+003C4C16 0000003E
+003C4CBC 0000000F
+
+Have All Element Stones DON'T USE THIS CODE UNTIL DRAGON ROOST ISLAND
+01E019B5 08000000
+003C4CC7 00000007
+003C524A 00000040
+
+Have Complete Triforce USE THIS CODE AFTER BEATING THE TOWER OF THE GODS
+01E019B8 08000000
+003C4CC6 000000FF
+
++Press R to Jump
+01E019BB 08000000
+0A3ED84A 00000020
+863E4410 00000001
+
+Press R to Mega Jump
+01E019BC 08000000
+0A3ED84A 00000020
+863E4410 00000003
\ No newline at end of file
diff --git a/Binary/win32/WII/setting-eur.txt b/Binary/win32/WII/setting-eur.txt
new file mode 100644
index 0000000000..693d7411eb
Binary files /dev/null and b/Binary/win32/WII/setting-eur.txt differ
diff --git a/Binary/win32/WII/setting-jpn.txt b/Binary/win32/WII/setting-jpn.txt
new file mode 100644
index 0000000000..db15646b46
Binary files /dev/null and b/Binary/win32/WII/setting-jpn.txt differ
diff --git a/Binary/win32/WII/setting-usa.txt b/Binary/win32/WII/setting-usa.txt
new file mode 100644
index 0000000000..38ca5d91db
Binary files /dev/null and b/Binary/win32/WII/setting-usa.txt differ
diff --git a/Binary/win32/cg.dll b/Binary/win32/cg.dll
new file mode 100644
index 0000000000..df703e24eb
Binary files /dev/null and b/Binary/win32/cg.dll differ
diff --git a/Binary/win32/cgGL.dll b/Binary/win32/cgGL.dll
new file mode 100644
index 0000000000..89a9efe249
Binary files /dev/null and b/Binary/win32/cgGL.dll differ
diff --git a/Binary/x64/Data/font_ansi.bin b/Binary/x64/Data/font_ansi.bin
new file mode 100644
index 0000000000..33b20041cc
Binary files /dev/null and b/Binary/x64/Data/font_ansi.bin differ
diff --git a/Binary/x64/Data/font_sjis.bin b/Binary/x64/Data/font_sjis.bin
new file mode 100644
index 0000000000..c8d25fdcd0
Binary files /dev/null and b/Binary/x64/Data/font_sjis.bin differ
diff --git a/Binary/x64/Patches/GMSE01.ini b/Binary/x64/Patches/GMSE01.ini
new file mode 100644
index 0000000000..1cd4bcf77d
--- /dev/null
+++ b/Binary/x64/Patches/GMSE01.ini
@@ -0,0 +1,156 @@
+[OnFrame]
+
+[ActionReplay]
+All Shines
+00E60AE1 18000000
+045708E8 FFFFFFFF
+045708EC FFFFFFFF
+045708F0 FFFFFFFF
+
+Open all levels and nozzles
+00E60AE0 18000000
+04570958 FFFFFFFF
+0457095C FFFFFFFF
+
+8 red coins(press L & B)
+00E61642 18000000
+0A3FBBF4 00000240
+025709DE 00000008
+
+Infinite hover time
+00E61520 18000000
+042640BC 60000000
+
+Infinite water
+00E6151F 18000000
+04263F58 38002710
+042635B0 60000000
+
+Infinite health
+00E60ADF 18000000
+424057F4 00040009
+
++99 lives
+00E60ADE 18000000
+00570967 00000063
+
++Test Level
+00B86425 08000000
+043E9710 00000C01
+
++Low Gravity
+00B809F5 08000000
+4240E12C 05003E00
+
+Jesus Mode A.K.A. Walk on Water D-Pad Up/Down = On/Off
+00B813BC 08000000
+04002F00 3C608041
+04002F04 8063E12C
+04002F08 80C3FFCC
+04002F0C 2C060000
+04002F10 4D820020
+04002F14 C2660008
+04002F18 EE852824
+04002F1C EE93A02A
+04002F20 FC019840
+04002F24 4C800020
+04002F28 FC20A090
+04002F2C 38C00008
+04002F30 90C30248
+04002F34 4E800020
+0A404454 00000008
+04189854 4BE796AC
+0A404454 00000004
+04189854 4E800020
+
++Do Not Have To Move Before Triple Jump
+00B819B3 08000000
+4240E10C 06B00000
+
+Spin Jump Gravity - Really Slow Fall
+00B86E48 08000000
+4240E10C 058E3D00
+
+Spin Jump Gravity - Almost No Fall
+00B8369D 08000000
+4240E10C 058E0000
+
+Spin Jump Gravity - Fall Really Fast
+00B86350 08000000
+4240E10C 058E4200
+
+Spin Jump Gravity - Normal Speed
+00B80454 08000000
+4240E10C 058E3EB3
+
++Insane heat waves Crazy colors everywhere!
+00B80485 08000000
+043AA070 41200000
+
+Double vision heat wave (narrow)
+00B856EB 08000000
+043AA070 3F600000
+
+Double vision heat wave (wide)
+00B85C4A 08000000
+043AA070 3F400000
+
+Use only one of following two. Vanish point visual distortion
+00B842EC 08000000
+043AB304 3E000000
+
+Hard to select file, activators will work if you add them.. Camera is far out
+00B82579 08000000
+043AB304 3F000000
+
+X textures
+00B80A69 08000000
+043DB210 41200000
+
+
+Y textures
+00B80605 08000000
+043DB224 41200000
+
+
+Z textures
+00B86358 08000000
+043DB238 41200000
+
+
+Strangely distorted people
+00B82C96 08000000
+0440CC24 3F900000
+
+Mute game
+00B87829 08000000
+04417248 00000000
+
+Magnify camera
+00B87EB7 08000000
+04417690 3F900000
+
+Warped camera view
+00B851AB 08000000
+044176A8 3E000000
+
+Poorly Shaded Mario
+00B87DA5 08000000
+044176FC 00000000
+
+
+Nozzle Modifier Press the buttons below to switch to another nozzle. You must have your nozzle set to squirt for it to work. You will never use another nozzle box again!! Just kidding.B+D-Pad Up:Rocket NozzleB+D-Pad Left:Turbo NozzleB+D-Pad Right:Hover NozzleB+D-Pad Down:Jump Nozzle
+
+00B83682 08000000
+0A404454 00000208
+04269F50 3BE00001
+0A404454 00000204
+04269F50 3BE00002
+0A404454 00000201
+04269F50 3BE00005
+0A404454 00000202
+04269F50 3BE00004
+
+Always Green Yoshi
+00B80C27 08000000
+405F3A90 04AE4C00
diff --git a/Binary/x64/Patches/GZLE01.ini b/Binary/x64/Patches/GZLE01.ini
new file mode 100644
index 0000000000..045345c891
--- /dev/null
+++ b/Binary/x64/Patches/GZLE01.ini
@@ -0,0 +1,420 @@
+[OnFrame]
+0x802904b4=dword:0x4E800020 #Fix item hang
+
+# WARNING - cheats may screw up your save games
+# 0x803C4C09=byte:0x50 #Max health
+# 0x803C4C0B=byte:0x50 #Current health
+
+# Hidden dungeon
+# 0x803C9D44=dword:0x000000FF
+# 0x803C9D48=dword:0x485F7465
+# 0x803C9D4C=dword:0x73740000
+
+# Snow test room
+# 0x803C9D44=dword:0x000000FF
+# 0x803C9D48=dword:0x49546573
+# 0x803C9D4C=dword:0x74363200
+
+#only supports decrypted AR codes
+
+[ActionReplay]
+# Use GCNCrypt to decrypt large chunks of codes found online, and paste here.
+# Add a + to the name to activate.
+# Codes by GCNHacker87 (yes we forgot to ask permission)
++Master Code (useless)
+01E0197D 88000000
+C4323EA8 0000FF00
+
+Shadow Link
+01E05E82 08000000
+041926B8 60000000
+423BCDA0 00BCFFFF
+423BCDA0 00BDFF87
+403BCDA0 00017E3F
+
+Stuff at the top right of the screen is not visible
+01E00EFA 08000000
+903ED848 00000000
+023F633C 00028000
+003F710A 00000080
+003F713A 00000080
+003F715E 00000080
+403BB494 00106A80
+403BB498 002F5080
+00000000 40000000
+
+Super Hookshot
+01E03C97 08000000
+043F9DFC 48420B00
+040F1E68 28030001
+043F9E00 43008700
+0A3ED84A 00000140
+040F2898 3C000000
+123ED84A 00000140
+040F2898 8001004C
+
++Teleport to Fire Mountain up R Y
+01E05660 08000000
+4A3ED84A 00000828
+043E440C 482F85A1
+043E4414 C7EA36FD
+
+Hold A to swim fast
+01E0712B 08000000
+0A3ED84A 00000100
+0435D548 44610000
+123ED84A 00000100
+0435D548 41900000
+
++Run/Swim/Crawl fast Hold A
+01E06820 08000000
+4A3ED84A 00000100
+0435CEEC 42480000
+0435D548 44610000
+523ED84A 00000100
+0435CEEC 41880000
+0435D548 41900000
+0A3ED84A 00000120
+0435DB94 42800000
+123ED84A 00000120
+0435DB94 40400000
+
+(m)
+01E0197D 88000000
+C4323EA8 0000FF00
+
+Max Health
+01E0197E 08000000
+003C4C09 00000050
+
+Infinite Health
+01E0197F 08000000
+003C4C0B 00000050
+
+Full Nintendo Gallery
+01E01A3B 08000000
+003C5260 00000001
+023C52AC 0003FFFF
+023C52B8 0005FFFF
+003C52C8 000000FF
+023C52DC 0000FFFF
+
+Small energy sword
+01E058C4 08000000
+0435DF6C 004A004A
+
+Full energy Sword
+01E03B23 08000000
+0435DF6C 004C004C
+
+HookShot Head/beam sword
+01E064B0 08000000
+0435DF6C 004C001E
+
+Normal/no glow
+01E042B7 08000000
+0435DF6C 00460046
+
+Jesus Mode aka WalkOnWater
+01E071C7 08000000
+04004010 2C070003
+04004014 C01EFFA0
+04004018 4182000C
+0400401C C01F008C
+04004020 4809EF60
+04004024 FC16A840
+04004028 C2DEFFA4
+0400402C 4182FFF0
+04004030 4809EF54
+04004048 281E5787
+0400404C 4081001C
+04004050 FC010040
+04004054 4080000C
+04004058 D2BEFFA0
+0400405C 4800000C
+04004060 C2DEFF9C
+04004064 D03EFFA0
+04004068 EC210028
+0400406C 48138FB8
+043C5E44 04071987
+040A2F7C 4BF61094
+0413D020 4BEC7028
+
+Use anything indoors
+01E01C68 08000000
+0020485F 0000007E
+
+Sink or Swim A+D-pad down sink B+D-pad down swim
+01E00949 08000000
+0A3ED84A 00000104
+0435D560 50000000
+0A3ED84A 00000204
+0435D560 42B40000
+
+Jump to a ledge at any height
+01E05CFA 08000000
+0435D734 469C4000
+
+Very Fast on Ladders (May have to barly tap forward on joystick inorder to get on vein walls)
+01E01534 08000000
+00000000 8435DB18
+41200000 00040002
+0435DB38 7F7FFFFF
+
+Extra deku leaf controls (Y makes you rise, Z keeps you at your current height, X wind pulls you instead of push, to stop it from rising you must close and reopen the leaf quickly)
+01E04637 08000000
+0A3ED84A 00000800
+0435DC90 40700000
+0A3ED84A 00000010
+0435DC90 00000000
+0A3ED84A 00000400
+0435DCA4 C1200000
+4A3ED84A 00000000
+0435DC90 C0000000
+0435DCA4 41166666
+
+Roll further
+01E05AB9 08000000
+0435D3D0 40000000
+
+Instead of rolling, you glide
+01E05AAE 08000000
+0435D3CC 45500000
+
+#DON'T USE ANY OF THE FOLLOWING CODES UNTIL AFTER MEETING THE DRAGON BOAT
+Max Magic
+01E01983 08000000
+003C4C1B 00000020
+
+Infinite Magic
+01E01984 08000000
+003C4C1C 00000020
+
+Can Carry 1000 Rupees
+01E01985 08000000
+003C4C1A 00000001
+
+Can Carry 5000 Rupees
+01E01986 08000000
+003C4C1A 00000002
+
+Always Have 1000 Rupees
+01E01987 08000000
+023C4C0C 000003E8
+
+Always Have 5000 Rupees
+01E01988 08000000
+023C4C0C 00001388
+
+Link Can Swim Forever
+01E01989 08000000
+023CA76E 00000384
+
+Have All Songs
+01E0198A 08000000
+003C4CC5 0000003F
+
+Have Hero's Sword
+01E0198B 08000000
+003C4C16 00000038
+003C4CBC 00000001
+
+Have Mirror Shield
+01E0198C 08000000
+003C4C17 0000003C
+003C4CBD 00000003
+
+Have Telescope
+01E0198D 08000000
+003C4C44 00000020
+
+Have Sail
+01E0198E 08000000
+003C4C45 00000078
+
+Have Wind Waker
+01E0198F 08000000
+003C4C46 00000022
+
+Have Grappling Hook
+01E01990 08000000
+003C4C47 00000025
+
+Have Boomerang
+01E01991 08000000
+003C4C49 0000002D
+
+Have Deku Leaf
+01E01992 08000000
+003C4C4A 00000034
+
+Have Tingle Tuner
+01E01993 08000000
+003C4C4B 00000021
+
+Have DX Camera
+01E01994 08000000
+003C4C4C 00000026
+
+Have Iron Boots
+01E01995 08000000
+003C4C4D 00000029
+
+Have Magic Shielding
+01E01996 08000000
+003C4C4E 0000002A
+
+Have Bow And All Arrows
+01E01997 08000000
+003C4C50 00000036
+
+Have Bombs
+01E01998 08000000
+003C4C51 00000031
+
+Have Hookshot
+01E01999 08000000
+003C4C57 0000002F
+
+Have Megaton Hammer
+01E0199A 08000000
+003C4C58 00000033
+
+Have Bottle 1
+01E0199B 08000000
+003C4C52 00000050
+
+Have Bottle 2
+01E0199C 08000000
+003C4C53 00000050
+
+Have Bottle 2 With Fairy
+01E01ACC 08000000
+003C4C53 00000057
+
+Have Bottle 3
+01E0199D 08000000
+003C4C54 00000050
+
+Have Bottle 3 With Blue Potion
+01E01ACD 08000000
+003C4C54 00000053
+
+Have Bottle 4
+01E0199E 08000000
+003C4C55 00000050
+
+Have Spoils Bag
+01E0199F 08000000
+003C4C48 00000024
+
+Have Bait Bag
+01E019A0 08000000
+003C4C4F 0000002C
+
+Have Delivery Bag
+01E019A1 08000000
+003C4C56 00000030
+
+Infinite Berry Feed
+01E019A2 08000000
+003C4C86 00000082
+003C4CAC 00000009
+
+Infinite Pear Feed
+01E019A3 08000000
+003C4C87 00000083
+003C4CAD 00000009
+
+Max Red Chu Jelly
+01E019A4 08000000
+003C4C7E 00000049
+003C4CA4 00000063
+
+Max Green Chu Jelly
+01E019A5 08000000
+003C4C83 0000004A
+003C4CA5 00000063
+
+Max Blue Chu Jelly
+01E019A6 08000000
+003C4C85 0000004B
+003C4CA6 00000063
+
+Max Joy Pendants
+01E019A7 08000000
+003C4C7F 0000001F
+003C4CA7 00000063
+
+Max Skull Necklaces
+01E019A8 08000000
+003C4C80 00000045
+003C4CA8 00000063
+
+Max Knight's Crest
+01E019A9 08000000
+003C4C81 00000048
+003C4CA9 00000063
+
+Max Boko Baba Seeds
+01E019AA 08000000
+003C4C82 00000046
+003C4CAA 00000063
+
+Max Golden Feathers
+01E019AB 08000000
+003C4C84 00000047
+003C4CAB 00000063
+
+Can Carry 99 Arrows
+01E019AC 08000000
+003C4C77 00000063
+
+Can Carry 99 Bombs
+01E019AD 08000000
+003C4C78 00000063
+
+Infinite Arrows
+01E019AE 08000000
+003C4C71 00000063
+
+Infinite Bombs
+01E019AF 08000000
+003C4C72 00000063
+
+Have Fully Detailed Map
+01E019B0 08000000
+023C4D0C 00170303
+003C4D3C 00000003
+
+Have All Quest Maps
+01E019B1 08000000
+023C4CDC 0003FFFF
+
+All Triforce Maps Translated
+01E019B2 08000000
+003C4D4D 000000FF
+
+Fully Charged Master Sword DON'T USE THIS CODE UNTIL YOU HAVE THE MASTER SWORD
+01E01A3E 08000000
+003C4C16 0000003E
+003C4CBC 0000000F
+
+Have All Element Stones DON'T USE THIS CODE UNTIL DRAGON ROOST ISLAND
+01E019B5 08000000
+003C4CC7 00000007
+003C524A 00000040
+
+Have Complete Triforce USE THIS CODE AFTER BEATING THE TOWER OF THE GODS
+01E019B8 08000000
+003C4CC6 000000FF
+
++Press R to Jump
+01E019BB 08000000
+0A3ED84A 00000020
+863E4410 00000001
+
+Press R to Mega Jump
+01E019BC 08000000
+0A3ED84A 00000020
+863E4410 00000003
\ No newline at end of file
diff --git a/Binary/x64/WII/setting-eur.txt b/Binary/x64/WII/setting-eur.txt
new file mode 100644
index 0000000000..693d7411eb
Binary files /dev/null and b/Binary/x64/WII/setting-eur.txt differ
diff --git a/Binary/x64/WII/setting-jpn.txt b/Binary/x64/WII/setting-jpn.txt
new file mode 100644
index 0000000000..db15646b46
Binary files /dev/null and b/Binary/x64/WII/setting-jpn.txt differ
diff --git a/Binary/x64/WII/setting-usa.txt b/Binary/x64/WII/setting-usa.txt
new file mode 100644
index 0000000000..38ca5d91db
Binary files /dev/null and b/Binary/x64/WII/setting-usa.txt differ
diff --git a/Binary/x64/cg.dll b/Binary/x64/cg.dll
new file mode 100644
index 0000000000..b7093a468a
Binary files /dev/null and b/Binary/x64/cg.dll differ
diff --git a/Binary/x64/cgGL.dll b/Binary/x64/cgGL.dll
new file mode 100644
index 0000000000..8889677d9c
Binary files /dev/null and b/Binary/x64/cgGL.dll differ
diff --git a/Externals/Bochs_disasm/Bochs_disasm.vcproj b/Externals/Bochs_disasm/Bochs_disasm.vcproj
new file mode 100644
index 0000000000..e37e9e6aaf
--- /dev/null
+++ b/Externals/Bochs_disasm/Bochs_disasm.vcproj
@@ -0,0 +1,509 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Externals/Bochs_disasm/PowerPCDisasm.cpp b/Externals/Bochs_disasm/PowerPCDisasm.cpp
new file mode 100644
index 0000000000..f1b215774c
--- /dev/null
+++ b/Externals/Bochs_disasm/PowerPCDisasm.cpp
@@ -0,0 +1,2247 @@
+/* $VER: ppc_disasm.c V1.1 (19.02.2000)
+*
+* Disassembler module for the PowerPC microprocessor family
+* Copyright (c) 1998-2000 Frank Wille
+*
+* ppc_disasm.c is freeware and may be freely redistributed as long as
+* no modifications are made and nothing is charged for it.
+* Non-commercial usage is allowed without any restrictions.
+* EVERY PRODUCT OR PROGRAM DERIVED DIRECTLY FROM MY SOURCE MAY NOT BE
+* SOLD COMMERCIALLY WITHOUT PERMISSION FROM THE AUTHOR.
+*
+*
+* v1.2 (31.07.2003) org
+* modified for IBM PowerPC Gekko.
+* v1.1 (19.02.2000) phx
+* fabs wasn't recognized.
+* v1.0 (30.01.2000) phx
+* stfsx, stfdx, lfsx, lfdx, stfsux, stfdux, lfsux, lfdux, etc.
+* printed "rd,ra,rb" as operands instead "fd,ra,rb".
+* v0.4 (01.06.1999) phx
+* 'stwm' shoud have been 'stmw'.
+* v0.3 (17.11.1998) phx
+* The OE-types (e.g. addo, subfeo, etc.) didn't work for all
+* instructions.
+* AA-form branches have an absolute destination.
+* addze and subfze must not have a third operand.
+* sc was not recognized.
+* v0.2 (29.05.1998) phx
+* Sign error. SUBI got negative immediate values.
+* v0.1 (23.05.1998) phx
+* First version, which implements all PowerPC instructions.
+* v0.0 (09.05.1998) phx
+* File created.
+*/
+#include
+#include
+#include
+#include
+
+#include "PowerPCDisasm.h"
+
+namespace PPCDisasm
+{
+
+ /* version/revision */
+#define PPCDISASM_VER 1
+#define PPCDISASM_REV 1
+
+
+ /* typedefs */
+ typedef unsigned long ppc_word;
+
+#undef BIGENDIAN
+#undef LITTTLEENDIAN
+ /* endianess */
+#define LITTLEENDIAN 0
+
+
+ /* general defines */
+#define PPCIDXMASK 0xfc000000
+#define PPCIDX2MASK 0x000007fe
+#define PPCDMASK 0x03e00000
+#define PPCAMASK 0x001f0000
+#define PPCBMASK 0x0000f800
+#define PPCCMASK 0x000007c0
+#define PPCMMASK 0x0000003e
+#define PPCCRDMASK 0x03800000
+#define PPCCRAMASK 0x001c0000
+#define PPCLMASK 0x00600000
+#define PPCOE 0x00000400
+
+#define PPCIDXSH 26
+#define PPCDSH 21
+#define PPCASH 16
+#define PPCBSH 11
+#define PPCCSH 6
+#define PPCMSH 1
+#define PPCCRDSH 23
+#define PPCCRASH 18
+#define PPCLSH 21
+#define PPCIDX2SH 1
+
+#define PPCGETIDX(x) (((x)&PPCIDXMASK)>>PPCIDXSH)
+#define PPCGETD(x) (((x)&PPCDMASK)>>PPCDSH)
+#define PPCGETA(x) (((x)&PPCAMASK)>>PPCASH)
+#define PPCGETB(x) (((x)&PPCBMASK)>>PPCBSH)
+#define PPCGETC(x) (((x)&PPCCMASK)>>PPCCSH)
+#define PPCGETM(x) (((x)&PPCMMASK)>>PPCMSH)
+#define PPCGETCRD(x) (((x)&PPCCRDMASK)>>PPCCRDSH)
+#define PPCGETCRA(x) (((x)&PPCCRAMASK)>>PPCCRASH)
+#define PPCGETL(x) (((x)&PPCLMASK)>>PPCLSH)
+#define PPCGETIDX2(x) (((x)&PPCIDX2MASK)>>PPCIDX2SH)
+
+
+ /* Disassembler structure, the interface to the application */
+
+ struct DisasmPara_PPC {
+ ppc_word *instr; /* pointer to instruction to disassemble */
+ ppc_word *iaddr; /* instr.addr., usually the same as instr */
+ char *opcode; /* buffer for opcode, min. 10 chars. */
+ char *operands; /* operand buffer, min. 24 chars. */
+ /* changed by disassembler: */
+ unsigned char type; /* type of instruction, see below */
+ unsigned char flags; /* additional flags */
+ unsigned short sreg; /* register in load/store instructions */
+ ppc_word displacement; /* branch- or load/store displacement */
+ };
+
+#define PPCINSTR_OTHER 0 /* no additional info for other instr. */
+#define PPCINSTR_BRANCH 1 /* branch dest. = PC+displacement */
+#define PPCINSTR_LDST 2 /* load/store instruction: displ(sreg) */
+#define PPCINSTR_IMM 3 /* 16-bit immediate val. in displacement */
+
+#define PPCF_ILLEGAL (1<<0) /* illegal PowerPC instruction */
+#define PPCF_UNSIGNED (1<<1) /* unsigned immediate instruction */
+#define PPCF_SUPER (1<<2) /* supervisor level instruction */
+#define PPCF_64 (1<<3) /* 64-bit only instruction */
+
+
+ /* ppc_disasm.o prototypes */
+#ifndef PPC_DISASM_C
+ extern ppc_word *PPC_Disassemble(struct DisasmPara_PPC *);
+#endif
+
+
+ static const char *trap_condition[32] = {
+ NULL,"lgt","llt",NULL,"eq","lge","lle",NULL,
+ "gt",NULL,NULL,NULL,"ge",NULL,NULL,NULL,
+ "lt",NULL,NULL,NULL,"le",NULL,NULL,NULL,
+ "ne",NULL,NULL,NULL,NULL,NULL,NULL,NULL
+ };
+
+ static const char *cmpname[4] = {
+ "cmpw","cmpd","cmplw","cmpld"
+ };
+
+ static const char *b_ext[4] = {
+ "","l","a","la"
+ };
+
+ static const char *b_condition[8] = {
+ "ge","le","ne","ns","lt","gt","eq","so"
+ };
+
+ static const char *b_decr[16] = {
+ "nzf","zf",NULL,NULL,"nzt","zt",NULL,NULL,
+ "nz","z",NULL,NULL,"nz","z",NULL,NULL
+ };
+
+ static const char *regsel[2] = {
+ "","r"
+ };
+
+ static const char *oesel[2] = {
+ "","o"
+ };
+
+ static const char *rcsel[2] = {
+ "","."
+ };
+
+ static const char *ldstnames[] = {
+ "lwz","lwzu","lbz","lbzu","stw","stwu","stb","stbu","lhz","lhzu",
+ "lha","lhau","sth","sthu","lmw","stmw","lfs","lfsu","lfd","lfdu",
+ "stfs","stfsu","stfd","stfdu"
+ };
+
+ static const char *regnames[] = {
+ "r0", "sp", "rtoc", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
+ };
+
+ static const char *spr_name(int i)
+ {
+ static char def[8];
+
+ switch(i)
+ {
+ case 1: return "XER";
+ case 8: return "LR";
+ case 9: return "CTR";
+ case 18: return "DSIR";
+ case 19: return "DAR";
+ case 22: return "DEC";
+ case 25: return "SDR1";
+ case 26: return "SRR0";
+ case 27: return "SRR1";
+ case 272: return "SPRG0";
+ case 273: return "SPRG1";
+ case 274: return "SPRG2";
+ case 275: return "SPRG3";
+ case 282: return "EAR";
+ case 287: return "PVR";
+ case 528: return "IBAT0U";
+ case 529: return "IBAT0L";
+ case 530: return "IBAT1U";
+ case 531: return "IBAT1L";
+ case 532: return "IBAT2U";
+ case 533: return "IBAT2L";
+ case 534: return "IBAT3U";
+ case 535: return "IBAT3L";
+ case 536: return "DBAT0U";
+ case 537: return "DBAT0L";
+ case 538: return "DBAT1U";
+ case 539: return "DBAT1L";
+ case 540: return "DBAT2U";
+ case 541: return "DBAT2L";
+ case 542: return "DBAT3U";
+ case 543: return "DBAT3L";
+ case 912: return "GQR0";
+ case 913: return "GQR1";
+ case 914: return "GQR2";
+ case 915: return "GQR3";
+ case 916: return "GQR4";
+ case 917: return "GQR5";
+ case 918: return "GQR6";
+ case 919: return "GQR7";
+ case 920: return "HID2";
+ case 921: return "WPAR";
+ case 922: return "DMA_U";
+ case 923: return "DMA_L";
+ case 936: return "UMMCR0";
+ case 937: return "UPMC1";
+ case 938: return "UPMC2";
+ case 939: return "USIA";
+ case 940: return "UMMCR1";
+ case 941: return "UPMC3";
+ case 942: return "UPMC4";
+ case 943: return "USDA";
+ case 952: return "MMCR0";
+ case 953: return "PMC1";
+ case 954: return "PMC2";
+ case 955: return "SIA";
+ case 956: return "MMCR1";
+ case 957: return "PMC3";
+ case 958: return "PMC4";
+ case 959: return "SDA";
+ case 1008: return "HID0";
+ case 1009: return "HID1";
+ case 1010: return "IABR";
+ case 1013: return "DABR";
+ case 1017: return "L2CR";
+ case 1019: return "ICTC";
+ case 1020: return "THRM1";
+ case 1021: return "THRM2";
+ case 1022: return "THRM3";
+ }
+
+ sprintf(def, "%i", i);
+ return def;
+ }
+
+ static void ierror(const char *errtxt,...)
+ /* display internal error and quit program */
+ {
+ va_list vl;
+
+ fprintf(stderr,"\nINTERNAL ERROR (PPC disassembler): ");
+ va_start(vl,errtxt);
+ vfprintf(stderr,errtxt,vl);
+ va_end(vl);
+ fprintf(stderr,".\nAborting.\n");
+ exit(1);
+ }
+
+
+ static ppc_word swapda(ppc_word w)
+ {
+ return ((w&0xfc00ffff)|((w&PPCAMASK)<<5)|((w&PPCDMASK)>>5));
+ }
+
+
+ static ppc_word swapab(ppc_word w)
+ {
+ return ((w&0xffe007ff)|((w&PPCBMASK)<<5)|((w&PPCAMASK)>>5));
+ }
+
+
+ static void ill(struct DisasmPara_PPC *dp,ppc_word in)
+ {
+ // strcpy(dp->opcode,".word");
+ // sprintf(dp->operands,"0x%08lx",(unsigned long)in);
+
+ strcpy(dp->opcode,"");
+ sprintf(dp->operands,"");
+
+ dp->flags |= PPCF_ILLEGAL;
+ }
+
+
+ static void imm(struct DisasmPara_PPC *dp,ppc_word in,int uimm,int type,int hex)
+ /* Generate immediate instruction operand. */
+ /* type 0: D-mode, D,A,imm */
+ /* type 1: S-mode, A,S,imm */
+ /* type 2: S/D register is ignored (trap,cmpi) */
+ /* type 3: A register is ignored (li) */
+ {
+ int i = (int)(in & 0xffff);
+
+ dp->type = PPCINSTR_IMM;
+ if (!uimm) {
+ if (i > 0x7fff)
+ i -= 0x10000;
+ }
+ else
+ dp->flags |= PPCF_UNSIGNED;
+ dp->displacement = i;
+
+ switch (type) {
+ case 0:
+ sprintf(dp->operands,"%s, %s, %d",regnames[(int)PPCGETD(in)],regnames[(int)PPCGETA(in)],i);
+ break;
+ case 1:
+ if(hex)
+ sprintf(dp->operands,"%s, %s, 0x%.4X",regnames[(int)PPCGETA(in)],regnames[(int)PPCGETD(in)],i);
+ else
+ sprintf(dp->operands,"%s, %s, %d",regnames[(int)PPCGETA(in)],regnames[(int)PPCGETD(in)],i);
+ break;
+ case 2:
+ sprintf(dp->operands,"%s, %d",regnames[(int)PPCGETA(in)],i);
+ break;
+ case 3:
+ if(hex)
+ sprintf(dp->operands,"%s, 0x%.4X",regnames[(int)PPCGETD(in)],i);
+ else
+ sprintf(dp->operands,"%s, %d",regnames[(int)PPCGETD(in)],i);
+ break;
+ default:
+ ierror("imm(): Wrong type");
+ break;
+ }
+ }
+
+
+ static void ra_rb(char *s,ppc_word in)
+ {
+ sprintf(s,"%s, %s",regnames[(int)PPCGETA(in)],regnames[(int)PPCGETB(in)]);
+ }
+
+
+ static char *rd_ra_rb(char *s,ppc_word in,int mask)
+ {
+ static const char *fmt = "%s, ";
+
+ if (mask) {
+ if (mask & 4)
+ s += sprintf(s,fmt,regnames[(int)PPCGETD(in)]);
+ if (mask & 2)
+ s += sprintf(s,fmt,regnames[(int)PPCGETA(in)]);
+ if (mask & 1)
+ s += sprintf(s,fmt,regnames[(int)PPCGETB(in)]);
+ *--s = '\0';
+ *--s = '\0';
+ }
+ else
+ *s = '\0';
+ return (s);
+ }
+
+
+ static char *fd_ra_rb(char *s,ppc_word in,int mask)
+ {
+ static const char *ffmt = "f%d,";
+ static const char *rfmt = "%s,";
+
+ if (mask) {
+ if (mask & 4)
+ s += sprintf(s,ffmt,(int)PPCGETD(in));
+ if (mask & 2)
+ s += sprintf(s,rfmt,regnames[(int)PPCGETA(in)]);
+ if (mask & 1)
+ s += sprintf(s,rfmt,regnames[(int)PPCGETB(in)]);
+ *--s = '\0';
+ }
+ else
+ *s = '\0';
+ return (s);
+ }
+
+
+ static void trapi(struct DisasmPara_PPC *dp,ppc_word in,unsigned char dmode)
+ {
+ const char *cnd;
+
+ if (cnd = trap_condition[PPCGETD(in)]) {
+ dp->flags |= dmode;
+ sprintf(dp->opcode,"t%c%s",dmode?'d':'w',cnd);
+ imm(dp,in,0,2,0);
+ }
+ else
+ ill(dp,in);
+ }
+
+
+ static void cmpi(struct DisasmPara_PPC *dp,ppc_word in,int uimm)
+ {
+ char *oper = dp->operands;
+ int i = (int)PPCGETL(in);
+
+ if (i < 2) {
+ if (i)
+ dp->flags |= PPCF_64;
+ sprintf(dp->opcode,"%si",cmpname[uimm*2+i]);
+ if (i = (int)PPCGETCRD(in)) {
+ sprintf(oper,"cr%c,",'0'+i);
+ dp->operands += 4;
+ }
+ imm(dp,in,uimm,2,0);
+ dp->operands = oper;
+ }
+ else
+ ill(dp,in);
+ }
+
+
+ static void addi(struct DisasmPara_PPC *dp,ppc_word in,const char *ext)
+ {
+ if ((in&0x08000000) && !PPCGETA(in)) {
+ sprintf(dp->opcode,"l%s",ext); /* li, lis */
+ if(!strcmp(ext, "i"))
+ imm(dp,in,0,3,0);
+ else
+ imm(dp,in,1,3,1);
+ }
+ else {
+ sprintf(dp->opcode,"%s%s",(in&0x8000)?"sub":"add",ext);
+ if (in & 0x8000)
+ in = (in^0xffff) + 1;
+ imm(dp,in,1,0,0);
+ }
+ }
+
+
+ static int branch(struct DisasmPara_PPC *dp,ppc_word in, const char *bname,int aform,int bdisp)
+ /* build a branch instr. and return number of chars written to operand */
+ {
+ int bo = (int)PPCGETD(in);
+ int bi = (int)PPCGETA(in);
+ char y = (char)(bo & 1);
+ int opercnt = 0;
+ const char *ext = b_ext[aform*2+(int)(in&1)];
+
+ if (bdisp < 0)
+ y ^= 1;
+ y = y ? '+':'-';
+
+ if (bo & 4) {
+ /* standard case - no decrement */
+ if (bo & 16) {
+ /* branch always */
+ if (PPCGETIDX(in) != 16) {
+ sprintf(dp->opcode,"b%s%s",bname,ext);
+ }
+ else {
+ sprintf(dp->opcode,"bc%s",ext);
+ opercnt = sprintf(dp->operands,"%d, %d",bo,bi);
+ }
+ }
+ else {
+ /* branch conditional */
+ sprintf(dp->opcode,"b%s%s%s%c",b_condition[((bo&8)>>1)+(bi&3)],
+ bname,ext,y);
+ if (bi >= 4)
+ opercnt = sprintf(dp->operands,"cr%d",bi>>2);
+ }
+ }
+
+ else {
+ /* CTR is decremented and checked */
+ sprintf(dp->opcode,"bd%s%s%s%c",b_decr[bo>>1],bname,ext,y);
+ if (!(bo & 16))
+ opercnt = sprintf(dp->operands,"%d",bi);
+ }
+
+ return (opercnt);
+ }
+
+
+ static void bc(struct DisasmPara_PPC *dp,ppc_word in)
+ {
+ unsigned long d = (int)(in & 0xfffc);
+ int offs;
+ char *oper = dp->operands;
+
+ if(d & 0x8000) d |= 0xffff0000;
+
+ if (offs = branch(dp,in,"",(in&2)?1:0,d)) {
+ oper += offs;
+ *oper++ = ',';
+ }
+ if (in & 2) /* AA ? */
+ sprintf(dp->operands,"0x%.8X",(unsigned long)d);
+ else
+ sprintf(oper,"0x%.8X",(unsigned long)(*dp->iaddr) + d);
+ dp->type = PPCINSTR_BRANCH;
+ dp->displacement = (ppc_word)d;
+ }
+
+
+ static void bli(struct DisasmPara_PPC *dp,ppc_word in)
+ {
+ unsigned long d = (unsigned long)(in & 0x3fffffc);
+
+ if(d & 0x02000000) d |= 0xfc000000;
+
+ sprintf(dp->opcode,"b%s",b_ext[in&3]);
+ if (in & 2) /* AA ? */
+ sprintf(dp->operands,"0x%.8X",(unsigned long)d);
+ else
+ sprintf(dp->operands,"0x%.8X",(unsigned long)(*dp->iaddr) + d);
+ dp->type = PPCINSTR_BRANCH;
+ dp->displacement = (ppc_word)d;
+ }
+
+
+ static void mcrf(struct DisasmPara_PPC *dp,ppc_word in,char c)
+ {
+ if (!(in & 0x0063f801)) {
+ sprintf(dp->opcode,"mcrf%c",c);
+ sprintf(dp->operands,"cr%d, cr%d",(int)PPCGETCRD(in),(int)PPCGETCRA(in));
+ }
+ else
+ ill(dp,in);
+ }
+
+
+ static void crop(struct DisasmPara_PPC *dp,ppc_word in,const char *n1,const char *n2)
+ {
+ int crd = (int)PPCGETD(in);
+ int cra = (int)PPCGETA(in);
+ int crb = (int)PPCGETB(in);
+
+ if (!(in & 1)) {
+ sprintf(dp->opcode,"cr%s",(cra==crb && n2)?n2:n1);
+ if (cra == crb && n2)
+ sprintf(dp->operands,"%d, %d",crd,cra);
+ else
+ sprintf(dp->operands,"%d, %d, %d",crd,cra,crb);
+ }
+ else
+ ill(dp,in);
+ }
+
+
+ static void nooper(struct DisasmPara_PPC *dp,ppc_word in,const char *name,
+ unsigned char dmode)
+ {
+ if (in & (PPCDMASK|PPCAMASK|PPCBMASK|1)) {
+ ill(dp,in);
+ }
+ else {
+ dp->flags |= dmode;
+ strcpy(dp->opcode,name);
+ }
+ }
+
+
+ static unsigned int Helper_Mask(int mb, int me)
+ {
+ //first make 001111111111111 part
+ unsigned int begin = 0xFFFFFFFF >> mb;
+ //then make 000000000001111 part, which is used to flip the bits of the first one
+ unsigned int end = me < 31 ? (0xFFFFFFFF >> (me + 1)) : 0;
+ //do the bitflip
+ unsigned int mask = begin ^ end;
+ //and invert if backwards
+ if (me < mb)
+ return ~mask;
+ else
+ return mask;
+ }
+
+
+ static void rlw(struct DisasmPara_PPC *dp,ppc_word in,const char *name,int i)
+ {
+ int s = (int)PPCGETD(in);
+ int a = (int)PPCGETA(in);
+ int bsh = (int)PPCGETB(in);
+ int mb = (int)PPCGETC(in);
+ int me = (int)PPCGETM(in);
+
+
+
+ sprintf(dp->opcode,"rlw%s%c",name,in&1?'.':'\0');
+ sprintf(dp->operands,"%s, %s, %s%d, %d, %d (%08x)",regnames[a],regnames[s],regsel[i],bsh,mb,me,Helper_Mask(mb, me));
+ }
+
+
+ static void ori(struct DisasmPara_PPC *dp,ppc_word in,const char *name)
+ {
+ strcpy(dp->opcode,name);
+ imm(dp,in,1,1,1);
+ }
+
+
+ static void rld(struct DisasmPara_PPC *dp,ppc_word in,const char *name,int i)
+ {
+ int s = (int)PPCGETD(in);
+ int a = (int)PPCGETA(in);
+ int bsh = i ? (int)PPCGETB(in) : (int)(((in&2)<<4)+PPCGETB(in));
+ int m = (int)(in&0x7e0)>>5;
+
+ dp->flags |= PPCF_64;
+ sprintf(dp->opcode,"rld%s%c",name,in&1?'.':'\0');
+ sprintf(dp->operands,"%s, %s, %s%d, %d",regnames[a],regnames[s],regsel[i],bsh,m);
+ }
+
+
+ static void cmp(struct DisasmPara_PPC *dp,ppc_word in)
+ {
+ char *oper = dp->operands;
+ int i = (int)PPCGETL(in);
+
+ if (i < 2) {
+ if (i)
+ dp->flags |= PPCF_64;
+ strcpy(dp->opcode,cmpname[((in&PPCIDX2MASK)?2:0)+i]);
+ if (i = (int)PPCGETCRD(in))
+ oper += sprintf(oper,"cr%c,",'0'+i);
+ ra_rb(oper,in);
+ }
+ else
+ ill(dp,in);
+ }
+
+
+ static void trap(struct DisasmPara_PPC *dp,ppc_word in,unsigned char dmode)
+ {
+ const char *cnd;
+ int to = (int)PPCGETD(in);
+
+ if (cnd = trap_condition[to]) {
+ dp->flags |= dmode;
+ sprintf(dp->opcode,"t%c%s",dmode?'d':'w',cnd);
+ ra_rb(dp->operands,in);
+ }
+ else {
+ if (to == 31) {
+ if (dmode) {
+ dp->flags |= dmode;
+ strcpy(dp->opcode,"td");
+ strcpy(dp->operands,"31,0,0");
+ }
+ else
+ strcpy(dp->opcode,"trap");
+ }
+ else
+ ill(dp,in);
+ }
+ }
+
+
+ static void dab(struct DisasmPara_PPC *dp,ppc_word in,const char *name,int mask,
+ int smode,int chkoe,int chkrc,unsigned char dmode)
+ /* standard instruction: xxxx rD,rA,rB */
+ {
+ if (chkrc>=0 && ((in&1)!=(unsigned)chkrc)) {
+ ill(dp,in);
+ }
+ else {
+ dp->flags |= dmode;
+ if (smode)
+ in = swapda(in); /* rA,rS,rB */
+ sprintf(dp->opcode,"%s%s%s",name,
+ oesel[chkoe&&(in&PPCOE)],rcsel[(chkrc<0)&&(in&1)]);
+ rd_ra_rb(dp->operands,in,mask);
+ }
+ }
+
+
+ static void rrn(struct DisasmPara_PPC *dp,ppc_word in,const char *name,
+ int smode,int chkoe,int chkrc,unsigned char dmode)
+ /* Last operand is no register: xxxx rD,rA,NB */
+ {
+ char *s;
+
+ if (chkrc>=0 && ((in&1)!=(unsigned)chkrc)) {
+ ill(dp,in);
+ }
+ else {
+ dp->flags |= dmode;
+ if (smode)
+ in = swapda(in); /* rA,rS,NB */
+ sprintf(dp->opcode,"%s%s%s",name,
+ oesel[chkoe&&(in&PPCOE)],rcsel[(chkrc<0)&&(in&1)]);
+ s = rd_ra_rb(dp->operands,in,6);
+ sprintf(s,",%d",(int)PPCGETB(in));
+ }
+ }
+
+
+ static void mtcr(struct DisasmPara_PPC *dp,ppc_word in)
+ {
+ int s = (int)PPCGETD(in);
+ int crm = (int)(in&0x000ff000)>>12;
+ char *oper = dp->operands;
+
+ if (in & 0x00100801) {
+ ill(dp,in);
+ }
+ else {
+ sprintf(dp->opcode,"mtcr%c",crm==0xff?'\0':'f');
+ if (crm != 0xff)
+ oper += sprintf(oper,"0x%02x,",crm);
+ sprintf(oper,"%s",regnames[s]);
+ }
+ }
+
+
+ static void msr(struct DisasmPara_PPC *dp,ppc_word in,int smode)
+ {
+ int s = (int)PPCGETD(in);
+ int sr = (int)(in&0x000f0000)>>16;
+
+ if (in & 0x0010f801) {
+ ill(dp,in);
+ }
+ else {
+ dp->flags |= PPCF_SUPER;
+ sprintf(dp->opcode,"m%csr",smode?'t':'f');
+ if (smode)
+ sprintf(dp->operands,"%d, %s",sr,regnames[s]);
+ else
+ sprintf(dp->operands,"%s, %d",regnames[s],sr);
+ }
+ }
+
+
+ static void mspr(struct DisasmPara_PPC *dp,ppc_word in,int smode)
+ {
+ int d = (int)PPCGETD(in);
+ int spr = (int)((PPCGETB(in)<<5)+PPCGETA(in));
+ int fmt = 0;
+ const char *x;
+
+ if (in & 1) {
+ ill(dp,in);
+ }
+
+ else {
+ if (spr!=1 && spr!=8 && spr!=9)
+ dp->flags |= PPCF_SUPER;
+ switch (spr) {
+ case 1:
+ x = "xer";
+ break;
+ case 8:
+ x = "lr";
+ break;
+ case 9:
+ x = "ctr";
+ break;
+ default:
+ x = "spr";
+ fmt = 1;
+ break;
+ }
+
+ sprintf(dp->opcode,"m%c%s",smode?'t':'f',x);
+ if (fmt) {
+ if (smode)
+ sprintf(dp->operands,"%s, %s",spr_name(spr),regnames[d]);
+ else
+ sprintf(dp->operands,"%s, %s",regnames[d],spr_name(spr));
+ }
+ else
+ sprintf(dp->operands,"%s",regnames[d]);
+ }
+ }
+
+
+ static void mtb(struct DisasmPara_PPC *dp,ppc_word in)
+ {
+ int d = (int)PPCGETD(in);
+ int tbr = (int)((PPCGETB(in)<<5)+PPCGETA(in));
+ char *s = dp->operands;
+ char x;
+
+ if (in & 1) {
+ ill(dp,in);
+ }
+
+ else {
+ s += sprintf(s,"%s",regnames[d]);
+ switch (tbr) {
+ case 268:
+ x = 'l';
+ break;
+ case 269:
+ x = 'u';
+ break;
+ default:
+ x = '\0';
+ dp->flags |= PPCF_SUPER;
+ sprintf(s,",%d",tbr);
+ break;
+ }
+ sprintf(dp->opcode,"mftb%c",x);
+ }
+ }
+
+
+ static void sradi(struct DisasmPara_PPC *dp,ppc_word in)
+ {
+ int s = (int)PPCGETD(in);
+ int a = (int)PPCGETA(in);
+ int bsh = (int)(((in&2)<<4)+PPCGETB(in));
+
+ dp->flags |= PPCF_64;
+ sprintf(dp->opcode,"sradi%c",in&1?'.':'\0');
+ sprintf(dp->operands,"%s, %s, %d",regnames[a],regnames[s],bsh);
+ }
+
+ static const char *ldst_offs(unsigned long val)
+ {
+ static char buf[8];
+
+ if(val == 0)
+ {
+ return "0";
+ }
+ else
+ {
+ if(val & 0x8000)
+ {
+ sprintf(buf, "-0x%.4X", ((~val) & 0xffff) + 1);
+ }
+ else
+ {
+ sprintf(buf, "0x%.4X", val);
+ }
+
+ return buf;
+ }
+ }
+
+ static void ldst(struct DisasmPara_PPC *dp,ppc_word in,const char *name,
+ char reg,unsigned char dmode)
+ {
+ int s = (int)PPCGETD(in);
+ int a = (int)PPCGETA(in);
+ int d = (ppc_word)(in & 0xffff);
+
+ dp->type = PPCINSTR_LDST;
+ dp->flags |= dmode;
+ dp->sreg = (short)a;
+ // if (d >= 0x8000)
+ // d -= 0x10000;
+ dp->displacement = (ppc_word)d;
+ strcpy(dp->opcode,name);
+ if(reg == 'r')
+ {
+ sprintf(dp->operands,"%s, %s (%s)", regnames[s], ldst_offs(d), regnames[a]);
+ }
+ else
+ {
+ sprintf(dp->operands,"%c%d, %s (%s)",reg,s, ldst_offs(d), regnames[a]);
+ }
+ }
+
+
+ static void fdabc(struct DisasmPara_PPC *dp,ppc_word in, const char *name,
+ int mask,unsigned char dmode)
+ /* standard floating point instruction: xxxx fD,fA,fB,fC */
+ {
+ static const char *fmt = "f%d,";
+ char *s = dp->operands;
+ int err = 0;
+
+ dp->flags |= dmode;
+ sprintf(dp->opcode,"f%s%s",name,rcsel[in&1]);
+ s += sprintf(s,fmt,(int)PPCGETD(in));
+ if (mask & 4)
+ s += sprintf(s,fmt,(int)PPCGETA(in));
+ else
+ err |= (int)PPCGETA(in);
+ if (mask & 2)
+ s += sprintf(s,fmt,(int)PPCGETB(in));
+ else if (PPCGETB(in))
+ err |= (int)PPCGETB(in);
+ if (mask & 1)
+ s += sprintf(s,fmt,(int)PPCGETC(in));
+ else if (!(mask&8))
+ err |= (int)PPCGETC(in);
+ *(s-1) = '\0';
+ if (err)
+ ill(dp,in);
+ }
+
+
+ static void fdab(struct DisasmPara_PPC *dp,ppc_word in,const char *name,int mask)
+ /* indexed float instruction: xxxx fD,rA,rB */
+ {
+ strcpy(dp->opcode,name);
+ fd_ra_rb(dp->operands,in,mask);
+ }
+
+
+ static void fcmp(struct DisasmPara_PPC *dp,ppc_word in,char c)
+ {
+ if (in & 0x00600001) {
+ ill(dp,in);
+ }
+ else {
+ sprintf(dp->opcode,"fcmp%c",c);
+ sprintf(dp->operands,"cr%d,f%d,f%d",(int)PPCGETCRD(in),
+ (int)PPCGETA(in),(int)PPCGETB(in));
+ }
+ }
+
+
+ static void mtfsb(struct DisasmPara_PPC *dp,ppc_word in,int n)
+ {
+ if (in & (PPCAMASK|PPCBMASK)) {
+ ill(dp,in);
+ }
+ else {
+ sprintf(dp->opcode,"mtfsb%d%s",n,rcsel[in&1]);
+ sprintf(dp->operands,"%d",(int)PPCGETD(in));
+ }
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ //PAIRED
+ //////////////////////////////////////////////////////////////////////////////////
+
+ /*
+ sprintf(buf, "psq_lx", FD);
+ sprintf(buf, "psq_stx", FD);
+ sprintf(buf, "psq_lux", FD);
+ sprintf(buf, "psq_stux", FD);
+ */
+#define RA ((inst >> 16) & 0x1f)
+#define RB ((inst >> 11) & 0x1f)
+#define RC ((inst >> 6) & 0x1f)
+#define RD ((inst >> 21) & 0x1f)
+#define RS ((inst >> 21) & 0x1f)
+#define FA ((inst >> 16) & 0x1f)
+#define FB ((inst >> 11) & 0x1f)
+#define FC ((inst >> 6) & 0x1f)
+#define FD ((inst >> 21) & 0x1f)
+#define FS ((inst >> 21) & 0x1f)
+#define IMM (inst & 0xffff)
+#define UIMM (inst & 0xffff)
+#define OFS (inst & 0xffff)
+#define OPCD ((inst >> 26) & 0x3f)
+#define XO_10 ((inst >> 1) & 0x3ff)
+#define XO_9 ((inst >> 1) & 0x1ff)
+#define XO_5 ((inst >> 1) & 0x1f)
+#define Rc (inst & 1)
+#define SH ((inst >> 11) & 0x1f)
+#define MB ((inst >> 6) & 0x1f)
+#define ME ((inst >> 1) & 0x1f)
+#define OE ((inst >> 10) & 1)
+#define TO ((inst >> 21) & 0x1f)
+#define CRFD ((inst >> 23) & 0x7)
+#define CRFS ((inst >> 18) & 0x7)
+#define CRBD ((inst >> 21) & 0x1f)
+#define CRBA ((inst >> 16) & 0x1f)
+#define CRBB ((inst >> 11) & 0x1f)
+#define L ((inst >> 21) & 1)
+#define NB ((inst >> 11) & 0x1f)
+#define AA ((inst >> 1) & 1)
+#define LK (inst & 1)
+#define LI ((inst >> 2) & 0xffffff)
+#define BO ((inst >> 21) & 0x1f)
+#define BI ((inst >> 16) & 0x1f)
+#define BD ((inst >> 2) & 0x3fff)
+
+#define MTFSFI_IMM ((inst >> 12) & 0xf)
+#define FM ((inst >> 17) & 0xff)
+#define SR ((inst >> 16) & 0xf)
+#define SPR ((inst >> 11) & 0x3ff)
+#define TBR ((inst >> 11) & 0x3ff)
+#define CRM ((inst >> 12) & 0xff)
+ inline int SEX12(unsigned int x)
+ {
+ return x & 0x800 ? (x|0xFFFFF000) : x;
+ }
+
+ static void ps(struct DisasmPara_PPC *dp,ppc_word inst)
+ {
+ ppc_word pc = *dp->iaddr;
+ char *op = dp->opcode;
+ char *pr = dp->operands;
+ switch((inst>>1)&0x1F)
+ {
+ case 6:
+ strcpy(op, "ps_lux");
+ sprintf(pr, "p%u, (r%u + r%u)", FD, RA, RB);
+ return;
+
+ case 18:
+ strcpy(op, "ps_div");
+ sprintf(pr, "p%u, p%u/p%u", FD, FA, FB);
+ return;
+ case 20:
+ strcpy(op, "ps_sub");
+ sprintf(pr, "p%u, p%u-p%u", FD, FA, FB);
+ return;
+ case 21:
+ strcpy(op, "ps_add");
+ sprintf(pr, "p%u, p%u+p%u", FD, FA, FB);
+ return;
+ case 23:
+ strcpy(op, "ps_sel");
+ sprintf(pr, "p%u>=0?p%u:p%u", FD, FA, FC, FB);
+ return;
+ case 24:
+ strcpy(op, "ps_res");
+ sprintf(pr, "p%u, (1/p%u)", FD, FB);
+ return;
+
+ case 25:
+ strcpy(op, "ps_mul");
+ sprintf(pr, "p%u, p%u*p%u", FD, FA, FC);
+ return;
+
+ case 26: //rsqrte
+ strcpy(op, "ps_rsqrte");
+ sprintf(pr, "p%u, p%u", FD, FB);
+ return;
+ case 28: //msub
+ strcpy(op, "ps_msub");
+ sprintf(pr, "p%u, p%u*p%u-p%u", FD, FA, FC, FB);
+ return;
+ case 29: //madd
+ strcpy(op, "ps_madd");
+ sprintf(pr, "p%u, p%u*p%u+p%u", FD, FA, FC, FB);
+ return;
+ case 30: //nmsub
+ strcpy(op, "ps_nmsub");
+ sprintf(pr, "p%u, -(p%u*p%u-p%u)", FD, FA, FC, FB);
+ return;
+ case 31: //nmadd
+ strcpy(op, "ps_nmadd");
+ sprintf(pr, "p%u, -(p%u*p%u+p%u)", FD, FA, FC, FB);
+ return;
+ case 10:
+ strcpy(op, "ps_sum0");
+ sprintf(pr, "p%u, 0=p%u+p%u, 1=p%u", FD, FA, FB, FC);
+ return;
+ case 11:
+ strcpy(op, "ps_sum1");
+ sprintf(pr, "p%u, 0=p%u, 1=p%u+p%u", FD, FC, FA, FB);
+ return;
+ case 12:
+ strcpy(op, "ps_muls0");
+ sprintf(pr, "p%u, p%u*p%u[0]", FD, FA, FC);
+ return;
+ case 13:
+ strcpy(op, "ps_muls1");
+ sprintf(pr, "p%u, p%u*p%u[1]", FD, FA, FC);
+ return;
+ case 14:
+ strcpy(op, "ps_madds0");
+ sprintf(pr, "p%u, p%u*p%u[0]+p%u", FD, FA, FC, FB);
+ return;
+ case 15:
+ strcpy(op, "ps_madds1");
+ sprintf(pr, "p%u, p%u*p%u[1]+p%u", FD, FA, FC, FB);
+ return;
+ }
+
+ switch((inst>>1)&0x3FF)
+ {
+ //10-bit suckers (?)
+ case 40: //nmadd
+ strcpy(op, "ps_neg");
+ sprintf(pr, "p%u, -p%u", FD, FB);
+ return;
+ case 72: //nmadd
+ strcpy(op, "ps_mr");
+ sprintf(pr, "p%u, p%u", FD, FB);
+ return;
+ case 136:
+ strcpy(op, "ps_nabs");
+ sprintf(pr, "p%u, -|p%u|", FD, FB);
+ return;
+ case 264:
+ strcpy(op, "ps_abs");
+ sprintf(pr, "p%u, |p%u|", FD, FB);
+ return;
+ case 0:
+ strcpy(op, "ps_cmpu0");
+ sprintf(pr, "ps_cmpu0", FD);
+ return;
+ case 32:
+ strcpy(op,"ps_cmpq0");
+ sprintf(pr, "ps_cmpo0", FD);
+ return;
+ case 64:
+ strcpy(op,"ps_cmpu1");
+ sprintf(pr, "ps_cmpu1", FD);
+ return;
+ case 96:
+ strcpy(op,"ps_cmpo1");
+ sprintf(pr, "ps_cmpo1", FD);
+ return;
+ case 528:
+ strcpy(op,"ps_merge00");
+ sprintf(pr, "p%u, p%u[0],p%u[0]", FD, FA, FB);
+ return;
+ case 560:
+ strcpy(op,"ps_merge01");
+ sprintf(pr, "p%u, p%u[0],p%u[1]", FD, FA, FB);
+ return;
+ case 592:
+ strcpy(op,"ps_merge10");
+ sprintf(pr, "p%u, p%u[1],p%u[0]", FD, FA, FB);
+ return;
+ case 624:
+ strcpy(op,"ps_merge11");
+ sprintf(pr, "p%u, p%u[1],p%u[1]", FD, FA, FB);
+ return;
+ case 1014:
+ strcpy(op,"dcbz_l");
+ sprintf(pr, "");
+ return;
+ }
+
+ // default:
+ sprintf(op, "ps_%i",((inst>>1)&0x1f));
+ strcpy(pr,"---");
+ return;
+ }
+
+ static void ps_mem(struct DisasmPara_PPC *dp,ppc_word inst)
+ {
+ ppc_word pc = *dp->iaddr;
+ char *op = dp->opcode;
+ char *pr = dp->operands;
+ switch(PPCGETIDX(inst))
+ {
+ case 56:
+ strcpy(op,"psq_l");
+ sprintf(pr, "p%u, %i(r%u)", RS, SEX12(inst&0xFFF), RA);
+ break;
+ case 57:
+ strcpy(op,"psq_lu");
+ sprintf(pr, "", FD);
+ break;
+ case 60:
+ strcpy(op,"psq_st");
+ sprintf(pr, "%i(r%u), p%u", SEX12(inst&0xFFF), RA, RS);
+ break;
+ case 61:
+ strcpy(op,"psq_stu");
+ sprintf(pr, "r%u, p%u ?", RA, RS);
+ break;
+ }
+ }
+
+
+ ppc_word *PPC_Disassemble(struct DisasmPara_PPC *dp)
+ /* Disassemble PPC instruction and return a pointer to the next */
+ /* instruction, or NULL if an error occured. */
+ {
+ ppc_word in = *(dp->instr);
+
+ if (dp->opcode==NULL || dp->operands==NULL)
+ return (NULL); /* no buffers */
+
+#if LITTLEENDIAN
+ in = (in & 0xff)<<24 | (in & 0xff00)<<8 | (in & 0xff0000)>>8 |
+ (in & 0xff000000)>>24;
+#endif
+ dp->type = PPCINSTR_OTHER;
+ dp->flags = 0;
+ *(dp->operands) = 0;
+
+ switch (PPCGETIDX(in))
+ {
+ case 1:
+ sprintf(dp->opcode,"HLE");
+ //HLE call
+ break;
+ case 2:
+ trapi(dp,in,PPCF_64); /* tdi */
+ break;
+
+ case 3:
+ trapi(dp,in,0); /* twi */
+ break;
+ case 4:
+ ps(dp,in);
+ break;
+ case 56:
+ case 57:
+ case 60:
+ case 61:
+ ps_mem(dp,in);
+ break;
+
+
+ case 7:
+ strcpy(dp->opcode,"mulli");
+ imm(dp,in,0,0,0);
+ break;
+
+ case 8:
+ strcpy(dp->opcode,"subfic");
+ imm(dp,in,0,0,0);
+ break;
+
+ case 10:
+ cmpi(dp,in,1); /* cmpli */
+ break;
+
+ case 11:
+ cmpi(dp,in,0); /* cmpi */
+ break;
+
+ case 12:
+ addi(dp,in,"ic"); /* addic */
+ break;
+
+ case 13:
+ addi(dp,in,"ic."); /* addic. */
+ break;
+
+ case 14:
+ addi(dp,in,"i"); /* addi */
+ break;
+
+ case 15:
+ addi(dp,in,"is"); /* addis */
+ break;
+
+ case 16:
+ bc(dp,in);
+ break;
+
+ case 17:
+ if ((in & ~PPCIDXMASK) == 2)
+ strcpy(dp->opcode,"sc");
+ else
+ ill(dp,in);
+ break;
+
+ case 18:
+ bli(dp,in);
+ break;
+
+ case 19:
+ switch (PPCGETIDX2(in)) {
+ case 0:
+ mcrf(dp,in,'\0'); /* mcrf */
+ break;
+
+ case 16:
+ branch(dp,in,"lr",0,0); /* bclr */
+ break;
+
+ case 33:
+ crop(dp,in,"nor","not"); /* crnor */
+ break;
+
+ case 50:
+ nooper(dp,in,"rfi",PPCF_SUPER);
+ break;
+
+ case 129:
+ crop(dp,in,"andc",NULL); /* crandc */
+ break;
+
+ case 150:
+ nooper(dp,in,"isync",0);
+ break;
+
+ case 193:
+ crop(dp,in,"xor","clr"); /* crxor */
+ break;
+
+ case 225:
+ crop(dp,in,"nand",NULL); /* crnand */
+ break;
+
+ case 257:
+ crop(dp,in,"and",NULL); /* crand */
+ break;
+
+ case 289:
+ crop(dp,in,"eqv","set"); /* creqv */
+ break;
+
+ case 417:
+ crop(dp,in,"orc",NULL); /* crorc */
+ break;
+
+ case 449:
+ crop(dp,in,"or","move"); /* cror */
+ break;
+
+ case 528:
+ branch(dp,in,"ctr",0,0); /* bcctr */
+ break;
+
+ default:
+ ill(dp,in);
+ break;
+ }
+ break;
+
+ case 20:
+ rlw(dp,in,"imi",0); /* rlwimi */
+ break;
+
+ case 21:
+ rlw(dp,in,"inm",0); /* rlwinm */
+ break;
+
+ case 23:
+ rlw(dp,in,"nm",1); /* rlwnm */
+ break;
+
+ case 24:
+ if (in & ~PPCIDXMASK)
+ ori(dp,in,"ori");
+ else
+ strcpy(dp->opcode,"nop");
+ break;
+
+ case 25:
+ ori(dp,in,"oris");
+ break;
+
+ case 26:
+ ori(dp,in,"xori");
+ break;
+
+ case 27:
+ ori(dp,in,"xoris");
+ break;
+
+ case 28:
+ ori(dp,in,"andi.");
+ break;
+
+ case 29:
+ ori(dp,in,"andis.");
+ break;
+
+ case 30:
+ switch (in & 0x1c) {
+ case 0:
+ rld(dp,in,"icl",0); /* rldicl */
+ break;
+ case 1:
+ rld(dp,in,"icr",0); /* rldicr */
+ break;
+ case 2:
+ rld(dp,in,"ic",0); /* rldic */
+ break;
+ case 3:
+ rld(dp,in,"imi",0); /* rldimi */
+ break;
+ case 4:
+ rld(dp,in,in&2?"cl":"cr",1); /* rldcl, rldcr */
+ break;
+ default:
+ ill(dp,in);
+ break;
+ }
+ break;
+
+ case 31:
+ switch (PPCGETIDX2(in)) {
+ case 0:
+ case 32:
+ if (in & 1)
+ ill(dp,in);
+ else
+ cmp(dp,in); /* cmp, cmpl */
+ break;
+
+ case 4:
+ if (in & 1)
+ ill(dp,in);
+ else
+ trap(dp,in,0); /* tw */
+ break;
+
+ case 8:
+ case (PPCOE>>1)+8:
+ dab(dp,swapab(in),"subc",7,0,1,-1,0);
+ break;
+
+ case 9:
+ dab(dp,in,"mulhdu",7,0,0,-1,PPCF_64);
+ break;
+
+ case 10:
+ case (PPCOE>>1)+10:
+ dab(dp,in,"addc",7,0,1,-1,0);
+ break;
+
+ case 11:
+ dab(dp,in,"mulhwu",7,0,0,-1,0);
+ break;
+
+ case 19:
+ if (in & (PPCAMASK|PPCBMASK))
+ ill(dp,in);
+ else
+ dab(dp,in,"mfcr",4,0,0,0,0);
+ break;
+
+ case 20:
+ dab(dp,in,"lwarx",7,0,0,0,0);
+ break;
+
+ case 21:
+ dab(dp,in,"ldx",7,0,0,0,PPCF_64);
+ break;
+
+ case 23:
+ dab(dp,in,"lwzx",7,0,0,0,0);
+ break;
+
+ case 24:
+ dab(dp,in,"slw",7,1,0,-1,0);
+ break;
+
+ case 26:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"cntlzw",6,1,0,-1,0);
+ break;
+
+ case 27:
+ dab(dp,in,"sld",7,1,0,-1,PPCF_64);
+ break;
+
+ case 28:
+ dab(dp,in,"and",7,1,0,-1,0);
+ break;
+
+ case 40:
+ case (PPCOE>>1)+40:
+ dab(dp,swapab(in),"sub",7,0,1,-1,0);
+ break;
+
+ case 53:
+ dab(dp,in,"ldux",7,0,0,0,PPCF_64);
+ break;
+
+ case 54:
+ if (in & PPCDMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"dcbst",3,0,0,0,0);
+ break;
+
+ case 55:
+ dab(dp,in,"lwzux",7,0,0,0,0);
+ break;
+
+ case 58:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"cntlzd",6,1,0,-1,PPCF_64);
+ break;
+
+ case 60:
+ dab(dp,in,"andc",7,1,0,-1,0);
+ break;
+
+ case 68:
+ trap(dp,in,PPCF_64); /* td */
+ break;
+
+ case 73:
+ dab(dp,in,"mulhd",7,0,0,-1,PPCF_64);
+ break;
+
+ case 75:
+ dab(dp,in,"mulhw",7,0,0,-1,0);
+ break;
+
+ case 83:
+ if (in & (PPCAMASK|PPCBMASK))
+ ill(dp,in);
+ else
+ dab(dp,in,"mfmsr",4,0,0,0,PPCF_SUPER);
+ break;
+
+ case 84:
+ dab(dp,in,"ldarx",7,0,0,0,PPCF_64);
+ break;
+
+ case 86:
+ if (in & PPCDMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"dcbf",3,0,0,0,0);
+ break;
+
+ case 87:
+ dab(dp,in,"lbzx",7,0,0,0,0);
+ break;
+
+ case 104:
+ case (PPCOE>>1)+104:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"neg",6,0,1,-1,0);
+ break;
+
+ case 119:
+ dab(dp,in,"lbzux",7,0,0,0,0);
+ break;
+
+ case 124:
+ if (PPCGETD(in) == PPCGETB(in))
+ dab(dp,in,"not",6,1,0,-1,0);
+ else
+ dab(dp,in,"nor",7,1,0,-1,0);
+ break;
+
+ case 136:
+ case (PPCOE>>1)+136:
+ dab(dp,in,"subfe",7,0,1,-1,0);
+ break;
+
+ case 138:
+ case (PPCOE>>1)+138:
+ dab(dp,in,"adde",7,0,1,-1,0);
+ break;
+
+ case 144:
+ mtcr(dp,in);
+ break;
+
+ case 146:
+ if (in & (PPCAMASK|PPCBMASK))
+ ill(dp,in);
+ else
+ dab(dp,in,"mtmsr",4,0,0,0,PPCF_SUPER);
+ break;
+
+ case 149:
+ dab(dp,in,"stdx",7,0,0,0,PPCF_64);
+ break;
+
+ case 150:
+ dab(dp,in,"stwcx.",7,0,0,1,0);
+ break;
+
+ case 151:
+ dab(dp,in,"stwx",7,0,0,0,0);
+ break;
+
+ case 181:
+ dab(dp,in,"stdux",7,0,0,0,PPCF_64);
+ break;
+
+ case 183:
+ dab(dp,in,"stwux",7,0,0,0,0);
+ break;
+
+ case 200:
+ case (PPCOE>>1)+200:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"subfze",6,0,1,-1,0);
+ break;
+
+ case 202:
+ case (PPCOE>>1)+202:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"addze",6,0,1,-1,0);
+ break;
+
+ case 210:
+ msr(dp,in,1); /* mfsr */
+ break;
+
+ case 214:
+ dab(dp,in,"stdcx.",7,0,0,1,PPCF_64);
+ break;
+
+ case 215:
+ dab(dp,in,"stbx",7,0,0,0,0);
+ break;
+
+ case 232:
+ case (PPCOE>>1)+232:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"subfme",6,0,1,-1,0);
+ break;
+
+ case 233:
+ case (PPCOE>>1)+233:
+ dab(dp,in,"mulld",7,0,1,-1,PPCF_64);
+ break;
+
+ case 234:
+ case (PPCOE>>1)+234:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"addme",6,0,1,-1,0);
+ break;
+
+ case 235:
+ case (PPCOE>>1)+235:
+ dab(dp,in,"mullw",7,0,1,-1,0);
+ break;
+
+ case 242:
+ if (in & PPCAMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"mtsrin",5,0,0,0,PPCF_SUPER);
+ break;
+
+ case 246:
+ if (in & PPCDMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"dcbtst",3,0,0,0,0);
+ break;
+
+ case 247:
+ dab(dp,in,"stbux",7,0,0,0,0);
+ break;
+
+ case 266:
+ case (PPCOE>>1)+266:
+ dab(dp,in,"add",7,0,1,-1,0);
+ break;
+
+ case 278:
+ if (in & PPCDMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"dcbt",3,0,0,0,0);
+ break;
+
+ case 279:
+ dab(dp,in,"lhzx",7,0,0,0,0);
+ break;
+
+ case 284:
+ dab(dp,in,"eqv",7,1,0,-1,0);
+ break;
+
+ case 306:
+ if (in & (PPCDMASK|PPCAMASK))
+ ill(dp,in);
+ else
+ dab(dp,in,"tlbie",1,0,0,0,PPCF_SUPER);
+ break;
+
+ case 310:
+ dab(dp,in,"eciwx",7,0,0,0,0);
+ break;
+
+ case 311:
+ dab(dp,in,"lhzux",7,0,0,0,0);
+ break;
+
+ case 316:
+ dab(dp,in,"xor",7,1,0,-1,0);
+ break;
+
+ case 339:
+ mspr(dp,in,0); /* mfspr */
+ break;
+
+ case 341:
+ dab(dp,in,"lwax",7,0,0,0,PPCF_64);
+ break;
+
+ case 343:
+ dab(dp,in,"lhax",7,0,0,0,0);
+ break;
+
+ case 370:
+ nooper(dp,in,"tlbia",PPCF_SUPER);
+ break;
+
+ case 371:
+ mtb(dp,in); /* mftb */
+ break;
+
+ case 373:
+ dab(dp,in,"lwaux",7,0,0,0,PPCF_64);
+ break;
+
+ case 375:
+ dab(dp,in,"lhaux",7,0,0,0,0);
+ break;
+
+ case 407:
+ dab(dp,in,"sthx",7,0,0,0,0);
+ break;
+
+ case 412:
+ dab(dp,in,"orc",7,1,0,-1,0);
+ break;
+
+ case 413:
+ sradi(dp,in); /* sradi */
+ break;
+
+ case 434:
+ if (in & (PPCDMASK|PPCAMASK))
+ ill(dp,in);
+ else
+ dab(dp,in,"slbie",1,0,0,0,PPCF_SUPER|PPCF_64);
+ break;
+
+ case 438:
+ dab(dp,in,"ecowx",7,0,0,0,0);
+ break;
+
+ case 439:
+ dab(dp,in,"sthux",7,0,0,0,0);
+ break;
+
+ case 444:
+ if (PPCGETD(in) == PPCGETB(in))
+ dab(dp,in,"mr",6,1,0,-1,0);
+ else
+ dab(dp,in,"or",7,1,0,-1,0);
+ break;
+
+ case 457:
+ case (PPCOE>>1)+457:
+ dab(dp,in,"divdu",7,0,1,-1,PPCF_64);
+ break;
+
+ case 459:
+ case (PPCOE>>1)+459:
+ dab(dp,in,"divwu",7,0,1,-1,0);
+ break;
+
+ case 467:
+ mspr(dp,in,1); /* mtspr */
+ break;
+
+ case 470:
+ if (in & PPCDMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"dcbi",3,0,0,0,0);
+ break;
+
+ case 476:
+ dab(dp,in,"nand",7,1,0,-1,0);
+ break;
+
+ case 489:
+ case (PPCOE>>1)+489:
+ dab(dp,in,"divd",7,0,1,-1,PPCF_64);
+ break;
+
+ case 491:
+ case (PPCOE>>1)+491:
+ dab(dp,in,"divw",7,0,1,-1,0);
+ break;
+
+ case 498:
+ nooper(dp,in,"slbia",PPCF_SUPER|PPCF_64);
+ break;
+
+ case 512:
+ if (in & 0x007ff801)
+ ill(dp,in);
+ else {
+ strcpy(dp->opcode,"mcrxr");
+ sprintf(dp->operands,"cr%d",(int)PPCGETCRD(in));
+ }
+ break;
+
+ case 533:
+ dab(dp,in,"lswx",7,0,0,0,0);
+ break;
+
+ case 534:
+ dab(dp,in,"lwbrx",7,0,0,0,0);
+ break;
+
+ case 535:
+ fdab(dp,in,"lfsx",7);
+ break;
+
+ case 536:
+ dab(dp,in,"srw",7,1,0,-1,0);
+ break;
+
+ case 539:
+ dab(dp,in,"srd",7,1,0,-1,PPCF_64);
+ break;
+
+ case 566:
+ nooper(dp,in,"tlbsync",PPCF_SUPER);
+ break;
+
+ case 567:
+ fdab(dp,in,"lfsux",7);
+ break;
+
+ case 595:
+ msr(dp,in,0); /* mfsr */
+ break;
+
+ case 597:
+ rrn(dp,in,"lswi",0,0,0,0);
+ break;
+
+ case 598:
+ nooper(dp,in,"sync",PPCF_SUPER);
+ break;
+
+ case 599:
+ fdab(dp,in,"lfdx",7);
+ break;
+
+ case 631:
+ fdab(dp,in,"lfdux",7);
+ break;
+
+ case 659:
+ if (in & PPCAMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"mfsrin",5,0,0,0,PPCF_SUPER);
+ break;
+
+ case 661:
+ dab(dp,in,"stswx",7,0,0,0,0);
+ break;
+
+ case 662:
+ dab(dp,in,"stwbrx",7,0,0,0,0);
+ break;
+
+ case 663:
+ fdab(dp,in,"stfsx",7);
+ break;
+
+ case 695:
+ fdab(dp,in,"stfsux",7);
+ break;
+
+ case 725:
+ rrn(dp,in,"stswi",0,0,0,0);
+ break;
+
+ case 727:
+ fdab(dp,in,"stfdx",7);
+ break;
+
+ case 759:
+ fdab(dp,in,"stfdux",7);
+ break;
+
+ case 790:
+ dab(dp,in,"lhbrx",7,0,0,0,0);
+ break;
+
+ case 792:
+ dab(dp,in,"sraw",7,1,0,-1,0);
+ break;
+
+ case 794:
+ dab(dp,in,"srad",7,1,0,-1,PPCF_64);
+ break;
+
+ case 824:
+ rrn(dp,in,"srawi",1,0,-1,0);
+ break;
+
+ case 854:
+ nooper(dp,in,"eieio",PPCF_SUPER);
+ break;
+
+ case 918:
+ dab(dp,in,"sthbrx",7,0,0,0,0);
+ break;
+
+ case 922:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"extsh",6,1,0,-1,0);
+ break;
+
+ case 954:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"extsb",6,1,0,-1,0);
+ break;
+
+ case 982:
+ if (in & PPCDMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"icbi",3,0,0,0,0);
+ break;
+
+ case 983:
+ fdab(dp,in,"stfiwx",7);
+ break;
+
+ case 986:
+ if (in & PPCBMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"extsw",6,1,0,-1,PPCF_64);
+ break;
+
+ case 1014:
+ if (in & PPCDMASK)
+ ill(dp,in);
+ else
+ dab(dp,in,"dcbz",3,0,0,0,0);
+ break;
+
+ default:
+ ill(dp,in);
+ break;
+ }
+ break;
+
+ case 32:
+ case 33:
+ case 34:
+ case 35:
+ case 36:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ ldst(dp,in,ldstnames[PPCGETIDX(in)-32],'r',0);
+ break;
+
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ ldst(dp,in,ldstnames[PPCGETIDX(in)-32],'f',0);
+ break;
+
+ case 58:
+ switch (in & 3) {
+ case 0:
+ ldst(dp,in&~3,"ld",'r',PPCF_64);
+ break;
+ case 1:
+ ldst(dp,in&~3,"ldu",'r',PPCF_64);
+ break;
+ case 2:
+ ldst(dp,in&~3,"lwa",'r',PPCF_64);
+ break;
+ default:
+ ill(dp,in);
+ break;
+ }
+ break;
+
+ case 59:
+ switch (in & 0x3e) {
+ case 36:
+ fdabc(dp,in,"divs",6,0);
+ break;
+
+ case 40:
+ fdabc(dp,in,"subs",6,0);
+ break;
+
+ case 42:
+ fdabc(dp,in,"adds",6,0);
+ break;
+
+ case 44:
+ fdabc(dp,in,"sqrts",2,0);
+ break;
+
+ case 48:
+ fdabc(dp,in,"res",2,0);
+ break;
+
+ case 50:
+ fdabc(dp,in,"muls",5,0);
+ break;
+
+ case 56:
+ fdabc(dp,in,"msubs",7,0);
+ break;
+
+ case 58:
+ fdabc(dp,in,"madds",7,0);
+ break;
+
+ case 60:
+ fdabc(dp,in,"nmsubs",7,0);
+ break;
+
+ case 62:
+ fdabc(dp,in,"nmadds",7,0);
+ break;
+
+ default:
+ ill(dp,in);
+ break;
+ }
+ break;
+
+ case 62:
+ switch (in & 3) {
+ case 0:
+ ldst(dp,in&~3,"std",'r',PPCF_64);
+ break;
+ case 1:
+ ldst(dp,in&~3,"stdu",'r',PPCF_64);
+ break;
+ default:
+ ill(dp,in);
+ break;
+ }
+ break;
+
+ case 63:
+ if (in & 32) {
+ switch (in & 0x1e) {
+ case 4:
+ fdabc(dp,in,"div",6,0);
+ break;
+
+ case 8:
+ fdabc(dp,in,"sub",6,0);
+ break;
+
+ case 10:
+ fdabc(dp,in,"add",6,0);
+ break;
+
+ case 12:
+ fdabc(dp,in,"sqrt",2,0);
+ break;
+
+ case 14:
+ fdabc(dp,in,"sel",7,0);
+ break;
+
+ case 18:
+ fdabc(dp,in,"mul",5,0);
+ break;
+
+ case 20:
+ fdabc(dp,in,"sqrte",2,0);
+ break;
+
+ case 24:
+ fdabc(dp,in,"msub",7,0);
+ break;
+
+ case 26:
+ fdabc(dp,in,"madd",7,0);
+ break;
+
+ case 28:
+ fdabc(dp,in,"nmsub",7,0);
+ break;
+
+ case 30:
+ fdabc(dp,in,"nmadd",7,0);
+ break;
+
+ default:
+ ill(dp,in);
+ break;
+ }
+ }
+
+ else {
+ switch (PPCGETIDX2(in)) {
+ case 0:
+ fcmp(dp,in,'u');
+ break;
+
+ case 12:
+ fdabc(dp,in,"rsp",10,0);
+ break;
+
+ case 14:
+ fdabc(dp,in,"ctiw",10,0);
+ break;
+
+ case 15:
+ fdabc(dp,in,"ctiwz",10,0);
+ break;
+
+ case 32:
+ fcmp(dp,in,'o');
+ break;
+
+ case 38:
+ mtfsb(dp,in,1);
+ break;
+
+ case 40:
+ fdabc(dp,in,"neg",10,0);
+ break;
+
+ case 64:
+ mcrf(dp,in,'s'); /* mcrfs */
+ break;
+
+ case 70:
+ mtfsb(dp,in,0);
+ break;
+
+ case 72:
+ fdabc(dp,in,"mr",10,0);
+ break;
+
+ case 134:
+ if (!(in & 0x006f0800)) {
+ sprintf(dp->opcode,"mtfsfi%s",rcsel[in&1]);
+ sprintf(dp->operands,"cr%d,%d",(int)PPCGETCRD(in),
+ (int)(in & 0xf000)>>12);
+ }
+ else
+ ill(dp,in);
+ break;
+
+ case 136:
+ fdabc(dp,in,"nabs",10,0);
+ break;
+
+ case 264:
+ fdabc(dp,in,"abs",10,0);
+ break;
+
+ case 583:
+ if (in & (PPCAMASK|PPCBMASK))
+ ill(dp,in);
+ else
+ dab(dp,in,"mffs",4,0,0,-1,0);
+ break;
+
+ case 711:
+ if (!(in & 0x02010000)) {
+ sprintf(dp->opcode,"mtfsf%s",rcsel[in&1]);
+ sprintf(dp->operands,"0x%x,%d",
+ (unsigned)(in & 0x01fe)>>17,(int)PPCGETB(in));
+ }
+ else
+ ill(dp,in);
+ break;
+
+ case 814:
+ fdabc(dp,in,"fctid",10,PPCF_64);
+ break;
+
+ case 815:
+ fdabc(dp,in,"fctidz",10,PPCF_64);
+ break;
+
+ case 846:
+ fdabc(dp,in,"fcfid",10,PPCF_64);
+ break;
+
+ default:
+ ill(dp,in);
+ break;
+ }
+ }
+ break;
+
+ default:
+ ill(dp,in);
+ break;
+ }
+ return (dp->instr + 1);
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+// simplified interface
+
+const char *DisassembleGekko(unsigned int opcode, unsigned int curInstAddr)
+{
+ char opcodeStr[32], operandStr[32];
+ PPCDisasm::DisasmPara_PPC dp;
+ static char buf[128];
+ static unsigned int opc, adr;
+
+ opc = opcode;
+ adr = curInstAddr;
+
+ dp.opcode = opcodeStr;
+ dp.operands = operandStr;
+ dp.instr = (PPCDisasm::ppc_word *)&opc;
+ dp.iaddr = (PPCDisasm::ppc_word *)&adr;
+
+ PPCDisasm::PPC_Disassemble(&dp);
+
+ //sprintf(buf, "%-10s %s", opcodeStr, operandStr);
+ sprintf(buf, "%s\t%s", opcodeStr, operandStr);
+ return buf;
+}
+
+
+static const char *gprnames[] =
+{
+ "r00", "r01", "r02", "r03", "r04", "r05", "r06", "r07",
+ "r08", "r09", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
+};
+
+const char *GetGRPName(unsigned int index)
+{
+ if (index < 32)
+ return gprnames[index];
+ return 0;
+}
\ No newline at end of file
diff --git a/Externals/Bochs_disasm/PowerPCDisasm.h b/Externals/Bochs_disasm/PowerPCDisasm.h
new file mode 100644
index 0000000000..b6e71039e1
--- /dev/null
+++ b/Externals/Bochs_disasm/PowerPCDisasm.h
@@ -0,0 +1,28 @@
+/* $VER: ppc_disasm V0.1 (23.05.1998)
+ *
+ * Disassembler module for the PowerPC microprocessor family
+ * Copyright (c) 1998-2000 Frank Wille
+ *
+ * ppc_disasm.c is freeware and may be freely redistributed as long as
+ * no modifications are made and nothing is charged for it.
+ * Non-commercial usage is allowed without any restrictions.
+ * EVERY PRODUCT OR PROGRAM DERIVED DIRECTLY FROM MY SOURCE MAY NOT BE
+ * SOLD COMMERCIALLY WITHOUT PERMISSION FROM THE AUTHOR.
+ *
+ *
+ * v0.1 (23.05.1998) phx
+ * First version, which implements all PowerPC instructions.
+ * v0.0 (09.05.1998) phx
+ * File created.
+ */
+
+
+// Yeah, this does not really belong in bochs_disasm, but hey, it's a disasm and it needed a common location...
+
+#ifndef _POWERPC_DISASM
+#define _POWERPC_DISASM
+
+const char *DisassembleGekko(unsigned int opcode, unsigned int curInstAddr);
+const char *GetGRPName(unsigned int index);
+
+#endif
diff --git a/Externals/Bochs_disasm/SConscript b/Externals/Bochs_disasm/SConscript
new file mode 100644
index 0000000000..9890bb8d50
--- /dev/null
+++ b/Externals/Bochs_disasm/SConscript
@@ -0,0 +1,11 @@
+Import('env')
+
+files = ["dis_decode.cpp",
+ "dis_groups.cpp",
+ "resolve.cpp",
+ "syntax.cpp",
+ "PowerPCDisasm.cpp",
+ ]
+
+env_bochs = env.Copy(CXXFLAGS = " -fPIC ")
+env_bochs.StaticLibrary("bdisasm", files)
diff --git a/Externals/Bochs_disasm/config.h b/Externals/Bochs_disasm/config.h
new file mode 100644
index 0000000000..1f6f3743c4
--- /dev/null
+++ b/Externals/Bochs_disasm/config.h
@@ -0,0 +1,41 @@
+#ifndef _BOCHS_CONFIG_H
+#define _BOCHS_CONFIG_H
+
+#ifdef _WIN32
+typedef signed __int8 Bit8s;
+typedef signed __int16 Bit16s;
+typedef signed __int32 Bit32s;
+typedef signed __int64 Bit64s;
+
+typedef unsigned __int8 Bit8u;
+typedef unsigned __int16 Bit16u;
+typedef unsigned __int32 Bit32u;
+typedef unsigned __int64 Bit64u;
+
+typedef bool bx_bool;
+typedef Bit64u bx_address;
+
+#define BX_CPP_INLINE inline
+
+#else
+
+#include
+
+typedef int8_t Bit8s;
+typedef int16_t Bit16s;
+typedef int32_t Bit32s;
+typedef int64_t Bit64s;
+
+typedef uint8_t Bit8u;
+typedef uint16_t Bit16u;
+typedef uint32_t Bit32u;
+typedef uint64_t Bit64u;
+
+typedef bool bx_bool;
+typedef Bit64u bx_address;
+
+#define BX_CPP_INLINE inline
+
+#endif
+
+#endif
diff --git a/Externals/Bochs_disasm/dis_decode.cpp b/Externals/Bochs_disasm/dis_decode.cpp
new file mode 100644
index 0000000000..3734578658
--- /dev/null
+++ b/Externals/Bochs_disasm/dis_decode.cpp
@@ -0,0 +1,328 @@
+/////////////////////////////////////////////////////////////////////////
+// $Id: dis_decode.cc,v 1.32 2006/05/12 17:04:19 sshwarts Exp $
+/////////////////////////////////////////////////////////////////////////
+
+#include
+#include
+#include
+
+#include "disasm.h"
+#include "dis_tables.h"
+
+#define OPCODE(entry) ((BxDisasmOpcodeInfo_t*) entry->OpcodeInfo)
+#define OPCODE_TABLE(entry) ((BxDisasmOpcodeTable_t*) entry->OpcodeInfo)
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+static const unsigned char instruction_has_modrm[512] = {
+ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ /* ------------------------------- */
+ /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
+ /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
+ /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
+ /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
+ /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,
+ /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ /* A0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ /* B0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ /* C0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,
+ /* D0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,
+ /* E0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ /* F0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,
+ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ /* ------------------------------- */
+ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0F 00 */
+ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1, /* 0F 10 */
+ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 0F 20 */
+ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 0F 30 */
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0F 40 */
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0F 50 */
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0F 60 */
+ 1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1, /* 0F 70 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0F 80 */
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0F 90 */
+ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* 0F A0 */
+ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* 0F B0 */
+ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* 0F C0 */
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0F D0 */
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0F E0 */
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 /* 0F F0 */
+ /* ------------------------------- */
+ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
+};
+
+unsigned disassembler::disasm(bx_bool is_32, bx_bool is_64, bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+{
+ x86_insn insn = decode(is_32, is_64, base, ip, instr, disbuf);
+ return insn.ilen;
+}
+
+x86_insn disassembler::decode(bx_bool is_32, bx_bool is_64, bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+{
+ x86_insn insn(is_32, is_64);
+ const Bit8u *instruction_begin = instruction = instr;
+ resolve_modrm = NULL;
+ unsigned b3 = 0;
+
+ db_eip = ip;
+ db_base = base; // cs linear base (base for PM & cs<<4 for RM & VM)
+
+ disbufptr = disbuf; // start sprintf()'ing into beginning of buffer
+
+#define SSE_PREFIX_NONE 0
+#define SSE_PREFIX_66 1
+#define SSE_PREFIX_F2 2
+#define SSE_PREFIX_F3 3 /* only one SSE prefix could be used */
+ unsigned sse_prefix = SSE_PREFIX_NONE;
+
+ for(;;)
+ {
+ insn.b1 = fetch_byte();
+ insn.prefixes++;
+
+ switch(insn.b1) {
+ case 0x40: // rex
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+ if (! is_64) break;
+ insn.extend8b = 1;
+ if (insn.b1 & 0x8) {
+ insn.os_64 = 1;
+ insn.os_32 = 1;
+ }
+ if (insn.b1 & 0x4) insn.rex_r = 8;
+ if (insn.b1 & 0x2) insn.rex_x = 8;
+ if (insn.b1 & 0x1) insn.rex_b = 8;
+ continue;
+
+ case 0x26: // ES:
+ if (! is_64) insn.seg_override = ES_REG;
+ continue;
+
+ case 0x2e: // CS:
+ if (! is_64) insn.seg_override = CS_REG;
+ continue;
+
+ case 0x36: // SS:
+ if (! is_64) insn.seg_override = SS_REG;
+ continue;
+
+ case 0x3e: // DS:
+ if (! is_64) insn.seg_override = DS_REG;
+ continue;
+
+ case 0x64: // FS:
+ insn.seg_override = FS_REG;
+ continue;
+
+ case 0x65: // GS:
+ insn.seg_override = GS_REG;
+ continue;
+
+ case 0x66: // operand size override
+ if (!insn.os_64) insn.os_32 = !is_32;
+ if (!sse_prefix) sse_prefix = SSE_PREFIX_66;
+ continue;
+
+ case 0x67: // address size override
+ if (!is_64) insn.as_32 = !is_32;
+ insn.as_64 = 0;
+ continue;
+
+ case 0xf0: // lock
+ continue;
+
+ case 0xf2: // repne
+ if (!sse_prefix) sse_prefix = SSE_PREFIX_F2;
+ continue;
+
+ case 0xf3: // rep
+ if (!sse_prefix) sse_prefix = SSE_PREFIX_F3;
+ continue;
+
+ // no more prefixes
+ default:
+ break;
+ }
+
+ insn.prefixes--;
+ break;
+ }
+
+ if (insn.b1 == 0x0f)
+ {
+ insn.b1 = 0x100 | fetch_byte();
+ }
+
+ const BxDisasmOpcodeTable_t *opcode_table, *entry;
+
+ if (is_64) {
+ if (insn.os_64)
+ opcode_table = BxDisasmOpcodes64q;
+ else if (insn.os_32)
+ opcode_table = BxDisasmOpcodes64d;
+ else
+ opcode_table = BxDisasmOpcodes64w;
+ } else {
+ if (insn.os_32)
+ opcode_table = BxDisasmOpcodes32;
+ else
+ opcode_table = BxDisasmOpcodes16;
+ }
+
+ entry = opcode_table + insn.b1;
+
+ // will require 3rd byte for 3-byte opcode
+ if (entry->Attr & _GRP3BTAB) b3 = fetch_byte();
+
+ if (instruction_has_modrm[insn.b1])
+ {
+ decode_modrm(&insn);
+ }
+
+ int attr = entry->Attr;
+ while(attr)
+ {
+ switch(attr) {
+ case _GROUPN:
+ entry = &(OPCODE_TABLE(entry)[insn.nnn]);
+ break;
+
+ case _GRPSSE:
+ if(sse_prefix) insn.prefixes--;
+ /* For SSE opcodes, look into another 4 entries table
+ with the opcode prefixes (NONE, 0x66, 0xF2, 0xF3) */
+ entry = &(OPCODE_TABLE(entry)[sse_prefix]);
+ break;
+
+ case _SPLIT11B:
+ entry = &(OPCODE_TABLE(entry)[insn.mod != 3]); /* REG/MEM */
+ break;
+
+ case _GRPRM:
+ entry = &(OPCODE_TABLE(entry)[insn.rm]);
+ break;
+
+ case _GRPFP:
+ if(insn.mod != 3)
+ {
+ entry = &(OPCODE_TABLE(entry)[insn.nnn]);
+ } else {
+ int index = (insn.b1-0xD8)*64 + (insn.modrm & 0x3f);
+ entry = &(BxDisasmOpcodeInfoFP[index]);
+ }
+ break;
+
+ case _GRP3DNOW:
+ entry = &(BxDisasm3DNowGroup[peek_byte()]);
+ break;
+
+ case _GRP3BTAB:
+ entry = &(OPCODE_TABLE(entry)[b3 >> 4]);
+ break;
+
+ case _GRP3BOP:
+ entry = &(OPCODE_TABLE(entry)[b3 & 15]);
+ break;
+
+ default:
+ printf("Internal disassembler error - unknown attribute !\n");
+ return x86_insn(is_32, is_64);
+ }
+
+ /* get additional attributes from group table */
+ attr = entry->Attr;
+ }
+
+#define BRANCH_NOT_TAKEN 0x2E
+#define BRANCH_TAKEN 0x3E
+
+ unsigned branch_hint = 0;
+
+ // print prefixes
+ for(unsigned i=0;iIntelOpcode);
+ }
+
+ // branch hint for jcc instructions
+ if ((insn.b1 >= 0x070 && insn.b1 <= 0x07F) ||
+ (insn.b1 >= 0x180 && insn.b1 <= 0x18F))
+ {
+ if (prefix_byte == BRANCH_NOT_TAKEN || prefix_byte == BRANCH_TAKEN)
+ branch_hint = prefix_byte;
+ }
+ }
+
+ const BxDisasmOpcodeInfo_t *opcode = OPCODE(entry);
+
+ // patch jecx opcode
+ if (insn.b1 == 0xE3 && insn.as_32 && !insn.as_64)
+ opcode = &Ia_jecxz_Jb;
+
+ // fix nop opcode
+ if (insn.b1 == 0x90 && !insn.rex_b) {
+ opcode = &Ia_nop;
+ }
+
+ // print instruction disassembly
+ if (intel_mode)
+ print_disassembly_intel(&insn, opcode);
+ else
+ print_disassembly_att (&insn, opcode);
+
+ if (branch_hint == BRANCH_NOT_TAKEN)
+ {
+ dis_sprintf(", not taken");
+ }
+ else if (branch_hint == BRANCH_TAKEN)
+ {
+ dis_sprintf(", taken");
+ }
+
+ insn.ilen = (unsigned)(instruction - instruction_begin);
+
+ return insn;
+}
+
+void disassembler::dis_sprintf(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(disbufptr, fmt, ap);
+ va_end(ap);
+
+ disbufptr += strlen(disbufptr);
+}
+
+void disassembler::dis_putc(char symbol)
+{
+ *disbufptr++ = symbol;
+ *disbufptr = 0;
+}
diff --git a/Externals/Bochs_disasm/dis_groups.cpp b/Externals/Bochs_disasm/dis_groups.cpp
new file mode 100644
index 0000000000..75c9934aef
--- /dev/null
+++ b/Externals/Bochs_disasm/dis_groups.cpp
@@ -0,0 +1,607 @@
+/////////////////////////////////////////////////////////////////////////
+// $Id: dis_groups.cc,v 1.33 2006/08/13 09:40:07 sshwarts Exp $
+/////////////////////////////////////////////////////////////////////////
+
+#include
+#include
+#include "disasm.h"
+
+/*
+#if BX_DEBUGGER
+#include "../bx_debug/debug.h"
+#endif
+*/
+
+void disassembler::Apw(const x86_insn *insn)
+{
+ Bit16u imm16 = fetch_word();
+ Bit16u cs_selector = fetch_word();
+ dis_sprintf("%04x:%04x", (unsigned) cs_selector, (unsigned) imm16);
+}
+
+void disassembler::Apd(const x86_insn *insn)
+{
+ Bit32u imm32 = fetch_dword();
+ Bit16u cs_selector = fetch_word();
+ dis_sprintf("%04x:%08x", (unsigned) cs_selector, (unsigned) imm32);
+}
+
+// 8-bit general purpose registers
+void disassembler::AL(const x86_insn *insn) { dis_sprintf("%s", general_8bit_regname[rAX_REG]); }
+void disassembler::CL(const x86_insn *insn) { dis_sprintf("%s", general_8bit_regname[rCX_REG]); }
+
+// 16-bit general purpose registers
+void disassembler::AX(const x86_insn *insn) {
+ dis_sprintf("%s", general_16bit_regname[rAX_REG]);
+}
+
+void disassembler::DX(const x86_insn *insn) {
+ dis_sprintf("%s", general_16bit_regname[rDX_REG]);
+}
+
+// 32-bit general purpose registers
+void disassembler::EAX(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_32bit_regname[rAX_REG]);
+}
+
+// 64-bit general purpose registers
+void disassembler::RAX(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_64bit_regname[rAX_REG]);
+}
+
+// segment registers
+void disassembler::CS(const x86_insn *insn) { dis_sprintf("%s", segment_name[CS_REG]); }
+void disassembler::DS(const x86_insn *insn) { dis_sprintf("%s", segment_name[DS_REG]); }
+void disassembler::ES(const x86_insn *insn) { dis_sprintf("%s", segment_name[ES_REG]); }
+void disassembler::SS(const x86_insn *insn) { dis_sprintf("%s", segment_name[SS_REG]); }
+void disassembler::FS(const x86_insn *insn) { dis_sprintf("%s", segment_name[FS_REG]); }
+void disassembler::GS(const x86_insn *insn) { dis_sprintf("%s", segment_name[GS_REG]); }
+
+void disassembler::Sw(const x86_insn *insn) { dis_sprintf("%s", segment_name[insn->nnn]); }
+
+// test registers
+void disassembler::Td(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("tr%d", insn->nnn);
+ else
+ dis_sprintf("%%tr%d", insn->nnn);
+}
+
+// control register
+void disassembler::Cd(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("cr%d", insn->nnn);
+ else
+ dis_sprintf("%%cr%d", insn->nnn);
+}
+
+void disassembler::Cq(const x86_insn *insn) { Cd(insn); }
+
+// debug register
+void disassembler::Dd(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("db%d", insn->nnn);
+ else
+ dis_sprintf("%%db%d", insn->nnn);
+}
+
+void disassembler::Dq(const x86_insn *insn) { Dd(insn); }
+
+// 8-bit general purpose register
+void disassembler::R8(const x86_insn *insn)
+{
+ unsigned reg = (insn->b1 & 7) | insn->rex_b;
+
+ if (reg < 4 || insn->extend8b)
+ dis_sprintf("%s", general_8bit_regname_rex[reg]);
+ else
+ dis_sprintf("%s", general_8bit_regname[reg]);
+}
+
+// 16-bit general purpose register
+void disassembler::RX(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_16bit_regname[(insn->b1 & 7) | insn->rex_b]);
+}
+
+// 32-bit general purpose register
+void disassembler::ERX(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_32bit_regname[(insn->b1 & 7) | insn->rex_b]);
+}
+
+// 64-bit general purpose register
+void disassembler::RRX(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_64bit_regname[(insn->b1 & 7) | insn->rex_b]);
+}
+
+// general purpose register or memory operand
+void disassembler::Eb(const x86_insn *insn)
+{
+ if (insn->mod == 3) {
+ if (insn->rm < 4 || insn->extend8b)
+ dis_sprintf("%s", general_8bit_regname_rex[insn->rm]);
+ else
+ dis_sprintf("%s", general_8bit_regname[insn->rm]);
+ }
+ else
+ (this->*resolve_modrm)(insn, B_SIZE);
+}
+
+void disassembler::Ew(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ dis_sprintf("%s", general_16bit_regname[insn->rm]);
+ else
+ (this->*resolve_modrm)(insn, W_SIZE);
+}
+
+void disassembler::Ed(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ dis_sprintf("%s", general_32bit_regname[insn->rm]);
+ else
+ (this->*resolve_modrm)(insn, D_SIZE);
+}
+
+void disassembler::Eq(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ dis_sprintf("%s", general_64bit_regname[insn->rm]);
+ else
+ (this->*resolve_modrm)(insn, Q_SIZE);
+}
+
+// general purpose register
+void disassembler::Gb(const x86_insn *insn)
+{
+ if (insn->nnn < 4 || insn->extend8b)
+ dis_sprintf("%s", general_8bit_regname_rex[insn->nnn]);
+ else
+ dis_sprintf("%s", general_8bit_regname[insn->nnn]);
+}
+
+void disassembler::Gw(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_16bit_regname[insn->nnn]);
+}
+
+void disassembler::Gd(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_32bit_regname[insn->nnn]);
+}
+
+void disassembler::Gq(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_64bit_regname[insn->nnn]);
+}
+
+// immediate
+void disassembler::I1(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ dis_putc ('1');
+}
+
+void disassembler::Ib(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ dis_sprintf("0x%02x", (unsigned) fetch_byte());
+}
+
+void disassembler::Iw(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ dis_sprintf("0x%04x", (unsigned) fetch_word());
+}
+
+void disassembler::IwIb(const x86_insn *insn)
+{
+ Bit16u iw = fetch_word();
+ Bit8u ib = fetch_byte();
+
+ if (intel_mode) {
+ dis_sprintf("0x%04x, 0x%02x", iw, ib);
+ }
+ else {
+ dis_sprintf("$0x%02x, $0x%04x", ib, iw);
+ }
+}
+
+void disassembler::Id(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ dis_sprintf("0x%08x", (unsigned) fetch_dword());
+}
+
+void disassembler::Iq(const x86_insn *insn)
+{
+ Bit64u value = fetch_qword();
+
+ if (! intel_mode) dis_putc('$');
+ dis_sprintf("0x%08x%08x",
+ (unsigned)(value>>32), (unsigned)(value & 0xffffffff));
+}
+
+// sign extended immediate
+void disassembler::sIbw(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ Bit16u imm16 = (Bit8s) fetch_byte();
+ dis_sprintf("0x%04x", (unsigned) imm16);
+}
+
+// sign extended immediate
+void disassembler::sIbd(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ Bit32u imm32 = (Bit8s) fetch_byte();
+ dis_sprintf ("0x%08x", (unsigned) imm32);
+}
+
+// sign extended immediate
+void disassembler::sIbq(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ Bit64u imm64 = (Bit8s) fetch_byte();
+ dis_sprintf ("0x%08x%08x",
+ (unsigned)(imm64>>32), (unsigned)(imm64 & 0xffffffff));
+}
+
+// sign extended immediate
+void disassembler::sIdq(const x86_insn *insn)
+{
+ if (! intel_mode) dis_putc('$');
+ Bit64u imm64 = (Bit32s) fetch_dword();
+ dis_sprintf ("0x%08x%08x",
+ (unsigned)(imm64>>32), (unsigned)(imm64 & 0xffffffff));
+}
+
+// floating point
+void disassembler::ST0(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("st(0)");
+ else
+ dis_sprintf("%%st(0)");
+}
+
+void disassembler::STi(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("st(%d)", insn->rm);
+ else
+ dis_sprintf("%%st(%d)", insn->rm);
+}
+
+// 16-bit general purpose register
+void disassembler::Rw(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_16bit_regname[insn->rm]);
+}
+
+// 32-bit general purpose register
+void disassembler::Rd(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_32bit_regname[insn->rm]);
+}
+
+// 64-bit general purpose register
+void disassembler::Rq(const x86_insn *insn)
+{
+ dis_sprintf("%s", general_64bit_regname[insn->rm]);
+}
+
+// mmx register
+void disassembler::Pq(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("mm%d", insn->nnn);
+ else
+ dis_sprintf("%%mm%d", insn->nnn);
+}
+
+void disassembler::Nq(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("mm%d", insn->rm);
+ else
+ dis_sprintf("%%mm%d", insn->rm);
+}
+
+void disassembler::Qd(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ {
+ if (intel_mode)
+ dis_sprintf ("mm%d", insn->rm);
+ else
+ dis_sprintf("%%mm%d", insn->rm);
+ }
+ else
+ (this->*resolve_modrm)(insn, D_SIZE);
+}
+
+void disassembler::Qq(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ {
+ if (intel_mode)
+ dis_sprintf ("mm%d", insn->rm);
+ else
+ dis_sprintf("%%mm%d", insn->rm);
+ }
+ else
+ (this->*resolve_modrm)(insn, Q_SIZE);
+}
+
+// xmm register
+void disassembler::Udq(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("xmm%d", insn->rm);
+ else
+ dis_sprintf("%%xmm%d", insn->rm);
+}
+
+void disassembler::Vq(const x86_insn *insn)
+{
+ if (intel_mode)
+ dis_sprintf ("xmm%d", insn->nnn);
+ else
+ dis_sprintf("%%xmm%d", insn->nnn);
+}
+
+void disassembler::Vdq(const x86_insn *insn) { Vq(insn); }
+void disassembler::Vss(const x86_insn *insn) { Vq(insn); }
+void disassembler::Vsd(const x86_insn *insn) { Vq(insn); }
+void disassembler::Vps(const x86_insn *insn) { Vq(insn); }
+void disassembler::Vpd(const x86_insn *insn) { Vq(insn); }
+
+void disassembler::Wq(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ {
+ if (intel_mode)
+ dis_sprintf ("xmm%d", insn->rm);
+ else
+ dis_sprintf("%%xmm%d", insn->rm);
+ }
+ else
+ (this->*resolve_modrm)(insn, Q_SIZE);
+}
+
+void disassembler::Wdq(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ {
+ if (intel_mode)
+ dis_sprintf ("xmm%d", insn->rm);
+ else
+ dis_sprintf("%%xmm%d", insn->rm);
+ }
+ else
+ (this->*resolve_modrm)(insn, O_SIZE);
+}
+
+void disassembler::Wsd(const x86_insn *insn) { Wq(insn); }
+
+void disassembler::Wss(const x86_insn *insn)
+{
+ if (insn->mod == 3)
+ {
+ if (intel_mode)
+ dis_sprintf ("xmm%d", insn->rm);
+ else
+ dis_sprintf("%%xmm%d", insn->rm);
+ }
+ else
+ (this->*resolve_modrm)(insn, D_SIZE);
+}
+
+void disassembler::Wpd(const x86_insn *insn) { Wdq(insn); }
+void disassembler::Wps(const x86_insn *insn) { Wdq(insn); }
+
+// direct memory access
+void disassembler::OP_O(const x86_insn *insn, unsigned size)
+{
+ const char *seg;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = segment_name[DS_REG];
+
+ print_datasize(size);
+
+ if (insn->as_64) {
+ Bit64u imm64 = fetch_qword();
+ dis_sprintf("%s:0x%08x%08x", seg,
+ (unsigned)(imm64>>32), (unsigned)(imm64 & 0xffffffff));
+ }
+ else if (insn->as_32) {
+ Bit32u imm32 = fetch_dword();
+ dis_sprintf("%s:0x%x", seg, (unsigned) imm32);
+ }
+ else {
+ Bit16u imm16 = fetch_word();
+ dis_sprintf("%s:0x%x", seg, (unsigned) imm16);
+ }
+}
+
+void disassembler::Ob(const x86_insn *insn) { OP_O(insn, B_SIZE); }
+void disassembler::Ow(const x86_insn *insn) { OP_O(insn, W_SIZE); }
+void disassembler::Od(const x86_insn *insn) { OP_O(insn, D_SIZE); }
+void disassembler::Oq(const x86_insn *insn) { OP_O(insn, Q_SIZE); }
+
+// memory operand
+void disassembler::OP_M(const x86_insn *insn, unsigned size)
+{
+ if(insn->mod == 3)
+ dis_sprintf("(bad)");
+ else
+ (this->*resolve_modrm)(insn, size);
+}
+
+void disassembler::Ma(const x86_insn *insn) { OP_M(insn, X_SIZE); }
+void disassembler::Mp(const x86_insn *insn) { OP_M(insn, X_SIZE); }
+void disassembler::Ms(const x86_insn *insn) { OP_M(insn, X_SIZE); }
+void disassembler::Mx(const x86_insn *insn) { OP_M(insn, X_SIZE); }
+
+void disassembler::Mb(const x86_insn *insn) { OP_M(insn, B_SIZE); }
+void disassembler::Mw(const x86_insn *insn) { OP_M(insn, W_SIZE); }
+void disassembler::Md(const x86_insn *insn) { OP_M(insn, D_SIZE); }
+void disassembler::Mq(const x86_insn *insn) { OP_M(insn, Q_SIZE); }
+void disassembler::Mt(const x86_insn *insn) { OP_M(insn, T_SIZE); }
+
+void disassembler::Mdq(const x86_insn *insn) { OP_M(insn, O_SIZE); }
+void disassembler::Mps(const x86_insn *insn) { OP_M(insn, O_SIZE); }
+void disassembler::Mpd(const x86_insn *insn) { OP_M(insn, O_SIZE); }
+
+// string instructions
+void disassembler::OP_X(const x86_insn *insn, unsigned size)
+{
+ const char *rsi, *seg;
+
+ if (insn->as_64) {
+ rsi = general_64bit_regname[rSI_REG];
+ }
+ else {
+ if (insn->as_32)
+ rsi = general_32bit_regname[rSI_REG];
+ else
+ rsi = general_16bit_regname[rSI_REG];
+ }
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = segment_name[DS_REG];
+
+ print_datasize(size);
+
+ if (intel_mode)
+ dis_sprintf("%s:[%s]", seg, rsi);
+ else
+ dis_sprintf("%s:(%s)", seg, rsi);
+}
+
+void disassembler::Xb(const x86_insn *insn) { OP_X(insn, B_SIZE); }
+void disassembler::Xw(const x86_insn *insn) { OP_X(insn, W_SIZE); }
+void disassembler::Xd(const x86_insn *insn) { OP_X(insn, D_SIZE); }
+void disassembler::Xq(const x86_insn *insn) { OP_X(insn, Q_SIZE); }
+
+void disassembler::OP_Y(const x86_insn *insn, unsigned size)
+{
+ const char *rdi;
+
+ if (insn->as_64) {
+ rdi = general_64bit_regname[rDI_REG];
+ }
+ else {
+ if (insn->as_32)
+ rdi = general_32bit_regname[rDI_REG];
+ else
+ rdi = general_16bit_regname[rDI_REG];
+ }
+
+ print_datasize(size);
+
+ if (intel_mode)
+ dis_sprintf("%s:[%s]", segment_name[ES_REG], rdi);
+ else
+ dis_sprintf("%s:(%s)", segment_name[ES_REG], rdi);
+}
+
+void disassembler::Yb(const x86_insn *insn) { OP_Y(insn, B_SIZE); }
+void disassembler::Yw(const x86_insn *insn) { OP_Y(insn, W_SIZE); }
+void disassembler::Yd(const x86_insn *insn) { OP_Y(insn, D_SIZE); }
+void disassembler::Yq(const x86_insn *insn) { OP_Y(insn, Q_SIZE); }
+
+#define BX_JUMP_TARGET_NOT_REQ ((bx_address)(-1))
+
+// jump offset
+void disassembler::Jb(const x86_insn *insn)
+{
+ Bit8s imm8 = (Bit8s) fetch_byte();
+
+ if (insn->is_64) {
+ Bit64u imm64 = (Bit64s) imm8;
+ dis_sprintf(".+0x%08x%08x",
+ (unsigned)(imm64>>32), (unsigned)(imm64 & 0xffffffff));
+
+ if (db_base != BX_JUMP_TARGET_NOT_REQ) {
+ Bit64u target = db_eip + (Bit64s) imm64; target += db_base;
+ dis_sprintf(" (0x%08x%08x)",
+ (unsigned)(target>>32), (unsigned)(target & 0xffffffff));
+ }
+
+ return;
+ }
+
+ if (insn->os_32) {
+ Bit32u imm32 = (Bit32s) imm8;
+ dis_sprintf(".+0x%08x", (unsigned) imm32);
+
+ if (db_base != BX_JUMP_TARGET_NOT_REQ) {
+ Bit32u target = db_eip + (Bit32s) imm32; target += db_base;
+ dis_sprintf(" (0x%08x)", target);
+ }
+ }
+ else {
+ Bit16u imm16 = (Bit16s) imm8;
+ dis_sprintf(".+0x%04x", (unsigned) imm16);
+
+ if (db_base != BX_JUMP_TARGET_NOT_REQ) {
+ Bit16u target = (db_eip + (Bit16s) imm16) & 0xffff;
+ dis_sprintf(" (0x%08x)", target + db_base);
+ }
+ }
+}
+
+void disassembler::Jw(const x86_insn *insn)
+{
+ // Jw supported in 16-bit mode only
+ assert(! insn->is_64);
+ assert(! insn->is_32);
+
+ Bit16u imm16 = (Bit16s) fetch_word();
+ dis_sprintf(".+0x%04x", (unsigned) imm16);
+
+ if (db_base != BX_JUMP_TARGET_NOT_REQ) {
+ Bit16u target = (db_eip + (Bit16s) imm16) & 0xffff;
+ dis_sprintf(" (0x%08x)", target + db_base);
+ }
+}
+
+void disassembler::Jd(const x86_insn *insn)
+{
+ Bit32s imm32 = (Bit32s) fetch_dword();
+
+ if (insn->is_64) {
+ Bit64u imm64 = (Bit64s) imm32;
+ dis_sprintf(".+0x%08x%08x",
+ (unsigned)(imm64>>32), (unsigned)(imm64 & 0xffffffff));
+
+ if (db_base != BX_JUMP_TARGET_NOT_REQ) {
+ Bit64u target = db_eip + (Bit64s) imm64; target += db_base;
+ dis_sprintf(" (0x%08x%08x)",
+ (unsigned)(target>>32), (unsigned)(target & 0xffffffff));
+ }
+
+ return;
+ }
+
+ dis_sprintf(".+0x%08x", (unsigned) imm32);
+
+ if (db_base != BX_JUMP_TARGET_NOT_REQ) {
+ Bit32u target = db_eip + (Bit32s) imm32; target += db_base;
+ dis_sprintf(" (0x%08x)", target);
+ }
+}
diff --git a/Externals/Bochs_disasm/dis_tables.h b/Externals/Bochs_disasm/dis_tables.h
new file mode 100644
index 0000000000..f7291e0541
--- /dev/null
+++ b/Externals/Bochs_disasm/dis_tables.h
@@ -0,0 +1,152 @@
+/////////////////////////////////////////////////////////////////////////
+// $Id: dis_tables.h,v 1.29 2006/04/27 15:11:45 sshwarts Exp $
+/////////////////////////////////////////////////////////////////////////
+
+#ifndef _BX_DISASM_TABLES_
+#define _BX_DISASM_TABLES_
+
+// opcode table attributes
+#define _GROUPN 1
+#define _SPLIT11B 2
+#define _GRPFP 3
+#define _GRP3DNOW 4
+#define _GRPSSE 5
+#define _GRPRM 6
+#define _GRP3BOP 7
+#define _GRP3BTAB 8
+
+/* ************************************************************************ */
+#define GRPSSE(n) _GRPSSE, BxDisasmGroupSSE_##n
+#define GRPN(n) _GROUPN, BxDisasmGroup##n
+#define GRPRM(n) _GRPRM, BxDisasmGroupRm##n
+#define GRPMOD(n) _SPLIT11B, BxDisasmGroupMod##n
+#define GRPFP(n) _GRPFP, BxDisasmFPGroup##n
+#define GRP3DNOW _GRP3DNOW, BxDisasm3DNowGroup
+#define GR3BOP(n) _GRP3BOP, BxDisasm3ByteOp##n
+#define GR3BTAB(n) _GRP3BTAB, BxDisasm3ByteTable##n
+/* ************************************************************************ */
+
+#define Apw &disassembler::Apw
+#define Apd &disassembler::Apd
+
+#define AL &disassembler::AL
+#define CL &disassembler::CL
+#define AX &disassembler::AX
+#define DX &disassembler::DX
+
+#define EAX &disassembler::EAX
+#define RAX &disassembler::RAX
+
+#define CS &disassembler::CS
+#define DS &disassembler::DS
+#define ES &disassembler::ES
+#define SS &disassembler::SS
+#define FS &disassembler::FS
+#define GS &disassembler::GS
+
+#define Sw &disassembler::Sw
+
+#define Td &disassembler::Td
+
+#define Cd &disassembler::Cd
+#define Cq &disassembler::Cq
+
+#define Dd &disassembler::Dd
+#define Dq &disassembler::Dq
+
+#define R8 &disassembler::R8
+#define RX &disassembler::RX
+#define ERX &disassembler::ERX
+#define RRX &disassembler::RRX
+
+#define Eb &disassembler::Eb
+#define Ew &disassembler::Ew
+#define Ed &disassembler::Ed
+#define Eq &disassembler::Eq
+
+#define Gb &disassembler::Gb
+#define Gw &disassembler::Gw
+#define Gd &disassembler::Gd
+#define Gq &disassembler::Gq
+
+#define I1 &disassembler::I1
+#define Ib &disassembler::Ib
+#define Iw &disassembler::Iw
+#define Id &disassembler::Id
+#define Iq &disassembler::Iq
+
+#define IwIb &disassembler::IwIb
+
+#define sIbw &disassembler::sIbw
+#define sIbd &disassembler::sIbd
+#define sIbq &disassembler::sIbq
+#define sIdq &disassembler::sIdq
+
+#define ST0 &disassembler::ST0
+#define STi &disassembler::STi
+
+#define Rw &disassembler::Rw
+#define Rd &disassembler::Rd
+#define Rq &disassembler::Rq
+
+#define Pq &disassembler::Pq
+#define Qd &disassembler::Qd
+#define Qq &disassembler::Qq
+#define Nq &disassembler::Nq
+
+#define Vq &disassembler::Vq
+#define Vdq &disassembler::Vdq
+#define Vss &disassembler::Vss
+#define Vsd &disassembler::Vsd
+#define Vps &disassembler::Vps
+#define Vpd &disassembler::Vpd
+#define Udq &disassembler::Udq
+
+#define Wq &disassembler::Wq
+#define Wdq &disassembler::Wdq
+#define Wss &disassembler::Wss
+#define Wsd &disassembler::Wsd
+#define Wps &disassembler::Wps
+#define Wpd &disassembler::Wpd
+
+#define Ob &disassembler::Ob
+#define Ow &disassembler::Ow
+#define Od &disassembler::Od
+#define Oq &disassembler::Oq
+
+#define Ma &disassembler::Ma
+#define Mp &disassembler::Mp
+#define Ms &disassembler::Ms
+#define Mx &disassembler::Mx
+#define Mb &disassembler::Mb
+#define Mw &disassembler::Mw
+#define Md &disassembler::Md
+#define Mq &disassembler::Mq
+#define Mt &disassembler::Mt
+#define Mdq &disassembler::Mdq
+#define Mps &disassembler::Mps
+#define Mpd &disassembler::Mpd
+
+#define Xb &disassembler::Xb
+#define Xw &disassembler::Xw
+#define Xd &disassembler::Xd
+#define Xq &disassembler::Xq
+
+#define Yb &disassembler::Yb
+#define Yw &disassembler::Yw
+#define Yd &disassembler::Yd
+#define Yq &disassembler::Yq
+
+#define Jb &disassembler::Jb
+#define Jw &disassembler::Jw
+#define Jd &disassembler::Jd
+
+#define XX 0
+
+const struct BxDisasmOpcodeInfo_t
+#include "opcodes.inl"
+#include "dis_tables.inl"
+
+#undef XX
+
+#endif
diff --git a/Externals/Bochs_disasm/dis_tables.inl b/Externals/Bochs_disasm/dis_tables.inl
new file mode 100644
index 0000000000..26e9fefe6a
--- /dev/null
+++ b/Externals/Bochs_disasm/dis_tables.inl
@@ -0,0 +1,5081 @@
+/* ************************************************************************ */
+/* SSE opcodes */
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f10[4] = {
+ /* -- */ { 0, &Ia_movups_Vps_Wps },
+ /* 66 */ { 0, &Ia_movupd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_movsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_movss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f11[4] = {
+ /* -- */ { 0, &Ia_movups_Wps_Vps },
+ /* 66 */ { 0, &Ia_movupd_Wpd_Vpd },
+ /* F2 */ { 0, &Ia_movsd_Wsd_Vsd },
+ /* F3 */ { 0, &Ia_movss_Wss_Vss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupModMOVHLPS[2] = {
+ /* R */ { 0, &Ia_movhlps_Vps_Uq },
+ /* M */ { 0, &Ia_movlps_Vps_Mq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupModMOVHLPD[2] = {
+ /* R */ { 0, &Ia_movhlpd_Vpd_Uq },
+ /* M */ { 0, &Ia_movlpd_Vpd_Mq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f12[4] = {
+ /* -- */ { GRPMOD(MOVHLPS) },
+ /* 66 */ { GRPMOD(MOVHLPD) },
+ /* F2 */ { 0, &Ia_movddup_Vdq_Wq },
+ /* F3 */ { 0, &Ia_movsldup_Vdq_Wdq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f13[4] = {
+ /* -- */ { 0, &Ia_movlps_Mq_Vps },
+ /* 66 */ { 0, &Ia_movlpd_Mq_Vpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f14[4] = {
+ /* -- */ { 0, &Ia_unpcklps_Vps_Wq },
+ /* 66 */ { 0, &Ia_unpcklpd_Vpd_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f15[4] = {
+ /* -- */ { 0, &Ia_unpckhps_Vps_Wdq },
+ /* 66 */ { 0, &Ia_unpckhpd_Vpd_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupModMOVLHPS[2] = {
+ /* R */ { 0, &Ia_movlhps_Vps_Uq },
+ /* M */ { 0, &Ia_movhps_Vps_Mq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupModMOVLHPD[2] = {
+ /* R */ { 0, &Ia_movlhpd_Vpd_Uq },
+ /* M */ { 0, &Ia_movhpd_Vpd_Mq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f16[4] = {
+ /* -- */ { GRPMOD(MOVLHPS) },
+ /* 66 */ { GRPMOD(MOVLHPD) },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_movshdup_Vdq_Wdq },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f17[4] = {
+ /* -- */ { 0, &Ia_movhps_Mq_Vps },
+ /* 66 */ { 0, &Ia_movhpd_Mq_Vpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f28[4] = {
+ /* -- */ { 0, &Ia_movaps_Vps_Wps },
+ /* 66 */ { 0, &Ia_movapd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f29[4] = {
+ /* -- */ { 0, &Ia_movaps_Wps_Vps },
+ /* 66 */ { 0, &Ia_movapd_Wpd_Vpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2a[4] = {
+ /* -- */ { 0, &Ia_cvtpi2ps_Vps_Qq },
+ /* 66 */ { 0, &Ia_cvtpi2pd_Vpd_Qq },
+ /* F2 */ { 0, &Ia_cvtsi2sd_Vsd_Ed },
+ /* F3 */ { 0, &Ia_cvtsi2ss_Vss_Ed }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_640f2a[4] = {
+ /* -- */ { 0, &Ia_cvtpi2ps_Vps_Qq },
+ /* 66 */ { 0, &Ia_cvtpi2pd_Vpd_Qq },
+ /* F2 */ { 0, &Ia_cvtsi2sd_Vsd_Eq },
+ /* F3 */ { 0, &Ia_cvtsi2ss_Vss_Eq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2b[4] = {
+ /* -- */ { 0, &Ia_movntps_Mps_Vps },
+ /* 66 */ { 0, &Ia_movntpd_Mpd_Vpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2c[4] = {
+ /* -- */ { 0, &Ia_cvttps2pi_Pq_Wps },
+ /* 66 */ { 0, &Ia_cvttpd2pi_Pq_Wpd },
+ /* F2 */ { 0, &Ia_cvttsd2si_Gd_Wsd },
+ /* F3 */ { 0, &Ia_cvttss2si_Gd_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2cQ[4] = {
+ /* -- */ { 0, &Ia_cvttps2pi_Pq_Wps },
+ /* 66 */ { 0, &Ia_cvttpd2pi_Pq_Wpd },
+ /* F2 */ { 0, &Ia_cvttsd2si_Gq_Wsd },
+ /* F3 */ { 0, &Ia_cvttss2si_Gq_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2d[4] = {
+ /* -- */ { 0, &Ia_cvtps2pi_Pq_Wps },
+ /* 66 */ { 0, &Ia_cvtpd2pi_Pq_Wpd },
+ /* F2 */ { 0, &Ia_cvtsd2si_Gd_Wsd },
+ /* F3 */ { 0, &Ia_cvtss2si_Gd_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2dQ[4] = {
+ /* -- */ { 0, &Ia_cvtps2pi_Pq_Wps },
+ /* 66 */ { 0, &Ia_cvtpd2pi_Pq_Wpd },
+ /* F2 */ { 0, &Ia_cvtsd2si_Gq_Wsd },
+ /* F3 */ { 0, &Ia_cvtss2si_Gq_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2e[4] = {
+ /* -- */ { 0, &Ia_ucomiss_Vss_Wss },
+ /* 66 */ { 0, &Ia_ucomisd_Vsd_Wss },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f2f[4] = {
+ /* -- */ { 0, &Ia_comiss_Vss_Wss },
+ /* 66 */ { 0, &Ia_comisd_Vsd_Wsd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3800[4] = {
+ /* -- */ { 0, &Ia_pshufb_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_pshufb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3801[4] = {
+ /* -- */ { 0, &Ia_phaddw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_phaddw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3802[4] = {
+ /* -- */ { 0, &Ia_phaddd_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_phaddd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3803[4] = {
+ /* -- */ { 0, &Ia_phaddsw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_phaddsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3804[4] = {
+ /* -- */ { 0, &Ia_pmaddubsw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_pmaddubsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3805[4] = {
+ /* -- */ { 0, &Ia_phsubw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_phsubw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3806[4] = {
+ /* -- */ { 0, &Ia_phsubd_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_phsubd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3807[4] = {
+ /* -- */ { 0, &Ia_phsubsw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_phsubsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3808[4] = {
+ /* -- */ { 0, &Ia_psignb_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_psignb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3809[4] = {
+ /* -- */ { 0, &Ia_psignw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_psignw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f380a[4] = {
+ /* -- */ { 0, &Ia_psignd_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_psignd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f380b[4] = {
+ /* -- */ { 0, &Ia_pmulhrsw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_pmulhrsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f381c[4] = {
+ /* -- */ { 0, &Ia_pabsb_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_pabsb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f381d[4] = {
+ /* -- */ { 0, &Ia_pabsw_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_pabsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f381e[4] = {
+ /* -- */ { 0, &Ia_pabsd_Pq_Qq }, // SSE4
+ /* 66 */ { 0, &Ia_pabsd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f3a0f[4] = {
+ /* -- */ { 0, &Ia_palignr_Pq_Qq_Ib }, // SSE4
+ /* 66 */ { 0, &Ia_palignr_Vdq_Wdq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f50[4] = {
+ /* -- */ { 0, &Ia_movmskps_Gd_Vps },
+ /* 66 */ { 0, &Ia_movmskpd_Gd_Vpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f51[4] = {
+ /* -- */ { 0, &Ia_sqrtps_Vps_Wps },
+ /* 66 */ { 0, &Ia_sqrtpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_sqrtsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_sqrtss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f52[4] = {
+ /* -- */ { 0, &Ia_rsqrtps_Vps_Wps },
+ /* 66 */ { 0, &Ia_Invalid },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_rsqrtss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f53[4] = {
+ /* -- */ { 0, &Ia_rcpps_Vps_Wps },
+ /* 66 */ { 0, &Ia_Invalid },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_rcpss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f54[4] = {
+ /* -- */ { 0, &Ia_andps_Vps_Wps },
+ /* 66 */ { 0, &Ia_andpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f55[4] = {
+ /* -- */ { 0, &Ia_andnps_Vps_Wps },
+ /* 66 */ { 0, &Ia_andnpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f56[4] = {
+ /* -- */ { 0, &Ia_orps_Vps_Wps },
+ /* 66 */ { 0, &Ia_orpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f57[4] = {
+ /* -- */ { 0, &Ia_xorps_Vps_Wps },
+ /* 66 */ { 0, &Ia_xorpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f58[4] = {
+ /* -- */ { 0, &Ia_addps_Vps_Wps },
+ /* 66 */ { 0, &Ia_addpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_addsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_addss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f59[4] = {
+ /* -- */ { 0, &Ia_mulps_Vps_Wps },
+ /* 66 */ { 0, &Ia_mulpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_mulsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_mulss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f5a[4] = {
+ /* -- */ { 0, &Ia_cvtps2pd_Vpd_Wps },
+ /* 66 */ { 0, &Ia_cvtpd2ps_Vps_Wpd },
+ /* F2 */ { 0, &Ia_cvtsd2ss_Vss_Wsd },
+ /* F3 */ { 0, &Ia_cvtss2sd_Vsd_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f5b[4] = {
+ /* -- */ { 0, &Ia_cvtdq2ps_Vps_Wdq },
+ /* 66 */ { 0, &Ia_cvtps2dq_Vdq_Wps },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_cvttps2dq_Vdq_Wps }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f5c[4] = {
+ /* -- */ { 0, &Ia_subps_Vps_Wps },
+ /* 66 */ { 0, &Ia_subpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_subsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_subss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f5d[4] = {
+ /* -- */ { 0, &Ia_minps_Vps_Wps },
+ /* 66 */ { 0, &Ia_minpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_minsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_minss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f5e[4] = {
+ /* -- */ { 0, &Ia_divps_Vps_Wps },
+ /* 66 */ { 0, &Ia_divpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_divsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_divss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f5f[4] = {
+ /* -- */ { 0, &Ia_maxps_Vps_Wps },
+ /* 66 */ { 0, &Ia_maxpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_maxsd_Vsd_Wsd },
+ /* F3 */ { 0, &Ia_maxss_Vss_Wss }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f60[4] = {
+ /* -- */ { 0, &Ia_punpcklbw_Pq_Qd },
+ /* 66 */ { 0, &Ia_punpcklbw_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f61[4] = {
+ /* -- */ { 0, &Ia_punpcklwd_Pq_Qd },
+ /* 66 */ { 0, &Ia_punpcklwd_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f62[4] = {
+ /* -- */ { 0, &Ia_punpckldq_Pq_Qd },
+ /* 66 */ { 0, &Ia_punpckldq_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f63[4] = {
+ /* -- */ { 0, &Ia_packsswb_Pq_Qq },
+ /* 66 */ { 0, &Ia_packsswb_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f64[4] = {
+ /* -- */ { 0, &Ia_pcmpgtb_Pq_Qq },
+ /* 66 */ { 0, &Ia_pcmpgtb_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f65[4] = {
+ /* -- */ { 0, &Ia_pcmpgtw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pcmpgtw_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f66[4] = {
+ /* -- */ { 0, &Ia_pcmpgtd_Pq_Qq },
+ /* 66 */ { 0, &Ia_pcmpgtd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f67[4] = {
+ /* -- */ { 0, &Ia_packuswb_Pq_Qq },
+ /* 66 */ { 0, &Ia_packuswb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f68[4] = {
+ /* -- */ { 0, &Ia_punpckhbw_Pq_Qq },
+ /* 66 */ { 0, &Ia_punpckhbw_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f69[4] = {
+ /* -- */ { 0, &Ia_punpckhwd_Pq_Qq },
+ /* 66 */ { 0, &Ia_punpckhwd_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f6a[4] = {
+ /* -- */ { 0, &Ia_punpckhdq_Pq_Qq },
+ /* 66 */ { 0, &Ia_punpckhdq_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f6b[4] = {
+ /* -- */ { 0, &Ia_packssdw_Pq_Qq },
+ /* 66 */ { 0, &Ia_packssdw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f6c[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_punpcklqdq_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f6d[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_punpckhqdq_Vdq_Wq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f6e[4] = {
+ /* -- */ { 0, &Ia_movd_Pq_Ed },
+ /* 66 */ { 0, &Ia_movd_Vdq_Ed },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f6eQ[4] = {
+ /* -- */ { 0, &Ia_movq_Pq_Eq },
+ /* 66 */ { 0, &Ia_movq_Vdq_Eq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f6f[4] = {
+ /* -- */ { 0, &Ia_movq_Pq_Qq },
+ /* 66 */ { 0, &Ia_movdqa_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_movdqu_Vdq_Wdq },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f70[4] = {
+ /* -- */ { 0, &Ia_pshufw_Pq_Qq_Ib },
+ /* 66 */ { 0, &Ia_pshufd_Vdq_Wdq_Ib },
+ /* F2 */ { 0, &Ia_pshufhw_Vq_Wq_Ib },
+ /* F3 */ { 0, &Ia_pshuflw_Vq_Wq_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f74[4] = {
+ /* -- */ { 0, &Ia_pcmpeqb_Pq_Qq },
+ /* 66 */ { 0, &Ia_pcmpeqb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f75[4] = {
+ /* -- */ { 0, &Ia_pcmpeqw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pcmpeqw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f76[4] = {
+ /* -- */ { 0, &Ia_pcmpeqd_Pq_Qq },
+ /* 66 */ { 0, &Ia_pcmpeqd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f7c[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_haddpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_haddps_Vps_Wps },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f7d[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_hsubpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_hsubps_Vps_Wps },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f7e[4] = {
+ /* -- */ { 0, &Ia_movd_Ed_Pq },
+ /* 66 */ { 0, &Ia_movd_Ed_Vd },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_movq_Vq_Wq },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f7eQ[4] = {
+ /* -- */ { 0, &Ia_movq_Eq_Pq },
+ /* 66 */ { 0, &Ia_movq_Eq_Vq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_movq_Vq_Wq },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0f7f[4] = {
+ /* -- */ { 0, &Ia_movq_Qq_Pq },
+ /* 66 */ { 0, &Ia_movdqa_Wdq_Vdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_movdqu_Wdq_Vdq },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fc2[4] = {
+ /* -- */ { 0, &Ia_cmpps_Vps_Wps_Ib },
+ /* 66 */ { 0, &Ia_cmppd_Vpd_Wpd_Ib },
+ /* F2 */ { 0, &Ia_cmpsd_Vsd_Wsd_Ib },
+ /* F3 */ { 0, &Ia_cmpss_Vss_Wss_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fc3[4] = {
+ /* -- */ { 0, &Ia_movnti_Md_Gd },
+ /* 66 */ { 0, &Ia_Invalid },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_640fc3[4] = {
+ /* -- */ { 0, &Ia_movntiq_Mq_Gq },
+ /* 66 */ { 0, &Ia_Invalid },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fc4[4] = {
+ /* -- */ { 0, &Ia_pinsrw_Pq_Ed_Ib },
+ /* 66 */ { 0, &Ia_pinsrw_Vdq_Ed_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fc5[4] = {
+ /* -- */ { 0, &Ia_pextrw_Gd_Nq_Ib },
+ /* 66 */ { 0, &Ia_pextrw_Gd_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fc6[4] = {
+ /* -- */ { 0, &Ia_shufps_Vps_Wps_Ib },
+ /* 66 */ { 0, &Ia_shufpd_Vpd_Wpd_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd0[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_addsubpd_Vpd_Wpd },
+ /* F2 */ { 0, &Ia_addsubps_Vps_Wps },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd1[4] = {
+ /* -- */ { 0, &Ia_psrlw_Pq_Qq },
+ /* 66 */ { 0, &Ia_psrlw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd2[4] = {
+ /* -- */ { 0, &Ia_psrld_Pq_Qq },
+ /* 66 */ { 0, &Ia_psrld_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd3[4] = {
+ /* -- */ { 0, &Ia_psrlq_Pq_Qq },
+ /* 66 */ { 0, &Ia_psrlq_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd4[4] = {
+ /* -- */ { 0, &Ia_paddq_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddq_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd5[4] = {
+ /* -- */ { 0, &Ia_pmullw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pmullw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd6[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_movq_Wq_Vq },
+ /* F2 */ { 0, &Ia_movdq2q_Pq_Vq },
+ /* F3 */ { 0, &Ia_movq2dq_Vdq_Qq },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd7[4] = {
+ /* -- */ { 0, &Ia_pmovmskb_Gd_Nq },
+ /* 66 */ { 0, &Ia_pmovmskb_Gd_Udq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd8[4] = {
+ /* -- */ { 0, &Ia_psubusb_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubusb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fd9[4] = {
+ /* -- */ { 0, &Ia_psubusw_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubusw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fda[4] = {
+ /* -- */ { 0, &Ia_pminub_Pq_Qq },
+ /* 66 */ { 0, &Ia_pminub_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fdb[4] = {
+ /* -- */ { 0, &Ia_pand_Pq_Qq },
+ /* 66 */ { 0, &Ia_pand_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fdc[4] = {
+ /* -- */ { 0, &Ia_paddusb_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddusb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fdd[4] = {
+ /* -- */ { 0, &Ia_paddusw_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddusw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fde[4] = {
+ /* -- */ { 0, &Ia_pmaxub_Pq_Qq },
+ /* 66 */ { 0, &Ia_pmaxub_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fdf[4] = {
+ /* -- */ { 0, &Ia_pandn_Pq_Qq },
+ /* 66 */ { 0, &Ia_pandn_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe0[4] = {
+ /* -- */ { 0, &Ia_pavgb_Pq_Qq },
+ /* 66 */ { 0, &Ia_pavgb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe1[4] = {
+ /* -- */ { 0, &Ia_psraw_Pq_Qq },
+ /* 66 */ { 0, &Ia_psraw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe2[4] = {
+ /* -- */ { 0, &Ia_psrad_Pq_Qq },
+ /* 66 */ { 0, &Ia_psrad_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe3[4] = {
+ /* -- */ { 0, &Ia_pavgw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pavgw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe4[4] = {
+ /* -- */ { 0, &Ia_pmulhuw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pmulhuw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe5[4] = {
+ /* -- */ { 0, &Ia_pmulhw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pmulhw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe6[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_cvttpd2dq_Vq_Wpd },
+ /* F2 */ { 0, &Ia_cvtpd2dq_Vq_Wpd },
+ /* F3 */ { 0, &Ia_cvtdq2pd_Vpd_Wq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe7[4] = {
+ /* -- */ { 0, &Ia_movntq_Mq_Pq },
+ /* 66 */ { 0, &Ia_movntdq_Mdq_Vdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe8[4] = {
+ /* -- */ { 0, &Ia_psubsb_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubsb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fe9[4] = {
+ /* -- */ { 0, &Ia_psubsw_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fea[4] = {
+ /* -- */ { 0, &Ia_pminsw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pminsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0feb[4] = {
+ /* -- */ { 0, &Ia_por_Pq_Qq },
+ /* 66 */ { 0, &Ia_por_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fec[4] = {
+ /* -- */ { 0, &Ia_paddsb_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddsb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fed[4] = {
+ /* -- */ { 0, &Ia_paddsw_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddsw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fee[4] = {
+ /* -- */ { 0, &Ia_pmaxuw_Pq_Qq },
+ /* 66 */ { 0, &Ia_pmaxuw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0fef[4] = {
+ /* -- */ { 0, &Ia_pxor_Pq_Qq },
+ /* 66 */ { 0, &Ia_pxor_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff0[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_lddqu_Vdq_Mdq },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff1[4] = {
+ /* -- */ { 0, &Ia_psllw_Pq_Qq },
+ /* 66 */ { 0, &Ia_psllw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff2[4] = {
+ /* -- */ { 0, &Ia_pslld_Pq_Qq },
+ /* 66 */ { 0, &Ia_pslld_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff3[4] = {
+ /* -- */ { 0, &Ia_psllq_Pq_Qq },
+ /* 66 */ { 0, &Ia_psllq_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff4[4] = {
+ /* -- */ { 0, &Ia_pmuludq_Pq_Qq },
+ /* 66 */ { 0, &Ia_pmuludq_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff5[4] = {
+ /* -- */ { 0, &Ia_pmaddwd_Pq_Qq },
+ /* 66 */ { 0, &Ia_pmaddwd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff6[4] = {
+ /* -- */ { 0, &Ia_psadbw_Pq_Qq },
+ /* 66 */ { 0, &Ia_psadbw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff7[4] = {
+ /* -- */ { 0, &Ia_maskmovq_Pq_Nq },
+ /* 66 */ { 0, &Ia_maskmovdqu_Vdq_Udq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff8[4] = {
+ /* -- */ { 0, &Ia_psubb_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ff9[4] = {
+ /* -- */ { 0, &Ia_psubw_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ffa[4] = {
+ /* -- */ { 0, &Ia_psubd_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ffb[4] = {
+ /* -- */ { 0, &Ia_psubq_Pq_Qq },
+ /* 66 */ { 0, &Ia_psubq_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ffc[4] = {
+ /* -- */ { 0, &Ia_paddb_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddb_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ffd[4] = {
+ /* -- */ { 0, &Ia_paddw_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddw_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_0ffe[4] = {
+ /* -- */ { 0, &Ia_paddd_Pq_Qq },
+ /* 66 */ { 0, &Ia_paddd_Vdq_Wdq },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1202[4] = {
+ /* -- */ { 0, &Ia_psrlw_Nq_Ib },
+ /* 66 */ { 0, &Ia_psrlw_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1204[4] = {
+ /* -- */ { 0, &Ia_psraw_Nq_Ib },
+ /* 66 */ { 0, &Ia_psraw_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1206[4] = {
+ /* -- */ { 0, &Ia_psllw_Nq_Ib },
+ /* 66 */ { 0, &Ia_psllw_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1302[4] = {
+ /* -- */ { 0, &Ia_psrld_Nq_Ib },
+ /* 66 */ { 0, &Ia_psrld_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1304[4] = {
+ /* -- */ { 0, &Ia_psrad_Nq_Ib },
+ /* 66 */ { 0, &Ia_psrad_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1306[4] = {
+ /* -- */ { 0, &Ia_pslld_Nq_Ib },
+ /* 66 */ { 0, &Ia_pslld_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1402[4] = {
+ /* -- */ { 0, &Ia_psrlq_Nq_Ib },
+ /* 66 */ { 0, &Ia_psrlq_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1403[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_psrldq_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1406[4] = {
+ /* -- */ { 0, &Ia_psllq_Nq_Ib },
+ /* 66 */ { 0, &Ia_psllq_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupSSE_G1407[4] = {
+ /* -- */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_pslldq_Udq_Ib },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid }
+};
+
+
+/* ************************************************************************ */
+/* Opcode GroupN */
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG1EbIb[8] = {
+ /* 0 */ { 0, &Ia_addb_Eb_Ib },
+ /* 1 */ { 0, &Ia_orb_Eb_Ib },
+ /* 2 */ { 0, &Ia_adcb_Eb_Ib },
+ /* 3 */ { 0, &Ia_sbbb_Eb_Ib },
+ /* 4 */ { 0, &Ia_andb_Eb_Ib },
+ /* 5 */ { 0, &Ia_subb_Eb_Ib },
+ /* 6 */ { 0, &Ia_xorb_Eb_Ib },
+ /* 7 */ { 0, &Ia_cmpb_Eb_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG1EwIw[8] = {
+ /* 0 */ { 0, &Ia_addw_Ew_Iw },
+ /* 1 */ { 0, &Ia_orw_Ew_Iw },
+ /* 2 */ { 0, &Ia_adcw_Ew_Iw },
+ /* 3 */ { 0, &Ia_sbbw_Ew_Iw },
+ /* 4 */ { 0, &Ia_andw_Ew_Iw },
+ /* 5 */ { 0, &Ia_subw_Ew_Iw },
+ /* 6 */ { 0, &Ia_xorw_Ew_Iw },
+ /* 7 */ { 0, &Ia_cmpw_Ew_Iw }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG1EdId[8] = {
+ /* 0 */ { 0, &Ia_addl_Ed_Id },
+ /* 1 */ { 0, &Ia_orl_Ed_Id },
+ /* 2 */ { 0, &Ia_adcl_Ed_Id },
+ /* 3 */ { 0, &Ia_sbbl_Ed_Id },
+ /* 4 */ { 0, &Ia_andl_Ed_Id },
+ /* 5 */ { 0, &Ia_subl_Ed_Id },
+ /* 6 */ { 0, &Ia_xorl_Ed_Id },
+ /* 7 */ { 0, &Ia_cmpl_Ed_Id }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG1EqId[8] = {
+ /* 0 */ { 0, &Ia_addq_Eq_sId },
+ /* 1 */ { 0, &Ia_orq_Eq_sId },
+ /* 2 */ { 0, &Ia_adcq_Eq_sId },
+ /* 3 */ { 0, &Ia_sbbq_Eq_sId },
+ /* 4 */ { 0, &Ia_andq_Eq_sId },
+ /* 5 */ { 0, &Ia_subq_Eq_sId },
+ /* 6 */ { 0, &Ia_xorq_Eq_sId },
+ /* 7 */ { 0, &Ia_cmpq_Eq_sId }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG1EwIb[8] = {
+ /* 0 */ { 0, &Ia_addw_Ew_sIb }, // sign-extend byte
+ /* 1 */ { 0, &Ia_orw_Ew_sIb },
+ /* 2 */ { 0, &Ia_adcw_Ew_sIb },
+ /* 3 */ { 0, &Ia_sbbw_Ew_sIb },
+ /* 4 */ { 0, &Ia_andw_Ew_sIb },
+ /* 5 */ { 0, &Ia_subw_Ew_sIb },
+ /* 6 */ { 0, &Ia_xorw_Ew_sIb },
+ /* 7 */ { 0, &Ia_cmpw_Ew_sIb }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG1EdIb[8] = {
+ /* 0 */ { 0, &Ia_addl_Ed_sIb }, // sign-extend byte
+ /* 1 */ { 0, &Ia_orl_Ed_sIb },
+ /* 2 */ { 0, &Ia_adcl_Ed_sIb },
+ /* 3 */ { 0, &Ia_sbbl_Ed_sIb },
+ /* 4 */ { 0, &Ia_andl_Ed_sIb },
+ /* 5 */ { 0, &Ia_subl_Ed_sIb },
+ /* 6 */ { 0, &Ia_xorl_Ed_sIb },
+ /* 7 */ { 0, &Ia_cmpl_Ed_sIb }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG1EqIb[8] = {
+ /* 0 */ { 0, &Ia_addq_Eq_sIb }, // sign-extend byte
+ /* 1 */ { 0, &Ia_orq_Eq_sIb },
+ /* 2 */ { 0, &Ia_adcq_Eq_sIb },
+ /* 3 */ { 0, &Ia_sbbq_Eq_sIb },
+ /* 4 */ { 0, &Ia_andq_Eq_sIb },
+ /* 5 */ { 0, &Ia_subq_Eq_sIb },
+ /* 6 */ { 0, &Ia_xorq_Eq_sIb },
+ /* 7 */ { 0, &Ia_cmpq_Eq_sIb }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2Eb[8] = {
+ /* 0 */ { 0, &Ia_rolb_Eb_Ib },
+ /* 1 */ { 0, &Ia_rorb_Eb_Ib },
+ /* 2 */ { 0, &Ia_rclb_Eb_Ib },
+ /* 3 */ { 0, &Ia_rcrb_Eb_Ib },
+ /* 4 */ { 0, &Ia_shlb_Eb_Ib },
+ /* 5 */ { 0, &Ia_shrb_Eb_Ib },
+ /* 6 */ { 0, &Ia_shlb_Eb_Ib },
+ /* 7 */ { 0, &Ia_sarb_Eb_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EbI1[8] = {
+ /* 0 */ { 0, &Ia_rolb_Eb_I1 },
+ /* 1 */ { 0, &Ia_rorb_Eb_I1 },
+ /* 2 */ { 0, &Ia_rclb_Eb_I1 },
+ /* 3 */ { 0, &Ia_rcrb_Eb_I1 },
+ /* 4 */ { 0, &Ia_shlb_Eb_I1 },
+ /* 5 */ { 0, &Ia_shrb_Eb_I1 },
+ /* 6 */ { 0, &Ia_shlb_Eb_I1 },
+ /* 7 */ { 0, &Ia_sarb_Eb_I1 }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EbCL[8] = {
+ /* 0 */ { 0, &Ia_rolb_Eb_CL },
+ /* 1 */ { 0, &Ia_rorb_Eb_CL },
+ /* 2 */ { 0, &Ia_rclb_Eb_CL },
+ /* 3 */ { 0, &Ia_rcrb_Eb_CL },
+ /* 4 */ { 0, &Ia_shlb_Eb_CL },
+ /* 5 */ { 0, &Ia_shrb_Eb_CL },
+ /* 6 */ { 0, &Ia_shlb_Eb_CL },
+ /* 7 */ { 0, &Ia_sarb_Eb_CL }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2Ew[8] = {
+ /* 0 */ { 0, &Ia_rolw_Ew_Ib },
+ /* 1 */ { 0, &Ia_rorw_Ew_Ib },
+ /* 2 */ { 0, &Ia_rclw_Ew_Ib },
+ /* 3 */ { 0, &Ia_rcrw_Ew_Ib },
+ /* 4 */ { 0, &Ia_shlw_Ew_Ib },
+ /* 5 */ { 0, &Ia_shrw_Ew_Ib },
+ /* 6 */ { 0, &Ia_shlw_Ew_Ib },
+ /* 7 */ { 0, &Ia_sarw_Ew_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2Ed[8] = {
+ /* 0 */ { 0, &Ia_roll_Ed_Ib },
+ /* 1 */ { 0, &Ia_rorl_Ed_Ib },
+ /* 2 */ { 0, &Ia_rcll_Ed_Ib },
+ /* 3 */ { 0, &Ia_rcrl_Ed_Ib },
+ /* 4 */ { 0, &Ia_shll_Ed_Ib },
+ /* 5 */ { 0, &Ia_shrl_Ed_Ib },
+ /* 6 */ { 0, &Ia_shll_Ed_Ib },
+ /* 7 */ { 0, &Ia_sarl_Ed_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2Eq[8] = {
+ /* 0 */ { 0, &Ia_rolq_Eq_Ib },
+ /* 1 */ { 0, &Ia_rorq_Eq_Ib },
+ /* 2 */ { 0, &Ia_rclq_Eq_Ib },
+ /* 3 */ { 0, &Ia_rcrq_Eq_Ib },
+ /* 4 */ { 0, &Ia_shlq_Eq_Ib },
+ /* 5 */ { 0, &Ia_shrq_Eq_Ib },
+ /* 6 */ { 0, &Ia_shlq_Eq_Ib },
+ /* 7 */ { 0, &Ia_sarq_Eq_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EwI1[8] = {
+ /* 0 */ { 0, &Ia_rolw_Ew_I1 },
+ /* 1 */ { 0, &Ia_rorw_Ew_I1 },
+ /* 2 */ { 0, &Ia_rclw_Ew_I1 },
+ /* 3 */ { 0, &Ia_rcrw_Ew_I1 },
+ /* 4 */ { 0, &Ia_shlw_Ew_I1 },
+ /* 5 */ { 0, &Ia_shrw_Ew_I1 },
+ /* 6 */ { 0, &Ia_shlw_Ew_I1 },
+ /* 7 */ { 0, &Ia_sarw_Ew_I1 }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EdI1[8] = {
+ /* 0 */ { 0, &Ia_roll_Ed_I1 },
+ /* 1 */ { 0, &Ia_rorl_Ed_I1 },
+ /* 2 */ { 0, &Ia_rcll_Ed_I1 },
+ /* 3 */ { 0, &Ia_rcrl_Ed_I1 },
+ /* 4 */ { 0, &Ia_shll_Ed_I1 },
+ /* 5 */ { 0, &Ia_shrl_Ed_I1 },
+ /* 6 */ { 0, &Ia_shll_Ed_I1 },
+ /* 7 */ { 0, &Ia_sarl_Ed_I1 }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EqI1[8] = {
+ /* 0 */ { 0, &Ia_rolq_Eq_I1 },
+ /* 1 */ { 0, &Ia_rorq_Eq_I1 },
+ /* 2 */ { 0, &Ia_rclq_Eq_I1 },
+ /* 3 */ { 0, &Ia_rcrq_Eq_I1 },
+ /* 4 */ { 0, &Ia_shlq_Eq_I1 },
+ /* 5 */ { 0, &Ia_shrq_Eq_I1 },
+ /* 6 */ { 0, &Ia_shlq_Eq_I1 },
+ /* 7 */ { 0, &Ia_sarq_Eq_I1 }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EwCL[8] = {
+ /* 0 */ { 0, &Ia_rolw_Ew_CL },
+ /* 1 */ { 0, &Ia_rorw_Ew_CL },
+ /* 2 */ { 0, &Ia_rclw_Ew_CL },
+ /* 3 */ { 0, &Ia_rcrw_Ew_CL },
+ /* 4 */ { 0, &Ia_shlw_Ew_CL },
+ /* 5 */ { 0, &Ia_shrw_Ew_CL },
+ /* 6 */ { 0, &Ia_shlw_Ew_CL },
+ /* 7 */ { 0, &Ia_sarw_Ew_CL }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EdCL[8] = {
+ /* 0 */ { 0, &Ia_roll_Ed_CL },
+ /* 1 */ { 0, &Ia_rorl_Ed_CL },
+ /* 2 */ { 0, &Ia_rcll_Ed_CL },
+ /* 3 */ { 0, &Ia_rcrl_Ed_CL },
+ /* 4 */ { 0, &Ia_shll_Ed_CL },
+ /* 5 */ { 0, &Ia_shrl_Ed_CL },
+ /* 6 */ { 0, &Ia_shll_Ed_CL },
+ /* 7 */ { 0, &Ia_sarl_Ed_CL }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG2EqCL[8] = {
+ /* 0 */ { 0, &Ia_rolq_Eq_CL },
+ /* 1 */ { 0, &Ia_rorq_Eq_CL },
+ /* 2 */ { 0, &Ia_rclq_Eq_CL },
+ /* 3 */ { 0, &Ia_rcrq_Eq_CL },
+ /* 4 */ { 0, &Ia_shlq_Eq_CL },
+ /* 5 */ { 0, &Ia_shrq_Eq_CL },
+ /* 6 */ { 0, &Ia_shlq_Eq_CL },
+ /* 7 */ { 0, &Ia_sarq_Eq_CL }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG3Eb[8] = {
+ /* 0 */ { 0, &Ia_testb_Eb_Ib },
+ /* 1 */ { 0, &Ia_testb_Eb_Ib },
+ /* 2 */ { 0, &Ia_notb_Eb },
+ /* 3 */ { 0, &Ia_negb_Eb },
+ /* 4 */ { 0, &Ia_mulb_AL_Eb },
+ /* 5 */ { 0, &Ia_imulb_AL_Eb },
+ /* 6 */ { 0, &Ia_divb_AL_Eb },
+ /* 7 */ { 0, &Ia_idivb_AL_Eb }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG3Ew[8] = {
+ /* 0 */ { 0, &Ia_testw_Ew_Iw },
+ /* 1 */ { 0, &Ia_testw_Ew_Iw },
+ /* 2 */ { 0, &Ia_notw_Ew },
+ /* 3 */ { 0, &Ia_negw_Ew },
+ /* 4 */ { 0, &Ia_mulw_AX_Ew },
+ /* 5 */ { 0, &Ia_imulw_AX_Ew },
+ /* 6 */ { 0, &Ia_divw_AX_Ew },
+ /* 7 */ { 0, &Ia_idivw_AX_Ew }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG3Ed[8] = {
+ /* 0 */ { 0, &Ia_testl_Ed_Id },
+ /* 1 */ { 0, &Ia_testl_Ed_Id },
+ /* 2 */ { 0, &Ia_notl_Ed },
+ /* 3 */ { 0, &Ia_negl_Ed },
+ /* 4 */ { 0, &Ia_mull_EAX_Ed },
+ /* 5 */ { 0, &Ia_imull_EAX_Ed },
+ /* 6 */ { 0, &Ia_divl_EAX_Ed },
+ /* 7 */ { 0, &Ia_idivl_EAX_Ed }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG3Eq[8] = {
+ /* 0 */ { 0, &Ia_testq_Eq_sId },
+ /* 1 */ { 0, &Ia_testq_Eq_sId },
+ /* 2 */ { 0, &Ia_notq_Eq },
+ /* 3 */ { 0, &Ia_negq_Eq },
+ /* 4 */ { 0, &Ia_mulq_RAX_Eq },
+ /* 5 */ { 0, &Ia_imulq_RAX_Eq },
+ /* 6 */ { 0, &Ia_divq_RAX_Eq },
+ /* 7 */ { 0, &Ia_idivq_RAX_Eq }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG4[8] = {
+ /* 0 */ { 0, &Ia_incb_Eb },
+ /* 1 */ { 0, &Ia_decb_Eb },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG5w[8] = {
+ /* 0 */ { 0, &Ia_incw_Ew },
+ /* 1 */ { 0, &Ia_decw_Ew },
+ /* 2 */ { 0, &Ia_call_Ew },
+ /* 3 */ { 0, &Ia_lcall_Mp },
+ /* 4 */ { 0, &Ia_jmp_Ew },
+ /* 5 */ { 0, &Ia_ljmp_Mp },
+ /* 6 */ { 0, &Ia_pushw_Ew },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG5d[8] = {
+ /* 0 */ { 0, &Ia_incl_Ed },
+ /* 1 */ { 0, &Ia_decl_Ed },
+ /* 2 */ { 0, &Ia_call_Ed },
+ /* 3 */ { 0, &Ia_lcall_Mp },
+ /* 4 */ { 0, &Ia_jmp_Ed },
+ /* 5 */ { 0, &Ia_ljmp_Mp },
+ /* 6 */ { 0, &Ia_pushl_Ed },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroup64G5d[8] = {
+ /* 0 */ { 0, &Ia_incl_Ed },
+ /* 1 */ { 0, &Ia_decl_Ed },
+ /* 2 */ { 0, &Ia_call_Eq },
+ /* 3 */ { 0, &Ia_lcall_Mp },
+ /* 4 */ { 0, &Ia_jmp_Eq },
+ /* 5 */ { 0, &Ia_ljmp_Mp },
+ /* 6 */ { 0, &Ia_pushq_Eq },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroup64G5q[8] = {
+ /* 0 */ { 0, &Ia_incq_Eq },
+ /* 1 */ { 0, &Ia_decq_Eq },
+ /* 2 */ { 0, &Ia_call_Eq },
+ /* 3 */ { 0, &Ia_lcall_Mp },
+ /* 4 */ { 0, &Ia_jmp_Eq },
+ /* 5 */ { 0, &Ia_ljmp_Mp },
+ /* 6 */ { 0, &Ia_pushq_Eq },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG6[8] = {
+ /* 0 */ { 0, &Ia_sldt },
+ /* 1 */ { 0, &Ia_str },
+ /* 2 */ { 0, &Ia_lldt },
+ /* 3 */ { 0, &Ia_ltr },
+ /* 4 */ { 0, &Ia_verr },
+ /* 5 */ { 0, &Ia_verw },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupRmINVLPG[8] = {
+ /* 0 */ { 0, &Ia_swapgs },
+ /* 1 */ { 0, &Ia_rdtscp },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_Invalid },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupModINVLPG[2] = {
+ /* R */ { GRPRM(INVLPG) },
+ /* M */ { 0, &Ia_invlpg }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupRmSIDT[8] = {
+ /* 0 */ { 0, &Ia_monitor },
+ /* 1 */ { 0, &Ia_mwait },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_Invalid },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupModSIDT[2] = {
+ /* R */ { GRPRM(SIDT) },
+ /* M */ { 0, &Ia_sidt }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG7[8] = {
+ /* 0 */ { 0, &Ia_sgdt },
+ /* 1 */ { GRPMOD(SIDT) },
+ /* 2 */ { 0, &Ia_lgdt },
+ /* 3 */ { 0, &Ia_lidt },
+ /* 4 */ { 0, &Ia_smsw_Ew },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_lmsw_Ew },
+ /* 7 */ { GRPMOD(INVLPG) },
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG8EwIb[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_Invalid },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_btw_Ew_Ib },
+ /* 5 */ { 0, &Ia_btsw_Ew_Ib },
+ /* 6 */ { 0, &Ia_btrw_Ew_Ib },
+ /* 7 */ { 0, &Ia_btcw_Ew_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG8EdIb[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_Invalid },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_btl_Ed_Ib },
+ /* 5 */ { 0, &Ia_btsl_Ed_Ib },
+ /* 6 */ { 0, &Ia_btrl_Ed_Ib },
+ /* 7 */ { 0, &Ia_btcl_Ed_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG8EqIb[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_Invalid },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_btq_Eq_Ib },
+ /* 5 */ { 0, &Ia_btsq_Eq_Ib },
+ /* 6 */ { 0, &Ia_btrq_Eq_Ib },
+ /* 7 */ { 0, &Ia_btcq_Eq_Ib }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG9[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_cmpxchg8b },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG9q[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_cmpxchg16b },
+ /* 2 */ { 0, &Ia_Invalid },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG12[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_Invalid },
+ /* 2 */ { GRPSSE(G1202) },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { GRPSSE(G1204) },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { GRPSSE(G1206) },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG13[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_Invalid },
+ /* 2 */ { GRPSSE(G1302) },
+ /* 3 */ { 0, &Ia_Invalid },
+ /* 4 */ { GRPSSE(G1304) },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { GRPSSE(G1306) },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG14[8] = {
+ /* 0 */ { 0, &Ia_Invalid },
+ /* 1 */ { 0, &Ia_Invalid },
+ /* 2 */ { GRPSSE(G1402) },
+ /* 3 */ { GRPSSE(G1403) },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { GRPSSE(G1406) },
+ /* 7 */ { GRPSSE(G1407) }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupModCFLUSH[2] = {
+ /* R */ { 0, &Ia_sfence },
+ /* M */ { 0, &Ia_cflush }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG15[8] = {
+ /* 0 */ { 0, &Ia_fxsave },
+ /* 1 */ { 0, &Ia_fxrstor },
+ /* 2 */ { 0, &Ia_ldmxcsr },
+ /* 3 */ { 0, &Ia_stmxcsr },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_lfence },
+ /* 6 */ { 0, &Ia_mfence },
+ /* 7 */ { GRPMOD(CFLUSH) } /* SFENCE/CFLUSH */
+};
+
+static BxDisasmOpcodeTable_t BxDisasmGroupG16[8] =
+{
+ /* 0 */ { 0, &Ia_prefetchnta },
+ /* 1 */ { 0, &Ia_prefetcht0 },
+ /* 2 */ { 0, &Ia_prefetcht1 },
+ /* 3 */ { 0, &Ia_prefetcht2 },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_Invalid }
+};
+
+/* ************************************************************************ */
+/* 3DNow! opcodes */
+
+static BxDisasmOpcodeTable_t BxDisasm3DNowGroup[256] = {
+ // 256 entries for 3DNow opcodes_by suffix
+ /* 00 */ { 0, &Ia_Invalid },
+ /* 01 */ { 0, &Ia_Invalid },
+ /* 02 */ { 0, &Ia_Invalid },
+ /* 03 */ { 0, &Ia_Invalid },
+ /* 04 */ { 0, &Ia_Invalid },
+ /* 05 */ { 0, &Ia_Invalid },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_Invalid },
+ /* 09 */ { 0, &Ia_Invalid },
+ /* 0A */ { 0, &Ia_Invalid },
+ /* 0B */ { 0, &Ia_Invalid },
+ /* 0C */ { 0, &Ia_pi2fw_Pq_Qq },
+ /* 0D */ { 0, &Ia_pi2fd_Pq_Qq },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { 0, &Ia_Invalid },
+ /* 10 */ { 0, &Ia_Invalid },
+ /* 11 */ { 0, &Ia_Invalid },
+ /* 12 */ { 0, &Ia_Invalid },
+ /* 13 */ { 0, &Ia_Invalid },
+ /* 14 */ { 0, &Ia_Invalid },
+ /* 15 */ { 0, &Ia_Invalid },
+ /* 16 */ { 0, &Ia_Invalid },
+ /* 17 */ { 0, &Ia_Invalid },
+ /* 18 */ { 0, &Ia_Invalid },
+ /* 19 */ { 0, &Ia_Invalid },
+ /* 1A */ { 0, &Ia_Invalid },
+ /* 1B */ { 0, &Ia_Invalid },
+ /* 1C */ { 0, &Ia_pf2iw_Pq_Qq },
+ /* 1D */ { 0, &Ia_pf2id_Pq_Qq },
+ /* 1E */ { 0, &Ia_Invalid },
+ /* 1F */ { 0, &Ia_Invalid },
+ /* 20 */ { 0, &Ia_Invalid },
+ /* 21 */ { 0, &Ia_Invalid },
+ /* 22 */ { 0, &Ia_Invalid },
+ /* 23 */ { 0, &Ia_Invalid },
+ /* 24 */ { 0, &Ia_Invalid },
+ /* 25 */ { 0, &Ia_Invalid },
+ /* 26 */ { 0, &Ia_Invalid },
+ /* 27 */ { 0, &Ia_Invalid },
+ /* 28 */ { 0, &Ia_Invalid },
+ /* 29 */ { 0, &Ia_Invalid },
+ /* 2A */ { 0, &Ia_Invalid },
+ /* 2B */ { 0, &Ia_Invalid },
+ /* 2C */ { 0, &Ia_Invalid },
+ /* 2D */ { 0, &Ia_Invalid },
+ /* 2E */ { 0, &Ia_Invalid },
+ /* 2F */ { 0, &Ia_Invalid },
+ /* 30 */ { 0, &Ia_Invalid },
+ /* 31 */ { 0, &Ia_Invalid },
+ /* 32 */ { 0, &Ia_Invalid },
+ /* 33 */ { 0, &Ia_Invalid },
+ /* 34 */ { 0, &Ia_Invalid },
+ /* 35 */ { 0, &Ia_Invalid },
+ /* 36 */ { 0, &Ia_Invalid },
+ /* 37 */ { 0, &Ia_Invalid },
+ /* 38 */ { 0, &Ia_Invalid },
+ /* 39 */ { 0, &Ia_Invalid },
+ /* 3A */ { 0, &Ia_Invalid },
+ /* 3B */ { 0, &Ia_Invalid },
+ /* 3C */ { 0, &Ia_Invalid },
+ /* 3D */ { 0, &Ia_Invalid },
+ /* 3E */ { 0, &Ia_Invalid },
+ /* 3F */ { 0, &Ia_Invalid },
+ /* 40 */ { 0, &Ia_Invalid },
+ /* 41 */ { 0, &Ia_Invalid },
+ /* 42 */ { 0, &Ia_Invalid },
+ /* 43 */ { 0, &Ia_Invalid },
+ /* 44 */ { 0, &Ia_Invalid },
+ /* 45 */ { 0, &Ia_Invalid },
+ /* 46 */ { 0, &Ia_Invalid },
+ /* 47 */ { 0, &Ia_Invalid },
+ /* 48 */ { 0, &Ia_Invalid },
+ /* 49 */ { 0, &Ia_Invalid },
+ /* 4A */ { 0, &Ia_Invalid },
+ /* 4B */ { 0, &Ia_Invalid },
+ /* 4C */ { 0, &Ia_Invalid },
+ /* 4D */ { 0, &Ia_Invalid },
+ /* 4E */ { 0, &Ia_Invalid },
+ /* 4F */ { 0, &Ia_Invalid },
+ /* 50 */ { 0, &Ia_Invalid },
+ /* 51 */ { 0, &Ia_Invalid },
+ /* 52 */ { 0, &Ia_Invalid },
+ /* 53 */ { 0, &Ia_Invalid },
+ /* 54 */ { 0, &Ia_Invalid },
+ /* 55 */ { 0, &Ia_Invalid },
+ /* 56 */ { 0, &Ia_Invalid },
+ /* 57 */ { 0, &Ia_Invalid },
+ /* 58 */ { 0, &Ia_Invalid },
+ /* 59 */ { 0, &Ia_Invalid },
+ /* 5A */ { 0, &Ia_Invalid },
+ /* 5B */ { 0, &Ia_Invalid },
+ /* 5C */ { 0, &Ia_Invalid },
+ /* 5D */ { 0, &Ia_Invalid },
+ /* 5E */ { 0, &Ia_Invalid },
+ /* 5F */ { 0, &Ia_Invalid },
+ /* 60 */ { 0, &Ia_Invalid },
+ /* 61 */ { 0, &Ia_Invalid },
+ /* 62 */ { 0, &Ia_Invalid },
+ /* 63 */ { 0, &Ia_Invalid },
+ /* 64 */ { 0, &Ia_Invalid },
+ /* 65 */ { 0, &Ia_Invalid },
+ /* 66 */ { 0, &Ia_Invalid },
+ /* 67 */ { 0, &Ia_Invalid },
+ /* 68 */ { 0, &Ia_Invalid },
+ /* 69 */ { 0, &Ia_Invalid },
+ /* 6A */ { 0, &Ia_Invalid },
+ /* 6B */ { 0, &Ia_Invalid },
+ /* 6C */ { 0, &Ia_Invalid },
+ /* 6D */ { 0, &Ia_Invalid },
+ /* 6E */ { 0, &Ia_Invalid },
+ /* 6F */ { 0, &Ia_Invalid },
+ /* 70 */ { 0, &Ia_Invalid },
+ /* 71 */ { 0, &Ia_Invalid },
+ /* 72 */ { 0, &Ia_Invalid },
+ /* 73 */ { 0, &Ia_Invalid },
+ /* 74 */ { 0, &Ia_Invalid },
+ /* 75 */ { 0, &Ia_Invalid },
+ /* 76 */ { 0, &Ia_Invalid },
+ /* 77 */ { 0, &Ia_Invalid },
+ /* 78 */ { 0, &Ia_Invalid },
+ /* 79 */ { 0, &Ia_Invalid },
+ /* 7A */ { 0, &Ia_Invalid },
+ /* 7B */ { 0, &Ia_Invalid },
+ /* 7C */ { 0, &Ia_Invalid },
+ /* 7D */ { 0, &Ia_Invalid },
+ /* 7E */ { 0, &Ia_Invalid },
+ /* 7F */ { 0, &Ia_Invalid },
+ /* 80 */ { 0, &Ia_Invalid },
+ /* 81 */ { 0, &Ia_Invalid },
+ /* 82 */ { 0, &Ia_Invalid },
+ /* 83 */ { 0, &Ia_Invalid },
+ /* 84 */ { 0, &Ia_Invalid },
+ /* 85 */ { 0, &Ia_Invalid },
+ /* 86 */ { 0, &Ia_Invalid },
+ /* 87 */ { 0, &Ia_Invalid },
+ /* 88 */ { 0, &Ia_Invalid },
+ /* 89 */ { 0, &Ia_Invalid },
+ /* 8A */ { 0, &Ia_pfnacc_Pq_Qq },
+ /* 8B */ { 0, &Ia_Invalid },
+ /* 8C */ { 0, &Ia_Invalid },
+ /* 8D */ { 0, &Ia_Invalid },
+ /* 8E */ { 0, &Ia_pfpnacc_Pq_Qq },
+ /* 8F */ { 0, &Ia_Invalid },
+ /* 90 */ { 0, &Ia_pfcmpge_Pq_Qq },
+ /* 91 */ { 0, &Ia_Invalid },
+ /* 92 */ { 0, &Ia_Invalid },
+ /* 93 */ { 0, &Ia_Invalid },
+ /* 94 */ { 0, &Ia_pfmin_Pq_Qq },
+ /* 95 */ { 0, &Ia_Invalid },
+ /* 96 */ { 0, &Ia_pfrcp_Pq_Qq },
+ /* 97 */ { 0, &Ia_pfrsqrt_Pq_Qq },
+ /* 98 */ { 0, &Ia_Invalid },
+ /* 99 */ { 0, &Ia_Invalid },
+ /* 9A */ { 0, &Ia_pfsub_Pq_Qq },
+ /* 9B */ { 0, &Ia_Invalid },
+ /* 9C */ { 0, &Ia_Invalid },
+ /* 9D */ { 0, &Ia_Invalid },
+ /* 9E */ { 0, &Ia_pfadd_Pq_Qq },
+ /* 9F */ { 0, &Ia_Invalid },
+ /* A0 */ { 0, &Ia_pfcmpgt_Pq_Qq },
+ /* A1 */ { 0, &Ia_Invalid },
+ /* A2 */ { 0, &Ia_Invalid },
+ /* A3 */ { 0, &Ia_Invalid },
+ /* A4 */ { 0, &Ia_pfmax_Pq_Qq },
+ /* A5 */ { 0, &Ia_Invalid },
+ /* A6 */ { 0, &Ia_pfrcpit1_Pq_Qq },
+ /* A7 */ { 0, &Ia_pfrsqit1_Pq_Qq },
+ /* A8 */ { 0, &Ia_Invalid },
+ /* A9 */ { 0, &Ia_Invalid },
+ /* AA */ { 0, &Ia_pfsubr_Pq_Qq },
+ /* AB */ { 0, &Ia_Invalid },
+ /* AC */ { 0, &Ia_Invalid },
+ /* AD */ { 0, &Ia_Invalid },
+ /* AE */ { 0, &Ia_pfacc_Pq_Qq },
+ /* AF */ { 0, &Ia_Invalid },
+ /* B0 */ { 0, &Ia_pfcmpeq_Pq_Qq },
+ /* B1 */ { 0, &Ia_Invalid },
+ /* B2 */ { 0, &Ia_Invalid },
+ /* B3 */ { 0, &Ia_Invalid },
+ /* B4 */ { 0, &Ia_pfmul_Pq_Qq },
+ /* B5 */ { 0, &Ia_Invalid },
+ /* B6 */ { 0, &Ia_pfrcpit2_Pq_Qq },
+ /* B7 */ { 0, &Ia_pmulhrw_Pq_Qq },
+ /* B8 */ { 0, &Ia_Invalid },
+ /* B9 */ { 0, &Ia_Invalid },
+ /* BA */ { 0, &Ia_Invalid },
+ /* BB */ { 0, &Ia_pswapd_Pq_Qq },
+ /* BC */ { 0, &Ia_Invalid },
+ /* BD */ { 0, &Ia_Invalid },
+ /* BE */ { 0, &Ia_Invalid },
+ /* BF */ { 0, &Ia_pavgb_Pq_Qq },
+ /* C0 */ { 0, &Ia_Invalid },
+ /* C1 */ { 0, &Ia_Invalid },
+ /* C2 */ { 0, &Ia_Invalid },
+ /* C3 */ { 0, &Ia_Invalid },
+ /* C4 */ { 0, &Ia_Invalid },
+ /* C5 */ { 0, &Ia_Invalid },
+ /* C6 */ { 0, &Ia_Invalid },
+ /* C7 */ { 0, &Ia_Invalid },
+ /* C8 */ { 0, &Ia_Invalid },
+ /* C9 */ { 0, &Ia_Invalid },
+ /* CA */ { 0, &Ia_Invalid },
+ /* CB */ { 0, &Ia_Invalid },
+ /* CC */ { 0, &Ia_Invalid },
+ /* CD */ { 0, &Ia_Invalid },
+ /* CE */ { 0, &Ia_Invalid },
+ /* CF */ { 0, &Ia_Invalid },
+ /* D0 */ { 0, &Ia_Invalid },
+ /* D1 */ { 0, &Ia_Invalid },
+ /* D2 */ { 0, &Ia_Invalid },
+ /* D3 */ { 0, &Ia_Invalid },
+ /* D4 */ { 0, &Ia_Invalid },
+ /* D5 */ { 0, &Ia_Invalid },
+ /* D6 */ { 0, &Ia_Invalid },
+ /* D7 */ { 0, &Ia_Invalid },
+ /* D8 */ { 0, &Ia_Invalid },
+ /* D9 */ { 0, &Ia_Invalid },
+ /* DA */ { 0, &Ia_Invalid },
+ /* DB */ { 0, &Ia_Invalid },
+ /* DC */ { 0, &Ia_Invalid },
+ /* DD */ { 0, &Ia_Invalid },
+ /* DE */ { 0, &Ia_Invalid },
+ /* DF */ { 0, &Ia_Invalid },
+ /* E0 */ { 0, &Ia_Invalid },
+ /* E1 */ { 0, &Ia_Invalid },
+ /* E2 */ { 0, &Ia_Invalid },
+ /* E3 */ { 0, &Ia_Invalid },
+ /* E4 */ { 0, &Ia_Invalid },
+ /* E5 */ { 0, &Ia_Invalid },
+ /* E6 */ { 0, &Ia_Invalid },
+ /* E7 */ { 0, &Ia_Invalid },
+ /* E8 */ { 0, &Ia_Invalid },
+ /* E9 */ { 0, &Ia_Invalid },
+ /* EA */ { 0, &Ia_Invalid },
+ /* EB */ { 0, &Ia_Invalid },
+ /* EC */ { 0, &Ia_Invalid },
+ /* ED */ { 0, &Ia_Invalid },
+ /* EE */ { 0, &Ia_Invalid },
+ /* EF */ { 0, &Ia_Invalid },
+ /* F0 */ { 0, &Ia_Invalid },
+ /* F1 */ { 0, &Ia_Invalid },
+ /* F2 */ { 0, &Ia_Invalid },
+ /* F3 */ { 0, &Ia_Invalid },
+ /* F4 */ { 0, &Ia_Invalid },
+ /* F5 */ { 0, &Ia_Invalid },
+ /* F6 */ { 0, &Ia_Invalid },
+ /* F7 */ { 0, &Ia_Invalid },
+ /* F8 */ { 0, &Ia_Invalid },
+ /* F9 */ { 0, &Ia_Invalid },
+ /* FA */ { 0, &Ia_Invalid },
+ /* FB */ { 0, &Ia_Invalid },
+ /* FC */ { 0, &Ia_Invalid },
+ /* FD */ { 0, &Ia_Invalid },
+ /* FE */ { 0, &Ia_Invalid },
+ /* FF */ { 0, &Ia_Invalid }
+};
+
+/* ************************************************************************ */
+/* FPU Opcodes */
+
+// floating point instructions when mod!=11b.
+// the following tables will be accessed like groups using the nnn (reg) field of
+// the modrm byte. (the first byte is D8-DF)
+
+ // D8 (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupD8[8] = {
+ /* 0 */ { 0, &Ia_fadds_Md },
+ /* 1 */ { 0, &Ia_fmuls_Md },
+ /* 2 */ { 0, &Ia_fcoms_Md },
+ /* 3 */ { 0, &Ia_fcomps_Md },
+ /* 4 */ { 0, &Ia_fsubs_Md },
+ /* 5 */ { 0, &Ia_fsubrs_Md },
+ /* 6 */ { 0, &Ia_fdivs_Md },
+ /* 7 */ { 0, &Ia_fdivrs_Md }
+};
+
+ // D9 (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupD9[8] = {
+ /* 0 */ { 0, &Ia_flds_Md },
+ /* 1 */ { 0, &Ia_Invalid },
+ /* 2 */ { 0, &Ia_fsts_Md },
+ /* 3 */ { 0, &Ia_fstps_Md },
+ /* 4 */ { 0, &Ia_fldenv },
+ /* 5 */ { 0, &Ia_fldcw },
+ /* 6 */ { 0, &Ia_fnstenv },
+ /* 7 */ { 0, &Ia_fnstcw }
+};
+
+ // DA (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupDA[8] = {
+ /* 0 */ { 0, &Ia_fiaddl_Md },
+ /* 1 */ { 0, &Ia_fimull_Md },
+ /* 2 */ { 0, &Ia_ficoml_Md },
+ /* 3 */ { 0, &Ia_ficompl_Md },
+ /* 4 */ { 0, &Ia_fisubl_Md },
+ /* 5 */ { 0, &Ia_fisubrl_Md },
+ /* 6 */ { 0, &Ia_fidivl_Md },
+ /* 7 */ { 0, &Ia_fidivrl_Md }
+};
+
+ // DB (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupDB[8] = {
+ /* 0 */ { 0, &Ia_fildl_Md },
+ /* 1 */ { 0, &Ia_fisttpl_Md },
+ /* 2 */ { 0, &Ia_fistl_Md },
+ /* 3 */ { 0, &Ia_fistpl_Md },
+ /* 4 */ { 0, &Ia_Invalid },
+ /* 5 */ { 0, &Ia_fldt_Mt },
+ /* 6 */ { 0, &Ia_Invalid },
+ /* 7 */ { 0, &Ia_fstpt_Mt }
+};
+
+ // DC (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupDC[8] = {
+ /* 0 */ { 0, &Ia_faddl_Mq },
+ /* 1 */ { 0, &Ia_fmull_Mq },
+ /* 2 */ { 0, &Ia_fcoml_Mq },
+ /* 3 */ { 0, &Ia_fcompl_Mq },
+ /* 4 */ { 0, &Ia_fsubl_Mq },
+ /* 5 */ { 0, &Ia_fsubrl_Mq },
+ /* 6 */ { 0, &Ia_fdivl_Mq },
+ /* 7 */ { 0, &Ia_fdivrl_Mq }
+};
+
+ // DD (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupDD[8] = {
+ /* 0 */ { 0, &Ia_fldl_Mq },
+ /* 1 */ { 0, &Ia_fisttpq_Mq },
+ /* 2 */ { 0, &Ia_fstl_Mq },
+ /* 3 */ { 0, &Ia_fstpl_Mq },
+ /* 4 */ { 0, &Ia_frstor },
+ /* 5 */ { 0, &Ia_Invalid },
+ /* 6 */ { 0, &Ia_fnsave },
+ /* 7 */ { 0, &Ia_fnstsw }
+};
+
+ // DE (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupDE[8] = {
+ /* 0 */ { 0, &Ia_fiadds_Mw },
+ /* 1 */ { 0, &Ia_fimuls_Mw },
+ /* 2 */ { 0, &Ia_ficoms_Mw },
+ /* 3 */ { 0, &Ia_ficomps_Mw },
+ /* 4 */ { 0, &Ia_fisubs_Mw },
+ /* 5 */ { 0, &Ia_fisubrs_Mw },
+ /* 6 */ { 0, &Ia_fidivs_Mw },
+ /* 7 */ { 0, &Ia_fidivrs_Mw }
+};
+
+ // DF (modrm is outside 00h - BFh) (mod != 11)
+static BxDisasmOpcodeTable_t BxDisasmFPGroupDF[8] = {
+ /* 0 */ { 0, &Ia_filds_Mw },
+ /* 1 */ { 0, &Ia_fisttps_Mw },
+ /* 2 */ { 0, &Ia_fists_Mw },
+ /* 3 */ { 0, &Ia_fistps_Mw },
+ /* 4 */ { 0, &Ia_fbldt_Mt },
+ /* 5 */ { 0, &Ia_fildq_Mq },
+ /* 6 */ { 0, &Ia_fbstpt_Mt },
+ /* 7 */ { 0, &Ia_fistpq_Mq }
+};
+
+// 512 entries for second byte of floating point instructions. (when mod==11b)
+static BxDisasmOpcodeTable_t BxDisasmOpcodeInfoFP[512] = {
+ // D8 (modrm is outside 00h - BFh) (mod == 11)
+ /* D8 C0 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C1 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C2 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C3 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C4 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C5 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C6 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C7 */ { 0, &Ia_fadd_ST0_STi },
+ /* D8 C8 */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 C9 */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 CA */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 CB */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 CC */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 CD */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 CE */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 CF */ { 0, &Ia_fmul_ST0_STi },
+ /* D8 D0 */ { 0, &Ia_fcom_STi },
+ /* D8 D1 */ { 0, &Ia_fcom_STi },
+ /* D8 D2 */ { 0, &Ia_fcom_STi },
+ /* D8 D3 */ { 0, &Ia_fcom_STi },
+ /* D8 D4 */ { 0, &Ia_fcom_STi },
+ /* D8 D5 */ { 0, &Ia_fcom_STi },
+ /* D8 D6 */ { 0, &Ia_fcom_STi },
+ /* D8 D7 */ { 0, &Ia_fcom_STi },
+ /* D8 D8 */ { 0, &Ia_fcomp_STi },
+ /* D8 D9 */ { 0, &Ia_fcomp_STi },
+ /* D8 DA */ { 0, &Ia_fcomp_STi },
+ /* D8 DB */ { 0, &Ia_fcomp_STi },
+ /* D8 DC */ { 0, &Ia_fcomp_STi },
+ /* D8 DD */ { 0, &Ia_fcomp_STi },
+ /* D8 DE */ { 0, &Ia_fcomp_STi },
+ /* D8 DF */ { 0, &Ia_fcomp_STi },
+ /* D8 E0 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E1 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E2 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E3 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E4 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E5 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E6 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E7 */ { 0, &Ia_fsub_ST0_STi },
+ /* D8 E8 */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 E9 */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 EA */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 EB */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 EC */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 ED */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 EE */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 EF */ { 0, &Ia_fsubr_ST0_STi },
+ /* D8 F0 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F1 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F2 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F3 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F4 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F5 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F6 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F7 */ { 0, &Ia_fdiv_ST0_STi },
+ /* D8 F8 */ { 0, &Ia_fdivr_ST0_STi },
+ /* D8 F9 */ { 0, &Ia_fdivr_ST0_STi },
+ /* D8 FA */ { 0, &Ia_fdivr_ST0_STi },
+ /* D8 FB */ { 0, &Ia_fdivr_ST0_STi },
+ /* D8 FC */ { 0, &Ia_fdivr_ST0_STi },
+ /* D8 FD */ { 0, &Ia_fdivr_ST0_STi },
+ /* D8 FE */ { 0, &Ia_fdivr_ST0_STi },
+ /* D8 FF */ { 0, &Ia_fdivr_ST0_STi },
+
+ // D9 (modrm is outside 00h - BFh) (mod == 11)
+ /* D9 C0 */ { 0, &Ia_fld_STi },
+ /* D9 C1 */ { 0, &Ia_fld_STi },
+ /* D9 C2 */ { 0, &Ia_fld_STi },
+ /* D9 C3 */ { 0, &Ia_fld_STi },
+ /* D9 C4 */ { 0, &Ia_fld_STi },
+ /* D9 C5 */ { 0, &Ia_fld_STi },
+ /* D9 C6 */ { 0, &Ia_fld_STi },
+ /* D9 C7 */ { 0, &Ia_fld_STi },
+ /* D9 C8 */ { 0, &Ia_fxch },
+ /* D9 C9 */ { 0, &Ia_fxch },
+ /* D9 CA */ { 0, &Ia_fxch },
+ /* D9 CB */ { 0, &Ia_fxch },
+ /* D9 CC */ { 0, &Ia_fxch },
+ /* D9 CD */ { 0, &Ia_fxch },
+ /* D9 CE */ { 0, &Ia_fxch },
+ /* D9 CF */ { 0, &Ia_fxch },
+ /* D9 D0 */ { 0, &Ia_fnop },
+ /* D9 D1 */ { 0, &Ia_Invalid },
+ /* D9 D2 */ { 0, &Ia_Invalid },
+ /* D9 D3 */ { 0, &Ia_Invalid },
+ /* D9 D4 */ { 0, &Ia_Invalid },
+ /* D9 D5 */ { 0, &Ia_Invalid },
+ /* D9 D6 */ { 0, &Ia_Invalid },
+ /* D9 D7 */ { 0, &Ia_Invalid },
+ /* D9 D8 */ { 0, &Ia_Invalid },
+ /* D9 D9 */ { 0, &Ia_Invalid },
+ /* D9 DA */ { 0, &Ia_Invalid },
+ /* D9 DB */ { 0, &Ia_Invalid },
+ /* D9 DC */ { 0, &Ia_Invalid },
+ /* D9 DD */ { 0, &Ia_Invalid },
+ /* D9 DE */ { 0, &Ia_Invalid },
+ /* D9 DF */ { 0, &Ia_Invalid },
+ /* D9 E0 */ { 0, &Ia_fchs },
+ /* D9 E1 */ { 0, &Ia_fabs },
+ /* D9 E2 */ { 0, &Ia_Invalid },
+ /* D9 E3 */ { 0, &Ia_Invalid },
+ /* D9 E4 */ { 0, &Ia_ftst },
+ /* D9 E5 */ { 0, &Ia_fxam },
+ /* D9 E6 */ { 0, &Ia_Invalid },
+ /* D9 E7 */ { 0, &Ia_Invalid },
+ /* D9 E8 */ { 0, &Ia_fld1 },
+ /* D9 E9 */ { 0, &Ia_fldl2t },
+ /* D9 EA */ { 0, &Ia_fldl2e },
+ /* D9 EB */ { 0, &Ia_fldpi },
+ /* D9 EC */ { 0, &Ia_fldlg2 },
+ /* D9 ED */ { 0, &Ia_fldln2 },
+ /* D9 EE */ { 0, &Ia_fldz },
+ /* D9 EF */ { 0, &Ia_Invalid },
+ /* D9 F0 */ { 0, &Ia_f2xm1 },
+ /* D9 F1 */ { 0, &Ia_fyl2x },
+ /* D9 F2 */ { 0, &Ia_fptan },
+ /* D9 F3 */ { 0, &Ia_fpatan },
+ /* D9 F4 */ { 0, &Ia_fxtract },
+ /* D9 F5 */ { 0, &Ia_fprem1 },
+ /* D9 F6 */ { 0, &Ia_fdecstp },
+ /* D9 F7 */ { 0, &Ia_fincstp },
+ /* D9 F8 */ { 0, &Ia_fprem },
+ /* D9 F9 */ { 0, &Ia_fyl2xp1 },
+ /* D9 FA */ { 0, &Ia_fsqrt },
+ /* D9 FB */ { 0, &Ia_fsincos },
+ /* D9 FC */ { 0, &Ia_frndint },
+ /* D9 FD */ { 0, &Ia_fscale },
+ /* D9 FE */ { 0, &Ia_fsin },
+ /* D9 FF */ { 0, &Ia_fcos },
+
+ // DA (modrm is outside 00h - BFh) (mod == 11)
+ /* DA C0 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C1 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C2 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C3 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C4 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C5 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C6 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C7 */ { 0, &Ia_fcmovb_ST0_STi },
+ /* DA C8 */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA C9 */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA CA */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA CB */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA CC */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA CD */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA CE */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA CF */ { 0, &Ia_fcmove_ST0_STi },
+ /* DA D0 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D1 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D2 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D3 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D4 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D5 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D6 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D7 */ { 0, &Ia_fcmovbe_ST0_STi },
+ /* DA D8 */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA D9 */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA DA */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA DB */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA DC */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA DD */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA DE */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA DF */ { 0, &Ia_fcmovu_ST0_STi },
+ /* DA E0 */ { 0, &Ia_Invalid },
+ /* DA E1 */ { 0, &Ia_Invalid },
+ /* DA E2 */ { 0, &Ia_Invalid },
+ /* DA E3 */ { 0, &Ia_Invalid },
+ /* DA E4 */ { 0, &Ia_Invalid },
+ /* DA E5 */ { 0, &Ia_Invalid },
+ /* DA E6 */ { 0, &Ia_Invalid },
+ /* DA E7 */ { 0, &Ia_Invalid },
+ /* DA E8 */ { 0, &Ia_Invalid },
+ /* DA E9 */ { 0, &Ia_fucompp },
+ /* DA EA */ { 0, &Ia_Invalid },
+ /* DA EB */ { 0, &Ia_Invalid },
+ /* DA EC */ { 0, &Ia_Invalid },
+ /* DA ED */ { 0, &Ia_Invalid },
+ /* DA EE */ { 0, &Ia_Invalid },
+ /* DA EF */ { 0, &Ia_Invalid },
+ /* DA F0 */ { 0, &Ia_Invalid },
+ /* DA F1 */ { 0, &Ia_Invalid },
+ /* DA F2 */ { 0, &Ia_Invalid },
+ /* DA F3 */ { 0, &Ia_Invalid },
+ /* DA F4 */ { 0, &Ia_Invalid },
+ /* DA F5 */ { 0, &Ia_Invalid },
+ /* DA F6 */ { 0, &Ia_Invalid },
+ /* DA F7 */ { 0, &Ia_Invalid },
+ /* DA F8 */ { 0, &Ia_Invalid },
+ /* DA F9 */ { 0, &Ia_Invalid },
+ /* DA FA */ { 0, &Ia_Invalid },
+ /* DA FB */ { 0, &Ia_Invalid },
+ /* DA FC */ { 0, &Ia_Invalid },
+ /* DA FD */ { 0, &Ia_Invalid },
+ /* DA FE */ { 0, &Ia_Invalid },
+ /* DA FF */ { 0, &Ia_Invalid },
+
+ // DB (modrm is outside 00h - BFh) (mod == 11)
+ /* DB C0 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C1 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C2 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C3 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C4 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C5 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C6 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C7 */ { 0, &Ia_fcmovnb_ST0_STi },
+ /* DB C8 */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB C9 */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB CA */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB CB */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB CC */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB CD */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB CE */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB CF */ { 0, &Ia_fcmovne_ST0_STi },
+ /* DB D0 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D1 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D2 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D3 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D4 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D5 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D6 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D7 */ { 0, &Ia_fcmovnbe_ST0_STi },
+ /* DB D8 */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB D9 */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB DA */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB DB */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB DC */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB DD */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB DE */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB DF */ { 0, &Ia_fcmovnu_ST0_STi },
+ /* DB E0 */ { 0, &Ia_feni },
+ /* DB E1 */ { 0, &Ia_fdisi },
+ /* DB E2 */ { 0, &Ia_fnclex },
+ /* DB E3 */ { 0, &Ia_fninit },
+ /* DB E4 */ { 0, &Ia_fsetpm },
+ /* DB E5 */ { 0, &Ia_Invalid },
+ /* DB E6 */ { 0, &Ia_Invalid },
+ /* DB E7 */ { 0, &Ia_Invalid },
+ /* DB E8 */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB E9 */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB EA */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB EB */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB EC */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB ED */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB EE */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB EF */ { 0, &Ia_fucomi_ST0_STi },
+ /* DB F0 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F1 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F2 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F3 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F4 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F5 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F6 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F7 */ { 0, &Ia_fcomi_ST0_STi },
+ /* DB F8 */ { 0, &Ia_Invalid },
+ /* DB F9 */ { 0, &Ia_Invalid },
+ /* DB FA */ { 0, &Ia_Invalid },
+ /* DB FB */ { 0, &Ia_Invalid },
+ /* DB FC */ { 0, &Ia_Invalid },
+ /* DB FD */ { 0, &Ia_Invalid },
+ /* DB FE */ { 0, &Ia_Invalid },
+ /* DB FF */ { 0, &Ia_Invalid },
+
+ // DC (modrm is outside 00h - BFh) (mod == 11)
+ /* DC C0 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C1 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C2 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C3 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C4 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C5 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C6 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C7 */ { 0, &Ia_fadd_STi_ST0 },
+ /* DC C8 */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC C9 */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC CA */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC CB */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC CC */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC CD */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC CE */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC CF */ { 0, &Ia_fmul_STi_ST0 },
+ /* DC D0 */ { 0, &Ia_Invalid },
+ /* DC D1 */ { 0, &Ia_Invalid },
+ /* DC D2 */ { 0, &Ia_Invalid },
+ /* DC D3 */ { 0, &Ia_Invalid },
+ /* DC D4 */ { 0, &Ia_Invalid },
+ /* DC D5 */ { 0, &Ia_Invalid },
+ /* DC D6 */ { 0, &Ia_Invalid },
+ /* DC D7 */ { 0, &Ia_Invalid },
+ /* DC D8 */ { 0, &Ia_Invalid },
+ /* DC D9 */ { 0, &Ia_Invalid },
+ /* DC DA */ { 0, &Ia_Invalid },
+ /* DC DB */ { 0, &Ia_Invalid },
+ /* DC DC */ { 0, &Ia_Invalid },
+ /* DC DD */ { 0, &Ia_Invalid },
+ /* DC DE */ { 0, &Ia_Invalid },
+ /* DC DF */ { 0, &Ia_Invalid },
+ /* DC E0 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E1 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E2 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E3 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E4 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E5 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E6 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E7 */ { 0, &Ia_fsubr_STi_ST0 },
+ /* DC E8 */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC E9 */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC EA */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC EB */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC EC */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC ED */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC EE */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC EF */ { 0, &Ia_fsub_STi_ST0 },
+ /* DC F0 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F1 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F2 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F3 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F4 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F5 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F6 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F7 */ { 0, &Ia_fdivr_STi_ST0 },
+ /* DC F8 */ { 0, &Ia_fdiv_STi_ST0 },
+ /* DC F9 */ { 0, &Ia_fdiv_STi_ST0 },
+ /* DC FA */ { 0, &Ia_fdiv_STi_ST0 },
+ /* DC FB */ { 0, &Ia_fdiv_STi_ST0 },
+ /* DC FC */ { 0, &Ia_fdiv_STi_ST0 },
+ /* DC FD */ { 0, &Ia_fdiv_STi_ST0 },
+ /* DC FE */ { 0, &Ia_fdiv_STi_ST0 },
+ /* DC FF */ { 0, &Ia_fdiv_STi_ST0 },
+
+ // DD (modrm is outside 00h - BFh) (mod == 11)
+ /* DD C0 */ { 0, &Ia_ffree_STi },
+ /* DD C1 */ { 0, &Ia_ffree_STi },
+ /* DD C2 */ { 0, &Ia_ffree_STi },
+ /* DD C3 */ { 0, &Ia_ffree_STi },
+ /* DD C4 */ { 0, &Ia_ffree_STi },
+ /* DD C5 */ { 0, &Ia_ffree_STi },
+ /* DD C6 */ { 0, &Ia_ffree_STi },
+ /* DD C7 */ { 0, &Ia_ffree_STi },
+ /* DD C8 */ { 0, &Ia_Invalid },
+ /* DD C9 */ { 0, &Ia_Invalid },
+ /* DD CA */ { 0, &Ia_Invalid },
+ /* DD CB */ { 0, &Ia_Invalid },
+ /* DD CC */ { 0, &Ia_Invalid },
+ /* DD CD */ { 0, &Ia_Invalid },
+ /* DD CE */ { 0, &Ia_Invalid },
+ /* DD CF */ { 0, &Ia_Invalid },
+ /* DD D0 */ { 0, &Ia_fst_STi },
+ /* DD D1 */ { 0, &Ia_fst_STi },
+ /* DD D2 */ { 0, &Ia_fst_STi },
+ /* DD D3 */ { 0, &Ia_fst_STi },
+ /* DD D4 */ { 0, &Ia_fst_STi },
+ /* DD D5 */ { 0, &Ia_fst_STi },
+ /* DD D6 */ { 0, &Ia_fst_STi },
+ /* DD D7 */ { 0, &Ia_fst_STi },
+ /* DD D8 */ { 0, &Ia_fstp_STi },
+ /* DD D9 */ { 0, &Ia_fstp_STi },
+ /* DD DA */ { 0, &Ia_fstp_STi },
+ /* DD DB */ { 0, &Ia_fstp_STi },
+ /* DD DC */ { 0, &Ia_fstp_STi },
+ /* DD DD */ { 0, &Ia_fstp_STi },
+ /* DD DE */ { 0, &Ia_fstp_STi },
+ /* DD DF */ { 0, &Ia_fstp_STi },
+ /* DD E0 */ { 0, &Ia_fucom_STi },
+ /* DD E1 */ { 0, &Ia_fucom_STi },
+ /* DD E2 */ { 0, &Ia_fucom_STi },
+ /* DD E3 */ { 0, &Ia_fucom_STi },
+ /* DD E4 */ { 0, &Ia_fucom_STi },
+ /* DD E5 */ { 0, &Ia_fucom_STi },
+ /* DD E6 */ { 0, &Ia_fucom_STi },
+ /* DD E7 */ { 0, &Ia_fucom_STi },
+ /* DD E8 */ { 0, &Ia_fucomp_STi },
+ /* DD E9 */ { 0, &Ia_fucomp_STi },
+ /* DD EA */ { 0, &Ia_fucomp_STi },
+ /* DD EB */ { 0, &Ia_fucomp_STi },
+ /* DD EC */ { 0, &Ia_fucomp_STi },
+ /* DD ED */ { 0, &Ia_fucomp_STi },
+ /* DD EE */ { 0, &Ia_fucomp_STi },
+ /* DD EF */ { 0, &Ia_fucomp_STi },
+ /* DD F0 */ { 0, &Ia_Invalid },
+ /* DD F1 */ { 0, &Ia_Invalid },
+ /* DD F2 */ { 0, &Ia_Invalid },
+ /* DD F3 */ { 0, &Ia_Invalid },
+ /* DD F4 */ { 0, &Ia_Invalid },
+ /* DD F5 */ { 0, &Ia_Invalid },
+ /* DD F6 */ { 0, &Ia_Invalid },
+ /* DD F7 */ { 0, &Ia_Invalid },
+ /* DD F8 */ { 0, &Ia_Invalid },
+ /* DD F9 */ { 0, &Ia_Invalid },
+ /* DD FA */ { 0, &Ia_Invalid },
+ /* DD FB */ { 0, &Ia_Invalid },
+ /* DD FC */ { 0, &Ia_Invalid },
+ /* DD FD */ { 0, &Ia_Invalid },
+ /* DD FE */ { 0, &Ia_Invalid },
+ /* DD FF */ { 0, &Ia_Invalid },
+
+ // DE (modrm is outside 00h - BFh) (mod == 11)
+ /* DE C0 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C1 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C2 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C3 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C4 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C5 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C6 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C7 */ { 0, &Ia_faddp_STi_ST0 },
+ /* DE C8 */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE C9 */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE CA */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE CB */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE CC */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE CD */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE CE */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE CF */ { 0, &Ia_fmulp_STi_ST0 },
+ /* DE D0 */ { 0, &Ia_Invalid },
+ /* DE D1 */ { 0, &Ia_Invalid },
+ /* DE D2 */ { 0, &Ia_Invalid },
+ /* DE D3 */ { 0, &Ia_Invalid },
+ /* DE D4 */ { 0, &Ia_Invalid },
+ /* DE D5 */ { 0, &Ia_Invalid },
+ /* DE D6 */ { 0, &Ia_Invalid },
+ /* DE D7 */ { 0, &Ia_Invalid },
+ /* DE D8 */ { 0, &Ia_Invalid },
+ /* DE D9 */ { 0, &Ia_fcompp },
+ /* DE DA */ { 0, &Ia_Invalid },
+ /* DE DB */ { 0, &Ia_Invalid },
+ /* DE DC */ { 0, &Ia_Invalid },
+ /* DE DD */ { 0, &Ia_Invalid },
+ /* DE DE */ { 0, &Ia_Invalid },
+ /* DE DF */ { 0, &Ia_Invalid },
+ /* DE E0 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E1 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E2 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E3 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E4 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E5 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E6 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E7 */ { 0, &Ia_fsubrp_STi_ST0 },
+ /* DE E8 */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE E9 */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE EA */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE EB */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE EC */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE ED */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE EE */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE EF */ { 0, &Ia_fsubp_STi_ST0 },
+ /* DE F0 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F1 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F2 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F3 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F4 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F5 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F6 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F7 */ { 0, &Ia_fdivrp_STi_ST0 },
+ /* DE F8 */ { 0, &Ia_fdivp_STi_ST0 },
+ /* DE F9 */ { 0, &Ia_fdivp_STi_ST0 },
+ /* DE FA */ { 0, &Ia_fdivp_STi_ST0 },
+ /* DE FB */ { 0, &Ia_fdivp_STi_ST0 },
+ /* DE FC */ { 0, &Ia_fdivp_STi_ST0 },
+ /* DE FD */ { 0, &Ia_fdivp_STi_ST0 },
+ /* DE FE */ { 0, &Ia_fdivp_STi_ST0 },
+ /* DE FF */ { 0, &Ia_fdivp_STi_ST0 },
+
+ // DF (modrm is outside 00h - BFh) (mod == 11)
+ /* DF C0 */ { 0, &Ia_ffreep_STi }, // 287 compatibility opcode
+ /* DF C1 */ { 0, &Ia_ffreep_STi },
+ /* DF C2 */ { 0, &Ia_ffreep_STi },
+ /* DF C3 */ { 0, &Ia_ffreep_STi },
+ /* DF C4 */ { 0, &Ia_ffreep_STi },
+ /* DF C5 */ { 0, &Ia_ffreep_STi },
+ /* DF C6 */ { 0, &Ia_ffreep_STi },
+ /* DF C7 */ { 0, &Ia_ffreep_STi },
+ /* DF C8 */ { 0, &Ia_Invalid },
+ /* DF C9 */ { 0, &Ia_Invalid },
+ /* DF CA */ { 0, &Ia_Invalid },
+ /* DF CB */ { 0, &Ia_Invalid },
+ /* DF CC */ { 0, &Ia_Invalid },
+ /* DF CD */ { 0, &Ia_Invalid },
+ /* DF CE */ { 0, &Ia_Invalid },
+ /* DF CF */ { 0, &Ia_Invalid },
+ /* DF D0 */ { 0, &Ia_Invalid },
+ /* DF D1 */ { 0, &Ia_Invalid },
+ /* DF D2 */ { 0, &Ia_Invalid },
+ /* DF D3 */ { 0, &Ia_Invalid },
+ /* DF D4 */ { 0, &Ia_Invalid },
+ /* DF D5 */ { 0, &Ia_Invalid },
+ /* DF D6 */ { 0, &Ia_Invalid },
+ /* DF D7 */ { 0, &Ia_Invalid },
+ /* DF D8 */ { 0, &Ia_Invalid },
+ /* DF D9 */ { 0, &Ia_Invalid },
+ /* DF DA */ { 0, &Ia_Invalid },
+ /* DF DB */ { 0, &Ia_Invalid },
+ /* DF DC */ { 0, &Ia_Invalid },
+ /* DF DD */ { 0, &Ia_Invalid },
+ /* DF DE */ { 0, &Ia_Invalid },
+ /* DF DF */ { 0, &Ia_Invalid },
+ /* DF E0 */ { 0, &Ia_fnstsw_AX },
+ /* DF E1 */ { 0, &Ia_Invalid },
+ /* DF E2 */ { 0, &Ia_Invalid },
+ /* DF E3 */ { 0, &Ia_Invalid },
+ /* DF E4 */ { 0, &Ia_Invalid },
+ /* DF E5 */ { 0, &Ia_Invalid },
+ /* DF E6 */ { 0, &Ia_Invalid },
+ /* DF E7 */ { 0, &Ia_Invalid },
+ /* DF E8 */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF E9 */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF EA */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF EB */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF EC */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF ED */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF EE */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF EF */ { 0, &Ia_fucomip_ST0_STi },
+ /* DF F0 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F1 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F2 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F3 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F4 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F5 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F6 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F7 */ { 0, &Ia_fcomip_ST0_STi },
+ /* DF F8 */ { 0, &Ia_Invalid },
+ /* DF F9 */ { 0, &Ia_Invalid },
+ /* DF FA */ { 0, &Ia_Invalid },
+ /* DF FB */ { 0, &Ia_Invalid },
+ /* DF FC */ { 0, &Ia_Invalid },
+ /* DF FD */ { 0, &Ia_Invalid },
+ /* DF FE */ { 0, &Ia_Invalid },
+ /* DF FF */ { 0, &Ia_Invalid },
+};
+
+/* ************************************************************************ */
+/* 3-byte opcode table (Table A-4, 0F 38) */
+
+static BxDisasmOpcodeTable_t BxDisasm3ByteOp0f380x[16] = {
+ /* 00 */ { GRPSSE(0f3800) },
+ /* 01 */ { GRPSSE(0f3801) },
+ /* 02 */ { GRPSSE(0f3802) },
+ /* 03 */ { GRPSSE(0f3803) },
+ /* 04 */ { GRPSSE(0f3804) },
+ /* 05 */ { GRPSSE(0f3805) },
+ /* 06 */ { GRPSSE(0f3806) },
+ /* 07 */ { GRPSSE(0f3807) },
+ /* 08 */ { GRPSSE(0f3808) },
+ /* 09 */ { GRPSSE(0f3809) },
+ /* 0A */ { GRPSSE(0f380a) },
+ /* 0B */ { GRPSSE(0f380b) },
+ /* 0C */ { 0, &Ia_Invalid },
+ /* 0D */ { 0, &Ia_Invalid },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasm3ByteOp0f381x[16] = {
+ /* 00 */ { 0, &Ia_Invalid },
+ /* 01 */ { 0, &Ia_Invalid },
+ /* 02 */ { 0, &Ia_Invalid },
+ /* 03 */ { 0, &Ia_Invalid },
+ /* 04 */ { 0, &Ia_Invalid },
+ /* 05 */ { 0, &Ia_Invalid },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_Invalid },
+ /* 09 */ { 0, &Ia_Invalid },
+ /* 0A */ { 0, &Ia_Invalid },
+ /* 0B */ { 0, &Ia_Invalid },
+ /* 0C */ { GRPSSE(0f381c) },
+ /* 0D */ { GRPSSE(0f381d) },
+ /* 0E */ { GRPSSE(0f381e) },
+ /* 0F */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasm3ByteTableA4[16] = {
+ /* 00 */ { GR3BOP(0f380x) },
+ /* 01 */ { GR3BOP(0f381x) },
+ /* 02 */ { 0, &Ia_Invalid },
+ /* 03 */ { 0, &Ia_Invalid },
+ /* 04 */ { 0, &Ia_Invalid },
+ /* 05 */ { 0, &Ia_Invalid },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_Invalid },
+ /* 09 */ { 0, &Ia_Invalid },
+ /* 0A */ { 0, &Ia_Invalid },
+ /* 0B */ { 0, &Ia_Invalid },
+ /* 0C */ { 0, &Ia_Invalid },
+ /* 0D */ { 0, &Ia_Invalid },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { 0, &Ia_Invalid }
+};
+
+/* ************************************************************************ */
+/* 3-byte opcode table (Table A-5, 0F 3A) */
+
+static BxDisasmOpcodeTable_t BxDisasm3ByteOp0f3a0x[16] = {
+ /* 00 */ { 0, &Ia_Invalid },
+ /* 01 */ { 0, &Ia_Invalid },
+ /* 02 */ { 0, &Ia_Invalid },
+ /* 03 */ { 0, &Ia_Invalid },
+ /* 04 */ { 0, &Ia_Invalid },
+ /* 05 */ { 0, &Ia_Invalid },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_Invalid },
+ /* 09 */ { 0, &Ia_Invalid },
+ /* 0A */ { 0, &Ia_Invalid },
+ /* 0B */ { 0, &Ia_Invalid },
+ /* 0C */ { 0, &Ia_Invalid },
+ /* 0D */ { 0, &Ia_Invalid },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { GRPSSE(0f3a0f) }
+};
+
+static BxDisasmOpcodeTable_t BxDisasm3ByteTableA5[16] = {
+ /* 00 */ { GR3BOP(0f3a0x) },
+ /* 01 */ { 0, &Ia_Invalid },
+ /* 02 */ { 0, &Ia_Invalid },
+ /* 03 */ { 0, &Ia_Invalid },
+ /* 04 */ { 0, &Ia_Invalid },
+ /* 05 */ { 0, &Ia_Invalid },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_Invalid },
+ /* 09 */ { 0, &Ia_Invalid },
+ /* 0A */ { 0, &Ia_Invalid },
+ /* 0B */ { 0, &Ia_Invalid },
+ /* 0C */ { 0, &Ia_Invalid },
+ /* 0D */ { 0, &Ia_Invalid },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { 0, &Ia_Invalid }
+};
+
+/* ************************************************************************ */
+/* 16-bit operand size */
+
+static BxDisasmOpcodeTable_t BxDisasmOpcodes16[256*2] = {
+ // 256 entries for single byte opcodes
+ /* 00 */ { 0, &Ia_addb_Eb_Gb },
+ /* 01 */ { 0, &Ia_addw_Ew_Gw },
+ /* 02 */ { 0, &Ia_addb_Gb_Eb },
+ /* 03 */ { 0, &Ia_addw_Gw_Ew },
+ /* 04 */ { 0, &Ia_addb_AL_Ib },
+ /* 05 */ { 0, &Ia_addw_AX_Iw },
+ /* 06 */ { 0, &Ia_pushw_ES },
+ /* 07 */ { 0, &Ia_popw_ES },
+ /* 08 */ { 0, &Ia_orb_Eb_Gb },
+ /* 09 */ { 0, &Ia_orw_Ew_Gw },
+ /* 0A */ { 0, &Ia_orb_Gb_Eb },
+ /* 0B */ { 0, &Ia_orw_Gw_Ew },
+ /* 0C */ { 0, &Ia_orb_AL_Ib },
+ /* 0D */ { 0, &Ia_orw_AX_Iw },
+ /* 0E */ { 0, &Ia_pushw_CS },
+ /* 0F */ { 0, &Ia_error }, // 2 byte escape
+ /* 10 */ { 0, &Ia_adcb_Eb_Gb },
+ /* 11 */ { 0, &Ia_adcw_Ew_Gw },
+ /* 12 */ { 0, &Ia_adcb_Gb_Eb },
+ /* 13 */ { 0, &Ia_adcw_Gw_Ew },
+ /* 14 */ { 0, &Ia_adcb_AL_Ib },
+ /* 15 */ { 0, &Ia_adcw_AX_Iw },
+ /* 16 */ { 0, &Ia_pushw_SS },
+ /* 17 */ { 0, &Ia_popw_SS },
+ /* 18 */ { 0, &Ia_sbbb_Eb_Gb },
+ /* 19 */ { 0, &Ia_sbbw_Ew_Gw },
+ /* 1A */ { 0, &Ia_sbbb_Gb_Eb },
+ /* 1B */ { 0, &Ia_sbbw_Gw_Ew },
+ /* 1C */ { 0, &Ia_sbbb_AL_Ib },
+ /* 1D */ { 0, &Ia_sbbw_AX_Iw },
+ /* 1E */ { 0, &Ia_pushw_DS },
+ /* 1F */ { 0, &Ia_popw_DS },
+ /* 20 */ { 0, &Ia_andb_Eb_Gb },
+ /* 21 */ { 0, &Ia_andw_Ew_Gw },
+ /* 22 */ { 0, &Ia_andb_Gb_Eb },
+ /* 23 */ { 0, &Ia_andw_Gw_Ew },
+ /* 24 */ { 0, &Ia_andb_AL_Ib },
+ /* 25 */ { 0, &Ia_andw_AX_Iw },
+ /* 26 */ { 0, &Ia_prefix_es }, // ES:
+ /* 27 */ { 0, &Ia_daa },
+ /* 28 */ { 0, &Ia_subb_Eb_Gb },
+ /* 29 */ { 0, &Ia_subw_Ew_Gw },
+ /* 2A */ { 0, &Ia_subb_Gb_Eb },
+ /* 2B */ { 0, &Ia_subw_Gw_Ew },
+ /* 2C */ { 0, &Ia_subb_AL_Ib },
+ /* 2D */ { 0, &Ia_subw_AX_Iw },
+ /* 2E */ { 0, &Ia_prefix_cs }, // CS:
+ /* 2F */ { 0, &Ia_das },
+ /* 30 */ { 0, &Ia_xorb_Eb_Gb },
+ /* 31 */ { 0, &Ia_xorw_Ew_Gw },
+ /* 32 */ { 0, &Ia_xorb_Gb_Eb },
+ /* 33 */ { 0, &Ia_xorw_Gw_Ew },
+ /* 34 */ { 0, &Ia_xorb_AL_Ib },
+ /* 35 */ { 0, &Ia_xorw_AX_Iw },
+ /* 36 */ { 0, &Ia_prefix_ss }, // SS:
+ /* 37 */ { 0, &Ia_aaa },
+ /* 38 */ { 0, &Ia_cmpb_Eb_Gb },
+ /* 39 */ { 0, &Ia_cmpw_Ew_Gw },
+ /* 3A */ { 0, &Ia_cmpb_Gb_Eb },
+ /* 3B */ { 0, &Ia_cmpw_Gw_Ew },
+ /* 3C */ { 0, &Ia_cmpb_AL_Ib },
+ /* 3D */ { 0, &Ia_cmpw_AX_Iw },
+ /* 3E */ { 0, &Ia_prefix_ds }, // DS:
+ /* 3F */ { 0, &Ia_aas },
+ /* 40 */ { 0, &Ia_incw_RX },
+ /* 41 */ { 0, &Ia_incw_RX },
+ /* 42 */ { 0, &Ia_incw_RX },
+ /* 43 */ { 0, &Ia_incw_RX },
+ /* 44 */ { 0, &Ia_incw_RX },
+ /* 45 */ { 0, &Ia_incw_RX },
+ /* 46 */ { 0, &Ia_incw_RX },
+ /* 47 */ { 0, &Ia_incw_RX },
+ /* 48 */ { 0, &Ia_decw_RX },
+ /* 49 */ { 0, &Ia_decw_RX },
+ /* 4A */ { 0, &Ia_decw_RX },
+ /* 4B */ { 0, &Ia_decw_RX },
+ /* 4C */ { 0, &Ia_decw_RX },
+ /* 4D */ { 0, &Ia_decw_RX },
+ /* 4E */ { 0, &Ia_decw_RX },
+ /* 4F */ { 0, &Ia_decw_RX },
+ /* 50 */ { 0, &Ia_pushw_RX },
+ /* 51 */ { 0, &Ia_pushw_RX },
+ /* 52 */ { 0, &Ia_pushw_RX },
+ /* 53 */ { 0, &Ia_pushw_RX },
+ /* 54 */ { 0, &Ia_pushw_RX },
+ /* 55 */ { 0, &Ia_pushw_RX },
+ /* 56 */ { 0, &Ia_pushw_RX },
+ /* 57 */ { 0, &Ia_pushw_RX },
+ /* 58 */ { 0, &Ia_popw_RX },
+ /* 59 */ { 0, &Ia_popw_RX },
+ /* 5A */ { 0, &Ia_popw_RX },
+ /* 5B */ { 0, &Ia_popw_RX },
+ /* 5C */ { 0, &Ia_popw_RX },
+ /* 5D */ { 0, &Ia_popw_RX },
+ /* 5E */ { 0, &Ia_popw_RX },
+ /* 5F */ { 0, &Ia_popw_RX },
+ /* 60 */ { 0, &Ia_pushaw },
+ /* 61 */ { 0, &Ia_popaw },
+ /* 62 */ { 0, &Ia_boundw_Gw_Ma },
+ /* 63 */ { 0, &Ia_arpl_Ew_Rw },
+ /* 64 */ { 0, &Ia_prefix_fs }, // FS:
+ /* 65 */ { 0, &Ia_prefix_gs }, // GS:
+ /* 66 */ { 0, &Ia_prefix_osize }, // OSIZE:
+ /* 67 */ { 0, &Ia_prefix_asize }, // ASIZE:
+ /* 68 */ { 0, &Ia_pushw_Iw },
+ /* 69 */ { 0, &Ia_imulw_Gw_Ew_Iw },
+ /* 6A */ { 0, &Ia_pushw_sIb },
+ /* 6B */ { 0, &Ia_imulw_Gw_Ew_sIb },
+ /* 6C */ { 0, &Ia_insb_Yb_DX },
+ /* 6D */ { 0, &Ia_insw_Yw_DX },
+ /* 6E */ { 0, &Ia_outsb_DX_Xb },
+ /* 6F */ { 0, &Ia_outsw_DX_Xw },
+ /* 70 */ { 0, &Ia_jo_Jb },
+ /* 71 */ { 0, &Ia_jno_Jb },
+ /* 72 */ { 0, &Ia_jb_Jb },
+ /* 73 */ { 0, &Ia_jnb_Jb },
+ /* 74 */ { 0, &Ia_jz_Jb },
+ /* 75 */ { 0, &Ia_jnz_Jb },
+ /* 76 */ { 0, &Ia_jbe_Jb },
+ /* 77 */ { 0, &Ia_jnbe_Jb },
+ /* 78 */ { 0, &Ia_js_Jb },
+ /* 79 */ { 0, &Ia_jns_Jb },
+ /* 7A */ { 0, &Ia_jp_Jb },
+ /* 7B */ { 0, &Ia_jnp_Jb },
+ /* 7C */ { 0, &Ia_jl_Jb },
+ /* 7D */ { 0, &Ia_jnl_Jb },
+ /* 7E */ { 0, &Ia_jle_Jb },
+ /* 7F */ { 0, &Ia_jnle_Jb },
+ /* 80 */ { GRPN(G1EbIb) },
+ /* 81 */ { GRPN(G1EwIw) },
+ /* 82 */ { GRPN(G1EbIb) },
+ /* 83 */ { GRPN(G1EwIb) },
+ /* 84 */ { 0, &Ia_testb_Eb_Gb },
+ /* 85 */ { 0, &Ia_testw_Ew_Gw },
+ /* 86 */ { 0, &Ia_xchgb_Eb_Gb },
+ /* 87 */ { 0, &Ia_xchgw_Ew_Gw },
+ /* 88 */ { 0, &Ia_movb_Eb_Gb },
+ /* 89 */ { 0, &Ia_movw_Ew_Gw },
+ /* 8A */ { 0, &Ia_movb_Gb_Eb },
+ /* 8B */ { 0, &Ia_movw_Gw_Ew },
+ /* 8C */ { 0, &Ia_movw_Ew_Sw },
+ /* 8D */ { 0, &Ia_leaw_Gw_Mw },
+ /* 8E */ { 0, &Ia_movw_Sw_Ew },
+ /* 8F */ { 0, &Ia_popw_Ew },
+ /* 90 */ { 0, &Ia_nop },
+ /* 91 */ { 0, &Ia_xchgw_RX_AX },
+ /* 92 */ { 0, &Ia_xchgw_RX_AX },
+ /* 93 */ { 0, &Ia_xchgw_RX_AX },
+ /* 94 */ { 0, &Ia_xchgw_RX_AX },
+ /* 95 */ { 0, &Ia_xchgw_RX_AX },
+ /* 96 */ { 0, &Ia_xchgw_RX_AX },
+ /* 97 */ { 0, &Ia_xchgw_RX_AX },
+ /* 98 */ { 0, &Ia_cbw },
+ /* 99 */ { 0, &Ia_cwd },
+ /* 9A */ { 0, &Ia_lcall_Apw },
+ /* 9B */ { 0, &Ia_fwait },
+ /* 9C */ { 0, &Ia_pushfw },
+ /* 9D */ { 0, &Ia_popfw },
+ /* 9E */ { 0, &Ia_sahf },
+ /* 9F */ { 0, &Ia_lahf },
+ /* A0 */ { 0, &Ia_movb_AL_Ob },
+ /* A1 */ { 0, &Ia_movw_AX_Ow },
+ /* A0 */ { 0, &Ia_movb_Ob_AL },
+ /* A1 */ { 0, &Ia_movw_Ow_AX },
+ /* A4 */ { 0, &Ia_movsb_Yb_Xb },
+ /* A5 */ { 0, &Ia_movsw_Yw_Xw },
+ /* A6 */ { 0, &Ia_cmpsb_Yb_Xb },
+ /* A7 */ { 0, &Ia_cmpsw_Yw_Xw },
+ /* A8 */ { 0, &Ia_testb_AL_Ib },
+ /* A9 */ { 0, &Ia_testw_AX_Iw },
+ /* AA */ { 0, &Ia_stosb_Yb_AL },
+ /* AB */ { 0, &Ia_stosw_Yw_AX },
+ /* AC */ { 0, &Ia_lodsb_AL_Xb },
+ /* AD */ { 0, &Ia_lodsw_AX_Xw },
+ /* AE */ { 0, &Ia_scasb_Yb_AL },
+ /* AF */ { 0, &Ia_scasw_Yw_AX },
+ /* B0 */ { 0, &Ia_movb_R8_Ib },
+ /* B1 */ { 0, &Ia_movb_R8_Ib },
+ /* B2 */ { 0, &Ia_movb_R8_Ib },
+ /* B3 */ { 0, &Ia_movb_R8_Ib },
+ /* B4 */ { 0, &Ia_movb_R8_Ib },
+ /* B5 */ { 0, &Ia_movb_R8_Ib },
+ /* B6 */ { 0, &Ia_movb_R8_Ib },
+ /* B7 */ { 0, &Ia_movb_R8_Ib },
+ /* B8 */ { 0, &Ia_movw_RX_Iw },
+ /* B9 */ { 0, &Ia_movw_RX_Iw },
+ /* BA */ { 0, &Ia_movw_RX_Iw },
+ /* BB */ { 0, &Ia_movw_RX_Iw },
+ /* BC */ { 0, &Ia_movw_RX_Iw },
+ /* BD */ { 0, &Ia_movw_RX_Iw },
+ /* BE */ { 0, &Ia_movw_RX_Iw },
+ /* BF */ { 0, &Ia_movw_RX_Iw },
+ /* C0 */ { GRPN(G2Eb) },
+ /* C1 */ { GRPN(G2Ew) },
+ /* C2 */ { 0, &Ia_ret_Iw },
+ /* C3 */ { 0, &Ia_ret },
+ /* C4 */ { 0, &Ia_lesw_Gw_Mp },
+ /* C5 */ { 0, &Ia_ldsw_Gw_Mp },
+ /* C6 */ { 0, &Ia_movb_Eb_Ib },
+ /* C7 */ { 0, &Ia_movw_Ew_Iw },
+ /* C8 */ { 0, &Ia_enter },
+ /* C9 */ { 0, &Ia_leave },
+ /* CA */ { 0, &Ia_lret_Iw },
+ /* CB */ { 0, &Ia_lret },
+ /* CC */ { 0, &Ia_int3 },
+ /* CD */ { 0, &Ia_int_Ib },
+ /* CE */ { 0, &Ia_into },
+ /* CF */ { 0, &Ia_iretw },
+ /* D0 */ { GRPN(G2EbI1) },
+ /* D1 */ { GRPN(G2EwI1) },
+ /* D2 */ { GRPN(G2EbCL) },
+ /* D3 */ { GRPN(G2EwCL) },
+ /* D4 */ { 0, &Ia_aam },
+ /* D5 */ { 0, &Ia_aad },
+ /* D6 */ { 0, &Ia_salc },
+ /* D7 */ { 0, &Ia_xlat },
+ /* D8 */ { GRPFP(D8) },
+ /* D9 */ { GRPFP(D9) },
+ /* DA */ { GRPFP(DA) },
+ /* DB */ { GRPFP(DB) },
+ /* DC */ { GRPFP(DC) },
+ /* DD */ { GRPFP(DD) },
+ /* DE */ { GRPFP(DE) },
+ /* DF */ { GRPFP(DF) },
+ /* E0 */ { 0, &Ia_loopne_Jb },
+ /* E1 */ { 0, &Ia_loope_Jb },
+ /* E2 */ { 0, &Ia_loop_Jb },
+ /* E3 */ { 0, &Ia_jcxz_Jb },
+ /* E4 */ { 0, &Ia_inb_AL_Ib },
+ /* E5 */ { 0, &Ia_inw_AX_Ib },
+ /* E6 */ { 0, &Ia_outb_Ib_AL },
+ /* E7 */ { 0, &Ia_outw_Ib_AX },
+ /* E8 */ { 0, &Ia_call_Jw },
+ /* E9 */ { 0, &Ia_jmp_Jw },
+ /* EA */ { 0, &Ia_ljmp_Apw },
+ /* EB */ { 0, &Ia_jmp_Jb },
+ /* EC */ { 0, &Ia_inb_AL_DX },
+ /* ED */ { 0, &Ia_inw_AX_DX },
+ /* EE */ { 0, &Ia_outb_DX_AL },
+ /* EF */ { 0, &Ia_outw_DX_AX },
+ /* F0 */ { 0, &Ia_prefix_lock }, // LOCK:
+ /* F1 */ { 0, &Ia_int1 },
+ /* F2 */ { 0, &Ia_prefix_repne }, // REPNE:
+ /* F3 */ { 0, &Ia_prefix_rep }, // REP:
+ /* F4 */ { 0, &Ia_hlt },
+ /* F5 */ { 0, &Ia_cmc },
+ /* F6 */ { GRPN(G3Eb) },
+ /* F7 */ { GRPN(G3Ew) },
+ /* F8 */ { 0, &Ia_clc },
+ /* F9 */ { 0, &Ia_stc },
+ /* FA */ { 0, &Ia_cli },
+ /* FB */ { 0, &Ia_sti },
+ /* FC */ { 0, &Ia_cld },
+ /* FD */ { 0, &Ia_std },
+ /* FE */ { GRPN(G4) },
+ /* FF */ { GRPN(G5w) },
+
+ // 256 entries for two byte opcodes
+ /* 0F 00 */ { GRPN(G6) },
+ /* 0F 01 */ { GRPN(G7) },
+ /* 0F 02 */ { 0, &Ia_larw_Gw_Ew },
+ /* 0F 03 */ { 0, &Ia_lslw_Gw_Ew },
+ /* 0F 04 */ { 0, &Ia_Invalid },
+ /* 0F 05 */ { 0, &Ia_syscall },
+ /* 0F 06 */ { 0, &Ia_clts },
+ /* 0F 07 */ { 0, &Ia_sysret },
+ /* 0F 08 */ { 0, &Ia_invd },
+ /* 0F 09 */ { 0, &Ia_wbinvd },
+ /* 0F 0A */ { 0, &Ia_Invalid },
+ /* 0F 0B */ { 0, &Ia_ud2a },
+ /* 0F 0C */ { 0, &Ia_Invalid },
+ /* 0F 0D */ { 0, &Ia_prefetch }, // 3DNow!
+ /* 0F 0E */ { 0, &Ia_femms }, // 3DNow!
+ /* 0F 0F */ { GRP3DNOW },
+ /* 0F 10 */ { GRPSSE(0f10) },
+ /* 0F 11 */ { GRPSSE(0f11) },
+ /* 0F 12 */ { GRPSSE(0f12) },
+ /* 0F 13 */ { GRPSSE(0f13) },
+ /* 0F 14 */ { GRPSSE(0f14) },
+ /* 0F 15 */ { GRPSSE(0f15) },
+ /* 0F 16 */ { GRPSSE(0f16) },
+ /* 0F 17 */ { GRPSSE(0f17) },
+ /* 0F 18 */ { GRPN(G16) },
+ /* 0F 19 */ { 0, &Ia_Invalid },
+ /* 0F 1A */ { 0, &Ia_Invalid },
+ /* 0F 1B */ { 0, &Ia_Invalid },
+ /* 0F 1C */ { 0, &Ia_Invalid },
+ /* 0F 1D */ { 0, &Ia_Invalid },
+ /* 0F 1E */ { 0, &Ia_Invalid },
+ /* 0F 1F */ { 0, &Ia_multibyte_nop },
+ /* 0F 20 */ { 0, &Ia_movl_Rd_Cd },
+ /* 0F 21 */ { 0, &Ia_movl_Rd_Dd },
+ /* 0F 22 */ { 0, &Ia_movl_Cd_Rd },
+ /* 0F 23 */ { 0, &Ia_movl_Dd_Rd },
+ /* 0F 24 */ { 0, &Ia_movl_Rd_Td },
+ /* 0F 25 */ { 0, &Ia_Invalid },
+ /* 0F 26 */ { 0, &Ia_movl_Td_Rd },
+ /* 0F 27 */ { 0, &Ia_Invalid },
+ /* 0F 28 */ { GRPSSE(0f28) },
+ /* 0F 29 */ { GRPSSE(0f29) },
+ /* 0F 2A */ { GRPSSE(0f2a) },
+ /* 0F 2B */ { GRPSSE(0f2b) },
+ /* 0F 2C */ { GRPSSE(0f2c) },
+ /* 0F 2D */ { GRPSSE(0f2d) },
+ /* 0F 2E */ { GRPSSE(0f2e) },
+ /* 0F 2F */ { GRPSSE(0f2f) },
+ /* 0F 30 */ { 0, &Ia_wrmsr },
+ /* 0F 31 */ { 0, &Ia_rdtsc },
+ /* 0F 32 */ { 0, &Ia_rdmsr },
+ /* 0F 33 */ { 0, &Ia_rdpmc },
+ /* 0F 34 */ { 0, &Ia_sysenter },
+ /* 0F 35 */ { 0, &Ia_sysexit },
+ /* 0F 36 */ { 0, &Ia_Invalid },
+ /* 0F 37 */ { 0, &Ia_Invalid },
+ /* 0F 38 */ { GR3BTAB(A4) },
+ /* 0F 39 */ { 0, &Ia_Invalid },
+ /* 0F 3A */ { GR3BTAB(A5) },
+ /* 0F 3B */ { 0, &Ia_Invalid },
+ /* 0F 3C */ { 0, &Ia_Invalid },
+ /* 0F 3D */ { 0, &Ia_Invalid },
+ /* 0F 3E */ { 0, &Ia_Invalid },
+ /* 0F 3F */ { 0, &Ia_Invalid },
+ /* 0F 40 */ { 0, &Ia_cmovow_Gw_Ew },
+ /* 0F 41 */ { 0, &Ia_cmovnow_Gw_Ew },
+ /* 0F 42 */ { 0, &Ia_cmovcw_Gw_Ew },
+ /* 0F 43 */ { 0, &Ia_cmovncw_Gw_Ew },
+ /* 0F 44 */ { 0, &Ia_cmovzw_Gw_Ew },
+ /* 0F 45 */ { 0, &Ia_cmovnzw_Gw_Ew },
+ /* 0F 46 */ { 0, &Ia_cmovnaw_Gw_Ew },
+ /* 0F 47 */ { 0, &Ia_cmovaw_Gw_Ew },
+ /* 0F 48 */ { 0, &Ia_cmovsw_Gw_Ew },
+ /* 0F 49 */ { 0, &Ia_cmovnsw_Gw_Ew },
+ /* 0F 4A */ { 0, &Ia_cmovpw_Gw_Ew },
+ /* 0F 4B */ { 0, &Ia_cmovnpw_Gw_Ew },
+ /* 0F 4C */ { 0, &Ia_cmovlw_Gw_Ew },
+ /* 0F 4D */ { 0, &Ia_cmovnlw_Gw_Ew },
+ /* 0F 4E */ { 0, &Ia_cmovngw_Gw_Ew },
+ /* 0F 4F */ { 0, &Ia_cmovgw_Gw_Ew },
+ /* 0F 50 */ { GRPSSE(0f50) },
+ /* 0F 51 */ { GRPSSE(0f51) },
+ /* 0F 52 */ { GRPSSE(0f52) },
+ /* 0F 53 */ { GRPSSE(0f53) },
+ /* 0F 54 */ { GRPSSE(0f54) },
+ /* 0F 55 */ { GRPSSE(0f55) },
+ /* 0F 56 */ { GRPSSE(0f56) },
+ /* 0F 57 */ { GRPSSE(0f57) },
+ /* 0F 58 */ { GRPSSE(0f58) },
+ /* 0F 59 */ { GRPSSE(0f59) },
+ /* 0F 5A */ { GRPSSE(0f5a) },
+ /* 0F 5B */ { GRPSSE(0f5b) },
+ /* 0F 5C */ { GRPSSE(0f5c) },
+ /* 0F 5D */ { GRPSSE(0f5d) },
+ /* 0F 5E */ { GRPSSE(0f5e) },
+ /* 0F 5F */ { GRPSSE(0f5f) },
+ /* 0F 60 */ { GRPSSE(0f60) },
+ /* 0F 61 */ { GRPSSE(0f61) },
+ /* 0F 62 */ { GRPSSE(0f62) },
+ /* 0F 63 */ { GRPSSE(0f63) },
+ /* 0F 64 */ { GRPSSE(0f64) },
+ /* 0F 65 */ { GRPSSE(0f65) },
+ /* 0F 66 */ { GRPSSE(0f66) },
+ /* 0F 67 */ { GRPSSE(0f67) },
+ /* 0F 68 */ { GRPSSE(0f68) },
+ /* 0F 69 */ { GRPSSE(0f69) },
+ /* 0F 6A */ { GRPSSE(0f6a) },
+ /* 0F 6B */ { GRPSSE(0f6b) },
+ /* 0F 6C */ { GRPSSE(0f6c) },
+ /* 0F 6D */ { GRPSSE(0f6d) },
+ /* 0F 6E */ { GRPSSE(0f6e) },
+ /* 0F 6F */ { GRPSSE(0f6f) },
+ /* 0F 70 */ { GRPSSE(0f70) },
+ /* 0F 71 */ { GRPN(G12) },
+ /* 0F 72 */ { GRPN(G13) },
+ /* 0F 73 */ { GRPN(G14) },
+ /* 0F 74 */ { GRPSSE(0f74) },
+ /* 0F 75 */ { GRPSSE(0f75) },
+ /* 0F 76 */ { GRPSSE(0f76) },
+ /* 0F 77 */ { 0, &Ia_emms },
+ /* 0F 78 */ { 0, &Ia_Invalid },
+ /* 0F 79 */ { 0, &Ia_Invalid },
+ /* 0F 7A */ { 0, &Ia_Invalid },
+ /* 0F 7B */ { 0, &Ia_Invalid },
+ /* 0F 7C */ { GRPSSE(0f7c) },
+ /* 0F 7D */ { GRPSSE(0f7d) },
+ /* 0F 7E */ { GRPSSE(0f7e) },
+ /* 0F 7F */ { GRPSSE(0f7f) },
+ /* 0F 80 */ { 0, &Ia_jo_Jw },
+ /* 0F 81 */ { 0, &Ia_jno_Jw },
+ /* 0F 82 */ { 0, &Ia_jb_Jw },
+ /* 0F 83 */ { 0, &Ia_jnb_Jw },
+ /* 0F 84 */ { 0, &Ia_jz_Jw },
+ /* 0F 85 */ { 0, &Ia_jnz_Jw },
+ /* 0F 86 */ { 0, &Ia_jbe_Jw },
+ /* 0F 87 */ { 0, &Ia_jnbe_Jw },
+ /* 0F 88 */ { 0, &Ia_js_Jw },
+ /* 0F 89 */ { 0, &Ia_jns_Jw },
+ /* 0F 8A */ { 0, &Ia_jp_Jw },
+ /* 0F 8B */ { 0, &Ia_jnp_Jw },
+ /* 0F 8C */ { 0, &Ia_jl_Jw },
+ /* 0F 8D */ { 0, &Ia_jnl_Jw },
+ /* 0F 8E */ { 0, &Ia_jle_Jw },
+ /* 0F 8F */ { 0, &Ia_jnle_Jw },
+ /* 0F 90 */ { 0, &Ia_seto_Eb },
+ /* 0F 91 */ { 0, &Ia_setno_Eb },
+ /* 0F 92 */ { 0, &Ia_setb_Eb },
+ /* 0F 93 */ { 0, &Ia_setnb_Eb },
+ /* 0F 94 */ { 0, &Ia_setz_Eb },
+ /* 0F 95 */ { 0, &Ia_setnz_Eb },
+ /* 0F 96 */ { 0, &Ia_setbe_Eb },
+ /* 0F 97 */ { 0, &Ia_setnbe_Eb },
+ /* 0F 98 */ { 0, &Ia_sets_Eb },
+ /* 0F 99 */ { 0, &Ia_setns_Eb },
+ /* 0F 9A */ { 0, &Ia_setp_Eb },
+ /* 0F 9B */ { 0, &Ia_setnp_Eb },
+ /* 0F 9C */ { 0, &Ia_setl_Eb },
+ /* 0F 9D */ { 0, &Ia_setnl_Eb },
+ /* 0F 9E */ { 0, &Ia_setle_Eb },
+ /* 0F 9F */ { 0, &Ia_setnle_Eb },
+ /* 0F A0 */ { 0, &Ia_pushw_FS },
+ /* 0F A1 */ { 0, &Ia_popw_FS },
+ /* 0F A2 */ { 0, &Ia_cpuid },
+ /* 0F A3 */ { 0, &Ia_btw_Ew_Gw },
+ /* 0F A4 */ { 0, &Ia_shldw_Ew_Gw_Ib },
+ /* 0F A5 */ { 0, &Ia_shldw_Ew_Gw_CL },
+ /* 0F A6 */ { 0, &Ia_Invalid },
+ /* 0F A7 */ { 0, &Ia_Invalid },
+ /* 0F A8 */ { 0, &Ia_pushw_GS },
+ /* 0F A9 */ { 0, &Ia_popw_GS },
+ /* 0F AA */ { 0, &Ia_rsm },
+ /* 0F AB */ { 0, &Ia_btsw_Ew_Gw },
+ /* 0F AC */ { 0, &Ia_shrdw_Ew_Gw_Ib },
+ /* 0F AD */ { 0, &Ia_shrdw_Ew_Gw_CL },
+ /* 0F AE */ { GRPN(G15) },
+ /* 0F AF */ { 0, &Ia_imulw_Gw_Ew },
+ /* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
+ /* 0F B1 */ { 0, &Ia_cmpxchgw_Ew_Gw },
+ /* 0F B2 */ { 0, &Ia_lssw_Gw_Mp },
+ /* 0F B3 */ { 0, &Ia_btrw_Ew_Gw },
+ /* 0F B4 */ { 0, &Ia_lfsw_Gw_Mp },
+ /* 0F B5 */ { 0, &Ia_lgsw_Gw_Mp },
+ /* 0F B6 */ { 0, &Ia_movzbw_Gw_Eb },
+ /* 0F B7 */ { 0, &Ia_movw_Gw_Ew },
+ /* 0F B8 */ { 0, &Ia_Invalid },
+ /* 0F B9 */ { 0, &Ia_ud2b },
+ /* 0F BA */ { GRPN(G8EwIb) },
+ /* 0F BB */ { 0, &Ia_btcw_Ew_Gw },
+ /* 0F BC */ { 0, &Ia_bsfw_Gw_Ew },
+ /* 0F BD */ { 0, &Ia_bsrw_Gw_Ew },
+ /* 0F BE */ { 0, &Ia_movsbw_Gw_Eb },
+ /* 0F BF */ { 0, &Ia_movw_Gw_Ew },
+ /* 0F C0 */ { 0, &Ia_xaddb_Eb_Gb },
+ /* 0F C0 */ { 0, &Ia_xaddw_Ew_Gw },
+ /* 0F C2 */ { GRPSSE(0fc2) },
+ /* 0F C3 */ { GRPSSE(0fc3) },
+ /* 0F C4 */ { GRPSSE(0fc4) },
+ /* 0F C5 */ { GRPSSE(0fc5) },
+ /* 0F C6 */ { GRPSSE(0fc6) },
+ /* 0F C7 */ { GRPN(G9) },
+ /* 0F C8 */ { 0, &Ia_bswapl_ERX },
+ /* 0F C9 */ { 0, &Ia_bswapl_ERX },
+ /* 0F CA */ { 0, &Ia_bswapl_ERX },
+ /* 0F CB */ { 0, &Ia_bswapl_ERX },
+ /* 0F CC */ { 0, &Ia_bswapl_ERX },
+ /* 0F CD */ { 0, &Ia_bswapl_ERX },
+ /* 0F CE */ { 0, &Ia_bswapl_ERX },
+ /* 0F CF */ { 0, &Ia_bswapl_ERX },
+ /* 0F D0 */ { GRPSSE(0fd0) },
+ /* 0F D1 */ { GRPSSE(0fd1) },
+ /* 0F D2 */ { GRPSSE(0fd2) },
+ /* 0F D3 */ { GRPSSE(0fd3) },
+ /* 0F D4 */ { GRPSSE(0fd4) },
+ /* 0F D5 */ { GRPSSE(0fd5) },
+ /* 0F D6 */ { GRPSSE(0fd6) },
+ /* 0F D7 */ { GRPSSE(0fd7) },
+ /* 0F D8 */ { GRPSSE(0fd8) },
+ /* 0F D9 */ { GRPSSE(0fd9) },
+ /* 0F DA */ { GRPSSE(0fda) },
+ /* 0F DB */ { GRPSSE(0fdb) },
+ /* 0F DC */ { GRPSSE(0fdc) },
+ /* 0F DD */ { GRPSSE(0fdd) },
+ /* 0F DE */ { GRPSSE(0fde) },
+ /* 0F DF */ { GRPSSE(0fdf) },
+ /* 0F E0 */ { GRPSSE(0fe0) },
+ /* 0F E1 */ { GRPSSE(0fe1) },
+ /* 0F E2 */ { GRPSSE(0fe2) },
+ /* 0F E3 */ { GRPSSE(0fe3) },
+ /* 0F E4 */ { GRPSSE(0fe4) },
+ /* 0F E5 */ { GRPSSE(0fe5) },
+ /* 0F E6 */ { GRPSSE(0fe6) },
+ /* 0F E7 */ { GRPSSE(0fe7) },
+ /* 0F E8 */ { GRPSSE(0fe8) },
+ /* 0F E9 */ { GRPSSE(0fe9) },
+ /* 0F EA */ { GRPSSE(0fea) },
+ /* 0F EB */ { GRPSSE(0feb) },
+ /* 0F EC */ { GRPSSE(0fec) },
+ /* 0F ED */ { GRPSSE(0fed) },
+ /* 0F EE */ { GRPSSE(0fee) },
+ /* 0F EF */ { GRPSSE(0fef) },
+ /* 0F F0 */ { GRPSSE(0ff0) },
+ /* 0F F1 */ { GRPSSE(0ff1) },
+ /* 0F F2 */ { GRPSSE(0ff2) },
+ /* 0F F3 */ { GRPSSE(0ff3) },
+ /* 0F F4 */ { GRPSSE(0ff4) },
+ /* 0F F5 */ { GRPSSE(0ff5) },
+ /* 0F F6 */ { GRPSSE(0ff6) },
+ /* 0F F7 */ { GRPSSE(0ff7) },
+ /* 0F F8 */ { GRPSSE(0ff8) },
+ /* 0F F9 */ { GRPSSE(0ff9) },
+ /* 0F FA */ { GRPSSE(0ffa) },
+ /* 0F FB */ { GRPSSE(0ffb) },
+ /* 0F FC */ { GRPSSE(0ffc) },
+ /* 0F FD */ { GRPSSE(0ffd) },
+ /* 0F FE */ { GRPSSE(0ffe) },
+ /* 0F FF */ { 0, &Ia_Invalid }
+};
+
+/* ************************************************************************ */
+/* 32-bit operand size */
+
+static BxDisasmOpcodeTable_t BxDisasmOpcodes32[256*2] = {
+ // 256 entries for single byte opcodes
+ /* 00 */ { 0, &Ia_addb_Eb_Gb },
+ /* 01 */ { 0, &Ia_addl_Ed_Gd },
+ /* 02 */ { 0, &Ia_addb_Gb_Eb },
+ /* 03 */ { 0, &Ia_addl_Gd_Ed },
+ /* 04 */ { 0, &Ia_addb_AL_Ib, },
+ /* 05 */ { 0, &Ia_addl_EAX_Id, },
+ /* 06 */ { 0, &Ia_pushl_ES },
+ /* 07 */ { 0, &Ia_popl_ES },
+ /* 08 */ { 0, &Ia_orb_Eb_Gb },
+ /* 09 */ { 0, &Ia_orl_Ed_Gd },
+ /* 0A */ { 0, &Ia_orb_Gb_Eb },
+ /* 0B */ { 0, &Ia_orl_Gd_Ed },
+ /* 0C */ { 0, &Ia_orb_AL_Ib },
+ /* 0D */ { 0, &Ia_orl_EAX_Id },
+ /* 0E */ { 0, &Ia_pushl_CS },
+ /* 0F */ { 0, &Ia_error }, // 2 byte escape
+ /* 10 */ { 0, &Ia_adcb_Eb_Gb },
+ /* 11 */ { 0, &Ia_adcl_Ed_Gd },
+ /* 12 */ { 0, &Ia_adcb_Gb_Eb },
+ /* 13 */ { 0, &Ia_adcl_Gd_Ed },
+ /* 14 */ { 0, &Ia_adcb_AL_Ib },
+ /* 15 */ { 0, &Ia_adcl_EAX_Id },
+ /* 16 */ { 0, &Ia_pushl_SS },
+ /* 17 */ { 0, &Ia_popl_SS },
+ /* 18 */ { 0, &Ia_sbbb_Eb_Gb },
+ /* 19 */ { 0, &Ia_sbbl_Ed_Gd },
+ /* 1A */ { 0, &Ia_sbbb_Gb_Eb },
+ /* 1B */ { 0, &Ia_sbbl_Gd_Ed },
+ /* 1C */ { 0, &Ia_sbbb_AL_Ib },
+ /* 1D */ { 0, &Ia_sbbl_EAX_Id },
+ /* 1E */ { 0, &Ia_pushl_DS },
+ /* 1F */ { 0, &Ia_popl_DS },
+ /* 20 */ { 0, &Ia_andb_Eb_Gb },
+ /* 21 */ { 0, &Ia_andl_Ed_Gd },
+ /* 22 */ { 0, &Ia_andb_Gb_Eb },
+ /* 23 */ { 0, &Ia_andl_Gd_Ed },
+ /* 24 */ { 0, &Ia_andb_AL_Ib },
+ /* 25 */ { 0, &Ia_andl_EAX_Id },
+ /* 26 */ { 0, &Ia_prefix_es }, // ES:
+ /* 27 */ { 0, &Ia_daa },
+ /* 28 */ { 0, &Ia_subb_Eb_Gb },
+ /* 29 */ { 0, &Ia_subl_Ed_Gd },
+ /* 2A */ { 0, &Ia_subb_Gb_Eb },
+ /* 2B */ { 0, &Ia_subl_Gd_Ed },
+ /* 2C */ { 0, &Ia_subb_AL_Ib },
+ /* 2D */ { 0, &Ia_subl_EAX_Id },
+ /* 2E */ { 0, &Ia_prefix_cs }, // CS:
+ /* 2F */ { 0, &Ia_das },
+ /* 30 */ { 0, &Ia_xorb_Eb_Gb },
+ /* 31 */ { 0, &Ia_xorl_Ed_Gd },
+ /* 32 */ { 0, &Ia_xorb_Gb_Eb },
+ /* 33 */ { 0, &Ia_xorl_Gd_Ed },
+ /* 34 */ { 0, &Ia_xorb_AL_Ib },
+ /* 35 */ { 0, &Ia_xorl_EAX_Id },
+ /* 36 */ { 0, &Ia_prefix_ss }, // SS:
+ /* 37 */ { 0, &Ia_aaa },
+ /* 38 */ { 0, &Ia_cmpb_Eb_Gb },
+ /* 39 */ { 0, &Ia_cmpl_Ed_Gd },
+ /* 3A */ { 0, &Ia_cmpb_Gb_Eb },
+ /* 3B */ { 0, &Ia_cmpl_Gd_Ed },
+ /* 3C */ { 0, &Ia_cmpb_AL_Ib },
+ /* 3D */ { 0, &Ia_cmpl_EAX_Id },
+ /* 3E */ { 0, &Ia_prefix_ds }, // DS:
+ /* 3F */ { 0, &Ia_aas },
+ /* 40 */ { 0, &Ia_incl_ERX },
+ /* 41 */ { 0, &Ia_incl_ERX },
+ /* 42 */ { 0, &Ia_incl_ERX },
+ /* 43 */ { 0, &Ia_incl_ERX },
+ /* 44 */ { 0, &Ia_incl_ERX },
+ /* 45 */ { 0, &Ia_incl_ERX },
+ /* 46 */ { 0, &Ia_incl_ERX },
+ /* 47 */ { 0, &Ia_incl_ERX },
+ /* 48 */ { 0, &Ia_decl_ERX },
+ /* 49 */ { 0, &Ia_decl_ERX },
+ /* 4A */ { 0, &Ia_decl_ERX },
+ /* 4B */ { 0, &Ia_decl_ERX },
+ /* 4C */ { 0, &Ia_decl_ERX },
+ /* 4D */ { 0, &Ia_decl_ERX },
+ /* 4E */ { 0, &Ia_decl_ERX },
+ /* 4F */ { 0, &Ia_decl_ERX },
+ /* 50 */ { 0, &Ia_pushl_ERX },
+ /* 51 */ { 0, &Ia_pushl_ERX },
+ /* 52 */ { 0, &Ia_pushl_ERX },
+ /* 53 */ { 0, &Ia_pushl_ERX },
+ /* 54 */ { 0, &Ia_pushl_ERX },
+ /* 55 */ { 0, &Ia_pushl_ERX },
+ /* 56 */ { 0, &Ia_pushl_ERX },
+ /* 57 */ { 0, &Ia_pushl_ERX },
+ /* 58 */ { 0, &Ia_popl_ERX },
+ /* 59 */ { 0, &Ia_popl_ERX },
+ /* 5A */ { 0, &Ia_popl_ERX },
+ /* 5B */ { 0, &Ia_popl_ERX },
+ /* 5C */ { 0, &Ia_popl_ERX },
+ /* 5D */ { 0, &Ia_popl_ERX },
+ /* 5E */ { 0, &Ia_popl_ERX },
+ /* 5F */ { 0, &Ia_popl_ERX },
+ /* 60 */ { 0, &Ia_pushal },
+ /* 61 */ { 0, &Ia_popal },
+ /* 62 */ { 0, &Ia_boundl_Gd_Ma },
+ /* 63 */ { 0, &Ia_arpl_Ew_Rw },
+ /* 64 */ { 0, &Ia_prefix_fs }, // FS:
+ /* 65 */ { 0, &Ia_prefix_gs }, // GS:
+ /* 66 */ { 0, &Ia_prefix_osize }, // OSIZE:
+ /* 67 */ { 0, &Ia_prefix_asize }, // ASIZE:
+ /* 68 */ { 0, &Ia_pushl_Id },
+ /* 69 */ { 0, &Ia_imull_Gd_Ed_Id },
+ /* 6A */ { 0, &Ia_pushl_sIb },
+ /* 6B */ { 0, &Ia_imull_Gd_Ed_sIb },
+ /* 6C */ { 0, &Ia_insb_Yb_DX },
+ /* 6D */ { 0, &Ia_insl_Yd_DX },
+ /* 6E */ { 0, &Ia_outsb_DX_Xb },
+ /* 6F */ { 0, &Ia_outsl_DX_Xd },
+ /* 70 */ { 0, &Ia_jo_Jb },
+ /* 71 */ { 0, &Ia_jno_Jb },
+ /* 72 */ { 0, &Ia_jb_Jb },
+ /* 73 */ { 0, &Ia_jnb_Jb },
+ /* 74 */ { 0, &Ia_jz_Jb },
+ /* 75 */ { 0, &Ia_jnz_Jb },
+ /* 76 */ { 0, &Ia_jbe_Jb },
+ /* 77 */ { 0, &Ia_jnbe_Jb },
+ /* 78 */ { 0, &Ia_js_Jb },
+ /* 79 */ { 0, &Ia_jns_Jb },
+ /* 7A */ { 0, &Ia_jp_Jb },
+ /* 7B */ { 0, &Ia_jnp_Jb },
+ /* 7C */ { 0, &Ia_jl_Jb },
+ /* 7D */ { 0, &Ia_jnl_Jb },
+ /* 7E */ { 0, &Ia_jle_Jb },
+ /* 7F */ { 0, &Ia_jnle_Jb },
+ /* 80 */ { GRPN(G1EbIb) },
+ /* 81 */ { GRPN(G1EdId) },
+ /* 82 */ { GRPN(G1EbIb) },
+ /* 83 */ { GRPN(G1EdIb) },
+ /* 84 */ { 0, &Ia_testb_Eb_Gb },
+ /* 85 */ { 0, &Ia_testl_Ed_Gd },
+ /* 86 */ { 0, &Ia_xchgb_Eb_Gb },
+ /* 87 */ { 0, &Ia_xchgl_Ed_Gd },
+ /* 88 */ { 0, &Ia_movb_Eb_Gb },
+ /* 89 */ { 0, &Ia_movl_Ed_Gd },
+ /* 8A */ { 0, &Ia_movb_Gb_Eb },
+ /* 8B */ { 0, &Ia_movl_Gd_Ed },
+ /* 8C */ { 0, &Ia_movw_Ew_Sw },
+ /* 8D */ { 0, &Ia_leal_Gd_Md },
+ /* 8E */ { 0, &Ia_movw_Sw_Ew },
+ /* 8F */ { 0, &Ia_popl_Ed },
+ /* 90 */ { 0, &Ia_nop },
+ /* 91 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 92 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 93 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 94 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 95 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 96 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 97 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 98 */ { 0, &Ia_cwde },
+ /* 99 */ { 0, &Ia_cdq },
+ /* 9A */ { 0, &Ia_lcall_Apd },
+ /* 9B */ { 0, &Ia_fwait },
+ /* 9C */ { 0, &Ia_pushfl },
+ /* 9D */ { 0, &Ia_popfl },
+ /* 9E */ { 0, &Ia_sahf },
+ /* 9F */ { 0, &Ia_lahf },
+ /* A0 */ { 0, &Ia_movb_AL_Ob },
+ /* A1 */ { 0, &Ia_movl_EAX_Od },
+ /* A0 */ { 0, &Ia_movb_Ob_AL },
+ /* A1 */ { 0, &Ia_movl_Od_EAX },
+ /* A4 */ { 0, &Ia_movsb_Yb_Xb },
+ /* A5 */ { 0, &Ia_movsl_Yd_Xd },
+ /* A6 */ { 0, &Ia_cmpsb_Yb_Xb },
+ /* A7 */ { 0, &Ia_cmpsl_Yd_Xd },
+ /* A8 */ { 0, &Ia_testb_AL_Ib },
+ /* A9 */ { 0, &Ia_testl_EAX_Id },
+ /* AA */ { 0, &Ia_stosb_Yb_AL },
+ /* AB */ { 0, &Ia_stosl_Yd_EAX },
+ /* AC */ { 0, &Ia_lodsb_AL_Xb },
+ /* AD */ { 0, &Ia_lodsl_EAX_Xd },
+ /* AE */ { 0, &Ia_scasb_Yb_AL },
+ /* AF */ { 0, &Ia_scasl_Yd_EAX },
+ /* B0 */ { 0, &Ia_movb_R8_Ib },
+ /* B1 */ { 0, &Ia_movb_R8_Ib },
+ /* B2 */ { 0, &Ia_movb_R8_Ib },
+ /* B3 */ { 0, &Ia_movb_R8_Ib },
+ /* B4 */ { 0, &Ia_movb_R8_Ib },
+ /* B5 */ { 0, &Ia_movb_R8_Ib },
+ /* B6 */ { 0, &Ia_movb_R8_Ib },
+ /* B7 */ { 0, &Ia_movb_R8_Ib },
+ /* B8 */ { 0, &Ia_movl_ERX_Id },
+ /* B9 */ { 0, &Ia_movl_ERX_Id },
+ /* BA */ { 0, &Ia_movl_ERX_Id },
+ /* BB */ { 0, &Ia_movl_ERX_Id },
+ /* BC */ { 0, &Ia_movl_ERX_Id },
+ /* BD */ { 0, &Ia_movl_ERX_Id },
+ /* BE */ { 0, &Ia_movl_ERX_Id },
+ /* BF */ { 0, &Ia_movl_ERX_Id },
+ /* C0 */ { GRPN(G2Eb) },
+ /* C1 */ { GRPN(G2Ed) },
+ /* C2 */ { 0, &Ia_ret_Iw },
+ /* C3 */ { 0, &Ia_ret },
+ /* C4 */ { 0, &Ia_lesl_Gd_Mp },
+ /* C5 */ { 0, &Ia_ldsl_Gd_Mp },
+ /* C6 */ { 0, &Ia_movb_Eb_Ib },
+ /* C7 */ { 0, &Ia_movl_Ed_Id },
+ /* C8 */ { 0, &Ia_enter },
+ /* C9 */ { 0, &Ia_leave },
+ /* CA */ { 0, &Ia_lret_Iw },
+ /* CB */ { 0, &Ia_lret },
+ /* CC */ { 0, &Ia_int3 },
+ /* CD */ { 0, &Ia_int_Ib },
+ /* CE */ { 0, &Ia_into },
+ /* CF */ { 0, &Ia_iretl },
+ /* D0 */ { GRPN(G2EbI1) },
+ /* D1 */ { GRPN(G2EdI1) },
+ /* D2 */ { GRPN(G2EbCL) },
+ /* D3 */ { GRPN(G2EdCL) },
+ /* D4 */ { 0, &Ia_aam },
+ /* D5 */ { 0, &Ia_aad },
+ /* D6 */ { 0, &Ia_salc },
+ /* D7 */ { 0, &Ia_xlat },
+ /* D8 */ { GRPFP(D8) },
+ /* D9 */ { GRPFP(D9) },
+ /* DA */ { GRPFP(DA) },
+ /* DB */ { GRPFP(DB) },
+ /* DC */ { GRPFP(DC) },
+ /* DD */ { GRPFP(DD) },
+ /* DE */ { GRPFP(DE) },
+ /* DF */ { GRPFP(DF) },
+ /* E0 */ { 0, &Ia_loopne_Jb },
+ /* E1 */ { 0, &Ia_loope_Jb },
+ /* E2 */ { 0, &Ia_loop_Jb },
+ /* E3 */ { 0, &Ia_jcxz_Jb },
+ /* E4 */ { 0, &Ia_inb_AL_Ib },
+ /* E5 */ { 0, &Ia_inl_EAX_Ib },
+ /* E6 */ { 0, &Ia_outb_Ib_AL },
+ /* E7 */ { 0, &Ia_outl_Ib_EAX },
+ /* E8 */ { 0, &Ia_call_Jd },
+ /* E9 */ { 0, &Ia_jmp_Jd },
+ /* EA */ { 0, &Ia_ljmp_Apd },
+ /* EB */ { 0, &Ia_jmp_Jb },
+ /* EC */ { 0, &Ia_inb_AL_DX },
+ /* ED */ { 0, &Ia_inl_EAX_DX },
+ /* EE */ { 0, &Ia_outb_DX_AL },
+ /* EF */ { 0, &Ia_outl_DX_EAX },
+ /* F0 */ { 0, &Ia_prefix_lock }, // LOCK:
+ /* F1 */ { 0, &Ia_int1 },
+ /* F2 */ { 0, &Ia_prefix_repne }, // REPNE:
+ /* F3 */ { 0, &Ia_prefix_rep }, // REP:
+ /* F4 */ { 0, &Ia_hlt },
+ /* F5 */ { 0, &Ia_cmc },
+ /* F6 */ { GRPN(G3Eb) },
+ /* F7 */ { GRPN(G3Ed) },
+ /* F8 */ { 0, &Ia_clc },
+ /* F9 */ { 0, &Ia_stc },
+ /* FA */ { 0, &Ia_cli },
+ /* FB */ { 0, &Ia_sti },
+ /* FC */ { 0, &Ia_cld },
+ /* FD */ { 0, &Ia_std },
+ /* FE */ { GRPN(G4) },
+ /* FF */ { GRPN(G5d) },
+
+ // 256 entries for two byte opcodes
+ /* 0F 00 */ { GRPN(G6) },
+ /* 0F 01 */ { GRPN(G7) },
+ /* 0F 02 */ { 0, &Ia_larl_Gd_Ew },
+ /* 0F 03 */ { 0, &Ia_lsll_Gd_Ew },
+ /* 0F 04 */ { 0, &Ia_Invalid },
+ /* 0F 05 */ { 0, &Ia_syscall },
+ /* 0F 06 */ { 0, &Ia_clts },
+ /* 0F 07 */ { 0, &Ia_sysret },
+ /* 0F 08 */ { 0, &Ia_invd },
+ /* 0F 09 */ { 0, &Ia_wbinvd },
+ /* 0F 0A */ { 0, &Ia_Invalid },
+ /* 0F 0B */ { 0, &Ia_ud2a },
+ /* 0F 0C */ { 0, &Ia_Invalid },
+ /* 0F 0D */ { 0, &Ia_prefetch }, // 3DNow!
+ /* 0F 0E */ { 0, &Ia_femms }, // 3DNow!
+ /* 0F 0F */ { GRP3DNOW },
+ /* 0F 10 */ { GRPSSE(0f10) },
+ /* 0F 11 */ { GRPSSE(0f11) },
+ /* 0F 12 */ { GRPSSE(0f12) },
+ /* 0F 13 */ { GRPSSE(0f13) },
+ /* 0F 14 */ { GRPSSE(0f14) },
+ /* 0F 15 */ { GRPSSE(0f15) },
+ /* 0F 16 */ { GRPSSE(0f16) },
+ /* 0F 17 */ { GRPSSE(0f17) },
+ /* 0F 18 */ { GRPN(G16) },
+ /* 0F 19 */ { 0, &Ia_Invalid },
+ /* 0F 1A */ { 0, &Ia_Invalid },
+ /* 0F 1B */ { 0, &Ia_Invalid },
+ /* 0F 1C */ { 0, &Ia_Invalid },
+ /* 0F 1D */ { 0, &Ia_Invalid },
+ /* 0F 1E */ { 0, &Ia_Invalid },
+ /* 0F 1F */ { 0, &Ia_multibyte_nop },
+ /* 0F 20 */ { 0, &Ia_movl_Rd_Cd },
+ /* 0F 21 */ { 0, &Ia_movl_Rd_Dd },
+ /* 0F 22 */ { 0, &Ia_movl_Cd_Rd },
+ /* 0F 23 */ { 0, &Ia_movl_Dd_Rd },
+ /* 0F 24 */ { 0, &Ia_movl_Rd_Td },
+ /* 0F 25 */ { 0, &Ia_Invalid },
+ /* 0F 26 */ { 0, &Ia_movl_Td_Rd },
+ /* 0F 27 */ { 0, &Ia_Invalid },
+ /* 0F 28 */ { GRPSSE(0f28) },
+ /* 0F 29 */ { GRPSSE(0f29) },
+ /* 0F 2A */ { GRPSSE(0f2a) },
+ /* 0F 2B */ { GRPSSE(0f2b) },
+ /* 0F 2C */ { GRPSSE(0f2c) },
+ /* 0F 2D */ { GRPSSE(0f2d) },
+ /* 0F 2E */ { GRPSSE(0f2e) },
+ /* 0F 2F */ { GRPSSE(0f2f) },
+ /* 0F 30 */ { 0, &Ia_wrmsr },
+ /* 0F 31 */ { 0, &Ia_rdtsc },
+ /* 0F 32 */ { 0, &Ia_rdmsr },
+ /* 0F 33 */ { 0, &Ia_rdpmc },
+ /* 0F 34 */ { 0, &Ia_sysenter },
+ /* 0F 35 */ { 0, &Ia_sysexit },
+ /* 0F 36 */ { 0, &Ia_Invalid },
+ /* 0F 37 */ { 0, &Ia_Invalid },
+ /* 0F 38 */ { GR3BTAB(A4) },
+ /* 0F 39 */ { 0, &Ia_Invalid },
+ /* 0F 3A */ { GR3BTAB(A5) },
+ /* 0F 3B */ { 0, &Ia_Invalid },
+ /* 0F 3C */ { 0, &Ia_Invalid },
+ /* 0F 3D */ { 0, &Ia_Invalid },
+ /* 0F 3E */ { 0, &Ia_Invalid },
+ /* 0F 3F */ { 0, &Ia_Invalid },
+ /* 0F 40 */ { 0, &Ia_cmovol_Gd_Ed },
+ /* 0F 41 */ { 0, &Ia_cmovnol_Gd_Ed },
+ /* 0F 42 */ { 0, &Ia_cmovcl_Gd_Ed },
+ /* 0F 43 */ { 0, &Ia_cmovncl_Gd_Ed },
+ /* 0F 44 */ { 0, &Ia_cmovzl_Gd_Ed },
+ /* 0F 45 */ { 0, &Ia_cmovnzl_Gd_Ed },
+ /* 0F 46 */ { 0, &Ia_cmovnal_Gd_Ed },
+ /* 0F 47 */ { 0, &Ia_cmoval_Gd_Ed },
+ /* 0F 48 */ { 0, &Ia_cmovsl_Gd_Ed },
+ /* 0F 49 */ { 0, &Ia_cmovnsl_Gd_Ed },
+ /* 0F 4A */ { 0, &Ia_cmovpl_Gd_Ed },
+ /* 0F 4B */ { 0, &Ia_cmovnpl_Gd_Ed },
+ /* 0F 4C */ { 0, &Ia_cmovll_Gd_Ed },
+ /* 0F 4D */ { 0, &Ia_cmovnll_Gd_Ed },
+ /* 0F 4E */ { 0, &Ia_cmovngl_Gd_Ed },
+ /* 0F 4F */ { 0, &Ia_cmovgl_Gd_Ed },
+ /* 0F 50 */ { GRPSSE(0f50) },
+ /* 0F 51 */ { GRPSSE(0f51) },
+ /* 0F 52 */ { GRPSSE(0f52) },
+ /* 0F 53 */ { GRPSSE(0f53) },
+ /* 0F 54 */ { GRPSSE(0f54) },
+ /* 0F 55 */ { GRPSSE(0f55) },
+ /* 0F 56 */ { GRPSSE(0f56) },
+ /* 0F 57 */ { GRPSSE(0f57) },
+ /* 0F 58 */ { GRPSSE(0f58) },
+ /* 0F 59 */ { GRPSSE(0f59) },
+ /* 0F 5A */ { GRPSSE(0f5a) },
+ /* 0F 5B */ { GRPSSE(0f5b) },
+ /* 0F 5C */ { GRPSSE(0f5c) },
+ /* 0F 5D */ { GRPSSE(0f5d) },
+ /* 0F 5E */ { GRPSSE(0f5e) },
+ /* 0F 5F */ { GRPSSE(0f5f) },
+ /* 0F 60 */ { GRPSSE(0f60) },
+ /* 0F 61 */ { GRPSSE(0f61) },
+ /* 0F 62 */ { GRPSSE(0f62) },
+ /* 0F 63 */ { GRPSSE(0f63) },
+ /* 0F 64 */ { GRPSSE(0f64) },
+ /* 0F 65 */ { GRPSSE(0f65) },
+ /* 0F 66 */ { GRPSSE(0f66) },
+ /* 0F 67 */ { GRPSSE(0f67) },
+ /* 0F 68 */ { GRPSSE(0f68) },
+ /* 0F 69 */ { GRPSSE(0f69) },
+ /* 0F 6A */ { GRPSSE(0f6a) },
+ /* 0F 6B */ { GRPSSE(0f6b) },
+ /* 0F 6C */ { GRPSSE(0f6c) },
+ /* 0F 6D */ { GRPSSE(0f6d) },
+ /* 0F 6E */ { GRPSSE(0f6e) },
+ /* 0F 6F */ { GRPSSE(0f6f) },
+ /* 0F 70 */ { GRPSSE(0f70) },
+ /* 0F 71 */ { GRPN(G12) },
+ /* 0F 72 */ { GRPN(G13) },
+ /* 0F 73 */ { GRPN(G14) },
+ /* 0F 74 */ { GRPSSE(0f74) },
+ /* 0F 75 */ { GRPSSE(0f75) },
+ /* 0F 76 */ { GRPSSE(0f76) },
+ /* 0F 77 */ { 0, &Ia_emms },
+ /* 0F 78 */ { 0, &Ia_Invalid },
+ /* 0F 79 */ { 0, &Ia_Invalid },
+ /* 0F 7A */ { 0, &Ia_Invalid },
+ /* 0F 7B */ { 0, &Ia_Invalid },
+ /* 0F 7C */ { GRPSSE(0f7c) },
+ /* 0F 7D */ { GRPSSE(0f7d) },
+ /* 0F 7E */ { GRPSSE(0f7e) },
+ /* 0F 7F */ { GRPSSE(0f7f) },
+ /* 0F 80 */ { 0, &Ia_jo_Jd },
+ /* 0F 81 */ { 0, &Ia_jno_Jd },
+ /* 0F 82 */ { 0, &Ia_jb_Jd },
+ /* 0F 83 */ { 0, &Ia_jnb_Jd },
+ /* 0F 84 */ { 0, &Ia_jz_Jd },
+ /* 0F 85 */ { 0, &Ia_jnz_Jd },
+ /* 0F 86 */ { 0, &Ia_jbe_Jd },
+ /* 0F 87 */ { 0, &Ia_jnbe_Jd },
+ /* 0F 88 */ { 0, &Ia_js_Jd },
+ /* 0F 89 */ { 0, &Ia_jns_Jd },
+ /* 0F 8A */ { 0, &Ia_jp_Jd },
+ /* 0F 8B */ { 0, &Ia_jnp_Jd },
+ /* 0F 8C */ { 0, &Ia_jl_Jd },
+ /* 0F 8D */ { 0, &Ia_jnl_Jd },
+ /* 0F 8E */ { 0, &Ia_jle_Jd },
+ /* 0F 8F */ { 0, &Ia_jnle_Jd },
+ /* 0F 90 */ { 0, &Ia_seto_Eb },
+ /* 0F 91 */ { 0, &Ia_setno_Eb },
+ /* 0F 92 */ { 0, &Ia_setb_Eb },
+ /* 0F 93 */ { 0, &Ia_setnb_Eb },
+ /* 0F 94 */ { 0, &Ia_setz_Eb },
+ /* 0F 95 */ { 0, &Ia_setnz_Eb },
+ /* 0F 96 */ { 0, &Ia_setbe_Eb },
+ /* 0F 97 */ { 0, &Ia_setnbe_Eb },
+ /* 0F 98 */ { 0, &Ia_sets_Eb },
+ /* 0F 99 */ { 0, &Ia_setns_Eb },
+ /* 0F 9A */ { 0, &Ia_setp_Eb },
+ /* 0F 9B */ { 0, &Ia_setnp_Eb },
+ /* 0F 9C */ { 0, &Ia_setl_Eb },
+ /* 0F 9D */ { 0, &Ia_setnl_Eb },
+ /* 0F 9E */ { 0, &Ia_setle_Eb },
+ /* 0F 9F */ { 0, &Ia_setnle_Eb },
+ /* 0F A0 */ { 0, &Ia_pushl_FS },
+ /* 0F A1 */ { 0, &Ia_popl_FS },
+ /* 0F A2 */ { 0, &Ia_cpuid },
+ /* 0F A3 */ { 0, &Ia_btl_Ed_Gd },
+ /* 0F A4 */ { 0, &Ia_shldl_Ed_Gd_Ib },
+ /* 0F A5 */ { 0, &Ia_shldl_Ed_Gd_CL },
+ /* 0F A6 */ { 0, &Ia_Invalid },
+ /* 0F A7 */ { 0, &Ia_Invalid },
+ /* 0F A8 */ { 0, &Ia_pushl_GS },
+ /* 0F A9 */ { 0, &Ia_popl_GS },
+ /* 0F AA */ { 0, &Ia_rsm },
+ /* 0F AB */ { 0, &Ia_btsl_Ed_Gd },
+ /* 0F AC */ { 0, &Ia_shrdl_Ed_Gd_Ib },
+ /* 0F AD */ { 0, &Ia_shrdl_Ed_Gd_CL },
+ /* 0F AE */ { GRPN(G15) },
+ /* 0F AF */ { 0, &Ia_imull_Gd_Ed },
+ /* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
+ /* 0F B1 */ { 0, &Ia_cmpxchgl_Ed_Gd },
+ /* 0F B2 */ { 0, &Ia_lssl_Gd_Mp },
+ /* 0F B3 */ { 0, &Ia_btrl_Ed_Gd },
+ /* 0F B4 */ { 0, &Ia_lfsl_Gd_Mp },
+ /* 0F B5 */ { 0, &Ia_lgsl_Gd_Mp },
+ /* 0F B6 */ { 0, &Ia_movzbl_Gd_Eb },
+ /* 0F B7 */ { 0, &Ia_movzwl_Gd_Ew },
+ /* 0F B8 */ { 0, &Ia_Invalid },
+ /* 0F B9 */ { 0, &Ia_ud2b },
+ /* 0F BA */ { GRPN(G8EdIb) },
+ /* 0F BB */ { 0, &Ia_btcl_Ed_Gd },
+ /* 0F BC */ { 0, &Ia_bsfl_Gd_Ed },
+ /* 0F BD */ { 0, &Ia_bsrl_Gd_Ed },
+ /* 0F BE */ { 0, &Ia_movsbl_Gd_Eb },
+ /* 0F BF */ { 0, &Ia_movswl_Gd_Ew },
+ /* 0F C0 */ { 0, &Ia_xaddb_Eb_Gb },
+ /* 0F C0 */ { 0, &Ia_xaddl_Ed_Gd },
+ /* 0F C2 */ { GRPSSE(0fc2) },
+ /* 0F C3 */ { GRPSSE(0fc3) },
+ /* 0F C4 */ { GRPSSE(0fc4) },
+ /* 0F C5 */ { GRPSSE(0fc5) },
+ /* 0F C6 */ { GRPSSE(0fc6) },
+ /* 0F C7 */ { GRPN(G9) },
+ /* 0F C8 */ { 0, &Ia_bswapl_ERX },
+ /* 0F C9 */ { 0, &Ia_bswapl_ERX },
+ /* 0F CA */ { 0, &Ia_bswapl_ERX },
+ /* 0F CB */ { 0, &Ia_bswapl_ERX },
+ /* 0F CC */ { 0, &Ia_bswapl_ERX },
+ /* 0F CD */ { 0, &Ia_bswapl_ERX },
+ /* 0F CE */ { 0, &Ia_bswapl_ERX },
+ /* 0F CF */ { 0, &Ia_bswapl_ERX },
+ /* 0F D0 */ { GRPSSE(0fd0) },
+ /* 0F D1 */ { GRPSSE(0fd1) },
+ /* 0F D2 */ { GRPSSE(0fd2) },
+ /* 0F D3 */ { GRPSSE(0fd3) },
+ /* 0F D4 */ { GRPSSE(0fd4) },
+ /* 0F D5 */ { GRPSSE(0fd5) },
+ /* 0F D6 */ { GRPSSE(0fd6) },
+ /* 0F D7 */ { GRPSSE(0fd7) },
+ /* 0F D8 */ { GRPSSE(0fd8) },
+ /* 0F D9 */ { GRPSSE(0fd9) },
+ /* 0F DA */ { GRPSSE(0fda) },
+ /* 0F DB */ { GRPSSE(0fdb) },
+ /* 0F DC */ { GRPSSE(0fdc) },
+ /* 0F DD */ { GRPSSE(0fdd) },
+ /* 0F DE */ { GRPSSE(0fde) },
+ /* 0F DF */ { GRPSSE(0fdf) },
+ /* 0F E0 */ { GRPSSE(0fe0) },
+ /* 0F E1 */ { GRPSSE(0fe1) },
+ /* 0F E2 */ { GRPSSE(0fe2) },
+ /* 0F E3 */ { GRPSSE(0fe3) },
+ /* 0F E4 */ { GRPSSE(0fe4) },
+ /* 0F E5 */ { GRPSSE(0fe5) },
+ /* 0F E6 */ { GRPSSE(0fe6) },
+ /* 0F E7 */ { GRPSSE(0fe7) },
+ /* 0F E8 */ { GRPSSE(0fe8) },
+ /* 0F E9 */ { GRPSSE(0fe9) },
+ /* 0F EA */ { GRPSSE(0fea) },
+ /* 0F EB */ { GRPSSE(0feb) },
+ /* 0F EC */ { GRPSSE(0fec) },
+ /* 0F ED */ { GRPSSE(0fed) },
+ /* 0F EE */ { GRPSSE(0fee) },
+ /* 0F EF */ { GRPSSE(0fef) },
+ /* 0F F0 */ { GRPSSE(0ff0) },
+ /* 0F F1 */ { GRPSSE(0ff1) },
+ /* 0F F2 */ { GRPSSE(0ff2) },
+ /* 0F F3 */ { GRPSSE(0ff3) },
+ /* 0F F4 */ { GRPSSE(0ff4) },
+ /* 0F F5 */ { GRPSSE(0ff5) },
+ /* 0F F6 */ { GRPSSE(0ff6) },
+ /* 0F F7 */ { GRPSSE(0ff7) },
+ /* 0F F8 */ { GRPSSE(0ff8) },
+ /* 0F F9 */ { GRPSSE(0ff9) },
+ /* 0F FA */ { GRPSSE(0ffa) },
+ /* 0F FB */ { GRPSSE(0ffb) },
+ /* 0F FC */ { GRPSSE(0ffc) },
+ /* 0F FD */ { GRPSSE(0ffd) },
+ /* 0F FE */ { GRPSSE(0ffe) },
+ /* 0F FF */ { 0, &Ia_Invalid }
+};
+
+/* ************************************************************************ */
+/* Long mode */
+
+static BxDisasmOpcodeTable_t BxDisasmOpcodes64w[256*2] = {
+ // 256 entries for single byte opcodes
+ /* 00 */ { 0, &Ia_addb_Eb_Gb },
+ /* 01 */ { 0, &Ia_addw_Ew_Gw },
+ /* 02 */ { 0, &Ia_addb_Gb_Eb },
+ /* 03 */ { 0, &Ia_addw_Gw_Ew },
+ /* 04 */ { 0, &Ia_addb_AL_Ib },
+ /* 05 */ { 0, &Ia_addw_AX_Iw },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_orb_Eb_Gb },
+ /* 09 */ { 0, &Ia_orw_Ew_Gw },
+ /* 0A */ { 0, &Ia_orb_Gb_Eb },
+ /* 0B */ { 0, &Ia_orw_Gw_Ew },
+ /* 0C */ { 0, &Ia_orb_AL_Ib },
+ /* 0D */ { 0, &Ia_orw_AX_Iw },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { 0, &Ia_error }, // 2 byte escape
+ /* 10 */ { 0, &Ia_adcb_Eb_Gb },
+ /* 11 */ { 0, &Ia_adcw_Ew_Gw },
+ /* 12 */ { 0, &Ia_adcb_Gb_Eb },
+ /* 13 */ { 0, &Ia_adcw_Gw_Ew },
+ /* 14 */ { 0, &Ia_adcb_AL_Ib },
+ /* 15 */ { 0, &Ia_adcw_AX_Iw },
+ /* 16 */ { 0, &Ia_Invalid },
+ /* 17 */ { 0, &Ia_Invalid },
+ /* 18 */ { 0, &Ia_sbbb_Eb_Gb },
+ /* 19 */ { 0, &Ia_sbbw_Ew_Gw },
+ /* 1A */ { 0, &Ia_sbbb_Gb_Eb },
+ /* 1B */ { 0, &Ia_sbbw_Gw_Ew },
+ /* 1C */ { 0, &Ia_sbbb_AL_Ib },
+ /* 1D */ { 0, &Ia_sbbw_AX_Iw },
+ /* 1E */ { 0, &Ia_Invalid },
+ /* 1F */ { 0, &Ia_Invalid },
+ /* 20 */ { 0, &Ia_andb_Eb_Gb },
+ /* 21 */ { 0, &Ia_andw_Ew_Gw },
+ /* 22 */ { 0, &Ia_andb_Gb_Eb },
+ /* 23 */ { 0, &Ia_andw_Gw_Ew },
+ /* 24 */ { 0, &Ia_andb_AL_Ib },
+ /* 25 */ { 0, &Ia_andw_AX_Iw },
+ /* 26 */ { 0, &Ia_prefix_es }, // ES:
+ /* 27 */ { 0, &Ia_Invalid },
+ /* 28 */ { 0, &Ia_subb_Eb_Gb },
+ /* 29 */ { 0, &Ia_subw_Ew_Gw },
+ /* 2A */ { 0, &Ia_subb_Gb_Eb },
+ /* 2B */ { 0, &Ia_subw_Gw_Ew },
+ /* 2C */ { 0, &Ia_subb_AL_Ib },
+ /* 2D */ { 0, &Ia_subw_AX_Iw },
+ /* 2E */ { 0, &Ia_prefix_cs }, // CS:
+ /* 2F */ { 0, &Ia_Invalid },
+ /* 30 */ { 0, &Ia_xorb_Eb_Gb },
+ /* 31 */ { 0, &Ia_xorw_Ew_Gw },
+ /* 32 */ { 0, &Ia_xorb_Gb_Eb },
+ /* 33 */ { 0, &Ia_xorw_Gw_Ew },
+ /* 34 */ { 0, &Ia_xorb_AL_Ib },
+ /* 35 */ { 0, &Ia_xorw_AX_Iw },
+ /* 36 */ { 0, &Ia_prefix_ss }, // SS:
+ /* 37 */ { 0, &Ia_Invalid },
+ /* 38 */ { 0, &Ia_cmpb_Eb_Gb },
+ /* 39 */ { 0, &Ia_cmpw_Ew_Gw },
+ /* 3A */ { 0, &Ia_cmpb_Gb_Eb },
+ /* 3B */ { 0, &Ia_cmpw_Gw_Ew },
+ /* 3C */ { 0, &Ia_cmpb_AL_Ib },
+ /* 3D */ { 0, &Ia_cmpw_AX_Iw },
+ /* 3E */ { 0, &Ia_prefix_ds }, // DS:
+ /* 3F */ { 0, &Ia_Invalid },
+ /* 40 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 41 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 42 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 43 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 44 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 45 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 46 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 47 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 48 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 49 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4A */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4B */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4C */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4D */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4E */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4F */ { 0, &Ia_prefix_rex }, // REX:
+ /* 50 */ { 0, &Ia_pushw_RX },
+ /* 51 */ { 0, &Ia_pushw_RX },
+ /* 52 */ { 0, &Ia_pushw_RX },
+ /* 53 */ { 0, &Ia_pushw_RX },
+ /* 54 */ { 0, &Ia_pushw_RX },
+ /* 55 */ { 0, &Ia_pushw_RX },
+ /* 56 */ { 0, &Ia_pushw_RX },
+ /* 57 */ { 0, &Ia_pushw_RX },
+ /* 58 */ { 0, &Ia_popw_RX },
+ /* 59 */ { 0, &Ia_popw_RX },
+ /* 5A */ { 0, &Ia_popw_RX },
+ /* 5B */ { 0, &Ia_popw_RX },
+ /* 5C */ { 0, &Ia_popw_RX },
+ /* 5D */ { 0, &Ia_popw_RX },
+ /* 5E */ { 0, &Ia_popw_RX },
+ /* 5F */ { 0, &Ia_popw_RX },
+ /* 60 */ { 0, &Ia_Invalid },
+ /* 61 */ { 0, &Ia_Invalid },
+ /* 62 */ { 0, &Ia_Invalid },
+ /* 63 */ { 0, &Ia_movw_Gw_Ew },
+ /* 64 */ { 0, &Ia_prefix_fs }, // FS:
+ /* 65 */ { 0, &Ia_prefix_gs }, // GS:
+ /* 66 */ { 0, &Ia_prefix_osize }, // OSIZE:
+ /* 67 */ { 0, &Ia_prefix_asize }, // ASIZE:
+ /* 68 */ { 0, &Ia_pushw_Iw },
+ /* 69 */ { 0, &Ia_imulw_Gw_Ew_Iw },
+ /* 6A */ { 0, &Ia_pushw_sIb },
+ /* 6B */ { 0, &Ia_imulw_Gw_Ew_sIb },
+ /* 6C */ { 0, &Ia_insb_Yb_DX },
+ /* 6D */ { 0, &Ia_insw_Yw_DX },
+ /* 6E */ { 0, &Ia_outsb_DX_Xb },
+ /* 6F */ { 0, &Ia_outsw_DX_Xw },
+ /* 70 */ { 0, &Ia_jo_Jb },
+ /* 71 */ { 0, &Ia_jno_Jb },
+ /* 72 */ { 0, &Ia_jb_Jb },
+ /* 73 */ { 0, &Ia_jnb_Jb },
+ /* 74 */ { 0, &Ia_jz_Jb },
+ /* 75 */ { 0, &Ia_jnz_Jb },
+ /* 76 */ { 0, &Ia_jbe_Jb },
+ /* 77 */ { 0, &Ia_jnbe_Jb },
+ /* 78 */ { 0, &Ia_js_Jb },
+ /* 79 */ { 0, &Ia_jns_Jb },
+ /* 7A */ { 0, &Ia_jp_Jb },
+ /* 7B */ { 0, &Ia_jnp_Jb },
+ /* 7C */ { 0, &Ia_jl_Jb },
+ /* 7D */ { 0, &Ia_jnl_Jb },
+ /* 7E */ { 0, &Ia_jle_Jb },
+ /* 7F */ { 0, &Ia_jnle_Jb },
+ /* 80 */ { GRPN(G1EbIb) },
+ /* 81 */ { GRPN(G1EwIw) },
+ /* 82 */ { 9, &Ia_Invalid },
+ /* 83 */ { GRPN(G1EwIb) },
+ /* 84 */ { 0, &Ia_testb_Eb_Gb },
+ /* 85 */ { 0, &Ia_testw_Ew_Gw },
+ /* 86 */ { 0, &Ia_xchgb_Eb_Gb },
+ /* 87 */ { 0, &Ia_xchgw_Ew_Gw },
+ /* 88 */ { 0, &Ia_movb_Eb_Gb },
+ /* 89 */ { 0, &Ia_movw_Ew_Gw },
+ /* 8A */ { 0, &Ia_movb_Gb_Eb },
+ /* 8B */ { 0, &Ia_movw_Gw_Ew },
+ /* 8C */ { 0, &Ia_movw_Ew_Sw },
+ /* 8D */ { 0, &Ia_leaw_Gw_Mw },
+ /* 8E */ { 0, &Ia_movw_Sw_Ew },
+ /* 8F */ { 0, &Ia_popw_Ew },
+ /* 90 */ { 0, &Ia_xchgw_RX_AX }, // handle XCHG R8w, AX
+ /* 91 */ { 0, &Ia_xchgw_RX_AX },
+ /* 92 */ { 0, &Ia_xchgw_RX_AX },
+ /* 93 */ { 0, &Ia_xchgw_RX_AX },
+ /* 94 */ { 0, &Ia_xchgw_RX_AX },
+ /* 95 */ { 0, &Ia_xchgw_RX_AX },
+ /* 96 */ { 0, &Ia_xchgw_RX_AX },
+ /* 97 */ { 0, &Ia_xchgw_RX_AX },
+ /* 98 */ { 0, &Ia_cbw },
+ /* 99 */ { 0, &Ia_cwd },
+ /* 9A */ { 0, &Ia_Invalid },
+ /* 9B */ { 0, &Ia_fwait },
+ /* 9C */ { 0, &Ia_pushfw },
+ /* 9D */ { 0, &Ia_popfw },
+ /* 9E */ { 0, &Ia_sahf },
+ /* 9F */ { 0, &Ia_lahf },
+ /* A0 */ { 0, &Ia_movb_AL_Ob },
+ /* A1 */ { 0, &Ia_movw_AX_Ow },
+ /* A0 */ { 0, &Ia_movb_Ob_AL },
+ /* A1 */ { 0, &Ia_movw_Ow_AX },
+ /* A4 */ { 0, &Ia_movsb_Yb_Xb },
+ /* A5 */ { 0, &Ia_movsw_Yw_Xw },
+ /* A6 */ { 0, &Ia_cmpsb_Yb_Xb },
+ /* A7 */ { 0, &Ia_cmpsw_Yw_Xw },
+ /* A8 */ { 0, &Ia_testb_AL_Ib },
+ /* A9 */ { 0, &Ia_testw_AX_Iw },
+ /* AA */ { 0, &Ia_stosb_Yb_AL },
+ /* AB */ { 0, &Ia_stosw_Yw_AX },
+ /* AC */ { 0, &Ia_lodsb_AL_Xb },
+ /* AD */ { 0, &Ia_lodsw_AX_Xw },
+ /* AE */ { 0, &Ia_scasb_Yb_AL },
+ /* AF */ { 0, &Ia_scasw_Yw_AX },
+ /* B0 */ { 0, &Ia_movb_R8_Ib },
+ /* B1 */ { 0, &Ia_movb_R8_Ib },
+ /* B2 */ { 0, &Ia_movb_R8_Ib },
+ /* B3 */ { 0, &Ia_movb_R8_Ib },
+ /* B4 */ { 0, &Ia_movb_R8_Ib },
+ /* B5 */ { 0, &Ia_movb_R8_Ib },
+ /* B6 */ { 0, &Ia_movb_R8_Ib },
+ /* B7 */ { 0, &Ia_movb_R8_Ib },
+ /* B8 */ { 0, &Ia_movw_RX_Iw },
+ /* B9 */ { 0, &Ia_movw_RX_Iw },
+ /* BA */ { 0, &Ia_movw_RX_Iw },
+ /* BB */ { 0, &Ia_movw_RX_Iw },
+ /* BC */ { 0, &Ia_movw_RX_Iw },
+ /* BD */ { 0, &Ia_movw_RX_Iw },
+ /* BE */ { 0, &Ia_movw_RX_Iw },
+ /* BF */ { 0, &Ia_movw_RX_Iw },
+ /* C0 */ { GRPN(G2Eb) },
+ /* C1 */ { GRPN(G2Ew) },
+ /* C2 */ { 0, &Ia_ret_Iw },
+ /* C3 */ { 0, &Ia_ret },
+ /* C4 */ { 0, &Ia_Invalid },
+ /* C5 */ { 0, &Ia_Invalid },
+ /* C6 */ { 0, &Ia_movb_Eb_Ib },
+ /* C7 */ { 0, &Ia_movw_Ew_Iw },
+ /* C8 */ { 0, &Ia_enter },
+ /* C9 */ { 0, &Ia_leave },
+ /* CA */ { 0, &Ia_lret_Iw },
+ /* CB */ { 0, &Ia_lret },
+ /* CC */ { 0, &Ia_int3 },
+ /* CD */ { 0, &Ia_int_Ib },
+ /* CE */ { 0, &Ia_Invalid },
+ /* CF */ { 0, &Ia_iretw },
+ /* D0 */ { GRPN(G2EbI1) },
+ /* D1 */ { GRPN(G2EwI1) },
+ /* D2 */ { GRPN(G2EbCL) },
+ /* D3 */ { GRPN(G2EwCL) },
+ /* D4 */ { 0, &Ia_Invalid },
+ /* D5 */ { 0, &Ia_Invalid },
+ /* D6 */ { 0, &Ia_Invalid },
+ /* D7 */ { 0, &Ia_xlat },
+ /* D8 */ { GRPFP(D8) },
+ /* D9 */ { GRPFP(D9) },
+ /* DA */ { GRPFP(DA) },
+ /* DB */ { GRPFP(DB) },
+ /* DC */ { GRPFP(DC) },
+ /* DD */ { GRPFP(DD) },
+ /* DE */ { GRPFP(DE) },
+ /* DF */ { GRPFP(DF) },
+ /* E0 */ { 0, &Ia_loopne_Jb },
+ /* E1 */ { 0, &Ia_loope_Jb },
+ /* E2 */ { 0, &Ia_loop_Jb },
+ /* E3 */ { 0, &Ia_jrcxz_Jb },
+ /* E4 */ { 0, &Ia_inb_AL_Ib },
+ /* E5 */ { 0, &Ia_inw_AX_Ib },
+ /* E6 */ { 0, &Ia_outb_Ib_AL },
+ /* E7 */ { 0, &Ia_outw_Ib_AX },
+ /* E8 */ { 0, &Ia_call_Jd },
+ /* E9 */ { 0, &Ia_jmp_Jd },
+ /* EA */ { 0, &Ia_Invalid },
+ /* EB */ { 0, &Ia_jmp_Jb },
+ /* EC */ { 0, &Ia_inb_AL_DX },
+ /* ED */ { 0, &Ia_inw_AX_DX },
+ /* EE */ { 0, &Ia_outb_DX_AL },
+ /* EF */ { 0, &Ia_outw_DX_AX },
+ /* F0 */ { 0, &Ia_prefix_lock }, // LOCK:
+ /* F1 */ { 0, &Ia_int1 },
+ /* F2 */ { 0, &Ia_prefix_repne }, // REPNE:
+ /* F3 */ { 0, &Ia_prefix_rep }, // REP:
+ /* F4 */ { 0, &Ia_hlt },
+ /* F5 */ { 0, &Ia_cmc },
+ /* F6 */ { GRPN(G3Eb) },
+ /* F7 */ { GRPN(G3Ew) },
+ /* F8 */ { 0, &Ia_clc },
+ /* F9 */ { 0, &Ia_stc },
+ /* FA */ { 0, &Ia_cli },
+ /* FB */ { 0, &Ia_sti },
+ /* FC */ { 0, &Ia_cld },
+ /* FD */ { 0, &Ia_std },
+ /* FE */ { GRPN(G4) },
+ /* FF */ { GRPN(G5w) },
+
+ // 256 entries for two byte opcodes
+ /* 0F 00 */ { GRPN(G6) },
+ /* 0F 01 */ { GRPN(G7) },
+ /* 0F 02 */ { 0, &Ia_larw_Gw_Ew },
+ /* 0F 03 */ { 0, &Ia_lslw_Gw_Ew },
+ /* 0F 04 */ { 0, &Ia_Invalid },
+ /* 0F 05 */ { 0, &Ia_syscall },
+ /* 0F 06 */ { 0, &Ia_clts },
+ /* 0F 07 */ { 0, &Ia_sysret },
+ /* 0F 08 */ { 0, &Ia_invd },
+ /* 0F 09 */ { 0, &Ia_wbinvd },
+ /* 0F 0A */ { 0, &Ia_Invalid },
+ /* 0F 0B */ { 0, &Ia_ud2a },
+ /* 0F 0C */ { 0, &Ia_Invalid },
+ /* 0F 0D */ { 0, &Ia_prefetch }, // 3DNow!
+ /* 0F 0E */ { 0, &Ia_femms }, // 3DNow!
+ /* 0F 0F */ { GRP3DNOW },
+ /* 0F 10 */ { GRPSSE(0f10) },
+ /* 0F 11 */ { GRPSSE(0f11) },
+ /* 0F 12 */ { GRPSSE(0f12) },
+ /* 0F 13 */ { GRPSSE(0f13) },
+ /* 0F 14 */ { GRPSSE(0f14) },
+ /* 0F 15 */ { GRPSSE(0f15) },
+ /* 0F 16 */ { GRPSSE(0f16) },
+ /* 0F 17 */ { GRPSSE(0f17) },
+ /* 0F 18 */ { GRPN(G16) },
+ /* 0F 19 */ { 0, &Ia_Invalid },
+ /* 0F 1A */ { 0, &Ia_Invalid },
+ /* 0F 1B */ { 0, &Ia_Invalid },
+ /* 0F 1C */ { 0, &Ia_Invalid },
+ /* 0F 1D */ { 0, &Ia_Invalid },
+ /* 0F 1E */ { 0, &Ia_Invalid },
+ /* 0F 1F */ { 0, &Ia_multibyte_nop },
+ /* 0F 20 */ { 0, &Ia_movq_Rq_Cq },
+ /* 0F 21 */ { 0, &Ia_movq_Rq_Dq },
+ /* 0F 22 */ { 0, &Ia_movq_Cq_Rq },
+ /* 0F 23 */ { 0, &Ia_movq_Dq_Rq },
+ /* 0F 24 */ { 0, &Ia_Invalid },
+ /* 0F 25 */ { 0, &Ia_Invalid },
+ /* 0F 26 */ { 0, &Ia_Invalid },
+ /* 0F 27 */ { 0, &Ia_Invalid },
+ /* 0F 28 */ { GRPSSE(0f28) },
+ /* 0F 29 */ { GRPSSE(0f29) },
+ /* 0F 2A */ { GRPSSE(0f2a) },
+ /* 0F 2B */ { GRPSSE(0f2b) },
+ /* 0F 2C */ { GRPSSE(0f2c) },
+ /* 0F 2D */ { GRPSSE(0f2d) },
+ /* 0F 2E */ { GRPSSE(0f2e) },
+ /* 0F 2F */ { GRPSSE(0f2f) },
+ /* 0F 30 */ { 0, &Ia_wrmsr },
+ /* 0F 31 */ { 0, &Ia_rdtsc },
+ /* 0F 32 */ { 0, &Ia_rdmsr },
+ /* 0F 33 */ { 0, &Ia_rdpmc },
+ /* 0F 34 */ { 0, &Ia_sysenter },
+ /* 0F 35 */ { 0, &Ia_sysexit },
+ /* 0F 36 */ { 0, &Ia_Invalid },
+ /* 0F 37 */ { 0, &Ia_Invalid },
+ /* 0F 38 */ { GR3BTAB(A4) },
+ /* 0F 39 */ { 0, &Ia_Invalid },
+ /* 0F 3A */ { GR3BTAB(A5) },
+ /* 0F 3B */ { 0, &Ia_Invalid },
+ /* 0F 3C */ { 0, &Ia_Invalid },
+ /* 0F 3D */ { 0, &Ia_Invalid },
+ /* 0F 3E */ { 0, &Ia_Invalid },
+ /* 0F 3F */ { 0, &Ia_Invalid },
+ /* 0F 40 */ { 0, &Ia_cmovow_Gw_Ew },
+ /* 0F 41 */ { 0, &Ia_cmovnow_Gw_Ew },
+ /* 0F 42 */ { 0, &Ia_cmovcw_Gw_Ew },
+ /* 0F 43 */ { 0, &Ia_cmovncw_Gw_Ew },
+ /* 0F 44 */ { 0, &Ia_cmovzw_Gw_Ew },
+ /* 0F 45 */ { 0, &Ia_cmovnzw_Gw_Ew },
+ /* 0F 46 */ { 0, &Ia_cmovnaw_Gw_Ew },
+ /* 0F 47 */ { 0, &Ia_cmovaw_Gw_Ew },
+ /* 0F 48 */ { 0, &Ia_cmovsw_Gw_Ew },
+ /* 0F 49 */ { 0, &Ia_cmovnsw_Gw_Ew },
+ /* 0F 4A */ { 0, &Ia_cmovpw_Gw_Ew },
+ /* 0F 4B */ { 0, &Ia_cmovnpw_Gw_Ew },
+ /* 0F 4C */ { 0, &Ia_cmovlw_Gw_Ew },
+ /* 0F 4D */ { 0, &Ia_cmovnlw_Gw_Ew },
+ /* 0F 4E */ { 0, &Ia_cmovngw_Gw_Ew },
+ /* 0F 4F */ { 0, &Ia_cmovgw_Gw_Ew },
+ /* 0F 50 */ { GRPSSE(0f50) },
+ /* 0F 51 */ { GRPSSE(0f51) },
+ /* 0F 52 */ { GRPSSE(0f52) },
+ /* 0F 53 */ { GRPSSE(0f53) },
+ /* 0F 54 */ { GRPSSE(0f54) },
+ /* 0F 55 */ { GRPSSE(0f55) },
+ /* 0F 56 */ { GRPSSE(0f56) },
+ /* 0F 57 */ { GRPSSE(0f57) },
+ /* 0F 58 */ { GRPSSE(0f58) },
+ /* 0F 59 */ { GRPSSE(0f59) },
+ /* 0F 5A */ { GRPSSE(0f5a) },
+ /* 0F 5B */ { GRPSSE(0f5b) },
+ /* 0F 5C */ { GRPSSE(0f5c) },
+ /* 0F 5D */ { GRPSSE(0f5d) },
+ /* 0F 5E */ { GRPSSE(0f5e) },
+ /* 0F 5F */ { GRPSSE(0f5f) },
+ /* 0F 60 */ { GRPSSE(0f60) },
+ /* 0F 61 */ { GRPSSE(0f61) },
+ /* 0F 62 */ { GRPSSE(0f62) },
+ /* 0F 63 */ { GRPSSE(0f63) },
+ /* 0F 64 */ { GRPSSE(0f64) },
+ /* 0F 65 */ { GRPSSE(0f65) },
+ /* 0F 66 */ { GRPSSE(0f66) },
+ /* 0F 67 */ { GRPSSE(0f67) },
+ /* 0F 68 */ { GRPSSE(0f68) },
+ /* 0F 69 */ { GRPSSE(0f69) },
+ /* 0F 6A */ { GRPSSE(0f6a) },
+ /* 0F 6B */ { GRPSSE(0f6b) },
+ /* 0F 6C */ { GRPSSE(0f6c) },
+ /* 0F 6D */ { GRPSSE(0f6d) },
+ /* 0F 6E */ { GRPSSE(0f6e) },
+ /* 0F 6F */ { GRPSSE(0f6f) },
+ /* 0F 70 */ { GRPSSE(0f70) },
+ /* 0F 71 */ { GRPN(G12) },
+ /* 0F 72 */ { GRPN(G13) },
+ /* 0F 73 */ { GRPN(G14) },
+ /* 0F 74 */ { GRPSSE(0f74) },
+ /* 0F 75 */ { GRPSSE(0f75) },
+ /* 0F 76 */ { GRPSSE(0f76) },
+ /* 0F 77 */ { 0, &Ia_emms },
+ /* 0F 78 */ { 0, &Ia_Invalid },
+ /* 0F 79 */ { 0, &Ia_Invalid },
+ /* 0F 7A */ { 0, &Ia_Invalid },
+ /* 0F 7B */ { 0, &Ia_Invalid },
+ /* 0F 7C */ { GRPSSE(0f7c) },
+ /* 0F 7D */ { GRPSSE(0f7d) },
+ /* 0F 7E */ { GRPSSE(0f7e) },
+ /* 0F 7F */ { GRPSSE(0f7f) },
+ /* 0F 80 */ { 0, &Ia_jo_Jd },
+ /* 0F 81 */ { 0, &Ia_jno_Jd },
+ /* 0F 82 */ { 0, &Ia_jb_Jd },
+ /* 0F 83 */ { 0, &Ia_jnb_Jd },
+ /* 0F 84 */ { 0, &Ia_jz_Jd },
+ /* 0F 85 */ { 0, &Ia_jnz_Jd },
+ /* 0F 86 */ { 0, &Ia_jbe_Jd },
+ /* 0F 87 */ { 0, &Ia_jnbe_Jd },
+ /* 0F 88 */ { 0, &Ia_js_Jd },
+ /* 0F 89 */ { 0, &Ia_jns_Jd },
+ /* 0F 8A */ { 0, &Ia_jp_Jd },
+ /* 0F 8B */ { 0, &Ia_jnp_Jd },
+ /* 0F 8C */ { 0, &Ia_jl_Jd },
+ /* 0F 8D */ { 0, &Ia_jnl_Jd },
+ /* 0F 8E */ { 0, &Ia_jle_Jd },
+ /* 0F 8F */ { 0, &Ia_jnle_Jd },
+ /* 0F 90 */ { 0, &Ia_seto_Eb },
+ /* 0F 91 */ { 0, &Ia_setno_Eb },
+ /* 0F 92 */ { 0, &Ia_setb_Eb },
+ /* 0F 93 */ { 0, &Ia_setnb_Eb },
+ /* 0F 94 */ { 0, &Ia_setz_Eb },
+ /* 0F 95 */ { 0, &Ia_setnz_Eb },
+ /* 0F 96 */ { 0, &Ia_setbe_Eb },
+ /* 0F 97 */ { 0, &Ia_setnbe_Eb },
+ /* 0F 98 */ { 0, &Ia_sets_Eb },
+ /* 0F 99 */ { 0, &Ia_setns_Eb },
+ /* 0F 9A */ { 0, &Ia_setp_Eb },
+ /* 0F 9B */ { 0, &Ia_setnp_Eb },
+ /* 0F 9C */ { 0, &Ia_setl_Eb },
+ /* 0F 9D */ { 0, &Ia_setnl_Eb },
+ /* 0F 9E */ { 0, &Ia_setle_Eb },
+ /* 0F 9F */ { 0, &Ia_setnle_Eb },
+ /* 0F A0 */ { 0, &Ia_pushw_FS },
+ /* 0F A1 */ { 0, &Ia_popw_FS },
+ /* 0F A2 */ { 0, &Ia_cpuid },
+ /* 0F A3 */ { 0, &Ia_btw_Ew_Gw },
+ /* 0F A4 */ { 0, &Ia_shldw_Ew_Gw_Ib },
+ /* 0F A5 */ { 0, &Ia_shldw_Ew_Gw_CL },
+ /* 0F A6 */ { 0, &Ia_Invalid },
+ /* 0F A7 */ { 0, &Ia_Invalid },
+ /* 0F A8 */ { 0, &Ia_pushw_GS },
+ /* 0F A9 */ { 0, &Ia_popw_GS },
+ /* 0F AA */ { 0, &Ia_rsm },
+ /* 0F AB */ { 0, &Ia_btsw_Ew_Gw },
+ /* 0F AC */ { 0, &Ia_shrdw_Ew_Gw_Ib },
+ /* 0F AD */ { 0, &Ia_shrdw_Ew_Gw_CL },
+ /* 0F AE */ { GRPN(G15) },
+ /* 0F AF */ { 0, &Ia_imulw_Gw_Ew },
+ /* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
+ /* 0F B1 */ { 0, &Ia_cmpxchgw_Ew_Gw },
+ /* 0F B2 */ { 0, &Ia_lssw_Gw_Mp },
+ /* 0F B3 */ { 0, &Ia_btrw_Ew_Gw },
+ /* 0F B4 */ { 0, &Ia_lfsw_Gw_Mp },
+ /* 0F B5 */ { 0, &Ia_lgsw_Gw_Mp },
+ /* 0F B6 */ { 0, &Ia_movzbw_Gw_Eb },
+ /* 0F B7 */ { 0, &Ia_movw_Gw_Ew },
+ /* 0F B8 */ { 0, &Ia_Invalid },
+ /* 0F B9 */ { 0, &Ia_ud2b },
+ /* 0F BA */ { GRPN(G8EwIb) },
+ /* 0F BB */ { 0, &Ia_btcw_Ew_Gw },
+ /* 0F BC */ { 0, &Ia_bsfw_Gw_Ew },
+ /* 0F BD */ { 0, &Ia_bsrw_Gw_Ew },
+ /* 0F BE */ { 0, &Ia_movsbw_Gw_Eb },
+ /* 0F BF */ { 0, &Ia_movw_Gw_Ew },
+ /* 0F C0 */ { 0, &Ia_xaddb_Eb_Gb },
+ /* 0F C0 */ { 0, &Ia_xaddw_Ew_Gw },
+ /* 0F C2 */ { GRPSSE(0fc2) },
+ /* 0F C3 */ { GRPSSE(0fc3) },
+ /* 0F C4 */ { GRPSSE(0fc4) },
+ /* 0F C5 */ { GRPSSE(0fc5) },
+ /* 0F C6 */ { GRPSSE(0fc6) },
+ /* 0F C7 */ { GRPN(G9) },
+ /* 0F C8 */ { 0, &Ia_bswapl_ERX },
+ /* 0F C9 */ { 0, &Ia_bswapl_ERX },
+ /* 0F CA */ { 0, &Ia_bswapl_ERX },
+ /* 0F CB */ { 0, &Ia_bswapl_ERX },
+ /* 0F CC */ { 0, &Ia_bswapl_ERX },
+ /* 0F CD */ { 0, &Ia_bswapl_ERX },
+ /* 0F CE */ { 0, &Ia_bswapl_ERX },
+ /* 0F CF */ { 0, &Ia_bswapl_ERX },
+ /* 0F D0 */ { GRPSSE(0fd0) },
+ /* 0F D1 */ { GRPSSE(0fd1) },
+ /* 0F D2 */ { GRPSSE(0fd2) },
+ /* 0F D3 */ { GRPSSE(0fd3) },
+ /* 0F D4 */ { GRPSSE(0fd4) },
+ /* 0F D5 */ { GRPSSE(0fd5) },
+ /* 0F D6 */ { GRPSSE(0fd6) },
+ /* 0F D7 */ { GRPSSE(0fd7) },
+ /* 0F D8 */ { GRPSSE(0fd8) },
+ /* 0F D9 */ { GRPSSE(0fd9) },
+ /* 0F DA */ { GRPSSE(0fda) },
+ /* 0F DB */ { GRPSSE(0fdb) },
+ /* 0F DC */ { GRPSSE(0fdc) },
+ /* 0F DD */ { GRPSSE(0fdd) },
+ /* 0F DE */ { GRPSSE(0fde) },
+ /* 0F DF */ { GRPSSE(0fdf) },
+ /* 0F E0 */ { GRPSSE(0fe0) },
+ /* 0F E1 */ { GRPSSE(0fe1) },
+ /* 0F E2 */ { GRPSSE(0fe2) },
+ /* 0F E3 */ { GRPSSE(0fe3) },
+ /* 0F E4 */ { GRPSSE(0fe4) },
+ /* 0F E5 */ { GRPSSE(0fe5) },
+ /* 0F E6 */ { GRPSSE(0fe6) },
+ /* 0F E7 */ { GRPSSE(0fe7) },
+ /* 0F E8 */ { GRPSSE(0fe8) },
+ /* 0F E9 */ { GRPSSE(0fe9) },
+ /* 0F EA */ { GRPSSE(0fea) },
+ /* 0F EB */ { GRPSSE(0feb) },
+ /* 0F EC */ { GRPSSE(0fec) },
+ /* 0F ED */ { GRPSSE(0fed) },
+ /* 0F EE */ { GRPSSE(0fee) },
+ /* 0F EF */ { GRPSSE(0fef) },
+ /* 0F F0 */ { GRPSSE(0ff0) },
+ /* 0F F1 */ { GRPSSE(0ff1) },
+ /* 0F F2 */ { GRPSSE(0ff2) },
+ /* 0F F3 */ { GRPSSE(0ff3) },
+ /* 0F F4 */ { GRPSSE(0ff4) },
+ /* 0F F5 */ { GRPSSE(0ff5) },
+ /* 0F F6 */ { GRPSSE(0ff6) },
+ /* 0F F7 */ { GRPSSE(0ff7) },
+ /* 0F F8 */ { GRPSSE(0ff8) },
+ /* 0F F9 */ { GRPSSE(0ff9) },
+ /* 0F FA */ { GRPSSE(0ffa) },
+ /* 0F FB */ { GRPSSE(0ffb) },
+ /* 0F FC */ { GRPSSE(0ffc) },
+ /* 0F FD */ { GRPSSE(0ffd) },
+ /* 0F FE */ { GRPSSE(0ffe) },
+ /* 0F FF */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmOpcodes64d[256*2] = {
+ // 256 entries for single byte opcodes
+ /* 00 */ { 0, &Ia_addb_Eb_Gb },
+ /* 01 */ { 0, &Ia_addl_Ed_Gd },
+ /* 02 */ { 0, &Ia_addb_Gb_Eb },
+ /* 03 */ { 0, &Ia_addl_Gd_Ed },
+ /* 04 */ { 0, &Ia_addb_AL_Ib, },
+ /* 05 */ { 0, &Ia_addl_EAX_Id, },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_orb_Eb_Gb },
+ /* 09 */ { 0, &Ia_orl_Ed_Gd },
+ /* 0A */ { 0, &Ia_orb_Gb_Eb },
+ /* 0B */ { 0, &Ia_orl_Gd_Ed },
+ /* 0C */ { 0, &Ia_orb_AL_Ib },
+ /* 0D */ { 0, &Ia_orl_EAX_Id },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { 0, &Ia_error }, // 2 byte escape
+ /* 10 */ { 0, &Ia_adcb_Eb_Gb },
+ /* 11 */ { 0, &Ia_adcl_Ed_Gd },
+ /* 12 */ { 0, &Ia_adcb_Gb_Eb },
+ /* 13 */ { 0, &Ia_adcl_Gd_Ed },
+ /* 14 */ { 0, &Ia_adcb_AL_Ib },
+ /* 15 */ { 0, &Ia_adcl_EAX_Id },
+ /* 16 */ { 0, &Ia_Invalid },
+ /* 17 */ { 0, &Ia_Invalid },
+ /* 18 */ { 0, &Ia_sbbb_Eb_Gb },
+ /* 19 */ { 0, &Ia_sbbl_Ed_Gd },
+ /* 1A */ { 0, &Ia_sbbb_Gb_Eb },
+ /* 1B */ { 0, &Ia_sbbl_Gd_Ed },
+ /* 1C */ { 0, &Ia_sbbb_AL_Ib },
+ /* 1D */ { 0, &Ia_sbbl_EAX_Id },
+ /* 1E */ { 0, &Ia_Invalid },
+ /* 1F */ { 0, &Ia_Invalid },
+ /* 20 */ { 0, &Ia_andb_Eb_Gb },
+ /* 21 */ { 0, &Ia_andl_Ed_Gd },
+ /* 22 */ { 0, &Ia_andb_Gb_Eb },
+ /* 23 */ { 0, &Ia_andl_Gd_Ed },
+ /* 24 */ { 0, &Ia_andb_AL_Ib },
+ /* 25 */ { 0, &Ia_andl_EAX_Id },
+ /* 26 */ { 0, &Ia_prefix_es }, // ES:
+ /* 27 */ { 0, &Ia_Invalid },
+ /* 28 */ { 0, &Ia_subb_Eb_Gb },
+ /* 29 */ { 0, &Ia_subl_Ed_Gd },
+ /* 2A */ { 0, &Ia_subb_Gb_Eb },
+ /* 2B */ { 0, &Ia_subl_Gd_Ed },
+ /* 2C */ { 0, &Ia_subb_AL_Ib },
+ /* 2D */ { 0, &Ia_subl_EAX_Id },
+ /* 2E */ { 0, &Ia_prefix_cs }, // CS:
+ /* 2F */ { 0, &Ia_Invalid },
+ /* 30 */ { 0, &Ia_xorb_Eb_Gb },
+ /* 31 */ { 0, &Ia_xorl_Ed_Gd },
+ /* 32 */ { 0, &Ia_xorb_Gb_Eb },
+ /* 33 */ { 0, &Ia_xorl_Gd_Ed },
+ /* 34 */ { 0, &Ia_xorb_AL_Ib },
+ /* 35 */ { 0, &Ia_xorl_EAX_Id },
+ /* 36 */ { 0, &Ia_prefix_ss }, // SS:
+ /* 37 */ { 0, &Ia_Invalid },
+ /* 38 */ { 0, &Ia_cmpb_Eb_Gb },
+ /* 39 */ { 0, &Ia_cmpl_Ed_Gd },
+ /* 3A */ { 0, &Ia_cmpb_Gb_Eb },
+ /* 3B */ { 0, &Ia_cmpl_Gd_Ed },
+ /* 3C */ { 0, &Ia_cmpb_AL_Ib },
+ /* 3D */ { 0, &Ia_cmpl_EAX_Id },
+ /* 3E */ { 0, &Ia_prefix_ds }, // DS:
+ /* 3F */ { 0, &Ia_Invalid },
+ /* 40 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 41 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 42 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 43 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 44 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 45 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 46 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 47 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 48 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 49 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4A */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4B */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4C */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4D */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4E */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4F */ { 0, &Ia_prefix_rex }, // REX:
+ /* 50 */ { 0, &Ia_pushq_RRX },
+ /* 51 */ { 0, &Ia_pushq_RRX },
+ /* 52 */ { 0, &Ia_pushq_RRX },
+ /* 53 */ { 0, &Ia_pushq_RRX },
+ /* 54 */ { 0, &Ia_pushq_RRX },
+ /* 55 */ { 0, &Ia_pushq_RRX },
+ /* 56 */ { 0, &Ia_pushq_RRX },
+ /* 57 */ { 0, &Ia_pushq_RRX },
+ /* 58 */ { 0, &Ia_popq_RRX },
+ /* 59 */ { 0, &Ia_popq_RRX },
+ /* 5A */ { 0, &Ia_popq_RRX },
+ /* 5B */ { 0, &Ia_popq_RRX },
+ /* 5C */ { 0, &Ia_popq_RRX },
+ /* 5D */ { 0, &Ia_popq_RRX },
+ /* 5E */ { 0, &Ia_popq_RRX },
+ /* 5F */ { 0, &Ia_popq_RRX },
+ /* 60 */ { 0, &Ia_Invalid },
+ /* 61 */ { 0, &Ia_Invalid },
+ /* 62 */ { 0, &Ia_Invalid },
+ /* 63 */ { 0, &Ia_movl_Gd_Ed },
+ /* 64 */ { 0, &Ia_prefix_fs }, // FS:
+ /* 65 */ { 0, &Ia_prefix_gs }, // GS:
+ /* 66 */ { 0, &Ia_prefix_osize }, // OSIZE:
+ /* 67 */ { 0, &Ia_prefix_asize }, // ASIZE:
+ /* 68 */ { 0, &Ia_pushq_sId },
+ /* 69 */ { 0, &Ia_imull_Gd_Ed_Id },
+ /* 6A */ { 0, &Ia_pushq_sIb },
+ /* 6B */ { 0, &Ia_imull_Gd_Ed_sIb },
+ /* 6C */ { 0, &Ia_insb_Yb_DX },
+ /* 6D */ { 0, &Ia_insl_Yd_DX },
+ /* 6E */ { 0, &Ia_outsb_DX_Xb },
+ /* 6F */ { 0, &Ia_outsl_DX_Xd },
+ /* 70 */ { 0, &Ia_jo_Jb },
+ /* 71 */ { 0, &Ia_jno_Jb },
+ /* 72 */ { 0, &Ia_jb_Jb },
+ /* 73 */ { 0, &Ia_jnb_Jb },
+ /* 74 */ { 0, &Ia_jz_Jb },
+ /* 75 */ { 0, &Ia_jnz_Jb },
+ /* 76 */ { 0, &Ia_jbe_Jb },
+ /* 77 */ { 0, &Ia_jnbe_Jb },
+ /* 78 */ { 0, &Ia_js_Jb },
+ /* 79 */ { 0, &Ia_jns_Jb },
+ /* 7A */ { 0, &Ia_jp_Jb },
+ /* 7B */ { 0, &Ia_jnp_Jb },
+ /* 7C */ { 0, &Ia_jl_Jb },
+ /* 7D */ { 0, &Ia_jnl_Jb },
+ /* 7E */ { 0, &Ia_jle_Jb },
+ /* 7F */ { 0, &Ia_jnle_Jb },
+ /* 80 */ { GRPN(G1EbIb) },
+ /* 81 */ { GRPN(G1EdId) },
+ /* 82 */ { 0, &Ia_Invalid },
+ /* 83 */ { GRPN(G1EdIb) },
+ /* 84 */ { 0, &Ia_testb_Eb_Gb },
+ /* 85 */ { 0, &Ia_testl_Ed_Gd },
+ /* 86 */ { 0, &Ia_xchgb_Eb_Gb },
+ /* 87 */ { 0, &Ia_xchgl_Ed_Gd },
+ /* 88 */ { 0, &Ia_movb_Eb_Gb },
+ /* 89 */ { 0, &Ia_movl_Ed_Gd },
+ /* 8A */ { 0, &Ia_movb_Gb_Eb },
+ /* 8B */ { 0, &Ia_movl_Gd_Ed },
+ /* 8C */ { 0, &Ia_movw_Ew_Sw },
+ /* 8D */ { 0, &Ia_leal_Gd_Md },
+ /* 8E */ { 0, &Ia_movw_Sw_Ew },
+ /* 8F */ { 0, &Ia_popq_Eq },
+ /* 90 */ { 0, &Ia_xchgl_ERX_EAX }, // handle XCHG R8d, EAX
+ /* 91 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 92 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 93 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 94 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 95 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 96 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 97 */ { 0, &Ia_xchgl_ERX_EAX },
+ /* 98 */ { 0, &Ia_cwde },
+ /* 99 */ { 0, &Ia_cdq },
+ /* 9A */ { 0, &Ia_Invalid },
+ /* 9B */ { 0, &Ia_fwait },
+ /* 9C */ { 0, &Ia_pushfq },
+ /* 9D */ { 0, &Ia_popfq },
+ /* 9E */ { 0, &Ia_sahf },
+ /* 9F */ { 0, &Ia_lahf },
+ /* A0 */ { 0, &Ia_movb_AL_Ob },
+ /* A1 */ { 0, &Ia_movl_EAX_Od },
+ /* A0 */ { 0, &Ia_movb_Ob_AL },
+ /* A1 */ { 0, &Ia_movl_Od_EAX },
+ /* A4 */ { 0, &Ia_movsb_Yb_Xb },
+ /* A5 */ { 0, &Ia_movsl_Yd_Xd },
+ /* A6 */ { 0, &Ia_cmpsb_Yb_Xb },
+ /* A7 */ { 0, &Ia_cmpsl_Yd_Xd },
+ /* A8 */ { 0, &Ia_testb_AL_Ib },
+ /* A9 */ { 0, &Ia_testl_EAX_Id },
+ /* AA */ { 0, &Ia_stosb_Yb_AL },
+ /* AB */ { 0, &Ia_stosl_Yd_EAX },
+ /* AC */ { 0, &Ia_lodsb_AL_Xb },
+ /* AD */ { 0, &Ia_lodsl_EAX_Xd },
+ /* AE */ { 0, &Ia_scasb_Yb_AL },
+ /* AF */ { 0, &Ia_scasl_Yd_EAX },
+ /* B0 */ { 0, &Ia_movb_R8_Ib },
+ /* B1 */ { 0, &Ia_movb_R8_Ib },
+ /* B2 */ { 0, &Ia_movb_R8_Ib },
+ /* B3 */ { 0, &Ia_movb_R8_Ib },
+ /* B4 */ { 0, &Ia_movb_R8_Ib },
+ /* B5 */ { 0, &Ia_movb_R8_Ib },
+ /* B6 */ { 0, &Ia_movb_R8_Ib },
+ /* B7 */ { 0, &Ia_movb_R8_Ib },
+ /* B8 */ { 0, &Ia_movl_ERX_Id },
+ /* B9 */ { 0, &Ia_movl_ERX_Id },
+ /* BA */ { 0, &Ia_movl_ERX_Id },
+ /* BB */ { 0, &Ia_movl_ERX_Id },
+ /* BC */ { 0, &Ia_movl_ERX_Id },
+ /* BD */ { 0, &Ia_movl_ERX_Id },
+ /* BE */ { 0, &Ia_movl_ERX_Id },
+ /* BF */ { 0, &Ia_movl_ERX_Id },
+ /* C0 */ { GRPN(G2Eb) },
+ /* C1 */ { GRPN(G2Ed) },
+ /* C2 */ { 0, &Ia_ret_Iw },
+ /* C3 */ { 0, &Ia_ret },
+ /* C4 */ { 0, &Ia_Invalid },
+ /* C5 */ { 0, &Ia_Invalid },
+ /* C6 */ { 0, &Ia_movb_Eb_Ib },
+ /* C7 */ { 0, &Ia_movl_Ed_Id },
+ /* C8 */ { 0, &Ia_enter },
+ /* C9 */ { 0, &Ia_leave },
+ /* CA */ { 0, &Ia_lret_Iw },
+ /* CB */ { 0, &Ia_lret },
+ /* CC */ { 0, &Ia_int3 },
+ /* CD */ { 0, &Ia_int_Ib },
+ /* CE */ { 0, &Ia_Invalid },
+ /* CF */ { 0, &Ia_iretl },
+ /* D0 */ { GRPN(G2EbI1) },
+ /* D1 */ { GRPN(G2EdI1) },
+ /* D2 */ { GRPN(G2EbCL) },
+ /* D3 */ { GRPN(G2EdCL) },
+ /* D4 */ { 0, &Ia_Invalid },
+ /* D5 */ { 0, &Ia_Invalid },
+ /* D6 */ { 0, &Ia_Invalid },
+ /* D7 */ { 0, &Ia_xlat },
+ /* D8 */ { GRPFP(D8) },
+ /* D9 */ { GRPFP(D9) },
+ /* DA */ { GRPFP(DA) },
+ /* DB */ { GRPFP(DB) },
+ /* DC */ { GRPFP(DC) },
+ /* DD */ { GRPFP(DD) },
+ /* DE */ { GRPFP(DE) },
+ /* DF */ { GRPFP(DF) },
+ /* E0 */ { 0, &Ia_loopne_Jb },
+ /* E1 */ { 0, &Ia_loope_Jb },
+ /* E2 */ { 0, &Ia_loop_Jb },
+ /* E3 */ { 0, &Ia_jrcxz_Jb },
+ /* E4 */ { 0, &Ia_inb_AL_Ib },
+ /* E5 */ { 0, &Ia_inl_EAX_Ib },
+ /* E6 */ { 0, &Ia_outb_Ib_AL },
+ /* E7 */ { 0, &Ia_outl_Ib_EAX },
+ /* E8 */ { 0, &Ia_call_Jd },
+ /* E9 */ { 0, &Ia_jmp_Jd },
+ /* EA */ { 0, &Ia_Invalid },
+ /* EB */ { 0, &Ia_jmp_Jb },
+ /* EC */ { 0, &Ia_inb_AL_DX },
+ /* ED */ { 0, &Ia_inl_EAX_DX },
+ /* EE */ { 0, &Ia_outb_DX_AL },
+ /* EF */ { 0, &Ia_outl_DX_EAX },
+ /* F0 */ { 0, &Ia_prefix_lock }, // LOCK:
+ /* F1 */ { 0, &Ia_int1 },
+ /* F2 */ { 0, &Ia_prefix_repne }, // REPNE:
+ /* F3 */ { 0, &Ia_prefix_rep }, // REP:
+ /* F4 */ { 0, &Ia_hlt },
+ /* F5 */ { 0, &Ia_cmc },
+ /* F6 */ { GRPN(G3Eb) },
+ /* F7 */ { GRPN(G3Ed) },
+ /* F8 */ { 0, &Ia_clc },
+ /* F9 */ { 0, &Ia_stc },
+ /* FA */ { 0, &Ia_cli },
+ /* FB */ { 0, &Ia_sti },
+ /* FC */ { 0, &Ia_cld },
+ /* FD */ { 0, &Ia_std },
+ /* FE */ { GRPN(G4) },
+ /* FF */ { GRPN(64G5d) },
+
+ // 256 entries for two byte opcodes
+ /* 0F 00 */ { GRPN(G6) },
+ /* 0F 01 */ { GRPN(G7) },
+ /* 0F 02 */ { 0, &Ia_larl_Gd_Ew },
+ /* 0F 03 */ { 0, &Ia_lsll_Gd_Ew },
+ /* 0F 04 */ { 0, &Ia_Invalid },
+ /* 0F 05 */ { 0, &Ia_syscall },
+ /* 0F 06 */ { 0, &Ia_clts },
+ /* 0F 07 */ { 0, &Ia_sysret },
+ /* 0F 08 */ { 0, &Ia_invd },
+ /* 0F 09 */ { 0, &Ia_wbinvd },
+ /* 0F 0A */ { 0, &Ia_Invalid },
+ /* 0F 0B */ { 0, &Ia_ud2a },
+ /* 0F 0C */ { 0, &Ia_Invalid },
+ /* 0F 0D */ { 0, &Ia_prefetch }, // 3DNow!
+ /* 0F 0E */ { 0, &Ia_femms }, // 3DNow!
+ /* 0F 0F */ { GRP3DNOW },
+ /* 0F 10 */ { GRPSSE(0f10) },
+ /* 0F 11 */ { GRPSSE(0f11) },
+ /* 0F 12 */ { GRPSSE(0f12) },
+ /* 0F 13 */ { GRPSSE(0f13) },
+ /* 0F 14 */ { GRPSSE(0f14) },
+ /* 0F 15 */ { GRPSSE(0f15) },
+ /* 0F 16 */ { GRPSSE(0f16) },
+ /* 0F 17 */ { GRPSSE(0f17) },
+ /* 0F 18 */ { GRPN(G16) },
+ /* 0F 19 */ { 0, &Ia_Invalid },
+ /* 0F 1A */ { 0, &Ia_Invalid },
+ /* 0F 1B */ { 0, &Ia_Invalid },
+ /* 0F 1C */ { 0, &Ia_Invalid },
+ /* 0F 1D */ { 0, &Ia_Invalid },
+ /* 0F 1E */ { 0, &Ia_Invalid },
+ /* 0F 1F */ { 0, &Ia_multibyte_nop },
+ /* 0F 20 */ { 0, &Ia_movq_Rq_Cq },
+ /* 0F 21 */ { 0, &Ia_movq_Rq_Dq },
+ /* 0F 22 */ { 0, &Ia_movq_Cq_Rq },
+ /* 0F 23 */ { 0, &Ia_movq_Dq_Rq },
+ /* 0F 24 */ { 0, &Ia_Invalid },
+ /* 0F 25 */ { 0, &Ia_Invalid },
+ /* 0F 26 */ { 0, &Ia_Invalid },
+ /* 0F 27 */ { 0, &Ia_Invalid },
+ /* 0F 28 */ { GRPSSE(0f28) },
+ /* 0F 29 */ { GRPSSE(0f29) },
+ /* 0F 2A */ { GRPSSE(0f2a) },
+ /* 0F 2B */ { GRPSSE(0f2b) },
+ /* 0F 2C */ { GRPSSE(0f2c) },
+ /* 0F 2D */ { GRPSSE(0f2d) },
+ /* 0F 2E */ { GRPSSE(0f2e) },
+ /* 0F 2F */ { GRPSSE(0f2f) },
+ /* 0F 30 */ { 0, &Ia_wrmsr },
+ /* 0F 31 */ { 0, &Ia_rdtsc },
+ /* 0F 32 */ { 0, &Ia_rdmsr },
+ /* 0F 33 */ { 0, &Ia_rdpmc },
+ /* 0F 34 */ { 0, &Ia_sysenter },
+ /* 0F 35 */ { 0, &Ia_sysexit },
+ /* 0F 36 */ { 0, &Ia_Invalid },
+ /* 0F 37 */ { 0, &Ia_Invalid },
+ /* 0F 38 */ { GR3BTAB(A4) },
+ /* 0F 39 */ { 0, &Ia_Invalid },
+ /* 0F 3A */ { GR3BTAB(A5) },
+ /* 0F 3B */ { 0, &Ia_Invalid },
+ /* 0F 3C */ { 0, &Ia_Invalid },
+ /* 0F 3D */ { 0, &Ia_Invalid },
+ /* 0F 3E */ { 0, &Ia_Invalid },
+ /* 0F 3F */ { 0, &Ia_Invalid },
+ /* 0F 40 */ { 0, &Ia_cmovol_Gd_Ed },
+ /* 0F 41 */ { 0, &Ia_cmovnol_Gd_Ed },
+ /* 0F 42 */ { 0, &Ia_cmovcl_Gd_Ed },
+ /* 0F 43 */ { 0, &Ia_cmovncl_Gd_Ed },
+ /* 0F 44 */ { 0, &Ia_cmovzl_Gd_Ed },
+ /* 0F 45 */ { 0, &Ia_cmovnzl_Gd_Ed },
+ /* 0F 46 */ { 0, &Ia_cmovnal_Gd_Ed },
+ /* 0F 47 */ { 0, &Ia_cmoval_Gd_Ed },
+ /* 0F 48 */ { 0, &Ia_cmovsl_Gd_Ed },
+ /* 0F 49 */ { 0, &Ia_cmovnsl_Gd_Ed },
+ /* 0F 4A */ { 0, &Ia_cmovpl_Gd_Ed },
+ /* 0F 4B */ { 0, &Ia_cmovnpl_Gd_Ed },
+ /* 0F 4C */ { 0, &Ia_cmovll_Gd_Ed },
+ /* 0F 4D */ { 0, &Ia_cmovnll_Gd_Ed },
+ /* 0F 4E */ { 0, &Ia_cmovngl_Gd_Ed },
+ /* 0F 4F */ { 0, &Ia_cmovgl_Gd_Ed },
+ /* 0F 50 */ { GRPSSE(0f50) },
+ /* 0F 51 */ { GRPSSE(0f51) },
+ /* 0F 52 */ { GRPSSE(0f52) },
+ /* 0F 53 */ { GRPSSE(0f53) },
+ /* 0F 54 */ { GRPSSE(0f54) },
+ /* 0F 55 */ { GRPSSE(0f55) },
+ /* 0F 56 */ { GRPSSE(0f56) },
+ /* 0F 57 */ { GRPSSE(0f57) },
+ /* 0F 58 */ { GRPSSE(0f58) },
+ /* 0F 59 */ { GRPSSE(0f59) },
+ /* 0F 5A */ { GRPSSE(0f5a) },
+ /* 0F 5B */ { GRPSSE(0f5b) },
+ /* 0F 5C */ { GRPSSE(0f5c) },
+ /* 0F 5D */ { GRPSSE(0f5d) },
+ /* 0F 5E */ { GRPSSE(0f5e) },
+ /* 0F 5F */ { GRPSSE(0f5f) },
+ /* 0F 60 */ { GRPSSE(0f60) },
+ /* 0F 61 */ { GRPSSE(0f61) },
+ /* 0F 62 */ { GRPSSE(0f62) },
+ /* 0F 63 */ { GRPSSE(0f63) },
+ /* 0F 64 */ { GRPSSE(0f64) },
+ /* 0F 65 */ { GRPSSE(0f65) },
+ /* 0F 66 */ { GRPSSE(0f66) },
+ /* 0F 67 */ { GRPSSE(0f67) },
+ /* 0F 68 */ { GRPSSE(0f68) },
+ /* 0F 69 */ { GRPSSE(0f69) },
+ /* 0F 6A */ { GRPSSE(0f6a) },
+ /* 0F 6B */ { GRPSSE(0f6b) },
+ /* 0F 6C */ { GRPSSE(0f6c) },
+ /* 0F 6D */ { GRPSSE(0f6d) },
+ /* 0F 6E */ { GRPSSE(0f6e) },
+ /* 0F 6F */ { GRPSSE(0f6f) },
+ /* 0F 70 */ { GRPSSE(0f70) },
+ /* 0F 71 */ { GRPN(G12) },
+ /* 0F 72 */ { GRPN(G13) },
+ /* 0F 73 */ { GRPN(G14) },
+ /* 0F 74 */ { GRPSSE(0f74) },
+ /* 0F 75 */ { GRPSSE(0f75) },
+ /* 0F 76 */ { GRPSSE(0f76) },
+ /* 0F 77 */ { 0, &Ia_emms },
+ /* 0F 78 */ { 0, &Ia_Invalid },
+ /* 0F 79 */ { 0, &Ia_Invalid },
+ /* 0F 7A */ { 0, &Ia_Invalid },
+ /* 0F 7B */ { 0, &Ia_Invalid },
+ /* 0F 7C */ { GRPSSE(0f7c) },
+ /* 0F 7D */ { GRPSSE(0f7d) },
+ /* 0F 7E */ { GRPSSE(0f7e) },
+ /* 0F 7F */ { GRPSSE(0f7f) },
+ /* 0F 80 */ { 0, &Ia_jo_Jd },
+ /* 0F 81 */ { 0, &Ia_jno_Jd },
+ /* 0F 82 */ { 0, &Ia_jb_Jd },
+ /* 0F 83 */ { 0, &Ia_jnb_Jd },
+ /* 0F 84 */ { 0, &Ia_jz_Jd },
+ /* 0F 85 */ { 0, &Ia_jnz_Jd },
+ /* 0F 86 */ { 0, &Ia_jbe_Jd },
+ /* 0F 87 */ { 0, &Ia_jnbe_Jd },
+ /* 0F 88 */ { 0, &Ia_js_Jd },
+ /* 0F 89 */ { 0, &Ia_jns_Jd },
+ /* 0F 8A */ { 0, &Ia_jp_Jd },
+ /* 0F 8B */ { 0, &Ia_jnp_Jd },
+ /* 0F 8C */ { 0, &Ia_jl_Jd },
+ /* 0F 8D */ { 0, &Ia_jnl_Jd },
+ /* 0F 8E */ { 0, &Ia_jle_Jd },
+ /* 0F 8F */ { 0, &Ia_jnle_Jd },
+ /* 0F 90 */ { 0, &Ia_seto_Eb },
+ /* 0F 91 */ { 0, &Ia_setno_Eb },
+ /* 0F 92 */ { 0, &Ia_setb_Eb },
+ /* 0F 93 */ { 0, &Ia_setnb_Eb },
+ /* 0F 94 */ { 0, &Ia_setz_Eb },
+ /* 0F 95 */ { 0, &Ia_setnz_Eb },
+ /* 0F 96 */ { 0, &Ia_setbe_Eb },
+ /* 0F 97 */ { 0, &Ia_setnbe_Eb },
+ /* 0F 98 */ { 0, &Ia_sets_Eb },
+ /* 0F 99 */ { 0, &Ia_setns_Eb },
+ /* 0F 9A */ { 0, &Ia_setp_Eb },
+ /* 0F 9B */ { 0, &Ia_setnp_Eb },
+ /* 0F 9C */ { 0, &Ia_setl_Eb },
+ /* 0F 9D */ { 0, &Ia_setnl_Eb },
+ /* 0F 9E */ { 0, &Ia_setle_Eb },
+ /* 0F 9F */ { 0, &Ia_setnle_Eb },
+ /* 0F A0 */ { 0, &Ia_pushq_FS },
+ /* 0F A1 */ { 0, &Ia_popq_FS },
+ /* 0F A2 */ { 0, &Ia_cpuid },
+ /* 0F A3 */ { 0, &Ia_btl_Ed_Gd },
+ /* 0F A4 */ { 0, &Ia_shldl_Ed_Gd_Ib },
+ /* 0F A5 */ { 0, &Ia_shldl_Ed_Gd_CL },
+ /* 0F A6 */ { 0, &Ia_Invalid },
+ /* 0F A7 */ { 0, &Ia_Invalid },
+ /* 0F A8 */ { 0, &Ia_pushq_GS },
+ /* 0F A9 */ { 0, &Ia_popq_GS },
+ /* 0F AA */ { 0, &Ia_rsm },
+ /* 0F AB */ { 0, &Ia_btsl_Ed_Gd },
+ /* 0F AC */ { 0, &Ia_shrdl_Ed_Gd_Ib },
+ /* 0F AD */ { 0, &Ia_shrdl_Ed_Gd_CL },
+ /* 0F AE */ { GRPN(G15) },
+ /* 0F AF */ { 0, &Ia_imull_Gd_Ed },
+ /* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
+ /* 0F B1 */ { 0, &Ia_cmpxchgl_Ed_Gd },
+ /* 0F B2 */ { 0, &Ia_lssl_Gd_Mp },
+ /* 0F B3 */ { 0, &Ia_btrl_Ed_Gd },
+ /* 0F B4 */ { 0, &Ia_lfsl_Gd_Mp },
+ /* 0F B5 */ { 0, &Ia_lgsl_Gd_Mp },
+ /* 0F B6 */ { 0, &Ia_movzbl_Gd_Eb },
+ /* 0F B7 */ { 0, &Ia_movzwl_Gd_Ew },
+ /* 0F B8 */ { 0, &Ia_Invalid },
+ /* 0F B9 */ { 0, &Ia_ud2b },
+ /* 0F BA */ { GRPN(G8EdIb) },
+ /* 0F BB */ { 0, &Ia_btcl_Ed_Gd },
+ /* 0F BC */ { 0, &Ia_bsfl_Gd_Ed },
+ /* 0F BD */ { 0, &Ia_bsrl_Gd_Ed },
+ /* 0F BE */ { 0, &Ia_movsbl_Gd_Eb },
+ /* 0F BF */ { 0, &Ia_movswl_Gd_Ew },
+ /* 0F C0 */ { 0, &Ia_xaddb_Eb_Gb },
+ /* 0F C0 */ { 0, &Ia_xaddl_Ed_Gd },
+ /* 0F C2 */ { GRPSSE(0fc2) },
+ /* 0F C3 */ { GRPSSE(0fc3) },
+ /* 0F C4 */ { GRPSSE(0fc4) },
+ /* 0F C5 */ { GRPSSE(0fc5) },
+ /* 0F C6 */ { GRPSSE(0fc6) },
+ /* 0F C7 */ { GRPN(G9) },
+ /* 0F C8 */ { 0, &Ia_bswapl_ERX },
+ /* 0F C9 */ { 0, &Ia_bswapl_ERX },
+ /* 0F CA */ { 0, &Ia_bswapl_ERX },
+ /* 0F CB */ { 0, &Ia_bswapl_ERX },
+ /* 0F CC */ { 0, &Ia_bswapl_ERX },
+ /* 0F CD */ { 0, &Ia_bswapl_ERX },
+ /* 0F CE */ { 0, &Ia_bswapl_ERX },
+ /* 0F CF */ { 0, &Ia_bswapl_ERX },
+ /* 0F D0 */ { GRPSSE(0fd0) },
+ /* 0F D1 */ { GRPSSE(0fd1) },
+ /* 0F D2 */ { GRPSSE(0fd2) },
+ /* 0F D3 */ { GRPSSE(0fd3) },
+ /* 0F D4 */ { GRPSSE(0fd4) },
+ /* 0F D5 */ { GRPSSE(0fd5) },
+ /* 0F D6 */ { GRPSSE(0fd6) },
+ /* 0F D7 */ { GRPSSE(0fd7) },
+ /* 0F D8 */ { GRPSSE(0fd8) },
+ /* 0F D9 */ { GRPSSE(0fd9) },
+ /* 0F DA */ { GRPSSE(0fda) },
+ /* 0F DB */ { GRPSSE(0fdb) },
+ /* 0F DC */ { GRPSSE(0fdc) },
+ /* 0F DD */ { GRPSSE(0fdd) },
+ /* 0F DE */ { GRPSSE(0fde) },
+ /* 0F DF */ { GRPSSE(0fdf) },
+ /* 0F E0 */ { GRPSSE(0fe0) },
+ /* 0F E1 */ { GRPSSE(0fe1) },
+ /* 0F E2 */ { GRPSSE(0fe2) },
+ /* 0F E3 */ { GRPSSE(0fe3) },
+ /* 0F E4 */ { GRPSSE(0fe4) },
+ /* 0F E5 */ { GRPSSE(0fe5) },
+ /* 0F E6 */ { GRPSSE(0fe6) },
+ /* 0F E7 */ { GRPSSE(0fe7) },
+ /* 0F E8 */ { GRPSSE(0fe8) },
+ /* 0F E9 */ { GRPSSE(0fe9) },
+ /* 0F EA */ { GRPSSE(0fea) },
+ /* 0F EB */ { GRPSSE(0feb) },
+ /* 0F EC */ { GRPSSE(0fec) },
+ /* 0F ED */ { GRPSSE(0fed) },
+ /* 0F EE */ { GRPSSE(0fee) },
+ /* 0F EF */ { GRPSSE(0fef) },
+ /* 0F F0 */ { GRPSSE(0ff0) },
+ /* 0F F1 */ { GRPSSE(0ff1) },
+ /* 0F F2 */ { GRPSSE(0ff2) },
+ /* 0F F3 */ { GRPSSE(0ff3) },
+ /* 0F F4 */ { GRPSSE(0ff4) },
+ /* 0F F5 */ { GRPSSE(0ff5) },
+ /* 0F F6 */ { GRPSSE(0ff6) },
+ /* 0F F7 */ { GRPSSE(0ff7) },
+ /* 0F F8 */ { GRPSSE(0ff8) },
+ /* 0F F9 */ { GRPSSE(0ff9) },
+ /* 0F FA */ { GRPSSE(0ffa) },
+ /* 0F FB */ { GRPSSE(0ffb) },
+ /* 0F FC */ { GRPSSE(0ffc) },
+ /* 0F FD */ { GRPSSE(0ffd) },
+ /* 0F FE */ { GRPSSE(0ffe) },
+ /* 0F FF */ { 0, &Ia_Invalid }
+};
+
+static BxDisasmOpcodeTable_t BxDisasmOpcodes64q[256*2] = {
+ // 256 entries for single byte opcodes
+ /* 00 */ { 0, &Ia_addb_Eb_Gb },
+ /* 01 */ { 0, &Ia_addq_Eq_Gq },
+ /* 02 */ { 0, &Ia_addb_Gb_Eb },
+ /* 03 */ { 0, &Ia_addq_Gq_Eq },
+ /* 04 */ { 0, &Ia_addb_AL_Ib, },
+ /* 05 */ { 0, &Ia_addq_RAX_sId },
+ /* 06 */ { 0, &Ia_Invalid },
+ /* 07 */ { 0, &Ia_Invalid },
+ /* 08 */ { 0, &Ia_orb_Eb_Gb },
+ /* 09 */ { 0, &Ia_orq_Eq_Gq },
+ /* 0A */ { 0, &Ia_orb_Gb_Eb },
+ /* 0B */ { 0, &Ia_orq_Gq_Eq },
+ /* 0C */ { 0, &Ia_orb_AL_Ib },
+ /* 0D */ { 0, &Ia_orq_RAX_sId },
+ /* 0E */ { 0, &Ia_Invalid },
+ /* 0F */ { 0, &Ia_error }, // 2 byte escape
+ /* 10 */ { 0, &Ia_adcb_Eb_Gb },
+ /* 11 */ { 0, &Ia_adcq_Eq_Gq },
+ /* 12 */ { 0, &Ia_adcb_Gb_Eb },
+ /* 13 */ { 0, &Ia_adcq_Gq_Eq },
+ /* 14 */ { 0, &Ia_adcb_AL_Ib },
+ /* 15 */ { 0, &Ia_adcq_RAX_sId },
+ /* 16 */ { 0, &Ia_Invalid },
+ /* 17 */ { 0, &Ia_Invalid },
+ /* 18 */ { 0, &Ia_sbbb_Eb_Gb },
+ /* 19 */ { 0, &Ia_sbbq_Eq_Gq },
+ /* 1A */ { 0, &Ia_sbbb_Gb_Eb },
+ /* 1B */ { 0, &Ia_sbbq_Gq_Eq },
+ /* 1C */ { 0, &Ia_sbbb_AL_Ib },
+ /* 1D */ { 0, &Ia_sbbq_RAX_sId },
+ /* 1E */ { 0, &Ia_Invalid },
+ /* 1F */ { 0, &Ia_Invalid },
+ /* 20 */ { 0, &Ia_andb_Eb_Gb },
+ /* 21 */ { 0, &Ia_andq_Eq_Gq },
+ /* 22 */ { 0, &Ia_andb_Gb_Eb },
+ /* 23 */ { 0, &Ia_andq_Gq_Eq },
+ /* 24 */ { 0, &Ia_andb_AL_Ib },
+ /* 25 */ { 0, &Ia_andq_RAX_sId },
+ /* 26 */ { 0, &Ia_prefix_es }, // ES:
+ /* 27 */ { 0, &Ia_Invalid },
+ /* 28 */ { 0, &Ia_subb_Eb_Gb },
+ /* 29 */ { 0, &Ia_subq_Eq_Gq },
+ /* 2A */ { 0, &Ia_subb_Gb_Eb },
+ /* 2B */ { 0, &Ia_subq_Gq_Eq },
+ /* 2C */ { 0, &Ia_subb_AL_Ib },
+ /* 2D */ { 0, &Ia_subq_RAX_sId },
+ /* 2E */ { 0, &Ia_prefix_cs }, // CS:
+ /* 2F */ { 0, &Ia_Invalid },
+ /* 30 */ { 0, &Ia_xorb_Eb_Gb },
+ /* 31 */ { 0, &Ia_xorq_Eq_Gq },
+ /* 32 */ { 0, &Ia_xorb_Gb_Eb },
+ /* 33 */ { 0, &Ia_xorq_Gq_Eq },
+ /* 34 */ { 0, &Ia_xorb_AL_Ib },
+ /* 35 */ { 0, &Ia_xorq_RAX_sId },
+ /* 36 */ { 0, &Ia_prefix_ss }, // SS:
+ /* 37 */ { 0, &Ia_Invalid },
+ /* 38 */ { 0, &Ia_cmpb_Eb_Gb },
+ /* 39 */ { 0, &Ia_cmpq_Eq_Gq },
+ /* 3A */ { 0, &Ia_cmpb_Gb_Eb },
+ /* 3B */ { 0, &Ia_cmpq_Gq_Eq },
+ /* 3C */ { 0, &Ia_cmpb_AL_Ib },
+ /* 3D */ { 0, &Ia_cmpq_RAX_sId },
+ /* 3E */ { 0, &Ia_prefix_ds }, // DS:
+ /* 3F */ { 0, &Ia_Invalid },
+ /* 40 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 41 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 42 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 43 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 44 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 45 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 46 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 47 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 48 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 49 */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4A */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4B */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4C */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4D */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4E */ { 0, &Ia_prefix_rex }, // REX:
+ /* 4F */ { 0, &Ia_prefix_rex }, // REX:
+ /* 50 */ { 0, &Ia_pushq_RRX },
+ /* 51 */ { 0, &Ia_pushq_RRX },
+ /* 52 */ { 0, &Ia_pushq_RRX },
+ /* 53 */ { 0, &Ia_pushq_RRX },
+ /* 54 */ { 0, &Ia_pushq_RRX },
+ /* 55 */ { 0, &Ia_pushq_RRX },
+ /* 56 */ { 0, &Ia_pushq_RRX },
+ /* 57 */ { 0, &Ia_pushq_RRX },
+ /* 58 */ { 0, &Ia_popq_RRX },
+ /* 59 */ { 0, &Ia_popq_RRX },
+ /* 5A */ { 0, &Ia_popq_RRX },
+ /* 5B */ { 0, &Ia_popq_RRX },
+ /* 5C */ { 0, &Ia_popq_RRX },
+ /* 5D */ { 0, &Ia_popq_RRX },
+ /* 5E */ { 0, &Ia_popq_RRX },
+ /* 5F */ { 0, &Ia_popq_RRX },
+ /* 60 */ { 0, &Ia_Invalid },
+ /* 61 */ { 0, &Ia_Invalid },
+ /* 62 */ { 0, &Ia_Invalid },
+ /* 63 */ { 0, &Ia_movslq_Gq_Ed },
+ /* 64 */ { 0, &Ia_prefix_fs }, // FS:
+ /* 65 */ { 0, &Ia_prefix_gs }, // GS:
+ /* 66 */ { 0, &Ia_prefix_osize }, // OSIZE:
+ /* 67 */ { 0, &Ia_prefix_asize }, // ASIZE:
+ /* 68 */ { 0, &Ia_pushq_sId },
+ /* 69 */ { 0, &Ia_imulq_Gq_Eq_sId },
+ /* 6A */ { 0, &Ia_pushq_sIb },
+ /* 6B */ { 0, &Ia_imulq_Gq_Eq_sIb },
+ /* 6C */ { 0, &Ia_insb_Yb_DX },
+ /* 6D */ { 0, &Ia_insl_Yd_DX },
+ /* 6E */ { 0, &Ia_outsb_DX_Xb },
+ /* 6F */ { 0, &Ia_outsl_DX_Xd },
+ /* 70 */ { 0, &Ia_jo_Jb },
+ /* 71 */ { 0, &Ia_jno_Jb },
+ /* 72 */ { 0, &Ia_jb_Jb },
+ /* 73 */ { 0, &Ia_jnb_Jb },
+ /* 74 */ { 0, &Ia_jz_Jb },
+ /* 75 */ { 0, &Ia_jnz_Jb },
+ /* 76 */ { 0, &Ia_jbe_Jb },
+ /* 77 */ { 0, &Ia_jnbe_Jb },
+ /* 78 */ { 0, &Ia_js_Jb },
+ /* 79 */ { 0, &Ia_jns_Jb },
+ /* 7A */ { 0, &Ia_jp_Jb },
+ /* 7B */ { 0, &Ia_jnp_Jb },
+ /* 7C */ { 0, &Ia_jl_Jb },
+ /* 7D */ { 0, &Ia_jnl_Jb },
+ /* 7E */ { 0, &Ia_jle_Jb },
+ /* 7F */ { 0, &Ia_jnle_Jb },
+ /* 80 */ { GRPN(G1EbIb) },
+ /* 81 */ { GRPN(G1EqId) },
+ /* 82 */ { 0, &Ia_Invalid },
+ /* 83 */ { GRPN(G1EqIb) },
+ /* 84 */ { 0, &Ia_testb_Eb_Gb },
+ /* 85 */ { 0, &Ia_testq_Eq_Gq },
+ /* 86 */ { 0, &Ia_xchgb_Eb_Gb },
+ /* 87 */ { 0, &Ia_xchgq_Eq_Gq },
+ /* 88 */ { 0, &Ia_movb_Eb_Gb },
+ /* 89 */ { 0, &Ia_movq_Eq_Gq },
+ /* 8A */ { 0, &Ia_movb_Gb_Eb },
+ /* 8B */ { 0, &Ia_movq_Gq_Eq },
+ /* 8C */ { 0, &Ia_movw_Ew_Sw },
+ /* 8D */ { 0, &Ia_leaq_Gq_Mq },
+ /* 8E */ { 0, &Ia_movw_Sw_Ew },
+ /* 8F */ { 0, &Ia_popq_Eq },
+ /* 90 */ { 0, &Ia_xchgq_RRX_RAX }, // handle XCHG R8, RAX
+ /* 91 */ { 0, &Ia_xchgq_RRX_RAX },
+ /* 92 */ { 0, &Ia_xchgq_RRX_RAX },
+ /* 93 */ { 0, &Ia_xchgq_RRX_RAX },
+ /* 94 */ { 0, &Ia_xchgq_RRX_RAX },
+ /* 95 */ { 0, &Ia_xchgq_RRX_RAX },
+ /* 96 */ { 0, &Ia_xchgq_RRX_RAX },
+ /* 97 */ { 0, &Ia_xchgq_RRX_RAX },
+ /* 98 */ { 0, &Ia_cdqe },
+ /* 99 */ { 0, &Ia_cqo },
+ /* 9A */ { 0, &Ia_Invalid },
+ /* 9B */ { 0, &Ia_fwait },
+ /* 9C */ { 0, &Ia_pushfq },
+ /* 9D */ { 0, &Ia_popfq },
+ /* 9E */ { 0, &Ia_sahf },
+ /* 9F */ { 0, &Ia_lahf },
+ /* A0 */ { 0, &Ia_movb_AL_Ob },
+ /* A1 */ { 0, &Ia_movq_RAX_Oq },
+ /* A0 */ { 0, &Ia_movb_Ob_AL },
+ /* A1 */ { 0, &Ia_movq_Oq_RAX },
+ /* A4 */ { 0, &Ia_movsb_Yb_Xb },
+ /* A5 */ { 0, &Ia_movsq_Yq_Xq },
+ /* A6 */ { 0, &Ia_cmpsb_Yb_Xb },
+ /* A7 */ { 0, &Ia_cmpsq_Yq_Xq },
+ /* A8 */ { 0, &Ia_testb_AL_Ib },
+ /* A9 */ { 0, &Ia_testq_RAX_sId },
+ /* AA */ { 0, &Ia_stosb_Yb_AL },
+ /* AB */ { 0, &Ia_stosq_Yq_RAX },
+ /* AC */ { 0, &Ia_lodsb_AL_Xb },
+ /* AD */ { 0, &Ia_lodsq_RAX_Xq },
+ /* AE */ { 0, &Ia_scasb_Yb_AL },
+ /* AF */ { 0, &Ia_scasq_Yq_RAX },
+ /* B0 */ { 0, &Ia_movb_R8_Ib },
+ /* B1 */ { 0, &Ia_movb_R8_Ib },
+ /* B2 */ { 0, &Ia_movb_R8_Ib },
+ /* B3 */ { 0, &Ia_movb_R8_Ib },
+ /* B4 */ { 0, &Ia_movb_R8_Ib },
+ /* B5 */ { 0, &Ia_movb_R8_Ib },
+ /* B6 */ { 0, &Ia_movb_R8_Ib },
+ /* B7 */ { 0, &Ia_movb_R8_Ib },
+ /* B8 */ { 0, &Ia_movq_RRX_Iq },
+ /* B9 */ { 0, &Ia_movq_RRX_Iq },
+ /* BA */ { 0, &Ia_movq_RRX_Iq },
+ /* BB */ { 0, &Ia_movq_RRX_Iq },
+ /* BC */ { 0, &Ia_movq_RRX_Iq },
+ /* BD */ { 0, &Ia_movq_RRX_Iq },
+ /* BE */ { 0, &Ia_movq_RRX_Iq },
+ /* BF */ { 0, &Ia_movq_RRX_Iq },
+ /* C0 */ { GRPN(G2Eb) },
+ /* C1 */ { GRPN(G2Eq) },
+ /* C2 */ { 0, &Ia_ret_Iw },
+ /* C3 */ { 0, &Ia_ret },
+ /* C4 */ { 0, &Ia_Invalid },
+ /* C5 */ { 0, &Ia_Invalid },
+ /* C6 */ { 0, &Ia_movb_Eb_Ib },
+ /* C7 */ { 0, &Ia_movq_Eq_sId },
+ /* C8 */ { 0, &Ia_enter },
+ /* C9 */ { 0, &Ia_leave },
+ /* CA */ { 0, &Ia_lret_Iw },
+ /* CB */ { 0, &Ia_lret },
+ /* CC */ { 0, &Ia_int3 },
+ /* CD */ { 0, &Ia_int_Ib },
+ /* CE */ { 0, &Ia_Invalid },
+ /* CF */ { 0, &Ia_iretq },
+ /* D0 */ { GRPN(G2EbI1) },
+ /* D1 */ { GRPN(G2EqI1) },
+ /* D2 */ { GRPN(G2EbCL) },
+ /* D3 */ { GRPN(G2EqCL) },
+ /* D4 */ { 0, &Ia_Invalid },
+ /* D5 */ { 0, &Ia_Invalid },
+ /* D6 */ { 0, &Ia_Invalid },
+ /* D7 */ { 0, &Ia_xlat },
+ /* D8 */ { GRPFP(D8) },
+ /* D9 */ { GRPFP(D9) },
+ /* DA */ { GRPFP(DA) },
+ /* DB */ { GRPFP(DB) },
+ /* DC */ { GRPFP(DC) },
+ /* DD */ { GRPFP(DD) },
+ /* DE */ { GRPFP(DE) },
+ /* DF */ { GRPFP(DF) },
+ /* E0 */ { 0, &Ia_loopne_Jb },
+ /* E1 */ { 0, &Ia_loope_Jb },
+ /* E2 */ { 0, &Ia_loop_Jb },
+ /* E3 */ { 0, &Ia_jrcxz_Jb },
+ /* E4 */ { 0, &Ia_inb_AL_Ib },
+ /* E5 */ { 0, &Ia_inl_EAX_Ib },
+ /* E6 */ { 0, &Ia_outb_Ib_AL },
+ /* E7 */ { 0, &Ia_outl_Ib_EAX },
+ /* E8 */ { 0, &Ia_call_Jd },
+ /* E9 */ { 0, &Ia_jmp_Jd },
+ /* EA */ { 0, &Ia_Invalid },
+ /* EB */ { 0, &Ia_jmp_Jb },
+ /* EC */ { 0, &Ia_inb_AL_DX },
+ /* ED */ { 0, &Ia_inl_EAX_DX },
+ /* EE */ { 0, &Ia_outb_DX_AL },
+ /* EF */ { 0, &Ia_outl_DX_EAX },
+ /* F0 */ { 0, &Ia_prefix_lock }, // LOCK:
+ /* F1 */ { 0, &Ia_int1 },
+ /* F2 */ { 0, &Ia_prefix_repne }, // REPNE:
+ /* F3 */ { 0, &Ia_prefix_rep }, // REP:
+ /* F4 */ { 0, &Ia_hlt },
+ /* F5 */ { 0, &Ia_cmc },
+ /* F6 */ { GRPN(G3Eb) },
+ /* F7 */ { GRPN(G3Eq) },
+ /* F8 */ { 0, &Ia_clc },
+ /* F9 */ { 0, &Ia_stc },
+ /* FA */ { 0, &Ia_cli },
+ /* FB */ { 0, &Ia_sti },
+ /* FC */ { 0, &Ia_cld },
+ /* FD */ { 0, &Ia_std },
+ /* FE */ { GRPN(G4) },
+ /* FF */ { GRPN(64G5q) },
+
+ // 256 entries for two byte opcodes
+ /* 0F 00 */ { GRPN(G6) },
+ /* 0F 01 */ { GRPN(G7) },
+ /* 0F 02 */ { 0, &Ia_larq_Gq_Ew },
+ /* 0F 03 */ { 0, &Ia_lslq_Gq_Ew },
+ /* 0F 04 */ { 0, &Ia_Invalid },
+ /* 0F 05 */ { 0, &Ia_syscall },
+ /* 0F 06 */ { 0, &Ia_clts },
+ /* 0F 07 */ { 0, &Ia_sysret },
+ /* 0F 08 */ { 0, &Ia_invd },
+ /* 0F 09 */ { 0, &Ia_wbinvd },
+ /* 0F 0A */ { 0, &Ia_Invalid },
+ /* 0F 0B */ { 0, &Ia_ud2a },
+ /* 0F 0C */ { 0, &Ia_Invalid },
+ /* 0F 0D */ { 0, &Ia_prefetch }, // 3DNow!
+ /* 0F 0E */ { 0, &Ia_femms }, // 3DNow!
+ /* 0F 0F */ { GRP3DNOW },
+ /* 0F 10 */ { GRPSSE(0f10) },
+ /* 0F 11 */ { GRPSSE(0f11) },
+ /* 0F 12 */ { GRPSSE(0f12) },
+ /* 0F 13 */ { GRPSSE(0f13) },
+ /* 0F 14 */ { GRPSSE(0f14) },
+ /* 0F 15 */ { GRPSSE(0f15) },
+ /* 0F 16 */ { GRPSSE(0f16) },
+ /* 0F 17 */ { GRPSSE(0f17) },
+ /* 0F 18 */ { GRPN(G16) },
+ /* 0F 19 */ { 0, &Ia_Invalid },
+ /* 0F 1A */ { 0, &Ia_Invalid },
+ /* 0F 1B */ { 0, &Ia_Invalid },
+ /* 0F 1C */ { 0, &Ia_Invalid },
+ /* 0F 1D */ { 0, &Ia_Invalid },
+ /* 0F 1E */ { 0, &Ia_Invalid },
+ /* 0F 1F */ { 0, &Ia_multibyte_nop },
+ /* 0F 20 */ { 0, &Ia_movq_Rq_Cq },
+ /* 0F 21 */ { 0, &Ia_movq_Rq_Dq },
+ /* 0F 22 */ { 0, &Ia_movq_Cq_Rq },
+ /* 0F 23 */ { 0, &Ia_movq_Dq_Rq },
+ /* 0F 24 */ { 0, &Ia_Invalid },
+ /* 0F 25 */ { 0, &Ia_Invalid },
+ /* 0F 26 */ { 0, &Ia_Invalid },
+ /* 0F 27 */ { 0, &Ia_Invalid },
+ /* 0F 28 */ { GRPSSE(0f28) },
+ /* 0F 29 */ { GRPSSE(0f29) },
+ /* 0F 2A */ { GRPSSE(640f2a) },
+ /* 0F 2B */ { GRPSSE(0f2b) },
+ /* 0F 2C */ { GRPSSE(0f2cQ) },
+ /* 0F 2D */ { GRPSSE(0f2dQ) },
+ /* 0F 2E */ { GRPSSE(0f2e) },
+ /* 0F 2F */ { GRPSSE(0f2f) },
+ /* 0F 30 */ { 0, &Ia_wrmsr },
+ /* 0F 31 */ { 0, &Ia_rdtsc },
+ /* 0F 32 */ { 0, &Ia_rdmsr },
+ /* 0F 33 */ { 0, &Ia_rdpmc },
+ /* 0F 34 */ { 0, &Ia_sysenter },
+ /* 0F 35 */ { 0, &Ia_sysexit },
+ /* 0F 36 */ { 0, &Ia_Invalid },
+ /* 0F 37 */ { 0, &Ia_Invalid },
+ /* 0F 38 */ { GR3BTAB(A4) },
+ /* 0F 39 */ { 0, &Ia_Invalid },
+ /* 0F 3A */ { GR3BTAB(A5) },
+ /* 0F 3B */ { 0, &Ia_Invalid },
+ /* 0F 3C */ { 0, &Ia_Invalid },
+ /* 0F 3D */ { 0, &Ia_Invalid },
+ /* 0F 3E */ { 0, &Ia_Invalid },
+ /* 0F 3F */ { 0, &Ia_Invalid },
+ /* 0F 40 */ { 0, &Ia_cmovoq_Gq_Eq },
+ /* 0F 41 */ { 0, &Ia_cmovnoq_Gq_Eq },
+ /* 0F 42 */ { 0, &Ia_cmovcq_Gq_Eq },
+ /* 0F 43 */ { 0, &Ia_cmovncq_Gq_Eq },
+ /* 0F 44 */ { 0, &Ia_cmovzq_Gq_Eq },
+ /* 0F 45 */ { 0, &Ia_cmovnzq_Gq_Eq },
+ /* 0F 46 */ { 0, &Ia_cmovnaq_Gq_Eq },
+ /* 0F 47 */ { 0, &Ia_cmovaq_Gq_Eq },
+ /* 0F 48 */ { 0, &Ia_cmovsq_Gq_Eq },
+ /* 0F 49 */ { 0, &Ia_cmovnsq_Gq_Eq },
+ /* 0F 4A */ { 0, &Ia_cmovpq_Gq_Eq },
+ /* 0F 4B */ { 0, &Ia_cmovnpq_Gq_Eq },
+ /* 0F 4C */ { 0, &Ia_cmovlq_Gq_Eq },
+ /* 0F 4D */ { 0, &Ia_cmovnlq_Gq_Eq },
+ /* 0F 4E */ { 0, &Ia_cmovngq_Gq_Eq },
+ /* 0F 4F */ { 0, &Ia_cmovgq_Gq_Eq },
+ /* 0F 50 */ { GRPSSE(0f50) },
+ /* 0F 51 */ { GRPSSE(0f51) },
+ /* 0F 52 */ { GRPSSE(0f52) },
+ /* 0F 53 */ { GRPSSE(0f53) },
+ /* 0F 54 */ { GRPSSE(0f54) },
+ /* 0F 55 */ { GRPSSE(0f55) },
+ /* 0F 56 */ { GRPSSE(0f56) },
+ /* 0F 57 */ { GRPSSE(0f57) },
+ /* 0F 58 */ { GRPSSE(0f58) },
+ /* 0F 59 */ { GRPSSE(0f59) },
+ /* 0F 5A */ { GRPSSE(0f5a) },
+ /* 0F 5B */ { GRPSSE(0f5b) },
+ /* 0F 5C */ { GRPSSE(0f5c) },
+ /* 0F 5D */ { GRPSSE(0f5d) },
+ /* 0F 5E */ { GRPSSE(0f5e) },
+ /* 0F 5F */ { GRPSSE(0f5f) },
+ /* 0F 60 */ { GRPSSE(0f60) },
+ /* 0F 61 */ { GRPSSE(0f61) },
+ /* 0F 62 */ { GRPSSE(0f62) },
+ /* 0F 63 */ { GRPSSE(0f63) },
+ /* 0F 64 */ { GRPSSE(0f64) },
+ /* 0F 65 */ { GRPSSE(0f65) },
+ /* 0F 66 */ { GRPSSE(0f66) },
+ /* 0F 67 */ { GRPSSE(0f67) },
+ /* 0F 68 */ { GRPSSE(0f68) },
+ /* 0F 69 */ { GRPSSE(0f69) },
+ /* 0F 6A */ { GRPSSE(0f6a) },
+ /* 0F 6B */ { GRPSSE(0f6b) },
+ /* 0F 6C */ { GRPSSE(0f6c) },
+ /* 0F 6D */ { GRPSSE(0f6d) },
+ /* 0F 6E */ { GRPSSE(0f6eQ) },
+ /* 0F 6F */ { GRPSSE(0f6f) },
+ /* 0F 70 */ { GRPSSE(0f70) },
+ /* 0F 71 */ { GRPN(G12) },
+ /* 0F 72 */ { GRPN(G13) },
+ /* 0F 73 */ { GRPN(G14) },
+ /* 0F 74 */ { GRPSSE(0f74) },
+ /* 0F 75 */ { GRPSSE(0f75) },
+ /* 0F 76 */ { GRPSSE(0f76) },
+ /* 0F 77 */ { 0, &Ia_emms },
+ /* 0F 78 */ { 0, &Ia_Invalid },
+ /* 0F 79 */ { 0, &Ia_Invalid },
+ /* 0F 7A */ { 0, &Ia_Invalid },
+ /* 0F 7B */ { 0, &Ia_Invalid },
+ /* 0F 7C */ { GRPSSE(0f7c) },
+ /* 0F 7D */ { GRPSSE(0f7d) },
+ /* 0F 7E */ { GRPSSE(0f7eQ) },
+ /* 0F 7F */ { GRPSSE(0f7f) },
+ /* 0F 80 */ { 0, &Ia_jo_Jd },
+ /* 0F 81 */ { 0, &Ia_jno_Jd },
+ /* 0F 82 */ { 0, &Ia_jb_Jd },
+ /* 0F 83 */ { 0, &Ia_jnb_Jd },
+ /* 0F 84 */ { 0, &Ia_jz_Jd },
+ /* 0F 85 */ { 0, &Ia_jnz_Jd },
+ /* 0F 86 */ { 0, &Ia_jbe_Jd },
+ /* 0F 87 */ { 0, &Ia_jnbe_Jd },
+ /* 0F 88 */ { 0, &Ia_js_Jd },
+ /* 0F 89 */ { 0, &Ia_jns_Jd },
+ /* 0F 8A */ { 0, &Ia_jp_Jd },
+ /* 0F 8B */ { 0, &Ia_jnp_Jd },
+ /* 0F 8C */ { 0, &Ia_jl_Jd },
+ /* 0F 8D */ { 0, &Ia_jnl_Jd },
+ /* 0F 8E */ { 0, &Ia_jle_Jd },
+ /* 0F 8F */ { 0, &Ia_jnle_Jd },
+ /* 0F 90 */ { 0, &Ia_seto_Eb },
+ /* 0F 91 */ { 0, &Ia_setno_Eb },
+ /* 0F 92 */ { 0, &Ia_setb_Eb },
+ /* 0F 93 */ { 0, &Ia_setnb_Eb },
+ /* 0F 94 */ { 0, &Ia_setz_Eb },
+ /* 0F 95 */ { 0, &Ia_setnz_Eb },
+ /* 0F 96 */ { 0, &Ia_setbe_Eb },
+ /* 0F 97 */ { 0, &Ia_setnbe_Eb },
+ /* 0F 98 */ { 0, &Ia_sets_Eb },
+ /* 0F 99 */ { 0, &Ia_setns_Eb },
+ /* 0F 9A */ { 0, &Ia_setp_Eb },
+ /* 0F 9B */ { 0, &Ia_setnp_Eb },
+ /* 0F 9C */ { 0, &Ia_setl_Eb },
+ /* 0F 9D */ { 0, &Ia_setnl_Eb },
+ /* 0F 9E */ { 0, &Ia_setle_Eb },
+ /* 0F 9F */ { 0, &Ia_setnle_Eb },
+ /* 0F A0 */ { 0, &Ia_pushq_FS },
+ /* 0F A1 */ { 0, &Ia_popq_FS },
+ /* 0F A2 */ { 0, &Ia_cpuid },
+ /* 0F A3 */ { 0, &Ia_btq_Eq_Gq },
+ /* 0F A4 */ { 0, &Ia_shldq_Eq_Gq_Ib },
+ /* 0F A5 */ { 0, &Ia_shldq_Eq_Gq_CL },
+ /* 0F A6 */ { 0, &Ia_Invalid },
+ /* 0F A7 */ { 0, &Ia_Invalid },
+ /* 0F A8 */ { 0, &Ia_pushq_GS },
+ /* 0F A9 */ { 0, &Ia_popq_GS },
+ /* 0F AA */ { 0, &Ia_rsm },
+ /* 0F AB */ { 0, &Ia_btsq_Eq_Gq },
+ /* 0F AC */ { 0, &Ia_shrdq_Eq_Gq_Ib },
+ /* 0F AD */ { 0, &Ia_shrdq_Eq_Gq_CL },
+ /* 0F AE */ { GRPN(G15) },
+ /* 0F AF */ { 0, &Ia_imulq_Gq_Eq },
+ /* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
+ /* 0F B1 */ { 0, &Ia_cmpxchgq_Eq_Gq },
+ /* 0F B2 */ { 0, &Ia_lssq_Gq_Mp },
+ /* 0F B3 */ { 0, &Ia_btrq_Eq_Gq },
+ /* 0F B4 */ { 0, &Ia_lfsq_Gq_Mp },
+ /* 0F B5 */ { 0, &Ia_lgsq_Gq_Mp },
+ /* 0F B6 */ { 0, &Ia_movzbq_Gq_Eb },
+ /* 0F B7 */ { 0, &Ia_movzwq_Gq_Ew },
+ /* 0F B8 */ { 0, &Ia_Invalid },
+ /* 0F B9 */ { 0, &Ia_ud2b },
+ /* 0F BA */ { GRPN(G8EqIb) },
+ /* 0F BB */ { 0, &Ia_btcq_Eq_Gq },
+ /* 0F BC */ { 0, &Ia_bsfq_Gq_Eq },
+ /* 0F BD */ { 0, &Ia_bsrq_Gq_Eq },
+ /* 0F BE */ { 0, &Ia_movsbq_Gq_Eb },
+ /* 0F BF */ { 0, &Ia_movswq_Gq_Ew },
+ /* 0F C0 */ { 0, &Ia_xaddb_Eb_Gb },
+ /* 0F C0 */ { 0, &Ia_xaddq_Eq_Gq },
+ /* 0F C2 */ { GRPSSE(0fc2) },
+ /* 0F C3 */ { GRPSSE(640fc3) },
+ /* 0F C4 */ { GRPSSE(0fc4) },
+ /* 0F C5 */ { GRPSSE(0fc5) },
+ /* 0F C6 */ { GRPSSE(0fc6) },
+ /* 0F C7 */ { GRPN(G9q) },
+ /* 0F C8 */ { 0, &Ia_bswapq_RRX },
+ /* 0F C9 */ { 0, &Ia_bswapq_RRX },
+ /* 0F CA */ { 0, &Ia_bswapq_RRX },
+ /* 0F CB */ { 0, &Ia_bswapq_RRX },
+ /* 0F CC */ { 0, &Ia_bswapq_RRX },
+ /* 0F CD */ { 0, &Ia_bswapq_RRX },
+ /* 0F CE */ { 0, &Ia_bswapq_RRX },
+ /* 0F CF */ { 0, &Ia_bswapq_RRX },
+ /* 0F D0 */ { GRPSSE(0fd0) },
+ /* 0F D1 */ { GRPSSE(0fd1) },
+ /* 0F D2 */ { GRPSSE(0fd2) },
+ /* 0F D3 */ { GRPSSE(0fd3) },
+ /* 0F D4 */ { GRPSSE(0fd4) },
+ /* 0F D5 */ { GRPSSE(0fd5) },
+ /* 0F D6 */ { GRPSSE(0fd6) },
+ /* 0F D7 */ { GRPSSE(0fd7) },
+ /* 0F D8 */ { GRPSSE(0fd8) },
+ /* 0F D9 */ { GRPSSE(0fd9) },
+ /* 0F DA */ { GRPSSE(0fda) },
+ /* 0F DB */ { GRPSSE(0fdb) },
+ /* 0F DC */ { GRPSSE(0fdc) },
+ /* 0F DD */ { GRPSSE(0fdd) },
+ /* 0F DE */ { GRPSSE(0fde) },
+ /* 0F DF */ { GRPSSE(0fdf) },
+ /* 0F E0 */ { GRPSSE(0fe0) },
+ /* 0F E1 */ { GRPSSE(0fe1) },
+ /* 0F E2 */ { GRPSSE(0fe2) },
+ /* 0F E3 */ { GRPSSE(0fe3) },
+ /* 0F E4 */ { GRPSSE(0fe4) },
+ /* 0F E5 */ { GRPSSE(0fe5) },
+ /* 0F E6 */ { GRPSSE(0fe6) },
+ /* 0F E7 */ { GRPSSE(0fe7) },
+ /* 0F E8 */ { GRPSSE(0fe8) },
+ /* 0F E9 */ { GRPSSE(0fe9) },
+ /* 0F EA */ { GRPSSE(0fea) },
+ /* 0F EB */ { GRPSSE(0feb) },
+ /* 0F EC */ { GRPSSE(0fec) },
+ /* 0F ED */ { GRPSSE(0fed) },
+ /* 0F EE */ { GRPSSE(0fee) },
+ /* 0F EF */ { GRPSSE(0fef) },
+ /* 0F F0 */ { GRPSSE(0ff0) },
+ /* 0F F1 */ { GRPSSE(0ff1) },
+ /* 0F F2 */ { GRPSSE(0ff2) },
+ /* 0F F3 */ { GRPSSE(0ff3) },
+ /* 0F F4 */ { GRPSSE(0ff4) },
+ /* 0F F5 */ { GRPSSE(0ff5) },
+ /* 0F F6 */ { GRPSSE(0ff6) },
+ /* 0F F7 */ { GRPSSE(0ff7) },
+ /* 0F F8 */ { GRPSSE(0ff8) },
+ /* 0F F9 */ { GRPSSE(0ff9) },
+ /* 0F FA */ { GRPSSE(0ffa) },
+ /* 0F FB */ { GRPSSE(0ffb) },
+ /* 0F FC */ { GRPSSE(0ffc) },
+ /* 0F FD */ { GRPSSE(0ffd) },
+ /* 0F FE */ { GRPSSE(0ffe) },
+ /* 0F FF */ { 0, &Ia_Invalid }
+};
diff --git a/Externals/Bochs_disasm/disasm.h b/Externals/Bochs_disasm/disasm.h
new file mode 100644
index 0000000000..0bf21e8cfb
--- /dev/null
+++ b/Externals/Bochs_disasm/disasm.h
@@ -0,0 +1,508 @@
+#ifndef _BX_DISASM_H_
+#define _BX_DISASM_H_
+
+#include "config.h"
+
+#define BX_DECODE_MODRM(modrm_byte, mod, opcode, rm) { \
+ mod = (modrm_byte >> 6) & 0x03; \
+ opcode = (modrm_byte >> 3) & 0x07; \
+ rm = modrm_byte & 0x07; \
+}
+
+#define BX_DECODE_SIB(sib_byte, scale, index, base) { \
+ scale = sib_byte >> 6; \
+ index = (sib_byte >> 3) & 0x07; \
+ base = sib_byte & 0x07; \
+}
+
+// will be used in future
+#define IA_286 0x00000001 /* 286+ instruction */
+#define IA_386 0x00000002 /* 386+ instruction */
+#define IA_486 0x00000004 /* 486+ instruction */
+#define IA_PENTIUM 0x00000008 /* Pentium+ instruction */
+#define IA_P6 0x00000010 /* P6 new instruction */
+#define IA_SYSTEM 0x00000020 /* system instruction (require CPL=0) */
+#define IA_LEGACY 0x00000040 /* legacy instruction */
+#define IA_X87 0x00000080 /* FPU (X87) instruction */
+#define IA_MMX 0x00000100 /* MMX instruction */
+#define IA_3DNOW 0x00000200 /* 3DNow! instruction */
+#define IA_PREFETCH 0x00000400 /* Prefetch instruction */
+#define IA_SSE 0x00000800 /* SSE instruction */
+#define IA_SSE2 0x00001000 /* SSE2 instruction */
+#define IA_SSE3 0x00002000 /* SSE3 instruction */
+#define IA_SSE4 0x00004000 /* SSE4 instruction */
+#define IA_X86_64 0x00008000 /* x86-64 instruction */
+
+/* general purpose bit register */
+enum {
+ rAX_REG,
+ rCX_REG,
+ rDX_REG,
+ rBX_REG,
+ rSP_REG,
+ rBP_REG,
+ rSI_REG,
+ rDI_REG
+};
+
+/* segment register */
+enum {
+ ES_REG,
+ CS_REG,
+ SS_REG,
+ DS_REG,
+ FS_REG,
+ GS_REG,
+ INVALID_SEG1,
+ INVALID_SEG2
+};
+
+class disassembler;
+struct x86_insn;
+
+typedef void (disassembler::*BxDisasmPtr_t)(const x86_insn *insn);
+typedef void (disassembler::*BxDisasmResolveModrmPtr_t)(const x86_insn *insn, unsigned attr);
+
+struct BxDisasmOpcodeInfo_t
+{
+ const char *IntelOpcode;
+ const char *AttOpcode;
+ BxDisasmPtr_t Operand1;
+ BxDisasmPtr_t Operand2;
+ BxDisasmPtr_t Operand3;
+};
+
+struct BxDisasmOpcodeTable_t
+{
+ Bit32u Attr;
+ const void *OpcodeInfo;
+};
+
+// segment override not used
+#define NO_SEG_OVERRIDE 0xFF
+
+// datasize attributes
+#define X_SIZE 0x0000
+#define B_SIZE 0x0100
+#define W_SIZE 0x0200
+#define D_SIZE 0x0300
+#define Q_SIZE 0x0400
+#define Z_SIZE 0x0500
+#define V_SIZE 0x0600
+#define O_SIZE 0x0700
+#define T_SIZE 0x0800
+#define P_SIZE 0x0900
+
+// branch hint attribute
+#define BRANCH_HINT 0x1000
+
+struct x86_insn
+{
+public:
+ x86_insn(bx_bool is32, bx_bool is64);
+
+ bx_bool is_seg_override() const {
+ return (seg_override != NO_SEG_OVERRIDE);
+ }
+
+public:
+ bx_bool is_32, is_64;
+ bx_bool as_32, as_64;
+ bx_bool os_32, os_64;
+
+ Bit8u extend8b;
+ Bit8u rex_r, rex_x, rex_b;
+ Bit8u seg_override;
+ unsigned b1, prefixes;
+ unsigned ilen;
+
+ Bit8u modrm, mod, nnn, rm;
+ Bit8u sib, scale, index, base;
+ union {
+ Bit16u displ16;
+ Bit32u displ32;
+ } displacement;
+};
+
+BX_CPP_INLINE x86_insn::x86_insn(bx_bool is32, bx_bool is64)
+{
+ is_32 = is32;
+ is_64 = is64;
+
+ if (is_64) {
+ os_64 = 0;
+ as_64 = 1;
+ os_32 = 1;
+ as_32 = 1;
+ }
+ else {
+ os_64 = 0;
+ as_64 = 0;
+ os_32 = is_32;
+ as_32 = is_32;
+ }
+
+ extend8b = 0;
+ rex_r = rex_b = rex_x = 0;
+ seg_override = NO_SEG_OVERRIDE;
+ prefixes = 0;
+ ilen = 0;
+ b1 = 0;
+
+ modrm = mod = nnn = rm = 0;
+ sib = scale = index = base = 0;
+ displacement.displ32 = 0;
+}
+
+class disassembler {
+public:
+ disassembler() { set_syntax_intel(); }
+
+ unsigned disasm(bx_bool is_32, bx_bool is_64, bx_address base, bx_address ip, const Bit8u *instr, char *disbuf);
+
+ unsigned disasm16(bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+ { return disasm(0, 0, base, ip, instr, disbuf); }
+
+ unsigned disasm32(bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+ { return disasm(1, 0, base, ip, instr, disbuf); }
+
+ unsigned disasm64(bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+ { return disasm(1, 1, base, ip, instr, disbuf); }
+
+ x86_insn decode(bx_bool is_32, bx_bool is_64, bx_address base, bx_address ip, const Bit8u *instr, char *disbuf);
+
+ x86_insn decode16(bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+ { return decode(0, 0, base, ip, instr, disbuf); }
+
+ x86_insn decode32(bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+ { return decode(1, 0, base, ip, instr, disbuf); }
+
+ x86_insn decode64(bx_address base, bx_address ip, const Bit8u *instr, char *disbuf)
+ { return decode(1, 1, base, ip, instr, disbuf); }
+
+ void set_syntax_intel();
+ void set_syntax_att ();
+
+ void toggle_syntax_mode();
+
+private:
+ bx_bool intel_mode;
+
+ const char **general_16bit_regname;
+ const char **general_8bit_regname;
+ const char **general_32bit_regname;
+ const char **general_8bit_regname_rex;
+ const char **general_64bit_regname;
+
+ const char **segment_name;
+ const char **index16;
+
+ const char *sreg_mod01or10_rm32[8];
+ const char *sreg_mod00_base32[8];
+ const char *sreg_mod01or10_base32[8];
+ const char *sreg_mod00_rm16[8];
+ const char *sreg_mod01or10_rm16[8];
+
+private:
+
+ bx_address db_eip, db_base;
+
+ const Bit8u *instruction; // for fetching of next byte of instruction
+
+ char *disbufptr;
+
+ BxDisasmResolveModrmPtr_t resolve_modrm;
+
+ BX_CPP_INLINE Bit8u fetch_byte() {
+ db_eip++;
+ return(*instruction++);
+ };
+
+ BX_CPP_INLINE Bit8u peek_byte() {
+ return(*instruction);
+ };
+
+ BX_CPP_INLINE Bit16u fetch_word() {
+ Bit8u b0 = * (Bit8u *) instruction++;
+ Bit8u b1 = * (Bit8u *) instruction++;
+ Bit16u ret16 = (b1<<8) | b0;
+ db_eip += 2;
+ return(ret16);
+ };
+
+ BX_CPP_INLINE Bit32u fetch_dword() {
+ Bit8u b0 = * (Bit8u *) instruction++;
+ Bit8u b1 = * (Bit8u *) instruction++;
+ Bit8u b2 = * (Bit8u *) instruction++;
+ Bit8u b3 = * (Bit8u *) instruction++;
+ Bit32u ret32 = (b3<<24) | (b2<<16) | (b1<<8) | b0;
+ db_eip += 4;
+ return(ret32);
+ };
+
+ BX_CPP_INLINE Bit64u fetch_qword() {
+ Bit64u d0 = fetch_dword();
+ Bit64u d1 = fetch_dword();
+ Bit64u ret64 = (d1<<32) | d0;
+ return(ret64);
+ };
+
+ void dis_putc(char symbol);
+ void dis_sprintf(const char *fmt, ...);
+ void decode_modrm(x86_insn *insn);
+
+ void resolve16_mod0 (const x86_insn *insn, unsigned mode);
+ void resolve16_mod1or2(const x86_insn *insn, unsigned mode);
+
+ void resolve32_mod0 (const x86_insn *insn, unsigned mode);
+ void resolve32_mod1or2(const x86_insn *insn, unsigned mode);
+
+ void resolve32_mod0_rm4 (const x86_insn *insn, unsigned mode);
+ void resolve32_mod1or2_rm4(const x86_insn *insn, unsigned mode);
+
+ void resolve64_mod0 (const x86_insn *insn, unsigned mode);
+ void resolve64_mod1or2(const x86_insn *insn, unsigned mode);
+
+ void resolve64_mod0_rm4 (const x86_insn *insn, unsigned mode);
+ void resolve64_mod1or2_rm4(const x86_insn *insn, unsigned mode);
+
+ void initialize_modrm_segregs();
+
+ void print_datasize (unsigned mode);
+
+ void print_memory_access16(int datasize,
+ const char *seg, const char *index, Bit16u disp);
+ void print_memory_access (int datasize,
+ const char *seg, const char *base, const char *index, int scale, Bit32u disp);
+
+ void print_disassembly_intel(const x86_insn *insn, const BxDisasmOpcodeInfo_t *entry);
+ void print_disassembly_att (const x86_insn *insn, const BxDisasmOpcodeInfo_t *entry);
+
+public:
+
+/*
+ * Codes for Addressing Method:
+ * ---------------------------
+ * A - Direct address. The instruction has no ModR/M byte; the address
+ * of the operand is encoded in the instruction; and no base register,
+ * index register, or scaling factor can be applied.
+ * C - The reg field of the ModR/M byte selects a control register.
+ * D - The reg field of the ModR/M byte selects a debug register.
+ * E - A ModR/M byte follows the opcode and specifies the operand. The
+ * operand is either a general-purpose register or a memory address.
+ * If it is a memory address, the address is computed from a segment
+ * register and any of the following values: a base register, an
+ * index register, a scaling factor, a displacement.
+ * F - Flags Register.
+ * G - The reg field of the ModR/M byte selects a general register.
+ * I - Immediate data. The operand value is encoded in subsequent bytes of
+ * the instruction.
+ * J - The instruction contains a relative offset to be added to the
+ * instruction pointer register.
+ * M - The ModR/M byte may refer only to memory.
+ * N - The R/M field of the ModR/M byte selects a packed-quadword MMX
+ technology register.
+ * O - The instruction has no ModR/M byte; the offset of the operand is
+ * coded as a word or double word (depending on address size attribute)
+ * in the instruction. No base register, index register, or scaling
+ * factor can be applied.
+ * P - The reg field of the ModR/M byte selects a packed quadword MMX
+ * technology register.
+ * Q - A ModR/M byte follows the opcode and specifies the operand. The
+ * operand is either an MMX technology register or a memory address.
+ * If it is a memory address, the address is computed from a segment
+ * register and any of the following values: a base register, an
+ * index register, a scaling factor, and a displacement.
+ * R - The mod field of the ModR/M byte may refer only to a general register.
+ * S - The reg field of the ModR/M byte selects a segment register.
+ * U - The R/M field of the ModR/M byte selects a 128-bit XMM register.
+ * T - The reg field of the ModR/M byte selects a test register.
+ * V - The reg field of the ModR/M byte selects a 128-bit XMM register.
+ * W - A ModR/M byte follows the opcode and specifies the operand. The
+ * operand is either a 128-bit XMM register or a memory address. If
+ * it is a memory address, the address is computed from a segment
+ * register and any of the following values: a base register, an
+ * index register, a scaling factor, and a displacement.
+ * X - Memory addressed by the DS:rSI register pair.
+ * Y - Memory addressed by the ES:rDI register pair.
+ */
+
+/*
+ * Codes for Operand Type:
+ * ----------------------
+ * a - Two one-word operands in memory or two double-word operands in
+ * memory, depending on operand-size attribute (used only by the BOUND
+ * instruction).
+ * b - Byte, regardless of operand-size attribute.
+ * d - Doubleword, regardless of operand-size attribute.
+ * dq - Double-quadword, regardless of operand-size attribute.
+ * p - 32-bit or 48-bit pointer, depending on operand-size attribute.
+ * pd - 128-bit packed double-precision floating-point data.
+ * pi - Quadword MMX technology register (packed integer)
+ * ps - 128-bit packed single-precision floating-point data.
+ * q - Quadword, regardless of operand-size attribute.
+ * s - 6-byte or 10-byte pseudo-descriptor.
+ * si - Doubleword integer register (scalar integer)
+ * ss - Scalar element of a 128-bit packed single-precision floating data.
+ * sd - Scalar element of a 128-bit packed double-precision floating data.
+ * v - Word, doubleword or quadword, depending on operand-size attribute.
+ * w - Word, regardless of operand-size attr.
+ */
+
+ // far call/jmp
+ void Apw(const x86_insn *insn);
+ void Apd(const x86_insn *insn);
+
+ // 8-bit general purpose registers
+ void AL(const x86_insn *insn);
+ void CL(const x86_insn *insn);
+
+ // 16-bit general purpose registers
+ void AX(const x86_insn *insn);
+ void DX(const x86_insn *insn);
+
+ // 32-bit general purpose registers
+ void EAX(const x86_insn *insn);
+
+ // 64-bit general purpose registers
+ void RAX(const x86_insn *insn);
+
+ // segment registers
+ void CS(const x86_insn *insn);
+ void DS(const x86_insn *insn);
+ void ES(const x86_insn *insn);
+ void SS(const x86_insn *insn);
+ void FS(const x86_insn *insn);
+ void GS(const x86_insn *insn);
+
+ // segment registers
+ void Sw(const x86_insn *insn);
+
+ // test registers
+ void Td(const x86_insn *insn);
+
+ // control register
+ void Cd(const x86_insn *insn);
+ void Cq(const x86_insn *insn);
+
+ // debug register
+ void Dd(const x86_insn *insn);
+ void Dq(const x86_insn *insn);
+
+ // 8-bit general purpose register
+ void R8(const x86_insn *insn);
+
+ // 16-bit general purpose register
+ void RX(const x86_insn *insn);
+
+ // 32-bit general purpose register
+ void ERX(const x86_insn *insn);
+
+ // 64-bit general purpose register
+ void RRX(const x86_insn *insn);
+
+ // general purpose register or memory operand
+ void Eb(const x86_insn *insn);
+ void Ew(const x86_insn *insn);
+ void Ed(const x86_insn *insn);
+ void Eq(const x86_insn *insn);
+
+ // general purpose register
+ void Gb(const x86_insn *insn);
+ void Gw(const x86_insn *insn);
+ void Gd(const x86_insn *insn);
+ void Gq(const x86_insn *insn);
+
+ // immediate
+ void I1(const x86_insn *insn);
+ void Ib(const x86_insn *insn);
+ void Iw(const x86_insn *insn);
+ void Id(const x86_insn *insn);
+ void Iq(const x86_insn *insn);
+
+ // two immediates Iw/Ib
+ void IwIb(const x86_insn *insn);
+
+ // sign extended immediate
+ void sIbw(const x86_insn *insn);
+ void sIbd(const x86_insn *insn);
+ void sIbq(const x86_insn *insn);
+ void sIdq(const x86_insn *insn);
+
+ // floating point
+ void ST0(const x86_insn *insn);
+ void STi(const x86_insn *insn);
+
+ // general purpose register
+ void Rw(const x86_insn *insn);
+ void Rd(const x86_insn *insn);
+ void Rq(const x86_insn *insn);
+
+ // mmx register
+ void Pq(const x86_insn *insn);
+
+ // mmx register or memory operand
+ void Qd(const x86_insn *insn);
+ void Qq(const x86_insn *insn);
+ void Vq(const x86_insn *insn);
+ void Nq(const x86_insn *insn);
+
+ // xmm register
+ void Udq(const x86_insn *insn);
+ void Vdq(const x86_insn *insn);
+ void Vss(const x86_insn *insn);
+ void Vsd(const x86_insn *insn);
+ void Vps(const x86_insn *insn);
+ void Vpd(const x86_insn *insn);
+
+ // xmm register or memory operand
+ void Wq(const x86_insn *insn);
+ void Wdq(const x86_insn *insn);
+ void Wss(const x86_insn *insn);
+ void Wsd(const x86_insn *insn);
+ void Wps(const x86_insn *insn);
+ void Wpd(const x86_insn *insn);
+
+ // direct memory access
+ void OP_O(const x86_insn *insn, unsigned size);
+ void Ob(const x86_insn *insn);
+ void Ow(const x86_insn *insn);
+ void Od(const x86_insn *insn);
+ void Oq(const x86_insn *insn);
+
+ // memory operand
+ void OP_M(const x86_insn *insn, unsigned size);
+ void Ma(const x86_insn *insn);
+ void Mp(const x86_insn *insn);
+ void Ms(const x86_insn *insn);
+ void Mx(const x86_insn *insn);
+ void Mb(const x86_insn *insn);
+ void Mw(const x86_insn *insn);
+ void Md(const x86_insn *insn);
+ void Mq(const x86_insn *insn);
+ void Mt(const x86_insn *insn);
+ void Mdq(const x86_insn *insn);
+ void Mps(const x86_insn *insn);
+ void Mpd(const x86_insn *insn);
+
+ // string instructions
+ void OP_X(const x86_insn *insn, unsigned size);
+ void Xb(const x86_insn *insn);
+ void Xw(const x86_insn *insn);
+ void Xd(const x86_insn *insn);
+ void Xq(const x86_insn *insn);
+
+ // string instructions
+ void OP_Y(const x86_insn *insn, unsigned size);
+ void Yb(const x86_insn *insn);
+ void Yw(const x86_insn *insn);
+ void Yd(const x86_insn *insn);
+ void Yq(const x86_insn *insn);
+
+ // jump offset
+ void Jb(const x86_insn *insn);
+ void Jw(const x86_insn *insn);
+ void Jd(const x86_insn *insn);
+};
+
+#endif
diff --git a/Externals/Bochs_disasm/opcodes.inl b/Externals/Bochs_disasm/opcodes.inl
new file mode 100644
index 0000000000..a06968361f
--- /dev/null
+++ b/Externals/Bochs_disasm/opcodes.inl
@@ -0,0 +1,1230 @@
+Ia_aaa = { "aaa", "aaa", XX, XX, XX },
+Ia_aad = { "aad", "aad", Ib, XX, XX },
+Ia_aam = { "aam", "aam", Ib, XX, XX },
+Ia_aas = { "aas", "aas", XX, XX, XX },
+Ia_adcb_AL_Ib = { "adc", "adcb", AL, Ib, XX },
+Ia_adcb_Eb_Gb = { "adc", "adcb", Eb, Gb, XX },
+Ia_adcb_Eb_Ib = { "adc", "adcb", Eb, Ib, XX },
+Ia_adcb_Gb_Eb = { "adc", "adcb", Gb, Eb, XX },
+Ia_adcl_EAX_Id = { "adc", "adcl", EAX, Id, XX },
+Ia_adcl_Ed_Gd = { "adc", "adcl", Ed, Gd, XX },
+Ia_adcl_Ed_Id = { "adc", "adcl", Ed, Id, XX },
+Ia_adcl_Ed_sIb = { "adc", "adcl", Ed, sIbd, XX },
+Ia_adcl_Gd_Ed = { "adc", "adcl", Gd, Ed, XX },
+Ia_adcq_Eq_Gq = { "adc", "adcq", Eq, Gq, XX },
+Ia_adcq_Eq_sIb = { "adc", "adcq", Eq, sIbq, XX },
+Ia_adcq_Eq_sId = { "adc", "adcq", Eq, Iq, XX },
+Ia_adcq_Gq_Eq = { "adc", "adcq", Gq, Eq, XX },
+Ia_adcq_RAX_sId = { "adc", "adcq", RAX, sIdq, XX },
+Ia_adcw_AX_Iw = { "adc", "adcw", AX, Iw, XX },
+Ia_adcw_Ew_Gw = { "adc", "adcw", Ew, Gw, XX },
+Ia_adcw_Ew_Iw = { "adc", "adcw", Ew, Iw, XX },
+Ia_adcw_Ew_sIb = { "adc", "adcw", Ew, sIbw, XX },
+Ia_adcw_Gw_Ew = { "adc", "adcw", Gw, Ew, XX },
+Ia_addb_AL_Ib = { "add", "addb", AL, Ib, XX },
+Ia_addb_Eb_Gb = { "add", "addb", Eb, Gb, XX },
+Ia_addb_Eb_Ib = { "add", "addb", Eb, Ib, XX },
+Ia_addb_Gb_Eb = { "add", "addb", Gb, Eb, XX },
+Ia_addl_EAX_Id = { "add", "addl", EAX, Id, XX },
+Ia_addl_Ed_Gd = { "add", "addl", Ed, Gd, XX },
+Ia_addl_Ed_Id = { "add", "addl", Ed, Id, XX },
+Ia_addl_Ed_sIb = { "add", "addl", Ed, sIbd, XX },
+Ia_addl_Gd_Ed = { "add", "addl", Gd, Ed, XX },
+Ia_addpd_Vpd_Wpd = { "addpd", "addpd", Vpd, Wpd, XX },
+Ia_addps_Vps_Wps = { "addps", "addps", Vps, Wps, XX },
+Ia_addq_Eq_Gq = { "add", "addq", Eq, Gq, XX },
+Ia_addq_Eq_sIb = { "add", "addq", Eq, sIbq, XX },
+Ia_addq_Eq_sId = { "add", "addq", Eq, sIdq, XX },
+Ia_addq_Gq_Eq = { "add", "addq", Gq, Eq, XX },
+Ia_addq_RAX_sId = { "add", "addq", RAX, sIdq, XX },
+Ia_addsd_Vsd_Wsd = { "addsd", "addsd", Vsd, Wsd, XX },
+Ia_addss_Vss_Wss = { "addss", "addss", Vss, Wss, XX },
+Ia_addsubpd_Vpd_Wpd = { "addsubpd", "addsubpd", Vpd, Wpd, XX },
+Ia_addsubps_Vps_Wps = { "addsubps", "addsubps", Vps, Wps, XX },
+Ia_addw_AX_Iw = { "add", "addw", AX, Iw, XX },
+Ia_addw_Ew_Gw = { "add", "addw", Ew, Gw, XX },
+Ia_addw_Ew_Iw = { "add", "addw", Ew, Iw, XX },
+Ia_addw_Ew_sIb = { "add", "addw", Ew, sIbw, XX },
+Ia_addw_Gw_Ew = { "add", "addw", Gw, Ew, XX },
+Ia_andb_AL_Ib = { "and", "andb", AL, Ib, XX },
+Ia_andb_Eb_Gb = { "and", "andb", Eb, Gb, XX },
+Ia_andb_Eb_Ib = { "and", "andb", Eb, Ib, XX },
+Ia_andb_Gb_Eb = { "and", "andb", Gb, Eb, XX },
+Ia_andl_EAX_Id = { "and", "andl", EAX, Id, XX },
+Ia_andl_Ed_Gd = { "and", "andl", Ed, Gd, XX },
+Ia_andl_Ed_Id = { "and", "andl", Ed, Id, XX },
+Ia_andl_Ed_sIb = { "and", "andl", Ed, sIbd, XX },
+Ia_andl_Gd_Ed = { "and", "andl", Gd, Ed, XX },
+Ia_andnpd_Vpd_Wpd = { "andnpd", "andnpd", Vpd, Wpd, XX },
+Ia_andnps_Vps_Wps = { "andnps", "andnps", Vps, Wps, XX },
+Ia_andpd_Vpd_Wpd = { "andpd", "andpd", Vpd, Wpd, XX },
+Ia_andps_Vps_Wps = { "andps", "andps", Vps, Wps, XX },
+Ia_andq_Eq_Gq = { "and", "andq", Eq, Gq, XX },
+Ia_andq_Eq_sIb = { "and", "andq", Eq, sIbq, XX },
+Ia_andq_Eq_sId = { "and", "andq", Eq, sIdq, XX },
+Ia_andq_Gq_Eq = { "and", "andq", Gq, Eq, XX },
+Ia_andq_RAX_sId = { "and", "andq", RAX, sIdq, XX },
+Ia_andw_AX_Iw = { "and", "andw", AX, Iw, XX },
+Ia_andw_Ew_Gw = { "and", "andw", Ew, Gw, XX },
+Ia_andw_Ew_Iw = { "and", "andw", Ew, Iw, XX },
+Ia_andw_Ew_sIb = { "and", "andw", Ew, sIbw, XX },
+Ia_andw_Gw_Ew = { "and", "andw", Gw, Ew, XX },
+Ia_arpl_Ew_Rw = { "arpl", "arpl", Ew, Rw, XX },
+Ia_boundl_Gd_Ma = { "bound", "boundl", Gd, Ma, XX },
+Ia_boundw_Gw_Ma = { "bound", "boundw", Gw, Ma, XX },
+Ia_bsfl_Gd_Ed = { "bsf", "bsfl", Gd, Ed, XX },
+Ia_bsfq_Gq_Eq = { "bsf", "bsfq", Gq, Eq, XX },
+Ia_bsfw_Gw_Ew = { "bsf", "bsfw", Gw, Ew, XX },
+Ia_bsrl_Gd_Ed = { "bsr", "bsrl", Gd, Ed, XX },
+Ia_bsrq_Gq_Eq = { "bsr", "bsrq", Gq, Eq, XX },
+Ia_bsrw_Gw_Ew = { "bsr", "bsrw", Gw, Ew, XX },
+Ia_bswapl_ERX = { "bswap", "bswapl", ERX, XX, XX },
+Ia_bswapq_RRX = { "bswap", "bswapq", RRX, XX, XX },
+Ia_btcl_Ed_Gd = { "btc", "btcl", Ed, Gd, XX },
+Ia_btcl_Ed_Ib = { "btc", "btcl", Ed, Ib, XX },
+Ia_btcq_Eq_Gq = { "btc", "btcq", Eq, Gq, XX },
+Ia_btcq_Eq_Ib = { "btc", "btcq", Eq, Ib, XX },
+Ia_btcw_Ew_Gw = { "btc", "btcw", Ew, Gw, XX },
+Ia_btcw_Ew_Ib = { "btc", "btcw", Ew, Ib, XX },
+Ia_btl_Ed_Gd = { "bt", "btl", Ed, Gd, XX },
+Ia_btl_Ed_Ib = { "bt", "btl", Ed, Ib, XX },
+Ia_btq_Eq_Gq = { "bt", "btq", Eq, Gq, XX },
+Ia_btq_Eq_Ib = { "bt", "btq", Eq, Ib, XX },
+Ia_btrl_Ed_Gd = { "btr", "btrl", Ed, Gd, XX },
+Ia_btrl_Ed_Ib = { "btr", "btrl", Ed, Ib, XX },
+Ia_btrq_Eq_Gq = { "btr", "btrq", Eq, Gq, XX },
+Ia_btrq_Eq_Ib = { "btr", "btrq", Eq, Ib, XX },
+Ia_btrw_Ew_Gw = { "btr", "btrw", Ew, Gw, XX },
+Ia_btrw_Ew_Ib = { "btr", "btrw", Ew, Ib, XX },
+Ia_btsl_Ed_Gd = { "bts", "btsl", Ed, Gd, XX },
+Ia_btsl_Ed_Ib = { "bts", "btsl", Ed, Ib, XX },
+Ia_btsq_Eq_Gq = { "bts", "btsq", Eq, Gq, XX },
+Ia_btsq_Eq_Ib = { "bts", "btsq", Eq, Ib, XX },
+Ia_btsw_Ew_Gw = { "bts", "btsw", Ew, Gw, XX },
+Ia_btsw_Ew_Ib = { "bts", "btsw", Ew, Ib, XX },
+Ia_btw_Ew_Gw = { "bt", "btw", Ew, Gw, XX },
+Ia_btw_Ew_Ib = { "bt", "btw", Ew, Ib, XX },
+Ia_call_Ed = { "call", "call", Ed, XX, XX },
+Ia_call_Eq = { "call", "call", Eq, XX, XX },
+Ia_call_Ew = { "call", "call", Ew, XX, XX },
+Ia_call_Jd = { "call", "call", Jd, XX, XX },
+Ia_call_Jw = { "call", "call", Jw, XX, XX },
+Ia_cbw = { "cbw", "cbtw", XX, XX, XX },
+Ia_cdq = { "cdq", "cltd", XX, XX, XX },
+Ia_cdqe = { "cdqe", "cltq", XX, XX, XX },
+Ia_cflush = { "cflush", "cflush", Mb, XX, XX },
+Ia_clc = { "clc", "clc", XX, XX, XX },
+Ia_cld = { "cld", "cld", XX, XX, XX },
+Ia_cli = { "cli", "cli", XX, XX, XX },
+Ia_clts = { "clts", "clts", XX, XX, XX },
+Ia_cmc = { "cmc", "cmc", XX, XX, XX },
+Ia_cmoval_Gd_Ed = { "cmova", "cmoval", Gd, Ed, XX },
+Ia_cmovaq_Gq_Eq = { "cmova", "cmovaq", Gq, Eq, XX },
+Ia_cmovaw_Gw_Ew = { "cmova", "cmovaw", Gw, Ew, XX },
+Ia_cmovcl_Gd_Ed = { "cmovc", "cmovcl", Gd, Ed, XX },
+Ia_cmovcq_Gq_Eq = { "cmovc", "cmovcq", Gq, Eq, XX },
+Ia_cmovcw_Gw_Ew = { "cmovc", "cmovcw", Gw, Ew, XX },
+Ia_cmovgl_Gd_Ed = { "cmovg", "cmovgl", Gd, Ed, XX },
+Ia_cmovgq_Gq_Eq = { "cmovg", "cmovgq", Gq, Eq, XX },
+Ia_cmovgw_Gw_Ew = { "cmovg", "cmovgw", Gw, Ew, XX },
+Ia_cmovll_Gd_Ed = { "cmovl", "cmovll", Gd, Ed, XX },
+Ia_cmovlq_Gq_Eq = { "cmovl", "cmovlq", Gq, Eq, XX },
+Ia_cmovlw_Gw_Ew = { "cmovl", "cmovlw", Gw, Ew, XX },
+Ia_cmovnal_Gd_Ed = { "cmovna", "cmovnal", Gd, Ed, XX },
+Ia_cmovnaq_Gq_Eq = { "cmovna", "cmovnaq", Gq, Eq, XX },
+Ia_cmovnaw_Gw_Ew = { "cmovna", "cmovnaw", Gw, Ew, XX },
+Ia_cmovncl_Gd_Ed = { "cmovnc", "cmovncl", Gd, Ed, XX },
+Ia_cmovncq_Gq_Eq = { "cmovnc", "cmovncq", Gq, Eq, XX },
+Ia_cmovncw_Gw_Ew = { "cmovnc", "cmovncw", Gw, Ew, XX },
+Ia_cmovngl_Gd_Ed = { "cmovng", "cmovngl", Gd, Ed, XX },
+Ia_cmovngq_Gq_Eq = { "cmovng", "cmovngq", Gq, Eq, XX },
+Ia_cmovngw_Gw_Ew = { "cmovng", "cmovngw", Gw, Ew, XX },
+Ia_cmovnll_Gd_Ed = { "cmovnl", "cmovnll", Gd, Ed, XX },
+Ia_cmovnlq_Gq_Eq = { "cmovnl", "cmovnlq", Gq, Eq, XX },
+Ia_cmovnlw_Gw_Ew = { "cmovnl", "cmovnlw", Gw, Ew, XX },
+Ia_cmovnol_Gd_Ed = { "cmovno", "cmovnol", Gd, Ed, XX },
+Ia_cmovnoq_Gq_Eq = { "cmovno", "cmovnoq", Gq, Eq, XX },
+Ia_cmovnow_Gw_Ew = { "cmovno", "cmovnow", Gw, Ew, XX },
+Ia_cmovnpl_Gd_Ed = { "cmovnp", "cmovnpl", Gd, Ed, XX },
+Ia_cmovnpq_Gq_Eq = { "cmovnp", "cmovnpq", Gq, Eq, XX },
+Ia_cmovnpw_Gw_Ew = { "cmovnp", "cmovnpw", Gw, Ew, XX },
+Ia_cmovnsl_Gd_Ed = { "cmovns", "cmovnsl", Gd, Ed, XX },
+Ia_cmovnsq_Gq_Eq = { "cmovns", "cmovnsq", Gq, Eq, XX },
+Ia_cmovnsw_Gw_Ew = { "cmovns", "cmovnsw", Gw, Ew, XX },
+Ia_cmovnzl_Gd_Ed = { "cmovnz", "cmovnzl", Gd, Ed, XX },
+Ia_cmovnzq_Gq_Eq = { "cmovnz", "cmovnzq", Gq, Eq, XX },
+Ia_cmovnzw_Gw_Ew = { "cmovnz", "cmovnzw", Gw, Ew, XX },
+Ia_cmovol_Gd_Ed = { "cmovo", "cmovol", Gd, Ed, XX },
+Ia_cmovoq_Gq_Eq = { "cmovo", "cmovoq", Gq, Eq, XX },
+Ia_cmovow_Gw_Ew = { "cmovo", "cmovow", Gw, Ew, XX },
+Ia_cmovpl_Gd_Ed = { "cmovp", "cmovpl", Gd, Ed, XX },
+Ia_cmovpq_Gq_Eq = { "cmovp", "cmovpq", Gq, Eq, XX },
+Ia_cmovpw_Gw_Ew = { "cmovp", "cmovpw", Gw, Ew, XX },
+Ia_cmovsl_Gd_Ed = { "cmovs", "cmovsl", Gd, Ed, XX },
+Ia_cmovsq_Gq_Eq = { "cmovs", "cmovsq", Gq, Eq, XX },
+Ia_cmovsw_Gw_Ew = { "cmovs", "cmovsw", Gw, Ew, XX },
+Ia_cmovzl_Gd_Ed = { "cmovz", "cmovzl", Gd, Ed, XX },
+Ia_cmovzq_Gq_Eq = { "cmovz", "cmovzq", Gq, Eq, XX },
+Ia_cmovzw_Gw_Ew = { "cmovz", "cmovzw", Gw, Ew, XX },
+Ia_cmpb_AL_Ib = { "cmp", "cmpb", AL, Ib, XX },
+Ia_cmpb_Eb_Gb = { "cmp", "cmpb", Eb, Gb, XX },
+Ia_cmpb_Eb_Ib = { "cmp", "cmpb", Eb, Ib, XX },
+Ia_cmpb_Gb_Eb = { "cmp", "cmpb", Gb, Eb, XX },
+Ia_cmpl_EAX_Id = { "cmp", "cmpl", EAX, Id, XX },
+Ia_cmpl_Ed_Gd = { "cmp", "cmpl", Ed, Gd, XX },
+Ia_cmpl_Ed_Id = { "cmp", "cmpl", Ed, Id, XX },
+Ia_cmpl_Ed_sIb = { "cmp", "cmpl", Ed, sIbd, XX },
+Ia_cmpl_Gd_Ed = { "cmp", "cmpl", Gd, Ed, XX },
+Ia_cmppd_Vpd_Wpd_Ib = { "cmppd", "cmppd", Vpd, Wpd, Ib },
+Ia_cmpps_Vps_Wps_Ib = { "cmpps", "cmpps", Vps, Wps, Ib },
+Ia_cmpq_Eq_Gq = { "cmp", "cmpq", Eq, Gq, XX },
+Ia_cmpq_Eq_sIb = { "cmp", "cmpq", Eq, sIbq, XX },
+Ia_cmpq_Eq_sId = { "cmp", "cmpq", Eq, sIdq, XX },
+Ia_cmpq_Gq_Eq = { "cmp", "cmpq", Gq, Eq, XX },
+Ia_cmpq_RAX_sId = { "cmp", "cmpq", RAX, sIdq, XX },
+Ia_cmpsb_Yb_Xb = { "cmpsb", "cmpsb", Yb, Xb, XX },
+Ia_cmpsd_Vsd_Wsd_Ib = { "cmpsd", "cmpsd", Vsd, Wsd, Ib },
+Ia_cmpsl_Yd_Xd = { "cmpsd", "cmpsl", Yd, Xd, XX },
+Ia_cmpsq_Yq_Xq = { "cmpsq", "cmpsq", Yq, Xq, XX },
+Ia_cmpss_Vss_Wss_Ib = { "cmpss", "cmpss", Vss, Wss, Ib },
+Ia_cmpsw_Yw_Xw = { "cmpsw", "cmpsw", Yw, Xw, XX },
+Ia_cmpw_AX_Iw = { "cmp", "cmpw", AX, Iw, XX },
+Ia_cmpw_Ew_Gw = { "cmp", "cmpw", Ew, Gw, XX },
+Ia_cmpw_Ew_Iw = { "cmp", "cmpw", Ew, Iw, XX },
+Ia_cmpw_Ew_sIb = { "cmp", "cmpw", Ew, sIbw, XX },
+Ia_cmpw_Gw_Ew = { "cmp", "cmpw", Gw, Ew, XX },
+Ia_cmpxchg16b = { "cmpxchg16b", "cmpxchg16b", Mdq, XX, XX },
+Ia_cmpxchg8b = { "cmpxchg8b", "cmpxchg8b", Mq, XX, XX },
+Ia_cmpxchgb_Eb_Gb = { "cmpxchg", "cmpxchgb", Eb, Gb, XX },
+Ia_cmpxchgl_Ed_Gd = { "cmpxchg", "cmpxchgl", Ed, Gd, XX },
+Ia_cmpxchgq_Eq_Gq = { "cmpxchg", "cmpxchgq", Eq, Gq, XX },
+Ia_cmpxchgw_Ew_Gw = { "cmpxchg", "cmpxchgw", Ew, Gw, XX },
+Ia_comisd_Vsd_Wsd = { "comisd", "comisd", Vsd, Wsd, XX },
+Ia_comiss_Vss_Wss = { "comiss", "comiss", Vss, Wss, XX },
+Ia_cpuid = { "cpuid", "cpuid", XX, XX, XX },
+Ia_cqo = { "cqo", "cqto", XX, XX, XX },
+Ia_cvtdq2pd_Vpd_Wq = { "cvtdq2pd", "cvtdq2pd", Vpd, Wq, XX },
+Ia_cvtdq2ps_Vps_Wdq = { "cvtdq2ps", "cvtdq2ps", Vps, Wdq, XX },
+Ia_cvtpd2dq_Vq_Wpd = { "cvtpd2dq", "cvtpd2dq", Vq, Wpd, XX },
+Ia_cvtpd2pi_Pq_Wpd = { "cvtpd2pi", "cvtpd2pi", Pq, Wpd, XX },
+Ia_cvtpd2ps_Vps_Wpd = { "cvtpd2ps", "cvtpd2ps", Vps, Wpd, XX },
+Ia_cvtpi2pd_Vpd_Qq = { "cvtpi2pd", "cvtpi2pd", Vpd, Qq, XX },
+Ia_cvtpi2ps_Vps_Qq = { "cvtpi2ps", "cvtpi2ps", Vps, Qq, XX },
+Ia_cvtps2dq_Vdq_Wps = { "cvtps2dq", "cvtps2dq", Vdq, Wps, XX },
+Ia_cvtps2pd_Vpd_Wps = { "cvtps2pd", "cvtps2pd", Vpd, Wps, XX },
+Ia_cvtps2pi_Pq_Wps = { "cvtps2pi", "cvtps2pi", Pq, Wps, XX },
+Ia_cvtsd2si_Gd_Wsd = { "cvtsd2si", "cvtsd2si", Gd, Wsd, XX },
+Ia_cvtsd2si_Gq_Wsd = { "cvtsd2si", "cvtsd2si", Gq, Wsd, XX },
+Ia_cvtsd2ss_Vss_Wsd = { "cvtsd2ss", "cvtsd2ss", Vss, Wsd, XX },
+Ia_cvtsi2sd_Vsd_Ed = { "cvtsi2sd", "cvtsi2sd", Vsd, Ed, XX },
+Ia_cvtsi2sd_Vsd_Eq = { "cvtsi2sd", "cvtsi2sd", Vsd, Eq, XX },
+Ia_cvtsi2ss_Vss_Ed = { "cvtsi2ss", "cvtsi2ss", Vss, Ed, XX },
+Ia_cvtsi2ss_Vss_Eq = { "cvtsi2ss", "cvtsi2ss", Vss, Eq, XX },
+Ia_cvtss2sd_Vsd_Wss = { "cvtss2sd", "cvtss2sd", Vsd, Wss, XX },
+Ia_cvtss2si_Gd_Wss = { "cvtss2si", "cvtss2si", Gd, Wss, XX },
+Ia_cvtss2si_Gq_Wss = { "cvtss2si", "cvtss2si", Gq, Wss, XX },
+Ia_cvttpd2dq_Vq_Wpd = { "cvttpd2dq", "cvttpd2dq", Vq, Wpd, XX },
+Ia_cvttpd2pi_Pq_Wpd = { "cvttpd2pi", "cvttpd2pi", Pq, Wpd, XX },
+Ia_cvttps2dq_Vdq_Wps = { "cvttps2dq", "cvttps2dq", Vdq, Wps, XX },
+Ia_cvttps2pi_Pq_Wps = { "cvttps2pi", "cvttps2pi", Pq, Wps, XX },
+Ia_cvttsd2si_Gd_Wsd = { "cvttsd2si", "cvttsd2si", Gd, Wsd, XX },
+Ia_cvttsd2si_Gq_Wsd = { "cvttsd2si", "cvttsd2si", Gq, Wsd, XX },
+Ia_cvttss2si_Gd_Wss = { "cvttss2si", "cvttss2si", Gd, Wss, XX },
+Ia_cvttss2si_Gq_Wss = { "cvttss2si", "cvttss2si", Gq, Wss, XX },
+Ia_cwd = { "cwd", "cwtd", XX, XX, XX },
+Ia_cwde = { "cwde", "cwtl", XX, XX, XX },
+Ia_daa = { "daa", "daa", XX, XX, XX },
+Ia_das = { "das", "das", XX, XX, XX },
+Ia_decb_Eb = { "dec", "decb", Eb, XX, XX },
+Ia_decl_Ed = { "dec", "decl", Ed, XX, XX },
+Ia_decl_ERX = { "dec", "decl", ERX, XX, XX },
+Ia_decq_Eq = { "dec", "decq", Eq, XX, XX },
+Ia_decw_Ew = { "dec", "decw", Ew, XX, XX },
+Ia_decw_RX = { "dec", "decw", RX, XX, XX },
+Ia_divb_AL_Eb = { "div", "divb", AL, Eb, XX },
+Ia_divl_EAX_Ed = { "div", "divl", EAX, Ed, XX },
+Ia_divpd_Vpd_Wpd = { "divpd", "divpd", Vpd, Wpd, XX },
+Ia_divps_Vps_Wps = { "divps", "divps", Vps, Wps, XX },
+Ia_divq_RAX_Eq = { "div", "divq", RAX, Eq, XX },
+Ia_divsd_Vsd_Wsd = { "divsd", "divsd", Vsd, Wsd, XX },
+Ia_divss_Vss_Wss = { "divss", "divss", Vss, Wss, XX },
+Ia_divw_AX_Ew = { "div", "divw", AX, Ew, XX },
+Ia_emms = { "emms", "emms", XX, XX, XX },
+Ia_enter = { "enter", "enter", IwIb, XX, XX },
+Ia_error = { "(error)", "(error)", XX, XX, XX },
+Ia_f2xm1 = { "f2xm1", "f2xm1", XX, XX, XX },
+Ia_fabs = { "fabs", "fabs", XX, XX, XX },
+Ia_fadd_ST0_STi = { "fadd", "fadd", ST0, STi, XX },
+Ia_fadd_STi_ST0 = { "fadd", "fadd", STi, ST0, XX },
+Ia_faddl_Mq = { "fadd", "faddl", Mq, XX, XX },
+Ia_faddp_STi_ST0 = { "faddp", "faddp", STi, ST0, XX },
+Ia_fadds_Md = { "fadd", "fadds", Md, XX, XX },
+Ia_fbldt_Mt = { "fbld", "fbldt", Mt, XX, XX },
+Ia_fbstpt_Mt = { "fbstp", "fbstpt", Mt, XX, XX },
+Ia_fchs = { "fchs", "fchs", XX, XX, XX },
+Ia_fcmovb_ST0_STi = { "fcmovb", "fcmovb", ST0, STi, XX },
+Ia_fcmovbe_ST0_STi = { "fcmovbe", "fcmovbe", ST0, STi, XX },
+Ia_fcmove_ST0_STi = { "fcmove", "fcmove", ST0, STi, XX },
+Ia_fcmovnb_ST0_STi = { "fcmovnb", "fcmovnb", ST0, STi, XX },
+Ia_fcmovnbe_ST0_STi = { "fcmovnbe", "fcmovnbe", ST0, STi, XX },
+Ia_fcmovne_ST0_STi = { "fcmovne", "fcmovne", ST0, STi, XX },
+Ia_fcmovnu_ST0_STi = { "fcmovnu", "fcmovnu", ST0, STi, XX },
+Ia_fcmovu_ST0_STi = { "fcmovu", "fcmovu", ST0, STi, XX },
+Ia_fcom_STi = { "fcom", "fcom", STi, XX, XX },
+Ia_fcomi_ST0_STi = { "fcomi", "fcomi", ST0, STi, XX },
+Ia_fcomip_ST0_STi = { "fcomip", "fcomip", ST0, STi, XX },
+Ia_fcoml_Mq = { "fcom", "fcoml", Mq, XX, XX },
+Ia_fcomp_STi = { "fcomp", "fcomp", STi, XX, XX },
+Ia_fcompl_Mq = { "fcomp", "fcompl", Mq, XX, XX },
+Ia_fcompp = { "fcompp", "fcompp", XX, XX, XX },
+Ia_fcomps_Md = { "fcomp", "fcomps", Md, XX, XX },
+Ia_fcoms_Md = { "fcom", "fcoms", Md, XX, XX },
+Ia_fcos = { "fcos", "fcos", XX, XX, XX },
+Ia_fdecstp = { "fdecstp", "fdecstp", XX, XX, XX },
+Ia_fdisi = { "fdisi (287 legacy)", "fdisi (287 legacy)", XX, XX, XX },
+Ia_fdiv_ST0_STi = { "fdiv", "fdiv", ST0, STi, XX },
+Ia_fdiv_STi_ST0 = { "fdiv", "fdiv", STi, ST0, XX },
+Ia_fdivl_Mq = { "fdiv", "fdivl", Mq, XX, XX },
+Ia_fdivp_STi_ST0 = { "fdivp", "fdivp", STi, ST0, XX },
+Ia_fdivr_ST0_STi = { "fdivr", "fdivr", ST0, STi, XX },
+Ia_fdivr_STi_ST0 = { "fdivr", "fdivr", STi, ST0, XX },
+Ia_fdivrl_Mq = { "fdivr", "fdivrl", Mq, XX, XX },
+Ia_fdivrp_STi_ST0 = { "fdivrp", "fdivrp", STi, ST0, XX },
+Ia_fdivrs_Md = { "fdivr", "fdivrs", Md, XX, XX },
+Ia_fdivs_Md = { "fdiv", "fdivs", Md, XX, XX },
+Ia_femms = { "femms", "femms", XX, XX, XX },
+Ia_feni = { "feni (287 legacy)", "feni(287 legacy)", XX, XX, XX },
+Ia_ffree_STi = { "ffree", "ffree", STi, XX, XX },
+Ia_ffreep_STi = { "ffreep", "ffreep", STi, XX, XX },
+Ia_fiaddl_Md = { "fiadd", "fiaddl", Md, XX, XX },
+Ia_fiadds_Mw = { "fiadd", "fiadds", Mw, XX, XX },
+Ia_ficoml_Md = { "ficom", "ficoml", Md, XX, XX },
+Ia_ficompl_Md = { "ficomp", "ficompl", Md, XX, XX },
+Ia_ficomps_Mw = { "ficomp", "ficomps", Mw, XX, XX },
+Ia_ficoms_Mw = { "ficom", "ficoms", Mw, XX, XX },
+Ia_fidivl_Md = { "fidiv", "fidivl", Md, XX, XX },
+Ia_fidivrl_Md = { "fidivr", "fidivrl", Md, XX, XX },
+Ia_fidivrs_Mw = { "fidivr", "fidivrs", Mw, XX, XX },
+Ia_fidivs_Mw = { "fidiv", "fidivs", Mw, XX, XX },
+Ia_fildl_Md = { "fild", "fildl", Md, XX, XX },
+Ia_fildq_Mq = { "fild", "fildq", Mq, XX, XX },
+Ia_filds_Mw = { "fild", "filds", Mw, XX, XX },
+Ia_fimull_Md = { "fimul", "fimull", Md, XX, XX },
+Ia_fimuls_Mw = { "fimul", "fimuls", Mw, XX, XX },
+Ia_fincstp = { "fincstp", "fincstp", XX, XX, XX },
+Ia_fistl_Md = { "fist", "fistl", Md, XX, XX },
+Ia_fistpl_Md = { "fistp", "fistpl", Md, XX, XX },
+Ia_fistpq_Mq = { "fistp", "fistpq", Mq, XX, XX },
+Ia_fistps_Mw = { "fistp", "fistps", Mw, XX, XX },
+Ia_fists_Mw = { "fist", "fists", Mw, XX, XX },
+Ia_fisttpl_Md = { "fisttp", "fisttpl", Md, XX, XX },
+Ia_fisttpq_Mq = { "fisttp", "fisttpq", Mq, XX, XX },
+Ia_fisttps_Mw = { "fisttp", "fisttps", Mw, XX, XX },
+Ia_fisubl_Md = { "fisub", "fisubl", Md, XX, XX },
+Ia_fisubrl_Md = { "fisubr", "fisubrl", Md, XX, XX },
+Ia_fisubrs_Mw = { "fisubr", "fisubrs", Mw, XX, XX },
+Ia_fisubs_Mw = { "fisub", "fisubs", Mw, XX, XX },
+Ia_fld_STi = { "fld", "fld", STi, XX, XX },
+Ia_fld1 = { "fld1", "fld1", XX, XX, XX },
+Ia_fldcw = { "fldcw", "fldcw", Ew, XX, XX },
+Ia_fldenv = { "fldenv", "fldenv", Mx, XX, XX },
+Ia_fldl_Mq = { "fld", "fldl", Mq, XX, XX },
+Ia_fldl2e = { "fldl2e", "fldl2e", XX, XX, XX },
+Ia_fldl2t = { "fldl2t", "fldl2t", XX, XX, XX },
+Ia_fldlg2 = { "fldlg2", "fldlg2", XX, XX, XX },
+Ia_fldln2 = { "fldln2", "fldln2", XX, XX, XX },
+Ia_fldpi = { "fldpi", "fldpi", XX, XX, XX },
+Ia_flds_Md = { "fld", "flds", Md, XX, XX },
+Ia_fldt_Mt = { "fld", "fldt", Mt, XX, XX },
+Ia_fldz = { "fldz", "fldz", XX, XX, XX },
+Ia_fmul_ST0_STi = { "fmul", "fmul", ST0, STi, XX },
+Ia_fmul_STi_ST0 = { "fmul", "fmul", STi, ST0, XX },
+Ia_fmull_Mq = { "fmul", "fmull", Mq, XX, XX },
+Ia_fmulp_STi_ST0 = { "fmulp", "fmulp", STi, ST0, XX },
+Ia_fmuls_Md = { "fmul", "fmuls", Md, XX, XX },
+Ia_fnclex = { "fnclex", "fnclex", XX, XX, XX },
+Ia_fninit = { "fninit", "fninit", XX, XX, XX },
+Ia_fnop = { "fnop", "fnop", XX, XX, XX },
+Ia_fnsave = { "fnsave", "fnsave", Mx, XX, XX },
+Ia_fnstcw = { "fnstcw", "fnstcw", Mw, XX, XX },
+Ia_fnstenv = { "fnstenv", "fnstenv", Mx, XX, XX },
+Ia_fnstsw = { "fnstsw", "fnstsw", Mw, XX, XX },
+Ia_fnstsw_AX = { "fnstsw", "fnstsw", AX, XX, XX },
+Ia_fpatan = { "fpatan", "fpatan", XX, XX, XX },
+Ia_fprem = { "fprem", "fprem", XX, XX, XX },
+Ia_fprem1 = { "fprem1", "fprem1", XX, XX, XX },
+Ia_fptan = { "fptan", "fptan", XX, XX, XX },
+Ia_frndint = { "frndint", "frndint", XX, XX, XX },
+Ia_frstor = { "frstor", "frstor", Mx, XX, XX },
+Ia_fscale = { "fscale", "fscale", XX, XX, XX },
+Ia_fsetpm = { "fsetpm (287 legacy)", "fsetpm (287 legacy)", XX, XX, XX },
+Ia_fsin = { "fsin", "fsin", XX, XX, XX },
+Ia_fsincos = { "fsincos", "fsincos", XX, XX, XX },
+Ia_fsqrt = { "fsqrt", "fsqrt", XX, XX, XX },
+Ia_fst_STi = { "fst", "fst", STi, XX, XX },
+Ia_fstl_Mq = { "fst", "fstl", Mq, XX, XX },
+Ia_fstp_STi = { "fstp", "fstp", STi, XX, XX },
+Ia_fstpl_Mq = { "fstp", "fstpl", Mq, XX, XX },
+Ia_fstps_Md = { "fstp", "fstps", Md, XX, XX },
+Ia_fstpt_Mt = { "fstp", "fstpt", Mt, XX, XX },
+Ia_fsts_Md = { "fst", "fsts", Md, XX, XX },
+Ia_fsub_ST0_STi = { "fsub", "fsub", ST0, STi, XX },
+Ia_fsub_STi_ST0 = { "fsub", "fsub", STi, ST0, XX },
+Ia_fsubl_Mq = { "fsub", "fsubl", Mq, XX, XX },
+Ia_fsubp_STi_ST0 = { "fsubp", "fsubp", STi, ST0, XX },
+Ia_fsubr_ST0_STi = { "fsubr", "fsubr", ST0, STi, XX },
+Ia_fsubr_STi_ST0 = { "fsubr", "fsubr", STi, ST0, XX },
+Ia_fsubrl_Mq = { "fsubr", "fsubrl", Mq, XX, XX },
+Ia_fsubrp_STi_ST0 = { "fsubrp", "fsubrp", STi, ST0, XX },
+Ia_fsubrs_Md = { "fsubr", "fsubrs", Md, XX, XX },
+Ia_fsubs_Md = { "fsub", "fsubs", Md, XX, XX },
+Ia_ftst = { "ftst", "ftst", XX, XX, XX },
+Ia_fucom_STi = { "fucom", "fucom", STi, XX, XX },
+Ia_fucomi_ST0_STi = { "fucomi", "fucomi", ST0, STi, XX },
+Ia_fucomip_ST0_STi = { "fucomip", "fucomip", ST0, STi, XX },
+Ia_fucomp_STi = { "fucomp", "fucomp", STi, XX, XX },
+Ia_fucompp = { "fucompp", "fucompp", XX, XX, XX },
+Ia_fwait = { "fwait", "fwait", XX, XX, XX },
+Ia_fxam = { "fxam", "fxam", XX, XX, XX },
+Ia_fxch = { "fxch", "fxch", STi, XX, XX },
+Ia_fxrstor = { "fxrstor", "fxrstor", Mx, XX, XX },
+Ia_fxsave = { "fxsave", "fxsave", Mx, XX, XX },
+Ia_fxtract = { "fxtract", "fxtract", XX, XX, XX },
+Ia_fyl2x = { "fyl2x", "fyl2x", XX, XX, XX },
+Ia_fyl2xp1 = { "fyl2xp1", "fyl2xp1", XX, XX, XX },
+Ia_haddpd_Vpd_Wpd = { "haddpd", "haddpd", Vpd, Wpd, XX },
+Ia_haddps_Vps_Wps = { "haddps", "haddps", Vps, Wps, XX },
+Ia_hlt = { "hlt", "hlt", XX, XX, XX },
+Ia_hsubpd_Vpd_Wpd = { "hsubpd", "hsubpd", Vpd, Wpd, XX },
+Ia_hsubps_Vps_Wps = { "hsubps", "hsubps", Vps, Wps, XX },
+Ia_idivb_AL_Eb = { "idiv", "idivb", AL, Eb, XX },
+Ia_idivl_EAX_Ed = { "idiv", "idivl", EAX, Ed, XX },
+Ia_idivq_RAX_Eq = { "idiv", "idivq", RAX, Eq, XX },
+Ia_idivw_AX_Ew = { "idiv", "idivw", AX, Ew, XX },
+Ia_imulb_AL_Eb = { "imul", "imulb", AL, Eb, XX },
+Ia_imull_EAX_Ed = { "imul", "imull", EAX, Ed, XX },
+Ia_imull_Gd_Ed = { "imul", "imull", Gd, Ed, XX },
+Ia_imull_Gd_Ed_Id = { "imul", "imull", Gd, Ed, Id },
+Ia_imull_Gd_Ed_sIb = { "imul", "imull", Gd, Ed, sIbd },
+Ia_imulq_Gq_Eq = { "imul", "imulq", Gq, Eq, XX },
+Ia_imulq_Gq_Eq_sIb = { "imul", "imulq", Gq, Eq, sIbq },
+Ia_imulq_Gq_Eq_sId = { "imul", "imulq", Gq, Eq, sIdq },
+Ia_imulq_RAX_Eq = { "imul", "imulq", RAX, Eq, XX },
+Ia_imulw_AX_Ew = { "imul", "imulw", AX, Ew, XX },
+Ia_imulw_Gw_Ew = { "imul", "imulw", Gw, Ew, XX },
+Ia_imulw_Gw_Ew_Iw = { "imul", "imulw", Gw, Ew, Iw },
+Ia_imulw_Gw_Ew_sIb = { "imul", "imulw", Gw, Ew, sIbw },
+Ia_inb_AL_DX = { "in", "inb", AL, DX, XX },
+Ia_inb_AL_Ib = { "in", "inb", AL, Ib, XX },
+Ia_incb_Eb = { "inc", "incb", Eb, XX, XX },
+Ia_incl_Ed = { "inc", "incl", Ed, XX, XX },
+Ia_incl_ERX = { "inc", "incl", ERX, XX, XX },
+Ia_incq_Eq = { "inc", "incq", Eq, XX, XX },
+Ia_incw_Ew = { "inc", "incw", Ew, XX, XX },
+Ia_incw_RX = { "inc", "incw", RX, XX, XX },
+Ia_inl_EAX_DX = { "in", "inl", EAX, DX, XX },
+Ia_inl_EAX_Ib = { "in", "inl", EAX, Ib, XX },
+Ia_insb_Yb_DX = { "insb", "insb", Yb, DX, XX },
+Ia_insl_Yd_DX = { "insd", "insl", Yd, DX, XX },
+Ia_insw_Yw_DX = { "insw", "insw", Yw, DX, XX },
+Ia_int_Ib = { "int", "int", Ib, XX, XX },
+Ia_int1 = { "int1", "int1", XX, XX, XX },
+Ia_int3 = { "int3", "int3", XX, XX, XX },
+Ia_into = { "into", "into", XX, XX, XX },
+Ia_Invalid = { "(invalid)", "(invalid)", XX, XX, XX },
+Ia_invd = { "invd", "invd", XX, XX, XX },
+Ia_invlpg = { "invlpg", "invlpg", Mx, XX, XX },
+Ia_inw_AX_DX = { "in", "inw", AX, DX, XX },
+Ia_inw_AX_Ib = { "in", "inw", AX, Ib, XX },
+Ia_iretl = { "iretd", "iretd", XX, XX, XX },
+Ia_iretq = { "iretq", "iretq", XX, XX, XX },
+Ia_iretw = { "iret", "iretw", XX, XX, XX },
+Ia_jb_Jb = { "jb", "jb", Jb, XX, XX },
+Ia_jb_Jd = { "jb", "jb", Jd, XX, XX },
+Ia_jb_Jw = { "jb", "jb", Jw, XX, XX },
+Ia_jbe_Jb = { "jbe", "jbe", Jb, XX, XX },
+Ia_jbe_Jd = { "jbe", "jbe", Jd, XX, XX },
+Ia_jbe_Jw = { "jbe", "jbe", Jw, XX, XX },
+Ia_jcxz_Jb = { "jcxz", "jcxz", Jb, XX, XX },
+Ia_jecxz_Jb = { "jecxz", "jecxz", Jb, XX, XX },
+Ia_jl_Jb = { "jl", "jl", Jb, XX, XX },
+Ia_jl_Jd = { "jl", "jl", Jd, XX, XX },
+Ia_jl_Jw = { "jl", "jl", Jw, XX, XX },
+Ia_jle_Jb = { "jle", "jle", Jb, XX, XX },
+Ia_jle_Jd = { "jle", "jle", Jd, XX, XX },
+Ia_jle_Jw = { "jle", "jle", Jw, XX, XX },
+Ia_jmp_Ed = { "jmp", "jmp", Ed, XX, XX },
+Ia_jmp_Eq = { "jmp", "jmp", Eq, XX, XX },
+Ia_jmp_Ew = { "jmp", "jmp", Ew, XX, XX },
+Ia_jmp_Jb = { "jmp", "jmp", Jb, XX, XX },
+Ia_jmp_Jd = { "jmp", "jmp", Jd, XX, XX },
+Ia_jmp_Jw = { "jmp", "jmp", Jw, XX, XX },
+Ia_jnb_Jb = { "jnb", "jnb", Jb, XX, XX },
+Ia_jnb_Jd = { "jnb", "jnb", Jd, XX, XX },
+Ia_jnb_Jw = { "jnb", "jnb", Jw, XX, XX },
+Ia_jnbe_Jb = { "jnbe", "jnbe", Jb, XX, XX },
+Ia_jnbe_Jd = { "jnbe", "jnbe", Jd, XX, XX },
+Ia_jnbe_Jw = { "jnbe", "jnbe", Jw, XX, XX },
+Ia_jnl_Jb = { "jnl", "jnl", Jb, XX, XX },
+Ia_jnl_Jd = { "jnl", "jnl", Jd, XX, XX },
+Ia_jnl_Jw = { "jnl", "jnl", Jw, XX, XX },
+Ia_jnle_Jb = { "jnle", "jnle", Jb, XX, XX },
+Ia_jnle_Jd = { "jnle", "jnle", Jd, XX, XX },
+Ia_jnle_Jw = { "jnle", "jnle", Jw, XX, XX },
+Ia_jno_Jb = { "jno", "jno", Jb, XX, XX },
+Ia_jno_Jd = { "jno", "jno", Jd, XX, XX },
+Ia_jno_Jw = { "jno", "jno", Jw, XX, XX },
+Ia_jnp_Jb = { "jnp", "jnp", Jb, XX, XX },
+Ia_jnp_Jd = { "jnp", "jnp", Jd, XX, XX },
+Ia_jnp_Jw = { "jnp", "jnp", Jw, XX, XX },
+Ia_jns_Jb = { "jns", "jns", Jb, XX, XX },
+Ia_jns_Jd = { "jns", "jns", Jd, XX, XX },
+Ia_jns_Jw = { "jns", "jns", Jw, XX, XX },
+Ia_jnz_Jb = { "jnz", "jnz", Jb, XX, XX },
+Ia_jnz_Jd = { "jnz", "jnz", Jd, XX, XX },
+Ia_jnz_Jw = { "jnz", "jnz", Jw, XX, XX },
+Ia_jo_Jb = { "jo", "jo", Jb, XX, XX },
+Ia_jo_Jd = { "jo", "jo", Jd, XX, XX },
+Ia_jo_Jw = { "jo", "jo", Jw, XX, XX },
+Ia_jp_Jb = { "jp", "jp", Jb, XX, XX },
+Ia_jp_Jd = { "jp", "jp", Jd, XX, XX },
+Ia_jp_Jw = { "jp", "jp", Jw, XX, XX },
+Ia_jrcxz_Jb = { "jrcxz", "jrcxz", Jb, XX, XX },
+Ia_js_Jb = { "js", "js", Jb, XX, XX },
+Ia_js_Jd = { "js", "js", Jd, XX, XX },
+Ia_js_Jw = { "js", "js", Jw, XX, XX },
+Ia_jz_Jb = { "jz", "jz", Jb, XX, XX },
+Ia_jz_Jd = { "jz", "jz", Jd, XX, XX },
+Ia_jz_Jw = { "jz", "jz", Jw, XX, XX },
+Ia_lahf = { "lahf", "lahf", XX, XX, XX },
+Ia_larl_Gd_Ew = { "lar", "larl", Gd, Ew, XX },
+Ia_larq_Gq_Ew = { "lar", "larq", Gq, Ew, XX },
+Ia_larw_Gw_Ew = { "lar", "larw", Gw, Ew, XX },
+Ia_lcall_Apd = { "call far", "lcall", Apd, XX, XX },
+Ia_lcall_Apw = { "call far", "lcall", Apw, XX, XX },
+Ia_lcall_Mp = { "call far", "lcall", Mp, XX, XX },
+Ia_lddqu_Vdq_Mdq = { "lddqu", "lddqu", Vdq, Mdq, XX },
+Ia_ldmxcsr = { "ldmxcsr", "ldmxcsr", Md, XX, XX },
+Ia_ldsl_Gd_Mp = { "lds", "ldsl", Gd, Mp, XX },
+Ia_ldsw_Gw_Mp = { "lds", "ldsw", Gw, Mp, XX },
+Ia_leal_Gd_Md = { "lea", "leal", Gd, Md, XX },
+Ia_leaq_Gq_Mq = { "lea", "leaq", Gq, Mq, XX },
+Ia_leave = { "leave", "leave", XX, XX, XX },
+Ia_leaw_Gw_Mw = { "lea", "leaw", Gw, Mw, XX },
+Ia_lesl_Gd_Mp = { "les", "lesl", Gd, Mp, XX },
+Ia_lesw_Gw_Mp = { "les", "lesw", Gw, Mp, XX },
+Ia_lfence = { "lfence", "lfence", XX, XX, XX },
+Ia_lfsl_Gd_Mp = { "lfs", "lfsl", Gd, Mp, XX },
+Ia_lfsq_Gq_Mp = { "lfs", "lfsq", Gq, Mp, XX },
+Ia_lfsw_Gw_Mp = { "lfs", "lfsw", Gw, Mp, XX },
+Ia_lgdt = { "lgdt", "lgdt", Ms, XX, XX },
+Ia_lgsl_Gd_Mp = { "lgs", "lgsl", Gd, Mp, XX },
+Ia_lgsq_Gq_Mp = { "lgs", "lgsq", Gq, Mp, XX },
+Ia_lgsw_Gw_Mp = { "lgs", "lgsw", Gw, Mp, XX },
+Ia_lidt = { "lidt", "lidt", Ms, XX, XX },
+Ia_ljmp_Apd = { "jmp far", "ljmp", Apd, XX, XX },
+Ia_ljmp_Apw = { "jmp far", "ljmp", Apw, XX, XX },
+Ia_ljmp_Mp = { "jmp far", "ljmp", Mp, XX, XX },
+Ia_lldt = { "lldt", "lldt", Ew, XX, XX },
+Ia_lmsw_Ew = { "lmsw", "lmsw", Ew, XX, XX },
+Ia_lodsb_AL_Xb = { "lodsb", "lodsb", AL, Xb, XX },
+Ia_lodsl_EAX_Xd = { "lodsd", "lodsl", EAX, Xd, XX },
+Ia_lodsq_RAX_Xq = { "lodsq", "lodsq", RAX, Xq, XX },
+Ia_lodsw_AX_Xw = { "lodsw", "lodsw", AX, Xw, XX },
+Ia_loop_Jb = { "loop", "loop", Jb, XX, XX },
+Ia_loope_Jb = { "loope", "loope", Jb, XX, XX },
+Ia_loopne_Jb = { "loopne", "loopne", Jb, XX, XX },
+Ia_lret = { "retf", "lret", XX, XX, XX },
+Ia_lret_Iw = { "retf", "lret", Iw, XX, XX },
+Ia_lsll_Gd_Ew = { "lsl", "lsll", Gd, Ew, XX },
+Ia_lslq_Gq_Ew = { "lsl", "lslq", Gq, Ew, XX },
+Ia_lslw_Gw_Ew = { "lsl", "lslw", Gw, Ew, XX },
+Ia_lssl_Gd_Mp = { "lss", "lssl", Gd, Mp, XX },
+Ia_lssq_Gq_Mp = { "lss", "lssq", Gq, Mp, XX },
+Ia_lssw_Gw_Mp = { "lss", "lssw", Gw, Mp, XX },
+Ia_ltr = { "ltr", "ltr", Ew, XX, XX },
+Ia_maskmovdqu_Vdq_Udq = { "maskmovdqu", "maskmovdqu", Vdq, Udq, XX },
+Ia_maskmovq_Pq_Nq = { "maskmovq", "maskmovq", Pq, Nq, XX },
+Ia_maxpd_Vpd_Wpd = { "maxpd", "maxpd", Vpd, Wpd, XX },
+Ia_maxps_Vps_Wps = { "maxps", "maxps", Vps, Wps, XX },
+Ia_maxsd_Vsd_Wsd = { "maxsd", "maxsd", Vsd, Wsd, XX },
+Ia_maxss_Vss_Wss = { "maxss", "maxss", Vss, Wss, XX },
+Ia_mfence = { "mfence", "mfence", XX, XX, XX },
+Ia_minpd_Vpd_Wpd = { "minpd", "minpd", Vpd, Wpd, XX },
+Ia_minps_Vps_Wps = { "minps", "minps", Vps, Wps, XX },
+Ia_minsd_Vsd_Wsd = { "minsd", "minsd", Vsd, Wsd, XX },
+Ia_minss_Vss_Wss = { "minss", "minss", Vss, Wss, XX },
+Ia_monitor = { "monitor", "monitor", XX, XX, XX },
+Ia_movapd_Vpd_Wpd = { "movapd", "movapd", Vpd, Wpd, XX },
+Ia_movapd_Wpd_Vpd = { "movapd", "movapd", Wpd, Vpd, XX },
+Ia_movaps_Vps_Wps = { "movaps", "movaps", Vps, Wps, XX },
+Ia_movaps_Wps_Vps = { "movaps", "movaps", Wps, Vps, XX },
+Ia_movb_AL_Ob = { "mov", "movb", AL, Ob, XX },
+Ia_movb_Eb_Gb = { "mov", "movb", Eb, Gb, XX },
+Ia_movb_Eb_Ib = { "mov", "movb", Eb, Ib, XX },
+Ia_movb_Gb_Eb = { "mov", "movb", Gb, Eb, XX },
+Ia_movb_Ob_AL = { "mov", "movb", Ob, AL, XX },
+Ia_movb_R8_Ib = { "mov", "movb", R8, Ib, XX },
+Ia_movd_Ed_Pq = { "movd", "movd", Ed, Pq, XX },
+Ia_movd_Ed_Vd = { "movd", "movd", Ed, Vdq, XX },
+Ia_movd_Pq_Ed = { "movd", "movd", Pq, Ed, XX },
+Ia_movd_Vdq_Ed = { "movd", "movd", Vdq, Ed, XX },
+Ia_movddup_Vdq_Wq = { "movddup", "movddup", Vdq, Wq, XX },
+Ia_movdq2q_Pq_Vq = { "movdq2q", "movdq2q", Pq, Vq, XX },
+Ia_movdqa_Vdq_Wdq = { "movdqa", "movdqa", Vdq, Wdq, XX },
+Ia_movdqa_Wdq_Vdq = { "movdqa", "movdqa", Wdq, Vdq, XX },
+Ia_movdqu_Vdq_Wdq = { "movdqu", "movdqu", Vdq, Wdq, XX },
+Ia_movdqu_Wdq_Vdq = { "movdqu", "movdqu", Wdq, Vdq, XX },
+Ia_movhlpd_Vpd_Uq = { "movhlpd", "movhlpd", Vpd, Udq, XX },
+Ia_movhlps_Vps_Uq = { "movhlps", "movhlps", Vps, Udq, XX },
+Ia_movhpd_Mq_Vpd = { "movhpd", "movhpd", Mq, Vpd, XX },
+Ia_movhpd_Vpd_Mq = { "movhpd", "movhpd", Vpd, Mq, XX },
+Ia_movhps_Mq_Vps = { "movhps", "movhps", Mq, Vps, XX },
+Ia_movhps_Vps_Mq = { "movhps", "movhps", Vps, Mq, XX },
+Ia_movl_Cd_Rd = { "mov", "movl", Cd, Rd, XX },
+Ia_movl_Dd_Rd = { "mov", "movl", Dd, Rd, XX },
+Ia_movl_EAX_Od = { "mov", "movl", EAX, Od, XX },
+Ia_movl_Ed_Gd = { "mov", "movl", Ed, Gd, XX },
+Ia_movl_Ed_Id = { "mov", "movl", Ed, Id, XX },
+Ia_movl_ERX_Id = { "mov", "movl", ERX, Id, XX },
+Ia_movl_Gd_Ed = { "mov", "movl", Gd, Ed, XX },
+Ia_movl_Od_EAX = { "mov", "movl", Od, EAX, XX },
+Ia_movl_Rd_Cd = { "mov", "movl", Rd, Cd, XX },
+Ia_movl_Rd_Dd = { "mov", "movl", Rd, Dd, XX },
+Ia_movl_Rd_Td = { "mov", "movl", Rd, Td, XX },
+Ia_movl_Td_Rd = { "mov", "movl", Td, Rd, XX },
+Ia_movlhpd_Vpd_Uq = { "movlhpd", "movlhpd", Vpd, Udq, XX },
+Ia_movlhps_Vps_Uq = { "movlhps", "movlhps", Vps, Udq, XX },
+Ia_movlpd_Mq_Vpd = { "movlpd", "movlpd", Mq, Vpd, XX },
+Ia_movlpd_Vpd_Mq = { "movlpd", "movlpd", Vpd, Mq, XX },
+Ia_movlps_Mq_Vps = { "movlps", "movlps", Mq, Vps, XX },
+Ia_movlps_Vps_Mq = { "movlps", "movlps", Vps, Mq, XX },
+Ia_movmskpd_Gd_Vpd = { "movmskpd", "movmskpd", Gd, Vpd, XX },
+Ia_movmskps_Gd_Vps = { "movmskps", "movmskps", Gd, Vps, XX },
+Ia_movntdq_Mdq_Vdq = { "movntdq", "movntdq", Mdq, Vdq, XX },
+Ia_movnti_Md_Gd = { "movnti", "movnti", Md, Gd, XX },
+Ia_movntiq_Mq_Gq = { "movntiq", "movntiq", Mq, Gq, XX },
+Ia_movntpd_Mpd_Vpd = { "movntpd", "movntpd", Mpd, Vpd, XX },
+Ia_movntps_Mps_Vps = { "movntps", "movntps", Mps, Vps, XX },
+Ia_movntq_Mq_Pq = { "movntq", "movntq", Mq, Pq, XX },
+Ia_movq_Cq_Rq = { "mov", "movq", Cq, Rq, XX },
+Ia_movq_Dq_Rq = { "mov", "movq", Dq, Rq, XX },
+Ia_movq_Eq_Gq = { "mov", "movq", Eq, Gq, XX },
+Ia_movq_Eq_Pq = { "movq", "movq", Eq, Pq, XX },
+Ia_movq_Eq_sId = { "mov", "movq", Eq, sIdq, XX },
+Ia_movq_Eq_Vq = { "movq", "movq", Eq, Vq, XX },
+Ia_movq_Gq_Eq = { "mov", "movq", Gq, Eq, XX },
+Ia_movq_Oq_RAX = { "mov", "movq", Oq, RAX, XX },
+Ia_movq_Pq_Eq = { "movq", "movq", Pq, Eq, XX },
+Ia_movq_Pq_Qq = { "movq", "movq", Pq, Qq, XX },
+Ia_movq_Qq_Pq = { "movq", "movq", Qq, Pq, XX },
+Ia_movq_RAX_Oq = { "mov", "movq", RAX, Oq, XX },
+Ia_movq_Rq_Cq = { "mov", "movq", Rq, Cq, XX },
+Ia_movq_Rq_Dq = { "mov", "movq", Rq, Dq, XX },
+Ia_movq_RRX_Iq = { "mov", "movq", RRX, Iq, XX },
+Ia_movq_Vdq_Eq = { "movq", "movq", Vdq, Eq, XX },
+Ia_movq_Vq_Wq = { "movq", "movq", Vq, Wq, XX },
+Ia_movq_Wq_Vq = { "movq", "movq", Wq, Vq, XX },
+Ia_movq2dq_Vdq_Qq = { "movq2dq", "movq2dq", Vdq, Qq, XX },
+Ia_movsb_Yb_Xb = { "movsb", "movsb", Yb, Xb, XX },
+Ia_movsbl_Gd_Eb = { "movsx", "movsbl", Gd, Eb, XX },
+Ia_movsbq_Gq_Eb = { "movsx", "movsbq", Gq, Eb, XX },
+Ia_movsbw_Gw_Eb = { "movsx", "movsbw", Gw, Eb, XX },
+Ia_movsd_Vsd_Wsd = { "movsd", "movsd", Vsd, Wsd, XX },
+Ia_movsd_Wsd_Vsd = { "movsd", "movsd", Wsd, Vsd, XX },
+Ia_movshdup_Vdq_Wdq = { "movshdup", "movshdup", Vdq, Wdq, XX },
+Ia_movsl_Yd_Xd = { "movsd", "movsl", Yd, Xd, XX },
+Ia_movsldup_Vdq_Wdq = { "movsldup", "movsldup", Vdq, Wdq, XX },
+Ia_movslq_Gq_Ed = { "movsxd", "movslq", Gq, Ed, XX },
+Ia_movsq_Yq_Xq = { "movsq", "movsq", Yq, Xq, XX },
+Ia_movss_Vss_Wss = { "movss", "movss", Vss, Wss, XX },
+Ia_movss_Wss_Vss = { "movss", "movss", Wss, Vss, XX },
+Ia_movsw_Yw_Xw = { "movsw", "movsw", Yw, Xw, XX },
+Ia_movswl_Gd_Ew = { "movsx", "movswl", Gd, Ew, XX },
+Ia_movswq_Gq_Ew = { "movsx", "movswq", Gq, Ew, XX },
+Ia_movupd_Vpd_Wpd = { "movupd", "movupd", Vpd, Wpd, XX },
+Ia_movupd_Wpd_Vpd = { "movupd", "movupd", Wpd, Vpd, XX },
+Ia_movups_Vps_Wps = { "movups", "movups", Vps, Wps, XX },
+Ia_movups_Wps_Vps = { "movups", "movups", Wps, Vps, XX },
+Ia_movw_AX_Ow = { "mov", "movw", AX, Ow, XX },
+Ia_movw_Ew_Gw = { "mov", "movw", Ew, Gw, XX },
+Ia_movw_Ew_Iw = { "mov", "movw", Ew, Iw, XX },
+Ia_movw_Ew_Sw = { "mov", "movw", Ew, Sw, XX },
+Ia_movw_Gw_Ew = { "mov", "movw", Gw, Ew, XX },
+Ia_movw_Ow_AX = { "mov", "movw", Ow, AX, XX },
+Ia_movw_RX_Iw = { "mov", "movw", RX, Iw, XX },
+Ia_movw_Sw_Ew = { "mov", "movw", Sw, Ew, XX },
+Ia_movzbl_Gd_Eb = { "movzx", "movzbl", Gd, Eb, XX },
+Ia_movzbq_Gq_Eb = { "movzx", "movzbq", Gq, Eb, XX },
+Ia_movzbw_Gw_Eb = { "movzx", "movzbw", Gw, Eb, XX },
+Ia_movzwl_Gd_Ew = { "movzx", "movzwl", Gd, Ew, XX },
+Ia_movzwq_Gq_Ew = { "movzx", "movzwq", Gq, Ew, XX },
+Ia_mulb_AL_Eb = { "mul", "mulb", AL, Eb, XX },
+Ia_mull_EAX_Ed = { "mul", "mull", EAX, Ed, XX },
+Ia_mulpd_Vpd_Wpd = { "mulpd", "mulpd", Vpd, Wpd, XX },
+Ia_mulps_Vps_Wps = { "mulps", "mulps", Vps, Wps, XX },
+Ia_mulq_RAX_Eq = { "mul", "mulq", RAX, Eq, XX },
+Ia_mulsd_Vsd_Wsd = { "mulsd", "mulsd", Vsd, Wsd, XX },
+Ia_mulss_Vss_Wss = { "mulss", "mulss", Vss, Wss, XX },
+Ia_multibyte_nop = { "multibyte nop", "multibyte nop", XX, XX, XX },
+Ia_mulw_AX_Ew = { "mul", "mulw", AX, Ew, XX },
+Ia_mwait = { "mwait", "mwait", XX, XX, XX },
+Ia_negb_Eb = { "neg", "negb", Eb, XX, XX },
+Ia_negl_Ed = { "neg", "negl", Ed, XX, XX },
+Ia_negq_Eq = { "neg", "negq", Eq, XX, XX },
+Ia_negw_Ew = { "neg", "negw", Ew, XX, XX },
+Ia_nop = { "nop", "nop", XX, XX, XX },
+Ia_notb_Eb = { "not", "notb", Eb, XX, XX },
+Ia_notl_Ed = { "not", "notl", Ed, XX, XX },
+Ia_notq_Eq = { "not", "notq", Eq, XX, XX },
+Ia_notw_Ew = { "not", "notw", Ew, XX, XX },
+Ia_orb_AL_Ib = { "or", "orb", AL, Ib, XX },
+Ia_orb_Eb_Gb = { "or", "orb", Eb, Gb, XX },
+Ia_orb_Eb_Ib = { "or", "orb", Eb, Ib, XX },
+Ia_orb_Gb_Eb = { "or", "orb", Gb, Eb, XX },
+Ia_orl_EAX_Id = { "or", "orl", EAX, Id, XX },
+Ia_orl_Ed_Gd = { "or", "orl", Ed, Gd, XX },
+Ia_orl_Ed_Id = { "or", "orl", Ed, Id, XX },
+Ia_orl_Ed_sIb = { "or", "orl", Ed, sIbd, XX },
+Ia_orl_Gd_Ed = { "or", "orl", Gd, Ed, XX },
+Ia_orpd_Vpd_Wpd = { "orpd", "orpd", Vpd, Wpd, XX },
+Ia_orps_Vps_Wps = { "orps", "orps", Vps, Wps, XX },
+Ia_orq_Eq_Gq = { "or", "orq", Eq, Gq, XX },
+Ia_orq_Eq_sIb = { "or", "orq", Eq, sIbq, XX },
+Ia_orq_Eq_sId = { "or", "orq", Eq, sIdq, XX },
+Ia_orq_Gq_Eq = { "or", "orq", Gq, Eq, XX },
+Ia_orq_RAX_sId = { "or", "orq", RAX, sIdq, XX },
+Ia_orw_AX_Iw = { "or", "orw", AX, Iw, XX },
+Ia_orw_Ew_Gw = { "or", "orw", Ew, Gw, XX },
+Ia_orw_Ew_Iw = { "or", "orw", Ew, Iw, XX },
+Ia_orw_Ew_sIb = { "or", "orw", Ew, sIbw, XX },
+Ia_orw_Gw_Ew = { "or", "orw", Gw, Ew, XX },
+Ia_outb_DX_AL = { "out", "outb", DX, AL, XX },
+Ia_outb_Ib_AL = { "out", "outb", Ib, AL, XX },
+Ia_outl_DX_EAX = { "out", "outl", DX, EAX, XX },
+Ia_outl_Ib_EAX = { "out", "outl", Ib, EAX, XX },
+Ia_outsb_DX_Xb = { "outsb", "outsb", DX, Xb, XX },
+Ia_outsl_DX_Xd = { "outsd", "outsl", DX, Xd, XX },
+Ia_outsw_DX_Xw = { "outsw", "outsw", DX, Xw, XX },
+Ia_outw_DX_AX = { "out", "outw", DX, AX, XX },
+Ia_outw_Ib_AX = { "out", "outw", Ib, AX, XX },
+Ia_pabsb_Pq_Qq = { "pabsb", "pabsb", Pq, Qq, XX },
+Ia_pabsb_Vdq_Wdq = { "pabsb", "pabsb", Vdq, Wdq, XX },
+Ia_pabsd_Pq_Qq = { "pabsd", "pabsd", Pq, Qq, XX },
+Ia_pabsd_Vdq_Wdq = { "pabsd", "pabsd", Vdq, Wdq, XX },
+Ia_pabsw_Pq_Qq = { "pabsw", "pabsw", Pq, Qq, XX },
+Ia_pabsw_Vdq_Wdq = { "pabsw", "pabsw", Vdq, Wdq, XX },
+Ia_packssdw_Pq_Qq = { "packssdw", "packssdw", Pq, Qq, XX },
+Ia_packssdw_Vdq_Wdq = { "packssdw", "packssdw", Vdq, Wdq, XX },
+Ia_packsswb_Pq_Qq = { "packsswb", "packsswb", Pq, Qq, XX },
+Ia_packsswb_Vdq_Wq = { "packsswb", "packsswb", Vdq, Wq, XX },
+Ia_packuswb_Pq_Qq = { "packuswb", "packuswb", Pq, Qq, XX },
+Ia_packuswb_Vdq_Wdq = { "packuswb", "packuswb", Vdq, Wdq, XX },
+Ia_paddb_Pq_Qq = { "paddb", "paddb", Pq, Qq, XX },
+Ia_paddb_Vdq_Wdq = { "paddb", "paddb", Vdq, Wdq, XX },
+Ia_paddd_Pq_Qq = { "paddd", "paddd", Pq, Qq, XX },
+Ia_paddd_Vdq_Wdq = { "paddd", "paddd", Vdq, Wdq, XX },
+Ia_paddq_Pq_Qq = { "paddq", "paddq", Pq, Qq, XX },
+Ia_paddq_Vdq_Wdq = { "paddq", "paddq", Vdq, Wdq, XX },
+Ia_paddsb_Pq_Qq = { "paddsb", "paddsb", Pq, Qq, XX },
+Ia_paddsb_Vdq_Wdq = { "paddsb", "paddsb", Vdq, Wdq, XX },
+Ia_paddsw_Pq_Qq = { "paddsw", "paddsw", Pq, Qq, XX },
+Ia_paddsw_Vdq_Wdq = { "paddsw", "paddsw", Vdq, Wdq, XX },
+Ia_paddusb_Pq_Qq = { "paddusb", "paddusb", Pq, Qq, XX },
+Ia_paddusb_Vdq_Wdq = { "paddusb", "paddusb", Vdq, Wdq, XX },
+Ia_paddusw_Pq_Qq = { "paddusw", "paddusw", Pq, Qq, XX },
+Ia_paddusw_Vdq_Wdq = { "paddusw", "paddusw", Vdq, Wdq, XX },
+Ia_paddw_Pq_Qq = { "paddw", "paddw", Pq, Qq, XX },
+Ia_paddw_Vdq_Wdq = { "paddw", "paddw", Vdq, Wdq, XX },
+Ia_palignr_Pq_Qq_Ib = { "palignr", "palignr", Pq, Qq, Ib },
+Ia_palignr_Vdq_Wdq_Ib = { "palignr", "palignr", Vdq, Wdq, Ib },
+Ia_pand_Pq_Qq = { "pand", "pand", Pq, Qq, XX },
+Ia_pand_Vdq_Wdq = { "pand", "pand", Vdq, Wdq, XX },
+Ia_pandn_Pq_Qq = { "pandn", "pandn", Pq, Qq, XX },
+Ia_pandn_Vdq_Wdq = { "pandn", "pandn", Vdq, Wdq, XX },
+Ia_pause = { "pause", "pause", XX, XX, XX },
+Ia_pavgb_Pq_Qq = { "pavgb", "pavgb", Pq, Qq, XX },
+Ia_pavgb_Vdq_Wdq = { "pavgb", "pavgb", Vdq, Wdq, XX },
+Ia_pavgw_Pq_Qq = { "pavgw", "pavgw", Pq, Qq, XX },
+Ia_pavgw_Vdq_Wdq = { "pavgw", "pavgw", Vdq, Wdq, XX },
+Ia_pcmpeqb_Pq_Qq = { "pcmpeqb", "pcmpeqb", Pq, Qq, XX },
+Ia_pcmpeqb_Vdq_Wdq = { "pcmpeqb", "pcmpeqb", Vdq, Wdq, XX },
+Ia_pcmpeqd_Pq_Qq = { "pcmpeqd", "pcmpeqd", Pq, Qq, XX },
+Ia_pcmpeqd_Vdq_Wdq = { "pcmpeqd", "pcmpeqd", Vdq, Wdq, XX },
+Ia_pcmpeqw_Pq_Qq = { "pcmpeqw", "pcmpeqw", Pq, Qq, XX },
+Ia_pcmpeqw_Vdq_Wdq = { "pcmpeqw", "pcmpeqw", Vdq, Wdq, XX },
+Ia_pcmpgtb_Pq_Qq = { "pcmpgtb", "pcmpgtb", Pq, Qq, XX },
+Ia_pcmpgtb_Vdq_Wq = { "pcmpgtb", "pcmpgtb", Vdq, Wq, XX },
+Ia_pcmpgtd_Pq_Qq = { "pcmpgtd", "pcmpgtd", Pq, Qq, XX },
+Ia_pcmpgtd_Vdq_Wdq = { "pcmpgtd", "pcmpgtd", Vdq, Wdq, XX },
+Ia_pcmpgtw_Pq_Qq = { "pcmpgtw", "pcmpgtw", Pq, Qq, XX },
+Ia_pcmpgtw_Vdq_Wq = { "pcmpgtw", "pcmpgtw", Vdq, Wq, XX },
+Ia_pextrw_Gd_Nq_Ib = { "pextrw", "pextrw", Gd, Nq, Ib },
+Ia_pextrw_Gd_Udq_Ib = { "pextrw", "pextrw", Gd, Udq, Ib },
+Ia_pf2id_Pq_Qq = { "pf2id", "pf2id", Pq, Qq, XX },
+Ia_pf2iw_Pq_Qq = { "pf2iw", "pf2iw", Pq, Qq, XX },
+Ia_pfacc_Pq_Qq = { "pfacc", "pfacc", Pq, Qq, XX },
+Ia_pfadd_Pq_Qq = { "pfadd", "pfadd", Pq, Qq, XX },
+Ia_pfcmpeq_Pq_Qq = { "pfcmpeq", "pfcmpeq", Pq, Qq, XX },
+Ia_pfcmpge_Pq_Qq = { "pfcmpge", "pfcmpge", Pq, Qq, XX },
+Ia_pfcmpgt_Pq_Qq = { "pfcmpgt", "pfcmpgt", Pq, Qq, XX },
+Ia_pfmax_Pq_Qq = { "pfmax", "pfmax", Pq, Qq, XX },
+Ia_pfmin_Pq_Qq = { "pfmin", "pfmin", Pq, Qq, XX },
+Ia_pfmul_Pq_Qq = { "pfmul", "pfmul", Pq, Qq, XX },
+Ia_pfnacc_Pq_Qq = { "pfnacc", "pfnacc", Pq, Qq, XX },
+Ia_pfpnacc_Pq_Qq = { "pfpnacc", "pfpnacc", Pq, Qq, XX },
+Ia_pfrcp_Pq_Qq = { "pfrcp", "pfrcp", Pq, Qq, XX },
+Ia_pfrcpit1_Pq_Qq = { "pfrcpit1", "pfrcpit1", Pq, Qq, XX },
+Ia_pfrcpit2_Pq_Qq = { "pfrcpit2", "pfrcpit2", Pq, Qq, XX },
+Ia_pfrsqit1_Pq_Qq = { "pfrsqit1", "pfrsqit1", Pq, Qq, XX },
+Ia_pfrsqrt_Pq_Qq = { "pfrsqrt", "pfrsqrt", Pq, Qq, XX },
+Ia_pfsub_Pq_Qq = { "pfsub", "pfsub", Pq, Qq, XX },
+Ia_pfsubr_Pq_Qq = { "pfsubr", "pfsubr", Pq, Qq, XX },
+Ia_phaddd_Pq_Qq = { "phaddd", "phaddd", Pq, Qq, XX },
+Ia_phaddd_Vdq_Wdq = { "phaddd", "phaddd", Vdq, Wdq, XX },
+Ia_phaddsw_Pq_Qq = { "phaddsw", "phaddsw", Pq, Qq, XX },
+Ia_phaddsw_Vdq_Wdq = { "phaddsw", "phaddsw", Vdq, Wdq, XX },
+Ia_phaddw_Pq_Qq = { "phaddw", "phaddw", Pq, Qq, XX },
+Ia_phaddw_Vdq_Wdq = { "phaddw", "phaddw", Vdq, Wdq, XX },
+Ia_phsubd_Pq_Qq = { "phsubd", "phsubd", Pq, Qq, XX },
+Ia_phsubd_Vdq_Wdq = { "phsubd", "phsubd", Vdq, Wdq, XX },
+Ia_phsubsw_Pq_Qq = { "phsubsw", "phsubsw", Pq, Qq, XX },
+Ia_phsubsw_Vdq_Wdq = { "phsubsw", "phsubsw", Vdq, Wdq, XX },
+Ia_phsubw_Pq_Qq = { "phsubw", "phsubw", Pq, Qq, XX },
+Ia_phsubw_Vdq_Wdq = { "phsubw", "phsubw", Vdq, Wdq, XX },
+Ia_pi2fd_Pq_Qq = { "pi2fd", "pi2fd", Pq, Qq, XX },
+Ia_pi2fw_Pq_Qq = { "pi2fw", "pi2fw", Pq, Qq, XX },
+Ia_pinsrw_Pq_Ed_Ib = { "pinsrw", "pinsrw", Pq, Ed, Ib },
+Ia_pinsrw_Vdq_Ed_Ib = { "pinsrw", "pinsrw", Vdq, Ed, Ib },
+Ia_pmaddubsw_Pq_Qq = { "pmaddubsw", "pmaddubsw", Pq, Qq, XX },
+Ia_pmaddubsw_Vdq_Wdq = { "pmaddubsw", "pmaddubsw", Vdq, Wdq, XX },
+Ia_pmaddwd_Pq_Qq = { "pmaddwd", "pmaddwd", Pq, Qq, XX },
+Ia_pmaddwd_Vdq_Wdq = { "pmaddwd", "pmaddwd", Vdq, Wdq, XX },
+Ia_pmaxub_Pq_Qq = { "pmaxub", "pmaxub", Pq, Qq, XX },
+Ia_pmaxub_Vdq_Wdq = { "pmaxub", "pmaxub", Vdq, Wdq, XX },
+Ia_pmaxuw_Pq_Qq = { "pmaxuw", "pmaxuw", Pq, Qq, XX },
+Ia_pmaxuw_Vdq_Wdq = { "pmaxuw", "pmaxuw", Vdq, Wdq, XX },
+Ia_pminsw_Pq_Qq = { "pminsw", "pminsw", Pq, Qq, XX },
+Ia_pminsw_Vdq_Wdq = { "pminsw", "pminsw", Vdq, Wdq, XX },
+Ia_pminub_Pq_Qq = { "pminub", "pminub", Pq, Qq, XX },
+Ia_pminub_Vdq_Wdq = { "pminub", "pminub", Vdq, Wdq, XX },
+Ia_pmovmskb_Gd_Nq = { "pmovmskb", "pmovmskb", Gd, Nq, XX },
+Ia_pmovmskb_Gd_Udq = { "pmovmskb", "pmovmskb", Gd, Udq, XX },
+Ia_pmulhrsw_Pq_Qq = { "pmulhrsw", "pmulhrsw", Pq, Qq, XX },
+Ia_pmulhrsw_Vdq_Wdq = { "pmulhrsw", "pmulhrsw", Vdq, Wdq, XX },
+Ia_pmulhrw_Pq_Qq = { "pmulhrw", "pmulhrw", Pq, Qq, XX },
+Ia_pmulhuw_Pq_Qq = { "pmulhuw", "pmulhuw", Pq, Qq, XX },
+Ia_pmulhuw_Vdq_Wdq = { "pmulhuw", "pmulhuw", Vdq, Wdq, XX },
+Ia_pmulhw_Pq_Qq = { "pmulhw", "pmulhw", Pq, Qq, XX },
+Ia_pmulhw_Vdq_Wdq = { "pmulhw", "pmulhw", Vdq, Wdq, XX },
+Ia_pmullw_Pq_Qq = { "pmullw", "pmullw", Pq, Qq, XX },
+Ia_pmullw_Vdq_Wdq = { "pmullw", "pmullw", Vdq, Wdq, XX },
+Ia_pmuludq_Pq_Qq = { "pmuludq", "pmuludq", Pq, Qq, XX },
+Ia_pmuludq_Vdq_Wdq = { "pmuludq", "pmuludq", Vdq, Wdq, XX },
+Ia_popal = { "popad", "popal", XX, XX, XX },
+Ia_popaw = { "popa", "popa", XX, XX, XX },
+Ia_popfl = { "popfd", "popfl", XX, XX, XX },
+Ia_popfq = { "popfq", "popfq", XX, XX, XX },
+Ia_popfw = { "popf", "popf", XX, XX, XX },
+Ia_popl_DS = { "pop", "popl", DS, XX, XX },
+Ia_popl_Ed = { "pop", "popl", Ed, XX, XX },
+Ia_popl_ERX = { "pop", "popl", ERX, XX, XX },
+Ia_popl_ES = { "pop", "popl", ES, XX, XX },
+Ia_popl_FS = { "pop", "popl", FS, XX, XX },
+Ia_popl_GS = { "pop", "popl", GS, XX, XX },
+Ia_popl_SS = { "pop", "popl", SS, XX, XX },
+Ia_popq_Eq = { "pop", "popq", Eq, XX, XX },
+Ia_popq_FS = { "pop", "popq", FS, XX, XX },
+Ia_popq_GS = { "pop", "popq", GS, XX, XX },
+Ia_popq_RRX = { "pop", "popq", RRX, XX, XX },
+Ia_popw_DS = { "pop", "popw", DS, XX, XX },
+Ia_popw_ES = { "pop", "popw", ES, XX, XX },
+Ia_popw_Ew = { "pop", "popw", Ew, XX, XX },
+Ia_popw_FS = { "pop", "popw", FS, XX, XX },
+Ia_popw_GS = { "pop", "popw", GS, XX, XX },
+Ia_popw_RX = { "pop", "popw", RX, XX, XX },
+Ia_popw_SS = { "pop", "popw", SS, XX, XX },
+Ia_por_Pq_Qq = { "por", "por", Pq, Qq, XX },
+Ia_por_Vdq_Wdq = { "por", "por", Vdq, Wdq, XX },
+Ia_prefetch = { "prefetch (3dnow!)", "prefetch (3dnow!)", Mb, XX, XX },
+Ia_prefetchnta = { "prefetchnta", "prefetchnta", Mb, XX, XX },
+Ia_prefetcht0 = { "prefetcht0", "prefetcht0", Mb, XX, XX },
+Ia_prefetcht1 = { "prefetcht1", "prefetcht1", Mb, XX, XX },
+Ia_prefetcht2 = { "prefetcht2", "prefetcht2", Mb, XX, XX },
+Ia_prefix_asize = { "asize", "asize", XX, XX, XX },
+Ia_prefix_cs = { "cs", "cs", XX, XX, XX },
+Ia_prefix_ds = { "ds", "ds", XX, XX, XX },
+Ia_prefix_es = { "es", "es", XX, XX, XX },
+Ia_prefix_fs = { "fs", "fs", XX, XX, XX },
+Ia_prefix_gs = { "gs", "gs", XX, XX, XX },
+Ia_prefix_lock = { "lock", "lock", XX, XX, XX },
+Ia_prefix_osize = { "osize", "osize", XX, XX, XX },
+Ia_prefix_rep = { "rep", "rep", XX, XX, XX },
+Ia_prefix_repne = { "repne", "repne", XX, XX, XX },
+Ia_prefix_rex = { "rex", "rex", XX, XX, XX },
+Ia_prefix_ss = { "ss", "ss", XX, XX, XX },
+Ia_psadbw_Pq_Qq = { "psadbw", "psadbw", Pq, Qq, XX },
+Ia_psadbw_Vdq_Wdq = { "psadbw", "psadbw", Vdq, Wdq, XX },
+Ia_pshufb_Pq_Qq = { "pshufb", "pshufb", Pq, Qq, XX },
+Ia_pshufb_Vdq_Wdq = { "pshufb", "pshufb", Vdq, Wdq, XX },
+Ia_pshufd_Vdq_Wdq_Ib = { "pshufd", "pshufd", Vdq, Wdq, Ib },
+Ia_pshufhw_Vq_Wq_Ib = { "pshufhw", "pshufhw", Vq, Wq, Ib },
+Ia_pshuflw_Vq_Wq_Ib = { "pshuflw", "pshuflw", Vq, Wq, Ib },
+Ia_pshufw_Pq_Qq_Ib = { "pshufw", "pshufw", Pq, Qq, Ib },
+Ia_psignb_Pq_Qq = { "psignb", "psignb", Pq, Qq, XX },
+Ia_psignb_Vdq_Wdq = { "psignb", "psignb", Vdq, Wdq, XX },
+Ia_psignd_Pq_Qq = { "psignd", "psignd", Pq, Qq, XX },
+Ia_psignd_Vdq_Wdq = { "psignd", "psignd", Vdq, Wdq, XX },
+Ia_psignw_Pq_Qq = { "psignw", "psignw", Pq, Qq, XX },
+Ia_psignw_Vdq_Wdq = { "psignw", "psignw", Vdq, Wdq, XX },
+Ia_pslld_Nq_Ib = { "pslld", "pslld", Nq, Ib, XX },
+Ia_pslld_Pq_Qq = { "pslld", "pslld", Pq, Qq, XX },
+Ia_pslld_Udq_Ib = { "pslld", "pslld", Udq, Ib, XX },
+Ia_pslld_Vdq_Wdq = { "pslld", "pslld", Vdq, Wdq, XX },
+Ia_pslldq_Udq_Ib = { "pslldq", "pslldq", Udq, Ib, XX },
+Ia_psllq_Nq_Ib = { "psllq", "psllq", Nq, Ib, XX },
+Ia_psllq_Pq_Qq = { "psllq", "psllq", Pq, Qq, XX },
+Ia_psllq_Udq_Ib = { "psllq", "psllq", Udq, Ib, XX },
+Ia_psllq_Vdq_Wdq = { "psllq", "psllq", Vdq, Wdq, XX },
+Ia_psllw_Nq_Ib = { "psllw", "psllw", Nq, Ib, XX },
+Ia_psllw_Pq_Qq = { "psllw", "psllw", Pq, Qq, XX },
+Ia_psllw_Udq_Ib = { "psllw", "psllw", Udq, Ib, XX },
+Ia_psllw_Vdq_Wdq = { "psllw", "psllw", Vdq, Wdq, XX },
+Ia_psrad_Nq_Ib = { "psrad", "psrad", Nq, Ib, XX },
+Ia_psrad_Pq_Qq = { "psrad", "psrad", Pq, Qq, XX },
+Ia_psrad_Udq_Ib = { "psrad", "psrad", Udq, Ib, XX },
+Ia_psrad_Vdq_Wdq = { "psrad", "psrad", Vdq, Wdq, XX },
+Ia_psraw_Nq_Ib = { "psraw", "psraw", Nq, Ib, XX },
+Ia_psraw_Pq_Qq = { "psraw", "psraw", Pq, Qq, XX },
+Ia_psraw_Udq_Ib = { "psraw", "psraw", Udq, Ib, XX },
+Ia_psraw_Vdq_Wdq = { "psraw", "psraw", Vdq, Wdq, XX },
+Ia_psrld_Nq_Ib = { "psrld", "psrld", Nq, Ib, XX },
+Ia_psrld_Pq_Qq = { "psrld", "psrld", Pq, Qq, XX },
+Ia_psrld_Udq_Ib = { "psrld", "psrld", Udq, Ib, XX },
+Ia_psrld_Vdq_Wdq = { "psrld", "psrld", Vdq, Wdq, XX },
+Ia_psrldq_Udq_Ib = { "psrldq", "psrldq", Udq, Ib, XX },
+Ia_psrlq_Nq_Ib = { "psrlq", "psrlq", Nq, Ib, XX },
+Ia_psrlq_Pq_Qq = { "psrlq", "psrlq", Pq, Qq, XX },
+Ia_psrlq_Udq_Ib = { "psrlq", "psrlq", Udq, Ib, XX },
+Ia_psrlq_Vdq_Wdq = { "psrlq", "psrlq", Vdq, Wdq, XX },
+Ia_psrlw_Nq_Ib = { "psrlw", "psrlw", Nq, Ib, XX },
+Ia_psrlw_Pq_Qq = { "psrlw", "psrlw", Pq, Qq, XX },
+Ia_psrlw_Udq_Ib = { "psrlw", "psrlw", Udq, Ib, XX },
+Ia_psrlw_Vdq_Wdq = { "psrlw", "psrlw", Vdq, Wdq, XX },
+Ia_psubb_Pq_Qq = { "psubb", "psubb", Pq, Qq, XX },
+Ia_psubb_Vdq_Wdq = { "psubb", "psubb", Vdq, Wdq, XX },
+Ia_psubd_Pq_Qq = { "psubd", "psubd", Pq, Qq, XX },
+Ia_psubd_Vdq_Wdq = { "psubd", "psubd", Vdq, Wdq, XX },
+Ia_psubq_Pq_Qq = { "psubq", "psubq", Pq, Qq, XX },
+Ia_psubq_Vdq_Wdq = { "psubq", "psubq", Vdq, Wdq, XX },
+Ia_psubsb_Pq_Qq = { "psubsb", "psubsb", Pq, Qq, XX },
+Ia_psubsb_Vdq_Wdq = { "psubsb", "psubsb", Vdq, Wdq, XX },
+Ia_psubsw_Pq_Qq = { "psubsw", "psubsw", Pq, Qq, XX },
+Ia_psubsw_Vdq_Wdq = { "psubsw", "psubsw", Vdq, Wdq, XX },
+Ia_psubusb_Pq_Qq = { "psubusb", "psubusb", Pq, Qq, XX },
+Ia_psubusb_Vdq_Wdq = { "psubusb", "psubusb", Vdq, Wdq, XX },
+Ia_psubusw_Pq_Qq = { "psubusw", "psubusw", Pq, Qq, XX },
+Ia_psubusw_Vdq_Wdq = { "psubusw", "psubusw", Vdq, Wdq, XX },
+Ia_psubw_Pq_Qq = { "psubw", "psubw", Pq, Qq, XX },
+Ia_psubw_Vdq_Wdq = { "psubw", "psubw", Vdq, Wdq, XX },
+Ia_pswapd_Pq_Qq = { "pswapd", "pswapd", Pq, Qq, XX },
+Ia_punpckhbw_Pq_Qq = { "punpckhbw", "punpckhbw", Pq, Qq, XX },
+Ia_punpckhbw_Vdq_Wq = { "punpckhbw", "punpckhbw", Vdq, Wq, XX },
+Ia_punpckhdq_Pq_Qq = { "punpckhdq", "punpckhdq", Pq, Qq, XX },
+Ia_punpckhdq_Vdq_Wq = { "punpckhdq", "punpckhdq", Vdq, Wq, XX },
+Ia_punpckhqdq_Vdq_Wq = { "punpckhqdq", "punpckhqdq", Vdq, Wq, XX },
+Ia_punpckhwd_Pq_Qq = { "punpckhwd", "punpckhwd", Pq, Qq, XX },
+Ia_punpckhwd_Vdq_Wq = { "punpckhwd", "punpckhwd", Vdq, Wq, XX },
+Ia_punpcklbw_Pq_Qd = { "punpcklbw", "punpcklbw", Pq, Qd, XX },
+Ia_punpcklbw_Vdq_Wq = { "punpcklbw", "punpcklbw", Vdq, Wq, XX },
+Ia_punpckldq_Pq_Qd = { "punpckldq", "punpckldq", Pq, Qd, XX },
+Ia_punpckldq_Vdq_Wq = { "punpckldq", "punpckldq", Vdq, Wq, XX },
+Ia_punpcklqdq_Vdq_Wq = { "punpcklqdq", "punpcklqdq", Vdq, Wq, XX },
+Ia_punpcklwd_Pq_Qd = { "punpcklwd", "punpcklwd", Pq, Qd, XX },
+Ia_punpcklwd_Vdq_Wq = { "punpcklwd", "punpcklwd", Vdq, Wq, XX },
+Ia_pushal = { "pushad", "pushal", XX, XX, XX },
+Ia_pushaw = { "pusha", "pusha", XX, XX, XX },
+Ia_pushfl = { "pushfd", "pushfl", XX, XX, XX },
+Ia_pushfq = { "pushfq", "pushfq", XX, XX, XX },
+Ia_pushfw = { "pushf", "pushf", XX, XX, XX },
+Ia_pushl_CS = { "push", "pushl", CS, XX, XX },
+Ia_pushl_DS = { "push", "pushl", DS, XX, XX },
+Ia_pushl_Ed = { "push", "pushl", Ed, XX, XX },
+Ia_pushl_ERX = { "push", "pushl", ERX, XX, XX },
+Ia_pushl_ES = { "push", "pushl", ES, XX, XX },
+Ia_pushl_FS = { "push", "pushl", FS, XX, XX },
+Ia_pushl_GS = { "push", "pushl", GS, XX, XX },
+Ia_pushl_Id = { "push", "pushl", Id, XX, XX },
+Ia_pushl_sIb = { "push", "pushl", sIbd, XX, XX },
+Ia_pushl_SS = { "push", "pushl", SS, XX, XX },
+Ia_pushq_Eq = { "push", "pushq", Eq, XX, XX },
+Ia_pushq_FS = { "push", "pushq", FS, XX, XX },
+Ia_pushq_GS = { "push", "pushq", GS, XX, XX },
+Ia_pushq_RRX = { "push", "pushq", RRX, XX, XX },
+Ia_pushq_sIb = { "push", "pushq", sIbq, XX, XX },
+Ia_pushq_sId = { "push", "pushq", sIdq, XX, XX },
+Ia_pushw_CS = { "push", "pushw", CS, XX, XX },
+Ia_pushw_DS = { "push", "pushw", DS, XX, XX },
+Ia_pushw_ES = { "push", "pushw", ES, XX, XX },
+Ia_pushw_Ew = { "push", "pushw", Ew, XX, XX },
+Ia_pushw_FS = { "push", "pushw", FS, XX, XX },
+Ia_pushw_GS = { "push", "pushw", GS, XX, XX },
+Ia_pushw_Iw = { "push", "pushw", Iw, XX, XX },
+Ia_pushw_RX = { "push", "pushw", RX, XX, XX },
+Ia_pushw_sIb = { "push", "pushw", sIbw, XX, XX },
+Ia_pushw_SS = { "push", "pushw", SS, XX, XX },
+Ia_pxor_Pq_Qq = { "pxor", "pxor", Pq, Qq, XX },
+Ia_pxor_Vdq_Wdq = { "pxor", "pxor", Vdq, Wdq, XX },
+Ia_rclb_Eb_CL = { "rcl", "rclb", Eb, CL, XX },
+Ia_rclb_Eb_I1 = { "rcl", "rclb", Eb, I1, XX },
+Ia_rclb_Eb_Ib = { "rcl", "rclb", Eb, Ib, XX },
+Ia_rcll_Ed_CL = { "rcl", "rcll", Ed, CL, XX },
+Ia_rcll_Ed_I1 = { "rcl", "rcll", Ed, I1, XX },
+Ia_rcll_Ed_Ib = { "rcl", "rcll", Ed, Ib, XX },
+Ia_rclq_Eq_CL = { "rcl", "rclq", Eq, CL, XX },
+Ia_rclq_Eq_I1 = { "rcl", "rclq", Eq, I1, XX },
+Ia_rclq_Eq_Ib = { "rcl", "rclq", Eq, Ib, XX },
+Ia_rclw_Ew_CL = { "rcl", "rclw", Ew, CL, XX },
+Ia_rclw_Ew_I1 = { "rcl", "rclw", Ew, I1, XX },
+Ia_rclw_Ew_Ib = { "rcl", "rclw", Ew, Ib, XX },
+Ia_rcpps_Vps_Wps = { "rcpps", "rcpps", Vps, Wps, XX },
+Ia_rcpss_Vss_Wss = { "rcpss", "rcpss", Vss, Wss, XX },
+Ia_rcrb_Eb_CL = { "rcr", "rcrb", Eb, CL, XX },
+Ia_rcrb_Eb_I1 = { "rcr", "rcrb", Eb, I1, XX },
+Ia_rcrb_Eb_Ib = { "rcr", "rcrb", Eb, Ib, XX },
+Ia_rcrl_Ed_CL = { "rcr", "rcrl", Ed, CL, XX },
+Ia_rcrl_Ed_I1 = { "rcr", "rcrl", Ed, I1, XX },
+Ia_rcrl_Ed_Ib = { "rcr", "rcrl", Ed, Ib, XX },
+Ia_rcrq_Eq_CL = { "rcr", "rcrq", Eq, CL, XX },
+Ia_rcrq_Eq_I1 = { "rcr", "rcrq", Eq, I1, XX },
+Ia_rcrq_Eq_Ib = { "rcr", "rcrq", Eq, Ib, XX },
+Ia_rcrw_Ew_CL = { "rcr", "rcrw", Ew, CL, XX },
+Ia_rcrw_Ew_I1 = { "rcr", "rcrw", Ew, I1, XX },
+Ia_rcrw_Ew_Ib = { "rcr", "rcrw", Ew, Ib, XX },
+Ia_rdmsr = { "rdmsr", "rdmsr", XX, XX, XX },
+Ia_rdpmc = { "rdpmc", "rdpmc", XX, XX, XX },
+Ia_rdtsc = { "rdtsc", "rdtsc", XX, XX, XX },
+Ia_rdtscp = { "rdtscp", "rdtscp", XX, XX, XX },
+Ia_ret = { "ret", "ret", XX, XX, XX },
+Ia_ret_Iw = { "ret", "ret", Iw, XX, XX },
+Ia_rolb_Eb_CL = { "rol", "rolb", Eb, CL, XX },
+Ia_rolb_Eb_I1 = { "rol", "rolb", Eb, I1, XX },
+Ia_rolb_Eb_Ib = { "rol", "rolb", Eb, Ib, XX },
+Ia_roll_Ed_CL = { "rol", "roll", Ed, CL, XX },
+Ia_roll_Ed_I1 = { "rol", "roll", Ed, I1, XX },
+Ia_roll_Ed_Ib = { "rol", "roll", Ed, Ib, XX },
+Ia_rolq_Eq_CL = { "rol", "rolq", Eq, CL, XX },
+Ia_rolq_Eq_I1 = { "rol", "rolq", Eq, I1, XX },
+Ia_rolq_Eq_Ib = { "rol", "rolq", Eq, Ib, XX },
+Ia_rolw_Ew_CL = { "rol", "rolw", Ew, CL, XX },
+Ia_rolw_Ew_I1 = { "rol", "rolw", Ew, I1, XX },
+Ia_rolw_Ew_Ib = { "rol", "rolw", Ew, Ib, XX },
+Ia_rorb_Eb_CL = { "ror", "rorb", Eb, CL, XX },
+Ia_rorb_Eb_I1 = { "ror", "rorb", Eb, I1, XX },
+Ia_rorb_Eb_Ib = { "ror", "rorb", Eb, Ib, XX },
+Ia_rorl_Ed_CL = { "ror", "rorl", Ed, CL, XX },
+Ia_rorl_Ed_I1 = { "ror", "rorl", Ed, I1, XX },
+Ia_rorl_Ed_Ib = { "ror", "rorl", Ed, Ib, XX },
+Ia_rorq_Eq_CL = { "ror", "rorq", Eq, CL, XX },
+Ia_rorq_Eq_I1 = { "ror", "rorq", Eq, I1, XX },
+Ia_rorq_Eq_Ib = { "ror", "rorq", Eq, Ib, XX },
+Ia_rorw_Ew_CL = { "ror", "rorw", Ew, CL, XX },
+Ia_rorw_Ew_I1 = { "ror", "rorw", Ew, I1, XX },
+Ia_rorw_Ew_Ib = { "ror", "rorw", Ew, Ib, XX },
+Ia_rsm = { "rsm", "rsm", XX, XX, XX },
+Ia_rsqrtps_Vps_Wps = { "rsqrtps", "rsqrtps", Vps, Wps, XX },
+Ia_rsqrtss_Vss_Wss = { "rsqrtss", "rsqrtss", Vss, Wss, XX },
+Ia_sahf = { "sahf", "sahf", XX, XX, XX },
+Ia_salc = { "salc", "salc", XX, XX, XX },
+Ia_sarb_Eb_CL = { "sar", "sarb", Eb, CL, XX },
+Ia_sarb_Eb_I1 = { "sar", "sarb", Eb, I1, XX },
+Ia_sarb_Eb_Ib = { "sar", "sarb", Eb, Ib, XX },
+Ia_sarl_Ed_CL = { "sar", "sarl", Ed, CL, XX },
+Ia_sarl_Ed_I1 = { "sar", "sarl", Ed, I1, XX },
+Ia_sarl_Ed_Ib = { "sar", "sarl", Ed, Ib, XX },
+Ia_sarq_Eq_CL = { "sar", "sarq", Eq, CL, XX },
+Ia_sarq_Eq_I1 = { "sar", "sarq", Eq, I1, XX },
+Ia_sarq_Eq_Ib = { "sar", "sarq", Eq, Ib, XX },
+Ia_sarw_Ew_CL = { "sar", "sarw", Ew, CL, XX },
+Ia_sarw_Ew_I1 = { "sar", "sarw", Ew, I1, XX },
+Ia_sarw_Ew_Ib = { "sar", "sarw", Ew, Ib, XX },
+Ia_sbbb_AL_Ib = { "sbb", "sbbb", AL, Ib, XX },
+Ia_sbbb_Eb_Gb = { "sbb", "sbbb", Eb, Gb, XX },
+Ia_sbbb_Eb_Ib = { "sbb", "sbbb", Eb, Ib, XX },
+Ia_sbbb_Gb_Eb = { "sbb", "sbbb", Gb, Eb, XX },
+Ia_sbbl_EAX_Id = { "sbb", "sbbl", EAX, Id, XX },
+Ia_sbbl_Ed_Gd = { "sbb", "sbbl", Ed, Gd, XX },
+Ia_sbbl_Ed_Id = { "sbb", "sbbl", Ed, Id, XX },
+Ia_sbbl_Ed_sIb = { "sbb", "sbbl", Ed, sIbd, XX },
+Ia_sbbl_Gd_Ed = { "sbb", "sbbl", Gd, Ed, XX },
+Ia_sbbq_Eq_Gq = { "sbb", "sbbq", Eq, Gq, XX },
+Ia_sbbq_Eq_sIb = { "sbb", "sbbq", Eq, sIbq, XX },
+Ia_sbbq_Eq_sId = { "sbb", "sbbq", Eq, sIdq, XX },
+Ia_sbbq_Gq_Eq = { "sbb", "sbbq", Gq, Eq, XX },
+Ia_sbbq_RAX_sId = { "sbb", "sbbq", RAX, sIdq, XX },
+Ia_sbbw_AX_Iw = { "sbb", "sbbw", AX, Iw, XX },
+Ia_sbbw_Ew_Gw = { "sbb", "sbbw", Ew, Gw, XX },
+Ia_sbbw_Ew_Iw = { "sbb", "sbbw", Ew, Iw, XX },
+Ia_sbbw_Ew_sIb = { "sbb", "sbbw", Ew, sIbw, XX },
+Ia_sbbw_Gw_Ew = { "sbb", "sbbw", Gw, Ew, XX },
+Ia_scasb_Yb_AL = { "scasb", "scasb", Yb, AL, XX },
+Ia_scasl_Yd_EAX = { "scasd", "scasl", Yd, EAX, XX },
+Ia_scasq_Yq_RAX = { "scasq", "scasq", Yq, RAX, XX },
+Ia_scasw_Yw_AX = { "scasw", "scasw", Yw, AX, XX },
+Ia_setb_Eb = { "setb", "setb", Eb, XX, XX },
+Ia_setbe_Eb = { "setbe", "setbe", Eb, XX, XX },
+Ia_setl_Eb = { "setl", "setl", Eb, XX, XX },
+Ia_setle_Eb = { "setle", "setle", Eb, XX, XX },
+Ia_setnb_Eb = { "setnb", "setnb", Eb, XX, XX },
+Ia_setnbe_Eb = { "setnbe", "setnbe", Eb, XX, XX },
+Ia_setnl_Eb = { "setnl", "setnl", Eb, XX, XX },
+Ia_setnle_Eb = { "setnle", "setnle", Eb, XX, XX },
+Ia_setno_Eb = { "setno", "setno", Eb, XX, XX },
+Ia_setnp_Eb = { "setnp", "setnp", Eb, XX, XX },
+Ia_setns_Eb = { "setns", "setns", Eb, XX, XX },
+Ia_setnz_Eb = { "setnz", "setnz", Eb, XX, XX },
+Ia_seto_Eb = { "seto", "seto", Eb, XX, XX },
+Ia_setp_Eb = { "setp", "setp", Eb, XX, XX },
+Ia_sets_Eb = { "sets", "sets", Eb, XX, XX },
+Ia_setz_Eb = { "setz", "setz", Eb, XX, XX },
+Ia_sfence = { "sfence", "sfence", XX, XX, XX },
+Ia_sgdt = { "sgdt", "sgdt", Ms, XX, XX },
+Ia_shlb_Eb_CL = { "shl", "shlb", Eb, CL, XX },
+Ia_shlb_Eb_I1 = { "shl", "shlb", Eb, I1, XX },
+Ia_shlb_Eb_Ib = { "shl", "shlb", Eb, Ib, XX },
+Ia_shldl_Ed_Gd_CL = { "shld", "shldl", Ed, Gd, CL },
+Ia_shldl_Ed_Gd_Ib = { "shld", "shldl", Ed, Gd, Ib },
+Ia_shldq_Eq_Gq_CL = { "shld", "shldq", Eq, Gq, CL },
+Ia_shldq_Eq_Gq_Ib = { "shld", "shldq", Eq, Gq, Ib },
+Ia_shldw_Ew_Gw_CL = { "shld", "shldw", Ew, Gw, CL },
+Ia_shldw_Ew_Gw_Ib = { "shld", "shldw", Ew, Gw, Ib },
+Ia_shll_Ed_CL = { "shl", "shll", Ed, CL, XX },
+Ia_shll_Ed_I1 = { "shl", "shll", Ed, I1, XX },
+Ia_shll_Ed_Ib = { "shl", "shll", Ed, Ib, XX },
+Ia_shlq_Eq_CL = { "shl", "shlq", Eq, CL, XX },
+Ia_shlq_Eq_I1 = { "shl", "shlq", Eq, I1, XX },
+Ia_shlq_Eq_Ib = { "shl", "shlq", Eq, Ib, XX },
+Ia_shlw_Ew_CL = { "shl", "shlw", Ew, CL, XX },
+Ia_shlw_Ew_I1 = { "shl", "shlw", Ew, I1, XX },
+Ia_shlw_Ew_Ib = { "shl", "shlw", Ew, Ib, XX },
+Ia_shrb_Eb_CL = { "shr", "shrb", Eb, CL, XX },
+Ia_shrb_Eb_I1 = { "shr", "shrb", Eb, I1, XX },
+Ia_shrb_Eb_Ib = { "shr", "shrb", Eb, Ib, XX },
+Ia_shrdl_Ed_Gd_CL = { "shrd", "shrdl", Ed, Gd, CL },
+Ia_shrdl_Ed_Gd_Ib = { "shrd", "shrdl", Ed, Gd, Ib },
+Ia_shrdq_Eq_Gq_CL = { "shrd", "shrdq", Eq, Gq, CL },
+Ia_shrdq_Eq_Gq_Ib = { "shrd", "shrdq", Eq, Gq, Ib },
+Ia_shrdw_Ew_Gw_CL = { "shrd", "shrdw", Ew, Gw, CL },
+Ia_shrdw_Ew_Gw_Ib = { "shrd", "shrdw", Ew, Gw, Ib },
+Ia_shrl_Ed_CL = { "shr", "shrl", Ed, CL, XX },
+Ia_shrl_Ed_I1 = { "shr", "shrl", Ed, I1, XX },
+Ia_shrl_Ed_Ib = { "shr", "shrl", Ed, Ib, XX },
+Ia_shrq_Eq_CL = { "shr", "shrq", Eq, CL, XX },
+Ia_shrq_Eq_I1 = { "shr", "shrq", Eq, I1, XX },
+Ia_shrq_Eq_Ib = { "shr", "shrq", Eq, Ib, XX },
+Ia_shrw_Ew_CL = { "shr", "shrw", Ew, CL, XX },
+Ia_shrw_Ew_I1 = { "shr", "shrw", Ew, I1, XX },
+Ia_shrw_Ew_Ib = { "shr", "shrw", Ew, Ib, XX },
+Ia_shufpd_Vpd_Wpd_Ib = { "shufpd", "shufpd", Vpd, Wpd, Ib },
+Ia_shufps_Vps_Wps_Ib = { "shufps", "shufps", Vps, Wps, Ib },
+Ia_sidt = { "sidt", "sidt", Ms, XX, XX },
+Ia_sldt = { "sldt", "sldt", Ew, XX, XX },
+Ia_smsw_Ew = { "smsw", "smsw", Ew, XX, XX },
+Ia_sqrtpd_Vpd_Wpd = { "sqrtpd", "sqrtpd", Vpd, Wpd, XX },
+Ia_sqrtps_Vps_Wps = { "sqrtps", "sqrtps", Vps, Wps, XX },
+Ia_sqrtsd_Vsd_Wsd = { "sqrtsd", "sqrtsd", Vsd, Wsd, XX },
+Ia_sqrtss_Vss_Wss = { "sqrtss", "sqrtss", Vss, Wss, XX },
+Ia_stc = { "stc", "stc", XX, XX, XX },
+Ia_std = { "std", "std", XX, XX, XX },
+Ia_sti = { "sti", "sti", XX, XX, XX },
+Ia_stmxcsr = { "stmxcsr", "stmxcsr", Md, XX, XX },
+Ia_stosb_Yb_AL = { "stosb", "stosb", Yb, AL, XX },
+Ia_stosl_Yd_EAX = { "stosd", "stosl", Yd, EAX, XX },
+Ia_stosq_Yq_RAX = { "stosq", "stosq", Yq, RAX, XX },
+Ia_stosw_Yw_AX = { "stosw", "stosw", Yw, AX, XX },
+Ia_str = { "str", "str", Ew, XX, XX },
+Ia_subb_AL_Ib = { "sub", "subb", AL, Ib, XX },
+Ia_subb_Eb_Gb = { "sub", "subb", Eb, Gb, XX },
+Ia_subb_Eb_Ib = { "sub", "subb", Eb, Ib, XX },
+Ia_subb_Gb_Eb = { "sub", "subb", Gb, Eb, XX },
+Ia_subl_EAX_Id = { "sub", "subl", EAX, Id, XX },
+Ia_subl_Ed_Gd = { "sub", "subl", Ed, Gd, XX },
+Ia_subl_Ed_Id = { "sub", "subl", Ed, Id, XX },
+Ia_subl_Ed_sIb = { "sub", "subl", Ed, sIbd, XX },
+Ia_subl_Gd_Ed = { "sub", "subl", Gd, Ed, XX },
+Ia_subpd_Vpd_Wpd = { "subpd", "subpd", Vpd, Wpd, XX },
+Ia_subps_Vps_Wps = { "subps", "subps", Vps, Wps, XX },
+Ia_subq_Eq_Gq = { "sub", "subq", Eq, Gq, XX },
+Ia_subq_Eq_sIb = { "sub", "subq", Eq, sIbq, XX },
+Ia_subq_Eq_sId = { "sub", "subq", Eq, sIdq, XX },
+Ia_subq_Gq_Eq = { "sub", "subq", Gq, Eq, XX },
+Ia_subq_RAX_sId = { "sub", "subq", RAX, sIdq, XX },
+Ia_subsd_Vsd_Wsd = { "subsd", "subsd", Vsd, Wsd, XX },
+Ia_subss_Vss_Wss = { "subss", "subss", Vss, Wss, XX },
+Ia_subw_AX_Iw = { "sub", "subw", AX, Iw, XX },
+Ia_subw_Ew_Gw = { "sub", "subw", Ew, Gw, XX },
+Ia_subw_Ew_Iw = { "sub", "subw", Ew, Iw, XX },
+Ia_subw_Ew_sIb = { "sub", "subw", Ew, sIbw, XX },
+Ia_subw_Gw_Ew = { "sub", "subw", Gw, Ew, XX },
+Ia_swapgs = { "swapgs", "swapgs", XX, XX, XX },
+Ia_syscall = { "syscall", "syscall", XX, XX, XX },
+Ia_sysenter = { "sysenter", "sysenter", XX, XX, XX },
+Ia_sysexit = { "sysexit", "sysexit", XX, XX, XX },
+Ia_sysret = { "sysret", "sysret", XX, XX, XX },
+Ia_testb_AL_Ib = { "test", "testb", AL, Ib, XX },
+Ia_testb_Eb_Gb = { "test", "testb", Eb, Gb, XX },
+Ia_testb_Eb_Ib = { "test", "testb", Eb, Ib, XX },
+Ia_testl_EAX_Id = { "test", "testl", EAX, Id, XX },
+Ia_testl_Ed_Gd = { "test", "testl", Ed, Gd, XX },
+Ia_testl_Ed_Id = { "test", "testl", Ed, Id, XX },
+Ia_testq_Eq_Gq = { "test", "testq", Eq, Gq, XX },
+Ia_testq_Eq_sId = { "test", "testq", Eq, sIdq, XX },
+Ia_testq_RAX_sId = { "test", "testq", RAX, sIdq, XX },
+Ia_testw_AX_Iw = { "test", "testw", AX, Iw, XX },
+Ia_testw_Ew_Gw = { "test", "testw", Ew, Gw, XX },
+Ia_testw_Ew_Iw = { "test", "testw", Ew, Iw, XX },
+Ia_ucomisd_Vsd_Wss = { "ucomisd", "ucomisd", Vsd, Wsd, XX },
+Ia_ucomiss_Vss_Wss = { "ucomiss", "ucomiss", Vss, Wss, XX },
+Ia_ud2a = { "ud2a", "ud2a", XX, XX, XX },
+Ia_ud2b = { "ud2b", "ud2b", XX, XX, XX },
+Ia_unpckhpd_Vpd_Wdq = { "unpckhpd", "unpckhpd", Vpd, Wdq, XX },
+Ia_unpckhps_Vps_Wdq = { "unpckhps", "unpckhps", Vps, Wdq, XX },
+Ia_unpcklpd_Vpd_Wq = { "unpcklpd", "unpcklpd", Vpd, Wq, XX },
+Ia_unpcklps_Vps_Wq = { "unpcklps", "unpcklps", Vps, Wq, XX },
+Ia_verr = { "verr", "verr", Ew, XX, XX },
+Ia_verw = { "verw", "verw", Ew, XX, XX },
+Ia_wbinvd = { "wbinvd", "wbinvd", XX, XX, XX },
+Ia_wrmsr = { "wrmsr", "wrmsr", XX, XX, XX },
+Ia_xaddb_Eb_Gb = { "xadd", "xaddb", Eb, Gb, XX },
+Ia_xaddl_Ed_Gd = { "xadd", "xaddl", Ed, Gd, XX },
+Ia_xaddq_Eq_Gq = { "xadd", "xaddq", Eq, Gq, XX },
+Ia_xaddw_Ew_Gw = { "xadd", "xaddw", Ew, Gw, XX },
+Ia_xchgb_Eb_Gb = { "xchg", "xchgb", Eb, Gb, XX },
+Ia_xchgl_Ed_Gd = { "xchg", "xchgl", Ed, Gd, XX },
+Ia_xchgl_ERX_EAX = { "xchg", "xchgl", ERX, EAX, XX },
+Ia_xchgq_Eq_Gq = { "xchg", "xchgq", Eq, Gq, XX },
+Ia_xchgq_RRX_RAX = { "xchg", "xchgq", RRX, RAX, XX },
+Ia_xchgw_Ew_Gw = { "xchg", "xchgw", Ew, Gw, XX },
+Ia_xchgw_RX_AX = { "xchg", "xchgw", RX, AX, XX },
+Ia_xlat = { "xlat", "xlat", XX, XX, XX },
+Ia_xorb_AL_Ib = { "xor", "xorb", AL, Ib, XX },
+Ia_xorb_Eb_Gb = { "xor", "xorb", Eb, Gb, XX },
+Ia_xorb_Eb_Ib = { "xor", "xorb", Eb, Ib, XX },
+Ia_xorb_Gb_Eb = { "xor", "xorb", Gb, Eb, XX },
+Ia_xorl_EAX_Id = { "xor", "xorl", EAX, Id, XX },
+Ia_xorl_Ed_Gd = { "xor", "xorl", Ed, Gd, XX },
+Ia_xorl_Ed_Id = { "xor", "xorl", Ed, Id, XX },
+Ia_xorl_Ed_sIb = { "xor", "xorl", Ed, sIbd, XX },
+Ia_xorl_Gd_Ed = { "xor", "xorl", Gd, Ed, XX },
+Ia_xorpd_Vpd_Wpd = { "xorpd", "xorpd", Vpd, Wpd, XX },
+Ia_xorps_Vps_Wps = { "xorps", "xorps", Vps, Wps, XX },
+Ia_xorq_Eq_Gq = { "xor", "xorq", Eq, Gq, XX },
+Ia_xorq_Eq_sIb = { "xor", "xorq", Eq, sIbq, XX },
+Ia_xorq_Eq_sId = { "xor", "xorq", Eq, sIdq, XX },
+Ia_xorq_Gq_Eq = { "xor", "xorq", Gq, Eq, XX },
+Ia_xorq_RAX_sId = { "xor", "xorq", RAX, sIdq, XX },
+Ia_xorw_AX_Iw = { "xor", "xorw", AX, Iw, XX },
+Ia_xorw_Ew_Gw = { "xor", "xorw", Ew, Gw, XX },
+Ia_xorw_Ew_Iw = { "xor", "xorw", Ew, Iw, XX },
+Ia_xorw_Ew_sIb = { "xor", "xorw", Ew, sIbw, XX },
+Ia_xorw_Gw_Ew = { "xor", "xorw", Gw, Ew, XX };
diff --git a/Externals/Bochs_disasm/resolve.cpp b/Externals/Bochs_disasm/resolve.cpp
new file mode 100644
index 0000000000..3bf2d344dc
--- /dev/null
+++ b/Externals/Bochs_disasm/resolve.cpp
@@ -0,0 +1,460 @@
+/////////////////////////////////////////////////////////////////////////
+// $Id: resolve.cc,v 1.13 2006/08/11 17:22:43 sshwarts Exp $
+/////////////////////////////////////////////////////////////////////////
+#include
+#include
+#include "disasm.h"
+
+void disassembler::decode_modrm(x86_insn *insn)
+{
+ insn->modrm = fetch_byte();
+ BX_DECODE_MODRM(insn->modrm, insn->mod, insn->nnn, insn->rm);
+ // MOVs with CRx and DRx always use register ops and ignore the mod field.
+ if ((insn->b1 & ~3) == 0x120) insn->mod = 3;
+ insn->nnn |= insn->rex_r;
+
+ if (insn->mod == 3) {
+ /* mod, reg, reg */
+ insn->rm |= insn->rex_b;
+ return;
+ }
+
+ if (insn->as_64)
+ {
+ if (insn->rm != 4) { /* rm != 100b, no s-i-b byte */
+ insn->rm |= insn->rex_b;
+ // one byte modrm
+ switch (insn->mod) {
+ case 0:
+ resolve_modrm = &disassembler::resolve64_mod0;
+ if ((insn->rm & 7) == 5) /* no reg, 32-bit displacement */
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ case 1:
+ /* reg, 8-bit displacement, sign extend */
+ resolve_modrm = &disassembler::resolve64_mod1or2;
+ insn->displacement.displ32 = (Bit8s) fetch_byte();
+ break;
+ case 2:
+ /* reg, 32-bit displacement */
+ resolve_modrm = &disassembler::resolve64_mod1or2;
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ } /* switch (mod) */
+ } /* if (rm != 4) */
+ else { /* rm == 4, s-i-b byte follows */
+ insn->sib = fetch_byte();
+ BX_DECODE_SIB(insn->sib, insn->scale, insn->index, insn->base);
+ insn->base |= insn->rex_b;
+ insn->index |= insn->rex_x;
+
+ switch (insn->mod) {
+ case 0:
+ resolve_modrm = &disassembler::resolve64_mod0_rm4;
+ if ((insn->base & 7) == 5)
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ case 1:
+ resolve_modrm = &disassembler::resolve64_mod1or2_rm4;
+ insn->displacement.displ32 = (Bit8s) fetch_byte();
+ break;
+ case 2:
+ resolve_modrm = &disassembler::resolve64_mod1or2_rm4;
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ }
+ } /* s-i-b byte follows */
+ }
+ else
+ {
+ if (insn->as_32)
+ {
+ if (insn->rm != 4) { /* rm != 100b, no s-i-b byte */
+ insn->rm |= insn->rex_b;
+ // one byte modrm
+ switch (insn->mod) {
+ case 0:
+ resolve_modrm = &disassembler::resolve32_mod0;
+ if ((insn->rm & 7) == 5) /* no reg, 32-bit displacement */
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ case 1:
+ /* reg, 8-bit displacement, sign extend */
+ resolve_modrm = &disassembler::resolve32_mod1or2;
+ insn->displacement.displ32 = (Bit8s) fetch_byte();
+ break;
+ case 2:
+ /* reg, 32-bit displacement */
+ resolve_modrm = &disassembler::resolve32_mod1or2;
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ } /* switch (mod) */
+ } /* if (rm != 4) */
+ else { /* rm == 4, s-i-b byte follows */
+ insn->sib = fetch_byte();
+ BX_DECODE_SIB(insn->sib, insn->scale, insn->index, insn->base);
+ insn->base |= insn->rex_b;
+ insn->index |= insn->rex_x;
+
+ switch (insn->mod) {
+ case 0:
+ resolve_modrm = &disassembler::resolve32_mod0_rm4;
+ if ((insn->base & 7) == 5)
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ case 1:
+ resolve_modrm = &disassembler::resolve32_mod1or2_rm4;
+ insn->displacement.displ32 = (Bit8s) fetch_byte();
+ break;
+ case 2:
+ resolve_modrm = &disassembler::resolve32_mod1or2_rm4;
+ insn->displacement.displ32 = fetch_dword();
+ break;
+ }
+ } /* s-i-b byte follows */
+ }
+ else {
+ assert(insn->rex_b == 0);
+ assert(insn->rex_x == 0);
+ assert(insn->rex_r == 0);
+ /* 16 bit addressing modes. */
+ switch (insn->mod) {
+ case 0:
+ resolve_modrm = &disassembler::resolve16_mod0;
+ if(insn->rm == 6)
+ insn->displacement.displ16 = fetch_word();
+ break;
+ case 1:
+ /* reg, 8-bit displacement, sign extend */
+ resolve_modrm = &disassembler::resolve16_mod1or2;
+ insn->displacement.displ16 = (Bit8s) fetch_byte();
+ break;
+ case 2:
+ resolve_modrm = &disassembler::resolve16_mod1or2;
+ insn->displacement.displ16 = fetch_word();
+ break;
+ } /* switch (mod) ... */
+ }
+ }
+}
+
+void disassembler::resolve16_mod0(const x86_insn *insn, unsigned mode)
+{
+ const char *seg;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod00_rm16[insn->rm];
+
+ if(insn->rm == 6)
+ print_memory_access16(mode, seg, NULL, insn->displacement.displ16);
+ else
+ print_memory_access16(mode, seg, index16[insn->rm], 0);
+}
+
+void disassembler::resolve16_mod1or2(const x86_insn *insn, unsigned mode)
+{
+ const char *seg;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod01or10_rm16[insn->rm];
+
+ print_memory_access16(mode, seg, index16[insn->rm], insn->displacement.displ16);
+}
+
+void disassembler::resolve32_mod0(const x86_insn *insn, unsigned mode)
+{
+ const char *seg;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = segment_name[DS_REG];
+
+ if ((insn->rm & 7) == 5) /* no reg, 32-bit displacement */
+ print_memory_access(mode, seg, NULL, NULL, 0, insn->displacement.displ32);
+ else
+ print_memory_access(mode, seg, general_32bit_regname[insn->rm], NULL, 0, 0);
+}
+
+void disassembler::resolve32_mod1or2(const x86_insn *insn, unsigned mode)
+{
+ const char *seg;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod01or10_rm32[insn->rm];
+
+ print_memory_access(mode, seg,
+ general_32bit_regname[insn->rm], NULL, 0, insn->displacement.displ32);
+}
+
+void disassembler::resolve32_mod0_rm4(const x86_insn *insn, unsigned mode)
+{
+ const char *seg, *base = NULL, *index = NULL;
+ Bit32u disp32 = 0;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod00_base32[insn->base];
+
+ if ((insn->base & 7) != 5)
+ base = general_32bit_regname[insn->base];
+ else
+ disp32 = insn->displacement.displ32;
+
+ if (insn->index != 4)
+ index = general_32bit_regname[insn->index];
+
+ print_memory_access(mode, seg, base, index, insn->scale, disp32);
+}
+
+void disassembler::resolve32_mod1or2_rm4(const x86_insn *insn, unsigned mode)
+{
+ const char *seg, *index = NULL;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod01or10_base32[insn->base];
+
+ if (insn->index != 4)
+ index = general_32bit_regname[insn->index];
+
+ print_memory_access(mode, seg,
+ general_32bit_regname[insn->base], index, insn->scale, insn->displacement.displ32);
+}
+
+void disassembler::resolve64_mod0(const x86_insn *insn, unsigned mode)
+{
+ const char *seg, *rip_regname;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = segment_name[DS_REG];
+
+ if (intel_mode) rip_regname = "rip";
+ else rip_regname = "%rip";
+
+ if ((insn->rm & 7) == 5) /* no reg, 32-bit displacement */
+ print_memory_access(mode, seg, rip_regname, NULL, 0, insn->displacement.displ32);
+ else
+ print_memory_access(mode, seg, general_64bit_regname[insn->rm], NULL, 0, 0);
+}
+
+void disassembler::resolve64_mod1or2(const x86_insn *insn, unsigned mode)
+{
+ const char *seg;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod01or10_rm32[insn->rm];
+
+ print_memory_access(mode, seg,
+ general_64bit_regname[insn->rm], NULL, 0, insn->displacement.displ32);
+}
+
+void disassembler::resolve64_mod0_rm4(const x86_insn *insn, unsigned mode)
+{
+ const char *seg, *base = NULL, *index = NULL;
+ Bit32u disp32 = 0;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod00_base32[insn->base];
+
+ if ((insn->base & 7) != 5)
+ base = general_64bit_regname[insn->base];
+ else
+ disp32 = insn->displacement.displ32;
+
+ if (insn->index != 4)
+ index = general_64bit_regname[insn->index];
+
+ print_memory_access(mode, seg, base, index, insn->scale, disp32);
+}
+
+void disassembler::resolve64_mod1or2_rm4(const x86_insn *insn, unsigned mode)
+{
+ const char *seg, *index = NULL;
+
+ if (insn->is_seg_override())
+ seg = segment_name[insn->seg_override];
+ else
+ seg = sreg_mod01or10_base32[insn->base];
+
+ if (insn->index != 4)
+ index = general_64bit_regname[insn->index];
+
+ print_memory_access(mode, seg,
+ general_64bit_regname[insn->base], index, insn->scale, insn->displacement.displ32);
+}
+
+void disassembler::print_datasize(unsigned size)
+{
+ if (!intel_mode) return;
+
+ switch(size)
+ {
+ case B_SIZE:
+ dis_sprintf("byte ptr ");
+ break;
+ case W_SIZE:
+ dis_sprintf("word ptr ");
+ break;
+ case D_SIZE:
+ dis_sprintf("dword ptr ");
+ break;
+ case Q_SIZE:
+ dis_sprintf("qword ptr ");
+ break;
+ case O_SIZE:
+ dis_sprintf("dqword ptr ");
+ break;
+ case T_SIZE:
+ dis_sprintf("tbyte ptr ");
+ break;
+ case P_SIZE:
+ break;
+ case X_SIZE:
+ break;
+ };
+}
+
+void disassembler::print_memory_access16(int datasize,
+ const char *seg, const char *index, Bit16u disp)
+{
+ print_datasize(datasize);
+
+ if (intel_mode)
+ {
+ if (index == NULL)
+ {
+ dis_sprintf("%s:0x%x", seg, (unsigned) disp);
+ }
+ else
+ {
+ if (disp != 0)
+ dis_sprintf("%s:[%s+0x%x]", seg, index, (unsigned) disp);
+ else
+ dis_sprintf("%s:[%s]", seg, index);
+ }
+ }
+ else
+ {
+ if (index == NULL)
+ {
+ dis_sprintf("%s:0x%x", seg, (unsigned) disp);
+ }
+ else
+ {
+ if (disp != 0)
+ dis_sprintf("%s:0x%x(%s,1)", seg, (unsigned) disp, index);
+ else
+ dis_sprintf("%s:(%s,1)", seg, index);
+ }
+ }
+}
+
+void disassembler::print_memory_access(int datasize,
+ const char *seg, const char *base, const char *index, int scale, Bit32u disp)
+{
+ print_datasize(datasize);
+
+ if (intel_mode)
+ {
+ if (base == NULL)
+ {
+ if (index == NULL)
+ {
+ dis_sprintf("%s:0x%x", seg, (unsigned) disp);
+ }
+ else
+ {
+ if (scale != 0)
+ {
+ if (disp != 0)
+ dis_sprintf("%s:[%s*%d+0x%x]", seg, index, 1<
+#include
+#include
+
+
+
+// TODO: reference additional headers your program requires here
diff --git a/Externals/Bochs_disasm/syntax.cpp b/Externals/Bochs_disasm/syntax.cpp
new file mode 100644
index 0000000000..a53eb3991e
--- /dev/null
+++ b/Externals/Bochs_disasm/syntax.cpp
@@ -0,0 +1,254 @@
+/////////////////////////////////////////////////////////////////////////
+// $Id: syntax.cc,v 1.10 2006/04/27 15:11:45 sshwarts Exp $
+/////////////////////////////////////////////////////////////////////////
+#include
+#include "disasm.h"
+
+//////////////////
+// Intel STYLE
+//////////////////
+
+#define BX_DISASM_SUPPORT_X86_64
+
+#ifdef BX_DISASM_SUPPORT_X86_64
+
+static const char *intel_general_16bit_regname[16] = {
+ "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
+ "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
+};
+
+static const char *intel_general_32bit_regname[16] = {
+ "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
+ "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
+};
+
+static const char *intel_general_64bit_regname[16] = {
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
+};
+
+static const char *intel_general_8bit_regname_rex[16] = {
+ "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
+ "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
+};
+
+#else
+
+static const char *intel_general_16bit_regname[8] = {
+ "ax", "cx", "dx", "bx", "sp", "bp", "si", "di"
+};
+
+static const char *intel_general_32bit_regname[8] = {
+ "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
+};
+
+#endif
+
+static const char *intel_general_8bit_regname[8] = {
+ "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"
+};
+
+static const char *intel_segment_name[8] = {
+ "es", "cs", "ss", "ds", "fs", "gs", "??", "??"
+};
+
+static const char *intel_index16[8] = {
+ "bx+si",
+ "bx+di",
+ "bp+si",
+ "bp+di",
+ "si",
+ "di",
+ "bp",
+ "bx"
+};
+
+
+//////////////////
+// AT&T STYLE
+//////////////////
+
+#ifdef BX_DISASM_SUPPORT_X86_64
+
+static const char *att_general_16bit_regname[16] = {
+ "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
+ "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
+};
+
+static const char *att_general_32bit_regname[16] = {
+ "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
+ "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
+};
+
+static const char *att_general_64bit_regname[16] = {
+ "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
+ "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
+};
+
+static const char *att_general_8bit_regname_rex[16] = {
+ "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
+ "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
+};
+
+#else
+
+static const char *att_general_16bit_regname[8] = {
+ "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di"
+};
+
+static const char *att_general_32bit_regname[8] = {
+ "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi"
+};
+
+#endif
+
+static const char *att_general_8bit_regname[8] = {
+ "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh"
+};
+
+static const char *att_segment_name[8] = {
+ "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%??", "%??"
+};
+
+static const char *att_index16[8] = {
+ "%bx, %si",
+ "%bx, %di",
+ "%bp, %si",
+ "%bp, %di",
+ "%si",
+ "%di",
+ "%bp",
+ "%bx"
+};
+
+#define NULL_SEGMENT_REGISTER 7
+
+void disassembler::initialize_modrm_segregs()
+{
+ sreg_mod00_rm16[0] = segment_name[DS_REG];
+ sreg_mod00_rm16[1] = segment_name[DS_REG];
+ sreg_mod00_rm16[2] = segment_name[SS_REG];
+ sreg_mod00_rm16[3] = segment_name[SS_REG];
+ sreg_mod00_rm16[4] = segment_name[DS_REG];
+ sreg_mod00_rm16[5] = segment_name[DS_REG];
+ sreg_mod00_rm16[6] = segment_name[DS_REG];
+ sreg_mod00_rm16[7] = segment_name[DS_REG];
+
+ sreg_mod01or10_rm16[0] = segment_name[DS_REG];
+ sreg_mod01or10_rm16[1] = segment_name[DS_REG];
+ sreg_mod01or10_rm16[2] = segment_name[SS_REG];
+ sreg_mod01or10_rm16[3] = segment_name[SS_REG];
+ sreg_mod01or10_rm16[4] = segment_name[DS_REG];
+ sreg_mod01or10_rm16[5] = segment_name[DS_REG];
+ sreg_mod01or10_rm16[6] = segment_name[SS_REG];
+ sreg_mod01or10_rm16[7] = segment_name[DS_REG];
+
+ sreg_mod01or10_rm32[0] = segment_name[DS_REG];
+ sreg_mod01or10_rm32[1] = segment_name[DS_REG];
+ sreg_mod01or10_rm32[2] = segment_name[DS_REG];
+ sreg_mod01or10_rm32[3] = segment_name[DS_REG];
+ sreg_mod01or10_rm32[4] = segment_name[NULL_SEGMENT_REGISTER];
+ sreg_mod01or10_rm32[5] = segment_name[SS_REG];
+ sreg_mod01or10_rm32[6] = segment_name[DS_REG];
+ sreg_mod01or10_rm32[7] = segment_name[DS_REG];
+
+ sreg_mod00_base32[0] = segment_name[DS_REG];
+ sreg_mod00_base32[1] = segment_name[DS_REG];
+ sreg_mod00_base32[2] = segment_name[DS_REG];
+ sreg_mod00_base32[3] = segment_name[DS_REG];
+ sreg_mod00_base32[4] = segment_name[SS_REG];
+ sreg_mod00_base32[5] = segment_name[DS_REG];
+ sreg_mod00_base32[6] = segment_name[DS_REG];
+ sreg_mod00_base32[7] = segment_name[DS_REG];
+
+ sreg_mod01or10_base32[0] = segment_name[DS_REG];
+ sreg_mod01or10_base32[1] = segment_name[DS_REG];
+ sreg_mod01or10_base32[2] = segment_name[DS_REG];
+ sreg_mod01or10_base32[3] = segment_name[DS_REG];
+ sreg_mod01or10_base32[4] = segment_name[SS_REG];
+ sreg_mod01or10_base32[5] = segment_name[SS_REG];
+ sreg_mod01or10_base32[6] = segment_name[DS_REG];
+ sreg_mod01or10_base32[7] = segment_name[DS_REG];
+}
+
+//////////////////
+// Intel STYLE
+//////////////////
+
+void disassembler::set_syntax_intel()
+{
+ intel_mode = 1;
+
+ general_16bit_regname = intel_general_16bit_regname;
+ general_8bit_regname = intel_general_8bit_regname;
+ general_32bit_regname = intel_general_32bit_regname;
+ general_8bit_regname_rex = intel_general_8bit_regname_rex;
+ general_64bit_regname = intel_general_64bit_regname;
+
+ segment_name = intel_segment_name;
+ index16 = intel_index16;
+
+ initialize_modrm_segregs();
+}
+
+void disassembler::print_disassembly_intel(const x86_insn *insn, const BxDisasmOpcodeInfo_t *entry)
+{
+ // print opcode
+ dis_sprintf("%s ", entry->IntelOpcode);
+
+ if (entry->Operand1) {
+ (this->*entry->Operand1)(insn);
+ }
+ if (entry->Operand2) {
+ dis_sprintf(", ");
+ (this->*entry->Operand2)(insn);
+ }
+ if (entry->Operand3) {
+ dis_sprintf(", ");
+ (this->*entry->Operand3)(insn);
+ }
+}
+
+//////////////////
+// AT&T STYLE
+//////////////////
+
+void disassembler::set_syntax_att()
+{
+ intel_mode = 0;
+
+ general_16bit_regname = att_general_16bit_regname;
+ general_8bit_regname = att_general_8bit_regname;
+ general_32bit_regname = att_general_32bit_regname;
+ general_8bit_regname_rex = att_general_8bit_regname_rex;
+ general_64bit_regname = att_general_64bit_regname;
+
+ segment_name = att_segment_name;
+ index16 = att_index16;
+
+ initialize_modrm_segregs();
+}
+
+void disassembler::toggle_syntax_mode()
+{
+ if (intel_mode) set_syntax_att();
+ else set_syntax_intel();
+}
+
+void disassembler::print_disassembly_att(const x86_insn *insn, const BxDisasmOpcodeInfo_t *entry)
+{
+ // print opcode
+ dis_sprintf("%s ", entry->AttOpcode);
+
+ if (entry->Operand3) {
+ (this->*entry->Operand3)(insn);
+ dis_sprintf(", ");
+ }
+ if (entry->Operand2) {
+ (this->*entry->Operand2)(insn);
+ dis_sprintf(", ");
+ }
+ if (entry->Operand1) {
+ (this->*entry->Operand1)(insn);
+ }
+}
diff --git a/Externals/Cg/cg.h b/Externals/Cg/cg.h
new file mode 100644
index 0000000000..0f2047338f
--- /dev/null
+++ b/Externals/Cg/cg.h
@@ -0,0 +1,705 @@
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+#ifndef _cg_h
+#define _cg_h
+
+/*************************************************************************/
+/*** CG Run-Time Library API ***/
+/*************************************************************************/
+
+#define CG_VERSION_NUM 2000
+
+#ifdef _WIN32
+# ifndef APIENTRY /* From Win32's */
+# define CG_APIENTRY_DEFINED
+# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
+# define APIENTRY __stdcall
+# else
+# define APIENTRY
+# endif
+# endif
+# ifndef WINGDIAPI /* From Win32's and */
+# define CG_WINGDIAPI_DEFINED
+# define WINGDIAPI __declspec(dllimport)
+# endif
+#endif /* _WIN32 */
+
+/* Set up for either Win32 import/export/lib. */
+#ifndef CG_API
+# ifdef _WIN32
+# ifdef CG_EXPORTS
+# define CG_API __declspec(dllexport)
+# elif defined (CG_LIB)
+# define CG_API
+# else
+# define CG_API __declspec(dllimport)
+# endif
+# else
+# define CG_API
+# endif
+#endif
+
+#ifndef CGENTRY
+# ifdef _WIN32
+# define CGENTRY __cdecl
+# else
+# define CGENTRY
+# endif
+#endif
+
+/*************************************************************************/
+/*** Data types and enumerants ***/
+/*************************************************************************/
+
+typedef int CGbool;
+
+#define CG_FALSE ((CGbool)0)
+#define CG_TRUE ((CGbool)1)
+
+typedef struct _CGcontext *CGcontext;
+typedef struct _CGprogram *CGprogram;
+typedef struct _CGparameter *CGparameter;
+typedef struct _CGobj *CGobj;
+typedef struct _CGbuffer *CGbuffer;
+typedef struct _CGeffect *CGeffect;
+typedef struct _CGtechnique *CGtechnique;
+typedef struct _CGpass *CGpass;
+typedef struct _CGstate *CGstate;
+typedef struct _CGstateassignment *CGstateassignment;
+typedef struct _CGannotation *CGannotation;
+typedef void *CGhandle;
+
+
+//!!! PREPROCESS BEGIN
+
+typedef enum
+ {
+ CG_UNKNOWN_TYPE,
+ CG_STRUCT,
+ CG_ARRAY,
+ CG_TYPELESS_STRUCT,
+
+ CG_TYPE_START_ENUM = 1024,
+# define CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, ncols, nrows, pc) \
+ enum_name ,
+
+#include
+
+# undef CG_DATATYPE_MACRO
+
+
+
+ } CGtype;
+
+typedef enum
+ {
+# define CG_BINDLOCATION_MACRO(name,enum_name,compiler_name,\
+ enum_int,addressable,param_type) \
+ enum_name = enum_int,
+
+#include
+
+ CG_UNDEFINED = 3256,
+
+ } CGresource;
+
+typedef enum
+ {
+ CG_PROFILE_START = 6144,
+ CG_PROFILE_UNKNOWN,
+
+# define CG_PROFILE_MACRO(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile) \
+ CG_PROFILE_##compiler_id_caps = int_id,
+
+#include
+
+ CG_PROFILE_MAX = 7100,
+ } CGprofile;
+
+typedef enum
+ {
+# define CG_ERROR_MACRO(code, enum_name, message) \
+ enum_name = code,
+# include
+ } CGerror;
+
+typedef enum
+ {
+# define CG_ENUM_MACRO(enum_name, enum_val) \
+ enum_name = enum_val,
+# include
+ } CGenum;
+
+//!!! PREPROCESS END
+
+typedef enum
+ {
+ CG_PARAMETERCLASS_UNKNOWN = 0,
+ CG_PARAMETERCLASS_SCALAR,
+ CG_PARAMETERCLASS_VECTOR,
+ CG_PARAMETERCLASS_MATRIX,
+ CG_PARAMETERCLASS_STRUCT,
+ CG_PARAMETERCLASS_ARRAY,
+ CG_PARAMETERCLASS_SAMPLER,
+ CG_PARAMETERCLASS_OBJECT
+ } CGparameterclass;
+
+typedef enum
+{
+ CG_UNKNOWN_DOMAIN = 0,
+ CG_FIRST_DOMAIN = 1,
+ CG_VERTEX_DOMAIN = 1,
+ CG_FRAGMENT_DOMAIN,
+ CG_GEOMETRY_DOMAIN,
+ CG_NUMBER_OF_DOMAINS
+} CGdomain;
+
+typedef enum
+{
+ CG_MAP_READ = 0,
+ CG_MAP_WRITE,
+ CG_MAP_READ_WRITE,
+ CG_MAP_WRITE_DISCARD,
+ CG_MAP_WRITE_NO_OVERWRITE
+} CGbufferaccess;
+
+typedef enum
+{
+ CG_BUFFER_USAGE_STREAM_DRAW = 0,
+ CG_BUFFER_USAGE_STREAM_READ,
+ CG_BUFFER_USAGE_STREAM_COPY,
+ CG_BUFFER_USAGE_STATIC_DRAW,
+ CG_BUFFER_USAGE_STATIC_READ,
+ CG_BUFFER_USAGE_STATIC_COPY,
+ CG_BUFFER_USAGE_DYNAMIC_DRAW,
+ CG_BUFFER_USAGE_DYNAMIC_READ,
+ CG_BUFFER_USAGE_DYNAMIC_COPY
+} CGbufferusage;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef CGbool (CGENTRY * CGstatecallback)(CGstateassignment);
+typedef void (CGENTRY * CGerrorCallbackFunc)(void);
+typedef void (CGENTRY * CGerrorHandlerFunc)(CGcontext ctx, CGerror err, void *data);
+
+/*************************************************************************/
+/*** Functions ***/
+/*************************************************************************/
+
+#ifndef CG_EXPLICIT
+
+/*** Library policy functions ***/
+
+CG_API CGenum CGENTRY cgSetLockingPolicy(CGenum lockingPolicy);
+CG_API CGenum CGENTRY cgGetLockingPolicy(void);
+CG_API CGenum CGENTRY cgSetSemanticCasePolicy(CGenum casePolicy);
+CG_API CGenum CGENTRY cgGetSemanticCasePolicy(void);
+
+/*** Context functions ***/
+
+CG_API CGcontext CGENTRY cgCreateContext(void);
+CG_API void CGENTRY cgDestroyContext(CGcontext ctx);
+CG_API CGbool CGENTRY cgIsContext(CGcontext ctx);
+CG_API const char * CGENTRY cgGetLastListing(CGcontext ctx);
+CG_API void CGENTRY cgSetLastListing(CGhandle handle, const char *listing);
+CG_API void CGENTRY cgSetAutoCompile(CGcontext ctx, CGenum flag);
+CG_API CGenum CGENTRY cgGetAutoCompile(CGcontext ctx);
+CG_API void CGENTRY cgSetParameterSettingMode(CGcontext ctx, CGenum parameterSettingMode);
+CG_API CGenum CGENTRY cgGetParameterSettingMode(CGcontext ctx);
+
+/*** Program functions ***/
+
+CG_API CGprogram CGENTRY cgCreateProgram(CGcontext ctx,
+ CGenum program_type,
+ const char *program,
+ CGprofile profile,
+ const char *entry,
+ const char **args);
+CG_API CGprogram CGENTRY cgCreateProgramFromFile(CGcontext ctx,
+ CGenum program_type,
+ const char *program_file,
+ CGprofile profile,
+ const char *entry,
+ const char **args);
+CG_API CGprogram CGENTRY cgCopyProgram(CGprogram program);
+CG_API void CGENTRY cgDestroyProgram(CGprogram program);
+
+CG_API CGprogram CGENTRY cgGetFirstProgram(CGcontext ctx);
+CG_API CGprogram CGENTRY cgGetNextProgram(CGprogram current);
+CG_API CGcontext CGENTRY cgGetProgramContext(CGprogram prog);
+CG_API CGbool CGENTRY cgIsProgram(CGprogram program);
+
+CG_API void CGENTRY cgCompileProgram(CGprogram program);
+CG_API CGbool CGENTRY cgIsProgramCompiled(CGprogram program);
+CG_API const char * CGENTRY cgGetProgramString(CGprogram prog, CGenum pname);
+CG_API CGprofile CGENTRY cgGetProgramProfile(CGprogram prog);
+CG_API char const * const * CGENTRY cgGetProgramOptions(CGprogram prog);
+CG_API void CGENTRY cgSetProgramProfile(CGprogram prog, CGprofile profile);
+CG_API CGenum CGENTRY cgGetProgramInput(CGprogram program);
+CG_API CGenum CGENTRY cgGetProgramOutput(CGprogram program);
+CG_API void CGENTRY cgSetPassProgramParameters(CGprogram);
+CG_API void CGENTRY cgUpdateProgramParameters(CGprogram program);
+
+/*** Parameter functions ***/
+
+CG_API CGparameter CGENTRY cgCreateParameter(CGcontext ctx, CGtype type);
+CG_API CGparameter CGENTRY cgCreateParameterArray(CGcontext ctx,
+ CGtype type,
+ int length);
+CG_API CGparameter CGENTRY cgCreateParameterMultiDimArray(CGcontext ctx,
+ CGtype type,
+ int dim,
+ const int *lengths);
+CG_API void CGENTRY cgDestroyParameter(CGparameter param);
+CG_API void CGENTRY cgConnectParameter(CGparameter from, CGparameter to);
+CG_API void CGENTRY cgDisconnectParameter(CGparameter param);
+CG_API CGparameter CGENTRY cgGetConnectedParameter(CGparameter param);
+
+CG_API int CGENTRY cgGetNumConnectedToParameters(CGparameter param);
+CG_API CGparameter CGENTRY cgGetConnectedToParameter(CGparameter param, int index);
+
+CG_API CGparameter CGENTRY cgGetNamedParameter(CGprogram prog, const char *name);
+CG_API CGparameter CGENTRY cgGetNamedProgramParameter(CGprogram prog,
+ CGenum name_space,
+ const char *name);
+
+CG_API CGparameter CGENTRY cgGetFirstParameter(CGprogram prog, CGenum name_space);
+CG_API CGparameter CGENTRY cgGetNextParameter(CGparameter current);
+CG_API CGparameter CGENTRY cgGetFirstLeafParameter(CGprogram prog, CGenum name_space);
+CG_API CGparameter CGENTRY cgGetNextLeafParameter(CGparameter current);
+
+CG_API CGparameter CGENTRY cgGetFirstStructParameter(CGparameter param);
+CG_API CGparameter CGENTRY cgGetNamedStructParameter(CGparameter param,
+ const char *name);
+
+CG_API CGparameter CGENTRY cgGetFirstDependentParameter(CGparameter param);
+
+CG_API CGparameter CGENTRY cgGetArrayParameter(CGparameter aparam, int index);
+CG_API int CGENTRY cgGetArrayDimension(CGparameter param);
+CG_API CGtype CGENTRY cgGetArrayType(CGparameter param);
+CG_API int CGENTRY cgGetArraySize(CGparameter param, int dimension);
+CG_API int CGENTRY cgGetArrayTotalSize(CGparameter param);
+CG_API void CGENTRY cgSetArraySize(CGparameter param, int size);
+CG_API void CGENTRY cgSetMultiDimArraySize(CGparameter param, const int *sizes);
+
+CG_API CGprogram CGENTRY cgGetParameterProgram(CGparameter param);
+CG_API CGcontext CGENTRY cgGetParameterContext(CGparameter param);
+CG_API CGbool CGENTRY cgIsParameter(CGparameter param);
+CG_API const char * CGENTRY cgGetParameterName(CGparameter param);
+CG_API CGtype CGENTRY cgGetParameterType(CGparameter param);
+CG_API CGtype CGENTRY cgGetParameterBaseType(CGparameter param);
+CG_API CGparameterclass CGENTRY cgGetParameterClass(CGparameter param);
+CG_API int CGENTRY cgGetParameterRows(CGparameter param);
+CG_API int CGENTRY cgGetParameterColumns(CGparameter param);
+CG_API CGtype CGENTRY cgGetParameterNamedType(CGparameter param);
+CG_API const char * CGENTRY cgGetParameterSemantic(CGparameter param);
+CG_API CGresource CGENTRY cgGetParameterResource(CGparameter param);
+CG_API CGresource CGENTRY cgGetParameterBaseResource(CGparameter param);
+CG_API unsigned long CGENTRY cgGetParameterResourceIndex(CGparameter param);
+CG_API CGenum CGENTRY cgGetParameterVariability(CGparameter param);
+CG_API CGenum CGENTRY cgGetParameterDirection(CGparameter param);
+CG_API CGbool CGENTRY cgIsParameterReferenced(CGparameter param);
+CG_API CGbool CGENTRY cgIsParameterUsed(CGparameter param, CGhandle handle);
+CG_API const double * CGENTRY cgGetParameterValues(CGparameter param,
+ CGenum value_type,
+ int *nvalues);
+CG_API void CGENTRY cgSetParameterValuedr(CGparameter param, int n, const double *vals);
+CG_API void CGENTRY cgSetParameterValuedc(CGparameter param, int n, const double *vals);
+CG_API void CGENTRY cgSetParameterValuefr(CGparameter param, int n, const float *vals);
+CG_API void CGENTRY cgSetParameterValuefc(CGparameter param, int n, const float *vals);
+CG_API void CGENTRY cgSetParameterValueir(CGparameter param, int n, const int *vals);
+CG_API void CGENTRY cgSetParameterValueic(CGparameter param, int n, const int *vals);
+CG_API int CGENTRY cgGetParameterValuedr(CGparameter param, int n, double *vals);
+CG_API int CGENTRY cgGetParameterValuedc(CGparameter param, int n, double *vals);
+CG_API int CGENTRY cgGetParameterValuefr(CGparameter param, int n, float *vals);
+CG_API int CGENTRY cgGetParameterValuefc(CGparameter param, int n, float *vals);
+CG_API int CGENTRY cgGetParameterValueir(CGparameter param, int n, int *vals);
+CG_API int CGENTRY cgGetParameterValueic(CGparameter param, int n, int *vals);
+CG_API const char * CGENTRY cgGetStringParameterValue(CGparameter param);
+CG_API void CGENTRY cgSetStringParameterValue(CGparameter param, const char *str);
+
+CG_API int CGENTRY cgGetParameterOrdinalNumber(CGparameter param);
+CG_API CGbool CGENTRY cgIsParameterGlobal(CGparameter param);
+CG_API int CGENTRY cgGetParameterIndex(CGparameter param);
+
+CG_API void CGENTRY cgSetParameterVariability(CGparameter param, CGenum vary);
+CG_API void CGENTRY cgSetParameterSemantic(CGparameter param, const char *semantic);
+
+CG_API void CGENTRY cgSetParameter1f(CGparameter param, float x);
+CG_API void CGENTRY cgSetParameter2f(CGparameter param, float x, float y);
+CG_API void CGENTRY cgSetParameter3f(CGparameter param, float x, float y, float z);
+CG_API void CGENTRY cgSetParameter4f(CGparameter param,
+ float x,
+ float y,
+ float z,
+ float w);
+CG_API void CGENTRY cgSetParameter1d(CGparameter param, double x);
+CG_API void CGENTRY cgSetParameter2d(CGparameter param, double x, double y);
+CG_API void CGENTRY cgSetParameter3d(CGparameter param,
+ double x,
+ double y,
+ double z);
+CG_API void CGENTRY cgSetParameter4d(CGparameter param,
+ double x,
+ double y,
+ double z,
+ double w);
+CG_API void CGENTRY cgSetParameter1i(CGparameter param, int x);
+CG_API void CGENTRY cgSetParameter2i(CGparameter param, int x, int y);
+CG_API void CGENTRY cgSetParameter3i(CGparameter param, int x, int y, int z);
+CG_API void CGENTRY cgSetParameter4i(CGparameter param,
+ int x,
+ int y,
+ int z,
+ int w);
+
+CG_API void CGENTRY cgSetParameter1iv(CGparameter param, const int *v);
+CG_API void CGENTRY cgSetParameter2iv(CGparameter param, const int *v);
+CG_API void CGENTRY cgSetParameter3iv(CGparameter param, const int *v);
+CG_API void CGENTRY cgSetParameter4iv(CGparameter param, const int *v);
+CG_API void CGENTRY cgSetParameter1fv(CGparameter param, const float *v);
+CG_API void CGENTRY cgSetParameter2fv(CGparameter param, const float *v);
+CG_API void CGENTRY cgSetParameter3fv(CGparameter param, const float *v);
+CG_API void CGENTRY cgSetParameter4fv(CGparameter param, const float *v);
+CG_API void CGENTRY cgSetParameter1dv(CGparameter param, const double *v);
+CG_API void CGENTRY cgSetParameter2dv(CGparameter param, const double *v);
+CG_API void CGENTRY cgSetParameter3dv(CGparameter param, const double *v);
+CG_API void CGENTRY cgSetParameter4dv(CGparameter param, const double *v);
+
+CG_API void CGENTRY cgSetMatrixParameterir(CGparameter param, const int *matrix);
+CG_API void CGENTRY cgSetMatrixParameterdr(CGparameter param, const double *matrix);
+CG_API void CGENTRY cgSetMatrixParameterfr(CGparameter param, const float *matrix);
+CG_API void CGENTRY cgSetMatrixParameteric(CGparameter param, const int *matrix);
+CG_API void CGENTRY cgSetMatrixParameterdc(CGparameter param, const double *matrix);
+CG_API void CGENTRY cgSetMatrixParameterfc(CGparameter param, const float *matrix);
+
+CG_API void CGENTRY cgGetMatrixParameterir(CGparameter param, int *matrix);
+CG_API void CGENTRY cgGetMatrixParameterdr(CGparameter param, double *matrix);
+CG_API void CGENTRY cgGetMatrixParameterfr(CGparameter param, float *matrix);
+CG_API void CGENTRY cgGetMatrixParameteric(CGparameter param, int *matrix);
+CG_API void CGENTRY cgGetMatrixParameterdc(CGparameter param, double *matrix);
+CG_API void CGENTRY cgGetMatrixParameterfc(CGparameter param, float *matrix);
+
+CG_API CGparameter CGENTRY cgGetNamedSubParameter(CGparameter param, const char *name);
+
+/*** Type Functions ***/
+
+CG_API const char * CGENTRY cgGetTypeString(CGtype type);
+CG_API CGtype CGENTRY cgGetType(const char *type_string);
+
+CG_API CGtype CGENTRY cgGetNamedUserType(CGhandle handle, const char *name);
+
+CG_API int CGENTRY cgGetNumUserTypes(CGhandle handle);
+CG_API CGtype CGENTRY cgGetUserType(CGhandle handle, int index);
+
+CG_API int CGENTRY cgGetNumParentTypes(CGtype type);
+CG_API CGtype CGENTRY cgGetParentType(CGtype type, int index);
+
+CG_API CGbool CGENTRY cgIsParentType(CGtype parent, CGtype child);
+CG_API CGbool CGENTRY cgIsInterfaceType(CGtype type);
+
+/*** Resource Functions ***/
+
+CG_API const char * CGENTRY cgGetResourceString(CGresource resource);
+CG_API CGresource CGENTRY cgGetResource(const char *resource_string);
+
+/*** Enum Functions ***/
+
+CG_API const char * CGENTRY cgGetEnumString(CGenum en);
+CG_API CGenum CGENTRY cgGetEnum(const char *enum_string);
+
+/*** Profile Functions ***/
+
+CG_API const char * CGENTRY cgGetProfileString(CGprofile profile);
+CG_API CGprofile CGENTRY cgGetProfile(const char *profile_string);
+
+/*** Error Functions ***/
+
+CG_API CGerror CGENTRY cgGetError(void);
+CG_API CGerror CGENTRY cgGetFirstError(void);
+CG_API const char * CGENTRY cgGetErrorString(CGerror error);
+CG_API const char * CGENTRY cgGetLastErrorString(CGerror *error);
+CG_API void CGENTRY cgSetErrorCallback(CGerrorCallbackFunc func);
+CG_API CGerrorCallbackFunc CGENTRY cgGetErrorCallback(void);
+CG_API void CGENTRY cgSetErrorHandler(CGerrorHandlerFunc func, void *data);
+CG_API CGerrorHandlerFunc CGENTRY cgGetErrorHandler(void **data);
+
+/*** Misc Functions ***/
+
+CG_API const char * CGENTRY cgGetString(CGenum sname);
+
+
+/*** CgFX Functions ***/
+
+CG_API CGeffect CGENTRY cgCreateEffect(CGcontext, const char *code, const char **args);
+CG_API CGeffect CGENTRY cgCreateEffectFromFile(CGcontext, const char *filename,
+ const char **args);
+CG_API CGeffect CGENTRY cgCopyEffect(CGeffect effect);
+CG_API void CGENTRY cgDestroyEffect(CGeffect);
+CG_API CGcontext CGENTRY cgGetEffectContext(CGeffect);
+CG_API CGbool CGENTRY cgIsEffect(CGeffect effect);
+
+CG_API CGeffect CGENTRY cgGetFirstEffect(CGcontext);
+CG_API CGeffect CGENTRY cgGetNextEffect(CGeffect);
+
+CG_API CGprogram CGENTRY cgCreateProgramFromEffect(CGeffect effect,
+ CGprofile profile,
+ const char *entry,
+ const char **args);
+
+CG_API CGtechnique CGENTRY cgGetFirstTechnique(CGeffect);
+CG_API CGtechnique CGENTRY cgGetNextTechnique(CGtechnique);
+CG_API CGtechnique CGENTRY cgGetNamedTechnique(CGeffect, const char *name);
+CG_API const char * CGENTRY cgGetTechniqueName(CGtechnique);
+CG_API CGbool CGENTRY cgIsTechnique(CGtechnique);
+CG_API CGbool CGENTRY cgValidateTechnique(CGtechnique);
+CG_API CGbool CGENTRY cgIsTechniqueValidated(CGtechnique);
+CG_API CGeffect CGENTRY cgGetTechniqueEffect(CGtechnique);
+
+CG_API CGpass CGENTRY cgGetFirstPass(CGtechnique);
+CG_API CGpass CGENTRY cgGetNamedPass(CGtechnique, const char *name);
+CG_API CGpass CGENTRY cgGetNextPass(CGpass);
+CG_API CGbool CGENTRY cgIsPass(CGpass);
+CG_API const char * CGENTRY cgGetPassName(CGpass);
+CG_API CGtechnique CGENTRY cgGetPassTechnique(CGpass);
+
+CG_API void CGENTRY cgSetPassState(CGpass);
+CG_API void CGENTRY cgResetPassState(CGpass);
+
+CG_API CGstateassignment CGENTRY cgGetFirstStateAssignment(CGpass);
+CG_API CGstateassignment CGENTRY cgGetNamedStateAssignment(CGpass, const char *name);
+CG_API CGstateassignment CGENTRY cgGetNextStateAssignment(CGstateassignment);
+CG_API CGbool CGENTRY cgIsStateAssignment(CGstateassignment);
+CG_API CGbool CGENTRY cgCallStateSetCallback(CGstateassignment);
+CG_API CGbool CGENTRY cgCallStateValidateCallback(CGstateassignment);
+CG_API CGbool CGENTRY cgCallStateResetCallback(CGstateassignment);
+CG_API CGpass CGENTRY cgGetStateAssignmentPass(CGstateassignment);
+CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentParameter(CGstateassignment);
+
+CG_API const float * CGENTRY cgGetFloatStateAssignmentValues(CGstateassignment, int *nVals);
+CG_API const int * CGENTRY cgGetIntStateAssignmentValues(CGstateassignment, int *nVals);
+CG_API const CGbool * CGENTRY cgGetBoolStateAssignmentValues(CGstateassignment, int *nVals);
+CG_API const char * CGENTRY cgGetStringStateAssignmentValue(CGstateassignment);
+CG_API CGprogram CGENTRY cgGetProgramStateAssignmentValue(CGstateassignment);
+CG_API CGparameter CGENTRY cgGetTextureStateAssignmentValue(CGstateassignment);
+CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentValue(CGstateassignment);
+CG_API int CGENTRY cgGetStateAssignmentIndex(CGstateassignment);
+
+CG_API int CGENTRY cgGetNumDependentStateAssignmentParameters(CGstateassignment);
+CG_API CGparameter CGENTRY cgGetDependentStateAssignmentParameter(CGstateassignment, int index);
+
+CG_API CGparameter CGENTRY cgGetConnectedStateAssignmentParameter(CGstateassignment);
+
+CG_API CGstate CGENTRY cgGetStateAssignmentState(CGstateassignment);
+CG_API CGstate CGENTRY cgGetSamplerStateAssignmentState(CGstateassignment);
+
+CG_API CGstate CGENTRY cgCreateState(CGcontext, const char *name, CGtype);
+CG_API CGstate CGENTRY cgCreateArrayState(CGcontext, const char *name, CGtype, int nelems);
+CG_API void CGENTRY cgSetStateCallbacks(CGstate, CGstatecallback set, CGstatecallback reset,
+ CGstatecallback validate);
+CG_API CGstatecallback CGENTRY cgGetStateSetCallback(CGstate);
+CG_API CGstatecallback CGENTRY cgGetStateResetCallback(CGstate);
+CG_API CGstatecallback CGENTRY cgGetStateValidateCallback(CGstate);
+CG_API CGcontext CGENTRY cgGetStateContext(CGstate);
+CG_API CGtype CGENTRY cgGetStateType(CGstate);
+CG_API const char * CGENTRY cgGetStateName(CGstate);
+CG_API CGstate CGENTRY cgGetNamedState(CGcontext, const char *name);
+CG_API CGstate CGENTRY cgGetFirstState(CGcontext);
+CG_API CGstate CGENTRY cgGetNextState(CGstate);
+CG_API CGbool CGENTRY cgIsState(CGstate);
+CG_API void CGENTRY cgAddStateEnumerant(CGstate, const char *name, int value);
+
+CG_API CGstate CGENTRY cgCreateSamplerState(CGcontext, const char *name, CGtype);
+CG_API CGstate CGENTRY cgCreateArraySamplerState(CGcontext, const char *name, CGtype, int nelems);
+CG_API CGstate CGENTRY cgGetNamedSamplerState(CGcontext, const char *name);
+CG_API CGstate CGENTRY cgGetFirstSamplerState(CGcontext);
+
+CG_API CGstateassignment CGENTRY cgGetFirstSamplerStateAssignment(CGparameter);
+CG_API CGstateassignment CGENTRY cgGetNamedSamplerStateAssignment(CGparameter, const char *);
+CG_API void CGENTRY cgSetSamplerState(CGparameter);
+
+CG_API CGparameter CGENTRY cgGetNamedEffectParameter(CGeffect, const char *);
+CG_API CGparameter CGENTRY cgGetFirstLeafEffectParameter(CGeffect);
+CG_API CGparameter CGENTRY cgGetFirstEffectParameter(CGeffect);
+CG_API CGparameter CGENTRY cgGetEffectParameterBySemantic(CGeffect, const char *);
+
+CG_API CGannotation CGENTRY cgGetFirstTechniqueAnnotation(CGtechnique);
+CG_API CGannotation CGENTRY cgGetFirstPassAnnotation(CGpass);
+CG_API CGannotation CGENTRY cgGetFirstParameterAnnotation(CGparameter);
+CG_API CGannotation CGENTRY cgGetFirstProgramAnnotation(CGprogram);
+CG_API CGannotation CGENTRY cgGetFirstEffectAnnotation(CGeffect);
+CG_API CGannotation CGENTRY cgGetNextAnnotation(CGannotation);
+
+CG_API CGannotation CGENTRY cgGetNamedTechniqueAnnotation(CGtechnique, const char *);
+CG_API CGannotation CGENTRY cgGetNamedPassAnnotation(CGpass, const char *);
+CG_API CGannotation CGENTRY cgGetNamedParameterAnnotation(CGparameter, const char *);
+CG_API CGannotation CGENTRY cgGetNamedProgramAnnotation(CGprogram, const char *);
+CG_API CGannotation CGENTRY cgGetNamedEffectAnnotation(CGeffect, const char *);
+
+CG_API CGbool CGENTRY cgIsAnnotation(CGannotation);
+
+CG_API const char * CGENTRY cgGetAnnotationName(CGannotation);
+CG_API CGtype CGENTRY cgGetAnnotationType(CGannotation);
+
+CG_API const float * CGENTRY cgGetFloatAnnotationValues(CGannotation, int *nvalues);
+CG_API const int * CGENTRY cgGetIntAnnotationValues(CGannotation, int *nvalues);
+CG_API const char * CGENTRY cgGetStringAnnotationValue(CGannotation);
+CG_API const char * const * CGENTRY cgGetStringAnnotationValues(CGannotation, int *nvalues);
+CG_API const CGbool * CGENTRY cgGetBoolAnnotationValues(CGannotation, int *nvalues);
+CG_API const int * CGENTRY cgGetBooleanAnnotationValues(CGannotation, int *nvalues);
+
+CG_API int CGENTRY cgGetNumDependentAnnotationParameters(CGannotation);
+CG_API CGparameter CGENTRY cgGetDependentAnnotationParameter(CGannotation, int index);
+
+CG_API void CGENTRY cgEvaluateProgram(CGprogram, float *, int ncomps, int nx, int ny, int nz);
+
+/*** Cg 1.5 Additions ***/
+
+CG_API CGbool CGENTRY cgSetEffectName(CGeffect, const char *name);
+CG_API const char * CGENTRY cgGetEffectName(CGeffect);
+CG_API CGeffect CGENTRY cgGetNamedEffect(CGcontext, const char *name);
+CG_API CGparameter CGENTRY cgCreateEffectParameter(CGeffect, const char *name, CGtype);
+
+CG_API CGtechnique CGENTRY cgCreateTechnique(CGeffect, const char *name);
+
+CG_API CGparameter CGENTRY cgCreateEffectParameterArray(CGeffect, const char *name, CGtype type, int length);
+CG_API CGparameter CGENTRY cgCreateEffectParameterMultiDimArray(CGeffect, const char *name, CGtype type, int dim, const int *lengths);
+
+CG_API CGpass CGENTRY cgCreatePass(CGtechnique, const char *name);
+
+CG_API CGstateassignment CGENTRY cgCreateStateAssignment(CGpass, CGstate);
+CG_API CGstateassignment CGENTRY cgCreateStateAssignmentIndex(CGpass, CGstate, int index);
+CG_API CGstateassignment CGENTRY cgCreateSamplerStateAssignment(CGparameter, CGstate);
+
+CG_API CGbool CGENTRY cgSetFloatStateAssignment(CGstateassignment, float);
+CG_API CGbool CGENTRY cgSetIntStateAssignment(CGstateassignment, int);
+CG_API CGbool CGENTRY cgSetBoolStateAssignment(CGstateassignment, CGbool);
+CG_API CGbool CGENTRY cgSetStringStateAssignment(CGstateassignment, const char *);
+CG_API CGbool CGENTRY cgSetProgramStateAssignment(CGstateassignment, CGprogram);
+CG_API CGbool CGENTRY cgSetSamplerStateAssignment(CGstateassignment, CGparameter);
+CG_API CGbool CGENTRY cgSetTextureStateAssignment(CGstateassignment, CGparameter);
+
+CG_API CGbool CGENTRY cgSetFloatArrayStateAssignment(CGstateassignment, const float *vals);
+CG_API CGbool CGENTRY cgSetIntArrayStateAssignment(CGstateassignment, const int *vals);
+CG_API CGbool CGENTRY cgSetBoolArrayStateAssignment(CGstateassignment, const CGbool *vals);
+
+CG_API CGannotation CGENTRY cgCreateTechniqueAnnotation(CGtechnique, const char *name, CGtype);
+CG_API CGannotation CGENTRY cgCreatePassAnnotation(CGpass, const char *name, CGtype);
+CG_API CGannotation CGENTRY cgCreateParameterAnnotation(CGparameter, const char *name, CGtype);
+CG_API CGannotation CGENTRY cgCreateProgramAnnotation(CGprogram, const char *name, CGtype);
+CG_API CGannotation CGENTRY cgCreateEffectAnnotation(CGeffect, const char *name, CGtype);
+
+CG_API CGbool CGENTRY cgSetIntAnnotation(CGannotation, int value);
+CG_API CGbool CGENTRY cgSetFloatAnnotation(CGannotation, float value);
+CG_API CGbool CGENTRY cgSetBoolAnnotation(CGannotation, CGbool value);
+CG_API CGbool CGENTRY cgSetStringAnnotation(CGannotation, const char *value);
+
+CG_API const char * CGENTRY cgGetStateEnumerantName(CGstate, int value);
+CG_API int CGENTRY cgGetStateEnumerantValue(CGstate, const char *name);
+
+CG_API CGeffect CGENTRY cgGetParameterEffect(CGparameter param);
+
+CG_API CGparameterclass CGENTRY cgGetTypeClass(CGtype type);
+CG_API CGtype CGENTRY cgGetTypeBase(CGtype type);
+CG_API CGbool CGENTRY cgGetTypeSizes(CGtype type, int *nrows, int *ncols);
+CG_API void CGENTRY cgGetMatrixSize(CGtype type, int *nrows, int *ncols);
+
+CG_API int CGENTRY cgGetNumProgramDomains( CGprogram program );
+CG_API CGdomain CGENTRY cgGetProfileDomain( CGprofile profile );
+CG_API CGprogram CGENTRY cgCombinePrograms( int n, const CGprogram *exeList );
+CG_API CGprogram CGENTRY cgCombinePrograms2( const CGprogram exe1, const CGprogram exe2 );
+CG_API CGprogram CGENTRY cgCombinePrograms3( const CGprogram exe1, const CGprogram exe2, const CGprogram exe3 );
+CG_API CGprofile CGENTRY cgGetProgramDomainProfile(CGprogram program, int index);
+
+/*** CGobj Functions ***/
+CG_API CGobj CGENTRY cgCreateObj( CGcontext context, CGenum program_type, const char *source, CGprofile profile, const char **args );
+CG_API CGobj CGENTRY cgCreateObjFromFile( CGcontext context, CGenum program_type, const char *source_file, CGprofile profile, const char **args );
+CG_API void CGENTRY cgDestroyObj( CGobj obj );
+
+CG_API long CGENTRY cgGetParameterResourceSize(CGparameter);
+CG_API CGtype CGENTRY cgGetParameterResourceType(CGparameter);
+CG_API int CGENTRY cgGetParameterBufferIndex(CGparameter);
+CG_API int CGENTRY cgGetParameterBufferOffset(CGparameter);
+
+CG_API CGbuffer CGENTRY cgCreateBuffer(CGcontext, int size, const void *data, CGbufferusage bufferUsage);
+CG_API void CGENTRY cgSetBufferData(CGbuffer, int size, const void *data);
+CG_API void CGENTRY cgSetBufferSubData(CGbuffer, int offset, int size, const void *data);
+CG_API void CGENTRY cgSetProgramBuffer(CGprogram program, int bufferIndex, CGbuffer buffer);
+
+CG_API void * CGENTRY cgMapBuffer(CGbuffer buffer, CGbufferaccess access);
+CG_API void CGENTRY cgUnmapBuffer(CGbuffer buffer);
+CG_API void CGENTRY cgDestroyBuffer(CGbuffer buffer);
+CG_API CGbuffer CGENTRY cgGetProgramBuffer(CGprogram, int bufferIndex);
+CG_API int CGENTRY cgGetBufferSize(CGbuffer);
+CG_API int CGENTRY cgGetProgramBufferMaxSize(CGprofile profile);
+CG_API int CGENTRY cgGetProgramBufferMaxIndex(CGprofile profile);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef CG_APIENTRY_DEFINED
+# undef CG_APIENTRY_DEFINED
+# undef APIENTRY
+#endif
+
+#ifdef CG_WINGDIAPI_DEFINED
+# undef CG_WINGDIAPI_DEFINED
+# undef WINGDIAPI
+#endif
+
+#endif
diff --git a/Externals/Cg/cg.lib b/Externals/Cg/cg.lib
new file mode 100644
index 0000000000..9639c4535a
Binary files /dev/null and b/Externals/Cg/cg.lib differ
diff --git a/Externals/Cg/cgGL.h b/Externals/Cg/cgGL.h
new file mode 100644
index 0000000000..4f30195f84
--- /dev/null
+++ b/Externals/Cg/cgGL.h
@@ -0,0 +1,423 @@
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef _cggl_h
+#define _cggl_h
+
+#include
+
+#ifdef _WIN32
+# ifndef APIENTRY /* From Win32's */
+# define CGGL_APIENTRY_DEFINED
+# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
+# define APIENTRY __stdcall
+# else
+# define APIENTRY
+# endif
+# endif
+# ifndef WINGDIAPI /* From Win32's and */
+# define CGGL_WINGDIAPI_DEFINED
+# define WINGDIAPI __declspec(dllimport)
+# endif
+#endif /* _WIN32 */
+
+/* Set up for either Win32 import/export/lib. */
+#ifndef CGGL_API
+# ifdef _WIN32
+# ifdef CGGL_EXPORTS
+# define CGGL_API __declspec(dllexport)
+# elif defined (CG_LIB)
+# define CGGL_API
+# else
+# define CGGL_API __declspec(dllimport)
+# endif
+# else
+# define CGGL_API
+# endif
+#endif
+
+#ifndef CGGLENTRY
+# ifdef _WIN32
+# define CGGLENTRY __cdecl
+# else
+# define CGGLENTRY
+# endif
+#endif
+
+#ifdef __APPLE__
+#include
+#else
+#include
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************************************************************/
+/*** cgGL Type Definitions ***/
+/*****************************************************************************/
+
+typedef enum
+ {
+ CG_GL_MATRIX_IDENTITY = 0,
+ CG_GL_MATRIX_TRANSPOSE = 1,
+ CG_GL_MATRIX_INVERSE = 2,
+ CG_GL_MATRIX_INVERSE_TRANSPOSE = 3,
+
+ CG_GL_MODELVIEW_MATRIX,
+ CG_GL_PROJECTION_MATRIX,
+ CG_GL_TEXTURE_MATRIX,
+ CG_GL_MODELVIEW_PROJECTION_MATRIX,
+
+ CG_GL_VERTEX,
+ CG_GL_FRAGMENT,
+ CG_GL_GEOMETRY
+
+ } CGGLenum;
+
+
+#ifndef CGGL_EXPLICIT
+
+/******************************************************************************
+ *** Profile Functions
+ *****************************************************************************/
+
+CGGL_API CGbool CGGLENTRY cgGLIsProfileSupported(CGprofile profile);
+
+CGGL_API void CGGLENTRY cgGLEnableProfile(CGprofile profile);
+CGGL_API void CGGLENTRY cgGLDisableProfile(CGprofile profile);
+
+CGGL_API CGprofile CGGLENTRY cgGLGetLatestProfile(CGGLenum profile_type);
+CGGL_API void CGGLENTRY cgGLSetOptimalOptions(CGprofile profile);
+
+/******************************************************************************
+ *** Program Managment Functions
+ *****************************************************************************/
+
+CGGL_API void CGGLENTRY cgGLLoadProgram(CGprogram program);
+CGGL_API CGbool CGGLENTRY cgGLIsProgramLoaded(CGprogram program);
+CGGL_API void CGGLENTRY cgGLBindProgram(CGprogram program);
+CGGL_API void CGGLENTRY cgGLUnbindProgram(CGprofile profile);
+CGGL_API GLuint CGGLENTRY cgGLGetProgramID(CGprogram program);
+
+/******************************************************************************
+ *** Parameter Managment Functions
+ *****************************************************************************/
+
+CGGL_API void CGGLENTRY cgGLSetParameter1f(CGparameter param,
+ float x);
+
+CGGL_API void CGGLENTRY cgGLSetParameter2f(CGparameter param,
+ float x,
+ float y);
+
+CGGL_API void CGGLENTRY cgGLSetParameter3f(CGparameter param,
+ float x,
+ float y,
+ float z);
+
+CGGL_API void CGGLENTRY cgGLSetParameter4f(CGparameter param,
+ float x,
+ float y,
+ float z,
+ float w);
+
+CGGL_API void CGGLENTRY cgGLSetParameter1fv(CGparameter param, const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameter2fv(CGparameter param, const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameter3fv(CGparameter param, const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameter4fv(CGparameter param, const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameter1d(CGparameter param,
+ double x);
+
+CGGL_API void CGGLENTRY cgGLSetParameter2d(CGparameter param,
+ double x,
+ double y);
+
+CGGL_API void CGGLENTRY cgGLSetParameter3d(CGparameter param,
+ double x,
+ double y,
+ double z);
+
+CGGL_API void CGGLENTRY cgGLSetParameter4d(CGparameter param,
+ double x,
+ double y,
+ double z,
+ double w);
+
+CGGL_API void CGGLENTRY cgGLSetParameter1dv(CGparameter param, const double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameter2dv(CGparameter param, const double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameter3dv(CGparameter param, const double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameter4dv(CGparameter param, const double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter1f(CGparameter param, float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter2f(CGparameter param, float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter3f(CGparameter param, float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter4f(CGparameter param, float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter1d(CGparameter param, double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter2d(CGparameter param, double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter3d(CGparameter param, double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameter4d(CGparameter param, double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray1f(CGparameter param,
+ long offset,
+ long nelements,
+ const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray2f(CGparameter param,
+ long offset,
+ long nelements,
+ const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray3f(CGparameter param,
+ long offset,
+ long nelements,
+ const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray4f(CGparameter param,
+ long offset,
+ long nelements,
+ const float *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray1d(CGparameter param,
+ long offset,
+ long nelements,
+ const double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray2d(CGparameter param,
+ long offset,
+ long nelements,
+ const double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray3d(CGparameter param,
+ long offset,
+ long nelements,
+ const double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterArray4d(CGparameter param,
+ long offset,
+ long nelements,
+ const double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray1f(CGparameter param,
+ long offset,
+ long nelements,
+ float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray2f(CGparameter param,
+ long offset,
+ long nelements,
+ float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray3f(CGparameter param,
+ long offset,
+ long nelements,
+ float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray4f(CGparameter param,
+ long offset,
+ long nelements,
+ float *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray1d(CGparameter param,
+ long offset,
+ long nelements,
+ double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray2d(CGparameter param,
+ long offset,
+ long nelements,
+ double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray3d(CGparameter param,
+ long offset,
+ long nelements,
+ double *v);
+
+CGGL_API void CGGLENTRY cgGLGetParameterArray4d(CGparameter param,
+ long offset,
+ long nelements,
+ double *v);
+
+CGGL_API void CGGLENTRY cgGLSetParameterPointer(CGparameter param,
+ GLint fsize,
+ GLenum type,
+ GLsizei stride,
+ const GLvoid *pointer);
+
+CGGL_API void CGGLENTRY cgGLEnableClientState(CGparameter param);
+CGGL_API void CGGLENTRY cgGLDisableClientState(CGparameter param);
+
+/******************************************************************************
+ *** Matrix Parameter Managment Functions
+ *****************************************************************************/
+
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterdr(CGparameter param,
+ const double *matrix);
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterfr(CGparameter param,
+ const float *matrix);
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterdc(CGparameter param,
+ const double *matrix);
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterfc(CGparameter param,
+ const float *matrix);
+
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterdr(CGparameter param, double *matrix);
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterfr(CGparameter param, float *matrix);
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterdc(CGparameter param, double *matrix);
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterfc(CGparameter param, float *matrix);
+
+CGGL_API void CGGLENTRY cgGLSetStateMatrixParameter(CGparameter param,
+ CGGLenum matrix,
+ CGGLenum transform);
+
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfc(CGparameter param,
+ long offset,
+ long nelements,
+ const float *matrices);
+
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfr(CGparameter param,
+ long offset,
+ long nelements,
+ const float *matrices);
+
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydc(CGparameter param,
+ long offset,
+ long nelements,
+ const double *matrices);
+
+CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydr(CGparameter param,
+ long offset,
+ long nelements,
+ const double *matrices);
+
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfc(CGparameter param,
+ long offset,
+ long nelements,
+ float *matrices);
+
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfr(CGparameter param,
+ long offset,
+ long nelements,
+ float *matrices);
+
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydc(CGparameter param,
+ long offset,
+ long nelements,
+ double *matrices);
+
+CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydr(CGparameter param,
+ long offset,
+ long nelements,
+ double *matrices);
+
+/******************************************************************************
+ *** Texture Parameter Managment Functions
+ *****************************************************************************/
+
+CGGL_API void CGGLENTRY cgGLSetTextureParameter(CGparameter param, GLuint texobj);
+CGGL_API GLuint CGGLENTRY cgGLGetTextureParameter(CGparameter param);
+CGGL_API void CGGLENTRY cgGLEnableTextureParameter(CGparameter param);
+CGGL_API void CGGLENTRY cgGLDisableTextureParameter(CGparameter param);
+CGGL_API GLenum CGGLENTRY cgGLGetTextureEnum(CGparameter param);
+
+CGGL_API void CGGLENTRY cgGLSetManageTextureParameters(CGcontext ctx, CGbool flag);
+CGGL_API CGbool CGGLENTRY cgGLGetManageTextureParameters(CGcontext ctx);
+
+CGGL_API void CGGLENTRY cgGLSetupSampler(CGparameter param, GLuint texobj);
+CGGL_API void CGGLENTRY cgGLRegisterStates(CGcontext);
+
+CGGL_API void CGGLENTRY cgGLEnableProgramProfiles( CGprogram program );
+CGGL_API void CGGLENTRY cgGLDisableProgramProfiles( CGprogram program );
+
+/******************************************************************************
+ *** Misc Functions
+ *****************************************************************************/
+
+CGGL_API void CGGLENTRY cgGLSetDebugMode( CGbool debug );
+
+/******************************************************************************
+ *** Buffer Functions
+ *****************************************************************************/
+
+CGGL_API CGbuffer CGGLENTRY cgGLCreateBuffer(CGcontext context, int size, const void *data, GLenum bufferUsage);
+CGGL_API GLuint CGGLENTRY cgGLGetBufferObject(CGbuffer buffer);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef CGGL_APIENTRY_DEFINED
+# undef CGGL_APIENTRY_DEFINED
+# undef APIENTRY
+#endif
+
+#ifdef CGGL_WINGDIAPI_DEFINED
+# undef CGGL_WINGDIAPI_DEFINED
+# undef WINGDIAPI
+#endif
+
+#endif
diff --git a/Externals/Cg/cgGL.lib b/Externals/Cg/cgGL.lib
new file mode 100644
index 0000000000..013c427c6d
Binary files /dev/null and b/Externals/Cg/cgGL.lib differ
diff --git a/Externals/Cg/cgGL_profiles.h b/Externals/Cg/cgGL_profiles.h
new file mode 100644
index 0000000000..44948edfb1
--- /dev/null
+++ b/Externals/Cg/cgGL_profiles.h
@@ -0,0 +1,70 @@
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+CG_PROFILE_MACRO(Vertex,vp20,VP20,"vp20",6146,1)
+CG_PROFILE_MACRO(Fragment20,fp20,FP20,"fp20",6147,0)
+CG_PROFILE_MACRO(Vertex30,vp30,VP30,"vp30",6148,1)
+CG_PROFILE_MACRO(Fragment,fp30,FP30,"fp30",6149,0)
+CG_PROFILE_MACRO(ARBVertex,arbvp1,ARBVP1,"arbvp1",6150,1)
+CG_PROFILE_MACRO(Fragment40,fp40,FP40,"fp40",6151,0)
+CG_PROFILE_MACRO(ARBFragment,arbfp1,ARBFP1,"arbfp1",7000,0)
+CG_PROFILE_MACRO(Vertex40,vp40,VP40,"vp40",7001,1)
+CG_PROFILE_MACRO(GLSLVertex,glslv,GLSLV,"glslv",7007,1)
+CG_PROFILE_MACRO(GLSLFragment,glslf,GLSLF,"glslf",7008,0)
+CG_PROFILE_MACRO(GLSLCombined, glslc, GLSLC, "glslc", 7009, 0)
+CG_PROFILE_MACRO(GPUFragment,gpu_fp,GPU_FP,"gp4fp",7010,0)
+CG_PROFILE_MACRO(GPUVertex,gpu_vp,GPU_VP,"gp4vp",7011,1)
+CG_PROFILE_MACRO(GPUGeometry,gpu_gp,GPU_GP,"gp4gp",7012,0)
+
+#ifndef CG_IN_PROFILES_INCLUDE
+# undef CG_PROFILE_MACRO
+#endif
diff --git a/Externals/Cg/cg_bindlocations.h b/Externals/Cg/cg_bindlocations.h
new file mode 100644
index 0000000000..adcff5548b
--- /dev/null
+++ b/Externals/Cg/cg_bindlocations.h
@@ -0,0 +1,382 @@
+
+
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+/*
+ * The following macro invocations define the supported CG basic hardware
+ * bind locations.
+ *
+ * The macros have the form :
+ *
+ * CG_BINDLOCATION_MACRO(name, compiler_name, enum_int)
+ *
+ * name : The name of the location.
+ * enum_name : The C enumerant.
+ * compiler_name : The name of the location within the compiler syntax.
+ * int_id : Integer enumerant associated with this bind location.
+ * (3256 is reservered for CG_UNDEFINED)
+ * addressable : The bind location must have an integer address
+ * associated with it.
+ * ParamType : the cgParamType of this register.
+ *
+ */
+
+
+CG_BINDLOCATION_MACRO(TexUnit0,CG_TEXUNIT0,"texunit 0",2048,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit1,CG_TEXUNIT1,"texunit 1",2049,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit2,CG_TEXUNIT2,"texunit 2",2050,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit3,CG_TEXUNIT3,"texunit 3",2051,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit4,CG_TEXUNIT4,"texunit 4",2052,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit5,CG_TEXUNIT5,"texunit 5",2053,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit6,CG_TEXUNIT6,"texunit 6",2054,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit7,CG_TEXUNIT7,"texunit 7",2055,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit8,CG_TEXUNIT8,"texunit 8",2056,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit9,CG_TEXUNIT9,"texunit 9",2057,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit10,CG_TEXUNIT10,"texunit 10",2058,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit11,CG_TEXUNIT11,"texunit 11",2059,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit12,CG_TEXUNIT12,"texunit 12",2060,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit13,CG_TEXUNIT13,"texunit 13",2061,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit14,CG_TEXUNIT14,"texunit 14",2062,0,CG_TEXOBJ_PARAM)
+CG_BINDLOCATION_MACRO(TexUnit15,CG_TEXUNIT15,"texunit 15",2063,0,CG_TEXOBJ_PARAM)
+
+CG_BINDLOCATION_MACRO(Buffer0, CG_BUFFER0, "buffer[0]", 2064, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer1, CG_BUFFER1, "buffer[1]", 2065, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer2, CG_BUFFER2, "buffer[2]", 2066, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer3, CG_BUFFER3, "buffer[3]", 2067, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer4, CG_BUFFER4, "buffer[4]", 2068, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer5, CG_BUFFER5, "buffer[5]", 2069, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer6, CG_BUFFER6, "buffer[6]", 2070, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer7, CG_BUFFER7, "buffer[7]", 2071, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer8, CG_BUFFER8, "buffer[8]", 2072, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer9, CG_BUFFER9, "buffer[9]", 2073, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer10, CG_BUFFER10, "buffer[10]", 2074, 1, CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Buffer11, CG_BUFFER11, "buffer[11]", 2075, 1, CGI_UNIFORM_PARAM)
+
+CG_BINDLOCATION_MACRO(Attr0,CG_ATTR0,"ATTR0",2113,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr1,CG_ATTR1,"ATTR1",2114,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr2,CG_ATTR2,"ATTR2",2115,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr3,CG_ATTR3,"ATTR3",2116,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr4,CG_ATTR4,"ATTR4",2117,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr5,CG_ATTR5,"ATTR5",2118,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr6,CG_ATTR6,"ATTR6",2119,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr7,CG_ATTR7,"ATTR7",2120,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr8,CG_ATTR8,"ATTR8",2121,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr9,CG_ATTR9,"ATTR9",2122,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr10,CG_ATTR10,"ATTR10",2123,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr11,CG_ATTR11,"ATTR11",2124,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr12,CG_ATTR12,"ATTR12",2125,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr13,CG_ATTR13,"ATTR13",2126,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr14,CG_ATTR14,"ATTR14",2127,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Attr15,CG_ATTR15,"ATTR15",2128,0,CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(VertUniform,CG_C,"c",2178,1,CGI_UNIFORM_PARAM)
+
+CG_BINDLOCATION_MACRO(Tex0,CG_TEX0,"TEX0",2179,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tex1,CG_TEX1,"TEX1",2180,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tex2,CG_TEX2,"TEX2",2181,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tex3,CG_TEX3,"TEX3",2192,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tex4,CG_TEX4,"TEX4",2193,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tex5,CG_TEX5,"TEX5",2194,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tex6,CG_TEX6,"TEX6",2195,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tex7,CG_TEX7,"TEX7",2196,0,CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(HPos,CG_HPOS,"HPOS",2243,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Col0,CG_COL0,"COL0",2245,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Col1,CG_COL1,"COL1",2246,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Col2,CG_COL2,"COL2",2247,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Col3,CG_COL3,"COL3",2248,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSiz,CG_PSIZ,"PSIZ",2309,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Clp0,CG_CLP0,"CLP0",2310,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Clp1,CG_CLP1,"CLP1",2311,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Clp2,CG_CLP2,"CLP2",2312,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Clp3,CG_CLP3,"CLP3",2313,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Clp4,CG_CLP4,"CLP4",2314,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Clp5,CG_CLP5,"CLP5",2315,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(WPos,CG_WPOS,"WPOS",2373,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PointCoord,CG_POINTCOORD,"POINTCOORD",2374,0,CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(Position0,CG_POSITION0,"POSITION0",2437,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position1,CG_POSITION1,"POSITION1",2438,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position2,CG_POSITION2,"POSITION2",2439,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position3,CG_POSITION3,"POSITION3",2440,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position4,CG_POSITION4,"POSITION4",2441,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position5,CG_POSITION5,"POSITION5",2442,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position6,CG_POSITION6,"POSITION6",2443,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position7,CG_POSITION7,"POSITION7",2444,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position8,CG_POSITION8,"POSITION8",2445,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position9,CG_POSITION9,"POSITION9",2446,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position10,CG_POSITION10,"POSITION10",2447,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position11,CG_POSITION11,"POSITION11",2448,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position12,CG_POSITION12,"POSITION12",2449,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position13,CG_POSITION13,"POSITION13",2450,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position14,CG_POSITION14,"POSITION14",2451,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Position15,CG_POSITION15,"POSITION15",2452,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Diffuse0,CG_DIFFUSE0,"DIFFUSE0",2501,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent0,CG_TANGENT0,"TANGENT0",2565,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent1,CG_TANGENT1,"TANGENT1",2566,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent2,CG_TANGENT2,"TANGENT2",2567,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent3,CG_TANGENT3,"TANGENT3",2568,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent4,CG_TANGENT4,"TANGENT4",2569,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent5,CG_TANGENT5,"TANGENT5",2570,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent6,CG_TANGENT6,"TANGENT6",2571,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent7,CG_TANGENT7,"TANGENT7",2572,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent8,CG_TANGENT8,"TANGENT8",2573,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent9,CG_TANGENT9,"TANGENT9",2574,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent10,CG_TANGENT10,"TANGENT10",2575,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent11,CG_TANGENT11,"TANGENT11",2576,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent12,CG_TANGENT12,"TANGENT12",2577,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent13,CG_TANGENT13,"TANGENT13",2578,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent14,CG_TANGENT14,"TANGENT14",2579,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Tangent15,CG_TANGENT15,"TANGENT15",2580,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Specular0,CG_SPECULAR0,"SPECULAR0",2629,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices0,CG_BLENDINDICES0,"BLENDINDICES0",2693,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices1,CG_BLENDINDICES1,"BLENDINDICES1",2694,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices2,CG_BLENDINDICES2,"BLENDINDICES2",2695,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices3,CG_BLENDINDICES3,"BLENDINDICES3",2696,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices4,CG_BLENDINDICES4,"BLENDINDICES4",2697,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices5,CG_BLENDINDICES5,"BLENDINDICES5",2698,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices6,CG_BLENDINDICES6,"BLENDINDICES6",2699,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices7,CG_BLENDINDICES7,"BLENDINDICES7",2700,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices8,CG_BLENDINDICES8,"BLENDINDICES8",2701,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices9,CG_BLENDINDICES9,"BLENDINDICES9",2702,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices10,CG_BLENDINDICES10,"BLENDINDICES10",2703,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices11,CG_BLENDINDICES11,"BLENDINDICES11",2704,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices12,CG_BLENDINDICES12,"BLENDINDICES12",2705,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices13,CG_BLENDINDICES13,"BLENDINDICES13",2706,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices14,CG_BLENDINDICES14,"BLENDINDICES14",2707,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendIndices15,CG_BLENDINDICES15,"BLENDINDICES15",2708,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color0,CG_COLOR0,"COLOR0",2757,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color1,CG_COLOR1,"COLOR1",2758,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color2,CG_COLOR2,"COLOR2",2759,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color3,CG_COLOR3,"COLOR3",2760,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color4,CG_COLOR4,"COLOR4",2761,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color5,CG_COLOR5,"COLOR5",2762,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color6,CG_COLOR6,"COLOR6",2763,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color7,CG_COLOR7,"COLOR7",2764,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color8,CG_COLOR8,"COLOR8",2765,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color9,CG_COLOR9,"COLOR9",2766,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color10,CG_COLOR10,"COLOR10",2767,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color11,CG_COLOR11,"COLOR11",2768,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color12,CG_COLOR12,"COLOR12",2769,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color13,CG_COLOR13,"COLOR13",2770,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color14,CG_COLOR14,"COLOR14",2771,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Color15,CG_COLOR15,"COLOR15",2772,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize0,CG_PSIZE0,"PSIZE0",2821,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize1,CG_PSIZE1,"PSIZE1",2822,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize2,CG_PSIZE2,"PSIZE2",2823,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize3,CG_PSIZE3,"PSIZE3",2824,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize4,CG_PSIZE4,"PSIZE4",2825,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize5,CG_PSIZE5,"PSIZE5",2826,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize6,CG_PSIZE6,"PSIZE6",2827,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize7,CG_PSIZE7,"PSIZE7",2828,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize8,CG_PSIZE8,"PSIZE8",2829,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize9,CG_PSIZE9,"PSIZE9",2830,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize10,CG_PSIZE10,"PSIZE10",2831,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize11,CG_PSIZE11,"PSIZE11",2832,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize12,CG_PSIZE12,"PSIZE12",2833,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize13,CG_PSIZE13,"PSIZE13",2834,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize14,CG_PSIZE14,"PSIZE14",2835,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PSize15,CG_PSIZE15,"PSIZE15",2836,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal0,CG_BINORMAL0,"BINORMAL0",2885,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal1,CG_BINORMAL1,"BINORMAL1",2886,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal2,CG_BINORMAL2,"BINORMAL2",2887,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal3,CG_BINORMAL3,"BINORMAL3",2888,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal4,CG_BINORMAL4,"BINORMAL4",2889,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal5,CG_BINORMAL5,"BINORMAL5",2890,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal6,CG_BINORMAL6,"BINORMAL6",2891,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal7,CG_BINORMAL7,"BINORMAL7",2892,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal8,CG_BINORMAL8,"BINORMAL8",2893,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal9,CG_BINORMAL9,"BINORMAL9",2894,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal10,CG_BINORMAL10,"BINORMAL10",2895,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal11,CG_BINORMAL11,"BINORMAL11",2896,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal12,CG_BINORMAL12,"BINORMAL12",2897,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal13,CG_BINORMAL13,"BINORMAL13",2898,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal14,CG_BINORMAL14,"BINORMAL14",2899,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BiNormal15,CG_BINORMAL15,"BINORMAL15",2900,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG0,CG_FOG0,"FOG0",2917,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG1,CG_FOG1,"FOG1",2918,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG2,CG_FOG2,"FOG2",2919,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG3,CG_FOG3,"FOG3",2920,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG4,CG_FOG4,"FOG4",2921,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG5,CG_FOG5,"FOG5",2922,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG6,CG_FOG6,"FOG6",2923,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG7,CG_FOG7,"FOG7",2924,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG8,CG_FOG8,"FOG8",2925,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG9,CG_FOG9,"FOG9",2926,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG10,CG_FOG10,"FOG10",2927,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG11,CG_FOG11,"FOG11",2928,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG12,CG_FOG12,"FOG12",2929,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG13,CG_FOG13,"FOG13",2930,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG14,CG_FOG14,"FOG14",2931,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FOG15,CG_FOG15,"FOG15",2932,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH0,CG_DEPTH0,"DEPTH0",2933,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH1,CG_DEPTH1,"DEPTH1",2934,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH2,CG_DEPTH2,"DEPTH2",2935,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH3,CG_DEPTH3,"DEPTH3",2936,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH4,CG_DEPTH4,"DEPTH4",2937,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH5,CG_DEPTH5,"DEPTH5",2938,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH6,CG_DEPTH6,"DEPTH6",2939,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH7,CG_DEPTH7,"DEPTH7",2940,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH8,CG_DEPTH8,"DEPTH8",2941,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH9,CG_DEPTH9,"DEPTH9",2942,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH10,CG_DEPTH10,"DEPTH10",2943,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH11,CG_DEPTH11,"DEPTH11",2944,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH12,CG_DEPTH12,"DEPTH12",2945,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH13,CG_DEPTH13,"DEPTH13",2946,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH14,CG_DEPTH14,"DEPTH14",2947,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(DEPTH15,CG_DEPTH15,"DEPTH15",2948,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE0,CG_SAMPLE0,"SAMPLE0",2949,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE1,CG_SAMPLE1,"SAMPLE1",2950,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE2,CG_SAMPLE2,"SAMPLE2",2951,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE3,CG_SAMPLE3,"SAMPLE3",2952,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE4,CG_SAMPLE4,"SAMPLE4",2953,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE5,CG_SAMPLE5,"SAMPLE5",2954,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE6,CG_SAMPLE6,"SAMPLE6",2955,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE7,CG_SAMPLE7,"SAMPLE7",2956,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE8,CG_SAMPLE8,"SAMPLE8",2957,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE9,CG_SAMPLE9,"SAMPLE9",2958,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE10,CG_SAMPLE10,"SAMPLE10",2959,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE11,CG_SAMPLE11,"SAMPLE11",2960,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE12,CG_SAMPLE12,"SAMPLE12",2961,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE13,CG_SAMPLE13,"SAMPLE13",2962,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE14,CG_SAMPLE14,"SAMPLE14",2963,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SAMPLE15,CG_SAMPLE15,"SAMPLE15",2964,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight0,CG_BLENDWEIGHT0,"BLENDWEIGHT0",3028,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight1,CG_BLENDWEIGHT1,"BLENDWEIGHT1",3029,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight2,CG_BLENDWEIGHT2,"BLENDWEIGHT2",3030,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight3,CG_BLENDWEIGHT3,"BLENDWEIGHT3",3031,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight4,CG_BLENDWEIGHT4,"BLENDWEIGHT4",3032,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight5,CG_BLENDWEIGHT5,"BLENDWEIGHT5",3033,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight6,CG_BLENDWEIGHT6,"BLENDWEIGHT6",3034,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight7,CG_BLENDWEIGHT7,"BLENDWEIGHT7",3035,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight8,CG_BLENDWEIGHT8,"BLENDWEIGHT8",3036,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight9,CG_BLENDWEIGHT9,"BLENDWEIGHT9",3037,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight10,CG_BLENDWEIGHT10,"BLENDWEIGHT10",3038,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight11,CG_BLENDWEIGHT11,"BLENDWEIGHT11",3039,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight12,CG_BLENDWEIGHT12,"BLENDWEIGHT12",3040,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight13,CG_BLENDWEIGHT13,"BLENDWEIGHT13",3041,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight14,CG_BLENDWEIGHT14,"BLENDWEIGHT14",3042,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(BlendWeight15,CG_BLENDWEIGHT15,"BLENDWEIGHT15",3043,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal0,CG_NORMAL0,"NORMAL0",3092,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal1,CG_NORMAL1,"NORMAL1",3093,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal2,CG_NORMAL2,"NORMAL2",3094,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal3,CG_NORMAL3,"NORMAL3",3095,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal4,CG_NORMAL4,"NORMAL4",3096,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal5,CG_NORMAL5,"NORMAL5",3097,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal6,CG_NORMAL6,"NORMAL6",3098,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal7,CG_NORMAL7,"NORMAL7",3099,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal8,CG_NORMAL8,"NORMAL8",3100,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal9,CG_NORMAL9,"NORMAL9",3101,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal10,CG_NORMAL10,"NORMAL10",3102,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal11,CG_NORMAL11,"NORMAL11",3103,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal12,CG_NORMAL12,"NORMAL12",3104,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal13,CG_NORMAL13,"NORMAL13",3105,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal14,CG_NORMAL14,"NORMAL14",3106,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Normal15,CG_NORMAL15,"NORMAL15",3107,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(FogCoord,CG_FOGCOORD,"FOGCOORD",3156,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord0,CG_TEXCOORD0,"TEXCOORD0",3220,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord1,CG_TEXCOORD1,"TEXCOORD1",3221,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord2,CG_TEXCOORD2,"TEXCOORD2",3222,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord3,CG_TEXCOORD3,"TEXCOORD3",3223,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord4,CG_TEXCOORD4,"TEXCOORD4",3224,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord5,CG_TEXCOORD5,"TEXCOORD5",3225,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord6,CG_TEXCOORD6,"TEXCOORD6",3226,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord7,CG_TEXCOORD7,"TEXCOORD7",3227,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord8,CG_TEXCOORD8,"TEXCOORD8",3228,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord9,CG_TEXCOORD9,"TEXCOORD9",3229,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord10,CG_TEXCOORD10,"TEXCOORD10",3230,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord11,CG_TEXCOORD11,"TEXCOORD11",3231,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord12,CG_TEXCOORD12,"TEXCOORD12",3232,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord13,CG_TEXCOORD13,"TEXCOORD13",3233,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord14,CG_TEXCOORD14,"TEXCOORD14",3234,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(TexCoord15,CG_TEXCOORD15,"TEXCOORD15",3235,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(CombinerConst0,CG_COMBINER_CONST0,"COMBINER_CONST0",3284,0,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(CombinerConst1,CG_COMBINER_CONST1,"COMBINER_CONST1",3285,0,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(CombinerStageConst0,CG_COMBINER_STAGE_CONST0,"COMBINER_STAGE_CONST0",3286,1,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(CombinerStageConst1,CG_COMBINER_STAGE_CONST1,"COMBINER_STAGE_CONST1",3287,1,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(OffsetTextureMatrix,CG_OFFSET_TEXTURE_MATRIX,"OFFSET_TEXTURE_MATRIX",3288,0,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(OffsetTextureScale,CG_OFFSET_TEXTURE_SCALE,"OFFSET_TEXTURE_SCALE",3289,0,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(OffsetTextureBias,CG_OFFSET_TEXTURE_BIAS,"OFFSET_TEXTURE_BIAS",3290,0,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(ConstEye,CG_CONST_EYE,"CONST_EYE",3291,0,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(Coverage, CG_COVERAGE, "COVERAGE", 3292, 0, CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(TessFactor,CG_TESSFACTOR,"TESSFACTOR",3255,0,CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(GLSLUniform,CG_GLSL_UNIFORM,"glsl_uniform",3300,1,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(GLSLAttrib,CG_GLSL_ATTRIB,"glsl_attrib",3301,1,CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(Env,CG_ENV,"ENV",3302,1,CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(HLSLUniform,CG_HLSL_UNIFORM,"hlsl_uniform",3559,1,CGI_UNIFORM_PARAM)
+CG_BINDLOCATION_MACRO(HLSLAttrib,CG_HLSL_VARYING,"hlsl_attrib",3560,1,CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(SamplerResource,CG_SAMPLER_RES, "SAMPLER_RES", 3561, 1, CGI_UNIFORM_PARAM)
+
+CG_BINDLOCATION_MACRO(LastColor0, CG_LASTCOL0, "LASTCOL0", 4400, 0, CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(LastColor1, CG_LASTCOL1, "LASTCOL1", 4401, 0, CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(LastColor2, CG_LASTCOL2, "LASTCOL2", 4402, 0, CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(LastColor3, CG_LASTCOL3, "LASTCOL3", 4403, 0, CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(LastColor4, CG_LASTCOL4, "LASTCOL4", 4404, 0, CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(LastColor5, CG_LASTCOL5, "LASTCOL5", 4405, 0, CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(LastColor6, CG_LASTCOL6, "LASTCOL6", 4406, 0, CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(LastColor7, CG_LASTCOL7, "LASTCOL7", 4407, 0, CG_VARYING_PARAM)
+
+CG_BINDLOCATION_MACRO(Face,CG_FACE,"FACE",4410,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(PrimitiveId,CG_PRIMITIVEID,"PRIMITIVEID",4411,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(InstanceId,CG_INSTANCEID,"INSTANCEID",4412,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SampleId,CG_SAMPLEID,"SAMPLEID",4413,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(VertexId,CG_VERTEXID,"VERTEXID",4414,0,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(Layer,CG_LAYER,"LAYER",4415,1,CG_VARYING_PARAM)
+CG_BINDLOCATION_MACRO(SampleMask,CG_SAMPLEMASK,"SAMPLEMASK",4416,0,CG_VARYING_PARAM)
+
+#undef CG_BINDLOCATION_MACRO
diff --git a/Externals/Cg/cg_datatypes.h b/Externals/Cg/cg_datatypes.h
new file mode 100644
index 0000000000..f61d6fb302
--- /dev/null
+++ b/Externals/Cg/cg_datatypes.h
@@ -0,0 +1,191 @@
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+/*
+ * The following macro invocations define the supported CG basic data types.
+ *
+ * The macros have the form :
+ *
+ * CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, nrows, ncols, pc_name)
+ *
+ * name : The name of the data type.
+ * compiler_name : The name of the data type within the compiler syntax.
+ * enum_name : The C enumerant.
+ * base_name : The C enumerant of the base type.
+ * nrows : Number of rows for matrix types. Should be 0 other-wise.
+ * ncols : Number of columns for scalar, vector, and matrix types.
+ * pc_name : The C enumerant of the parameter class.
+ *
+ */
+
+
+
+CG_DATATYPE_MACRO(Half,half,CG_HALF,CG_HALF,0,1,CG_PARAMETERCLASS_SCALAR)
+CG_DATATYPE_MACRO(Half2,half2,CG_HALF2,CG_HALF,0,2,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Half3,half3,CG_HALF3,CG_HALF,0,3,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Half4,half4,CG_HALF4,CG_HALF,0,4,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Half1x1,half1x1,CG_HALF1x1,CG_HALF,1,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half1x2,half1x2,CG_HALF1x2,CG_HALF,1,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half1x3,half1x3,CG_HALF1x3,CG_HALF,1,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half1x4,half1x4,CG_HALF1x4,CG_HALF,1,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half2x1,half2x1,CG_HALF2x1,CG_HALF,2,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half2x2,half2x2,CG_HALF2x2,CG_HALF,2,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half2x3,half2x3,CG_HALF2x3,CG_HALF,2,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half2x4,half2x4,CG_HALF2x4,CG_HALF,2,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half3x1,half3x1,CG_HALF3x1,CG_HALF,3,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half3x2,half3x2,CG_HALF3x2,CG_HALF,3,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half3x3,half3x3,CG_HALF3x3,CG_HALF,3,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half3x4,half3x4,CG_HALF3x4,CG_HALF,3,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half4x1,half4x1,CG_HALF4x1,CG_HALF,4,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half4x2,half4x2,CG_HALF4x2,CG_HALF,4,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half4x3,half4x3,CG_HALF4x3,CG_HALF,4,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half4x4,half4x4,CG_HALF4x4,CG_HALF,4,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float,float,CG_FLOAT,CG_FLOAT,0,1,CG_PARAMETERCLASS_SCALAR)
+CG_DATATYPE_MACRO(Float2,float2,CG_FLOAT2,CG_FLOAT,0,2,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Float3,float3,CG_FLOAT3,CG_FLOAT,0,3,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Float4,float4,CG_FLOAT4,CG_FLOAT,0,4,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Float1x1,float1x1,CG_FLOAT1x1,CG_FLOAT,1,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float1x2,float1x2,CG_FLOAT1x2,CG_FLOAT,1,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float1x3,float1x3,CG_FLOAT1x3,CG_FLOAT,1,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float1x4,float1x4,CG_FLOAT1x4,CG_FLOAT,1,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float2x1,float2x1,CG_FLOAT2x1,CG_FLOAT,2,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float2x2,float2x2,CG_FLOAT2x2,CG_FLOAT,2,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float2x3,float2x3,CG_FLOAT2x3,CG_FLOAT,2,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float2x4,float2x4,CG_FLOAT2x4,CG_FLOAT,2,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float3x1,float3x1,CG_FLOAT3x1,CG_FLOAT,3,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float3x2,float3x2,CG_FLOAT3x2,CG_FLOAT,3,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float3x3,float3x3,CG_FLOAT3x3,CG_FLOAT,3,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float3x4,float3x4,CG_FLOAT3x4,CG_FLOAT,3,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float4x1,float4x1,CG_FLOAT4x1,CG_FLOAT,4,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float4x2,float4x2,CG_FLOAT4x2,CG_FLOAT,4,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float4x3,float4x3,CG_FLOAT4x3,CG_FLOAT,4,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Float4x4,float4x4,CG_FLOAT4x4,CG_FLOAT,4,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Sampler1D,sampler1D,CG_SAMPLER1D,CG_SAMPLER1D,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(Sampler2D,sampler2D,CG_SAMPLER2D,CG_SAMPLER2D,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(Sampler3D,sampler3D,CG_SAMPLER3D,CG_SAMPLER3D,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(SamplerRECT,samplerRECT,CG_SAMPLERRECT,CG_SAMPLERRECT,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(SamplerCUBE,samplerCUBE,CG_SAMPLERCUBE,CG_SAMPLERCUBE,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(Fixed,fixed,CG_FIXED,CG_FIXED,0,1,CG_PARAMETERCLASS_SCALAR)
+CG_DATATYPE_MACRO(Fixed2,fixed2,CG_FIXED2,CG_FIXED,0,2,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Fixed3,fixed3,CG_FIXED3,CG_FIXED,0,3,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Fixed4,fixed4,CG_FIXED4,CG_FIXED,0,4,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Fixed1x1,fixed1x1,CG_FIXED1x1,CG_FIXED,1,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed1x2,fixed1x2,CG_FIXED1x2,CG_FIXED,1,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed1x3,fixed1x3,CG_FIXED1x3,CG_FIXED,1,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed1x4,fixed1x4,CG_FIXED1x4,CG_FIXED,1,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed2x1,fixed2x1,CG_FIXED2x1,CG_FIXED,2,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed2x2,fixed2x2,CG_FIXED2x2,CG_FIXED,2,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed2x3,fixed2x3,CG_FIXED2x3,CG_FIXED,2,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed2x4,fixed2x4,CG_FIXED2x4,CG_FIXED,2,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed3x1,fixed3x1,CG_FIXED3x1,CG_FIXED,3,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed3x2,fixed3x2,CG_FIXED3x2,CG_FIXED,3,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed3x3,fixed3x3,CG_FIXED3x3,CG_FIXED,3,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed3x4,fixed3x4,CG_FIXED3x4,CG_FIXED,3,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed4x1,fixed4x1,CG_FIXED4x1,CG_FIXED,4,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed4x2,fixed4x2,CG_FIXED4x2,CG_FIXED,4,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed4x3,fixed4x3,CG_FIXED4x3,CG_FIXED,4,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Fixed4x4,fixed4x4,CG_FIXED4x4,CG_FIXED,4,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Half1,half1,CG_HALF1,CG_HALF,0,1,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Float1,float1,CG_FLOAT1,CG_FLOAT,0,1,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Fixed1,fixed1,CG_FIXED1,CG_FIXED,0,1,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Int,int,CG_INT,CG_INT,0,1,CG_PARAMETERCLASS_SCALAR)
+CG_DATATYPE_MACRO(Int1,int1,CG_INT1,CG_INT,0,1,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Int2,int2,CG_INT2,CG_INT,0,2,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Int3,int3,CG_INT3,CG_INT,0,3,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Int4,int4,CG_INT4,CG_INT,0,4,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Int1x1,int1x1,CG_INT1x1,CG_INT,1,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int1x2,int1x2,CG_INT1x2,CG_INT,1,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int1x3,int1x3,CG_INT1x3,CG_INT,1,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int1x4,int1x4,CG_INT1x4,CG_INT,1,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int2x1,int2x1,CG_INT2x1,CG_INT,2,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int2x2,int2x2,CG_INT2x2,CG_INT,2,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int2x3,int2x3,CG_INT2x3,CG_INT,2,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int2x4,int2x4,CG_INT2x4,CG_INT,2,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int3x1,int3x1,CG_INT3x1,CG_INT,3,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int3x2,int3x2,CG_INT3x2,CG_INT,3,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int3x3,int3x3,CG_INT3x3,CG_INT,3,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int3x4,int3x4,CG_INT3x4,CG_INT,3,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int4x1,int4x1,CG_INT4x1,CG_INT,4,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int4x2,int4x2,CG_INT4x2,CG_INT,4,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int4x3,int4x3,CG_INT4x3,CG_INT,4,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Int4x4,int4x4,CG_INT4x4,CG_INT,4,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool,bool,CG_BOOL,CG_BOOL,0,1,CG_PARAMETERCLASS_SCALAR)
+CG_DATATYPE_MACRO(Bool1,bool1,CG_BOOL1,CG_BOOL,0,1,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Bool2,bool2,CG_BOOL2,CG_BOOL,0,2,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Bool3,bool3,CG_BOOL3,CG_BOOL,0,3,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Bool4,bool4,CG_BOOL4,CG_BOOL,0,4,CG_PARAMETERCLASS_VECTOR)
+CG_DATATYPE_MACRO(Bool1x1,bool1x1,CG_BOOL1x1,CG_BOOL,1,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool1x2,bool1x2,CG_BOOL1x2,CG_BOOL,1,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool1x3,bool1x3,CG_BOOL1x3,CG_BOOL,1,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool1x4,bool1x4,CG_BOOL1x4,CG_BOOL,1,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool2x1,bool2x1,CG_BOOL2x1,CG_BOOL,2,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool2x2,bool2x2,CG_BOOL2x2,CG_BOOL,2,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool2x3,bool2x3,CG_BOOL2x3,CG_BOOL,2,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool2x4,bool2x4,CG_BOOL2x4,CG_BOOL,2,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool3x1,bool3x1,CG_BOOL3x1,CG_BOOL,3,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool3x2,bool3x2,CG_BOOL3x2,CG_BOOL,3,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool3x3,bool3x3,CG_BOOL3x3,CG_BOOL,3,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool3x4,bool3x4,CG_BOOL3x4,CG_BOOL,3,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool4x1,bool4x1,CG_BOOL4x1,CG_BOOL,4,1,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool4x2,bool4x2,CG_BOOL4x2,CG_BOOL,4,2,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool4x3,bool4x3,CG_BOOL4x3,CG_BOOL,4,3,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(Bool4x4,bool4x4,CG_BOOL4x4,CG_BOOL,4,4,CG_PARAMETERCLASS_MATRIX)
+CG_DATATYPE_MACRO(String,string,CG_STRING,CG_STRING,0,1,CG_PARAMETERCLASS_OBJECT)
+CG_DATATYPE_MACRO(Program,program,CG_PROGRAM_TYPE,CG_PROGRAM_TYPE,0,0,CG_PARAMETERCLASS_OBJECT)
+CG_DATATYPE_MACRO(Texture,texture,CG_TEXTURE,CG_TEXTURE,0,0,CG_PARAMETERCLASS_OBJECT)
+CG_DATATYPE_MACRO(Sampler1DARRAY,sampler1DARRAY,CG_SAMPLER1DARRAY,CG_SAMPLER1DARRAY,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(Sampler2DARRAY,sampler2DARRAY,CG_SAMPLER2DARRAY,CG_SAMPLER2DARRAY,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(SamplerCUBEARRAY,samplerCUBEARRAY,CG_SAMPLERCUBEARRAY,CG_SAMPLERCUBEARRAY,0,0,CG_PARAMETERCLASS_SAMPLER)
+CG_DATATYPE_MACRO(VertexShader, vertexshader, CG_VERTEXSHADER_TYPE, CG_VERTEXSHADER_TYPE, 0, 0, CG_PARAMETERCLASS_OBJECT)
+CG_DATATYPE_MACRO(PixelShader, pixelshader, CG_PIXELSHADER_TYPE, CG_PIXELSHADER_TYPE, 0, 0, CG_PARAMETERCLASS_OBJECT)
+CG_DATATYPE_MACRO(Sampler, sampler, CG_SAMPLER, CG_SAMPLER, 0, 0, CG_PARAMETERCLASS_SAMPLER)
+#undef CG_DATATYPE_MACRO
diff --git a/Externals/Cg/cg_enums.h b/Externals/Cg/cg_enums.h
new file mode 100644
index 0000000000..07cfd837a6
--- /dev/null
+++ b/Externals/Cg/cg_enums.h
@@ -0,0 +1,112 @@
+
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+/*
+ * The following macro invocations define the supported CG basic data types.
+ *
+ * The macros have the form :
+ *
+ * CG_ENUM_MACRO(enum_name, enum_val)
+ *
+ * enum_name : The C enumerant name.
+ * enum_val : The enumerant value.
+ *
+ */
+
+
+
+CG_ENUM_MACRO(CG_UNKNOWN, 4096)
+CG_ENUM_MACRO(CG_IN, 4097)
+CG_ENUM_MACRO(CG_OUT, 4098)
+CG_ENUM_MACRO(CG_INOUT, 4099)
+CG_ENUM_MACRO(CG_MIXED, 4100)
+CG_ENUM_MACRO(CG_VARYING, 4101)
+CG_ENUM_MACRO(CG_UNIFORM, 4102)
+CG_ENUM_MACRO(CG_CONSTANT, 4103)
+CG_ENUM_MACRO(CG_PROGRAM_SOURCE, 4104)
+CG_ENUM_MACRO(CG_PROGRAM_ENTRY, 4105)
+CG_ENUM_MACRO(CG_COMPILED_PROGRAM, 4106)
+CG_ENUM_MACRO(CG_PROGRAM_PROFILE, 4107)
+CG_ENUM_MACRO(CG_GLOBAL, 4108)
+CG_ENUM_MACRO(CG_PROGRAM, 4109)
+CG_ENUM_MACRO(CG_DEFAULT, 4110)
+CG_ENUM_MACRO(CG_ERROR, 4111)
+CG_ENUM_MACRO(CG_SOURCE, 4112)
+CG_ENUM_MACRO(CG_OBJECT, 4113)
+CG_ENUM_MACRO(CG_COMPILE_MANUAL, 4114)
+CG_ENUM_MACRO(CG_COMPILE_IMMEDIATE, 4115)
+CG_ENUM_MACRO(CG_COMPILE_LAZY, 4116)
+CG_ENUM_MACRO(CG_CURRENT, 4117)
+CG_ENUM_MACRO(CG_LITERAL, 4118)
+CG_ENUM_MACRO(CG_VERSION, 4119)
+CG_ENUM_MACRO(CG_ROW_MAJOR, 4120)
+CG_ENUM_MACRO(CG_COLUMN_MAJOR, 4121)
+CG_ENUM_MACRO(CG_FRAGMENT, 4122)
+CG_ENUM_MACRO(CG_VERTEX, 4123)
+CG_ENUM_MACRO(CG_POINT, 4124)
+CG_ENUM_MACRO(CG_LINE, 4125)
+CG_ENUM_MACRO(CG_LINE_ADJ, 4126)
+CG_ENUM_MACRO(CG_TRIANGLE, 4127)
+CG_ENUM_MACRO(CG_TRIANGLE_ADJ, 4128)
+CG_ENUM_MACRO(CG_POINT_OUT, 4129)
+CG_ENUM_MACRO(CG_LINE_OUT, 4130)
+CG_ENUM_MACRO(CG_TRIANGLE_OUT, 4131)
+CG_ENUM_MACRO(CG_IMMEDIATE_PARAMETER_SETTING, 4132)
+CG_ENUM_MACRO(CG_DEFERRED_PARAMETER_SETTING, 4133)
+CG_ENUM_MACRO(CG_NO_LOCKS_POLICY, 4134)
+CG_ENUM_MACRO(CG_THREAD_SAFE_POLICY, 4135)
+CG_ENUM_MACRO(CG_FORCE_UPPER_CASE_POLICY, 4136)
+CG_ENUM_MACRO(CG_UNCHANGED_CASE_POLICY, 4137)
+#undef CG_ENUM_MACRO
+
+
diff --git a/Externals/Cg/cg_errors.h b/Externals/Cg/cg_errors.h
new file mode 100644
index 0000000000..73731e16f6
--- /dev/null
+++ b/Externals/Cg/cg_errors.h
@@ -0,0 +1,320 @@
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * The following macro invocations define error codes returned by various cg
+ * API functions.
+ *
+ * The macros have the form :
+ *
+ * CG_ERROR_MACRO(code, enum_name, message)
+ *
+ * code : The integer error code associated with the error.
+ * enum_name : The name of enumerant of the error code in the API.
+ * message : A description string associated with the error.
+ *
+ */
+
+
+CG_ERROR_MACRO(0,
+ CG_NO_ERROR,
+ "No error has occurred.")
+
+CG_ERROR_MACRO(1,
+ CG_COMPILER_ERROR,
+ "The compile returned an error.")
+
+CG_ERROR_MACRO(2,
+ CG_INVALID_PARAMETER_ERROR,
+ "The parameter used is invalid.")
+
+CG_ERROR_MACRO(3,
+ CG_INVALID_PROFILE_ERROR,
+ "The profile is not supported.")
+
+CG_ERROR_MACRO(4,
+ CG_PROGRAM_LOAD_ERROR,
+ "The program could not load.")
+
+CG_ERROR_MACRO(5,
+ CG_PROGRAM_BIND_ERROR,
+ "The program could not bind.")
+
+CG_ERROR_MACRO(6,
+ CG_PROGRAM_NOT_LOADED_ERROR,
+ "The program must be loaded before this operation may be used.")
+
+CG_ERROR_MACRO(7,
+ CG_UNSUPPORTED_GL_EXTENSION_ERROR,
+ "An unsupported GL extension was required to perform this operation.")
+
+CG_ERROR_MACRO(8,
+ CG_INVALID_VALUE_TYPE_ERROR,
+ "An unknown value type was assigned to a parameter.")
+
+CG_ERROR_MACRO(9,
+ CG_NOT_MATRIX_PARAM_ERROR,
+ "The parameter is not of matrix type.")
+
+CG_ERROR_MACRO(10,
+ CG_INVALID_ENUMERANT_ERROR,
+ "The enumerant parameter has an invalid value.")
+
+CG_ERROR_MACRO(11,
+ CG_NOT_4x4_MATRIX_ERROR,
+ "The parameter must be a 4x4 matrix type.")
+
+CG_ERROR_MACRO(12,
+ CG_FILE_READ_ERROR,
+ "The file could not be read.")
+
+CG_ERROR_MACRO(13,
+ CG_FILE_WRITE_ERROR,
+ "The file could not be written.")
+
+CG_ERROR_MACRO(14,
+ CG_NVPARSE_ERROR,
+ "nvparse could not successfully parse the output from the Cg "
+ "compiler backend.")
+
+CG_ERROR_MACRO(15,
+ CG_MEMORY_ALLOC_ERROR,
+ "Memory allocation failed.")
+
+CG_ERROR_MACRO(16,
+ CG_INVALID_CONTEXT_HANDLE_ERROR,
+ "Invalid context handle.")
+
+CG_ERROR_MACRO(17,
+ CG_INVALID_PROGRAM_HANDLE_ERROR,
+ "Invalid program handle.")
+
+CG_ERROR_MACRO(18,
+ CG_INVALID_PARAM_HANDLE_ERROR,
+ "Invalid parameter handle.")
+
+CG_ERROR_MACRO(19,
+ CG_UNKNOWN_PROFILE_ERROR,
+ "The specified profile is unknown.")
+
+CG_ERROR_MACRO(20,
+ CG_VAR_ARG_ERROR,
+ "The variable arguments were specified incorrectly.")
+
+CG_ERROR_MACRO(21,
+ CG_INVALID_DIMENSION_ERROR,
+ "The dimension value is invalid.")
+
+CG_ERROR_MACRO(22,
+ CG_ARRAY_PARAM_ERROR,
+ "The parameter must be an array.")
+
+CG_ERROR_MACRO(23,
+ CG_OUT_OF_ARRAY_BOUNDS_ERROR,
+ "Index into the array is out of bounds.")
+
+CG_ERROR_MACRO(24,
+ CG_CONFLICTING_TYPES_ERROR,
+ "A type being added to the context conflicts with an "
+ "existing type.")
+
+CG_ERROR_MACRO(25,
+ CG_CONFLICTING_PARAMETER_TYPES_ERROR,
+ "The parameters being bound have conflicting types.")
+
+CG_ERROR_MACRO(26,
+ CG_PARAMETER_IS_NOT_SHARED_ERROR,
+ "The parameter must be global.")
+
+CG_ERROR_MACRO(27,
+ CG_INVALID_PARAMETER_VARIABILITY_ERROR,
+ "The parameter could not be changed to the given variability.")
+
+CG_ERROR_MACRO(28,
+ CG_CANNOT_DESTROY_PARAMETER_ERROR,
+ "Cannot destroy the parameter. It is bound to other parameters "
+ "or is not a root parameter.")
+
+
+CG_ERROR_MACRO(29,
+ CG_NOT_ROOT_PARAMETER_ERROR,
+ "The parameter is not a root parameter.")
+
+CG_ERROR_MACRO(30,
+ CG_PARAMETERS_DO_NOT_MATCH_ERROR,
+ "The two parameters being bound do not match.")
+
+CG_ERROR_MACRO(31,
+ CG_IS_NOT_PROGRAM_PARAMETER_ERROR,
+ "The parameter is not a program parameter.")
+
+CG_ERROR_MACRO(32,
+ CG_INVALID_PARAMETER_TYPE_ERROR,
+ "The type of the parameter is invalid.")
+
+CG_ERROR_MACRO(33,
+ CG_PARAMETER_IS_NOT_RESIZABLE_ARRAY_ERROR,
+ "The parameter must be a resizable array.")
+
+CG_ERROR_MACRO(34,
+ CG_INVALID_SIZE_ERROR,
+ "The size value is invalid.")
+
+CG_ERROR_MACRO(35,
+ CG_BIND_CREATES_CYCLE_ERROR,
+ "Cannot bind the given parameters. Binding will form a cycle.")
+
+CG_ERROR_MACRO(36,
+ CG_ARRAY_TYPES_DO_NOT_MATCH_ERROR,
+ "Cannot bind the given parameters. Array types do not match.")
+
+CG_ERROR_MACRO(37,
+ CG_ARRAY_DIMENSIONS_DO_NOT_MATCH_ERROR,
+ "Cannot bind the given parameters. "
+ "Array dimensions do not match.")
+
+CG_ERROR_MACRO(38,
+ CG_ARRAY_HAS_WRONG_DIMENSION_ERROR,
+ "The array has the wrong dimension.")
+
+CG_ERROR_MACRO(39,
+ CG_TYPE_IS_NOT_DEFINED_IN_PROGRAM_ERROR,
+ "Connecting the parameters failed because The type of the "
+ "source parameter is not defined within the given program "
+ "or does not match the type with the same name in the program.")
+
+CG_ERROR_MACRO(40,
+ CG_INVALID_EFFECT_HANDLE_ERROR,
+ "Invalid effect handle.")
+
+CG_ERROR_MACRO(41,
+ CG_INVALID_STATE_HANDLE_ERROR,
+ "Invalid state handle.")
+
+CG_ERROR_MACRO(42,
+ CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR,
+ "Invalid stateassignment handle.")
+
+CG_ERROR_MACRO(43,
+ CG_INVALID_PASS_HANDLE_ERROR,
+ "Invalid pass handle.")
+
+CG_ERROR_MACRO(44,
+ CG_INVALID_ANNOTATION_HANDLE_ERROR,
+ "Invalid annotation handle.")
+
+CG_ERROR_MACRO(45,
+ CG_INVALID_TECHNIQUE_HANDLE_ERROR,
+ "Invalid technique handle.")
+
+// Do not use this! Use CG_INVALID_PARAM_HANDLE_ERROR instead.
+CG_ERROR_MACRO(46,
+ CG_INVALID_PARAMETER_HANDLE_ERROR,
+ "Invalid parameter handle.")
+
+CG_ERROR_MACRO(47,
+ CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR,
+ "Operation is not valid for this type of stateassignment.")
+
+CG_ERROR_MACRO(48,
+ CG_INVALID_FUNCTION_HANDLE_ERROR,
+ "Invalid function handle.")
+
+CG_ERROR_MACRO(49,
+ CG_INVALID_TECHNIQUE_ERROR,
+ "Technique did not pass validation.")
+
+CG_ERROR_MACRO(50,
+ CG_INVALID_POINTER_ERROR,
+ "The supplied pointer is NULL.")
+
+CG_ERROR_MACRO(51,
+ CG_NOT_ENOUGH_DATA_ERROR,
+ "Not enough data was provided.")
+
+CG_ERROR_MACRO(52,
+ CG_NON_NUMERIC_PARAMETER_ERROR,
+ "The parameter is not of a numeric type.")
+
+CG_ERROR_MACRO(53,
+ CG_ARRAY_SIZE_MISMATCH_ERROR,
+ "The specified array sizes are not compatible with the given array.")
+
+CG_ERROR_MACRO(54,
+ CG_CANNOT_SET_NON_UNIFORM_PARAMETER_ERROR,
+ "Cannot set the value of a non-uniform parameter.")
+
+CG_ERROR_MACRO(55,
+ CG_DUPLICATE_NAME_ERROR,
+ "This name is already in use.")
+
+CG_ERROR_MACRO(56,
+ CG_INVALID_OBJ_HANDLE_ERROR,
+ "Invalid object handle.")
+
+CG_ERROR_MACRO(57,
+ CG_INVALID_BUFFER_HANDLE_ERROR,
+ "Invalid buffer handle.")
+
+CG_ERROR_MACRO(58,
+ CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR,
+ "Buffer index is out of bounds.")
+
+CG_ERROR_MACRO(59,
+ CG_BUFFER_ALREADY_MAPPED_ERROR,
+ "The buffer is already mapped.")
+
+CG_ERROR_MACRO(60,
+ CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR,
+ "The buffer cannot be updated.")
+
+#undef CG_ERROR_MACRO
+
diff --git a/Externals/Cg/cg_profiles.h b/Externals/Cg/cg_profiles.h
new file mode 100644
index 0000000000..6b995f6e50
--- /dev/null
+++ b/Externals/Cg/cg_profiles.h
@@ -0,0 +1,95 @@
+/*
+ *
+ * Copyright (c) 2002-2007, NVIDIA Corporation.
+ *
+ *
+ *
+ * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
+ * of your agreement to the following terms, and your use, installation,
+ * modification or redistribution of this NVIDIA software constitutes
+ * acceptance of these terms. If you do not agree with these terms, please do
+ * not use, install, modify or redistribute this NVIDIA software.
+ *
+ *
+ *
+ * In consideration of your agreement to abide by the following terms, and
+ * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
+ * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
+ * Software"), to use, reproduce, modify and redistribute the NVIDIA
+ * Software, with or without modifications, in source and/or binary forms;
+ * provided that if you redistribute the NVIDIA Software, you must retain the
+ * copyright notice of NVIDIA, this notice and the following text and
+ * disclaimers in all such redistributions of the NVIDIA Software. Neither the
+ * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
+ * to endorse or promote products derived from the NVIDIA Software without
+ * specific prior written permission from NVIDIA. Except as expressly stated
+ * in this notice, no other rights or licenses express or implied, are granted
+ * by NVIDIA herein, including but not limited to any patent rights that may be
+ * infringed by your derivative works or by other works in which the NVIDIA
+ * Software may be incorporated. No hardware is licensed hereunder.
+ *
+ *
+ *
+ * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
+ * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
+ *
+ *
+ *
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
+ * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
+ * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
+ * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
+ * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * The following macro invocations define the supported CG profiles.
+ *
+ * The macros have the form :
+ *
+ * CG_PROFILE_MACRO(name, compiler_id, compiler_opt)
+ *
+ * name : The name of the profile. Used consistently with the API.
+ * compiler_id : The identifier string for the profile used by the compiler.
+ * compiler_id_caps : compiler_id in caps.
+ * compiler_opt : The command-line switch used to force compilation into
+ * the profile.
+ * int_id : Integer enumerant associated with this bind location.
+ * vertex_profile : Non-zero if this is a vertex profile, otherwise it
+ * is considered to be a fragment profile.
+ *
+ *
+ */
+
+#define CG_IN_PROFILES_INCLUDE
+
+#include
+
+
+CG_PROFILE_MACRO(DX9Vertex11,vs_1_1,VS_1_1,"vs_1_1",6153,1)
+CG_PROFILE_MACRO(DX9Vertex20,vs_2_0,VS_2_0,"vs_2_0",6154,1)
+CG_PROFILE_MACRO(DX9Vertex2x,vs_2_x,VS_2_X,"vs_2_x",6155,1)
+CG_PROFILE_MACRO(DX9Vertex2sw,vs_2_sw,VS_2_SW,"vs_2_sw",6156,1)
+CG_PROFILE_MACRO(DX9Vertex30,vs_3_0,VS_3_0,"vs_3_0",6157,1)
+CG_PROFILE_MACRO(DX9VertexHLSL,hlslv, HLSLV,"hlslv",6158,1)
+
+CG_PROFILE_MACRO(DX9Pixel11,ps_1_1,PS_1_1,"ps_1_1",6159,0)
+CG_PROFILE_MACRO(DX9Pixel12,ps_1_2,PS_1_2,"ps_1_2",6160,0)
+CG_PROFILE_MACRO(DX9Pixel13,ps_1_3,PS_1_3,"ps_1_3",6161,0)
+CG_PROFILE_MACRO(DX9Pixel20,ps_2_0,PS_2_0,"ps_2_0",6162,0)
+CG_PROFILE_MACRO(DX9Pixel2x,ps_2_x,PS_2_X,"ps_2_x",6163,0)
+CG_PROFILE_MACRO(DX9Pixel2sw,ps_2_sw,PS_2_SW,"ps_2_sw",6164,0)
+CG_PROFILE_MACRO(DX9Pixel30,ps_3_0,PS_3_0,"ps_3_0",6165,0)
+CG_PROFILE_MACRO(DX9PixelHLSL,hlslf,HLSLF,"hlslf",6166,0)
+
+CG_PROFILE_MACRO(Generic, generic, GENERIC, "generic", 7002,0)
+
+#undef CG_PROFILE_MACRO
+#undef CG_IN_PROFILES_INCLUDE
diff --git a/Externals/Cg64/cg.lib b/Externals/Cg64/cg.lib
new file mode 100644
index 0000000000..f9022d7b37
Binary files /dev/null and b/Externals/Cg64/cg.lib differ
diff --git a/Externals/Cg64/cgGL.lib b/Externals/Cg64/cgGL.lib
new file mode 100644
index 0000000000..97338019b2
Binary files /dev/null and b/Externals/Cg64/cgGL.lib differ
diff --git a/Externals/WTL80/atlapp.h b/Externals/WTL80/atlapp.h
new file mode 100644
index 0000000000..b62e097044
--- /dev/null
+++ b/Externals/WTL80/atlapp.h
@@ -0,0 +1,1688 @@
+// Windows Template Library - WTL version 8.0
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// This file is a part of the Windows Template Library.
+// The use and distribution terms for this software are covered by the
+// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php)
+// which can be found in the file CPL.TXT at the root of this distribution.
+// By using this software in any fashion, you are agreeing to be bound by
+// the terms of this license. You must not remove this notice, or
+// any other, from this software.
+
+#ifndef __ATLAPP_H__
+#define __ATLAPP_H__
+
+#pragma once
+
+#ifndef __cplusplus
+ #error ATL requires C++ compilation (use a .cpp suffix)
+#endif
+
+#ifndef __ATLBASE_H__
+ #error atlapp.h requires atlbase.h to be included first
+#endif
+
+#ifndef _WIN32_WCE
+ #if (WINVER < 0x0400)
+ #error WTL requires Windows version 4.0 or higher
+ #endif
+
+ #if (_WIN32_IE < 0x0300)
+ #error WTL requires IE version 3.0 or higher
+ #endif
+#endif
+
+#ifdef _ATL_NO_COMMODULE
+ #error WTL requires that _ATL_NO_COMMODULE is not defined
+#endif // _ATL_NO_COMMODULE
+
+#if defined(_WIN32_WCE) && defined(_ATL_MIN_CRT)
+ #pragma message("Warning: WTL for Windows CE doesn't use _ATL_MIN_CRT")
+#endif // defined(_WIN32_WCE) && defined(_ATL_MIN_CRT)
+
+#include
+#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE)
+ #include // for _beginthreadex
+#endif
+
+#if (_ATL_VER < 0x0800) && !defined(_DEBUG)
+ #include
+#endif
+
+#include
+#ifndef _WIN32_WCE
+#pragma comment(lib, "comctl32.lib")
+#endif // !_WIN32_WCE
+
+#ifndef _WIN32_WCE
+ #include "atlres.h"
+#else // CE specific
+ #include "atlresce.h"
+#endif // _WIN32_WCE
+
+// We need to disable this warning because of template class arguments
+#pragma warning(disable: 4127)
+
+
+///////////////////////////////////////////////////////////////////////////////
+// WTL version number
+
+#define _WTL_VER 0x0800
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Classes in this file:
+//
+// CMessageFilter
+// CIdleHandler
+// CMessageLoop
+//
+// CAppModule
+// CServerAppModule
+//
+// Global functions:
+// AtlGetDefaultGuiFont()
+// AtlCreateBoldFont()
+// AtlInitCommonControls()
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Global support for Windows CE
+
+#ifdef _WIN32_WCE
+
+#ifndef SW_SHOWDEFAULT
+ #define SW_SHOWDEFAULT SW_SHOWNORMAL
+#endif // !SW_SHOWDEFAULT
+
+// These get's OR-ed in a constant and will have no effect.
+// Defining them reduces the number of #ifdefs required for CE.
+#define LR_DEFAULTSIZE 0
+#define LR_LOADFROMFILE 0
+
+#ifndef SM_CXCURSOR
+ #define SM_CXCURSOR 13
+#endif
+#ifndef SM_CYCURSOR
+ #define SM_CYCURSOR 14
+#endif
+
+inline BOOL IsMenu(HMENU hMenu)
+{
+ MENUITEMINFO mii = { sizeof(MENUITEMINFO) };
+ ::SetLastError(0);
+ BOOL bRet = ::GetMenuItemInfo(hMenu, 0, TRUE, &mii);
+ if(!bRet)
+ bRet = (::GetLastError() != ERROR_INVALID_MENU_HANDLE) ? TRUE : FALSE;
+ return bRet;
+}
+
+#if (_WIN32_WCE >= 410)
+extern "C" void WINAPI ListView_SetItemSpacing(HWND hwndLV, int iHeight);
+#endif // (_WIN32_WCE >= 410)
+
+inline int MulDiv(IN int nNumber, IN int nNumerator, IN int nDenominator)
+{
+ __int64 multiple = nNumber * nNumerator;
+ return static_cast(multiple / nDenominator);
+}
+
+#if (_ATL_VER >= 0x0800)
+
+#ifndef _WTL_KEEP_WS_OVERLAPPEDWINDOW
+ #ifdef WS_OVERLAPPEDWINDOW
+ #undef WS_OVERLAPPEDWINDOW
+ #define WS_OVERLAPPEDWINDOW 0
+ #endif // WS_OVERLAPPEDWINDOW
+#endif // !_WTL_KEEP_WS_OVERLAPPEDWINDOW
+
+#ifndef RDW_FRAME
+ #define RDW_FRAME 0
+#endif // !RDW_FRAME
+
+#ifndef WM_WINDOWPOSCHANGING
+ #define WM_WINDOWPOSCHANGING 0
+#endif // !WM_WINDOWPOSCHANGING
+
+#define FreeResource(x)
+#define UnlockResource(x)
+
+namespace ATL
+{
+ inline HRESULT CComModule::RegisterClassObjects(DWORD /*dwClsContext*/, DWORD /*dwFlags*/) throw()
+ { return E_NOTIMPL; }
+ inline HRESULT CComModule::RevokeClassObjects() throw()
+ { return E_NOTIMPL; }
+}; // namespace ATL
+
+#ifndef lstrlenW
+ #define lstrlenW (int)ATL::lstrlenW
+#endif // lstrlenW
+
+inline int WINAPI lstrlenA(LPCSTR lpszString)
+{ return ATL::lstrlenA(lpszString); }
+
+#ifdef lstrcpyn
+ #undef lstrcpyn
+ #define lstrcpyn ATL::lstrcpynW
+#endif // lstrcpyn
+
+#ifndef SetWindowLongPtrW
+ inline LONG_PTR tmp_SetWindowLongPtrW( HWND hWnd, int nIndex, LONG_PTR dwNewLong )
+ {
+ return( ::SetWindowLongW( hWnd, nIndex, LONG( dwNewLong ) ) );
+ }
+ #define SetWindowLongPtrW tmp_SetWindowLongPtrW
+#endif
+
+#ifndef GetWindowLongPtrW
+ inline LONG_PTR tmp_GetWindowLongPtrW( HWND hWnd, int nIndex )
+ {
+ return( ::GetWindowLongW( hWnd, nIndex ) );
+ }
+ #define GetWindowLongPtrW tmp_GetWindowLongPtrW
+#endif
+
+#ifndef LongToPtr
+ #define LongToPtr(x) ((void*)x)
+#endif
+
+#ifndef PtrToInt
+ #define PtrToInt( p ) ((INT)(INT_PTR) (p) )
+#endif
+
+#else // !(_ATL_VER >= 0x0800)
+
+#ifdef lstrlenW
+ #undef lstrlenW
+ #define lstrlenW (int)::wcslen
+#endif // lstrlenW
+
+#define lstrlenA (int)strlen
+
+#ifndef lstrcpyn
+ inline LPTSTR lstrcpyn(LPTSTR lpstrDest, LPCTSTR lpstrSrc, int nLength)
+ {
+ if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0)
+ return NULL;
+ int nLen = min(lstrlen(lpstrSrc), nLength - 1);
+ LPTSTR lpstrRet = (LPTSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(TCHAR));
+ lpstrDest[nLen] = 0;
+ return lpstrRet;
+ }
+#endif // !lstrcpyn
+
+#ifndef lstrcpynW
+ inline LPWSTR lstrcpynW(LPWSTR lpstrDest, LPCWSTR lpstrSrc, int nLength)
+ {
+ return lstrcpyn(lpstrDest, lpstrSrc, nLength); // WinCE is Unicode only
+ }
+#endif // !lstrcpynW
+
+#ifndef lstrcpynA
+ inline LPSTR lstrcpynA(LPSTR lpstrDest, LPCSTR lpstrSrc, int nLength)
+ {
+ if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0)
+ return NULL;
+ int nLen = min(lstrlenA(lpstrSrc), nLength - 1);
+ LPSTR lpstrRet = (LPSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(char));
+ lpstrDest[nLen] = 0;
+ return lpstrRet;
+ }
+#endif // !lstrcpyn
+
+#ifdef TrackPopupMenu
+ #undef TrackPopupMenu
+#endif // TrackPopupMenu
+
+#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \
+static CWndClassInfo& GetWndClassInfo() \
+{ \
+ static CWndClassInfo wc = \
+ { \
+ { style, StartWindowProc, \
+ 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \
+ NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \
+ }; \
+ return wc; \
+}
+
+#ifndef _MAX_FNAME
+ #define _MAX_FNAME _MAX_PATH
+#endif // _MAX_FNAME
+
+#if (_WIN32_WCE < 400)
+ #define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i)))
+#endif // (_WIN32_WCE < 400)
+
+#if (_WIN32_WCE < 410)
+ #define WHEEL_PAGESCROLL (UINT_MAX)
+ #define WHEEL_DELTA 120
+#endif // (_WIN32_WCE < 410)
+
+#ifdef DrawIcon
+ #undef DrawIcon
+#endif
+
+#ifndef VARCMP_LT
+ #define VARCMP_LT 0
+#endif
+#ifndef VARCMP_EQ
+ #define VARCMP_EQ 1
+#endif
+#ifndef VARCMP_GT
+ #define VARCMP_GT 2
+#endif
+#ifndef VARCMP_NULL
+ #define VARCMP_NULL 3
+#endif
+
+#ifndef RDW_ALLCHILDREN
+ #define RDW_ALLCHILDREN 0
+#endif
+
+#endif // !(_ATL_VER >= 0x0800)
+
+#endif // _WIN32_WCE
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Global support for using original VC++ 6.0 headers with WTL
+
+#ifndef _ATL_NO_OLD_HEADERS_WIN64
+#if !defined(_WIN64) && (_ATL_VER < 0x0700)
+
+ #ifndef PSM_INSERTPAGE
+ #define PSM_INSERTPAGE (WM_USER + 119)
+ #endif // !PSM_INSERTPAGE
+
+ #ifndef GetClassLongPtr
+ #define GetClassLongPtrA GetClassLongA
+ #define GetClassLongPtrW GetClassLongW
+ #ifdef UNICODE
+ #define GetClassLongPtr GetClassLongPtrW
+ #else
+ #define GetClassLongPtr GetClassLongPtrA
+ #endif // !UNICODE
+ #endif // !GetClassLongPtr
+
+ #ifndef GCLP_HICONSM
+ #define GCLP_HICONSM (-34)
+ #endif // !GCLP_HICONSM
+
+ #ifndef GetWindowLongPtr
+ #define GetWindowLongPtrA GetWindowLongA
+ #define GetWindowLongPtrW GetWindowLongW
+ #ifdef UNICODE
+ #define GetWindowLongPtr GetWindowLongPtrW
+ #else
+ #define GetWindowLongPtr GetWindowLongPtrA
+ #endif // !UNICODE
+ #endif // !GetWindowLongPtr
+
+ #ifndef SetWindowLongPtr
+ #define SetWindowLongPtrA SetWindowLongA
+ #define SetWindowLongPtrW SetWindowLongW
+ #ifdef UNICODE
+ #define SetWindowLongPtr SetWindowLongPtrW
+ #else
+ #define SetWindowLongPtr SetWindowLongPtrA
+ #endif // !UNICODE
+ #endif // !SetWindowLongPtr
+
+ #ifndef GWLP_WNDPROC
+ #define GWLP_WNDPROC (-4)
+ #endif
+ #ifndef GWLP_HINSTANCE
+ #define GWLP_HINSTANCE (-6)
+ #endif
+ #ifndef GWLP_HWNDPARENT
+ #define GWLP_HWNDPARENT (-8)
+ #endif
+ #ifndef GWLP_USERDATA
+ #define GWLP_USERDATA (-21)
+ #endif
+ #ifndef GWLP_ID
+ #define GWLP_ID (-12)
+ #endif
+
+ #ifndef DWLP_MSGRESULT
+ #define DWLP_MSGRESULT 0
+ #endif
+
+ typedef long LONG_PTR;
+ typedef unsigned long ULONG_PTR;
+ typedef ULONG_PTR DWORD_PTR;
+
+ #ifndef HandleToUlong
+ #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) )
+ #endif
+ #ifndef HandleToLong
+ #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) )
+ #endif
+ #ifndef LongToHandle
+ #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h))
+ #endif
+ #ifndef PtrToUlong
+ #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) )
+ #endif
+ #ifndef PtrToLong
+ #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) )
+ #endif
+ #ifndef PtrToUint
+ #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) )
+ #endif
+ #ifndef PtrToInt
+ #define PtrToInt( p ) ((INT)(INT_PTR) (p) )
+ #endif
+ #ifndef PtrToUshort
+ #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) )
+ #endif
+ #ifndef PtrToShort
+ #define PtrToShort( p ) ((short)(LONG_PTR)(p) )
+ #endif
+ #ifndef IntToPtr
+ #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)i))
+ #endif
+ #ifndef UIntToPtr
+ #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)ui))
+ #endif
+ #ifndef LongToPtr
+ #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)l))
+ #endif
+ #ifndef ULongToPtr
+ #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul))
+ #endif
+
+#endif // !defined(_WIN64) && (_ATL_VER < 0x0700)
+#endif // !_ATL_NO_OLD_HEADERS_WIN64
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Global support for SecureHelper functions
+
+#ifndef _TRUNCATE
+ #define _TRUNCATE ((size_t)-1)
+#endif
+
+#ifndef _ERRCODE_DEFINED
+ #define _ERRCODE_DEFINED
+ typedef int errno_t;
+#endif
+
+#ifndef _SECURECRT_ERRCODE_VALUES_DEFINED
+ #define _SECURECRT_ERRCODE_VALUES_DEFINED
+ #define EINVAL 22
+ #define STRUNCATE 80
+#endif
+
+#ifndef _countof
+ #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Miscellaneous global support
+
+// define useful macros from winuser.h
+#ifndef IS_INTRESOURCE
+ #define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0)
+#endif // IS_INTRESOURCE
+
+// protect template members from windowsx.h macros
+#ifdef _INC_WINDOWSX
+ #undef SubclassWindow
+#endif // _INC_WINDOWSX
+
+// define useful macros from windowsx.h
+#ifndef GET_X_LPARAM
+ #define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam))
+#endif
+#ifndef GET_Y_LPARAM
+ #define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam))
+#endif
+
+// Dummy structs for compiling with /CLR
+#if (_MSC_VER >= 1300) && defined(_MANAGED)
+ __if_not_exists(_IMAGELIST::_IMAGELIST) { struct _IMAGELIST { }; }
+ __if_not_exists(_TREEITEM::_TREEITEM) { struct _TREEITEM { }; }
+ __if_not_exists(_PSP::_PSP) { struct _PSP { }; }
+#endif
+
+// Define ATLVERIFY macro for ATL3
+#if (_ATL_VER < 0x0700)
+ #ifndef ATLVERIFY
+ #ifdef _DEBUG
+ #define ATLVERIFY(expr) ATLASSERT(expr)
+ #else
+ #define ATLVERIFY(expr) (expr)
+ #endif // DEBUG
+ #endif // ATLVERIFY
+#endif // (_ATL_VER < 0x0700)
+
+// Forward declaration for ATL3 fix
+#if (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE)
+ namespace ATL { HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); };
+#endif
+
+
+namespace WTL
+{
+
+#if (_ATL_VER >= 0x0700)
+ DECLARE_TRACE_CATEGORY(atlTraceUI);
+ #ifdef _DEBUG
+ __declspec(selectany) ATL::CTraceCategory atlTraceUI(_T("atlTraceUI"));
+ #endif // _DEBUG
+#else // !(_ATL_VER >= 0x0700)
+ enum wtlTraceFlags
+ {
+ atlTraceUI = 0x10000000
+ };
+#endif // !(_ATL_VER >= 0x0700)
+
+// Windows version helper
+inline bool AtlIsOldWindows()
+{
+ OSVERSIONINFO ovi = { 0 };
+ ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ BOOL bRet = ::GetVersionEx(&ovi);
+ return (!bRet || !((ovi.dwMajorVersion >= 5) || (ovi.dwMajorVersion == 4 && ovi.dwMinorVersion >= 90)));
+}
+
+// default GUI font helper
+inline HFONT AtlGetDefaultGuiFont()
+{
+#ifndef _WIN32_WCE
+ return (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
+#else // CE specific
+ return (HFONT)::GetStockObject(SYSTEM_FONT);
+#endif // _WIN32_WCE
+}
+
+// bold font helper (NOTE: Caller owns the font, and should destroy it when done using it)
+inline HFONT AtlCreateBoldFont(HFONT hFont = NULL)
+{
+ if(hFont == NULL)
+ hFont = AtlGetDefaultGuiFont();
+ ATLASSERT(hFont != NULL);
+ HFONT hFontBold = NULL;
+ LOGFONT lf = { 0 };
+ if(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT))
+ {
+ lf.lfWeight = FW_BOLD;
+ hFontBold = ::CreateFontIndirect(&lf);
+ ATLASSERT(hFontBold != NULL);
+ }
+ else
+ {
+ ATLASSERT(FALSE);
+ }
+ return hFontBold;
+}
+
+// Common Controls initialization helper
+inline BOOL AtlInitCommonControls(DWORD dwFlags)
+{
+ INITCOMMONCONTROLSEX iccx = { sizeof(INITCOMMONCONTROLSEX), dwFlags };
+ BOOL bRet = ::InitCommonControlsEx(&iccx);
+ ATLASSERT(bRet);
+ return bRet;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// RunTimeHelper - helper functions for Windows version and structure sizes
+
+// Not for Windows CE
+#if defined(_WIN32_WCE) && !defined(_WTL_NO_RUNTIME_STRUCT_SIZE)
+ #define _WTL_NO_RUNTIME_STRUCT_SIZE
+#endif
+
+#ifndef _WTL_NO_RUNTIME_STRUCT_SIZE
+
+#ifndef _SIZEOF_STRUCT
+ #define _SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
+#endif
+
+#if (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE)
+ #define REBARBANDINFO_V6_SIZE _SIZEOF_STRUCT(REBARBANDINFO, cxHeader)
+#endif // (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE)
+
+#if (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE)
+ #define LVGROUP_V5_SIZE _SIZEOF_STRUCT(LVGROUP, uAlign)
+#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE)
+
+#if (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE)
+ #define LVTILEINFO_V5_SIZE _SIZEOF_STRUCT(LVTILEINFO, puColumns)
+#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE)
+
+#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE)
+ #define MCHITTESTINFO_V1_SIZE _SIZEOF_STRUCT(MCHITTESTINFO, st)
+#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE)
+
+#if !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE)
+ #define NONCLIENTMETRICS_V1_SIZE _SIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont)
+#endif // !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE)
+
+#endif // !_WTL_NO_RUNTIME_STRUCT_SIZE
+
+namespace RunTimeHelper
+{
+#ifndef _WIN32_WCE
+ inline bool IsCommCtrl6()
+ {
+ DWORD dwMajor = 0, dwMinor = 0;
+ HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor);
+ return (SUCCEEDED(hRet) && (dwMajor >= 6));
+ }
+
+ inline bool IsVista()
+ {
+ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) };
+ BOOL bRet = ::GetVersionEx(&ovi);
+ return ((bRet != FALSE) && (ovi.dwMajorVersion >= 6));
+ }
+#endif // !_WIN32_WCE
+
+ inline int SizeOf_REBARBANDINFO()
+ {
+ int nSize = sizeof(REBARBANDINFO);
+#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600)
+ if(!(IsVista() && IsCommCtrl6()))
+ nSize = REBARBANDINFO_V6_SIZE;
+#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600)
+ return nSize;
+ }
+
+#if (_WIN32_WINNT >= 0x501)
+ inline int SizeOf_LVGROUP()
+ {
+ int nSize = sizeof(LVGROUP);
+#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600)
+ if(!IsVista())
+ nSize = LVGROUP_V5_SIZE;
+#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600)
+ return nSize;
+ }
+
+ inline int SizeOf_LVTILEINFO()
+ {
+ int nSize = sizeof(LVTILEINFO);
+#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600)
+ if(!IsVista())
+ nSize = LVTILEINFO_V5_SIZE;
+#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600)
+ return nSize;
+ }
+#endif // (_WIN32_WINNT >= 0x501)
+
+ inline int SizeOf_MCHITTESTINFO()
+ {
+ int nSize = sizeof(MCHITTESTINFO);
+#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)
+ if(!(IsVista() && IsCommCtrl6()))
+ nSize = MCHITTESTINFO_V1_SIZE;
+#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)
+ return nSize;
+ }
+
+#ifndef _WIN32_WCE
+ inline int SizeOf_NONCLIENTMETRICS()
+ {
+ int nSize = sizeof(NONCLIENTMETRICS);
+#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600)
+ if(!IsVista())
+ nSize = NONCLIENTMETRICS_V1_SIZE;
+#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600)
+ return nSize;
+ }
+#endif // !_WIN32_WCE
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// ModuleHelper - helper functions for ATL3 and ATL7 module classes
+
+namespace ModuleHelper
+{
+ inline HINSTANCE GetModuleInstance()
+ {
+#if (_ATL_VER >= 0x0700)
+ return ATL::_AtlBaseModule.GetModuleInstance();
+#else // !(_ATL_VER >= 0x0700)
+ return ATL::_pModule->GetModuleInstance();
+#endif // !(_ATL_VER >= 0x0700)
+ }
+
+ inline HINSTANCE GetResourceInstance()
+ {
+#if (_ATL_VER >= 0x0700)
+ return ATL::_AtlBaseModule.GetResourceInstance();
+#else // !(_ATL_VER >= 0x0700)
+ return ATL::_pModule->GetResourceInstance();
+#endif // !(_ATL_VER >= 0x0700)
+ }
+
+ inline void AddCreateWndData(ATL::_AtlCreateWndData* pData, void* pObject)
+ {
+#if (_ATL_VER >= 0x0700)
+ ATL::_AtlWinModule.AddCreateWndData(pData, pObject);
+#else // !(_ATL_VER >= 0x0700)
+ ATL::_pModule->AddCreateWndData(pData, pObject);
+#endif // !(_ATL_VER >= 0x0700)
+ }
+
+ inline void* ExtractCreateWndData()
+ {
+#if (_ATL_VER >= 0x0700)
+ return ATL::_AtlWinModule.ExtractCreateWndData();
+#else // !(_ATL_VER >= 0x0700)
+ return ATL::_pModule->ExtractCreateWndData();
+#endif // !(_ATL_VER >= 0x0700)
+ }
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// SecureHelper - helper functions for VS2005 secure CRT
+
+namespace SecureHelper
+{
+ inline void strcpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc)
+ {
+#if _SECURE_ATL
+ ATL::Checked::strcpy_s(lpstrDest, cchDest, lpstrSrc);
+#else
+ if(cchDest > (size_t)lstrlenA(lpstrSrc))
+ ATLVERIFY(lstrcpyA(lpstrDest, lpstrSrc) != NULL);
+ else
+ ATLASSERT(FALSE);
+#endif
+ }
+
+ inline void strcpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc)
+ {
+#if _SECURE_ATL
+ ATL::Checked::wcscpy_s(lpstrDest, cchDest, lpstrSrc);
+#else
+ if(cchDest > (size_t)lstrlenW(lpstrSrc))
+ ATLVERIFY(lstrcpyW(lpstrDest, lpstrSrc) != NULL);
+ else
+ ATLASSERT(FALSE);
+#endif
+ }
+
+ inline void strcpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc)
+ {
+#ifdef _UNICODE
+ strcpyW_x(lpstrDest, cchDest, lpstrSrc);
+#else
+ strcpyA_x(lpstrDest, cchDest, lpstrSrc);
+#endif
+ }
+
+ inline errno_t strncpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc, size_t cchCount)
+ {
+#if _SECURE_ATL
+ return ATL::Checked::strncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount);
+#else
+ errno_t nRet = 0;
+ if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL)
+ {
+ nRet = EINVAL;
+ }
+ else if(cchCount == _TRUNCATE)
+ {
+ cchCount = min(cchDest - 1, size_t(lstrlenA(lpstrSrc)));
+ nRet = STRUNCATE;
+ }
+ else if(cchDest <= cchCount)
+ {
+ lpstrDest[0] = 0;
+ nRet = EINVAL;
+ }
+ if(nRet == 0 || nRet == STRUNCATE)
+ nRet = (lstrcpynA(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL;
+ ATLASSERT(nRet == 0 || nRet == STRUNCATE);
+ return nRet;
+#endif
+ }
+
+ inline errno_t strncpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc, size_t cchCount)
+ {
+#if _SECURE_ATL
+ return ATL::Checked::wcsncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount);
+#else
+ errno_t nRet = 0;
+ if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL)
+ {
+ nRet = EINVAL;
+ }
+ else if(cchCount == _TRUNCATE)
+ {
+ cchCount = min(cchDest - 1, size_t(lstrlenW(lpstrSrc)));
+ nRet = STRUNCATE;
+ }
+ else if(cchDest <= cchCount)
+ {
+ lpstrDest[0] = 0;
+ nRet = EINVAL;
+ }
+ if(nRet == 0 || nRet == STRUNCATE)
+ nRet = (lstrcpynW(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL;
+ ATLASSERT(nRet == 0 || nRet == STRUNCATE);
+ return nRet;
+#endif
+ }
+
+ inline errno_t strncpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc, size_t cchCount)
+ {
+#ifdef _UNICODE
+ return strncpyW_x(lpstrDest, cchDest, lpstrSrc, cchCount);
+#else
+ return strncpyA_x(lpstrDest, cchDest, lpstrSrc, cchCount);
+#endif
+ }
+
+ inline void strcatA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc)
+ {
+#if _SECURE_ATL
+ ATL::Checked::strcat_s(lpstrDest, cchDest, lpstrSrc);
+#else
+ if(cchDest > (size_t)lstrlenA(lpstrSrc))
+ ATLVERIFY(lstrcatA(lpstrDest, lpstrSrc) != NULL);
+ else
+ ATLASSERT(FALSE);
+#endif
+ }
+
+ inline void strcatW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc)
+ {
+#if _SECURE_ATL
+ ATL::Checked::wcscat_s(lpstrDest, cchDest, lpstrSrc);
+#else
+ if(cchDest > (size_t)lstrlenW(lpstrSrc))
+ ATLVERIFY(lstrcatW(lpstrDest, lpstrSrc) != NULL);
+ else
+ ATLASSERT(FALSE);
+#endif
+ }
+
+ inline void strcat_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc)
+ {
+#ifdef _UNICODE
+ strcatW_x(lpstrDest, cchDest, lpstrSrc);
+#else
+ strcatA_x(lpstrDest, cchDest, lpstrSrc);
+#endif
+ }
+
+ inline void memcpy_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc)
+ {
+#if _SECURE_ATL
+ ATL::Checked::memcpy_s(pDest, cbDest, pSrc, cbSrc);
+#else
+ if(cbDest >= cbSrc)
+ memcpy(pDest, pSrc, cbSrc);
+ else
+ ATLASSERT(FALSE);
+#endif
+ }
+
+ inline void memmove_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc)
+ {
+#if _SECURE_ATL
+ ATL::Checked::memmove_s(pDest, cbDest, pSrc, cbSrc);
+#else
+ if(cbDest >= cbSrc)
+ memmove(pDest, pSrc, cbSrc);
+ else
+ ATLASSERT(FALSE);
+#endif
+ }
+
+ inline int vsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args)
+ {
+#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE)
+ return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args);
+#else
+ cchBuff; // Avoid unused argument warning
+ return _vstprintf(lpstrBuff, lpstrFormat, args);
+#endif
+ }
+
+ inline int wvsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args)
+ {
+#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE)
+ return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args);
+#else
+ cchBuff; // Avoid unused argument warning
+ return ::wvsprintf(lpstrBuff, lpstrFormat, args);
+#endif
+ }
+
+ inline int sprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...)
+ {
+ va_list args;
+ va_start(args, lpstrFormat);
+ int nRes = vsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args);
+ va_end(args);
+ return nRes;
+ }
+
+ inline int wsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...)
+ {
+ va_list args;
+ va_start(args, lpstrFormat);
+ int nRes = wvsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args);
+ va_end(args);
+ return nRes;
+ }
+}; // namespace SecureHelper
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CMessageFilter - Interface for message filter support
+
+class CMessageFilter
+{
+public:
+ virtual BOOL PreTranslateMessage(MSG* pMsg) = 0;
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CIdleHandler - Interface for idle processing
+
+class CIdleHandler
+{
+public:
+ virtual BOOL OnIdle() = 0;
+};
+
+#ifndef _ATL_NO_OLD_NAMES
+ // for compatilibility with old names only
+ typedef CIdleHandler CUpdateUIObject;
+ #define DoUpdate OnIdle
+#endif // !_ATL_NO_OLD_NAMES
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CMessageLoop - message loop implementation
+
+class CMessageLoop
+{
+public:
+ ATL::CSimpleArray m_aMsgFilter;
+ ATL::CSimpleArray m_aIdleHandler;
+ MSG m_msg;
+
+// Message filter operations
+ BOOL AddMessageFilter(CMessageFilter* pMessageFilter)
+ {
+ return m_aMsgFilter.Add(pMessageFilter);
+ }
+
+ BOOL RemoveMessageFilter(CMessageFilter* pMessageFilter)
+ {
+ return m_aMsgFilter.Remove(pMessageFilter);
+ }
+
+// Idle handler operations
+ BOOL AddIdleHandler(CIdleHandler* pIdleHandler)
+ {
+ return m_aIdleHandler.Add(pIdleHandler);
+ }
+
+ BOOL RemoveIdleHandler(CIdleHandler* pIdleHandler)
+ {
+ return m_aIdleHandler.Remove(pIdleHandler);
+ }
+
+#ifndef _ATL_NO_OLD_NAMES
+ // for compatilibility with old names only
+ BOOL AddUpdateUI(CIdleHandler* pIdleHandler)
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and AddUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n"));
+ return AddIdleHandler(pIdleHandler);
+ }
+
+ BOOL RemoveUpdateUI(CIdleHandler* pIdleHandler)
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and RemoveUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n"));
+ return RemoveIdleHandler(pIdleHandler);
+ }
+#endif // !_ATL_NO_OLD_NAMES
+
+// message loop
+ int Run()
+ {
+ BOOL bDoIdle = TRUE;
+ int nIdleCount = 0;
+ BOOL bRet;
+
+ for(;;)
+ {
+ while(bDoIdle && !::PeekMessage(&m_msg, NULL, 0, 0, PM_NOREMOVE))
+ {
+ if(!OnIdle(nIdleCount++))
+ bDoIdle = FALSE;
+ }
+
+ bRet = ::GetMessage(&m_msg, NULL, 0, 0);
+
+ if(bRet == -1)
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("::GetMessage returned -1 (error)\n"));
+ continue; // error, don't process
+ }
+ else if(!bRet)
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("CMessageLoop::Run - exiting\n"));
+ break; // WM_QUIT, exit message loop
+ }
+
+ if(!PreTranslateMessage(&m_msg))
+ {
+ ::TranslateMessage(&m_msg);
+ ::DispatchMessage(&m_msg);
+ }
+
+ if(IsIdleMessage(&m_msg))
+ {
+ bDoIdle = TRUE;
+ nIdleCount = 0;
+ }
+ }
+
+ return (int)m_msg.wParam;
+ }
+
+ static BOOL IsIdleMessage(MSG* pMsg)
+ {
+ // These messages should NOT cause idle processing
+ switch(pMsg->message)
+ {
+ case WM_MOUSEMOVE:
+#ifndef _WIN32_WCE
+ case WM_NCMOUSEMOVE:
+#endif // !_WIN32_WCE
+ case WM_PAINT:
+ case 0x0118: // WM_SYSTIMER (caret blink)
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+// Overrideables
+ // Override to change message filtering
+ virtual BOOL PreTranslateMessage(MSG* pMsg)
+ {
+ // loop backwards
+ for(int i = m_aMsgFilter.GetSize() - 1; i >= 0; i--)
+ {
+ CMessageFilter* pMessageFilter = m_aMsgFilter[i];
+ if(pMessageFilter != NULL && pMessageFilter->PreTranslateMessage(pMsg))
+ return TRUE;
+ }
+ return FALSE; // not translated
+ }
+
+ // override to change idle processing
+ virtual BOOL OnIdle(int /*nIdleCount*/)
+ {
+ for(int i = 0; i < m_aIdleHandler.GetSize(); i++)
+ {
+ CIdleHandler* pIdleHandler = m_aIdleHandler[i];
+ if(pIdleHandler != NULL)
+ pIdleHandler->OnIdle();
+ }
+ return FALSE; // don't continue
+ }
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CStaticDataInitCriticalSectionLock and CWindowCreateCriticalSectionLock
+// internal classes to manage critical sections for both ATL3 and ATL7
+
+class CStaticDataInitCriticalSectionLock
+{
+public:
+#if (_ATL_VER >= 0x0700)
+ ATL::CComCritSecLock m_cslock;
+
+ CStaticDataInitCriticalSectionLock() : m_cslock(ATL::_pAtlModule->m_csStaticDataInitAndTypeInfo, false)
+ { }
+#endif // (_ATL_VER >= 0x0700)
+
+ HRESULT Lock()
+ {
+#if (_ATL_VER >= 0x0700)
+ return m_cslock.Lock();
+#else // !(_ATL_VER >= 0x0700)
+ ::EnterCriticalSection(&ATL::_pModule->m_csStaticDataInit);
+ return S_OK;
+#endif // !(_ATL_VER >= 0x0700)
+ }
+
+ void Unlock()
+ {
+#if (_ATL_VER >= 0x0700)
+ m_cslock.Unlock();
+#else // !(_ATL_VER >= 0x0700)
+ ::LeaveCriticalSection(&ATL::_pModule->m_csStaticDataInit);
+#endif // !(_ATL_VER >= 0x0700)
+ }
+};
+
+
+class CWindowCreateCriticalSectionLock
+{
+public:
+#if (_ATL_VER >= 0x0700)
+ ATL::CComCritSecLock m_cslock;
+
+ CWindowCreateCriticalSectionLock() : m_cslock(ATL::_AtlWinModule.m_csWindowCreate, false)
+ { }
+#endif // (_ATL_VER >= 0x0700)
+
+ HRESULT Lock()
+ {
+#if (_ATL_VER >= 0x0700)
+ return m_cslock.Lock();
+#else // !(_ATL_VER >= 0x0700)
+ ::EnterCriticalSection(&ATL::_pModule->m_csWindowCreate);
+ return S_OK;
+#endif // !(_ATL_VER >= 0x0700)
+ }
+
+ void Unlock()
+ {
+#if (_ATL_VER >= 0x0700)
+ m_cslock.Unlock();
+#else // !(_ATL_VER >= 0x0700)
+ ::LeaveCriticalSection(&ATL::_pModule->m_csWindowCreate);
+#endif // !(_ATL_VER >= 0x0700)
+ }
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CTempBuffer - helper class for stack allocations for ATL3
+
+#ifndef _WTL_STACK_ALLOC_THRESHOLD
+ #define _WTL_STACK_ALLOC_THRESHOLD 512
+#endif
+
+#if (_ATL_VER >= 0x0700)
+
+using ATL::CTempBuffer;
+
+#else // !(_ATL_VER >= 0x0700)
+
+#ifndef SIZE_MAX
+ #ifdef _WIN64
+ #define SIZE_MAX _UI64_MAX
+ #else
+ #define SIZE_MAX UINT_MAX
+ #endif
+#endif
+
+#pragma warning(disable: 4284) // warning for operator ->
+
+template
+class CTempBuffer
+{
+public:
+ CTempBuffer() : m_p(NULL)
+ {
+ }
+
+ CTempBuffer(size_t nElements) : m_p(NULL)
+ {
+ Allocate(nElements);
+ }
+
+ ~CTempBuffer()
+ {
+ if(m_p != reinterpret_cast(m_abFixedBuffer))
+ free(m_p);
+ }
+
+ operator T*() const
+ {
+ return m_p;
+ }
+
+ T* operator ->() const
+ {
+ ATLASSERT(m_p != NULL);
+ return m_p;
+ }
+
+ T* Allocate(size_t nElements)
+ {
+ ATLASSERT(nElements <= (SIZE_MAX / sizeof(T)));
+ return AllocateBytes(nElements * sizeof(T));
+ }
+
+ T* AllocateBytes(size_t nBytes)
+ {
+ ATLASSERT(m_p == NULL);
+ if(nBytes > t_nFixedBytes)
+ m_p = static_cast(malloc(nBytes));
+ else
+ m_p = reinterpret_cast(m_abFixedBuffer);
+
+ return m_p;
+ }
+
+private:
+ T* m_p;
+ BYTE m_abFixedBuffer[t_nFixedBytes];
+};
+
+#pragma warning(default: 4284)
+
+#endif // !(_ATL_VER >= 0x0700)
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CAppModule - module class for an application
+
+class CAppModule : public ATL::CComModule
+{
+public:
+ DWORD m_dwMainThreadID;
+ ATL::CSimpleMap* m_pMsgLoopMap;
+ ATL::CSimpleArray* m_pSettingChangeNotify;
+
+// Overrides of CComModule::Init and Term
+ HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL)
+ {
+ HRESULT hRet = CComModule::Init(pObjMap, hInstance, pLibID);
+ if(FAILED(hRet))
+ return hRet;
+
+ m_dwMainThreadID = ::GetCurrentThreadId();
+ typedef ATL::CSimpleMap _mapClass;
+ m_pMsgLoopMap = NULL;
+ ATLTRY(m_pMsgLoopMap = new _mapClass);
+ if(m_pMsgLoopMap == NULL)
+ return E_OUTOFMEMORY;
+ m_pSettingChangeNotify = NULL;
+
+ return hRet;
+ }
+
+ void Term()
+ {
+ TermSettingChangeNotify();
+ delete m_pMsgLoopMap;
+ CComModule::Term();
+ }
+
+// Message loop map methods
+ BOOL AddMessageLoop(CMessageLoop* pMsgLoop)
+ {
+ CStaticDataInitCriticalSectionLock lock;
+ if(FAILED(lock.Lock()))
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddMessageLoop.\n"));
+ ATLASSERT(FALSE);
+ return FALSE;
+ }
+
+ ATLASSERT(pMsgLoop != NULL);
+ ATLASSERT(m_pMsgLoopMap->Lookup(::GetCurrentThreadId()) == NULL); // not in map yet
+
+ BOOL bRet = m_pMsgLoopMap->Add(::GetCurrentThreadId(), pMsgLoop);
+
+ lock.Unlock();
+
+ return bRet;
+ }
+
+ BOOL RemoveMessageLoop()
+ {
+ CStaticDataInitCriticalSectionLock lock;
+ if(FAILED(lock.Lock()))
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveMessageLoop.\n"));
+ ATLASSERT(FALSE);
+ return FALSE;
+ }
+
+ BOOL bRet = m_pMsgLoopMap->Remove(::GetCurrentThreadId());
+
+ lock.Unlock();
+
+ return bRet;
+ }
+
+ CMessageLoop* GetMessageLoop(DWORD dwThreadID = ::GetCurrentThreadId()) const
+ {
+ CStaticDataInitCriticalSectionLock lock;
+ if(FAILED(lock.Lock()))
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::GetMessageLoop.\n"));
+ ATLASSERT(FALSE);
+ return NULL;
+ }
+
+ CMessageLoop* pLoop = m_pMsgLoopMap->Lookup(dwThreadID);
+
+ lock.Unlock();
+
+ return pLoop;
+ }
+
+// Setting change notify methods
+ // Note: Call this from the main thread for MSDI apps
+ BOOL InitSettingChangeNotify(DLGPROC pfnDlgProc = _SettingChangeDlgProc)
+ {
+ CStaticDataInitCriticalSectionLock lock;
+ if(FAILED(lock.Lock()))
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::InitSettingChangeNotify.\n"));
+ ATLASSERT(FALSE);
+ return FALSE;
+ }
+
+ if(m_pSettingChangeNotify == NULL)
+ {
+ typedef ATL::CSimpleArray _notifyClass;
+ ATLTRY(m_pSettingChangeNotify = new _notifyClass);
+ ATLASSERT(m_pSettingChangeNotify != NULL);
+ }
+
+ BOOL bRet = (m_pSettingChangeNotify != NULL);
+ if(bRet && m_pSettingChangeNotify->GetSize() == 0)
+ {
+ // init everything
+ _ATL_EMPTY_DLGTEMPLATE templ;
+ HWND hNtfWnd = ::CreateDialogIndirect(GetModuleInstance(), &templ, NULL, pfnDlgProc);
+ ATLASSERT(::IsWindow(hNtfWnd));
+ if(::IsWindow(hNtfWnd))
+ {
+// need conditional code because types don't match in winuser.h
+#ifdef _WIN64
+ ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, (LONG_PTR)this);
+#else
+ ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, PtrToLong(this));
+#endif
+ bRet = m_pSettingChangeNotify->Add(hNtfWnd);
+ }
+ else
+ {
+ bRet = FALSE;
+ }
+ }
+
+ lock.Unlock();
+
+ return bRet;
+ }
+
+ void TermSettingChangeNotify()
+ {
+ CStaticDataInitCriticalSectionLock lock;
+ if(FAILED(lock.Lock()))
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::TermSettingChangeNotify.\n"));
+ ATLASSERT(FALSE);
+ return;
+ }
+
+ if(m_pSettingChangeNotify != NULL && m_pSettingChangeNotify->GetSize() > 0)
+ ::DestroyWindow((*m_pSettingChangeNotify)[0]);
+ delete m_pSettingChangeNotify;
+ m_pSettingChangeNotify = NULL;
+
+ lock.Unlock();
+ }
+
+ BOOL AddSettingChangeNotify(HWND hWnd)
+ {
+ CStaticDataInitCriticalSectionLock lock;
+ if(FAILED(lock.Lock()))
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddSettingChangeNotify.\n"));
+ ATLASSERT(FALSE);
+ return FALSE;
+ }
+
+ ATLASSERT(::IsWindow(hWnd));
+ BOOL bRet = FALSE;
+ if(InitSettingChangeNotify() != FALSE)
+ bRet = m_pSettingChangeNotify->Add(hWnd);
+
+ lock.Unlock();
+
+ return bRet;
+ }
+
+ BOOL RemoveSettingChangeNotify(HWND hWnd)
+ {
+ CStaticDataInitCriticalSectionLock lock;
+ if(FAILED(lock.Lock()))
+ {
+ ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveSettingChangeNotify.\n"));
+ ATLASSERT(FALSE);
+ return FALSE;
+ }
+
+ BOOL bRet = FALSE;
+ if(m_pSettingChangeNotify != NULL)
+ bRet = m_pSettingChangeNotify->Remove(hWnd);
+
+ lock.Unlock();
+
+ return bRet;
+ }
+
+// Implementation - setting change notify dialog template and dialog procedure
+ struct _ATL_EMPTY_DLGTEMPLATE : DLGTEMPLATE
+ {
+ _ATL_EMPTY_DLGTEMPLATE()
+ {
+ memset(this, 0, sizeof(_ATL_EMPTY_DLGTEMPLATE));
+ style = WS_POPUP;
+ }
+ WORD wMenu, wClass, wTitle;
+ };
+
+#ifdef _WIN64
+ static INT_PTR CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+#else
+ static BOOL CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+#endif
+ {
+ if(uMsg == WM_SETTINGCHANGE)
+ {
+// need conditional code because types don't match in winuser.h
+#ifdef _WIN64
+ CAppModule* pModule = (CAppModule*)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
+#else
+ CAppModule* pModule = (CAppModule*)LongToPtr(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
+#endif
+ ATLASSERT(pModule != NULL);
+ ATLASSERT(pModule->m_pSettingChangeNotify != NULL);
+ const UINT uTimeout = 1500; // ms
+ for(int i = 1; i < pModule->m_pSettingChangeNotify->GetSize(); i++)
+ {
+#if !defined(_WIN32_WCE)
+ ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_ABORTIFHUNG, uTimeout, NULL);
+#elif(_WIN32_WCE >= 400) // CE specific
+ ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_NORMAL, uTimeout, NULL);
+#else // _WIN32_WCE < 400 specific
+ uTimeout;
+ ::SendMessage((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam);
+#endif
+ }
+ return TRUE;
+ }
+ return FALSE;
+ }
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CServerAppModule - module class for a COM server application
+
+class CServerAppModule : public CAppModule
+{
+public:
+ HANDLE m_hEventShutdown;
+ bool m_bActivity;
+ DWORD m_dwTimeOut;
+ DWORD m_dwPause;
+
+// Override of CAppModule::Init
+ HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL)
+ {
+ m_dwTimeOut = 5000;
+ m_dwPause = 1000;
+ return CAppModule::Init(pObjMap, hInstance, pLibID);
+ }
+
+ void Term()
+ {
+ if(m_hEventShutdown != NULL && ::CloseHandle(m_hEventShutdown))
+ m_hEventShutdown = NULL;
+ CAppModule::Term();
+ }
+
+// COM Server methods
+ LONG Unlock()
+ {
+ LONG lRet = CComModule::Unlock();
+ if(lRet == 0)
+ {
+ m_bActivity = true;
+ ::SetEvent(m_hEventShutdown); // tell monitor that we transitioned to zero
+ }
+ return lRet;
+ }
+
+ void MonitorShutdown()
+ {
+ for(;;)
+ {
+ ::WaitForSingleObject(m_hEventShutdown, INFINITE);
+ DWORD dwWait = 0;
+ do
+ {
+ m_bActivity = false;
+ dwWait = ::WaitForSingleObject(m_hEventShutdown, m_dwTimeOut);
+ }
+ while(dwWait == WAIT_OBJECT_0);
+ // timed out
+ if(!m_bActivity && m_nLockCnt == 0) // if no activity let's really bail
+ {
+#if ((_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM)) && defined(_ATL_FREE_THREADED) && !defined(_WIN32_WCE)
+ ::CoSuspendClassObjects();
+ if(!m_bActivity && m_nLockCnt == 0)
+#endif
+ break;
+ }
+ }
+ // This handle should be valid now. If it isn't,
+ // check if _Module.Term was called first (it shouldn't)
+ if(::CloseHandle(m_hEventShutdown))
+ m_hEventShutdown = NULL;
+ ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0);
+ }
+
+ bool StartMonitor()
+ {
+ m_hEventShutdown = ::CreateEvent(NULL, false, false, NULL);
+ if(m_hEventShutdown == NULL)
+ return false;
+ DWORD dwThreadID = 0;
+#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE)
+ HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))MonitorProc, this, 0, (UINT*)&dwThreadID);
+#else
+ HANDLE hThread = ::CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID);
+#endif
+ bool bRet = (hThread != NULL);
+ if(bRet)
+ ::CloseHandle(hThread);
+ return bRet;
+ }
+
+ static DWORD WINAPI MonitorProc(void* pv)
+ {
+ CServerAppModule* p = (CServerAppModule*)pv;
+ p->MonitorShutdown();
+ return 0;
+ }
+
+#if (_ATL_VER < 0x0700)
+ // search for an occurence of string p2 in string p1
+ static LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2)
+ {
+ while(p1 != NULL && *p1 != NULL)
+ {
+ LPCTSTR p = p2;
+ while(p != NULL && *p != NULL)
+ {
+ if(*p1 == *p)
+ return ::CharNext(p1);
+ p = ::CharNext(p);
+ }
+ p1 = ::CharNext(p1);
+ }
+ return NULL;
+ }
+#endif // (_ATL_VER < 0x0700)
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CString forward reference (enables CString use in atluser.h and atlgdi.h)
+
+#if defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING)
+ #define _WTL_USE_CSTRING
+#endif // defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING)
+
+#ifdef _WTL_USE_CSTRING
+ class CString; // forward declaration (include atlmisc.h for the whole class)
+#endif // _WTL_USE_CSTRING
+
+// CString namespace
+#ifndef _CSTRING_NS
+ #ifdef __ATLSTR_H__
+ #define _CSTRING_NS ATL
+ #else
+ #define _CSTRING_NS WTL
+ #endif
+#endif // _CSTRING_NS
+
+// Type classes namespace
+#ifndef _WTYPES_NS
+ #ifdef __ATLTYPES_H__
+ #define _WTYPES_NS
+ #else
+ #define _WTYPES_NS WTL
+ #endif
+#endif // _WTYPES_NS
+
+}; // namespace WTL
+
+
+///////////////////////////////////////////////////////////////////////////////
+// General DLL version helpers (excluded from atlbase.h if _ATL_DLL is defined)
+
+#if (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE)
+
+namespace ATL
+{
+
+inline HRESULT AtlGetDllVersion(HINSTANCE hInstDLL, DLLVERSIONINFO* pDllVersionInfo)
+{
+ ATLASSERT(pDllVersionInfo != NULL);
+ if(pDllVersionInfo == NULL)
+ return E_INVALIDARG;
+
+ // We must get this function explicitly because some DLLs don't implement it.
+ DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC)::GetProcAddress(hInstDLL, "DllGetVersion");
+ if(pfnDllGetVersion == NULL)
+ return E_NOTIMPL;
+
+ return (*pfnDllGetVersion)(pDllVersionInfo);
+}
+
+inline HRESULT AtlGetDllVersion(LPCTSTR lpstrDllName, DLLVERSIONINFO* pDllVersionInfo)
+{
+ HINSTANCE hInstDLL = ::LoadLibrary(lpstrDllName);
+ if(hInstDLL == NULL)
+ return E_FAIL;
+ HRESULT hRet = AtlGetDllVersion(hInstDLL, pDllVersionInfo);
+ ::FreeLibrary(hInstDLL);
+ return hRet;
+}
+
+// Common Control Versions:
+// Win95/WinNT 4.0 maj=4 min=00
+// IE 3.x maj=4 min=70
+// IE 4.0 maj=4 min=71
+inline HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor)
+{
+ ATLASSERT(pdwMajor != NULL && pdwMinor != NULL);
+ if(pdwMajor == NULL || pdwMinor == NULL)
+ return E_INVALIDARG;
+
+ DLLVERSIONINFO dvi;
+ ::ZeroMemory(&dvi, sizeof(dvi));
+ dvi.cbSize = sizeof(dvi);
+ HRESULT hRet = AtlGetDllVersion(_T("comctl32.dll"), &dvi);
+
+ if(SUCCEEDED(hRet))
+ {
+ *pdwMajor = dvi.dwMajorVersion;
+ *pdwMinor = dvi.dwMinorVersion;
+ }
+ else if(hRet == E_NOTIMPL)
+ {
+ // If DllGetVersion is not there, then the DLL is a version
+ // previous to the one shipped with IE 3.x
+ *pdwMajor = 4;
+ *pdwMinor = 0;
+ hRet = S_OK;
+ }
+
+ return hRet;
+}
+
+// Shell Versions:
+// Win95/WinNT 4.0 maj=4 min=00
+// IE 3.x, IE 4.0 without Web Integrated Desktop maj=4 min=00
+// IE 4.0 with Web Integrated Desktop maj=4 min=71
+// IE 4.01 with Web Integrated Desktop maj=4 min=72
+inline HRESULT AtlGetShellVersion(LPDWORD pdwMajor, LPDWORD pdwMinor)
+{
+ ATLASSERT(pdwMajor != NULL && pdwMinor != NULL);
+ if(pdwMajor == NULL || pdwMinor == NULL)
+ return E_INVALIDARG;
+
+ DLLVERSIONINFO dvi;
+ ::ZeroMemory(&dvi, sizeof(dvi));
+ dvi.cbSize = sizeof(dvi);
+ HRESULT hRet = AtlGetDllVersion(_T("shell32.dll"), &dvi);
+
+ if(SUCCEEDED(hRet))
+ {
+ *pdwMajor = dvi.dwMajorVersion;
+ *pdwMinor = dvi.dwMinorVersion;
+ }
+ else if(hRet == E_NOTIMPL)
+ {
+ // If DllGetVersion is not there, then the DLL is a version
+ // previous to the one shipped with IE 4.x
+ *pdwMajor = 4;
+ *pdwMinor = 0;
+ hRet = S_OK;
+ }
+
+ return hRet;
+}
+
+}; // namespace ATL
+
+#endif // (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE)
+
+
+// These are always included
+#include "atlwinx.h"
+#include "atluser.h"
+#include "atlgdi.h"
+
+#ifndef _WTL_NO_AUTOMATIC_NAMESPACE
+using namespace WTL;
+#endif // !_WTL_NO_AUTOMATIC_NAMESPACE
+
+#endif // __ATLAPP_H__
diff --git a/Externals/WTL80/atlcrack.h b/Externals/WTL80/atlcrack.h
new file mode 100644
index 0000000000..f92b35ad21
--- /dev/null
+++ b/Externals/WTL80/atlcrack.h
@@ -0,0 +1,2380 @@
+// Windows Template Library - WTL version 8.0
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// This file is a part of the Windows Template Library.
+// The use and distribution terms for this software are covered by the
+// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php)
+// which can be found in the file CPL.TXT at the root of this distribution.
+// By using this software in any fashion, you are agreeing to be bound by
+// the terms of this license. You must not remove this notice, or
+// any other, from this software.
+
+#ifndef __ATLCRACK_H__
+#define __ATLCRACK_H__
+
+#pragma once
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Message map macro for cracked handlers
+
+// Note about message maps with cracked handlers:
+// For ATL 3.0, a message map using cracked handlers MUST use BEGIN_MSG_MAP_EX.
+// For ATL 7.0 or higher, you can use BEGIN_MSG_MAP for CWindowImpl/CDialogImpl derived classes,
+// but must use BEGIN_MSG_MAP_EX for classes that don't derive from CWindowImpl/CDialogImpl.
+
+#define BEGIN_MSG_MAP_EX(theClass) \
+public: \
+ BOOL m_bMsgHandled; \
+ /* "handled" management for cracked handlers */ \
+ BOOL IsMsgHandled() const \
+ { \
+ return m_bMsgHandled; \
+ } \
+ void SetMsgHandled(BOOL bHandled) \
+ { \
+ m_bMsgHandled = bHandled; \
+ } \
+ BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \
+ { \
+ BOOL bOldMsgHandled = m_bMsgHandled; \
+ BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \
+ m_bMsgHandled = bOldMsgHandled; \
+ return bRet; \
+ } \
+ BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \
+ { \
+ BOOL bHandled = TRUE; \
+ hWnd; \
+ uMsg; \
+ wParam; \
+ lParam; \
+ lResult; \
+ bHandled; \
+ switch(dwMsgMapID) \
+ { \
+ case 0:
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Standard Windows message macros
+
+// int OnCreate(LPCREATESTRUCT lpCreateStruct)
+#define MSG_WM_CREATE(func) \
+ if (uMsg == WM_CREATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
+#define MSG_WM_INITDIALOG(func) \
+ if (uMsg == WM_INITDIALOG) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HWND)wParam, lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct)
+#define MSG_WM_COPYDATA(func) \
+ if (uMsg == WM_COPYDATA) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDestroy()
+#define MSG_WM_DESTROY(func) \
+ if (uMsg == WM_DESTROY) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMove(CPoint ptPos)
+#define MSG_WM_MOVE(func) \
+ if (uMsg == WM_MOVE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSize(UINT nType, CSize size)
+#define MSG_WM_SIZE(func) \
+ if (uMsg == WM_SIZE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther)
+#define MSG_WM_ACTIVATE(func) \
+ if (uMsg == WM_ACTIVATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSetFocus(CWindow wndOld)
+#define MSG_WM_SETFOCUS(func) \
+ if (uMsg == WM_SETFOCUS) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnKillFocus(CWindow wndFocus)
+#define MSG_WM_KILLFOCUS(func) \
+ if (uMsg == WM_KILLFOCUS) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnEnable(BOOL bEnable)
+#define MSG_WM_ENABLE(func) \
+ if (uMsg == WM_ENABLE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnPaint(CDCHandle dc)
+#define MSG_WM_PAINT(func) \
+ if (uMsg == WM_PAINT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HDC)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnClose()
+#define MSG_WM_CLOSE(func) \
+ if (uMsg == WM_CLOSE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnQueryEndSession(UINT nSource, UINT uLogOff)
+#define MSG_WM_QUERYENDSESSION(func) \
+ if (uMsg == WM_QUERYENDSESSION) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnQueryOpen()
+#define MSG_WM_QUERYOPEN(func) \
+ if (uMsg == WM_QUERYOPEN) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnEraseBkgnd(CDCHandle dc)
+#define MSG_WM_ERASEBKGND(func) \
+ if (uMsg == WM_ERASEBKGND) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSysColorChange()
+#define MSG_WM_SYSCOLORCHANGE(func) \
+ if (uMsg == WM_SYSCOLORCHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnEndSession(BOOL bEnding, UINT uLogOff)
+#define MSG_WM_ENDSESSION(func) \
+ if (uMsg == WM_ENDSESSION) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam, (UINT)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnShowWindow(BOOL bShow, UINT nStatus)
+#define MSG_WM_SHOWWINDOW(func) \
+ if (uMsg == WM_SHOWWINDOW) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam, (int)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit)
+#define MSG_WM_CTLCOLOREDIT(func) \
+ if (uMsg == WM_CTLCOLOREDIT) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox)
+#define MSG_WM_CTLCOLORLISTBOX(func) \
+ if (uMsg == WM_CTLCOLORLISTBOX) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button)
+#define MSG_WM_CTLCOLORBTN(func) \
+ if (uMsg == WM_CTLCOLORBTN) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd)
+#define MSG_WM_CTLCOLORDLG(func) \
+ if (uMsg == WM_CTLCOLORDLG) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
+#define MSG_WM_CTLCOLORSCROLLBAR(func) \
+ if (uMsg == WM_CTLCOLORSCROLLBAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic)
+#define MSG_WM_CTLCOLORSTATIC(func) \
+ if (uMsg == WM_CTLCOLORSTATIC) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
+#define MSG_WM_SETTINGCHANGE(func) \
+ if (uMsg == WM_SETTINGCHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPCTSTR)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDevModeChange(LPCTSTR lpDeviceName)
+#define MSG_WM_DEVMODECHANGE(func) \
+ if (uMsg == WM_DEVMODECHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((LPCTSTR)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnActivateApp(BOOL bActive, DWORD dwThreadID)
+#define MSG_WM_ACTIVATEAPP(func) \
+ if (uMsg == WM_ACTIVATEAPP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam, (DWORD)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnFontChange()
+#define MSG_WM_FONTCHANGE(func) \
+ if (uMsg == WM_FONTCHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnTimeChange()
+#define MSG_WM_TIMECHANGE(func) \
+ if (uMsg == WM_TIMECHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCancelMode()
+#define MSG_WM_CANCELMODE(func) \
+ if (uMsg == WM_CANCELMODE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message)
+#define MSG_WM_SETCURSOR(func) \
+ if (uMsg == WM_SETCURSOR) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message)
+#define MSG_WM_MOUSEACTIVATE(func) \
+ if (uMsg == WM_MOUSEACTIVATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnChildActivate()
+#define MSG_WM_CHILDACTIVATE(func) \
+ if (uMsg == WM_CHILDACTIVATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnGetMinMaxInfo(LPMINMAXINFO lpMMI)
+#define MSG_WM_GETMINMAXINFO(func) \
+ if (uMsg == WM_GETMINMAXINFO) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((LPMINMAXINFO)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnIconEraseBkgnd(CDCHandle dc)
+#define MSG_WM_ICONERASEBKGND(func) \
+ if (uMsg == WM_ICONERASEBKGND) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HDC)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSpoolerStatus(UINT nStatus, UINT nJobs)
+#define MSG_WM_SPOOLERSTATUS(func) \
+ if (uMsg == WM_SPOOLERSTATUS) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (UINT)LOWORD(lParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
+#define MSG_WM_DRAWITEM(func) \
+ if (uMsg == WM_DRAWITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
+#define MSG_WM_MEASUREITEM(func) \
+ if (uMsg == WM_MEASUREITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
+#define MSG_WM_DELETEITEM(func) \
+ if (uMsg == WM_DELETEITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+//int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
+#define MSG_WM_CHARTOITEM(func) \
+ if (uMsg == WM_CHARTOITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
+#define MSG_WM_VKEYTOITEM(func) \
+ if (uMsg == WM_VKEYTOITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HCURSOR OnQueryDragIcon()
+#define MSG_WM_QUERYDRAGICON(func) \
+ if (uMsg == WM_QUERYDRAGICON) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
+#define MSG_WM_COMPAREITEM(func) \
+ if (uMsg == WM_COMPAREITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCompacting(UINT nCpuTime)
+#define MSG_WM_COMPACTING(func) \
+ if (uMsg == WM_COMPACTING) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct)
+#define MSG_WM_NCCREATE(func) \
+ if (uMsg == WM_NCCREATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcDestroy()
+#define MSG_WM_NCDESTROY(func) \
+ if (uMsg == WM_NCDESTROY) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam)
+#define MSG_WM_NCCALCSIZE(func) \
+ if (uMsg == WM_NCCALCSIZE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((BOOL)wParam, lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// UINT OnNcHitTest(CPoint point)
+#define MSG_WM_NCHITTEST(func) \
+ if (uMsg == WM_NCHITTEST) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcPaint(CRgn rgn)
+#define MSG_WM_NCPAINT(func) \
+ if (uMsg == WM_NCPAINT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HRGN)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnNcActivate(BOOL bActive)
+#define MSG_WM_NCACTIVATE(func) \
+ if (uMsg == WM_NCACTIVATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((BOOL)wParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// UINT OnGetDlgCode(LPMSG lpMsg)
+#define MSG_WM_GETDLGCODE(func) \
+ if (uMsg == WM_GETDLGCODE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((LPMSG)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcMouseMove(UINT nHitTest, CPoint point)
+#define MSG_WM_NCMOUSEMOVE(func) \
+ if (uMsg == WM_NCMOUSEMOVE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcLButtonDown(UINT nHitTest, CPoint point)
+#define MSG_WM_NCLBUTTONDOWN(func) \
+ if (uMsg == WM_NCLBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcLButtonUp(UINT nHitTest, CPoint point)
+#define MSG_WM_NCLBUTTONUP(func) \
+ if (uMsg == WM_NCLBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcLButtonDblClk(UINT nHitTest, CPoint point)
+#define MSG_WM_NCLBUTTONDBLCLK(func) \
+ if (uMsg == WM_NCLBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcRButtonDown(UINT nHitTest, CPoint point)
+#define MSG_WM_NCRBUTTONDOWN(func) \
+ if (uMsg == WM_NCRBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcRButtonUp(UINT nHitTest, CPoint point)
+#define MSG_WM_NCRBUTTONUP(func) \
+ if (uMsg == WM_NCRBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcRButtonDblClk(UINT nHitTest, CPoint point)
+#define MSG_WM_NCRBUTTONDBLCLK(func) \
+ if (uMsg == WM_NCRBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcMButtonDown(UINT nHitTest, CPoint point)
+#define MSG_WM_NCMBUTTONDOWN(func) \
+ if (uMsg == WM_NCMBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcMButtonUp(UINT nHitTest, CPoint point)
+#define MSG_WM_NCMBUTTONUP(func) \
+ if (uMsg == WM_NCMBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNcMButtonDblClk(UINT nHitTest, CPoint point)
+#define MSG_WM_NCMBUTTONDBLCLK(func) \
+ if (uMsg == WM_NCMBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_KEYDOWN(func) \
+ if (uMsg == WM_KEYDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_KEYUP(func) \
+ if (uMsg == WM_KEYUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_CHAR(func) \
+ if (uMsg == WM_CHAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_DEADCHAR(func) \
+ if (uMsg == WM_DEADCHAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_SYSKEYDOWN(func) \
+ if (uMsg == WM_SYSKEYDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_SYSKEYUP(func) \
+ if (uMsg == WM_SYSKEYUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_SYSCHAR(func) \
+ if (uMsg == WM_SYSCHAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_SYSDEADCHAR(func) \
+ if (uMsg == WM_SYSDEADCHAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSysCommand(UINT nID, LPARAM lParam)
+#define MSG_WM_SYSCOMMAND(func) \
+ if (uMsg == WM_SYSCOMMAND) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnTCard(UINT idAction, DWORD dwActionData)
+#define MSG_WM_TCARD(func) \
+ if (uMsg == WM_TCARD) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (DWORD)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnTimer(UINT_PTR nIDEvent)
+#define MSG_WM_TIMER(func) \
+ if (uMsg == WM_TIMER) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT_PTR)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
+#define MSG_WM_HSCROLL(func) \
+ if (uMsg == WM_HSCROLL) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
+#define MSG_WM_VSCROLL(func) \
+ if (uMsg == WM_VSCROLL) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnInitMenu(CMenu menu)
+#define MSG_WM_INITMENU(func) \
+ if (uMsg == WM_INITMENU) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HMENU)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnInitMenuPopup(CMenu menuPopup, UINT nIndex, BOOL bSysMenu)
+#define MSG_WM_INITMENUPOPUP(func) \
+ if (uMsg == WM_INITMENUPOPUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMenuSelect(UINT nItemID, UINT nFlags, CMenu menu)
+#define MSG_WM_MENUSELECT(func) \
+ if (uMsg == WM_MENUSELECT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu menu)
+#define MSG_WM_MENUCHAR(func) \
+ if (uMsg == WM_MENUCHAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnNotify(int idCtrl, LPNMHDR pnmh)
+#define MSG_WM_NOTIFY(func) \
+ if (uMsg == WM_NOTIFY) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((int)wParam, (LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnEnterIdle(UINT nWhy, CWindow wndWho)
+#define MSG_WM_ENTERIDLE(func) \
+ if (uMsg == WM_ENTERIDLE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMouseMove(UINT nFlags, CPoint point)
+#define MSG_WM_MOUSEMOVE(func) \
+ if (uMsg == WM_MOUSEMOVE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+#define MSG_WM_MOUSEWHEEL(func) \
+ if (uMsg == WM_MOUSEWHEEL) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnLButtonDown(UINT nFlags, CPoint point)
+#define MSG_WM_LBUTTONDOWN(func) \
+ if (uMsg == WM_LBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnLButtonUp(UINT nFlags, CPoint point)
+#define MSG_WM_LBUTTONUP(func) \
+ if (uMsg == WM_LBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnLButtonDblClk(UINT nFlags, CPoint point)
+#define MSG_WM_LBUTTONDBLCLK(func) \
+ if (uMsg == WM_LBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnRButtonDown(UINT nFlags, CPoint point)
+#define MSG_WM_RBUTTONDOWN(func) \
+ if (uMsg == WM_RBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnRButtonUp(UINT nFlags, CPoint point)
+#define MSG_WM_RBUTTONUP(func) \
+ if (uMsg == WM_RBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnRButtonDblClk(UINT nFlags, CPoint point)
+#define MSG_WM_RBUTTONDBLCLK(func) \
+ if (uMsg == WM_RBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMButtonDown(UINT nFlags, CPoint point)
+#define MSG_WM_MBUTTONDOWN(func) \
+ if (uMsg == WM_MBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMButtonUp(UINT nFlags, CPoint point)
+#define MSG_WM_MBUTTONUP(func) \
+ if (uMsg == WM_MBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMButtonDblClk(UINT nFlags, CPoint point)
+#define MSG_WM_MBUTTONDBLCLK(func) \
+ if (uMsg == WM_MBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam)
+#define MSG_WM_PARENTNOTIFY(func) \
+ if (uMsg == WM_PARENTNOTIFY) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMDIActivate(CWindow wndActivate, CWindow wndDeactivate)
+#define MSG_WM_MDIACTIVATE(func) \
+ if (uMsg == WM_MDIACTIVATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam, (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnRenderFormat(UINT nFormat)
+#define MSG_WM_RENDERFORMAT(func) \
+ if (uMsg == WM_RENDERFORMAT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnRenderAllFormats()
+#define MSG_WM_RENDERALLFORMATS(func) \
+ if (uMsg == WM_RENDERALLFORMATS) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDestroyClipboard()
+#define MSG_WM_DESTROYCLIPBOARD(func) \
+ if (uMsg == WM_DESTROYCLIPBOARD) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDrawClipboard()
+#define MSG_WM_DRAWCLIPBOARD(func) \
+ if (uMsg == WM_DRAWCLIPBOARD) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct)
+#define MSG_WM_PAINTCLIPBOARD(func) \
+ if (uMsg == WM_PAINTCLIPBOARD) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \
+ ::GlobalUnlock((HGLOBAL)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
+#define MSG_WM_VSCROLLCLIPBOARD(func) \
+ if (uMsg == WM_VSCROLLCLIPBOARD) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnContextMenu(CWindow wnd, CPoint point)
+#define MSG_WM_CONTEXTMENU(func) \
+ if (uMsg == WM_CONTEXTMENU) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect)
+#define MSG_WM_SIZECLIPBOARD(func) \
+ if (uMsg == WM_SIZECLIPBOARD) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \
+ ::GlobalUnlock((HGLOBAL)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString)
+#define MSG_WM_ASKCBFORMATNAME(func) \
+ if (uMsg == WM_ASKCBFORMATNAME) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((DWORD)wParam, (LPTSTR)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter)
+#define MSG_WM_CHANGECBCHAIN(func) \
+ if (uMsg == WM_CHANGECBCHAIN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam, (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
+#define MSG_WM_HSCROLLCLIPBOARD(func) \
+ if (uMsg == WM_HSCROLLCLIPBOARD) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnQueryNewPalette()
+#define MSG_WM_QUERYNEWPALETTE(func) \
+ if (uMsg == WM_QUERYNEWPALETTE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnPaletteChanged(CWindow wndFocus)
+#define MSG_WM_PALETTECHANGED(func) \
+ if (uMsg == WM_PALETTECHANGED) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnPaletteIsChanging(CWindow wndPalChg)
+#define MSG_WM_PALETTEISCHANGING(func) \
+ if (uMsg == WM_PALETTEISCHANGING) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDropFiles(HDROP hDropInfo)
+#define MSG_WM_DROPFILES(func) \
+ if (uMsg == WM_DROPFILES) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HDROP)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnWindowPosChanging(LPWINDOWPOS lpWndPos)
+#define MSG_WM_WINDOWPOSCHANGING(func) \
+ if (uMsg == WM_WINDOWPOSCHANGING) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((LPWINDOWPOS)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnWindowPosChanged(LPWINDOWPOS lpWndPos)
+#define MSG_WM_WINDOWPOSCHANGED(func) \
+ if (uMsg == WM_WINDOWPOSCHANGED) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((LPWINDOWPOS)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnExitMenuLoop(BOOL fIsTrackPopupMenu)
+#define MSG_WM_EXITMENULOOP(func) \
+ if (uMsg == WM_EXITMENULOOP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnEnterMenuLoop(BOOL fIsTrackPopupMenu)
+#define MSG_WM_ENTERMENULOOP(func) \
+ if (uMsg == WM_ENTERMENULOOP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
+#define MSG_WM_STYLECHANGED(func) \
+ if (uMsg == WM_STYLECHANGED) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
+#define MSG_WM_STYLECHANGING(func) \
+ if (uMsg == WM_STYLECHANGING) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSizing(UINT fwSide, LPRECT pRect)
+#define MSG_WM_SIZING(func) \
+ if (uMsg == WM_SIZING) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPRECT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMoving(UINT fwSide, LPRECT pRect)
+#define MSG_WM_MOVING(func) \
+ if (uMsg == WM_MOVING) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPRECT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCaptureChanged(CWindow wnd)
+#define MSG_WM_CAPTURECHANGED(func) \
+ if (uMsg == WM_CAPTURECHANGED) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnDeviceChange(UINT nEventType, DWORD dwData)
+#define MSG_WM_DEVICECHANGE(func) \
+ if (uMsg == WM_DEVICECHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)wParam, (DWORD)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define MSG_WM_COMMAND(func) \
+ if (uMsg == WM_COMMAND) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen)
+#define MSG_WM_DISPLAYCHANGE(func) \
+ if (uMsg == WM_DISPLAYCHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnEnterSizeMove()
+#define MSG_WM_ENTERSIZEMOVE(func) \
+ if (uMsg == WM_ENTERSIZEMOVE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnExitSizeMove()
+#define MSG_WM_EXITSIZEMOVE(func) \
+ if (uMsg == WM_EXITSIZEMOVE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HFONT OnGetFont()
+#define MSG_WM_GETFONT(func) \
+ if (uMsg == WM_GETFONT) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnGetHotKey()
+#define MSG_WM_GETHOTKEY(func) \
+ if (uMsg == WM_GETHOTKEY) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HICON OnGetIcon()
+#define MSG_WM_GETICON(func) \
+ if (uMsg == WM_GETICON) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)wParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnGetText(int cchTextMax, LPTSTR lpszText)
+#define MSG_WM_GETTEXT(func) \
+ if (uMsg == WM_GETTEXT) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnGetTextLength()
+#define MSG_WM_GETTEXTLENGTH(func) \
+ if (uMsg == WM_GETTEXTLENGTH) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnHelp(LPHELPINFO lpHelpInfo)
+#define MSG_WM_HELP(func) \
+ if (uMsg == WM_HELP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((LPHELPINFO)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey)
+#define MSG_WM_HOTKEY(func) \
+ if (uMsg == WM_HOTKEY) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout)
+#define MSG_WM_INPUTLANGCHANGE(func) \
+ if (uMsg == WM_INPUTLANGCHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((DWORD)wParam, (HKL)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout)
+#define MSG_WM_INPUTLANGCHANGEREQUEST(func) \
+ if (uMsg == WM_INPUTLANGCHANGEREQUEST) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam, (HKL)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus)
+#define MSG_WM_NEXTDLGCTL(func) \
+ if (uMsg == WM_NEXTDLGCTL) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)LOWORD(lParam), wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu)
+#define MSG_WM_NEXTMENU(func) \
+ if (uMsg == WM_NEXTMENU) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((int)wParam, (LPMDINEXTMENU)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnNotifyFormat(CWindow wndFrom, int nCommand)
+#define MSG_WM_NOTIFYFORMAT(func) \
+ if (uMsg == WM_NOTIFYFORMAT) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HWND)wParam, (int)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD dwData)
+#define MSG_WM_POWERBROADCAST(func) \
+ if (uMsg == WM_POWERBROADCAST) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((DWORD)wParam, (DWORD)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnPrint(CDCHandle dc, UINT uFlags)
+#define MSG_WM_PRINT(func) \
+ if (uMsg == WM_PRINT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HDC)wParam, (UINT)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnPrintClient(CDCHandle dc, UINT uFlags)
+#define MSG_WM_PRINTCLIENT(func) \
+ if (uMsg == WM_PRINTCLIENT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HDC)wParam, (UINT)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError)
+#define MSG_WM_RASDIALEVENT(func) \
+ if (uMsg == WM_RASDIALEVENT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((RASCONNSTATE)wParam, (DWORD)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSetFont(CFont font, BOOL bRedraw)
+#define MSG_WM_SETFONT(func) \
+ if (uMsg == WM_SETFONT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((HFONT)wParam, (BOOL)LOWORD(lParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnSetHotKey(int nVirtKey, UINT uFlags)
+#define MSG_WM_SETHOTKEY(func) \
+ if (uMsg == WM_SETHOTKEY) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HICON OnSetIcon(UINT uType, HICON hIcon)
+#define MSG_WM_SETICON(func) \
+ if (uMsg == WM_SETICON) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnSetRedraw(BOOL bRedraw)
+#define MSG_WM_SETREDRAW(func) \
+ if (uMsg == WM_SETREDRAW) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((BOOL)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnSetText(LPCTSTR lpstrText)
+#define MSG_WM_SETTEXT(func) \
+ if (uMsg == WM_SETTEXT) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((LPCTSTR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnUserChanged()
+#define MSG_WM_USERCHANGED(func) \
+ if (uMsg == WM_USERCHANGED) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// New NT4 & NT5 messages
+
+#if(_WIN32_WINNT >= 0x0400)
+
+// void OnMouseHover(WPARAM wParam, CPoint ptPos)
+#define MSG_WM_MOUSEHOVER(func) \
+ if (uMsg == WM_MOUSEHOVER) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMouseLeave()
+#define MSG_WM_MOUSELEAVE(func) \
+ if (uMsg == WM_MOUSELEAVE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+#endif /* _WIN32_WINNT >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+
+// void OnMenuRButtonUp(WPARAM wParam, CMenu menu)
+#define MSG_WM_MENURBUTTONUP(func) \
+ if (uMsg == WM_MENURBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(wParam, (HMENU)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnMenuDrag(WPARAM wParam, CMenu menu)
+#define MSG_WM_MENUDRAG(func) \
+ if (uMsg == WM_MENUDRAG) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func(wParam, (HMENU)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info)
+#define MSG_WM_MENUGETOBJECT(func) \
+ if (uMsg == WM_MENUGETOBJECT) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((PMENUGETOBJECTINFO)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnUnInitMenuPopup(UINT nID, CMenu menu)
+#define MSG_WM_UNINITMENUPOPUP(func) \
+ if (uMsg == WM_UNINITMENUPOPUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(lParam), (HMENU)wParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnMenuCommand(WPARAM nIndex, CMenu menu)
+#define MSG_WM_MENUCOMMAND(func) \
+ if (uMsg == WM_MENUCOMMAND) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(wParam, (HMENU)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+#endif /* WINVER >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0500)
+
+// BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys)
+#define MSG_WM_APPCOMMAND(func) \
+ if (uMsg == WM_APPCOMMAND) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos)
+#define MSG_WM_NCXBUTTONDOWN(func) \
+ if (uMsg == WM_NCXBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos)
+#define MSG_WM_NCXBUTTONUP(func) \
+ if (uMsg == WM_NCXBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos)
+#define MSG_WM_NCXBUTTONDBLCLK(func) \
+ if (uMsg == WM_NCXBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos)
+#define MSG_WM_XBUTTONDOWN(func) \
+ if (uMsg == WM_XBUTTONDOWN) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos)
+#define MSG_WM_XBUTTONUP(func) \
+ if (uMsg == WM_XBUTTONUP) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos)
+#define MSG_WM_XBUTTONDBLCLK(func) \
+ if (uMsg == WM_XBUTTONDBLCLK) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnChangeUIState(WORD nAction, WORD nState)
+#define MSG_WM_CHANGEUISTATE(func) \
+ if (uMsg == WM_CHANGEUISTATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(LOWORD(wParam), HIWORD(wParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnUpdateUIState(WORD nAction, WORD nState)
+#define MSG_WM_UPDATEUISTATE(func) \
+ if (uMsg == WM_UPDATEUISTATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(LOWORD(wParam), HIWORD(wParam)); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnQueryUIState()
+#define MSG_WM_QUERYUISTATE(func) \
+ if (uMsg == WM_QUERYUISTATE) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+#endif // (_WIN32_WINNT >= 0x0500)
+
+#if(_WIN32_WINNT >= 0x0501)
+
+// void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput)
+#define MSG_WM_INPUT(func) \
+ if (uMsg == WM_INPUT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags)
+#define MSG_WM_UNICHAR(func) \
+ if (uMsg == WM_UNICHAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
+ if(IsMsgHandled()) \
+ { \
+ lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \
+ return TRUE; \
+ } \
+ }
+
+// void OnWTSSessionChange(WPARAM nStatusCode, PWTSSESSION_NOTIFICATION nSessionID)
+#define MSG_WM_WTSSESSION_CHANGE(func) \
+ if (uMsg == WM_WTSSESSION_CHANGE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(wParam, (PWTSSESSION_NOTIFICATION)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// OnThemeChanged()
+#define MSG_WM_THEMECHANGED(func) \
+ if (uMsg == WM_THEMECHANGED) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+///////////////////////////////////////////////////////////////////////////////
+// ATL defined messages
+
+// BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData)
+#define MSG_WM_FORWARDMSG(func) \
+ if (uMsg == WM_FORWARDMSG) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// Dialog specific messages
+
+// LRESULT OnDMGetDefID()
+#define MSG_DM_GETDEFID(func) \
+ if (uMsg == DM_GETDEFID) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func(); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDMSetDefID(UINT DefID)
+#define MSG_DM_SETDEFID(func) \
+ if (uMsg == DM_SETDEFID) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnDMReposition()
+#define MSG_DM_REPOSITION(func) \
+ if (uMsg == DM_REPOSITION) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// Reflected messages
+
+// void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define MSG_OCM_COMMAND(func) \
+ if (uMsg == OCM_COMMAND) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh)
+#define MSG_OCM_NOTIFY(func) \
+ if (uMsg == OCM_NOTIFY) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((int)wParam, (LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam)
+#define MSG_OCM_PARENTNOTIFY(func) \
+ if (uMsg == OCM_PARENTNOTIFY) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
+#define MSG_OCM_DRAWITEM(func) \
+ if (uMsg == OCM_DRAWITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
+#define MSG_OCM_MEASUREITEM(func) \
+ if (uMsg == OCM_MEASUREITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
+#define MSG_OCM_COMPAREITEM(func) \
+ if (uMsg == OCM_COMPAREITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
+#define MSG_OCM_DELETEITEM(func) \
+ if (uMsg == OCM_DELETEITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
+ lResult = TRUE; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
+#define MSG_OCM_VKEYTOITEM(func) \
+ if (uMsg == OCM_VKEYTOITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+//int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
+#define MSG_OCM_CHARTOITEM(func) \
+ if (uMsg == OCM_CHARTOITEM) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
+#define MSG_OCM_HSCROLL(func) \
+ if (uMsg == OCM_HSCROLL) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
+#define MSG_OCM_VSCROLL(func) \
+ if (uMsg == OCM_VSCROLL) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit)
+#define MSG_OCM_CTLCOLOREDIT(func) \
+ if (uMsg == OCM_CTLCOLOREDIT) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox)
+#define MSG_OCM_CTLCOLORLISTBOX(func) \
+ if (uMsg == OCM_CTLCOLORLISTBOX) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button)
+#define MSG_OCM_CTLCOLORBTN(func) \
+ if (uMsg == OCM_CTLCOLORBTN) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd)
+#define MSG_OCM_CTLCOLORDLG(func) \
+ if (uMsg == OCM_CTLCOLORDLG) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
+#define MSG_OCM_CTLCOLORSCROLLBAR(func) \
+ if (uMsg == OCM_CTLCOLORSCROLLBAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic)
+#define MSG_OCM_CTLCOLORSTATIC(func) \
+ if (uMsg == OCM_CTLCOLORSTATIC) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// Edit specific messages
+
+// void OnClear()
+#define MSG_WM_CLEAR(func) \
+ if (uMsg == WM_CLEAR) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCopy()
+#define MSG_WM_COPY(func) \
+ if (uMsg == WM_COPY) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCut()
+#define MSG_WM_CUT(func) \
+ if (uMsg == WM_CUT) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnPaste()
+#define MSG_WM_PASTE(func) \
+ if (uMsg == WM_PASTE) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnUndo()
+#define MSG_WM_UNDO(func) \
+ if (uMsg == WM_UNDO) \
+ { \
+ SetMsgHandled(TRUE); \
+ func(); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// Generic message handlers
+
+// LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
+#define MESSAGE_HANDLER_EX(msg, func) \
+ if(uMsg == msg) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func(uMsg, wParam, lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
+#define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \
+ if(uMsg >= msgFirst && uMsg <= msgLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func(uMsg, wParam, lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// Commands and notifications
+
+// void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define COMMAND_HANDLER_EX(id, code, func) \
+ if (uMsg == WM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define COMMAND_ID_HANDLER_EX(id, func) \
+ if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define COMMAND_CODE_HANDLER_EX(code, func) \
+ if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnNotifyHandlerEX(LPNMHDR pnmh)
+#define NOTIFY_HANDLER_EX(id, cd, func) \
+ if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh)
+#define NOTIFY_ID_HANDLER_EX(id, func) \
+ if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh)
+#define NOTIFY_CODE_HANDLER_EX(cd, func) \
+ if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
+ if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
+ if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh)
+#define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
+ if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
+#define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
+ if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \
+ if (uMsg == OCM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \
+ if (uMsg == OCM_COMMAND && id == LOWORD(wParam)) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \
+ if (uMsg == OCM_COMMAND && code == HIWORD(wParam)) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh)
+#define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \
+ if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh)
+#define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \
+ if (uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh)
+#define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \
+ if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
+ if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
+#define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
+ if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
+ lResult = 0; \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh)
+#define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
+ if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+// LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
+#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
+ if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
+ { \
+ SetMsgHandled(TRUE); \
+ lResult = func((LPNMHDR)lParam); \
+ if(IsMsgHandled()) \
+ return TRUE; \
+ }
+
+#endif // __ATLCRACK_H__
diff --git a/Externals/WTL80/atlctrls.h b/Externals/WTL80/atlctrls.h
new file mode 100644
index 0000000000..338f51d0be
--- /dev/null
+++ b/Externals/WTL80/atlctrls.h
@@ -0,0 +1,10039 @@
+// Windows Template Library - WTL version 8.0
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// This file is a part of the Windows Template Library.
+// The use and distribution terms for this software are covered by the
+// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php)
+// which can be found in the file CPL.TXT at the root of this distribution.
+// By using this software in any fashion, you are agreeing to be bound by
+// the terms of this license. You must not remove this notice, or
+// any other, from this software.
+
+#ifndef __ATLCTRLS_H__
+#define __ATLCTRLS_H__
+
+#pragma once
+
+#ifndef __cplusplus
+ #error ATL requires C++ compilation (use a .cpp suffix)
+#endif
+
+#ifndef __ATLAPP_H__
+ #error atlctrls.h requires atlapp.h to be included first
+#endif
+
+#ifndef __ATLWIN_H__
+ #error atlctrls.h requires atlwin.h to be included first
+#endif
+
+#if (_WIN32_IE < 0x0300)
+ #error atlctrls.h requires IE Version 3.0 or higher
+#endif
+
+#ifndef _WIN32_WCE
+ #include
+ #include
+#elif defined(WIN32_PLATFORM_WFSP) && !defined(_WINUSERM_H_)
+ #include
+#endif // !_WIN32_WCE
+
+// protect template members from windowsx.h macros
+#ifdef _INC_WINDOWSX
+ #undef GetNextSibling
+ #undef GetPrevSibling
+#endif // _INC_WINDOWSX
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Classes in this file:
+//
+// CStaticT - CStatic
+// CButtonT - CButton
+// CListBoxT - CListBox
+// CComboBoxT - CComboBox
+// CEditT - CEdit
+// CEditCommands
+// CScrollBarT - CScrollBar
+//
+// CImageList
+// CListViewCtrlT - CListViewCtrl
+// CTreeViewCtrlT - CTreeViewCtrl
+// CTreeItemT - CTreeItem
+// CTreeViewCtrlExT - CTreeViewCtrlEx
+// CHeaderCtrlT - CHeaderCtrl
+// CToolBarCtrlT - CToolBarCtrl
+// CStatusBarCtrlT - CStatusBarCtrl
+// CTabCtrlT - CTabCtrl
+// CToolInfo
+// CToolTipCtrlT - CToolTipCtrl
+// CTrackBarCtrlT - CTrackBarCtrl
+// CUpDownCtrlT - CUpDownCtrl
+// CProgressBarCtrlT - CProgressBarCtrl
+// CHotKeyCtrlT - CHotKeyCtrl
+// CAnimateCtrlT - CAnimateCtrl
+// CRichEditCtrlT - CRichEditCtrl
+// CRichEditCommands
+// CDragListBoxT - CDragListBox
+// CDragListNotifyImpl
+// CReBarCtrlT - CReBarCtrl
+// CComboBoxExT - CComboBoxEx
+// CDateTimePickerCtrlT - CDateTimePickerCtrl
+// CMonthCalendarCtrlT - CMonthCalendarCtrl
+// CFlatScrollBarImpl
+// CFlatScrollBarT - CFlatScrollBar
+// CIPAddressCtrlT - CIPAddressCtrl
+// CPagerCtrlT - CPagerCtrl
+// CLinkCtrlT - CLinkCtrl
+//
+// CCustomDraw
+//
+// CCECommandBarCtrlT - CCECommandBarCtrl
+// CCECommandBandsCtrlT - CCECommandBandsCtrl
+
+
+namespace WTL
+{
+
+// These are wrapper classes for Windows standard and common controls.
+// To implement a window based on a control, use following:
+// Example: Implementing a window based on a list box
+//
+// class CMyListBox : CWindowImpl
+// {
+// public:
+// BEGIN_MSG_MAP(CMyListBox)
+// // put your message handler entries here
+// END_MSG_MAP()
+// };
+
+
+
+// --- Standard Windows controls ---
+
+///////////////////////////////////////////////////////////////////////////////
+// CStatic - client side for a Windows STATIC control
+
+template
+class CStaticT : public TBase
+{
+public:
+// Constructors
+ CStaticT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CStaticT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return _T("STATIC");
+ }
+
+#ifndef _WIN32_WCE
+ HICON GetIcon() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HICON)::SendMessage(m_hWnd, STM_GETICON, 0, 0L);
+ }
+
+ HICON SetIcon(HICON hIcon)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HICON)::SendMessage(m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L);
+ }
+
+ HENHMETAFILE GetEnhMetaFile() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HENHMETAFILE)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0L);
+ }
+
+ HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HENHMETAFILE)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile);
+ }
+#else // CE specific
+ HICON GetIcon() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HICON)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ICON, 0L);
+ }
+
+ HICON SetIcon(HICON hIcon)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HICON)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ }
+#endif // _WIN32_WCE
+
+ CBitmapHandle GetBitmap() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L));
+ }
+
+ CBitmapHandle SetBitmap(HBITMAP hBitmap)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap));
+ }
+
+ HCURSOR GetCursor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HCURSOR)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0L);
+ }
+
+ HCURSOR SetCursor(HCURSOR hCursor)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HCURSOR)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor);
+ }
+};
+
+typedef CStaticT CStatic;
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CButton - client side for a Windows BUTTON control
+
+template
+class CButtonT : public TBase
+{
+public:
+// Constructors
+ CButtonT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CButtonT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return _T("BUTTON");
+ }
+
+ UINT GetState() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, BM_GETSTATE, 0, 0L);
+ }
+
+ void SetState(BOOL bHighlight)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, BM_SETSTATE, bHighlight, 0L);
+ }
+
+ int GetCheck() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0L);
+ }
+
+ void SetCheck(int nCheck)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0L);
+ }
+
+ UINT GetButtonStyle() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::GetWindowLong(m_hWnd, GWL_STYLE) & 0xFFFF;
+ }
+
+ void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw);
+ }
+
+#ifndef _WIN32_WCE
+ HICON GetIcon() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HICON)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0L);
+ }
+
+ HICON SetIcon(HICON hIcon)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HICON)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ }
+
+ CBitmapHandle GetBitmap() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0L));
+ }
+
+ CBitmapHandle SetBitmap(HBITMAP hBitmap)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap));
+ }
+#endif // !_WIN32_WCE
+
+#if (_WIN32_WINNT >= 0x0501)
+ BOOL GetIdealSize(LPSIZE lpSize) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, BCM_GETIDEALSIZE, 0, (LPARAM)lpSize);
+ }
+
+ BOOL GetImageList(PBUTTON_IMAGELIST pButtonImagelist) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, BCM_GETIMAGELIST, 0, (LPARAM)pButtonImagelist);
+ }
+
+ BOOL SetImageList(PBUTTON_IMAGELIST pButtonImagelist)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, BCM_SETIMAGELIST, 0, (LPARAM)pButtonImagelist);
+ }
+
+ BOOL GetTextMargin(LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, BCM_GETTEXTMARGIN, 0, (LPARAM)lpRect);
+ }
+
+ BOOL SetTextMargin(LPRECT lpRect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, BCM_SETTEXTMARGIN, 0, (LPARAM)lpRect);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+#if (WINVER >= 0x0600)
+ void SetDontClick(BOOL bDontClick)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, BM_SETDONTCLICK, (WPARAM)bDontClick, 0L);
+ }
+#endif // (WINVER >= 0x0600)
+
+#if (_WIN32_WINNT >= 0x0600)
+ BOOL SetDropDownState(BOOL bDropDown)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0);
+ return (BOOL)::SendMessage(m_hWnd, BCM_SETDROPDOWNSTATE, (WPARAM)bDropDown, 0L);
+ }
+
+ BOOL GetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0);
+ return (BOOL)::SendMessage(m_hWnd, BCM_GETSPLITINFO, 0, (LPARAM)pSplitInfo);
+ }
+
+ BOOL SetSplitInfo(PBUTTON_SPLITINFO pSplitInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0);
+ return (BOOL)::SendMessage(m_hWnd, BCM_SETSPLITINFO, 0, (LPARAM)pSplitInfo);
+ }
+
+ int GetNoteLength() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0);
+ return (int)::SendMessage(m_hWnd, BCM_GETNOTELENGTH, 0, 0L);
+ }
+
+ BOOL GetNote(LPWSTR lpstrNoteText, int cchNoteText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0);
+ return (BOOL)::SendMessage(m_hWnd, BCM_GETNOTE, cchNoteText, (LPARAM)lpstrNoteText);
+ }
+
+ BOOL SetNote(LPCWSTR lpstrNoteText)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0);
+ return (BOOL)::SendMessage(m_hWnd, BCM_SETNOTE, 0, (LPARAM)lpstrNoteText);
+ }
+
+ LRESULT SetElevationRequiredState(BOOL bSet)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return ::SendMessage(m_hWnd, BCM_SETSHIELD, 0, (LPARAM)bSet);
+ }
+#endif // (_WIN32_WINNT >= 0x0600)
+
+// Operations
+ void Click()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, BM_CLICK, 0, 0L);
+ }
+};
+
+typedef CButtonT CButton;
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CListBox - client side for a Windows LISTBOX control
+
+template
+class CListBoxT : public TBase
+{
+public:
+// Constructors
+ CListBoxT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CListBoxT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return _T("LISTBOX");
+ }
+
+ // for entire listbox
+ int GetCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0L);
+ }
+
+#ifndef _WIN32_WCE
+ int SetCount(int cItems)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(((GetStyle() & LBS_NODATA) != 0) && ((GetStyle() & LBS_HASSTRINGS) == 0));
+ return (int)::SendMessage(m_hWnd, LB_SETCOUNT, cItems, 0L);
+ }
+#endif // !_WIN32_WCE
+
+ int GetHorizontalExtent() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETHORIZONTALEXTENT, 0, 0L);
+ }
+
+ void SetHorizontalExtent(int cxExtent)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0L);
+ }
+
+ int GetTopIndex() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETTOPINDEX, 0, 0L);
+ }
+
+ int SetTopIndex(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_SETTOPINDEX, nIndex, 0L);
+ }
+
+ LCID GetLocale() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (LCID)::SendMessage(m_hWnd, LB_GETLOCALE, 0, 0L);
+ }
+
+ LCID SetLocale(LCID nNewLocale)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (LCID)::SendMessage(m_hWnd, LB_SETLOCALE, (WPARAM)nNewLocale, 0L);
+ }
+
+#if (WINVER >= 0x0500) && !defined(_WIN32_WCE)
+ DWORD GetListBoxInfo() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+#if (_WIN32_WINNT >= 0x0501)
+ return (DWORD)::SendMessage(m_hWnd, LB_GETLISTBOXINFO, 0, 0L);
+#else // !(_WIN32_WINNT >= 0x0501)
+ return ::GetListBoxInfo(m_hWnd);
+#endif // !(_WIN32_WINNT >= 0x0501)
+ }
+#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
+
+ // for single-selection listboxes
+ int GetCurSel() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0);
+ return (int)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0L);
+ }
+
+ int SetCurSel(int nSelect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0);
+ return (int)::SendMessage(m_hWnd, LB_SETCURSEL, nSelect, 0L);
+ }
+
+ // for multiple-selection listboxes
+ int GetSel(int nIndex) const // also works for single-selection
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETSEL, nIndex, 0L);
+ }
+
+ int SetSel(int nIndex, BOOL bSelect = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0);
+ return (int)::SendMessage(m_hWnd, LB_SETSEL, bSelect, nIndex);
+ }
+
+ int GetSelCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0);
+ return (int)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0L);
+ }
+
+ int GetSelItems(int nMaxItems, LPINT rgIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0);
+ return (int)::SendMessage(m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex);
+ }
+
+ int GetAnchorIndex() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0);
+ return (int)::SendMessage(m_hWnd, LB_GETANCHORINDEX, 0, 0L);
+ }
+
+ void SetAnchorIndex(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0);
+ ::SendMessage(m_hWnd, LB_SETANCHORINDEX, nIndex, 0L);
+ }
+
+ int GetCaretIndex() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETCARETINDEX, 0, 0);
+ }
+
+ int SetCaretIndex(int nIndex, BOOL bScroll = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0));
+ }
+
+ // for listbox items
+ DWORD_PTR GetItemData(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD_PTR)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L);
+ }
+
+ int SetItemData(int nIndex, DWORD_PTR dwItemData)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData);
+ }
+
+ void* GetItemDataPtr(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (void*)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L);
+ }
+
+ int SetItemDataPtr(int nIndex, void* pData)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItemData(nIndex, (DWORD_PTR)pData);
+ }
+
+ int GetItemRect(int nIndex, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect);
+ }
+
+ int GetText(int nIndex, LPTSTR lpszBuffer) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer);
+ }
+
+#ifndef _ATL_NO_COM
+#ifdef _OLEAUTO_H_
+ BOOL GetTextBSTR(int nIndex, BSTR& bstrText) const
+ {
+ USES_CONVERSION;
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(bstrText == NULL);
+
+ int nLen = GetTextLen(nIndex);
+ if(nLen == LB_ERR)
+ return FALSE;
+
+ CTempBuffer buff;
+ LPTSTR lpstrText = buff.Allocate(nLen + 1);
+ if(lpstrText == NULL)
+ return FALSE;
+
+ if(GetText(nIndex, lpstrText) == LB_ERR)
+ return FALSE;
+
+ bstrText = ::SysAllocString(T2OLE(lpstrText));
+ return (bstrText != NULL) ? TRUE : FALSE;
+ }
+#endif // _OLEAUTO_H_
+#endif // !_ATL_NO_COM
+
+#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+ int GetText(int nIndex, _CSTRING_NS::CString& strText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ int cchLen = GetTextLen(nIndex);
+ if(cchLen == LB_ERR)
+ return LB_ERR;
+ int nRet = LB_ERR;
+ LPTSTR lpstr = strText.GetBufferSetLength(cchLen);
+ if(lpstr != NULL)
+ {
+ nRet = GetText(nIndex, lpstr);
+ strText.ReleaseBuffer();
+ }
+ return nRet;
+ }
+#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+
+ int GetTextLen(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETTEXTLEN, nIndex, 0L);
+ }
+
+ int GetItemHeight(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L);
+ }
+
+ int SetItemHeight(int nIndex, UINT cyItemHeight)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0));
+ }
+
+ // Settable only attributes
+ void SetColumnWidth(int cxWidth)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L);
+ }
+
+ BOOL SetTabStops(int nTabStops, LPINT rgTabStops)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0);
+ return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops);
+ }
+
+ BOOL SetTabStops()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0);
+ return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 0, 0L);
+ }
+
+ BOOL SetTabStops(const int& cxEachStop) // takes an 'int'
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0);
+ return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop);
+ }
+
+// Operations
+ int InitStorage(int nItems, UINT nBytes)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_INITSTORAGE, (WPARAM)nItems, nBytes);
+ }
+
+ void ResetContent()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LB_RESETCONTENT, 0, 0L);
+ }
+
+ UINT ItemFromPoint(POINT pt, BOOL& bOutside) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ DWORD dw = (DWORD)::SendMessage(m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y));
+ bOutside = (BOOL)HIWORD(dw);
+ return (UINT)LOWORD(dw);
+ }
+
+ // manipulating listbox items
+ int AddString(LPCTSTR lpszItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem);
+ }
+
+ int DeleteString(UINT nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_DELETESTRING, nIndex, 0L);
+ }
+
+ int InsertString(int nIndex, LPCTSTR lpszItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem);
+ }
+
+#ifndef _WIN32_WCE
+ int Dir(UINT attr, LPCTSTR lpszWildCard)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard);
+ }
+
+ int AddFile(LPCTSTR lpstrFileName)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_ADDFILE, 0, (LPARAM)lpstrFileName);
+ }
+#endif // !_WIN32_WCE
+
+ // selection helpers
+ int FindString(int nStartAfter, LPCTSTR lpszItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_FINDSTRING, nStartAfter, (LPARAM)lpszItem);
+ }
+
+ int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind);
+ }
+
+ int SelectString(int nStartAfter, LPCTSTR lpszItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LB_SELECTSTRING, nStartAfter, (LPARAM)lpszItem);
+ }
+
+ int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0);
+ ATLASSERT(nFirstItem <= nLastItem);
+ return bSelect ? (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nFirstItem, nLastItem) : (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nLastItem, nFirstItem);
+ }
+
+#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages
+ DWORD GetInputMode(BOOL bCurrentMode = TRUE)
+ {
+ return SendMessage(LB_GETINPUTMODE, 0, (LPARAM)bCurrentMode);
+ }
+
+ BOOL SetInputMode(DWORD dwMode)
+ {
+ return SendMessage(LB_SETINPUTMODE, 0, (LPARAM)dwMode);
+ }
+#endif // WIN32_PLATFORM_WFSP
+};
+
+typedef CListBoxT CListBox;
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CComboBox - client side for a Windows COMBOBOX control
+
+#ifndef WIN32_PLATFORM_WFSP // No COMBOBOX on SmartPhones
+
+template
+class CComboBoxT : public TBase
+{
+public:
+// Constructors
+ CComboBoxT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CComboBoxT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return _T("COMBOBOX");
+ }
+
+ // for entire combo box
+ int GetCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0L);
+ }
+
+ int GetCurSel() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0L);
+ }
+
+ int SetCurSel(int nSelect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_SETCURSEL, nSelect, 0L);
+ }
+
+ LCID GetLocale() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (LCID)::SendMessage(m_hWnd, CB_GETLOCALE, 0, 0L);
+ }
+
+ LCID SetLocale(LCID nNewLocale)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (LCID)::SendMessage(m_hWnd, CB_SETLOCALE, (WPARAM)nNewLocale, 0L);
+ }
+
+ int GetTopIndex() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETTOPINDEX, 0, 0L);
+ }
+
+ int SetTopIndex(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_SETTOPINDEX, nIndex, 0L);
+ }
+
+ UINT GetHorizontalExtent() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, CB_GETHORIZONTALEXTENT, 0, 0L);
+ }
+
+ void SetHorizontalExtent(UINT nExtent)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, CB_SETHORIZONTALEXTENT, nExtent, 0L);
+ }
+
+ int GetDroppedWidth() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETDROPPEDWIDTH, 0, 0L);
+ }
+
+ int SetDroppedWidth(UINT nWidth)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_SETDROPPEDWIDTH, nWidth, 0L);
+ }
+
+#if ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420))
+ BOOL GetComboBoxInfo(PCOMBOBOXINFO pComboBoxInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+#if ((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420))
+ return (BOOL)::SendMessage(m_hWnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)pComboBoxInfo);
+#else // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420))
+ return ::GetComboBoxInfo(m_hWnd, pComboBoxInfo);
+#endif // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420))
+ }
+#endif // ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420))
+
+ // for edit control
+ DWORD GetEditSel() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, CB_GETEDITSEL, 0, 0L);
+ }
+
+ BOOL SetEditSel(int nStartChar, int nEndChar)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar));
+ }
+
+ // for combobox item
+ DWORD_PTR GetItemData(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD_PTR)::SendMessage(m_hWnd, CB_GETITEMDATA, nIndex, 0L);
+ }
+
+ int SetItemData(int nIndex, DWORD_PTR dwItemData)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData);
+ }
+
+ void* GetItemDataPtr(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (void*)GetItemData(nIndex);
+ }
+
+ int SetItemDataPtr(int nIndex, void* pData)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItemData(nIndex, (DWORD_PTR)pData);
+ }
+
+ int GetLBText(int nIndex, LPTSTR lpszText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText);
+ }
+
+#ifndef _ATL_NO_COM
+ BOOL GetLBTextBSTR(int nIndex, BSTR& bstrText) const
+ {
+ USES_CONVERSION;
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(bstrText == NULL);
+
+ int nLen = GetLBTextLen(nIndex);
+ if(nLen == CB_ERR)
+ return FALSE;
+
+ CTempBuffer buff;
+ LPTSTR lpstrText = buff.Allocate(nLen + 1);
+ if(lpstrText == NULL)
+ return FALSE;
+
+ if(GetLBText(nIndex, lpstrText) == CB_ERR)
+ return FALSE;
+
+ bstrText = ::SysAllocString(T2OLE(lpstrText));
+ return (bstrText != NULL) ? TRUE : FALSE;
+ }
+#endif // !_ATL_NO_COM
+
+#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+ int GetLBText(int nIndex, _CSTRING_NS::CString& strText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ int cchLen = GetLBTextLen(nIndex);
+ if(cchLen == CB_ERR)
+ return CB_ERR;
+ int nRet = CB_ERR;
+ LPTSTR lpstr = strText.GetBufferSetLength(cchLen);
+ if(lpstr != NULL)
+ {
+ nRet = GetLBText(nIndex, lpstr);
+ strText.ReleaseBuffer();
+ }
+ return nRet;
+ }
+#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+
+ int GetLBTextLen(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETLBTEXTLEN, nIndex, 0L);
+ }
+
+ int GetItemHeight(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L);
+ }
+
+ int SetItemHeight(int nIndex, UINT cyItemHeight)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0));
+ }
+
+ BOOL GetExtendedUI() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, CB_GETEXTENDEDUI, 0, 0L);
+ }
+
+ int SetExtendedUI(BOOL bExtended = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L);
+ }
+
+ void GetDroppedControlRect(LPRECT lprect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)lprect);
+ }
+
+ BOOL GetDroppedState() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, CB_GETDROPPEDSTATE, 0, 0L);
+ }
+
+#if (_WIN32_WINNT >= 0x0501)
+ int GetMinVisible() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_GETMINVISIBLE, 0, 0L);
+ }
+
+ BOOL SetMinVisible(int nMinVisible)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, CB_SETMINVISIBLE, nMinVisible, 0L);
+ }
+
+ // Vista only
+ BOOL GetCueBannerText(LPWSTR lpwText, int cchText) const
+ {
+#ifndef CB_GETCUEBANNER
+ const UINT CB_GETCUEBANNER = (CBM_FIRST + 4);
+#endif
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, CB_GETCUEBANNER, (WPARAM)lpwText, cchText);
+ }
+
+ // Vista only
+ BOOL SetCueBannerText(LPCWSTR lpcwText)
+ {
+#ifndef CB_SETCUEBANNER
+ const UINT CB_SETCUEBANNER = (CBM_FIRST + 3);
+#endif
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, CB_SETCUEBANNER, 0, (LPARAM)lpcwText);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+// Operations
+ int InitStorage(int nItems, UINT nBytes)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_INITSTORAGE, (WPARAM)nItems, nBytes);
+ }
+
+ void ResetContent()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0L);
+ }
+
+ // for edit control
+ BOOL LimitText(int nMaxChars)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, CB_LIMITTEXT, nMaxChars, 0L);
+ }
+
+ // for drop-down combo boxes
+ void ShowDropDown(BOOL bShowIt = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0L);
+ }
+
+ // manipulating listbox items
+ int AddString(LPCTSTR lpszString)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString);
+ }
+
+ int DeleteString(UINT nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_DELETESTRING, nIndex, 0L);
+ }
+
+ int InsertString(int nIndex, LPCTSTR lpszString)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString);
+ }
+
+#ifndef _WIN32_WCE
+ int Dir(UINT attr, LPCTSTR lpszWildCard)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard);
+ }
+#endif // !_WIN32_WCE
+
+ // selection helpers
+ int FindString(int nStartAfter, LPCTSTR lpszString) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_FINDSTRING, nStartAfter, (LPARAM)lpszString);
+ }
+
+ int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind);
+ }
+
+ int SelectString(int nStartAfter, LPCTSTR lpszString)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, CB_SELECTSTRING, nStartAfter, (LPARAM)lpszString);
+ }
+
+ // Clipboard operations
+ void Clear()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L);
+ }
+
+ void Copy()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_COPY, 0, 0L);
+ }
+
+ void Cut()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_CUT, 0, 0L);
+ }
+
+ void Paste()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_PASTE, 0, 0L);
+ }
+};
+
+typedef CComboBoxT CComboBox;
+
+#endif // !WIN32_PLATFORM_WFSP
+
+///////////////////////////////////////////////////////////////////////////////
+// CEdit - client side for a Windows EDIT control
+
+template
+class CEditT : public TBase
+{
+public:
+// Constructors
+ CEditT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CEditT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return _T("EDIT");
+ }
+
+ BOOL CanUndo() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L);
+ }
+
+ int GetLineCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L);
+ }
+
+ BOOL GetModify() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L);
+ }
+
+ void SetModify(BOOL bModified = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L);
+ }
+
+ void GetRect(LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect);
+ }
+
+ DWORD GetSel() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L);
+ }
+
+ void GetSel(int& nStartChar, int& nEndChar) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar);
+ }
+
+#ifndef _WIN32_WCE
+ HLOCAL GetHandle() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HLOCAL)::SendMessage(m_hWnd, EM_GETHANDLE, 0, 0L);
+ }
+
+ void SetHandle(HLOCAL hBuffer)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0L);
+ }
+#endif // !_WIN32_WCE
+
+ DWORD GetMargins() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, EM_GETMARGINS, 0, 0L);
+ }
+
+ void SetMargins(UINT nLeft, UINT nRight)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(nLeft, nRight));
+ }
+
+ UINT GetLimitText() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L);
+ }
+
+ void SetLimitText(UINT nMax)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETLIMITTEXT, nMax, 0L);
+ }
+
+ POINT PosFromChar(UINT nChar) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_POSFROMCHAR, nChar, 0);
+ POINT point = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) };
+ return point;
+ }
+
+ int CharFromPos(POINT pt, int* pLine = NULL) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y));
+ if(pLine != NULL)
+ *pLine = (int)(short)HIWORD(dwRet);
+ return (int)(short)LOWORD(dwRet);
+ }
+
+ // NOTE: first word in lpszBuffer must contain the size of the buffer!
+ int GetLine(int nIndex, LPTSTR lpszBuffer) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer);
+ }
+
+ int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ *(LPWORD)lpszBuffer = (WORD)nMaxLength;
+ return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer);
+ }
+
+ TCHAR GetPasswordChar() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (TCHAR)::SendMessage(m_hWnd, EM_GETPASSWORDCHAR, 0, 0L);
+ }
+
+ void SetPasswordChar(TCHAR ch)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETPASSWORDCHAR, ch, 0L);
+ }
+
+#ifndef _WIN32_WCE
+ EDITWORDBREAKPROC GetWordBreakProc() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (EDITWORDBREAKPROC)::SendMessage(m_hWnd, EM_GETWORDBREAKPROC, 0, 0L);
+ }
+
+ void SetWordBreakProc(EDITWORDBREAKPROC ewbprc)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc);
+ }
+#endif // !_WIN32_WCE
+
+ int GetFirstVisibleLine() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L);
+ }
+
+#ifndef _WIN32_WCE
+ int GetThumb() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & ES_MULTILINE) != 0);
+ return (int)::SendMessage(m_hWnd, EM_GETTHUMB, 0, 0L);
+ }
+#endif // !_WIN32_WCE
+
+ BOOL SetReadOnly(BOOL bReadOnly = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L);
+ }
+
+#if (WINVER >= 0x0500) && !defined(_WIN32_WCE)
+ UINT GetImeStatus(UINT uStatus) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, EM_GETIMESTATUS, uStatus, 0L);
+ }
+
+ UINT SetImeStatus(UINT uStatus, UINT uData)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, EM_SETIMESTATUS, uStatus, uData);
+ }
+#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
+
+#if (_WIN32_WINNT >= 0x0501)
+ BOOL GetCueBannerText(LPCWSTR lpstrText, int cchText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_GETCUEBANNER, (WPARAM)lpstrText, cchText);
+ }
+
+ // bKeepWithFocus - Vista only
+ BOOL SetCueBannerText(LPCWSTR lpstrText, BOOL bKeepWithFocus = FALSE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_SETCUEBANNER, (WPARAM)bKeepWithFocus, (LPARAM)(lpstrText));
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+// Operations
+ void EmptyUndoBuffer()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L);
+ }
+
+ BOOL FmtLines(BOOL bAddEOL)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_FMTLINES, bAddEOL, 0L);
+ }
+
+ void LimitText(int nChars = 0)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_LIMITTEXT, nChars, 0L);
+ }
+
+ int LineFromChar(int nIndex = -1) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, EM_LINEFROMCHAR, nIndex, 0L);
+ }
+
+ int LineIndex(int nLine = -1) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L);
+ }
+
+ int LineLength(int nLine = -1) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L);
+ }
+
+ void LineScroll(int nLines, int nChars = 0)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines);
+ }
+
+ void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText);
+ }
+
+ void SetRect(LPCRECT lpRect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect);
+ }
+
+ void SetRectNP(LPCRECT lpRect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect);
+ }
+
+ void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETSEL, LOWORD(dwSelection), HIWORD(dwSelection));
+ if(!bNoScroll)
+ ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L);
+ }
+
+ void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETSEL, nStartChar, nEndChar);
+ if(!bNoScroll)
+ ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L);
+ }
+
+ void SetSelAll(BOOL bNoScroll = FALSE)
+ {
+ SetSel(0, -1, bNoScroll);
+ }
+
+ void SetSelNone(BOOL bNoScroll = FALSE)
+ {
+ SetSel(-1, 0, bNoScroll);
+ }
+
+ BOOL SetTabStops(int nTabStops, LPINT rgTabStops)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops);
+ }
+
+ BOOL SetTabStops()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L);
+ }
+
+ BOOL SetTabStops(const int& cxEachStop) // takes an 'int'
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop);
+ }
+
+ void ScrollCaret()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L);
+ }
+
+ int Scroll(int nScrollAction)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & ES_MULTILINE) != 0);
+ LRESULT lRet = ::SendMessage(m_hWnd, EM_SCROLL, nScrollAction, 0L);
+ if(!(BOOL)HIWORD(lRet))
+ return -1; // failed
+ return (int)(short)LOWORD(lRet);
+
+ }
+
+ void InsertText(int nInsertAfterChar, LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE)
+ {
+ SetSel(nInsertAfterChar, nInsertAfterChar, bNoScroll);
+ ReplaceSel(lpstrText, bCanUndo);
+ }
+
+ void AppendText(LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE)
+ {
+ InsertText(GetWindowTextLength(), lpstrText, bNoScroll, bCanUndo);
+ }
+
+#if (_WIN32_WINNT >= 0x0501)
+ BOOL ShowBalloonTip(PEDITBALLOONTIP pEditBaloonTip)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_SHOWBALLOONTIP, 0, (LPARAM)pEditBaloonTip);
+ }
+
+ BOOL HideBalloonTip()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_HIDEBALLOONTIP, 0, 0L);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+#if (_WIN32_WINNT >= 0x0600)
+ DWORD GetHilite() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L);
+ }
+
+ void GetHilite(int& nStartChar, int& nEndChar) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L);
+ nStartChar = (int)(short)LOWORD(dwRet);
+ nEndChar = (int)(short)HIWORD(dwRet);
+ }
+
+ void SetHilite(int nStartChar, int nEndChar)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, EM_SETHILITE, nStartChar, nEndChar);
+ }
+#endif // (_WIN32_WINNT >= 0x0600)
+
+ // Clipboard operations
+ BOOL Undo()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L);
+ }
+
+ void Clear()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L);
+ }
+
+ void Copy()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_COPY, 0, 0L);
+ }
+
+ void Cut()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_CUT, 0, 0L);
+ }
+
+ void Paste()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, WM_PASTE, 0, 0L);
+ }
+
+#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages
+ DWORD GetExtendedStyle()
+ {
+ return SendMessage(EM_GETEXTENDEDSTYLE);
+ }
+
+ DWORD SetExtendedStyle(DWORD dwMask, DWORD dwExStyle)
+ {
+ return SendMessage(EM_SETEXTENDEDSTYLE, (WPARAM)dwMask, (LPARAM)dwExStyle);
+ }
+
+ DWORD GetInputMode(BOOL bCurrentMode = TRUE)
+ {
+ return SendMessage(EM_GETINPUTMODE, 0, (LPARAM)bCurrentMode);
+ }
+
+ BOOL SetInputMode(DWORD dwMode)
+ {
+ return SendMessage(EM_SETINPUTMODE, 0, (LPARAM)dwMode);
+ }
+
+ BOOL SetSymbols(LPCTSTR szSymbols)
+ {
+ return SendMessage(EM_SETSYMBOLS, 0, (LPARAM)szSymbols);
+ }
+
+ BOOL ResetSymbols()
+ {
+ return SendMessage(EM_SETSYMBOLS);
+ }
+#endif // WIN32_PLATFORM_WFSP
+};
+
+typedef CEditT CEdit;
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CEditCommands - message handlers for standard EDIT commands
+
+// Chain to CEditCommands message map. Your class must also derive from CEdit.
+// Example:
+// class CMyEdit : public CWindowImpl,
+// public CEditCommands
+// {
+// public:
+// BEGIN_MSG_MAP(CMyEdit)
+// // your handlers...
+// CHAIN_MSG_MAP_ALT(CEditCommands, 1)
+// END_MSG_MAP()
+// // other stuff...
+// };
+
+template
+class CEditCommands
+{
+public:
+ BEGIN_MSG_MAP(CEditCommands< T >)
+ ALT_MSG_MAP(1)
+ COMMAND_ID_HANDLER(ID_EDIT_CLEAR, OnEditClear)
+ COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, OnEditClearAll)
+ COMMAND_ID_HANDLER(ID_EDIT_COPY, OnEditCopy)
+ COMMAND_ID_HANDLER(ID_EDIT_CUT, OnEditCut)
+ COMMAND_ID_HANDLER(ID_EDIT_PASTE, OnEditPaste)
+ COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, OnEditSelectAll)
+ COMMAND_ID_HANDLER(ID_EDIT_UNDO, OnEditUndo)
+ END_MSG_MAP()
+
+ LRESULT OnEditClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+ {
+ T* pT = static_cast(this);
+ pT->Clear();
+ return 0;
+ }
+
+ LRESULT OnEditClearAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+ {
+ T* pT = static_cast(this);
+ pT->SetSel(0, -1);
+ pT->Clear();
+ return 0;
+ }
+
+ LRESULT OnEditCopy(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+ {
+ T* pT = static_cast(this);
+ pT->Copy();
+ return 0;
+ }
+
+ LRESULT OnEditCut(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+ {
+ T* pT = static_cast(this);
+ pT->Cut();
+ return 0;
+ }
+
+ LRESULT OnEditPaste(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+ {
+ T* pT = static_cast(this);
+ pT->Paste();
+ return 0;
+ }
+
+ LRESULT OnEditSelectAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+ {
+ T* pT = static_cast(this);
+ pT->SetSel(0, -1);
+ return 0;
+ }
+
+ LRESULT OnEditUndo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
+ {
+ T* pT = static_cast(this);
+ pT->Undo();
+ return 0;
+ }
+
+// State (update UI) helpers
+ BOOL CanCut() const
+ { return HasSelection(); }
+
+ BOOL CanCopy() const
+ { return HasSelection(); }
+
+ BOOL CanClear() const
+ { return HasSelection(); }
+
+ BOOL CanSelectAll() const
+ { return HasText(); }
+
+ BOOL CanFind() const
+ { return HasText(); }
+
+ BOOL CanRepeat() const
+ { return HasText(); }
+
+ BOOL CanReplace() const
+ { return HasText(); }
+
+ BOOL CanClearAll() const
+ { return HasText(); }
+
+// Implementation
+ BOOL HasSelection() const
+ {
+ const T* pT = static_cast(this);
+ int nMin, nMax;
+ ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nMin, (LPARAM)&nMax);
+ return (nMin != nMax);
+ }
+
+ BOOL HasText() const
+ {
+ const T* pT = static_cast(this);
+ return (pT->GetWindowTextLength() > 0);
+ }
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CScrollBar - client side for a Windows SCROLLBAR control
+
+template
+class CScrollBarT : public TBase
+{
+public:
+// Constructors
+ CScrollBarT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CScrollBarT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return _T("SCROLLBAR");
+ }
+
+#ifndef _WIN32_WCE
+ int GetScrollPos() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return ::GetScrollPos(m_hWnd, SB_CTL);
+ }
+#endif // !_WIN32_WCE
+
+ int SetScrollPos(int nPos, BOOL bRedraw = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw);
+ }
+
+#ifndef _WIN32_WCE
+ void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos);
+ }
+#endif // !_WIN32_WCE
+
+ void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw);
+ }
+
+ BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return ::GetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo);
+ }
+
+ int SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return ::SetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo, bRedraw);
+ }
+
+#ifndef _WIN32_WCE
+ int GetScrollLimit() const
+ {
+ int nMin = 0, nMax = 0;
+ ::GetScrollRange(m_hWnd, SB_CTL, &nMin, &nMax);
+ SCROLLINFO info = { 0 };
+ info.cbSize = sizeof(SCROLLINFO);
+ info.fMask = SIF_PAGE;
+ if(::GetScrollInfo(m_hWnd, SB_CTL, &info))
+ nMax -= ((info.nPage - 1) > 0) ? (info.nPage - 1) : 0;
+
+ return nMax;
+ }
+
+#if (WINVER >= 0x0500)
+ BOOL GetScrollBarInfo(PSCROLLBARINFO pScrollBarInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+#if (_WIN32_WINNT >= 0x0501)
+ return (BOOL)::SendMessage(m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo);
+#else // !(_WIN32_WINNT >= 0x0501)
+ return ::GetScrollBarInfo(m_hWnd, OBJID_CLIENT, pScrollBarInfo);
+#endif // !(_WIN32_WINNT >= 0x0501)
+ }
+#endif // (WINVER >= 0x0500)
+
+// Operations
+ void ShowScrollBar(BOOL bShow = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::ShowScrollBar(m_hWnd, SB_CTL, bShow);
+ }
+
+ BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags);
+ }
+#endif // !_WIN32_WCE
+};
+
+typedef CScrollBarT CScrollBar;
+
+
+// --- Windows Common Controls ---
+
+///////////////////////////////////////////////////////////////////////////////
+// CImageList
+
+class CImageList
+{
+public:
+ HIMAGELIST m_hImageList;
+
+// Constructor
+ CImageList(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList)
+ { }
+
+// Operators, etc.
+ CImageList& operator =(HIMAGELIST hImageList)
+ {
+ m_hImageList = hImageList;
+ return *this;
+ }
+
+ operator HIMAGELIST() const { return m_hImageList; }
+
+ void Attach(HIMAGELIST hImageList)
+ {
+ ATLASSERT(m_hImageList == NULL);
+ ATLASSERT(hImageList != NULL);
+ m_hImageList = hImageList;
+ }
+
+ HIMAGELIST Detach()
+ {
+ HIMAGELIST hImageList = m_hImageList;
+ m_hImageList = NULL;
+ return hImageList;
+ }
+
+ bool IsNull() const { return (m_hImageList == NULL); }
+
+// Attributes
+ int GetImageCount() const
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_GetImageCount(m_hImageList);
+ }
+
+ COLORREF GetBkColor() const
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_GetBkColor(m_hImageList);
+ }
+
+ COLORREF SetBkColor(COLORREF cr)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_SetBkColor(m_hImageList, cr);
+ }
+
+ BOOL GetImageInfo(int nImage, IMAGEINFO* pImageInfo) const
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_GetImageInfo(m_hImageList, nImage, pImageInfo);
+ }
+
+ HICON GetIcon(int nIndex, UINT uFlags = ILD_NORMAL) const
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_GetIcon(m_hImageList, nIndex, uFlags);
+ }
+
+ BOOL GetIconSize(int& cx, int& cy) const
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_GetIconSize(m_hImageList, &cx, &cy);
+ }
+
+ BOOL GetIconSize(SIZE& size) const
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_GetIconSize(m_hImageList, (int*)&size.cx, (int*)&size.cy);
+ }
+
+ BOOL SetIconSize(int cx, int cy)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_SetIconSize(m_hImageList, cx, cy);
+ }
+
+ BOOL SetIconSize(SIZE size)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_SetIconSize(m_hImageList, size.cx, size.cy);
+ }
+
+ BOOL SetImageCount(UINT uNewCount)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_SetImageCount(m_hImageList, uNewCount);
+ }
+
+ BOOL SetOverlayImage(int nImage, int nOverlay)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_SetOverlayImage(m_hImageList, nImage, nOverlay);
+ }
+
+// Operations
+ BOOL Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow)
+ {
+ ATLASSERT(m_hImageList == NULL);
+ m_hImageList = ImageList_Create(cx, cy, nFlags, nInitial, nGrow);
+ return (m_hImageList != NULL) ? TRUE : FALSE;
+ }
+
+ BOOL Create(ATL::_U_STRINGorID bitmap, int cx, int nGrow, COLORREF crMask)
+ {
+ ATLASSERT(m_hImageList == NULL);
+ m_hImageList = ImageList_LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, cx, nGrow, crMask);
+ return (m_hImageList != NULL) ? TRUE : FALSE;
+ }
+
+ BOOL CreateFromImage(ATL::_U_STRINGorID image, int cx, int nGrow, COLORREF crMask, UINT uType, UINT uFlags = LR_DEFAULTCOLOR | LR_DEFAULTSIZE)
+ {
+ ATLASSERT(m_hImageList == NULL);
+ m_hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, cx, nGrow, crMask, uType, uFlags);
+ return (m_hImageList != NULL) ? TRUE : FALSE;
+ }
+
+ BOOL Merge(HIMAGELIST hImageList1, int nImage1, HIMAGELIST hImageList2, int nImage2, int dx, int dy)
+ {
+ ATLASSERT(m_hImageList == NULL);
+ m_hImageList = ImageList_Merge(hImageList1, nImage1, hImageList2, nImage2, dx, dy);
+ return (m_hImageList != NULL) ? TRUE : FALSE;
+ }
+
+#ifndef _WIN32_WCE
+#ifdef __IStream_INTERFACE_DEFINED__
+ BOOL CreateFromStream(LPSTREAM lpStream)
+ {
+ ATLASSERT(m_hImageList == NULL);
+ m_hImageList = ImageList_Read(lpStream);
+ return (m_hImageList != NULL) ? TRUE : FALSE;
+ }
+#endif // __IStream_INTERFACE_DEFINED__
+#endif // !_WIN32_WCE
+
+ BOOL Destroy()
+ {
+ if (m_hImageList == NULL)
+ return FALSE;
+ BOOL bRet = ImageList_Destroy(m_hImageList);
+ if(bRet)
+ m_hImageList = NULL;
+ return bRet;
+ }
+
+ int Add(HBITMAP hBitmap, HBITMAP hBitmapMask = NULL)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_Add(m_hImageList, hBitmap, hBitmapMask);
+ }
+
+ int Add(HBITMAP hBitmap, COLORREF crMask)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_AddMasked(m_hImageList, hBitmap, crMask);
+ }
+
+ BOOL Remove(int nImage)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_Remove(m_hImageList, nImage);
+ }
+
+ BOOL RemoveAll()
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_RemoveAll(m_hImageList);
+ }
+
+ BOOL Replace(int nImage, HBITMAP hBitmap, HBITMAP hBitmapMask)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_Replace(m_hImageList, nImage, hBitmap, hBitmapMask);
+ }
+
+ int AddIcon(HICON hIcon)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_AddIcon(m_hImageList, hIcon);
+ }
+
+ int ReplaceIcon(int nImage, HICON hIcon)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_ReplaceIcon(m_hImageList, nImage, hIcon);
+ }
+
+ HICON ExtractIcon(int nImage)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_ExtractIcon(NULL, m_hImageList, nImage);
+ }
+
+ BOOL Draw(HDC hDC, int nImage, int x, int y, UINT nStyle)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ ATLASSERT(hDC != NULL);
+ return ImageList_Draw(m_hImageList, nImage, hDC, x, y, nStyle);
+ }
+
+ BOOL Draw(HDC hDC, int nImage, POINT pt, UINT nStyle)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ ATLASSERT(hDC != NULL);
+ return ImageList_Draw(m_hImageList, nImage, hDC, pt.x, pt.y, nStyle);
+ }
+
+ BOOL DrawEx(int nImage, HDC hDC, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ ATLASSERT(hDC != NULL);
+ return ImageList_DrawEx(m_hImageList, nImage, hDC, x, y, dx, dy, rgbBk, rgbFg, fStyle);
+ }
+
+ BOOL DrawEx(int nImage, HDC hDC, RECT& rect, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ ATLASSERT(hDC != NULL);
+ return ImageList_DrawEx(m_hImageList, nImage, hDC, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, rgbBk, rgbFg, fStyle);
+ }
+
+ static BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pimldp)
+ {
+ return ImageList_DrawIndirect(pimldp);
+ }
+
+ BOOL Copy(int nSrc, int nDst, UINT uFlags = ILCF_MOVE)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_Copy(m_hImageList, nDst, m_hImageList, nSrc, uFlags);
+ }
+
+#ifdef __IStream_INTERFACE_DEFINED__
+#ifndef _WIN32_WCE
+ static HIMAGELIST Read(LPSTREAM lpStream)
+ {
+ return ImageList_Read(lpStream);
+ }
+
+ BOOL Write(LPSTREAM lpStream)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_Write(m_hImageList, lpStream);
+ }
+#endif // !_WIN32_WCE
+
+#if (_WIN32_WINNT >= 0x0501)
+ static HRESULT ReadEx(DWORD dwFlags, LPSTREAM lpStream, REFIID riid, PVOID* ppv)
+ {
+ return ImageList_ReadEx(dwFlags, lpStream, riid, ppv);
+ }
+
+ HRESULT WriteEx(DWORD dwFlags, LPSTREAM lpStream)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_WriteEx(m_hImageList, dwFlags, lpStream);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+#endif // __IStream_INTERFACE_DEFINED__
+
+ // Drag operations
+ BOOL BeginDrag(int nImage, POINT ptHotSpot)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_BeginDrag(m_hImageList, nImage, ptHotSpot.x, ptHotSpot.y);
+ }
+
+ BOOL BeginDrag(int nImage, int xHotSpot, int yHotSpot)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_BeginDrag(m_hImageList, nImage, xHotSpot, yHotSpot);
+ }
+
+ static void EndDrag()
+ {
+ ImageList_EndDrag();
+ }
+
+ static BOOL DragMove(POINT pt)
+ {
+ return ImageList_DragMove(pt.x, pt.y);
+ }
+
+ static BOOL DragMove(int x, int y)
+ {
+ return ImageList_DragMove(x, y);
+ }
+
+ BOOL SetDragCursorImage(int nDrag, POINT ptHotSpot)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_SetDragCursorImage(m_hImageList, nDrag, ptHotSpot.x, ptHotSpot.y);
+ }
+
+ BOOL SetDragCursorImage(int nDrag, int xHotSpot, int yHotSpot)
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return ImageList_SetDragCursorImage(m_hImageList, nDrag, xHotSpot, yHotSpot);
+ }
+
+ static BOOL DragShowNolock(BOOL bShow = TRUE)
+ {
+ return ImageList_DragShowNolock(bShow);
+ }
+
+ static CImageList GetDragImage(LPPOINT lpPoint, LPPOINT lpPointHotSpot)
+ {
+ return CImageList(ImageList_GetDragImage(lpPoint, lpPointHotSpot));
+ }
+
+ static BOOL DragEnter(HWND hWnd, POINT point)
+ {
+ return ImageList_DragEnter(hWnd, point.x, point.y);
+ }
+
+ static BOOL DragEnter(HWND hWnd, int x, int y)
+ {
+ return ImageList_DragEnter(hWnd, x, y);
+ }
+
+ static BOOL DragLeave(HWND hWnd)
+ {
+ return ImageList_DragLeave(hWnd);
+ }
+
+#if (_WIN32_IE >= 0x0400)
+ CImageList Duplicate() const
+ {
+ ATLASSERT(m_hImageList != NULL);
+ return CImageList(ImageList_Duplicate(m_hImageList));
+ }
+
+ static CImageList Duplicate(HIMAGELIST hImageList)
+ {
+ ATLASSERT(hImageList != NULL);
+ return CImageList(ImageList_Duplicate(hImageList));
+ }
+#endif // (_WIN32_IE >= 0x0400)
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CToolTipCtrl
+
+#ifndef _WIN32_WCE
+
+class CToolInfo : public TOOLINFO
+{
+public:
+ CToolInfo(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL)
+ {
+ Init(nFlags, hWnd, nIDTool, lpRect, lpstrText, lUserParam);
+ }
+
+ operator LPTOOLINFO() { return this; }
+
+ operator LPARAM() { return (LPARAM)this; }
+
+ void Init(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL)
+ {
+ ATLASSERT(::IsWindow(hWnd));
+ memset(this, 0, sizeof(TOOLINFO));
+ cbSize = sizeof(TOOLINFO);
+ uFlags = nFlags;
+ if(nIDTool == 0)
+ {
+ hwnd = ::GetParent(hWnd);
+ uFlags |= TTF_IDISHWND;
+ uId = (UINT_PTR)hWnd;
+ }
+ else
+ {
+ hwnd = hWnd;
+ uId = nIDTool;
+ }
+ if(lpRect != NULL)
+ rect = *lpRect;
+ hinst = ModuleHelper::GetResourceInstance();
+ lpszText = lpstrText;
+ lParam = lUserParam;
+ }
+};
+
+template
+class CToolTipCtrlT : public TBase
+{
+public:
+// Constructors
+ CToolTipCtrlT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CToolTipCtrlT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return TOOLTIPS_CLASS;
+ }
+
+ void GetText(LPTOOLINFO lpToolInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_GETTEXT, 0, (LPARAM)&lpToolInfo);
+ }
+
+ void GetText(LPTSTR lpstrText, HWND hWnd, UINT nIDTool = 0) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(hWnd != NULL);
+ CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText);
+ ::SendMessage(m_hWnd, TTM_GETTEXT, 0, ti);
+ }
+
+ BOOL GetToolInfo(LPTOOLINFO lpToolInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, (LPARAM)lpToolInfo);
+ }
+
+ BOOL GetToolInfo(HWND hWnd, UINT nIDTool, UINT* puFlags, LPRECT lpRect, LPTSTR lpstrText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(hWnd != NULL);
+ ATLASSERT(puFlags != NULL);
+ ATLASSERT(lpRect != NULL);
+ CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText);
+ BOOL bRet = (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, ti);
+ if(bRet != FALSE)
+ {
+ *puFlags = ti.uFlags;
+ *lpRect = ti.rect;
+ }
+ return bRet;
+ }
+
+ void SetToolInfo(LPTOOLINFO lpToolInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo);
+ }
+
+ void SetToolRect(LPTOOLINFO lpToolInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, (LPARAM)lpToolInfo);
+ }
+
+ void SetToolRect(HWND hWnd, UINT nIDTool, LPCRECT lpRect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(hWnd != NULL);
+ ATLASSERT(nIDTool != 0);
+
+ CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRect, NULL);
+ ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, ti);
+ }
+
+ int GetToolCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TTM_GETTOOLCOUNT, 0, 0L);
+ }
+
+ int GetDelayTime(DWORD dwType) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TTM_GETDELAYTIME, dwType, 0L);
+ }
+
+ void SetDelayTime(DWORD dwType, int nTime)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_SETDELAYTIME, dwType, MAKELPARAM(nTime, 0));
+ }
+
+ void GetMargin(LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_GETMARGIN, 0, (LPARAM)lpRect);
+ }
+
+ void SetMargin(LPRECT lpRect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_SETMARGIN, 0, (LPARAM)lpRect);
+ }
+
+ int GetMaxTipWidth() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TTM_GETMAXTIPWIDTH, 0, 0L);
+ }
+
+ int SetMaxTipWidth(int nWidth)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TTM_SETMAXTIPWIDTH, 0, nWidth);
+ }
+
+ COLORREF GetTipBkColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPBKCOLOR, 0, 0L);
+ }
+
+ void SetTipBkColor(COLORREF clr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_SETTIPBKCOLOR, (WPARAM)clr, 0L);
+ }
+
+ COLORREF GetTipTextColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPTEXTCOLOR, 0, 0L);
+ }
+
+ void SetTipTextColor(COLORREF clr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)clr, 0L);
+ }
+
+ BOOL GetCurrentTool(LPTOOLINFO lpToolInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TTM_GETCURRENTTOOL, 0, (LPARAM)lpToolInfo);
+ }
+
+#if (_WIN32_IE >= 0x0500)
+ SIZE GetBubbleSize(LPTOOLINFO lpToolInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TTM_GETBUBBLESIZE, 0, (LPARAM)lpToolInfo);
+ SIZE size = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) };
+ return size;
+ }
+
+ BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle);
+ }
+#endif // (_WIN32_IE >= 0x0500)
+
+#if (_WIN32_WINNT >= 0x0501)
+ void GetTitle(PTTGETTITLE pTTGetTitle) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_GETTITLE, 0, (LPARAM)pTTGetTitle);
+ }
+
+ void SetWindowTheme(LPCWSTR lpstrTheme)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+// Operations
+ void Activate(BOOL bActivate)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_ACTIVATE, bActivate, 0L);
+ }
+
+ BOOL AddTool(LPTOOLINFO lpToolInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, (LPARAM)lpToolInfo);
+ }
+
+ BOOL AddTool(HWND hWnd, ATL::_U_STRINGorID text = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT nIDTool = 0)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(hWnd != NULL);
+ // the toolrect and toolid must both be zero or both valid
+ ATLASSERT((lpRectTool != NULL && nIDTool != 0) || (lpRectTool == NULL && nIDTool == 0));
+
+ CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRectTool, (LPTSTR)text.m_lpstr);
+ return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, ti);
+ }
+
+ void DelTool(LPTOOLINFO lpToolInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_DELTOOL, 0, (LPARAM)lpToolInfo);
+ }
+
+ void DelTool(HWND hWnd, UINT nIDTool = 0)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(hWnd != NULL);
+
+ CToolInfo ti(0, hWnd, nIDTool, NULL, NULL);
+ ::SendMessage(m_hWnd, TTM_DELTOOL, 0, ti);
+ }
+
+ BOOL HitTest(LPTTHITTESTINFO lpHitTestInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)lpHitTestInfo);
+ }
+
+ BOOL HitTest(HWND hWnd, POINT pt, LPTOOLINFO lpToolInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(hWnd != NULL);
+ ATLASSERT(lpToolInfo != NULL);
+
+ TTHITTESTINFO hti = { 0 };
+ hti.ti.cbSize = sizeof(TOOLINFO);
+ hti.hwnd = hWnd;
+ hti.pt.x = pt.x;
+ hti.pt.y = pt.y;
+ if((BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)&hti) != FALSE)
+ {
+ *lpToolInfo = hti.ti;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ void RelayEvent(LPMSG lpMsg)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_RELAYEVENT, 0, (LPARAM)lpMsg);
+ }
+
+ void UpdateTipText(LPTOOLINFO lpToolInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)lpToolInfo);
+ }
+
+ void UpdateTipText(ATL::_U_STRINGorID text, HWND hWnd, UINT nIDTool = 0)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(hWnd != NULL);
+
+ CToolInfo ti(0, hWnd, nIDTool, NULL, (LPTSTR)text.m_lpstr);
+ ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, ti);
+ }
+
+ BOOL EnumTools(UINT nTool, LPTOOLINFO lpToolInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TTM_ENUMTOOLS, nTool, (LPARAM)lpToolInfo);
+ }
+
+ void Pop()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_POP, 0, 0L);
+ }
+
+ void TrackActivate(LPTOOLINFO lpToolInfo, BOOL bActivate)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_TRACKACTIVATE, bActivate, (LPARAM)lpToolInfo);
+ }
+
+ void TrackPosition(int xPos, int yPos)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(xPos, yPos));
+ }
+
+#if (_WIN32_IE >= 0x0400)
+ void Update()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_UPDATE, 0, 0L);
+ }
+#endif // (_WIN32_IE >= 0x0400)
+
+#if (_WIN32_IE >= 0x0500)
+ BOOL AdjustRect(LPRECT lpRect, BOOL bLarger /*= TRUE*/)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TTM_ADJUSTRECT, bLarger, (LPARAM)lpRect);
+ }
+#endif // (_WIN32_IE >= 0x0500)
+
+#if (_WIN32_WINNT >= 0x0501)
+ void Popup()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TTM_POPUP, 0, 0L);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+};
+
+typedef CToolTipCtrlT CToolTipCtrl;
+
+#endif // !_WIN32_WCE
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CHeaderCtrl
+
+template
+class CHeaderCtrlT : public TBase
+{
+public:
+// Constructors
+ CHeaderCtrlT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CHeaderCtrlT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return WC_HEADER;
+ }
+
+ int GetItemCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_GETITEMCOUNT, 0, 0L);
+ }
+
+ BOOL GetItem(int nIndex, LPHDITEM pHeaderItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_GETITEM, nIndex, (LPARAM)pHeaderItem);
+ }
+
+ BOOL SetItem(int nIndex, LPHDITEM pHeaderItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_SETITEM, nIndex, (LPARAM)pHeaderItem);
+ }
+
+ CImageList GetImageList() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_GETIMAGELIST, 0, 0L));
+ }
+
+ CImageList SetImageList(HIMAGELIST hImageList)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_SETIMAGELIST, 0, (LPARAM)hImageList));
+ }
+
+ BOOL GetOrderArray(int nSize, int* lpnArray) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_GETORDERARRAY, nSize, (LPARAM)lpnArray);
+ }
+
+ BOOL SetOrderArray(int nSize, int* lpnArray)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_SETORDERARRAY, nSize, (LPARAM)lpnArray);
+ }
+
+ BOOL GetItemRect(int nIndex, LPRECT lpItemRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMRECT, nIndex, (LPARAM)lpItemRect);
+ }
+
+ int SetHotDivider(BOOL bPos, DWORD dwInputValue)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_SETHOTDIVIDER, bPos, dwInputValue);
+ }
+
+#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+ BOOL GetUnicodeFormat() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_GETUNICODEFORMAT, 0, 0L);
+ }
+
+ BOOL SetUnicodeFormat(BOOL bUnicode = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_SETUNICODEFORMAT, bUnicode, 0L);
+ }
+#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+
+#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+ int GetBitmapMargin() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_GETBITMAPMARGIN, 0, 0L);
+ }
+
+ int SetBitmapMargin(int nWidth)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_SETBITMAPMARGIN, nWidth, 0L);
+ }
+
+ int SetFilterChangeTimeout(DWORD dwTimeOut)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_SETFILTERCHANGETIMEOUT, 0, dwTimeOut);
+ }
+#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+
+#if (_WIN32_WINNT >= 0x0600)
+ BOOL GetItemDropDownRect(int nIndex, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect);
+ }
+
+ BOOL GetOverflowRect(LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_GETOVERFLOWRECT, 0, (LPARAM)lpRect);
+ }
+
+ int GetFocusedItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_GETFOCUSEDITEM, 0, 0L);
+ }
+
+ BOOL SetFocusedItem(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_SETFOCUSEDITEM, 0, nIndex);
+ }
+#endif // (_WIN32_WINNT >= 0x0600)
+
+// Operations
+ int InsertItem(int nIndex, LPHDITEM phdi)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_INSERTITEM, nIndex, (LPARAM)phdi);
+ }
+
+ int AddItem(LPHDITEM phdi)
+ {
+ return InsertItem(GetItemCount(), phdi);
+ }
+
+ BOOL DeleteItem(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_DELETEITEM, nIndex, 0L);
+ }
+
+ BOOL Layout(HD_LAYOUT* pHeaderLayout)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, HDM_LAYOUT, 0, (LPARAM)pHeaderLayout);
+ }
+
+ int HitTest(LPHDHITTESTINFO lpHitTestInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_HITTEST, 0, (LPARAM)lpHitTestInfo);
+ }
+
+ int OrderToIndex(int nOrder)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_ORDERTOINDEX, nOrder, 0L);
+ }
+
+ CImageList CreateDragImage(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_CREATEDRAGIMAGE, nIndex, 0L));
+ }
+
+#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+ int EditFilter(int nColumn, BOOL bDiscardChanges)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_EDITFILTER, nColumn, MAKELPARAM(bDiscardChanges, 0));
+ }
+
+ int ClearFilter(int nColumn)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, nColumn, 0L);
+ }
+
+ int ClearAllFilters()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, (WPARAM)-1, 0L);
+ }
+#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+};
+
+typedef CHeaderCtrlT CHeaderCtrl;
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CListViewCtrl
+
+template
+class CListViewCtrlT : public TBase
+{
+public:
+// Constructors
+ CListViewCtrlT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CListViewCtrlT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return WC_LISTVIEW;
+ }
+
+ COLORREF GetBkColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, LVM_GETBKCOLOR, 0, 0L);
+ }
+
+ BOOL SetBkColor(COLORREF cr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETBKCOLOR, 0, cr);
+ }
+
+ CImageList GetImageList(int nImageListType) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_GETIMAGELIST, nImageListType, 0L));
+ }
+
+ CImageList SetImageList(HIMAGELIST hImageList, int nImageList)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)hImageList));
+ }
+
+ int GetItemCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETITEMCOUNT, 0, 0L);
+ }
+
+ BOOL SetItemCount(int nItems)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, 0L);
+ }
+
+ BOOL GetItem(LPLVITEM pItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem);
+ }
+
+ BOOL SetItem(const LVITEM* pItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem);
+ }
+
+ BOOL SetItem(int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem,
+ int nImage, UINT nState, UINT nStateMask, LPARAM lParam)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM lvi = { 0 };
+ lvi.mask = nMask;
+ lvi.iItem = nItem;
+ lvi.iSubItem = nSubItem;
+ lvi.stateMask = nStateMask;
+ lvi.state = nState;
+ lvi.pszText = (LPTSTR) lpszItem;
+ lvi.iImage = nImage;
+ lvi.lParam = lParam;
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)&lvi);
+ }
+
+ UINT GetItemState(int nItem, UINT nMask) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, LVM_GETITEMSTATE, nItem, nMask);
+ }
+
+ BOOL SetItemState(int nItem, UINT nState, UINT nStateMask)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM lvi = { 0 };
+ lvi.state = nState;
+ lvi.stateMask = nStateMask;
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi);
+ }
+
+ BOOL SetItemState(int nItem, LPLVITEM pItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)pItem);
+ }
+
+#ifndef _ATL_NO_COM
+ BOOL GetItemText(int nItem, int nSubItem, BSTR& bstrText) const
+ {
+ USES_CONVERSION;
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(bstrText == NULL);
+ LVITEM lvi = { 0 };
+ lvi.iSubItem = nSubItem;
+
+ LPTSTR lpstrText = NULL;
+ int nRes = 0;
+ for(int nLen = 256; ; nLen *= 2)
+ {
+ ATLTRY(lpstrText = new TCHAR[nLen]);
+ if(lpstrText == NULL)
+ break;
+ lpstrText[0] = NULL;
+ lvi.cchTextMax = nLen;
+ lvi.pszText = lpstrText;
+ nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi);
+ if(nRes < nLen - 1)
+ break;
+ delete [] lpstrText;
+ lpstrText = NULL;
+ }
+
+ if(lpstrText != NULL)
+ {
+ if(nRes != 0)
+ bstrText = ::SysAllocString(T2OLE(lpstrText));
+ delete [] lpstrText;
+ }
+
+ return (bstrText != NULL) ? TRUE : FALSE;
+ }
+#endif // !_ATL_NO_COM
+
+#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+ int GetItemText(int nItem, int nSubItem, _CSTRING_NS::CString& strText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM lvi = { 0 };
+ lvi.iSubItem = nSubItem;
+
+ strText.Empty();
+ int nRes = 0;
+ for(int nLen = 256; ; nLen *= 2)
+ {
+ lvi.cchTextMax = nLen;
+ lvi.pszText = strText.GetBufferSetLength(nLen);
+ if(lvi.pszText == NULL)
+ {
+ nRes = 0;
+ break;
+ }
+ nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi);
+ if(nRes < nLen - 1)
+ break;
+ }
+ strText.ReleaseBuffer();
+ return nRes;
+ }
+#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+
+ int GetItemText(int nItem, int nSubItem, LPTSTR lpszText, int nLen) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM lvi = { 0 };
+ lvi.iSubItem = nSubItem;
+ lvi.cchTextMax = nLen;
+ lvi.pszText = lpszText;
+ return (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi);
+ }
+
+ BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItem(nItem, nSubItem, LVIF_TEXT, lpszText, 0, 0, 0, 0);
+ }
+
+ DWORD_PTR GetItemData(int nItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM lvi = { 0 };
+ lvi.iItem = nItem;
+ lvi.mask = LVIF_PARAM;
+ BOOL bRet = (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)&lvi);
+ return (DWORD_PTR)(bRet ? lvi.lParam : NULL);
+ }
+
+ BOOL SetItemData(int nItem, DWORD_PTR dwData)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItem(nItem, 0, LVIF_PARAM, NULL, 0, 0, 0, (LPARAM)dwData);
+ }
+
+ UINT GetCallbackMask() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, LVM_GETCALLBACKMASK, 0, 0L);
+ }
+
+ BOOL SetCallbackMask(UINT nMask)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETCALLBACKMASK, nMask, 0L);
+ }
+
+ BOOL GetItemPosition(int nItem, LPPOINT lpPoint) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMPOSITION, nItem, (LPARAM)lpPoint);
+ }
+
+ BOOL SetItemPosition(int nItem, POINT pt)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt);
+ }
+
+ BOOL SetItemPosition(int nItem, int x, int y)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON));
+ POINT pt = { x, y };
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt);
+ }
+
+ int GetStringWidth(LPCTSTR lpsz) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz);
+ }
+
+ CEdit GetEditControl() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CEdit((HWND)::SendMessage(m_hWnd, LVM_GETEDITCONTROL, 0, 0L));
+ }
+
+ BOOL GetColumn(int nCol, LVCOLUMN* pColumn) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMN, nCol, (LPARAM)pColumn);
+ }
+
+ BOOL SetColumn(int nCol, const LVCOLUMN* pColumn)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMN, nCol, (LPARAM)pColumn);
+ }
+
+ int GetColumnWidth(int nCol) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0L);
+ }
+
+ BOOL SetColumnWidth(int nCol, int cx)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0));
+ }
+
+ BOOL GetViewRect(LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETVIEWRECT, 0, (LPARAM)lpRect);
+ }
+
+ COLORREF GetTextColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTCOLOR, 0, 0L);
+ }
+
+ BOOL SetTextColor(COLORREF cr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTCOLOR, 0, cr);
+ }
+
+ COLORREF GetTextBkColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTBKCOLOR, 0, 0L);
+ }
+
+ BOOL SetTextBkColor(COLORREF cr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTBKCOLOR, 0, cr);
+ }
+
+ int GetTopIndex() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETTOPINDEX, 0, 0L);
+ }
+
+ int GetCountPerPage() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0L);
+ }
+
+ BOOL GetOrigin(LPPOINT lpPoint) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETORIGIN, 0, (LPARAM)lpPoint);
+ }
+
+ UINT GetSelectedCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, LVM_GETSELECTEDCOUNT, 0, 0L);
+ }
+
+ BOOL GetItemRect(int nItem, LPRECT lpRect, UINT nCode) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ lpRect->left = nCode;
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect);
+ }
+
+#ifndef _WIN32_WCE
+ HCURSOR GetHotCursor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HCURSOR)::SendMessage(m_hWnd, LVM_GETHOTCURSOR, 0, 0L);
+ }
+
+ HCURSOR SetHotCursor(HCURSOR hHotCursor)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HCURSOR)::SendMessage(m_hWnd, LVM_SETHOTCURSOR, 0, (LPARAM)hHotCursor);
+ }
+
+ int GetHotItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETHOTITEM, 0, 0L);
+ }
+
+ int SetHotItem(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_SETHOTITEM, nIndex, 0L);
+ }
+#endif // !_WIN32_WCE
+
+ BOOL GetColumnOrderArray(int nCount, int* lpnArray) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray);
+ }
+
+ BOOL SetColumnOrderArray(int nCount, int* lpnArray)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray);
+ }
+
+ CHeaderCtrl GetHeader() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CHeaderCtrl((HWND)::SendMessage(m_hWnd, LVM_GETHEADER, 0, 0L));
+ }
+
+ BOOL GetSubItemRect(int nItem, int nSubItem, int nFlag, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_REPORT);
+ ATLASSERT(lpRect != NULL);
+ lpRect->top = nSubItem;
+ lpRect->left = nFlag;
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETSUBITEMRECT, nItem, (LPARAM)lpRect);
+ }
+
+ DWORD SetIconSpacing(int cx, int cy)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_ICON);
+ return (DWORD)::SendMessage(m_hWnd, LVM_SETICONSPACING, 0, MAKELPARAM(cx, cy));
+ }
+
+ int GetISearchString(LPTSTR lpstr) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETISEARCHSTRING, 0, (LPARAM)lpstr);
+ }
+
+ void GetItemSpacing(SIZE& sizeSpacing, BOOL bSmallIconView = FALSE) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ DWORD dwRet = (DWORD)::SendMessage(m_hWnd, LVM_GETITEMSPACING, bSmallIconView, 0L);
+ sizeSpacing.cx = GET_X_LPARAM(dwRet);
+ sizeSpacing.cy = GET_Y_LPARAM(dwRet);
+ }
+
+#if (_WIN32_WCE >= 410)
+ void SetItemSpacing(INT cySpacing)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ListView_SetItemSpacing(m_hWnd, cySpacing);
+ }
+#endif // (_WIN32_WCE >= 410)
+
+ // single-selection only
+ int GetSelectedIndex() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0);
+ return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0));
+ }
+
+ BOOL GetSelectedItem(LPLVITEM pItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0);
+ ATLASSERT(pItem != NULL);
+ pItem->iItem = (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0));
+ if(pItem->iItem == -1)
+ return FALSE;
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem);
+ }
+
+ // extended list view styles
+ DWORD GetExtendedListViewStyle() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L);
+ }
+
+ // dwExMask = 0 means all styles
+ DWORD SetExtendedListViewStyle(DWORD dwExStyle, DWORD dwExMask = 0)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, dwExMask, dwExStyle);
+ }
+
+ // checkboxes only
+ BOOL GetCheckState(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetExtendedListViewStyle() & LVS_EX_CHECKBOXES) != 0);
+ UINT uRet = GetItemState(nIndex, LVIS_STATEIMAGEMASK);
+ return (uRet >> 12) - 1;
+ }
+
+ BOOL SetCheckState(int nItem, BOOL bCheck)
+ {
+ int nCheck = bCheck ? 2 : 1; // one based index
+ return SetItemState(nItem, INDEXTOSTATEIMAGEMASK(nCheck), LVIS_STATEIMAGEMASK);
+ }
+
+ // view type
+ DWORD GetViewType() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (GetStyle() & LVS_TYPEMASK);
+ }
+
+ DWORD SetViewType(DWORD dwType)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(dwType == LVS_ICON || dwType == LVS_SMALLICON || dwType == LVS_LIST || dwType == LVS_REPORT);
+ DWORD dwOldType = GetViewType();
+ if(dwType != dwOldType)
+ ModifyStyle(LVS_TYPEMASK, (dwType & LVS_TYPEMASK));
+ return dwOldType;
+ }
+
+#if (_WIN32_IE >= 0x0400)
+#ifndef _WIN32_WCE
+ BOOL GetBkImage(LPLVBKIMAGE plvbki) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETBKIMAGE, 0, (LPARAM)plvbki);
+ }
+
+ BOOL SetBkImage(LPLVBKIMAGE plvbki)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETBKIMAGE, 0, (LPARAM)plvbki);
+ }
+#endif // !_WIN32_WCE
+
+ int GetSelectionMark() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETSELECTIONMARK, 0, 0L);
+ }
+
+ int SetSelectionMark(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_SETSELECTIONMARK, 0, nIndex);
+ }
+
+#ifndef _WIN32_WCE
+ BOOL GetWorkAreas(int nWorkAreas, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETWORKAREAS, nWorkAreas, (LPARAM)lpRect);
+ }
+
+ BOOL SetWorkAreas(int nWorkAreas, LPRECT lpRect)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETWORKAREAS, nWorkAreas, (LPARAM)lpRect);
+ }
+
+ DWORD GetHoverTime() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0);
+ return (DWORD)::SendMessage(m_hWnd, LVM_GETHOVERTIME, 0, 0L);
+ }
+
+ DWORD SetHoverTime(DWORD dwHoverTime)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0);
+ return (DWORD)::SendMessage(m_hWnd, LVM_SETHOVERTIME, 0, dwHoverTime);
+ }
+
+ BOOL GetNumberOfWorkAreas(int* pnWorkAreas) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)pnWorkAreas);
+ }
+#endif // !_WIN32_WCE
+
+ BOOL SetItemCountEx(int nItems, DWORD dwFlags)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(((GetStyle() & LVS_OWNERDATA) != 0) && (((GetStyle() & LVS_TYPEMASK) == LVS_REPORT) || ((GetStyle() & LVS_TYPEMASK) == LVS_LIST)));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, dwFlags);
+ }
+
+#ifndef _WIN32_WCE
+ CToolTipCtrl GetToolTips() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_GETTOOLTIPS, 0, 0L));
+ }
+
+ CToolTipCtrl SetToolTips(HWND hWndTT)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L));
+ }
+
+ BOOL GetUnicodeFormat() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETUNICODEFORMAT, 0, 0L);
+ }
+
+ BOOL SetUnicodeFormat(BOOL bUnicode = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETUNICODEFORMAT, bUnicode, 0L);
+ }
+#endif // !_WIN32_WCE
+#endif // (_WIN32_IE >= 0x0400)
+
+#if (_WIN32_WINNT >= 0x0501)
+ int GetSelectedColumn() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETSELECTEDCOLUMN, 0, 0L);
+ }
+
+ void SetSelectedColumn(int nColumn)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_SETSELECTEDCOLUMN, nColumn, 0L);
+ }
+
+ DWORD GetView() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, LVM_GETVIEW, 0, 0L);
+ }
+
+ int SetView(DWORD dwView)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_SETVIEW, dwView, 0L);
+ }
+
+ BOOL IsGroupViewEnabled() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_ISGROUPVIEWENABLED, 0, 0L);
+ }
+
+ int GetGroupInfo(int nGroupID, PLVGROUP pGroup) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETGROUPINFO, nGroupID, (LPARAM)pGroup);
+ }
+
+ int SetGroupInfo(int nGroupID, PLVGROUP pGroup)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_SETGROUPINFO, nGroupID, (LPARAM)pGroup);
+ }
+
+ void GetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics);
+ }
+
+ void SetGroupMetrics(PLVGROUPMETRICS pGroupMetrics)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics);
+ }
+
+ void GetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_GETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo);
+ }
+
+ BOOL SetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo);
+ }
+
+ void GetTileInfo(PLVTILEINFO pTileInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_GETTILEINFO, 0, (LPARAM)pTileInfo);
+ }
+
+ BOOL SetTileInfo(PLVTILEINFO pTileInfo)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEINFO, 0, (LPARAM)pTileInfo);
+ }
+
+ BOOL GetInsertMark(LPLVINSERTMARK pInsertMark) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETINSERTMARK, 0, (LPARAM)pInsertMark);
+ }
+
+ BOOL SetInsertMark(LPLVINSERTMARK pInsertMark)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETINSERTMARK, 0, (LPARAM)pInsertMark);
+ }
+
+ int GetInsertMarkRect(LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETINSERTMARKRECT, 0, (LPARAM)lpRect);
+ }
+
+ COLORREF GetInsertMarkColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, LVM_GETINSERTMARKCOLOR, 0, 0L);
+ }
+
+ COLORREF SetInsertMarkColor(COLORREF clr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, LVM_SETINSERTMARKCOLOR, 0, clr);
+ }
+
+ COLORREF GetOutlineColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, LVM_GETOUTLINECOLOR, 0, 0L);
+ }
+
+ COLORREF SetOutlineColor(COLORREF clr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, LVM_SETOUTLINECOLOR, 0, clr);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+#if (_WIN32_WINNT >= 0x0600)
+ int GetGroupCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETGROUPCOUNT, 0, 0L);
+ }
+
+ BOOL GetGroupInfoByIndex(int nIndex, PLVGROUP pGroup) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPINFOBYINDEX, nIndex, (LPARAM)pGroup);
+ }
+
+ BOOL GetGroupRect(int nGroupID, int nType, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(lpRect != NULL);
+ if(lpRect != NULL)
+ lpRect->top = nType;
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPRECT, nGroupID, (LPARAM)lpRect);
+ }
+
+ UINT GetGroupState(int nGroupID, UINT uMask) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, LVM_GETGROUPSTATE, nGroupID, (LPARAM)uMask);
+ }
+
+ int GetFocusedGroup() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETFOCUSEDGROUP, 0, 0L);
+ }
+
+ BOOL GetEmptyText(LPWSTR lpstrText, int cchText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETEMPTYTEXT, cchText, (LPARAM)lpstrText);
+ }
+
+ BOOL GetFooterRect(LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERRECT, 0, (LPARAM)lpRect);
+ }
+
+ BOOL GetFooterInfo(LPLVFOOTERINFO lpFooterInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERINFO, 0, (LPARAM)lpFooterInfo);
+ }
+
+ BOOL GetFooterItemRect(int nItem, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEMRECT, nItem, (LPARAM)lpRect);
+ }
+
+ BOOL GetFooterItem(int nItem, LPLVFOOTERITEM lpFooterItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEM, nItem, (LPARAM)lpFooterItem);
+ }
+
+ BOOL GetItemIndexRect(PLVITEMINDEX pItemIndex, int nSubItem, int nType, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(pItemIndex != NULL);
+ ATLASSERT(lpRect != NULL);
+ if(lpRect != NULL)
+ {
+ lpRect->top = nSubItem;
+ lpRect->left = nType;
+ }
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMINDEXRECT, (WPARAM)pItemIndex, (LPARAM)lpRect);
+ }
+
+ BOOL SetItemIndexState(PLVITEMINDEX pItemIndex, UINT uState, UINT dwMask)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM lvi = { 0 };
+ lvi.state = uState;
+ lvi.stateMask = dwMask;
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMINDEXSTATE, (WPARAM)pItemIndex, (LPARAM)&lvi);
+ }
+
+ BOOL GetNextItemIndex(PLVITEMINDEX pItemIndex, WORD wFlags) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_GETNEXTITEMINDEX, (WPARAM)pItemIndex, MAKELPARAM(wFlags, 0));
+ }
+#endif // (_WIN32_WINNT >= 0x0600)
+
+// Operations
+ int InsertColumn(int nCol, const LVCOLUMN* pColumn)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn);
+ }
+
+ int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT,
+ int nWidth = -1, int nSubItem = -1, int iImage = -1, int iOrder = -1)
+ {
+ LVCOLUMN column = { 0 };
+ column.mask = LVCF_TEXT|LVCF_FMT;
+ column.pszText = (LPTSTR)lpszColumnHeading;
+ column.fmt = nFormat;
+ if (nWidth != -1)
+ {
+ column.mask |= LVCF_WIDTH;
+ column.cx = nWidth;
+ }
+ if (nSubItem != -1)
+ {
+ column.mask |= LVCF_SUBITEM;
+ column.iSubItem = nSubItem;
+ }
+ if (iImage != -1)
+ {
+ column.mask |= LVCF_IMAGE;
+ column.iImage = iImage;
+ }
+ if (iOrder != -1)
+ {
+ column.mask |= LVCF_ORDER;
+ column.iOrder = iOrder;
+ }
+ return InsertColumn(nCol, &column);
+ }
+
+ BOOL DeleteColumn(int nCol)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_DELETECOLUMN, nCol, 0L);
+ }
+
+ int InsertItem(UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM item = { 0 };
+ item.mask = nMask;
+ item.iItem = nItem;
+ item.iSubItem = 0;
+ item.pszText = (LPTSTR)lpszItem;
+ item.state = nState;
+ item.stateMask = nStateMask;
+ item.iImage = nImage;
+ item.lParam = lParam;
+ return InsertItem(&item);
+ }
+
+ int InsertItem(const LVITEM* pItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_INSERTITEM, 0, (LPARAM)pItem);
+ }
+
+ int InsertItem(int nItem, LPCTSTR lpszItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return InsertItem(LVIF_TEXT, nItem, lpszItem, 0, 0, 0, 0);
+ }
+
+ int InsertItem(int nItem, LPCTSTR lpszItem, int nImage)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return InsertItem(LVIF_TEXT|LVIF_IMAGE, nItem, lpszItem, 0, 0, nImage, 0);
+ }
+
+ int GetNextItem(int nItem, int nFlags) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, nItem, MAKELPARAM(nFlags, 0));
+ }
+
+ BOOL DeleteItem(int nItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_DELETEITEM, nItem, 0L);
+ }
+
+ BOOL DeleteAllItems()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_DELETEALLITEMS, 0, 0L);
+ }
+
+ int FindItem(LVFINDINFO* pFindInfo, int nStart) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo);
+ }
+
+ int HitTest(LVHITTESTINFO* pHitTestInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)pHitTestInfo);
+ }
+
+ int HitTest(POINT pt, UINT* pFlags) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVHITTESTINFO hti = { 0 };
+ hti.pt = pt;
+ int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)&hti);
+ if (pFlags != NULL)
+ *pFlags = hti.flags;
+ return nRes;
+ }
+
+ BOOL EnsureVisible(int nItem, BOOL bPartialOK)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0));
+ }
+
+ BOOL Scroll(SIZE size)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SCROLL, size.cx, size.cy);
+ }
+
+ BOOL RedrawItems(int nFirst, int nLast)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_REDRAWITEMS, nFirst, nLast);
+ }
+
+ BOOL Arrange(UINT nCode)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_ARRANGE, nCode, 0L);
+ }
+
+ CEdit EditLabel(int nItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CEdit((HWND)::SendMessage(m_hWnd, LVM_EDITLABEL, nItem, 0L));
+ }
+
+ BOOL Update(int nItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_UPDATE, nItem, 0L);
+ }
+
+ BOOL SortItems(PFNLVCOMPARE pfnCompare, LPARAM lParamSort)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMS, (WPARAM)lParamSort, (LPARAM)pfnCompare);
+ }
+
+ CImageList RemoveImageList(int nImageList)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, (WPARAM)nImageList, NULL));
+ }
+
+ CImageList CreateDragImage(int nItem, LPPOINT lpPoint)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_CREATEDRAGIMAGE, nItem, (LPARAM)lpPoint));
+ }
+
+ DWORD ApproximateViewRect(int cx = -1, int cy = -1, int nCount = -1)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, LVM_APPROXIMATEVIEWRECT, nCount, MAKELPARAM(cx, cy));
+ }
+
+ int SubItemHitTest(LPLVHITTESTINFO lpInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)lpInfo);
+ }
+
+ int AddColumn(LPCTSTR strItem, int nItem, int nSubItem = -1,
+ int nMask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
+ int nFmt = LVCFMT_LEFT)
+ {
+ const int cxOffset = 15;
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVCOLUMN lvc = { 0 };
+ lvc.mask = nMask;
+ lvc.fmt = nFmt;
+ lvc.pszText = (LPTSTR)strItem;
+ lvc.cx = GetStringWidth(lvc.pszText) + cxOffset;
+ if(nMask & LVCF_SUBITEM)
+ lvc.iSubItem = (nSubItem != -1) ? nSubItem : nItem;
+ return InsertColumn(nItem, &lvc);
+ }
+
+ int AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -1)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVITEM lvItem = { 0 };
+ lvItem.mask = LVIF_TEXT;
+ lvItem.iItem = nItem;
+ lvItem.iSubItem = nSubItem;
+ lvItem.pszText = (LPTSTR)strItem;
+ if(nImageIndex != -1)
+ {
+ lvItem.mask |= LVIF_IMAGE;
+ lvItem.iImage = nImageIndex;
+ }
+ if(nSubItem == 0)
+ return InsertItem(&lvItem);
+ return SetItem(&lvItem) ? nItem : -1;
+ }
+
+#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+ BOOL SortItemsEx(PFNLVCOMPARE pfnCompare, LPARAM lParamSort)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMSEX, (WPARAM)lParamSort, (LPARAM)pfnCompare);
+ }
+#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+
+#if (_WIN32_WINNT >= 0x0501)
+ int InsertGroup(int nItem, PLVGROUP pGroup)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_INSERTGROUP, nItem, (LPARAM)pGroup);
+ }
+
+ int AddGroup(PLVGROUP pGroup)
+ {
+ return InsertGroup(-1, pGroup);
+ }
+
+ int RemoveGroup(int nGroupID)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_REMOVEGROUP, nGroupID, 0L);
+ }
+
+ void MoveGroup(int nGroupID, int nItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_MOVEGROUP, nGroupID, nItem);
+ }
+
+ void MoveItemToGroup(int nItem, int nGroupID)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_MOVEITEMTOGROUP, nItem, nGroupID);
+ }
+
+ int EnableGroupView(BOOL bEnable)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_ENABLEGROUPVIEW, bEnable, 0L);
+ }
+
+ int SortGroups(PFNLVGROUPCOMPARE pCompareFunc, LPVOID lpVoid = NULL)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_SORTGROUPS, (WPARAM)pCompareFunc, (LPARAM)lpVoid);
+ }
+
+ void InsertGroupSorted(PLVINSERTGROUPSORTED pInsertGroupSorted)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_INSERTGROUPSORTED, (WPARAM)pInsertGroupSorted, 0L);
+ }
+
+ void RemoveAllGroups()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_REMOVEALLGROUPS, 0, 0L);
+ }
+
+ BOOL HasGroup(int nGroupID)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_HASGROUP, nGroupID, 0L);
+ }
+
+ BOOL InsertMarkHitTest(LPPOINT lpPoint, LPLVINSERTMARK pInsertMark) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)pInsertMark);
+ }
+
+ BOOL SetInfoTip(PLVSETINFOTIP pSetInfoTip)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, LVM_SETINFOTIP, 0, (LPARAM)pSetInfoTip);
+ }
+
+ void CancelEditLabel()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, LVM_CANCELEDITLABEL, 0, 0L);
+ }
+
+ UINT MapIndexToID(int nIndex) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, LVM_MAPINDEXTOID, nIndex, 0L);
+ }
+
+ int MapIDToIndex(UINT uID) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_MAPIDTOINDEX, uID, 0L);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+#if (_WIN32_WINNT >= 0x0600)
+ int HitTestEx(LPLVHITTESTINFO lpHitTestInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo);
+ }
+
+ int HitTestEx(POINT pt, UINT* pFlags) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ LVHITTESTINFO hti = { 0 };
+ hti.pt = pt;
+ int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)&hti);
+ if (pFlags != NULL)
+ *pFlags = hti.flags;
+ return nRes;
+ }
+
+ int SubItemHitTestEx(LPLVHITTESTINFO lpHitTestInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo);
+ }
+#endif // (_WIN32_WINNT >= 0x0600)
+
+ // single-selection only
+ BOOL SelectItem(int nIndex)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0);
+
+ BOOL bRet = SetItemState(nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
+ if(bRet)
+ bRet = EnsureVisible(nIndex, FALSE);
+ return bRet;
+ }
+};
+
+typedef CListViewCtrlT CListViewCtrl;
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CTreeViewCtrl
+
+template
+class CTreeViewCtrlT : public TBase
+{
+public:
+// Constructors
+ CTreeViewCtrlT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+
+ CTreeViewCtrlT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+ HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
+ DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
+ {
+ return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
+ }
+
+// Attributes
+ static LPCTSTR GetWndClassName()
+ {
+ return WC_TREEVIEW;
+ }
+
+ UINT GetCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, TVM_GETCOUNT, 0, 0L);
+ }
+
+ UINT GetIndent() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, TVM_GETINDENT, 0, 0L);
+ }
+
+ void SetIndent(UINT nIndent)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TVM_SETINDENT, nIndent, 0L);
+ }
+
+ CImageList GetImageList(int nImageListType = TVSIL_NORMAL) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_GETIMAGELIST, (WPARAM)nImageListType, 0L));
+ }
+
+ CImageList SetImageList(HIMAGELIST hImageList, int nImageListType = TVSIL_NORMAL)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageListType, (LPARAM)hImageList));
+ }
+
+ BOOL GetItem(LPTVITEM pItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem);
+ }
+
+ BOOL SetItem(LPTVITEM pItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem);
+ }
+
+ BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage,
+ int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = nMask;
+ item.pszText = (LPTSTR) lpszItem;
+ item.iImage = nImage;
+ item.iSelectedImage = nSelectedImage;
+ item.state = nState;
+ item.stateMask = nStateMask;
+ item.lParam = lParam;
+ return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&item);
+ }
+
+ BOOL GetItemText(HTREEITEM hItem, LPTSTR lpstrText, int nLen) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(lpstrText != NULL);
+
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = TVIF_TEXT;
+ item.pszText = lpstrText;
+ item.cchTextMax = nLen;
+
+ return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item);
+ }
+
+#ifndef _ATL_NO_COM
+ BOOL GetItemText(HTREEITEM hItem, BSTR& bstrText) const
+ {
+ USES_CONVERSION;
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT(bstrText == NULL);
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = TVIF_TEXT;
+
+ LPTSTR lpstrText = NULL;
+ BOOL bRet = FALSE;
+ for(int nLen = 256; ; nLen *= 2)
+ {
+ ATLTRY(lpstrText = new TCHAR[nLen]);
+ if(lpstrText == NULL)
+ break;
+ lpstrText[0] = NULL;
+ item.pszText = lpstrText;
+ item.cchTextMax = nLen;
+ bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item);
+ if(!bRet || (lstrlen(item.pszText) < nLen - 1))
+ break;
+ delete [] lpstrText;
+ lpstrText = NULL;
+ }
+
+ if(lpstrText != NULL)
+ {
+ if(bRet)
+ bstrText = ::SysAllocString(T2OLE(lpstrText));
+ delete [] lpstrText;
+ }
+
+ return (bstrText != NULL) ? TRUE : FALSE;
+ }
+#endif // !_ATL_NO_COM
+
+#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+ BOOL GetItemText(HTREEITEM hItem, _CSTRING_NS::CString& strText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = TVIF_TEXT;
+
+ strText.Empty();
+ BOOL bRet = FALSE;
+ for(int nLen = 256; ; nLen *= 2)
+ {
+ item.pszText = strText.GetBufferSetLength(nLen);
+ if(item.pszText == NULL)
+ {
+ bRet = FALSE;
+ break;
+ }
+ item.cchTextMax = nLen;
+ bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item);
+ if(!bRet || (lstrlen(item.pszText) < nLen - 1))
+ break;
+ }
+ strText.ReleaseBuffer();
+ return bRet;
+ }
+#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+
+ BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItem(hItem, TVIF_TEXT, lpszItem, 0, 0, 0, 0, NULL);
+ }
+
+ BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ BOOL bRes = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item);
+ if (bRes)
+ {
+ nImage = item.iImage;
+ nSelectedImage = item.iSelectedImage;
+ }
+ return bRes;
+ }
+
+ BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItem(hItem, TVIF_IMAGE|TVIF_SELECTEDIMAGE, NULL, nImage, nSelectedImage, 0, 0, NULL);
+ }
+
+ UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+ return (((UINT)::SendMessage(m_hWnd, TVM_GETITEMSTATE, (WPARAM)hItem, (LPARAM)nStateMask)) & nStateMask);
+#else // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE))
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = TVIF_STATE;
+ item.state = 0;
+ item.stateMask = nStateMask;
+ ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item);
+ return (item.state & nStateMask);
+#endif // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE))
+ }
+
+ BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItem(hItem, TVIF_STATE, NULL, 0, 0, nState, nStateMask, NULL);
+ }
+
+ DWORD_PTR GetItemData(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = TVIF_PARAM;
+ BOOL bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item);
+ return (DWORD_PTR)(bRet ? item.lParam : NULL);
+ }
+
+ BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return SetItem(hItem, TVIF_PARAM, NULL, 0, 0, 0, 0, (LPARAM)dwData);
+ }
+
+ CEdit GetEditControl() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CEdit((HWND)::SendMessage(m_hWnd, TVM_GETEDITCONTROL, 0, 0L));
+ }
+
+ UINT GetVisibleCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, TVM_GETVISIBLECOUNT, 0, 0L);
+ }
+
+ BOOL GetItemRect(HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ *(HTREEITEM*)lpRect = hItem;
+ return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMRECT, (WPARAM)bTextOnly, (LPARAM)lpRect);
+ }
+
+ BOOL ItemHasChildren(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVITEM item = { 0 };
+ item.hItem = hItem;
+ item.mask = TVIF_CHILDREN;
+ ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item);
+ return item.cChildren;
+ }
+
+#ifndef _WIN32_WCE
+ CToolTipCtrl GetToolTips() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_GETTOOLTIPS, 0, 0L));
+ }
+
+ CToolTipCtrl SetToolTips(HWND hWndTT)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L));
+ }
+#endif // !_WIN32_WCE
+
+ int GetISearchString(LPTSTR lpstr) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TVM_GETISEARCHSTRING, 0, (LPARAM)lpstr);
+ }
+
+ // checkboxes only
+ BOOL GetCheckState(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ATLASSERT((GetStyle() & TVS_CHECKBOXES) != 0);
+ UINT uRet = GetItemState(hItem, TVIS_STATEIMAGEMASK);
+ return (uRet >> 12) - 1;
+ }
+
+ BOOL SetCheckState(HTREEITEM hItem, BOOL bCheck)
+ {
+ int nCheck = bCheck ? 2 : 1; // one based index
+ return SetItemState(hItem, INDEXTOSTATEIMAGEMASK(nCheck), TVIS_STATEIMAGEMASK);
+ }
+
+#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+ COLORREF GetBkColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_GETBKCOLOR, 0, 0L);
+ }
+
+ COLORREF SetBkColor(COLORREF clr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)clr);
+ }
+
+ COLORREF GetInsertMarkColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_GETINSERTMARKCOLOR, 0, 0L);
+ }
+
+ COLORREF SetInsertMarkColor(COLORREF clr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr);
+ }
+
+ int GetItemHeight() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TVM_GETITEMHEIGHT, 0, 0L);
+ }
+
+ int SetItemHeight(int cyHeight)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TVM_SETITEMHEIGHT, cyHeight, 0L);
+ }
+
+ int GetScrollTime() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TVM_GETSCROLLTIME, 0, 0L);
+ }
+
+ int SetScrollTime(int nScrollTime)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (int)::SendMessage(m_hWnd, TVM_SETSCROLLTIME, nScrollTime, 0L);
+ }
+
+ COLORREF GetTextColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_GETTEXTCOLOR, 0, 0L);
+ }
+
+ COLORREF SetTextColor(COLORREF clr)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_SETTEXTCOLOR, 0, (LPARAM)clr);
+ }
+
+ BOOL GetUnicodeFormat() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_GETUNICODEFORMAT, 0, 0L);
+ }
+
+ BOOL SetUnicodeFormat(BOOL bUnicode = TRUE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SETUNICODEFORMAT, bUnicode, 0L);
+ }
+#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+
+#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+ COLORREF GetLineColor() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_GETLINECOLOR, 0, 0L);
+ }
+
+ COLORREF SetLineColor(COLORREF clrNew /*= CLR_DEFAULT*/)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (COLORREF)::SendMessage(m_hWnd, TVM_SETLINECOLOR, 0, (LPARAM)clrNew);
+ }
+#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)
+
+#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+ BOOL GetItem(LPTVITEMEX pItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem);
+ }
+
+ BOOL SetItem(LPTVITEMEX pItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem);
+ }
+#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+
+ DWORD GetExtendedStyle() const
+ {
+#ifndef TVM_GETEXTENDEDSTYLE
+ const UINT TVM_GETEXTENDEDSTYLE = (TV_FIRST + 45);
+#endif
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, TVM_GETEXTENDEDSTYLE, 0, 0L);
+ }
+
+ DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask)
+ {
+#ifndef TVM_SETEXTENDEDSTYLE
+ const UINT TVM_SETEXTENDEDSTYLE = (TV_FIRST + 44);
+#endif
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, TVM_SETEXTENDEDSTYLE, dwMask, dwStyle);
+ }
+
+#if (_WIN32_WINNT >= 0x0600)
+ BOOL SetAutoScrollInfo(UINT uPixPerSec, UINT uUpdateTime)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SETAUTOSCROLLINFO, (WPARAM)uPixPerSec, (LPARAM)uUpdateTime);
+ }
+
+ DWORD GetSelectedCount() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (DWORD)::SendMessage(m_hWnd, TVM_GETSELECTEDCOUNT, 0, 0L);
+ }
+
+ BOOL GetItemPartRect(HTREEITEM hItem, TVITEMPART partID, LPRECT lpRect) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVGETITEMPARTRECTINFO gipri = { hItem, lpRect, partID };
+ return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMPARTRECT, 0, (LPARAM)&gipri);
+ }
+#endif // (_WIN32_WINNT >= 0x0600)
+
+// Operations
+ HTREEITEM InsertItem(LPTVINSERTSTRUCT lpInsertStruct)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct);
+ }
+
+ HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage,
+ int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter);
+ }
+
+ HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter);
+ }
+
+ HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage,
+ int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam,
+ HTREEITEM hParent, HTREEITEM hInsertAfter)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVINSERTSTRUCT tvis = { 0 };
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = hInsertAfter;
+ tvis.item.mask = nMask;
+ tvis.item.pszText = (LPTSTR) lpszItem;
+ tvis.item.iImage = nImage;
+ tvis.item.iSelectedImage = nSelectedImage;
+ tvis.item.state = nState;
+ tvis.item.stateMask = nStateMask;
+ tvis.item.lParam = lParam;
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis);
+ }
+
+ BOOL DeleteItem(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem);
+ }
+
+ BOOL DeleteAllItems()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT);
+ }
+
+ BOOL Expand(HTREEITEM hItem, UINT nCode = TVE_EXPAND)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_EXPAND, nCode, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetChildItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetParentItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetFirstVisibleItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L);
+ }
+
+ HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem);
+ }
+
+ HTREEITEM GetSelectedItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L);
+ }
+
+ HTREEITEM GetDropHilightItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L);
+ }
+
+ HTREEITEM GetRootItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L);
+ }
+
+#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+ HTREEITEM GetLastVisibleItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L);
+ }
+#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+
+#if (_WIN32_IE >= 0x0600)
+ HTREEITEM GetNextSelectedItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L);
+ }
+#endif // (_WIN32_IE >= 0x0600)
+
+ BOOL Select(HTREEITEM hItem, UINT nCode)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, nCode, (LPARAM)hItem);
+ }
+
+ BOOL SelectItem(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem);
+ }
+
+ BOOL SelectDropTarget(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItem);
+ }
+
+ BOOL SelectSetFirstVisible(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_FIRSTVISIBLE, (LPARAM)hItem);
+ }
+
+ CEdit EditLabel(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CEdit((HWND)::SendMessage(m_hWnd, TVM_EDITLABEL, 0, (LPARAM)hItem));
+ }
+
+ BOOL EndEditLabelNow(BOOL bCancel)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_ENDEDITLABELNOW, bCancel, 0L);
+ }
+
+ HTREEITEM HitTest(TVHITTESTINFO* pHitTestInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo);
+ }
+
+ HTREEITEM HitTest(POINT pt, UINT* pFlags) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVHITTESTINFO hti = { 0 };
+ hti.pt = pt;
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti);
+ if (pFlags != NULL)
+ *pFlags = hti.flags;
+ return hTreeItem;
+ }
+
+ BOOL SortChildren(HTREEITEM hItem, BOOL bRecurse = FALSE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDREN, (WPARAM)bRecurse, (LPARAM)hItem);
+ }
+
+ BOOL EnsureVisible(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem);
+ }
+
+ BOOL SortChildrenCB(LPTVSORTCB pSort, BOOL bRecurse = FALSE)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDRENCB, (WPARAM)bRecurse, (LPARAM)pSort);
+ }
+
+ CImageList RemoveImageList(int nImageList)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageList, NULL));
+ }
+
+ CImageList CreateDragImage(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItem));
+ }
+
+#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+ BOOL SetInsertMark(HTREEITEM hTreeItem, BOOL bAfter)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, bAfter, (LPARAM)hTreeItem);
+ }
+
+ BOOL RemoveInsertMark()
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, 0, 0L);
+ }
+#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+
+#if (_WIN32_WINNT >= 0x0501)
+ HTREEITEM MapAccIDToHTREEITEM(UINT uID) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L);
+ }
+
+ UINT MapHTREEITEMToAccID(HTREEITEM hTreeItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return (UINT)::SendMessage(m_hWnd, TVM_MAPHTREEITEMTOACCID, (WPARAM)hTreeItem, 0L);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+
+#if (_WIN32_WINNT >= 0x0600)
+ void ShowInfoTip(HTREEITEM hItem)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ ::SendMessage(m_hWnd, TVM_SHOWINFOTIP, 0, (LPARAM)hItem);
+ }
+#endif // (_WIN32_WINNT >= 0x0600)
+};
+
+typedef CTreeViewCtrlT CTreeViewCtrl;
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CTreeViewCtrlEx
+
+// forward declaration
+template class CTreeViewCtrlExT;
+
+// Note: TBase here is for CTreeViewCtrlExT, and not for CTreeItemT itself
+template
+class CTreeItemT
+{
+public:
+ HTREEITEM m_hTreeItem;
+ CTreeViewCtrlExT* m_pTreeView;
+
+// Construction
+ CTreeItemT(HTREEITEM hTreeItem = NULL, CTreeViewCtrlExT* pTreeView = NULL) : m_hTreeItem(hTreeItem), m_pTreeView(pTreeView)
+ { }
+
+ CTreeItemT(const CTreeItemT& posSrc)
+ {
+ *this = posSrc;
+ }
+
+ operator HTREEITEM() { return m_hTreeItem; }
+
+ CTreeItemT& operator =(const CTreeItemT& itemSrc)
+ {
+ m_hTreeItem = itemSrc.m_hTreeItem;
+ m_pTreeView = itemSrc.m_pTreeView;
+ return *this;
+ }
+
+// Attributes
+ CTreeViewCtrlExT* GetTreeView() const { return m_pTreeView; }
+
+ BOOL operator !() const { return m_hTreeItem == NULL; }
+
+ BOOL IsNull() const { return m_hTreeItem == NULL; }
+
+ BOOL GetRect(LPRECT lpRect, BOOL bTextOnly) const;
+ BOOL GetText(LPTSTR lpstrText, int nLen) const;
+#ifndef _ATL_NO_COM
+ BOOL GetText(BSTR& bstrText) const;
+#endif // !_ATL_NO_COM
+#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+ BOOL GetText(_CSTRING_NS::CString& strText) const;
+#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+ BOOL SetText(LPCTSTR lpszItem);
+ BOOL GetImage(int& nImage, int& nSelectedImage) const;
+ BOOL SetImage(int nImage, int nSelectedImage);
+ UINT GetState(UINT nStateMask) const;
+ BOOL SetState(UINT nState, UINT nStateMask);
+ DWORD_PTR GetData() const;
+ BOOL SetData(DWORD_PTR dwData);
+ BOOL SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam);
+
+// Operations
+ CTreeItemT InsertAfter(LPCTSTR lpstrItem, HTREEITEM hItemAfter, int nImageIndex)
+ {
+ return _Insert(lpstrItem, nImageIndex, hItemAfter);
+ }
+
+ CTreeItemT AddHead(LPCTSTR lpstrItem, int nImageIndex)
+ {
+ return _Insert(lpstrItem, nImageIndex, TVI_FIRST);
+ }
+
+ CTreeItemT AddTail(LPCTSTR lpstrItem, int nImageIndex)
+ {
+ return _Insert(lpstrItem, nImageIndex, TVI_LAST);
+ }
+
+ CTreeItemT GetChild() const;
+ CTreeItemT GetNext(UINT nCode) const;
+ CTreeItemT GetNextSibling() const;
+ CTreeItemT GetPrevSibling() const;
+ CTreeItemT GetParent() const;
+ CTreeItemT GetFirstVisible() const;
+ CTreeItemT GetNextVisible() const;
+ CTreeItemT GetPrevVisible() const;
+ CTreeItemT GetSelected() const;
+ CTreeItemT GetDropHilight() const;
+ CTreeItemT GetRoot() const;
+#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+ CTreeItemT GetLastVisible() const;
+#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+#if (_WIN32_IE >= 0x0600)
+ CTreeItemT GetNextSelected() const;
+#endif // (_WIN32_IE >= 0x0600)
+ BOOL HasChildren() const;
+ BOOL Delete();
+ BOOL Expand(UINT nCode = TVE_EXPAND);
+ BOOL Select(UINT nCode);
+ BOOL Select();
+ BOOL SelectDropTarget();
+ BOOL SelectSetFirstVisible();
+ HWND EditLabel();
+ HIMAGELIST CreateDragImage();
+ BOOL SortChildren(BOOL bRecurse = FALSE);
+ BOOL EnsureVisible();
+ CTreeItemT _Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter);
+ int GetImageIndex() const;
+#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+ BOOL SetInsertMark(BOOL bAfter);
+#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
+#if (_WIN32_WINNT >= 0x0501)
+ UINT MapHTREEITEMToAccID() const;
+#endif // (_WIN32_WINNT >= 0x0501)
+#if (_WIN32_WINNT >= 0x0600)
+ void ShowInfoTip();
+ BOOL GetPartRect(TVITEMPART partID, LPRECT lpRect) const;
+#endif // (_WIN32_WINNT >= 0x0600)
+};
+
+typedef CTreeItemT CTreeItem;
+
+
+template
+class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase >
+{
+public:
+// Constructors
+ CTreeViewCtrlExT(HWND hWnd = NULL) : CTreeViewCtrlT< TBase >(hWnd)
+ { }
+
+ CTreeViewCtrlExT< TBase >& operator =(HWND hWnd)
+ {
+ m_hWnd = hWnd;
+ return *this;
+ }
+
+// Operations (overides that return CTreeItem)
+ CTreeItemT InsertItem(LPTVINSERTSTRUCT lpInsertStruct)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct);
+ return CTreeItemT(hTreeItem, this);
+ }
+
+ CTreeItemT InsertItem(LPCTSTR lpszItem, int nImage,
+ int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter);
+ }
+
+ CTreeItemT InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter);
+ }
+
+ CTreeItemT GetNextItem(HTREEITEM hItem, UINT nCode) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetChildItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetNextSiblingItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetPrevSiblingItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetParentItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetFirstVisibleItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetNextVisibleItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetPrevVisibleItem(HTREEITEM hItem) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetSelectedItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetDropHilightItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT GetRootItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+ CTreeItemT GetLastVisibleItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+
+#if (_WIN32_IE >= 0x0600)
+ CTreeItemT GetNextSelectedItem() const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+#endif // (_WIN32_IE >= 0x0600)
+
+ CTreeItemT HitTest(TVHITTESTINFO* pHitTestInfo) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+ CTreeItemT InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage,
+ int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam,
+ HTREEITEM hParent, HTREEITEM hInsertAfter)
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVINSERTSTRUCT tvis = { 0 };
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = hInsertAfter;
+ tvis.item.mask = nMask;
+ tvis.item.pszText = (LPTSTR) lpszItem;
+ tvis.item.iImage = nImage;
+ tvis.item.iSelectedImage = nSelectedImage;
+ tvis.item.state = nState;
+ tvis.item.stateMask = nStateMask;
+ tvis.item.lParam = lParam;
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis);
+ return CTreeItemT(hTreeItem, this);
+ }
+
+ CTreeItemT HitTest(POINT pt, UINT* pFlags) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ TVHITTESTINFO hti = { 0 };
+ hti.pt = pt;
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti);
+ if (pFlags != NULL)
+ *pFlags = hti.flags;
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+
+#if (_WIN32_WINNT >= 0x0501)
+ CTreeItemT MapAccIDToHTREEITEM(UINT uID) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+ HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L);
+ return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this);
+ }
+#endif // (_WIN32_WINNT >= 0x0501)
+};
+
+typedef CTreeViewCtrlExT CTreeViewCtrlEx;
+
+
+// CTreeItem inline methods
+template
+inline BOOL CTreeItemT::GetRect(LPRECT lpRect, BOOL bTextOnly) const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetItemRect(m_hTreeItem,lpRect,bTextOnly);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetNext(UINT nCode) const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetNextItem(m_hTreeItem,nCode);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetChild() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetChildItem(m_hTreeItem);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetNextSibling() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetNextSiblingItem(m_hTreeItem);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetPrevSibling() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetPrevSiblingItem(m_hTreeItem);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetParent() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetParentItem(m_hTreeItem);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetFirstVisible() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetFirstVisibleItem();
+}
+
+template
+inline CTreeItemT CTreeItemT::GetNextVisible() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetNextVisibleItem(m_hTreeItem);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetPrevVisible() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetPrevVisibleItem(m_hTreeItem);
+}
+
+template
+inline CTreeItemT CTreeItemT::GetSelected() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetSelectedItem();
+}
+
+template
+inline CTreeItemT CTreeItemT::GetDropHilight() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetDropHilightItem();
+}
+
+template
+inline CTreeItemT CTreeItemT::GetRoot() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetRootItem();
+}
+
+#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+template
+inline CTreeItemT CTreeItemT::GetLastVisible() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetLastVisibleItem();
+}
+#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400)
+
+#if (_WIN32_IE >= 0x0600)
+template
+inline CTreeItemT CTreeItemT::GetNextSelected() const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetNextSelectedItem();
+}
+#endif // (_WIN32_IE >= 0x0600)
+
+template
+inline BOOL CTreeItemT::GetText(LPTSTR lpstrText, int nLen) const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetItemText(m_hTreeItem, lpstrText, nLen);
+}
+
+#ifndef _ATL_NO_COM
+#ifdef _OLEAUTO_H_
+template
+inline BOOL CTreeItemT::GetText(BSTR& bstrText) const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetItemText(m_hTreeItem, bstrText);
+}
+#endif // _OLEAUTO_H_
+#endif // !_ATL_NO_COM
+
+#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+template
+inline BOOL CTreeItemT::GetText(_CSTRING_NS::CString& strText) const
+{
+ ATLASSERT(m_pTreeView != NULL);
+ return m_pTreeView->GetItemText(m_hTreeItem, strText);
+}
+#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
+
+template