Project1

标题: 请问如何打开的patches文件夹里面的.rvdata2格式的东西 [打印本页]

作者: 红泥杂货铺    时间: 2024-1-3 02:44
标题: 请问如何打开的patches文件夹里面的.rvdata2格式的东西
最近在汉化一款游戏,完全汉化完后进行游戏的实际游玩,发现有几张地图没有被汉化,在打开工程文件去确认,发现地图内所有东西都已经被汉化完毕了。
把所有地图浏览了一遍,没有发现同样的地图,于是乎就把地图删了,发现没有地图的情况下游戏依旧能读取在这个地图存的档。
最后在游戏内一个叫Patches的文件夹里面发现了个.rvdata2格式的东西但是不知道该如何打开。只要是这东西在Patches文件夹下我把那张没汉化的地图删掉他都能照常打开。

我试着把这个文件改名成Map001.rvdata2,但是读不出来,而且这东西影响的好像不止一张地图。
请问这种情况我该如何处理
作者: 红泥杂货铺    时间: 2024-1-3 02:50
脚本名字叫Yami Engine Ace - Patch System但是我不知道这东西怎么用
作者: 红泥杂货铺    时间: 2024-1-3 11:17
  1. #==============================================================================
  2. #
  3. # �� Yami Engine Ace - Patch System
  4. # -- Last Updated: 2012.04.06
  5. # -- Level: Hard
  6. # -- Requires: Yami Engine Ace - Basic Module
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YSE-PatchSystem"] = true

  11. #==============================================================================
  12. # �� Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.04.06 - Changed fake-patch detection.
  15. # 2012.03.17 - Released Full version.
  16. # 2012.03.04 - Released Open Beta version.
  17. # 2012.03.01 - Started Script.
  18. #
  19. #==============================================================================
  20. # �� Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This script will generate patch files for your game and make your game read
  23. # it to update things.
  24. #
  25. #==============================================================================
  26. # �� Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below �� Materials/�f�� but above �� Main. Remember to save.
  30. #
  31. # To open Patch Maker, use this custom script: (Use Script in Event)
  32. #---------------------------
  33. #    YSE.patch_start
  34. #---------------------------
  35. #
  36. #==============================================================================
  37. # �� Compatibility
  38. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  39. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  40. # it will run with RPG Maker VX without adjusting.
  41. #
  42. # Do not compress patch files in any methods.
  43. #
  44. #==============================================================================

  45. #==============================================================================
  46. # �� Configuration
  47. #==============================================================================

  48. module YSE
  49.   module PATCH_SYSTEM
  50.    
  51.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  52.     # - Save Data Configuration -
  53.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  54.     SAVE_CONFIGURATION = { # Start here.
  55.       :path          =>  "Patches",
  56.       :prefix_name   =>  "Patch",
  57.     } # Do not delete this.
  58.    
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.     # - Load Data Configuration -
  61.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  62.     LOAD_CONFIGURATION = { # Start here.
  63.       :load_test      =>  true, # Load Patches when Test.
  64.       :quit_fake      =>  true, # Quit Game when detected Fake Patches.
  65.       :check_patch    =>  true,
  66.     } # Do not delete this.

  67.   end
  68. end

  69. #==============================================================================
  70. # �� Editting anything past this point may potentially result in causing
  71. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  72. # halitosis so edit at your own risk.
  73. #==============================================================================

  74. #==============================================================================
  75. # �� YSE - Patch Module
  76. #==============================================================================

  77. module YSE
  78.   module PATCH_SYSTEM
  79.    
  80.     #--------------------------------------------------------------------------
  81.     # load_map_data
  82.     #--------------------------------------------------------------------------
  83.     def self.load_map_data(map_id)
  84.       result = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  85.       result
  86.     end
  87.    
  88.     #--------------------------------------------------------------------------
  89.     # slice_data
  90.     #--------------------------------------------------------------------------
  91.     def self.slice_data(data)
  92.       # Preparing Output
  93.       result = {}
  94.       actors = {}
  95.       classes = {}
  96.       skills = {}
  97.       items = {}
  98.       weapons = {}
  99.       armors = {}
  100.       enemies = {}
  101.       troops = {}
  102.       states = {}
  103.       animations = {}
  104.       map_data = {}
  105.       tileset = {}
  106.       common_event = {}
  107.       # Analyzing Data
  108.       data.each { |key, value|
  109.         case key
  110.         when /(?:common_event)(\d+)?/i
  111.           common_event[$1] = value
  112.         when /(?:tileset)(\d+)?/i
  113.           tileset[$1] = value
  114.         when /(?:map)(\d+)/i
  115.           map_data[$1] = value
  116.         when /(?:map_info)/i
  117.           map_data[:map_info] = value
  118.         when /(?:actors)(\d+)/i
  119.           actors[$1] = value
  120.         when /(?:classes)(\d+)/i
  121.           classes[$1] = value
  122.         when /(?:skills)(\d+)/i
  123.           skills[$1] = value
  124.         when /(?:items)(\d+)/i
  125.           items[$1] = value
  126.         when /(?:weapons)(\d+)/i
  127.           weapons[$1] = value
  128.         when /(?:armors)(\d+)/i
  129.           armors[$1] = value
  130.         when /(?:enemies)(\d+)/i
  131.           enemies[$1] = value
  132.         when /(?:troops)(\d+)/i
  133.           troops[$1] = value
  134.         when /(?:states)(\d+)/i
  135.           states[$1] = value
  136.         when /(?:animations)(\d+)/i
  137.           animations[$1] = value
  138.         end
  139.       }
  140.       # Combining Data
  141.       result[:common_event] = common_event
  142.       result[:tileset] = tileset
  143.       result[:map_data] = map_data
  144.       result[:actors] = actors
  145.       result[:classes] = classes
  146.       result[:skills] = skills
  147.       result[:items] = items
  148.       result[:weapons] = weapons
  149.       result[:armors] = armors
  150.       result[:enemies] = enemies
  151.       result[:troops] = troops
  152.       result[:states] = states
  153.       result[:animations] = animations
  154.       result
  155.     end
  156.    
  157.   end # PATCH_SYSTEM
  158. end # YSE

  159. #==============================================================================
  160. # �� DataManager
  161. #==============================================================================

  162. module DataManager
  163.   
  164.   #--------------------------------------------------------------------------
  165.   # alias method: load_normal_database
  166.   #--------------------------------------------------------------------------
  167.   class<<self; alias datamanager_patch_yse_load_normal_database load_normal_database; end
  168.   def self.load_normal_database
  169.     datamanager_patch_yse_load_normal_database
  170.     return unless YSE::PATCH_SYSTEM::LOAD_CONFIGURATION[:load_test]
  171.     load_patch_database
  172.   end
  173.   
  174.   #--------------------------------------------------------------------------
  175.   # new method: load_patch_database
  176.   #--------------------------------------------------------------------------
  177.   def self.load_patch_database
  178.     $data_maps_patch = {}
  179.     # Load Directory
  180.     dir = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:path]
  181.     prefix = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:prefix_name]
  182.     begin
  183.       directory = Dir.open("./#{dir}")
  184.     rescue
  185.       Dir.mkdir("./#{dir}", 0777)
  186.       directory = Dir.open("./#{dir}")
  187.     end
  188.     directory.each { |filename|
  189.       if filename =~ /(?:#{prefix})(\d+)?(?:.*)/i
  190.         YSE.load_data("./#{dir}/#{filename}", method(:extract_patch_data), 0, :mtime)
  191.       end
  192.     }
  193.   end
  194.   
  195.   #--------------------------------------------------------------------------
  196.   # new method: check_hash
  197.   #--------------------------------------------------------------------------
  198.   def self.check_hash(data)
  199.     return unless YSE::PATCH_SYSTEM::LOAD_CONFIGURATION[:check_patch]
  200.     return unless data["time"]
  201.     real_check = YSE.make_hash(data["time"])
  202.     return if data["hash"] == real_check
  203.     msg = "System detected a fake patch. Filename: #{data["filename"]}.\n"
  204.     msg += "Please delete that file or you will take your own risk.\n"
  205.     msg += "Thank you."
  206.     YSE.message_box("Fake Patch Detected!", msg)
  207.     exit if YSE::PATCH_SYSTEM::LOAD_CONFIGURATION[:quit_fake]
  208.   end
  209.   
  210.   #--------------------------------------------------------------------------
  211.   # new method: extract_patch_data
  212.   #--------------------------------------------------------------------------
  213.   def self.extract_patch_data(data, mtime)
  214.     # Checking hash
  215.     check_hash(data)
  216.     # Slice Data
  217.     temp = YSE::PATCH_SYSTEM.slice_data(data)
  218.     common_event = temp[:common_event]
  219.     tileset = temp[:tileset]
  220.     map_data = temp[:map_data]
  221.     actors = temp[:actors]
  222.     classes = temp[:classes]
  223.     skills = temp[:skills]
  224.     items = temp[:items]
  225.     weapons = temp[:weapons]
  226.     armors = temp[:armors]
  227.     enemies = temp[:enemies]
  228.     troops = temp[:troops]
  229.     states = temp[:states]
  230.     animations = temp[:animations]
  231.     # Common Events
  232.     common_event.each { |key, value|
  233.       next if value.nil?
  234.       $data_common_events[key.to_i] = value
  235.     }
  236.     # Database
  237.     tileset.each { |key, value|
  238.       next if value.nil?
  239.       $data_tilesets[key.to_i] = value
  240.     }
  241.     actors.each { |key, value|
  242.       next if value.nil?
  243.       $data_actors[key.to_i] = value
  244.     }
  245.     classes.each { |key, value|
  246.       next if value.nil?
  247.       $data_classes[key.to_i] = value
  248.     }
  249.     skills.each { |key, value|
  250.       next if value.nil?
  251.       $data_skills[key.to_i] = value
  252.     }
  253.     items.each { |key, value|
  254.       next if value.nil?
  255.       $data_items[key.to_i] = value
  256.     }
  257.     weapons.each { |key, value|
  258.       next if value.nil?
  259.       $data_weapons[key.to_i] = value
  260.     }
  261.     armors.each { |key, value|
  262.       next if value.nil?
  263.       $data_armors[key.to_i] = value
  264.     }
  265.     enemies.each { |key, value|
  266.       next if value.nil?
  267.       $data_enemies[key.to_i] = value
  268.     }
  269.     troops.each { |key, value|
  270.       next if value.nil?
  271.       $data_troops[key.to_i] = value
  272.     }
  273.     states.each { |key, value|
  274.       next if value.nil?
  275.       $data_states[key.to_i] = value
  276.     }
  277.     animations.each { |key, value|
  278.       next if value.nil?
  279.       $data_animations[key.to_i] = value
  280.     }
  281.     # Maps
  282.     $data_mapinfos = map_data[:map_info] if map_data[:map_info]
  283.     map_data.delete(:map_info)
  284.     $data_maps_patch = map_data
  285.   end
  286.   
  287.   #--------------------------------------------------------------------------
  288.   # alias method: reload_map_if_updated
  289.   #--------------------------------------------------------------------------
  290.   class<<self; alias datamanager_patch_yse_reload_map_if_updated reload_map_if_updated; end
  291.   def self.reload_map_if_updated
  292.     datamanager_patch_yse_reload_map_if_updated
  293.     reload_map_if_patched
  294.   end
  295.   
  296.   #--------------------------------------------------------------------------
  297.   # new method: reload_map_if_patched
  298.   #--------------------------------------------------------------------------
  299.   def self.reload_map_if_patched
  300.     unless $data_maps_patch[$game_map.map_id].nil?
  301.       $game_map.setup($game_map.map_id)
  302.       $game_player.center($game_player.x, $game_player.y)
  303.       $game_player.make_encounter_count
  304.     end
  305.   end
  306.   
  307. end # DataManager

  308. #==============================================================================
  309. # �� Game_Map
  310. #==============================================================================

  311. class Game_Map
  312.   
  313.   #--------------------------------------------------------------------------
  314.   # overwrite method: setup
  315.   #--------------------------------------------------------------------------
  316.   def setup(map_id)
  317.     @map_id = map_id
  318.     if $data_maps_patch.nil? || $data_maps_patch[map_id.to_s].nil?
  319.       @map = load_data(sprintf("Data/Map%03d.rvdata2", @map_id))
  320.     else
  321.       @map = $data_maps_patch[map_id.to_s]
  322.     end
  323.     @tileset_id = @map.tileset_id
  324.     @display_x = 0
  325.     @display_y = 0
  326.     referesh_vehicles
  327.     setup_events
  328.     setup_scroll
  329.     setup_parallax
  330.     setup_battleback
  331.     @need_refresh = false
  332.   end
  333.   
  334. end # Game_Map

  335. #==============================================================================
  336. # �� Window_Patch_Base
  337. #==============================================================================

  338. class Window_Patch_Base < Window_Selectable
  339.   
  340.   #--------------------------------------------------------------------------
  341.   # initialize
  342.   #--------------------------------------------------------------------------
  343.   def initialize
  344.     super((Graphics.width - 408) / 2, (Graphics.height - 344) / 2, 408, 344)
  345.     @data = []
  346.     refresh
  347.   end
  348.   
  349.   #--------------------------------------------------------------------------
  350.   # item_max
  351.   #--------------------------------------------------------------------------
  352.   def item_max
  353.     return @data.nil? ? 1 : @data.size
  354.   end
  355.   
  356.   #--------------------------------------------------------------------------
  357.   # item_max
  358.   #--------------------------------------------------------------------------
  359.   def make_data_list
  360.     # Loading Data.
  361.   end
  362.   
  363.   #--------------------------------------------------------------------------
  364.   # highlight
  365.   #--------------------------------------------------------------------------
  366.   def highlight(index)
  367.     # Highlight Data.
  368.   end
  369.   
  370.   #--------------------------------------------------------------------------
  371.   # draw_item
  372.   #--------------------------------------------------------------------------
  373.   def draw_item(index)
  374.     name = @data[index]
  375.     rect = item_rect(index)
  376.     rect.width -= 4
  377.     change_color(normal_color)
  378.     rect.x += 4
  379.     draw_text(rect, "#{index + 1}, ", 0)
  380.     change_color(normal_color)
  381.     change_color(Color.new(100,100,100)) unless highlight(index)
  382.     rect.x += 40
  383.     draw_text(rect, "#{name}", 0)
  384.     change_color(Color.new(255,175,175))
  385.     rect.x -= 44
  386.     draw_text(rect, sprintf("(ID: %03d)", index + 1), 2)
  387.   end
  388.   
  389.   #--------------------------------------------------------------------------
  390.   # refresh
  391.   #--------------------------------------------------------------------------
  392.   def refresh
  393.     make_data_list
  394.     create_contents
  395.     draw_all_items
  396.   end
  397.   
  398.   #--------------------------------------------------------------------------
  399.   # refresh
  400.   #--------------------------------------------------------------------------
  401.   def set_on_off
  402.     # Set on/off
  403.   end
  404.   
  405. end # Window_Patch_Base

  406. #==============================================================================
  407. # �� Window_Patch_Maps
  408. #==============================================================================

  409. class Window_Patch_Maps < Window_Patch_Base
  410.   
  411.   #--------------------------------------------------------------------------
  412.   # initialize
  413.   #--------------------------------------------------------------------------
  414.   def initialize
  415.     $patch_map_temp = []
  416.     super
  417.   end
  418.   
  419.   #--------------------------------------------------------------------------
  420.   # make_data_list
  421.   #--------------------------------------------------------------------------
  422.   def make_data_list
  423.     $data_mapinfos.each { |key, value|
  424.       @data.push(value.name)
  425.     }
  426.   end
  427.   
  428.   #--------------------------------------------------------------------------
  429.   # highlight
  430.   #--------------------------------------------------------------------------
  431.   def highlight(index)
  432.     $patch_map_temp.include?(index + 1)
  433.   end
  434.   
  435.   #--------------------------------------------------------------------------
  436.   # set_on_off
  437.   #--------------------------------------------------------------------------
  438.   def set_on_off
  439.     if $patch_map_temp.include?(index + 1)
  440.       $patch_map_temp.delete(index + 1)
  441.       draw_item(index)
  442.     else
  443.       $patch_map_temp.push(index + 1)
  444.       draw_item(index)
  445.     end
  446.   end
  447.   
  448. end # Window_Patch_Maps

  449. #==============================================================================
  450. # �� Window_Patch_Common_Event
  451. #==============================================================================

  452. class Window_Patch_Common_Event < Window_Patch_Base
  453.   
  454.   #--------------------------------------------------------------------------
  455.   # initialize
  456.   #--------------------------------------------------------------------------
  457.   def initialize
  458.     $patch_ce_temp = []
  459.     super
  460.   end
  461.   
  462.   #--------------------------------------------------------------------------
  463.   # make_data_list
  464.   #--------------------------------------------------------------------------
  465.   def make_data_list
  466.     $data_common_events.each { |value|
  467.       next if value.nil?
  468.       @data.push(value.name)
  469.     }
  470.   end
  471.   
  472.   #--------------------------------------------------------------------------
  473.   # highlight
  474.   #--------------------------------------------------------------------------
  475.   def highlight(index)
  476.     $patch_ce_temp.include?(index + 1)
  477.   end
  478.   
  479.   #--------------------------------------------------------------------------
  480.   # refresh
  481.   #--------------------------------------------------------------------------
  482.   def set_on_off
  483.     if $patch_ce_temp.include?(index + 1)
  484.       $patch_ce_temp.delete(index + 1)
  485.       draw_item(index)
  486.     else
  487.       $patch_ce_temp.push(index + 1)
  488.       draw_item(index)
  489.     end
  490.   end
  491.   
  492. end # Window_Patch_Common_Event

  493. #==============================================================================
  494. # �� Window_Patch_Tileset
  495. #==============================================================================

  496. class Window_Patch_Tileset < Window_Patch_Base
  497.   
  498.   #--------------------------------------------------------------------------
  499.   # initialize
  500.   #--------------------------------------------------------------------------
  501.   def initialize
  502.     $patch_ts_temp = []
  503.     super
  504.   end
  505.   
  506.   #--------------------------------------------------------------------------
  507.   # make_data_list
  508.   #--------------------------------------------------------------------------
  509.   def make_data_list
  510.     $data_tilesets.each { |value|
  511.       next if value.nil?
  512.       @data.push(value.name)
  513.     }
  514.   end
  515.   
  516.   #--------------------------------------------------------------------------
  517.   # highlight
  518.   #--------------------------------------------------------------------------
  519.   def highlight(index)
  520.     $patch_ts_temp.include?(index + 1)
  521.   end
  522.   
  523.   #--------------------------------------------------------------------------
  524.   # refresh
  525.   #--------------------------------------------------------------------------
  526.   def set_on_off
  527.     if $patch_ts_temp.include?(index + 1)
  528.       $patch_ts_temp.delete(index + 1)
  529.       draw_item(index)
  530.     else
  531.       $patch_ts_temp.push(index + 1)
  532.       draw_item(index)
  533.     end
  534.   end
  535.   
  536. end # Window_Patch_Tileset

  537. PATCH_HASH_NAME = ["Actors", "Classes", "Skills", "Items", "Weapons", "Armors",
  538.                    "Enemies", "Troops", "States", "Animations"]
  539. PATCH_HASH_NAME.each { |patch_name|
  540.   cStr = %Q(
  541.   class Window_Patch_#{patch_name} < Window_Patch_Base
  542.    
  543.     #--------------------------------------------------------------------------
  544.     # initialize
  545.     #--------------------------------------------------------------------------
  546.     def initialize
  547.       $patch_#{patch_name.downcase}_temp = []
  548.       super
  549.     end
  550.    
  551.     #--------------------------------------------------------------------------
  552.     # make_data_list
  553.     #--------------------------------------------------------------------------
  554.     def make_data_list
  555.       $data_#{patch_name.downcase}.each { |value|
  556.         next if value.nil?
  557.         @data.push(value.name)
  558.       }
  559.     end
  560.    
  561.     #--------------------------------------------------------------------------
  562.     # highlight
  563.     #--------------------------------------------------------------------------
  564.     def highlight(index)
  565.       $patch_#{patch_name.downcase}_temp.include?(index + 1)
  566.     end
  567.    
  568.     #--------------------------------------------------------------------------
  569.     # refresh
  570.     #--------------------------------------------------------------------------
  571.     def set_on_off
  572.       if $patch_#{patch_name.downcase}_temp.include?(index + 1)
  573.         $patch_#{patch_name.downcase}_temp.delete(index + 1)
  574.         draw_item(index)
  575.       else
  576.         $patch_#{patch_name.downcase}_temp.push(index + 1)
  577.         draw_item(index)
  578.       end
  579.     end
  580.    
  581.   end
  582.   )
  583.   eval(cStr)
  584. }

  585. #==============================================================================
  586. # �� Window_Patch_Command
  587. #==============================================================================

  588. class Window_Patch_Command < Window_Command
  589.   
  590.   #--------------------------------------------------------------------------
  591.   # initialize
  592.   #--------------------------------------------------------------------------
  593.   def initialize
  594.     super(0, (Graphics.height - fitting_height(4)) / 2)
  595.   end
  596.   
  597.   #--------------------------------------------------------------------------
  598.   # window_width
  599.   #--------------------------------------------------------------------------
  600.   def window_width
  601.     return Graphics.width
  602.   end
  603.   
  604.   #--------------------------------------------------------------------------
  605.   # visible_line_number
  606.   #--------------------------------------------------------------------------
  607.   def visible_line_number
  608.     return 4
  609.   end
  610.   
  611.   #--------------------------------------------------------------------------
  612.   # col_max
  613.   #--------------------------------------------------------------------------
  614.   def col_max
  615.     4
  616.   end
  617.   
  618.   #--------------------------------------------------------------------------
  619.   # make_command_list
  620.   #--------------------------------------------------------------------------
  621.   def make_command_list
  622.     add_command("Maps", :maps, true)
  623.     add_command("Common Events", :ce, true)
  624.     add_command("Tilesets", :ts, true)
  625.     PATCH_HASH_NAME.each { |patch_name|
  626.       cStr = "add_command(\"#{patch_name}\", :#{patch_name.downcase}, true)"
  627.       eval(cStr)
  628.     }
  629.     add_command("Patch!", :patch, true)
  630.     add_command("Patch All Things", :patch_all, true)
  631.     add_command("Exit", :cancel, true)
  632.   end

  633. end # Window_Patch_Command

  634. #==============================================================================
  635. # �� Scene_Patch_YSE
  636. #==============================================================================

  637. class Scene_Patch_YSE < Scene_Base
  638.   
  639.   #--------------------------------------------------------------------------
  640.   # start
  641.   #--------------------------------------------------------------------------
  642.   def start
  643.     super
  644.     create_all_windows
  645.     @command_window.activate
  646.     @command_window.select(0)
  647.   end
  648.   
  649.   #--------------------------------------------------------------------------
  650.   # create_all_windows
  651.   #--------------------------------------------------------------------------
  652.   def create_all_windows
  653.     #---
  654.     @command_window = Window_Patch_Command.new
  655.     @command_window.viewport = @viewport
  656.     @command_window.set_handler(:maps,    method(:patch_maps))
  657.     @command_window.set_handler(:ts,    method(:patch_tileset))
  658.     @command_window.set_handler(:ce,    method(:patch_common_event))
  659.     @command_window.set_handler(:patch,    method(:apply_patch))
  660.     @command_window.set_handler(:patch_all,    method(:apply_patch_all))
  661.     PATCH_HASH_NAME.each { |patch_name|
  662.       cStr = "@command_window.set_handler(:#{patch_name.downcase},    method(:patch_#{patch_name.downcase}))"
  663.       eval(cStr)
  664.     }
  665.     @command_window.set_handler(:cancel,   method(:return_scene))
  666.     #---
  667.     @maps_window = Window_Patch_Maps.new
  668.     @maps_window.viewport = @viewport
  669.     @maps_window.set_handler(:ok,    method(:on_maps_ok))
  670.     @maps_window.set_handler(:cancel,   method(:on_maps_cancel))
  671.     @maps_window.close
  672.     #---
  673.     PATCH_HASH_NAME.each { |patch_name|
  674.       cStr = %Q(
  675.         @#{patch_name.downcase}_window = Window_Patch_#{patch_name}.new
  676.         @#{patch_name.downcase}_window.viewport = @viewport
  677.         @#{patch_name.downcase}_window.set_handler(:ok,    method(:on_#{patch_name.downcase}_ok))
  678.         @#{patch_name.downcase}_window.set_handler(:cancel,   method(:on_#{patch_name.downcase}_cancel))
  679.         @#{patch_name.downcase}_window.close
  680.       )
  681.       eval(cStr)
  682.     }
  683.     #---
  684.     @ce_window = Window_Patch_Common_Event.new
  685.     @ce_window.viewport = @viewport
  686.     @ce_window.set_handler(:ok,    method(:on_ce_ok))
  687.     @ce_window.set_handler(:cancel,   method(:on_ce_cancel))
  688.     @ce_window.close
  689.     #---
  690.     @ts_window = Window_Patch_Tileset.new
  691.     @ts_window.viewport = @viewport
  692.     @ts_window.set_handler(:ok,    method(:on_ts_ok))
  693.     @ts_window.set_handler(:cancel,   method(:on_ts_cancel))
  694.     @ts_window.close
  695.   end
  696.   
  697.   #--------------------------------------------------------------------------
  698.   # patch_maps
  699.   #--------------------------------------------------------------------------
  700.   def patch_maps
  701.     @command_window.deactivate
  702.     @maps_window.open
  703.     @maps_window.activate
  704.     @maps_window.select(0)
  705.   end
  706.   
  707.   #--------------------------------------------------------------------------
  708.   # patch_tileset
  709.   #--------------------------------------------------------------------------
  710.   def patch_tileset
  711.     @command_window.deactivate
  712.     @ts_window.open
  713.     @ts_window.activate
  714.     @ts_window.select(0)
  715.   end
  716.   
  717.   #--------------------------------------------------------------------------
  718.   # patch_common_event
  719.   #--------------------------------------------------------------------------
  720.   def patch_common_event
  721.     @command_window.deactivate
  722.     @ce_window.open
  723.     @ce_window.activate
  724.     @ce_window.select(0)
  725.   end
  726.   
  727.   PATCH_HASH_NAME.each { |patch_name|
  728.     cStr = %Q(
  729.     def patch_#{patch_name.downcase}
  730.       @command_window.deactivate
  731.       @#{patch_name.downcase}_window.open
  732.       @#{patch_name.downcase}_window.activate
  733.       @#{patch_name.downcase}_window.select(0)
  734.     end
  735.     )
  736.     module_eval(cStr)
  737.   }
  738.   
  739.   #--------------------------------------------------------------------------
  740.   # on_maps_ok
  741.   #--------------------------------------------------------------------------
  742.   def on_maps_ok
  743.     @maps_window.set_on_off
  744.     @maps_window.activate
  745.   end
  746.   
  747.   #--------------------------------------------------------------------------
  748.   # on_maps_ok
  749.   #--------------------------------------------------------------------------
  750.   def on_maps_cancel
  751.     @maps_window.deactivate
  752.     @maps_window.close
  753.     @command_window.activate
  754.   end
  755.   
  756.   PATCH_HASH_NAME.each { |patch_name|
  757.     cStr = %Q(
  758.     def on_#{patch_name.downcase}_ok
  759.       @#{patch_name.downcase}_window.set_on_off
  760.       @#{patch_name.downcase}_window.activate
  761.     end
  762.     def on_#{patch_name.downcase}_cancel
  763.       @#{patch_name.downcase}_window.deactivate
  764.       @#{patch_name.downcase}_window.close
  765.       @command_window.activate
  766.     end
  767.     )
  768.     module_eval(cStr)
  769.   }
  770.   
  771.   #--------------------------------------------------------------------------
  772.   # on_ce_ok
  773.   #--------------------------------------------------------------------------
  774.   def on_ce_ok
  775.     @ce_window.set_on_off
  776.     @ce_window.activate
  777.   end
  778.   
  779.   #--------------------------------------------------------------------------
  780.   # on_ce_cancel
  781.   #--------------------------------------------------------------------------
  782.   def on_ce_cancel
  783.     @ce_window.deactivate
  784.     @ce_window.close
  785.     @command_window.activate
  786.   end
  787.   
  788.   #--------------------------------------------------------------------------
  789.   # on_ts_ok
  790.   #--------------------------------------------------------------------------
  791.   def on_ts_ok
  792.     @ts_window.set_on_off
  793.     @ts_window.activate
  794.   end
  795.   
  796.   #--------------------------------------------------------------------------
  797.   # on_ts_cancel
  798.   #--------------------------------------------------------------------------
  799.   def on_ts_cancel
  800.     @ts_window.deactivate
  801.     @ts_window.close
  802.     @command_window.activate
  803.   end
  804.   
  805.   #--------------------------------------------------------------------------
  806.   # apply_patch
  807.   #--------------------------------------------------------------------------
  808.   def apply_patch
  809.     dir = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:path]
  810.     prefix = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:prefix_name]
  811.     time = Time.now.strftime("%s")
  812.     filename = YSE.make_filename("#{prefix}#{time}", dir)
  813.     @temporary = {}
  814.     $patch_map_temp.each { |id|
  815.       next if id.nil?
  816.       map_data = YSE::PATCH_SYSTEM.load_map_data(id)
  817.       @temporary["map#{id}"] = map_data
  818.       @temporary["map_info"] = $data_mapinfos
  819.     }
  820.     $patch_ce_temp.each { |id|
  821.       next if id.nil?
  822.       @temporary["common_event#{id}"] = $data_common_events[id]
  823.     }
  824.     $patch_ts_temp.each { |id|
  825.       next if id.nil?
  826.       @temporary["tileset#{id}"] = $data_tilesets[id]
  827.     }
  828.     PATCH_HASH_NAME.each { |patch_name|
  829.       cStr = %Q(
  830.         $patch_#{patch_name.downcase}_temp.each { |id|
  831.           next if id.nil?
  832.           @temporary["#{patch_name.downcase}"+id.to_s] = $data_#{patch_name.downcase}[id]
  833.         }
  834.       )
  835.       eval(cStr)
  836.     }
  837.     @temporary["hash"] = YSE.make_hash(time)
  838.     @temporary["time"] = time
  839.     @temporary["filename"] = filename
  840.     YSE.save_data(filename, @temporary)
  841.     YSE.message_box("Patch System","Create Patch Complete! Location: #{filename}. Click OK to Exit.")
  842.     exit
  843.   end
  844.   
  845.   #--------------------------------------------------------------------------
  846.   # apply_patch_all
  847.   #--------------------------------------------------------------------------
  848.   def apply_patch_all
  849.     $data_mapinfos.each_key { |i|
  850.       next if i == 0
  851.       $patch_map_temp.push(i)
  852.     }
  853.     $data_common_events.size.times { |i|
  854.       next if i == 0
  855.       $patch_ce_temp.push(i)
  856.     }
  857.     $data_tilesets.size.times { |i|
  858.       next if i == 0
  859.       $patch_ts_temp.push(i)
  860.     }
  861.     PATCH_HASH_NAME.each { |patch_name|
  862.       cStr = %Q(
  863.         $data_#{patch_name.downcase}.size.times { |i|
  864.           next if i == 0
  865.           $patch_#{patch_name.downcase}_temp.push(i)
  866.         }
  867.       )
  868.       eval(cStr)
  869.     }
  870.     apply_patch
  871.   end
  872.   
  873. end # Scene_Patch_YSE

  874. #==============================================================================
  875. #
  876. # �� End of File
  877. #
  878. #==============================================================================
