设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2402|回复: 0
打印 上一主题 下一主题

[通用发布] zh在群里发了一个很蛋疼的东西所以就有了这个很蛋疼的工具

[复制链接]

Lv2.观梦者

傻♂逼

梦石
0
星屑
369
在线时间
1605 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

跳转到指定楼层
1
发表于 2011-6-10 20:52:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 yangff 于 2011-6-10 20:54 编辑

调试工具
不知道他会不会也写了一个……但是这个的功能……绝对蛋疼……
按Enter快速掠过,按Esc逐行步进
  1. $skip_mode=""
  2. #------------------------------------------------------------------------------
  3. # Moonlight INN
  4. # http://cgi.members.interq.or.jp/aquarius/rasetsu/
  5. # RaTTiE
  6. # [email protected]
  7. #------------------------------------------------------------
  8. # EasyConv::s2u(text) : S-JIS -> UTF-8
  9. # EasyConv::u2s(text) : UTF-8 -> S-JIS
  10. #==============================================
  11. module EasyConv
  12.   CP_ACP = 0
  13.   CP_UTF8 = 65001
  14.   #--------------------------------------------------------------------------
  15.   # 仠 S-JIS -> UTF-8
  16.   #--------------------------------------------------------------------------
  17.   def s2u(text)
  18.     m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  19.     w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
  20.     # S-JIS -> Unicode
  21.     len = m2w.call(CP_ACP, 0, text, -1, nil, 0);
  22.     buf = "\0" * (len*2)
  23.     m2w.call(CP_ACP, 0, text, -1, buf, buf.size/2);
  24.     # Unicode -> UTF-8
  25.     len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
  26.     ret = "\0" * len
  27.     w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
  28.     return ret
  29.   end
  30.   module_function :s2u
  31.   #--------------------------------------------------------------------------
  32.   # 仠 UTF-8 -> S-JIS
  33.   #--------------------------------------------------------------------------
  34.   def u2s(text)
  35.     m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  36.     w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
  37.     # UTF-8 -> Unicode
  38.     len = m2w.call(CP_UTF8, 0, text, -1, nil, 0);
  39.     buf = "\0" * (len*2)
  40.     m2w.call(CP_UTF8, 0, text, -1, buf, buf.size/2);
  41.     # Unicode -> S-JIS
  42.     len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil);
  43.     ret = "\0" * len
  44.     w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil);
  45.     return ret
  46.   end
  47.   module_function :u2s
  48. end

  49. def get_neme(n)
  50.   
  51.   return  $RGSS_SCRIPTS[n[-3,3].to_i][1]

  52. end  #
  53. module RMDebugger
  54.   module WinAPIs
  55.     K="kernel32"
  56.     def self.kd(f,c="",r="l")
  57.       return Win32API.new(K,"#{f}","#{c}","#{r}")
  58.     end
  59.     STD_INPUT_HANDLE = -10
  60.   STD_OUTPUT_HANDLE = -11
  61.   STD_ERROR_HANDLE = -12
  62.     AllocConsole=kd "AllocConsole"
  63.     FreeConsole =kd "FreeConsole"
  64.     GetStdHandle=kd "GetStdHandle","l"
  65.     WriteConsole=kd "WriteConsole","lplll"
  66.     ReadConsole =kd "ReadConsole","lplll"
  67.     SetConsoleMode=kd "SetConsoleMode","ll"
  68.   end
  69.   Handle=WinAPIs::AllocConsole.call

  70.   InputHandle=WinAPIs::GetStdHandle.call(-10)
  71.   OutputHandle=WinAPIs::GetStdHandle.call(-11)
  72.   #p InputHandle
  73.   #p OutputHandle
  74.   def self.write(s,mode=1)
  75.     #p s.size
  76.     #
  77.     s=EasyConv.u2s(s).delete!("\000")
  78.     WinAPIs::SetConsoleMode.call(OutputHandle,mode)
  79.     WinAPIs::WriteConsole.call(OutputHandle,s,s.size,s.size,0)
  80.     exitme=false
  81.     while not exitme
  82.       if $break_all
  83.         break
  84.       end
  85.       if Input.press?(Input::C)
  86.         exitme=true
  87.         $skip_mode="Line"
  88.         break
  89.       end
  90.       if Input.repeat?(Input::B)
  91.         exitme=true
  92.         $skip_mode=""
  93.       end
  94.       
  95.       Input.update
  96.       Graphics.update
  97.     end
  98.   end
  99.   def self.get_a_line(mode=4)
  100.     s1="\000"*256
  101.     WinAPIs::SetConsoleMode.call(InputHandle,mode)
  102.     WinAPIs::ReadConsole.call(InputHandle,s1,s1.size,0,0)
  103.     return s1
  104.   end
  105.   def self.exit
  106.     WinAPIs::FreeConsole.call
  107.   end
  108. set_trace_func lambda {|event, file, line, id, binding, klass|
  109.     #p event, file, line, id, binding, klass
  110.     return if (event=="line") and ($skip_mode=="Line")
  111.     return if event=="c-call"
  112.     return if event=="c-return"
  113.     return if event=="end"
  114.     return if event=="class"
  115.     get_neme(file)
  116.     a= "Event:#{event}\r\n #{get_neme(file)} line: #{line},id:#{id},klass:#{klass}\r\n"
  117.     write a
  118.     #
  119.     #write a
  120.    
  121. }

  122. end
  123. #RMDebugger.write "Please give me ,which mode would you like?(bl or bf?) You can choose it in next stop"
  124. #p RMDebugger.read

  125. alias old_exit exit
  126. def exit(*args)
  127.   $break_all=true
  128.   RMDebugger.exit
  129.   old_exit
  130. end
复制代码

点评

倒数第二行old_exit没有给参数....  发表于 2011-6-11 17:26
哎呀,蛋疼什么的最有爱了
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-25 05:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表