chishingchan 发表于 2019-11-26 21:30:53

Heaventools 语言包分析程序

此程序主要用来分析语言包的结构, 方便手动精简语言或汉化语言。



下载:
附表:
Heaventools 主页: http://www.heaventools.com/

Resource Tuner
http://www.heaventools.com/download/rtsetup.exe

ResTuner Console
http://www.heaventools.com/download/rtc_setup.exe


chishingchan 发表于 2019-11-26 21:35:53

附上源码:
#NoTrayIcon
FileInstall("D:\Program Files\Resource Tuner\ZlibUIN.exe", @TempDir & "\ZlibUIN.exe")
Local $smessage = "请选择一个 Heaventools 语言包"
Local $sfileopendialog = FileOpenDialog($smessage, @ScriptDir & "\", "语言包(langpack.dat)|所有文件(*.*)")
If @error Then Exit
$decompress = @TempDir & "\langpack.txt"
Run(@TempDir & "\ZlibUIN.exe", @TempDir, @SW_HIDE)
$title = "Zlib Tools"
WinWait($title)
WinActivate($title)
ControlSetText($title, "", "", $sfileopendialog)
ControlSetText($title, "", "", $decompress)
ControlClick($title, "", "")
Sleep(500)
ProcessClose("ZlibUIN.exe")
Local $number = _readbinary($decompress, 0, 4, True)
$h = 60 + 20 * ($number + 1) + 10
Local $hgui = GUICreate("Heaventools 语言包分析程序", 338, $h)
GUICtrlCreateLabel("语言包: ", 10, 10, 56, 20)
GUICtrlCreateLabel(_abbreviation($decompress, 46), 58, 10, 380, 20)
GUICtrlCreateLabel("序列    偏移   语言                      代码   长度", 10, 50, 312, 20)
Local $x = 70, $y = 1, $z
For $i = 4 To 4 + ($number - 1) * 16 Step 16
        $j = _readbinary($decompress, $i, 16, False)
        $j = StringTrimLeft($j, 2)
        $offset = Number(Binary("0x" & StringMid($j, 1, 8)))
        $langlen = Number(Binary("0x" & StringMid($j, 9, 8)))
        $langtxt = _decode(_readbinary($decompress, 4 + $number * 16 + $offset, $langlen, False), 2)
        $langcode = Number(Binary("0x" & StringMid($j, 17, 8)))
        $lang_lang = Number(Binary("0x" & StringMid($j, 25, 8)))
        GUICtrlCreateLabel(StringFormat("%2i   %7i%-19s", $y, $offset, $langtxt), 15, $x, 230, 20)
        GUICtrlCreateLabel(StringFormat("%4i%6i", $langcode, $lang_lang), 255, $x, 72, 20)
        $y += 1
        $x += 20
        $z = 4 + $number * 16 + $offset + $langlen + $lang_lang
Next
GUICtrlCreateLabel(StringFormat("%7i", $z), 45, $x, 100, 20)
GUISetState(@SW_SHOW, $hgui)
While 1
        Switch GUIGetMsg()
                Case -3
                        ExitLoop
        EndSwitch
WEnd
GUIDelete($hgui)

Func _readbinary($file, $begin, $amount, $tf)
        $ado_stream = ObjCreate("ADODB.Stream")
        $ado_stream.type = 1
        $ado_stream.open
        $ado_stream.loadfromfile($file)
        $ado_stream.position = $begin
        $read = $ado_stream.read($amount)
        $ado_stream.close
        If $tf Then
                Return Number($read)
        Else
                Return $read
        EndIf
EndFunc

Func _abbreviation($text, $len)
        If StringLen($text) > $len Then
                Return StringLeft($text, ($len - 6) / 2) & "..." & StringRight($text, ($len - 6) / 2)
        Else
                Return $text
        EndIf
EndFunc

Func _decode($expression, $flag)
        Return BinaryToString(Binary($expression), $flag)
EndFunc

sd1113396 发表于 2019-11-27 10:54:49


好工具,学习中!

wcb0414 发表于 2023-9-11 23:08:29

谢谢LZ,看看能不能分析Resource Tuner 2.23的语言包,
页: [1]
查看完整版本: Heaventools 语言包分析程序