Vai al contenuto


Toggle Chat RM - Chat Apri la Chat in un popup

E' severamente vietato richiedere supporto su RPG Maker in chat!
@  Melosx : (25 May 2012 - 08:30 PM) Buonasera a tutti
@  Hashmin : (25 May 2012 - 02:15 PM) ciao a tt!
@  Pech93 : (24 May 2012 - 01:55 PM) ho aggiunto delle composizioni originali!!! Chi le vuole ascoltare e dare qualche commento costruttivo?
@  MihaChan : (23 May 2012 - 09:19 PM) a parte i denti -che stanno decidendo di darmi noia in questi giorni-, tutto okay~
@  Melosx : (23 May 2012 - 09:18 PM) bene ^.^ ... Tu??
@  MihaChan : (23 May 2012 - 09:17 PM) come va? xD
@  MihaChan : (23 May 2012 - 09:16 PM) okay
@  MihaChan : (23 May 2012 - 09:16 PM) ah
@  Melosx : (23 May 2012 - 09:14 PM) ciao miha... ai dont spic inglisc
@  MihaChan : (23 May 2012 - 09:12 PM) how'sa goin'?
@  MihaChan : (23 May 2012 - 09:12 PM) ciao Mel!
@  Melosx : (23 May 2012 - 09:07 PM) ciao
@  MihaChan : (23 May 2012 - 09:06 PM) salve D:
@  Pech93 : (23 May 2012 - 08:05 PM) MIk?
@  Melosx : (23 May 2012 - 07:51 PM) VIENI SU MSN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@  Melosx : (23 May 2012 - 07:51 PM) MIIIIIIIIIIIIIIIIIIIKKKKKKKKKKKK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@  Melosx : (23 May 2012 - 07:46 PM) *iù
@  Melosx : (23 May 2012 - 07:38 PM) iu spin mi rai rau bebi rai rau laic a record bebi rau rau rau rau
@  Melosx : (23 May 2012 - 07:37 PM) lalalallalallalallallllllllllalalalallaaaaaaaaaaaaaaaaaaaaaa!!!!!!!!!!!!!!!!!!
@  Melosx : (23 May 2012 - 07:37 PM) lalalalala

RVDATA2 Compressor


  • Per cortesia connettiti per rispondere
Nessuna risposta a questa discussione

#1 OFFLINE   Ally

Ally

    Fondatori

  • Amministratori
  • 5558 Messaggi:
  • Localitàrpgmkr
  • Ruolo:
    Scripter
  • Progetto VX:
    Essence
  • Tool:
    RM2k/2k3

Inviato 03 February 2012 - 11:25 PM

Nome Script: RVDATA2 Compressor
Versione: Jet
Autore/i: N/D

Informazioni:
Lo script permette di diminuire il peso di compressione dei file =)

Istruzioni:
Inserite lo script sotto Material.
Istruzioni all'interno dello script.

Script:
#===============================================================================
# RVDATA2 Compression
# By Jet10985 (Jet)
#===============================================================================
# This script will compress .rvdata2 files in your data directory, to save space. 
# This script also compresses new save files.
# This script has: 0 customization options.
#===============================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# Object: load_data, save_data
# DataManager: load_game, save_game, load_header
#===============================================================================
=begin
This script will compress .rvdata2 everytime the game is started in TEST MODE.
This is to make sure the files are of the latest version.
--------------------------------------------------------------------------------
Before releasing your game, or releasing updates, you should run the game
in test mode to update the compressed files.

Before compiling your game, you should remove (DO NOT DELETE) the regular
.rvdata2 files.
--------------------------------------------------------------------------------
This script does not compress Scripts.rvdata2, do not remove it when you
release your game.
--------------------------------------------------------------------------------
This script will also compress save files, which means if you remove this script
and then attempt to load a save game that was made while this script was active,
it won't work.
=end

if $TEST
  array = Dir.entries("Data")
  array.each {|a|
    next if [".", ".."].include?(a)
    next unless !a.include?(".crvdata2") && !a.include?("Scripts.rvdata2")
    if File.directory?("Data/#{a}")
      Dir.entries("Data/#{a}").each {|v|
        next if [".", ".."].include?(v)
        array.push("#{a}/#{v}")
      }
      next
    end
    t = Zlib::Deflate.deflate(Marshal.dump(load_data("Data/#{a}")), 9)
    save_data(t, "Data/#{a.gsub(".rvdata2", "")}.crvdata2")
  }
end

class Object

  alias jet1828_load_data load_data
  def load_data(string)
    return $RGSS_SCRIPTS if string.include?("Scripts")
    string.gsub!(".rvdata2", ".crvdata2")
    f = Zlib::Inflate.inflate(jet1828_load_data(string))
    return Marshal.load(f)
  end
  
  alias jet1838_save_data save_data
  def save_data(var, file)
    f = Zlib::Deflate.deflate(Marshal.dump(var), 9)
    jet1838_save_data(f, "#{file.gsub(".rvdata", "")}.crvdata")
  end
end

module JetSaveMarshal
  
  def self.dump(object, io)
    Marshal.dump(Zlib::Deflate.deflate(Marshal.dump(object), 9), io)
  end
  
  def self.load(io)
    return Marshal.load(Zlib::Inflate.inflate(Marshal.load(io)))
  end
end

class << DataManager
  
  alias jet2846_save_game save_game
  def save_game(*args, &block)
    old_marshal = Object.const_get(:Marshal)
    DataManager.const_set(:Marshal, JetSaveMarshal)
    ret = jet2846_save_game(*args, &block)
    DataManager.const_set(:Marshal, old_marshal)
    return ret
  end
  
  alias jet2846_load_game load_game
  def load_game(*args, &block)
    old_marshal = Object.const_get(:Marshal)
    DataManager.const_set(:Marshal, JetSaveMarshal)
    ret = jet2846_load_game(*args, &block)
    DataManager.const_set(:Marshal, old_marshal)
    return ret
  end
  
  alias jet2846_load_header load_header
  def load_header(*args, &block)
    old_marshal = Object.const_get(:Marshal)
    DataManager.const_set(:Marshal, JetSaveMarshal)
    ret = jet2846_load_header(*args, &block)
    DataManager.const_set(:Marshal, old_marshal)
    return ret
  end
end

Immagine inserita
Spoiler




1 utente(i) stanno leggendo questa discussione

0 utenti, 1 ospiti, 0 utenti anonimi