Ace 스크립트

 

- 스크립트

 

  1. # *****************************************************************************
  2. #
  3. # OC AUDIO ENCRYPTION
  4. # Author: Ocedic
  5. # Site: http://ocedic.wordpress.com/
  6. # Version: 1.0
  7. # Last Updated: 7/17/13
  8. #
  9. # Updates:
  10. # 1.0  - First release
  11. #
  12. # *****************************************************************************
  13.  
  14. $imported = {} if $imported.nil?
  15. $imported["OC-AudioEncryption"] = true
  16.  
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # This script will encrypt your audio files and decrypt them during play.
  21. # Some important notes:
  22. #
  23. # * MP3s cannot be encrypted
  24. # * This encryption is very rudimentary and easy to circumvent
  25. #
  26. # Essentially, this script is designed to protect your audio files from your
  27. # regular Average Joe user. The fact is even if a 100% unbreakable
  28. # encryption script existed, people could simply record the audio from your
  29. # game and extract it that way.
  30. #==============================================================================
  31. # ▼ Instructions
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # First, it's recommended that you change the default CIPHER_KEY and
  34. # ENCRYPTED_FILE values in the configuration settings before you proceed.
  35. #
  36. # Run the script with ENCRYPT_AT_STARTUP set to true. This will create an
  37. # encrypted version of all audio files in your music folder.
  38. #
  39. # Set ENCRYPT_AT_STARTUP to false and move your original audio files to a new
  40. # location.
  41. #==============================================================================
  42. # ▼ Compatibility
  43. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  44. # This script may not be compatible with scripts that change the way audio is
  45. # played. If an incompatibility occurs, try placing this script above other
  46. # scripts.
  47. #==============================================================================
  48. # ▼ Terms of Use
  49. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  50. # Can be freely used and modified in non-commercial projects. Proper attribution
  51. # must be given to Ocedic, and this header must be preserved.
  52. # For commercial terms, see here: https://ocedic.wordpress.com/terms-of-use/
  53. #==============================================================================
  54.  
  55. #==============================================================================
  56. # ■ Configuration
  57. #------------------------------------------------------------------------------
  58. #  Change customizable settings here
  59. #==============================================================================
  60. module OC
  61.   module ENCRYPT
  62.    
  63. #==============================================================================
  64. # * Encrypt at Startup *
  65. #------------------------------------------------------------------------------
  66. #   This boolean value controls whether or not files are encrypted when the
  67. #   game is booted. If true, the script will iterate through all audio files
  68. #   in "Audio/BGM/" and encrypt them. When you have done this once, it's
  69. #   recommended that you move the original audio files to a secure backup
  70. #   directory and set this value to false.
  71. #==============================================================================  
  72.     ENCRYPT_AT_STARTUP = true
  73.    
  74. #==============================================================================
  75. # * Cipher Key *
  76. #------------------------------------------------------------------------------
  77. #   This key will be used to encrypt and decrypt audio files. Note that
  78. #   changing this string after you have encrypted your files will cause they to
  79. #   be incorrectly decrypted. It's advised that you choose a string at the
  80. #   beginning and stick with it!
  81. #==============================================================================    
  82.     CIPHER_KEY = "DONKEY"
  83.    
  84. #==============================================================================
  85. # * Encrypted Extension *
  86. #------------------------------------------------------------------------------
  87. #   The extension of the encrypted audio files.
  88. #------------------------------------------------------------------------------
  89. # * Encrypted File *
  90. #------------------------------------------------------------------------------
  91. #   The name and path of unencrypted audio files. It's recommended that you
  92. #   change this filepath to a more obtuse directory.
  93. #==============================================================================
  94.     ENCRYPTED_EXT = ".dog"
  95.     ENCRYPTED_FILE = "System/RGSSAudio"
  96.    
  97.   end #ENCRYPT
  98. end #OC
  99.  
  100. #==============================================================================
  101. # ■ SceneManager
  102. #==============================================================================
  103. module SceneManager
  104.  
  105.   class << self
  106.     alias oc_scene_manager_run_8pqe91 run
  107.   end
  108.   def self.run
  109.     if OC::ENCRYPT::ENCRYPT_AT_STARTUP
  110.       Dir.foreach("Audio/BGM/") do |item|
  111.         next if item == "." || item == ".."
  112.         next if item =~ /#{OC::ENCRYPT::ENCRYPTED_EXT}/
  113.         item = "Audio/BGM/" + item
  114.         Audio.encrypt(item)
  115.       end
  116.     end
  117.     oc_scene_manager_run_8pqe91
  118.   end
  119.    
  120. end
  121.  
  122. #==============================================================================
  123. # ■ Audio
  124. #==============================================================================
  125. module Audio
  126.  
  127.   @fileswitch = false
  128.  
  129. #==============================================================================
  130. # * New Method: Encrypt *
  131. #==============================================================================
  132.   def self.encrypt(filename)
  133.     sourcefile = File.open(filename, "rb")
  134.     content = sourcefile.readlines
  135.     sourcefile.close
  136.     encry_filename = Audio.strip_extension(filename)
  137.     targetfile = File.open(encry_filename + OC::ENCRYPT::ENCRYPTED_EXT, "wb")
  138.     for i in 0...content.size
  139.       content[i] = OC::ENCRYPT::CIPHER_KEY + content[i]
  140.     end
  141.     Marshal.dump(content, targetfile)
  142.     targetfile.close
  143.   end
  144.  
  145. #==============================================================================
  146. # * New Method: Decrypt *
  147. #==============================================================================  
  148.   def self.decrypt(filename)
  149.     sourcefile = File.open(filename + OC::ENCRYPT::ENCRYPTED_EXT, "rb")
  150.     content = Marshal.load(sourcefile)
  151.     for i in 0...content.size
  152.       value = content[i]
  153.       content[i] = value[OC::ENCRYPT::CIPHER_KEY.length, content[i].size]
  154.     end
  155.     sourcefile.close
  156.     begin
  157.       targetfile = File.open(OC::ENCRYPT::ENCRYPTED_FILE, "wb")
  158.       @fileswitch = false
  159.     rescue
  160.       targetfile = File.open(OC::ENCRYPT::ENCRYPTED_FILE + "1", "wb")
  161.       @fileswitch = true
  162.     end
  163.     for i in 0...content.size
  164.       targetfile.write(content[i])
  165.     end
  166.     targetfile.close
  167.   end
  168.  
  169. #==============================================================================
  170. # * New Method: Strip Extension *
  171. #==============================================================================
  172.   def self.strip_extension(filename)
  173.     result = filename.chomp(File.extname(filename))
  174.     return result
  175.   end
  176.  
  177. #==============================================================================
  178. # * New Method: Fileswitch *
  179. #==============================================================================
  180.   def self.fileswitch
  181.     return @fileswitch
  182.   end
  183.  
  184. end
  185.  
  186. #==============================================================================
  187. # ■ RPG::BGM
  188. #==============================================================================
  189. class RPG::BGM < RPG::AudioFile
  190.  
  191. #==============================================================================
  192. # * Overwrite: Play *
  193. #==============================================================================
  194.   def play(pos = 0)
  195.     if @name.empty?
  196.       Audio.bgm_stop
  197.       @@last = RPG::BGM.new
  198.     else
  199.       filename = "Audio/BGM/" + @name
  200.       if FileTest.exist?(filename + OC::ENCRYPT::ENCRYPTED_EXT)
  201.         Audio.decrypt(filename)
  202.         if !Audio.fileswitch
  203.          Audio.bgm_play(OC::ENCRYPT::ENCRYPTED_FILE, @volume, @pitch, pos)
  204.          begin
  205.            File.delete(OC::ENCRYPT::ENCRYPTED_FILE + "1")
  206.          rescue
  207.          end
  208.         else
  209.          Audio.bgm_play(OC::ENCRYPT::ENCRYPTED_FILE + "1", @volume, @pitch, pos)
  210.          begin
  211.            File.delete(OC::ENCRYPT::ENCRYPTED_FILE)
  212.          rescue
  213.          end
  214.         end
  215.       else
  216.         Audio.bgm_play(filename, @volume, @pitch, pos)
  217.       end
  218.       @@last = self.clone
  219.     end
  220.   end
  221.  
  222. end

 

 

