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 5110
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 28925
157 파티 맵에서 4명 이상 대열 이동 가능수 조절하는 스크립트 5 Omegaroid 2013.10.17 1785
156 기타 게임속 이벤트를 텍스트 파일로 추출 2 file 영감쟁e 2013.10.15 3769
155 전투 스킬 캐스팅 시스템 3 스리아씨 2013.10.12 32164
154 전투 자동전투 명령어 추가 스크립트 2 스리아씨 2013.10.11 1953
153 전투 공격시 반동데미지 스크립트 8 스리아씨 2013.10.11 1882
152 변수/스위치 Simple self switches(간단한 셀프 스위치) 4 한국사수련생 2013.10.04 1433
151 변수/스위치 Mog Event Sensor Range 4 file 이클립스 2013.09.30 1570
150 전투 Symbol Encounter 5 파송송뇌진탕 2013.09.29 2531
149 상점 Shop Stock < 상점에서 판매하는 아이템의 수량 제한 > 2 file 스리아씨 2013.09.26 1876
148 기타 아이템 합성 스크립트 4 file 스리아씨 2013.09.26 3138
147 메시지 Text Skip [ 메시지 스킵 ] 4 file 스리아씨 2013.09.26 2989
146 타이틀/게임오버 No Game Over 1 file 스리아씨 2013.09.26 2399
145 HUD 동방프로젝트(풍신록) 맵 이름 표시 3 file 스리아씨 2013.09.24 3254
144 기타 크리스탈 엔진 : 포켓몬 배틀 시스템 7 file 스리아씨 2013.09.24 3894
143 액터 액터 스탯 분배 스크립트 14 file 스리아씨 2013.09.23 2678
142 기타 이동제한 스크립트 5 file 스리아씨 2013.09.23 1769
141 HUD ReinoRpg Hudre 5 file 스리아씨 2013.09.22 2786
140 기타 KGC 스텟 포인트 분배 스크립트 4 file 스리아씨 2013.09.21 1812
139 버그픽스 Event Jitter Fix/Display Rounding Error Fix by Neon Black Alkaid 2013.08.31 1003
138 메뉴 저장금지시 메뉴에 저장 안 뜨게 하기 5 file Bunny_Boy 2013.08.24 2519
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11