赞 23
VIP 22
好人卡 18
积分 608
经验 44466
最后登录 2024-11-9
在线时间 1934 小时
Lv6.析梦学徒
Fuzzy Ginkgo Taciturn Knight
梦石 0
星屑 60819
在线时间 1934 小时
注册时间 2010-6-26
帖子 1605
本帖最后由 orzfly 于 2013-8-29 05:15 编辑
因为你说求高手解答,所以不是高手的人都不敢给你回答问题了(大雾)
所以我也不是高手我很菜的所以我就不回答你了。
------------------
Enterbrain 又调皮了,确实没有 disposed? 这个方法。
XP、VX、VX Ace 都没有的说。
void __cdecl Init_RGSSViewport( )
{
if ( !rb_cViewport )
{
rb_cViewport = rb_define_class( "Viewport" ) ;
rb_define_alloc_func( rb_cViewport, rgss_viewport_allocate) ;
rb_define_method( rb_cViewport, "clone" , ( int ) rgss_viewport_clone, 0 ) ;
rb_define_method( rb_cViewport, "dup" , ( int ) rgss_viewport_dup, 0 ) ;
rb_define_method( rb_cViewport, "initialize" , ( int ) rgss_viewport_initialize, -1 ) ;
rb_define_method( rb_cViewport, "dispose" , ( int ) rgss_viewport_dispose, 0 ) ;
rb_define_method( rb_cViewport, "flash" , ( int ) rgss_viewport_flash, 2 ) ;
rb_define_method( rb_cViewport, "update" , ( int ) rgss_viewport_update, 0 ) ;
rb_define_method( rb_cViewport, "rect" , ( int ) rgss_viewport_rect, 0 ) ;
rb_define_method( rb_cViewport, "rect=" , ( int ) rgss_viewport_rect_set, 1 ) ;
rb_define_method( rb_cViewport, "visible" , ( int ) rgss_viewport_visible, 0 ) ;
rb_define_method( rb_cViewport, "visible=" , ( int ) rgss_viewport_visible_set, 1 ) ;
rb_define_method( rb_cViewport, "z" , ( int ) rgss_viewport_z, 0 ) ;
rb_define_method( rb_cViewport, "z=" , ( int ) rgss_viewport_z_set, 1 ) ;
rb_define_method( rb_cViewport, "ox" , ( int ) rgss_viewport_ox, 0 ) ;
rb_define_method( rb_cViewport, "ox=" , ( int ) rgss_viewport_ox_set, 1 ) ;
rb_define_method( rb_cViewport, "oy" , ( int ) rgss_viewport_oy, 0 ) ;
rb_define_method( rb_cViewport, "oy=" , ( int ) rgss_viewport_oy_set, 1 ) ;
rb_define_method( rb_cViewport, "color" , ( int ) rgss_viewport_color, 0 ) ;
rb_define_method( rb_cViewport, "color=" , ( int ) rgss_viewport_color_set, 1 ) ;
rb_define_method( rb_cViewport, "tone" , ( int ) rgss_viewport_tone, 0 ) ;
rb_define_method( rb_cViewport, "tone=" , ( int ) rgss_viewport_tone_set, 1 ) ;
}
}
void __cdecl Init_RGSSViewport( )
{
if ( !rb_cViewport )
{
rb_cViewport = rb_define_class( "Viewport" ) ;
rb_define_alloc_func( rb_cViewport, rgss_viewport_allocate) ;
rb_define_method( rb_cViewport, "clone" , ( int ) rgss_viewport_clone, 0 ) ;
rb_define_method( rb_cViewport, "dup" , ( int ) rgss_viewport_dup, 0 ) ;
rb_define_method( rb_cViewport, "initialize" , ( int ) rgss_viewport_initialize, -1 ) ;
rb_define_method( rb_cViewport, "dispose" , ( int ) rgss_viewport_dispose, 0 ) ;
rb_define_method( rb_cViewport, "flash" , ( int ) rgss_viewport_flash, 2 ) ;
rb_define_method( rb_cViewport, "update" , ( int ) rgss_viewport_update, 0 ) ;
rb_define_method( rb_cViewport, "rect" , ( int ) rgss_viewport_rect, 0 ) ;
rb_define_method( rb_cViewport, "rect=" , ( int ) rgss_viewport_rect_set, 1 ) ;
rb_define_method( rb_cViewport, "visible" , ( int ) rgss_viewport_visible, 0 ) ;
rb_define_method( rb_cViewport, "visible=" , ( int ) rgss_viewport_visible_set, 1 ) ;
rb_define_method( rb_cViewport, "z" , ( int ) rgss_viewport_z, 0 ) ;
rb_define_method( rb_cViewport, "z=" , ( int ) rgss_viewport_z_set, 1 ) ;
rb_define_method( rb_cViewport, "ox" , ( int ) rgss_viewport_ox, 0 ) ;
rb_define_method( rb_cViewport, "ox=" , ( int ) rgss_viewport_ox_set, 1 ) ;
rb_define_method( rb_cViewport, "oy" , ( int ) rgss_viewport_oy, 0 ) ;
rb_define_method( rb_cViewport, "oy=" , ( int ) rgss_viewport_oy_set, 1 ) ;
rb_define_method( rb_cViewport, "color" , ( int ) rgss_viewport_color, 0 ) ;
rb_define_method( rb_cViewport, "color=" , ( int ) rgss_viewport_color_set, 1 ) ;
rb_define_method( rb_cViewport, "tone" , ( int ) rgss_viewport_tone, 0 ) ;
rb_define_method( rb_cViewport, "tone=" , ( int ) rgss_viewport_tone_set, 1 ) ;
}
}
---------
继续研究的报告:
a1 = object_id * 2 ;
result = *( _DWORD *) ( a1 + 16 ) ;
if ( !*( _DWORD *) ( result + 8 ) )
rb_raise( rb_cRGSSError, "disposed viewport" ) ;
a1 = object_id * 2 ;
result = *( _DWORD *) ( a1 + 16 ) ;
if ( !*( _DWORD *) ( result + 8 ) )
rb_raise( rb_cRGSSError, "disposed viewport" ) ;
所以我们可以自己写一个 disposed? 了:
class ::Viewport
RtlMoveMemory_pi = Win32API.new ( 'kernel32' , 'RtlMoveMemory' , 'pii' , 'i' )
def disposed?
buffer = " " * 4
ad = object_id * 2 + 16
RtlMoveMemory_pi.call ( buffer, ad, 4 )
ad = buffer.unpack ( "L" ) [ 0 ] + 8
RtlMoveMemory_pi.call ( buffer, ad, 4 )
return buffer.unpack ( "L" ) [ 0 ] == 0 ? true : false
end
end
class ::Viewport
RtlMoveMemory_pi = Win32API.new ( 'kernel32' , 'RtlMoveMemory' , 'pii' , 'i' )
def disposed?
buffer = " " * 4
ad = object_id * 2 + 16
RtlMoveMemory_pi.call ( buffer, ad, 4 )
ad = buffer.unpack ( "L" ) [ 0 ] + 8
RtlMoveMemory_pi.call ( buffer, ad, 4 )
return buffer.unpack ( "L" ) [ 0 ] == 0 ? true : false
end
end
@晴兰
评分
查看全部评分