#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # DREAM for Music Files by Blizzard # Version: 4.5 # Type: Encrpytor / Decryptor / Audio File Player # uses DREAM v4.0 or higher # Date: 19.8.2007 # Date v1.0b: 22.8.2007 # Date v1.01b: 27.8.2007 # Date v1.02b: 24.9.2007 # Date v1.03b: 14.12.2007 # Date v4.5: 23.3.2019 #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # This work is licensed under BSD License 2.0: # # #---------------------------------------------------------------------------- # # # # Copyright (c) Boris "Blizzard" Mikić # # All rights reserved. # # # # Redistribution and use in source and binary forms, with or without # # modification, are permitted provided that the following conditions are met: # # # # 1. Redistributions of source code must retain the above copyright notice, # # this list of conditions and the following disclaimer. # # # # 2. Redistributions in binary form must reproduce the above copyright # # notice, this list of conditions and the following disclaimer in the # # documentation and/or other materials provided with the distribution. # # # # 3. Neither the name of the copyright holder nor the names of its # # contributors may be used to endorse or promote products derived from # # this software without specific prior written permission. # # # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # # POSSIBILITY OF SUCH DAMAGE. # # # #---------------------------------------------------------------------------- # # You may use this script for both non-commercial and commercial products # without limitations as long as you fulfill the conditions presented by the # above license. The "complete" way to give credit is to include the license # somewhere in your product (e.g. in the credits screen), but a "simple" way # is also acceptable. The "simple" way to give credit is as follows: # # DREAM for Music Files licensed under BSD License 2.0 # Copyright (c) Boris "Blizzard" Mikić # # Alternatively, if your font doesn't support diacritic characters, you may # use this variant: # # DREAM for Music Files licensed under BSD License 2.0 # Copyright (c) Boris "Blizzard" Mikic # # In general other similar variants are allowed as long as it is clear who # the creator is (e.g. "DREAM for Music Files created by Blizzard" is # acceptable). But if possible, prefer to use one of the two variants listed # above. # # If you fail to give credit and/or claim that this work was created by you, # this may result in legal action and/or payment of damages even though this # work is free of charge to use normally. # #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # DO TOUCH THE VALUE BELOW! If you change the required version to a lower # value your script WILL malfunction, because older DREAM version don't have # all the methods and functions required by this script. Required_DREAM_Version = 4.4 # # # Compatibility: # # 98% compatible with SDK 1.x. 90% compatible with SDK 2.x. 99% compatible # with everything else. WILL corrupt your old savegames. Can cause # incompatibility issues with custom CMSes that change music playing methods # in Game_System. NEEDS DREAM of the provided version or higher. Files will # be saved into "DREAM Encrypted Audio" format with .dea extension. # # # Features: # # - encrypts your Audio files in a way, so you can encrypt them together with # Data Files and decrease the chance of music theft # - decrypts and plays the .dea files # # new in v1.0b: # - rewritten conditions using classic syntax to avoid RGSS conditioning bug # - now beta # # new in v1.01b: # - compatible with StromTronics CMS v5.0b and higher # # new in v1.02b: # - improved coding # # new in v1.03b: # - fixed a bbug cause by a typing mistake # # new in v4.5: # - now uses DREAM v4.4 # - added new license # - added usage and crediting instructions # # # Configuration: # # If you set ENCRYPT_AUDIO to true the script will encrypt the audio files # you have specified in AUDIO_FOR_ENCRYPTION and exit the application. If you # have set ENCRYPT_AUDIO to false, you can play the game normally and the # script will play the newly created files. All files go into the Data folder # organized as if they were in the normal Audio folders. # # Examples: # # - old locations and names: # Audio/BGM/Outskirts.mp3 # Audio/BGS/Blizzard.ogg # Audio/ME/Victory.mid # Audio/SE/Explosion.wav # # - new locations and names: # Data/Audio/BGM/Outskirts.dea # Data/Audio/BGS/Blizzard.dea # Data/Audio/ME/Victory.dea # Data/Audio/SE/Explosion.dea # # Put all files in the main game folder if you want to encrypt them. # # # IMPORTANT NOTES: # # This script will encrypt audio files and save it into .dea format. A file # in .dea format can't be player by any normal media anymore, so be don't # delete your old files in case you want to edit them or anything similar. # If you use this script without having encrypted all your .dea files, your # game will crash. # # # If you find any bugs, please report them here: # http://forum.chaos-project.com #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # START Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # turn on to create .dea files ENCRYPT_AUDIO = false # include audio file names WITH extension AUDIO_FOR_ENCRYPTION = ['001-Battle01.mid'] #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # END Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # ensures compatiblity $dream_music = true #============================================================================== # DREAM_ext controller #============================================================================== module DREAM def self.self_extract data = load_data('Data/DREAM_ext.rb') file = File.open("#{File.dirname('Game')}/DREAM_ext.rb", 'wb') file.write(data) file.close require File.expand_path('DREAM_ext.rb') self.load_DREAM end end DREAM.self_extract #============================================================================== # Audio File Encyption #============================================================================== if ENCRYPT_AUDIO AUDIO_FOR_ENCRYPTION.each {|filename| DREAM.encrypt_audio_file(filename, '.dea file') Graphics.update} exit end #============================================================================== # Game_System #============================================================================== class Game_System def bgm_play(bgm) @playing_bgm = bgm if bgm != nil && bgm.name != '' DREAM.play_encrypted_audio('Audio/BGM/', bgm, 0) else Audio.bgm_stop end Graphics.frame_reset end def bgs_play(bgs) @playing_bgs = bgs if bgs != nil && bgs.name != '' DREAM.play_encrypted_audio('Audio/BGS/', bgs, 1) else Audio.bgs_stop end Graphics.frame_reset end def me_play(me) if me != nil && me.name != '' DREAM.play_encrypted_audio('Audio/ME/', me, 2) else Audio.me_stop end Graphics.frame_reset end def se_play(se) if se != nil && se.name != '' DREAM.play_encrypted_audio('Audio/SE/', se, 3) end end end