출처 겸 사용법

 

http://ocedic.wordpress.com/scripts/utility-scripts/oc-audio-encryption/

http://www.rpgmakervxace.net/topic/16928-oc-audio-encryption/

Who's 스리아씨

?
뺘라뺘뺘
  • profile
    오렌지캬라멜 2014.01.23 14:47
    적용방법을 자세히 알려주실수 있으신가요 ???
    스크립 내용을 복사 붙어넣기만으로는 오류가 나와서요 ;
    새로 추가가 아닌 기존의 내용에 덮어씌어야 하는건가요 ?
  • ?
    스리아씨 2014.01.23 14:49
    이 스크립트를 사용하기 전에,주의 :

    이 스크립트는 MP3 파일을 암호화하지 않습니다. 그것은 당신이 그들에 변환하는 것이 좋습니다거야. OGG 형식보기
    이 스크립트를 사용하는 암호화는 소스 코드를 누구나 볼 수 있다는 사실에 의해 합성, 매우 간단합니다.
    이 스크립트는 다소 엉성 인해 오디오를 재생할 때 RGSS3이 열려있는 파일을 유지한다는 사실에, 순간에 실행됩니다.
    이 스크립트는 현재 음악을 암호화하고 BGS와 SE를 암호화하지 않습니다. 이들은 나중에 올 수 있습니다.

    라고 적혀있네염.
    사용방법은 안써서 잘 모릅니다(>..)
  • profile
    오렌지캬라멜 2014.01.23 14:51
    그렇군요 답변 ㄳ합니다 ^^

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 5593
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 29399
177 그래픽 Galy`s 캐릭터 그래픽 커스텀 3 스리아씨 2013.12.17 4924
176 기타 Gamepad Extender 습작 2015.01.02 744
175 타이틀/게임오버 GG침 스크립트 file 큔. 2018.07.18 862
174 버그픽스 Graphical Object Global Reference ACE (세부적인 에러메세지 없는 RGSS Player 크래쉬 디버거) by Mithran 1 Alkaid 2014.03.03 1542
173 전투 GTBS 2.4 버전 에코 2014.11.28 1917
172 전투 GTBS v2 for VX Ace by GubiD 1 Alkaid 2013.07.19 3078
171 기타 Hurt Faces V1.2 (상처에 고통스러워하는 액터의 얼굴을 출력해봅시다.) 5 file spice 2014.09.19 3034
170 기타 Icon_Character 8 file 허걱 2012.11.23 2617
169 키입력 Improved Imput System(part of DP Core) by DiamondandPlatinum3 1 Alkaid 2014.02.12 1301
168 기타 Improved Input System 1 습작 2015.01.02 1010
167 메시지 Item Choice Help Window for Ace 2 file 습작 2016.02.15 1410
166 키입력 Key Simulator by Fantasist 1 습작 2013.05.01 1403
165 기타 KGC 스텟 포인트 분배 스크립트 4 file 스리아씨 2013.09.21 1837
164 그래픽 Khas Awesome Light Effects BugFix 12 file 허걱 2013.01.15 3333
163 이동 및 탈것 Khas Pathfinder(길찾기 스크립트) 15 찬잎 2015.07.10 1980
162 버그픽스 Large Sprite ☆ Display Fix by Neon Black Alkaid 2014.02.08 1279
161 메시지 ListBox - 선택지 확장 스크립트 11 file 허걱 2014.04.03 3409
160 전투 LNX11 전투 RPGXP 전투처럼 만들기 큔. 2018.11.23 1479
159 기타 Localization by ForeverZer0, KK20 file 습작 2013.04.26 1436
158 기타 LUD Script Package file LuD 2017.08.15 1109
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11