赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 yangff 于 2011-6-10 20:54 编辑
调试工具
不知道他会不会也写了一个……但是这个的功能……绝对蛋疼……
按Enter快速掠过,按Esc逐行步进- $skip_mode=""
- #------------------------------------------------------------------------------
- # Moonlight INN
- # http://cgi.members.interq.or.jp/aquarius/rasetsu/
- # RaTTiE
- # [email protected]
- #------------------------------------------------------------
- # EasyConv::s2u(text) : S-JIS -> UTF-8
- # EasyConv::u2s(text) : UTF-8 -> S-JIS
- #==============================================
- module EasyConv
- CP_ACP = 0
- CP_UTF8 = 65001
- #--------------------------------------------------------------------------
- # 仠 S-JIS -> UTF-8
- #--------------------------------------------------------------------------
- def s2u(text)
- m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
- w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
- # S-JIS -> Unicode
- len = m2w.call(CP_ACP, 0, text, -1, nil, 0);
- buf = "\0" * (len*2)
- m2w.call(CP_ACP, 0, text, -1, buf, buf.size/2);
- # Unicode -> UTF-8
- len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
- ret = "\0" * len
- w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
- return ret
- end
- module_function :s2u
- #--------------------------------------------------------------------------
- # 仠 UTF-8 -> S-JIS
- #--------------------------------------------------------------------------
- def u2s(text)
- m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
- w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
- # UTF-8 -> Unicode
- len = m2w.call(CP_UTF8, 0, text, -1, nil, 0);
- buf = "\0" * (len*2)
- m2w.call(CP_UTF8, 0, text, -1, buf, buf.size/2);
- # Unicode -> S-JIS
- len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil);
- ret = "\0" * len
- w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil);
- return ret
- end
- module_function :u2s
- end
- def get_neme(n)
-
- return $RGSS_SCRIPTS[n[-3,3].to_i][1]
- end #
- module RMDebugger
- module WinAPIs
- K="kernel32"
- def self.kd(f,c="",r="l")
- return Win32API.new(K,"#{f}","#{c}","#{r}")
- end
- STD_INPUT_HANDLE = -10
- STD_OUTPUT_HANDLE = -11
- STD_ERROR_HANDLE = -12
- AllocConsole=kd "AllocConsole"
- FreeConsole =kd "FreeConsole"
- GetStdHandle=kd "GetStdHandle","l"
- WriteConsole=kd "WriteConsole","lplll"
- ReadConsole =kd "ReadConsole","lplll"
- SetConsoleMode=kd "SetConsoleMode","ll"
- end
- Handle=WinAPIs::AllocConsole.call
- InputHandle=WinAPIs::GetStdHandle.call(-10)
- OutputHandle=WinAPIs::GetStdHandle.call(-11)
- #p InputHandle
- #p OutputHandle
- def self.write(s,mode=1)
- #p s.size
- #
- s=EasyConv.u2s(s).delete!("\000")
- WinAPIs::SetConsoleMode.call(OutputHandle,mode)
- WinAPIs::WriteConsole.call(OutputHandle,s,s.size,s.size,0)
- exitme=false
- while not exitme
- if $break_all
- break
- end
- if Input.press?(Input::C)
- exitme=true
- $skip_mode="Line"
- break
- end
- if Input.repeat?(Input::B)
- exitme=true
- $skip_mode=""
- end
-
- Input.update
- Graphics.update
- end
- end
- def self.get_a_line(mode=4)
- s1="\000"*256
- WinAPIs::SetConsoleMode.call(InputHandle,mode)
- WinAPIs::ReadConsole.call(InputHandle,s1,s1.size,0,0)
- return s1
- end
- def self.exit
- WinAPIs::FreeConsole.call
- end
- set_trace_func lambda {|event, file, line, id, binding, klass|
- #p event, file, line, id, binding, klass
- return if (event=="line") and ($skip_mode=="Line")
- return if event=="c-call"
- return if event=="c-return"
- return if event=="end"
- return if event=="class"
- get_neme(file)
- a= "Event:#{event}\r\n #{get_neme(file)} line: #{line},id:#{id},klass:#{klass}\r\n"
- write a
- #
- #write a
-
- }
- end
- #RMDebugger.write "Please give me ,which mode would you like?(bl or bf?) You can choose it in next stop"
- #p RMDebugger.read
- alias old_exit exit
- def exit(*args)
- $break_all=true
- RMDebugger.exit
- old_exit
- end
复制代码 |
|