【.mkf】程序找到了源码,但是不会生成。求助,谢谢。
vb吧
全部回复
仅看楼主
level 1
穿IDcl 楼主
仙一有个音效文件是.mkf格式的,想解包了用。但是网上没找到mkf解包器。只找到了源码
Dim FJ() As Byte, coUNtA()
Private Sub Command1_Click()
'Me.Hide
Command1.Enabled = False
Text1.Enabled = False
Drive1.Enabled = False
Dir1.Enabled = False
Open Me.CommonDialog1.FileName For Binary As #1
ReDim FJ(LOF(1))
For i = 1 To LOF(1)
Get #1, , FJ(i)
If i Mod 20000 = 0 Then
Text2.Text = "loading " & Mid(i / LOF(1) * 100, 1, 2) & "%"
Text2.Refresh
Me.Refresh
End If
Next i
Dim a1(4)
For i = 4 To 1 Step -1
e = 5 - i
a1(e) = Hex(FJ(i))
asdf1 = a1(e)
For b = Len(a1(e)) To 1
asdf1 = "0" & asdf1
Next b
a1(e) = asdf1
a1(0) = Val("&H" & a1(1) & a1(2) & a1(3) & a1(4) & "&")
Next i
If a1(0) Mod 4 <> 0 Then MsgBox a1(0): End
ReDim coUNtA(a1(0) / 4 + 5)
coUNtA(1) = a1(0)
For i = 2 To (a1(0) / 4)
For k = 4 To 1 Step -1
'e = 5 - k
a1(k) = Hex(FJ(i * 4 - k + 1))
asdf1 = a1(k)
For b = Len(a1(k)) To 1
asdf1 = "0" & asdf1
Next b
a1(k) = asdf1
a1(0) = Val("&H" & a1(1) & a1(2) & a1(3) & a1(4) & "&")
Next k
Debug.Print a1(0)
coUNtA(i) = a1(0)
Next i
coUNtA(0) = i - 1
'For c = 7 To 1 Step -2
'temp1 = temp1 & Mid(asdf1, c, 2)
'Next c
Close #1
For i = 1 To coUNtA(0)
If coUNtA(1) = coUNtA(2) And www <> 1 Then i = i + 1: www = 1: GoTo 10
Open Me.Dir1.Path & "\" & i & Text1.Text For Binary As #2
For w = (coUNtA(i) + 1) To coUNtA(i + 1)
Put #2, , FJ(w)
Next w
Close #2
Text2.Text = "writing " & i & "/" & coUNtA(0)
Text2.Refresh
Me.Refresh
10 Next i
End
End Sub Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub Private Sub Form_Load()
Dim q As Byte
Dim w As Byte Me.CommonDialog1.ShowOpen
If Me.CommonDialog1.FileName = "" Then End
Open Me.CommonDialog1.FileName For Binary As #1
Get #1, , q
Get #1, , w
Close #1
q = Hex(q)
For i = Len(q) To 1
q = "0" & q
Next i
w = Hex(w)
For i = Len(w) To 1
w = "0" & w
Next i
a1 = w & q
a2 = Val("&H" & a1 & "&")
Open Me.CommonDialog1.FileName For Binary As #1
Get #1, a2 + 1, q
Get #1, , w
Close #1 If q = 170 And w = 85 Then
Text1.Text = ".rix"
ElseIf q = 67 And w = 114 Then
Text1.Text = ".voc"
ElseIf q = 82 And w = 73 Then
Text1.Text = ".wav"
ElseIf q = 77 And w = 84 Then
Text1.Text = ".mid"
ElseIf q = 66 And w = 77 Then
Text1.Text = ".bmp"
ElseIf q = 10 And w = 5 Then
Text1.Text = ".pcx"
End If
End Sub
2013年07月11日 03点07分 1
level 1
穿IDcl 楼主
下了一个vb6企业版,也安了msnd。
但是生成的时候依旧提示如下
请问应该如何解决?或者有没有哪位可以帮我生成以下然后发给我?谢谢。
2013年07月11日 03点07分 2
level 1
穿IDcl 楼主
求助ORZ
2013年07月11日 05点07分 3
level 1
你看看这样行不:
' 在模块顶部添加
Option Explicit
' 修改声明
Private FJ() As Byte
Private coUNtA() As Long
Private www As Boolean
Private Sub Command1_Click()
On Error GoTo ErrorHandler
'Me.Hide
Command1.Enabled = False
Text1.Enabled = False
Drive1.Enabled = False
Dir1.Enabled = False
Dim i As Long, k As Long, w As Long
Dim a1(4) As String
Dim asdf1 As String
Dim e As Integer
Dim b As Integer
Dim temp1 As String
www = False
' 打开文件读取数据
Open Me.CommonDialog1.FileName For Binary As #1
ReDim FJ(LOF(1) - 1) ' 修正:数组下标从0开始
' 读取整个文件
For i = 0 To LOF(1) - 1
Get #1, , FJ(i)
If (i + 1) Mod 20000 = 0 Then
Text2.Text = "loading " & Format((i + 1) / LOF(1) * 100, "0") & "%"
Text2.Refresh
Me.Refresh
DoEvents
End If
Next i
' 读取前4个字节作为文件数量(小端序)
Dim fileCount As Long
fileCount = 0
' 小端序转换为长整型
For i = 0 To 3
fileCount = fileCount + (CLng(FJ(i)) * (256 ^ i))
Next i
' 检查是否是4的倍数
If fileCount Mod 4 <> 0 Then
MsgBox "Invalid file count: " & fileCount, vbCritical
Close #1
Exit Sub
End If
Dim itemCount As Long
itemCount = fileCount / 4
' 重新定义数组
ReDim coUNtA(itemCount + 1)
coUNtA(0) = itemCount
' 读取索引表
Dim offset As Long
For i = 1 To itemCount
offset = 0
For k = 0 To 3
offset = offset + (CLng(FJ(i * 4 + k - 1)) * (256 ^ k))
Next k
coUNtA(i) = offset
Next i
Close #1
' 提取文件
Dim currentFile As Long
For i = 1 To itemCount - 1
' 跳过重复的文件
If coUNtA(1) = coUNtA(2) And Not www Then
i = i + 1
www = True
GoTo SkipFile
End If
' 计算文件大小
Dim fileSize As Long
If i < itemCount Then
fileSize = coUNtA(i + 1) - coUNtA(i)
Else
fileSize = UBound(FJ) - coUNtA(i) + 1
End If
' 写入文件
Open Me.Dir1.Path & "\" & i & Text1.Text For Binary As #2
For w = coUNtA(i) To coUNtA(i) + fileSize - 1
If w <= UBound(FJ) Then
Put #2, , FJ(w)
End If
Next w
Close #2
Text2.Text = "writing " & i & "/" & (itemCount - 1)
Text2.Refresh
Me.Refresh
DoEvents
SkipFile:
Next i
MsgBox "文件提取完成!", vbInformation
Exit Sub
ErrorHandler:
MsgBox "错误: " & Err.Description, vbCritical
If Not EOF(1) Then Close #1
If Not EOF(2) Then Close #2
End Sub
Private Sub Drive1_Change()
On Error Resume Next
Dir1.Path = Drive1.Drive
End Sub
Private Sub Form_Load()
On Error GoTo ErrorHandler
Dim q As Byte, w As Byte
Dim i As Integer
Dim a1 As String, a2 As Long
Me.CommonDialog1.Filter = "所有文件|*.*"
Me.CommonDialog1.ShowOpen
If Me.CommonDialog1.FileName = "" Then
Unload Me
Exit Sub
End If
' 读取文件头信息
Open Me.CommonDialog1.FileName For Binary As #1
Get #1, , q
Get #1, , w
Close #1
' 检测文件类型
If q = &H42 And w = &H4D Then ' "BM" - BMP
Text1.Text = ".bmp"
ElseIf q = &H52 And w = &H49 Then ' "RI" - WAV
Text1.Text = ".wav"
ElseIf q = &H4D And w = &H54 Then ' "MT" - MID
Text1.Text = ".mid"
ElseIf q = &H0A And w = &H05 Then ' PCX
Text1.Text = ".pcx"
ElseIf q = &H43 And w = &H72 Then ' "Cr" - VOC?
Text1.Text = ".voc"
ElseIf q = &HAA And w = &H55 Then ' RIX?
Text1.Text = ".rix"
Else
Text1.Text = ".dat" ' 未知类型
End If
Exit Sub
ErrorHandler:
MsgBox "加载文件时出错: " & Err.Description, vbCritical
If Not EOF(1) Then Close #1
End Sub
2025年12月12日 12点12分 4
谢谢[小乖]这么多年,我已经忘记这是啥了
2025年12月12日 21点12分
1