Project1
标题: 很奇怪的问题:RMXP中的 Viewport 端口竟然没有 disposed? 方法? [打印本页]
作者: ky52879 时间: 2013-8-29 00:11
标题: 很奇怪的问题:RMXP中的 Viewport 端口竟然没有 disposed? 方法?
刚才无意间发现一个BUG:
很奇怪的问题:RMXP中的 Viewport 端口竟然没有 disposed? 方法?
但是我查了F1:里面明确的指出——是有这个方法的,但是调用不成功。。。。
求高手解答!
作者: orzfly 时间: 2013-8-29 04:22
本帖最后由 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
@晴兰
作者: ky52879 时间: 2013-8-29 09:20
哇。。。好厉害,连RGSS102J里面的函数都能研究出来,佩服了!!!
PS:弱弱的问一句—RMXP的800*600地图,除了拼接3个Viewport外,还有好的方法吗?
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |