=begin ■アイテム画面エラー回避 RGSS2 DAIpage■ v1.0 ●機能と使い方●  たーくさんアイテムを持った時に落ちるエラーを回避します。 ●更新履歴●  10/10/07:画像データに配列を用いないことで軽量化  10/10/06:公開 =end #============================================================================== # ■ Window_Selectable #============================================================================== class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- alias dummy_bitmap_create_contents create_contents def create_contents w, h = width - 32, [height - 32, row_max * WLH].max if w * h > 4194304 self.contents.dispose Dummy_png.create_file(w, h) self.contents = Bitmap.new("temp.png") self.contents.clear File.delete("temp.png") return end dummy_bitmap_create_contents end end #============================================================================== # ■ Dummy_png #------------------------------------------------------------------------------ #  指定サイズの temp.png をカレントフォルダに生成します。 #============================================================================== module Dummy_png module_function #-------------------------------------------------------------------------- # ● ダミーpngファイル作成  #-------------------------------------------------------------------------- def create_file(w, h) f = File.open("temp.png", "wb") f.write("\x89PNG\r\n\x1a\n") f.write(dummy_i_h(w, h)) f.write(dummy_data(w, h)) f.write(deflate("IEND", "")) f.close end #-------------------------------------------------------------------------- # ● ダミーファイル、イメージヘッダ #-------------------------------------------------------------------------- def dummy_i_h(w, h) return deflate("IHDR", [w, h, 1, 0, 0, 0, 0].pack("N2C5")) end #-------------------------------------------------------------------------- # ● ダミーファイル、画像データ #-------------------------------------------------------------------------- def dummy_data(w, h) return deflate("IDAT", Zlib::Deflate.deflate("\000" * ((w * h + h) / 4))) end #-------------------------------------------------------------------------- # ● 圧縮 #-------------------------------------------------------------------------- def deflate(name, data) return [data.size, name, data, Zlib.crc32(name + data)].pack("NA4A*N") end end