复制代码

东西怎么操作我是学会了.........这是原始代码,请问这东西该如何读取已经写好的补丁.......
作者: 百里_飞柳    时间: 2024-1-3 22:36
本帖最后由 百里_飞柳 于 2024-1-3 22:42 编辑

这个补丁的原理好耿直……

是提供了一个Scene,其中可以选择哪些(角色、物品、公共事件等数据库内容,还有地图)需要被打包到一起生成一个名为Patch的文件,
然后游戏开始时,在读取了原有数据的基础上,再解包Patch文件,再逐个判定其中的内容并覆盖原有数据

我能想到的方法就是游戏开始后,DataManager 里从这些rvdata文件利用 load_data 读取后,再等这个Patch也读取覆盖后(load_patch_database),
利用RGSS3的 sava_data 方法,又把这些数据重新一个个写回文件里

比如读取时是这样
$data_actors        = load_data("Data/Actors.rvdata2")

那写回时这样
save_data($data_actors, "Data2/Actors.rvdata2")
记得新建个 Data2 文件夹,防止出错……

相当于你手动帮它应用完这些Patch,搞一组新的rvdata文件,最后再删掉Patch文件




以上是数据库内容,地图的话更耿直了

它是把打包后的地图导出后存入了全局变量 $data_maps_patch 这个哈希表里,键是 map_id.to_s 地图ID的字符串,值就是 load_data(sprintf("Data/Map%03d.rvdata2", @map_id)) 后的地图数据
你迭代这个哈希表,然后一个个 save_data( $data_maps_patch[map_id.to_s],  sprintf("Data2/Map%03d.rvdata2", map_id) ) 吧




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1