vx xp均可以使用
object_id * 2 + 16 这个是关键中的关键。详细的部分请调查ruby的资源的rb_obj_id和DATA_PTR这个部分。
io形式等等按照自己的需求来自己设定
class Font
def marshal_dump;end
def marshal_load(obj);end
endclass Bitmap
# 传送到内存的API函数
RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
def _dump(limit)
data = "rgba" * width * height
RtlMoveMemory_pi.call(data, address, data.length)
[width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
enddef self._load(str)
w, h, zdata = str.unpack("LLa*"); b =
new(w, h)
RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4); b
end# [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
#
def address
buffer, ad = "xxxx", object_id * 2 + 16
RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 8
RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 16
RtlMoveMemory_pi.call(buffer, ad, 4);
return buffer.unpack("L")[0]
endend 注意,这个脚本对于增强你的游戏性没有什么帮助,是关于如何储存图片的。
能打算使用这个的也是不需要范例的,要范例的估计也用不到。
不知道能不能解决 沉影不器 的 求把缓存里的bitmap压入存档的有效率的办法。如果不是的话,请原谅在下。