Files
kaizen/external/capstone/bindings/vb6/Form1.frm
T
iris 00cc9309cb Squashed 'external/ircolib/' changes from ce3cd726c..de6e324bd
de6e324bd separate emu thread
10d3daf86 Roms List improvements
95d202f37 Let's make the rom list process on a separate thread so the emulator doesnt take ages to load.
fc306967f Wow the ROM Header was just completely busted. Game list view works now
bad1691ee fuck this shit
2b59e5f46 game list in progress
d26417b83 remappable inputs in progress
ac4af8106 input
e72abc240 update readme
430139dc9 Qt6 frontend
3080d4d45 Fix this small bug too
08cd13b85 Cop0 unused functions do not actually pose a threat (as per manual). They don't do anything, so shall we.
61bb4fb44 make idle loop detection a little more specific with where the load goes
b037de4c3 SAZDFsdff
12e81e73e need to figure out why n64-systemtest loops indefinitely at some address that appears to be valid (i think it's me not invalidating the cache properly)
204f0e13b idle skipping seems to work!
cb8bb634a sdkfjlasdf
58e5c89c1 Fix compilation issue on my machine (no idea)
24fb2898e attempting more serious idle skipping
214719577 Place rsp.Step inside cached interpreter. Gains about 3 more fps
bb97dcc23 mmmmm
920b77d38 wjkhasdfjhkasdf
430ccdab4 it's a start...
4f42a673a Cached interpreter plays Mario 64. Start looking into RSP as well
c9a030787 idle skipping works!
5fbda03ce new idea
366637aba Idle skipping... maybe?
609fa2fb0 Cache instructions implemented but broken lmao. Commented out for now
e140a6d12 - Stop using inheritance for CPU, instead use composition. - Introduce KAIZEN_JIT_ENABLED optional define instead of relying on __aarch64__ and the like. - More cache work
68e613057 prep cache impl
811b4d809 fix clang format
fda755f7d idk
d5024ebbf small MI refactor in preparation of (eventually) implementing the RDRAM interface properly
694b45341 Merge commit '206dcdedf195fb320913584180edb12c7731e396' as 'external/SDL'
206dcdedf Squashed 'external/SDL/' content from commit 4d17b99d0a
4d16e1cb4 need to update sdl
848b19920 Fix compilation error
db61b5299 Merge commit 'e94a94559f28e49678fbcf72199a5258137b0fe9' as 'external/imgui'
e94a94559 Squashed 'external/imgui/' content from commit 02e9b8cac
52edb3757 need to update imgui
c1a705e86 Emulate weird JALR behaviour
4b4c32f4b Fix exception for "unusable COP1" in 4 instructions i missed accidentally (again)
df5828142 Bug putting 0s in the log everywhere
f8b580048 Make isviewer a sink to file
8241e9735 Fix exception for "unusable COP1" in 4 instructions i missed accidentally
b29715f20 small changes
d9a620bc1 make use of my new small utility library
0d1aa938e Add 'external/ircolib/' from commit 'ce3cd726c8df8388d554abf8bb55d55020eb4450'
e64eb40b3 Fuck git

git-subtree-dir: external/ircolib
git-subtree-split: de6e324bde
2026-06-15 11:56:38 +02:00

276 lines
8.2 KiB
Plaintext

VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
Caption = "VB6 Bindings for Capstone Disassembly Engine - Contributed by FireEye FLARE Team"
ClientHeight = 7290
ClientLeft = 60
ClientTop = 345
ClientWidth = 10275
LinkTopic = "Form1"
ScaleHeight = 7290
ScaleWidth = 10275
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command2
Caption = "Save"
Height = 375
Left = 8760
TabIndex = 8
Top = 120
Width = 1455
End
Begin VB.CommandButton Command1
Caption = " Arm 64"
Height = 375
Index = 4
Left = 6840
TabIndex = 7
Top = 120
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "Arm"
Height = 375
Index = 3
Left = 5160
TabIndex = 6
Top = 120
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "x86 64bit"
Height = 375
Index = 2
Left = 3480
TabIndex = 5
Top = 120
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "x86 16bit"
Height = 375
Index = 0
Left = 120
TabIndex = 4
Top = 120
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "x86 32bit"
Height = 375
Index = 1
Left = 1800
TabIndex = 3
Top = 120
Width = 1455
End
Begin MSComctlLib.ListView lv
Height = 2415
Left = 120
TabIndex = 2
Top = 1440
Width = 10095
_ExtentX = 17806
_ExtentY = 4260
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Courier"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Object.Width = 2540
EndProperty
End
Begin VB.ListBox List1
BeginProperty Font
Name = "Courier"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 840
Left = 120
TabIndex = 1
Top = 600
Width = 10095
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "Courier"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3375
Left = 120
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
Text = "Form1.frx":0000
Top = 3840
Width = 10095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'Capstone Disassembly Engine bindings for VB6
'Contributed by FireEye FLARE Team
'Author: David Zimmer <david.zimmer@fireeye.com>, <dzzie@yahoo.com>
'License: Apache 2.0
'Copyright: FireEye 2017
Dim cap As CDisassembler
Dim lastSample As Long
Private Sub Command1_Click(index As Integer)
Dim code() As Byte, arch As cs_arch, mode As cs_mode
lastSample = index
Const x86_code32 As String = "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x05\x23\x01\x00\x00\x36\x8b\x84\x91\x23\x01\x00\x00\x41\x8d\x84\x39\x89\x67\x00\x00\x8d\x87\x89\x67\x00\x00\xb4\xc6"
Const X86_CODE16 As String = "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x05\x23\x01\x00\x00\x36\x8b\x84\x91\x23\x01\x00\x00\x41\x8d\x84\x39\x89\x67\x00\x00\x8d\x87\x89\x67\x00\x00\xb4\xc6"
Const X86_CODE64 As String = "\x55\x48\x8b\x05\xb8\x13\x00\x00"
Const ARM_CODE As String = "\xED\xFF\xFF\xEB\x04\xe0\x2d\xe5\x00\x00\x00\x00\xe0\x83\x22\xe5\xf1\x02\x03\x0e\x00\x00\xa0\xe3\x02\x30\xc1\xe7\x00\x00\x53\xe3\x00\x02\x01\xf1\x05\x40\xd0\xe8\xf4\x80\x00\x00"
Const ARM64_CODE As String = "\x09\x00\x38\xd5\xbf\x40\x00\xd5\x0c\x05\x13\xd5\x20\x50\x02\x0e\x20\xe4\x3d\x0f\x00\x18\xa0\x5f\xa2\x00\xae\x9e\x9f\x37\x03\xd5\xbf\x33\x03\xd5\xdf\x3f\x03\xd5\x21\x7c\x02\x9b\x21\x7c\x00\x53\x00\x40\x21\x4b\xe1\x0b\x40\xb9\x20\x04\x81\xda\x20\x08\x02\x8b\x10\x5b\xe8\x3c"
Select Case index
Case 0:
arch = CS_ARCH_X86
mode = CS_MODE_16
code = toBytes(X86_CODE16)
Case 1:
arch = CS_ARCH_X86
mode = CS_MODE_32
code = toBytes(x86_code32)
Case 2:
arch = CS_ARCH_X86
mode = CS_MODE_64
code = toBytes(X86_CODE64)
Case 3:
arch = CS_ARCH_ARM
mode = CS_MODE_ARM
code = toBytes(ARM_CODE)
Case 4:
arch = CS_ARCH_ARM64
mode = CS_MODE_ARM
code = toBytes(ARM64_CODE)
End Select
test code, arch, mode
End Sub
Private Sub test(code() As Byte, arch As cs_arch, mode As cs_mode)
Dim ret As Collection
Dim ci As CInstruction
Dim li As ListItem
clearForm
If Not cap Is Nothing Then Set cap = Nothing
Set cap = New CDisassembler
If Not cap.init(arch, mode, True) Then
List1.AddItem "Failed to init engine: " & cap.errMsg
Exit Sub
End If
List1.AddItem "Capstone loaded @ 0x" & Hex(cap.hLib)
List1.AddItem "hEngine: 0x" & Hex(cap.hCapstone)
List1.AddItem "Version: " & cap.version
If cap.vMajor < 3 Then
List1.AddItem "Sample requires Capstone v3+"
Exit Sub
End If
Set ret = cap.disasm(&H1000, code)
For Each ci In ret
Set li = lv.ListItems.Add(, , ci.text)
Set li.Tag = ci
Next
End Sub
Private Sub Command2_Click()
Dim fName() As String
Dim fPath As String
Dim t() As String
Dim li As ListItem
Dim ci As CInstruction
On Error Resume Next
If lastSample = -1 Then
MsgBox "Run a test first..."
Exit Sub
End If
fName = Split("16b,32b,64b,Arm,Arm64", ",")
fPath = App.path & "\vb" & fName(lastSample) & "Test.txt"
If FileExists(fPath) Then Kill fPath
For Each li In lv.ListItems
push t, li.text
Set ci = li.Tag
push t, ci.toString()
push t, String(60, "-")
Next
WriteFile fPath, Join(t, vbCrLf)
MsgBox FileLen(fPath) & " bytes saved to: " & vbCrLf & vbCrLf & fPath
End Sub
Private Sub lv_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim ci As CInstruction
Set ci = Item.Tag
Text1 = ci.toString()
End Sub
Function clearForm()
List1.Clear
lv.ListItems.Clear
Text1 = Empty
End Function
Private Sub Form_Load()
lv.ColumnHeaders(1).Width = lv.Width
clearForm
lastSample = -1
End Sub