[RPG Maker XP] How to use this Encryption Script

Started by Aegisrox, February 16, 2013, 04:17:18 pm

Previous topic - Next topic

Aegisrox

Hello members of chaos project! I am writing because while i was surfing internet i found a script to encrypt data in RPG Maker.  8)

The problem is that i have no idea how to use it  :^_^':

There are the instructions but i dont know much about scripting, and i have no idea to do.

If you like you can try it, This is the site

https://github.com/Repflez/RPG-Maker-Scripts/tree/master/MakerCrypt

Please if your discover how to make it works, please reply this topic and share with the community :D

Thanks in advance

My best regards

Chevalsky
Crushing girls in the vanishing point......

ThallionDarkshine

February 16, 2013, 04:30:46 pm #1 Last Edit: February 16, 2013, 04:55:02 pm by ThallionDarkshine
This looks like its meant to be used as part of a save system addon or something. I'll try to write something to go with it.

Edit - I made a quick save/load system mod to use this system for save files. However, this doesn't look very secure and I would recommend that you use DREAM by Blizzard. It's in the script database and I'm pretty sure that it's much better than this script.

Spoiler: ShowHide

class Scene_Save
  def on_decision(filename)
    # Play save SE
    $game_system.se_play($data_system.save_se)
    # Write save data
    file = File.open(filename, "wb")
    write_save_data(file)
    file.close
    MakerCrypt.encrypt(filename)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Menu.new(4)
  end
end

class Scene_Load
  def on_decision(filename)
    # If file doesn't exist
    unless FileTest.exist?(filename)
      # Play buzzer SE
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # Play load SE
    $game_system.se_play($data_system.load_se)
    # Read save data
    MakerCrypt.decrypt(filename)
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    MakerCrypt.encrypt(filename)
    # Restore BGM and BGS
    $game_system.bgm_play($game_system.playing_bgm)
    $game_system.bgs_play($game_system.playing_bgs)
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $scene = Scene_Map.new
  end
end

class Window_SaveFile
  def initialize(file_index, filename)
    super(0, 64 + file_index % 4 * 104, 640, 104)
    self.contents = Bitmap.new(width - 32, height - 32)
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.rxdata"
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      MakerCrypt.decrypt(@filename)
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      @characters = Marshal.load(file)
      @frame_count = Marshal.load(file)
      @game_system = Marshal.load(file)
      @game_switches = Marshal.load(file)
      @game_variables = Marshal.load(file)
      @total_sec = @frame_count / Graphics.frame_rate
      file.close
      MakerCrypt.encrypt(@filename)
    end
    refresh
    @selected = false
  end
end

Aegisrox

Thanks for your answer ThallionDarkshine!

One question! How can i use DREAM to encrypt my data folder?

My best regards

Chevalsky
Crushing girls in the vanishing point......

ThallionDarkshine

February 16, 2013, 08:01:28 pm #3 Last Edit: February 16, 2013, 08:05:56 pm by ThallionDarkshine
You don't have to. It gets automatically put in the Game.rgsaad file when you encrypt your game.