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
38 기타 LUD Script Package file LuD 2017.08.15 1079
37 기타 (링크)RPG VX ACE 블랙잭 스크립트 게임애호가 2017.06.18 1003
36 기타 '결정 키로 이벤트 시작' 조건분기 추가 file Bunny_Boy 2016.01.16 1165
35 기타 Improved Input System 1 습작 2015.01.02 976
34 기타 Gamepad Extender 습작 2015.01.02 717
33 기타 메시지 표시 중에 자동으로 타이머 멈추기 1 file Bunny_Boy 2014.12.07 1026
32 기타 Hurt Faces V1.2 (상처에 고통스러워하는 액터의 얼굴을 출력해봅시다.) 5 file spice 2014.09.19 3003
31 기타 Map Screenshot by Tsukihime 2 Alkaid 2014.02.13 1832
30 기타 regendo - MenuScreen While Message 혜인 2014.01.23 1412
29 기타 Dialog Extractor 1.04 (VXA/VX/XP) 6 AltusZeon 2014.01.16 11669
28 기타 Falcao - Falcao Pets Servants 6 file 혜인 2014.01.04 1834
» 기타 VX ACE 오디오 암호화 스크립트 3 스리아씨 2013.10.22 1939
26 기타 게임속 이벤트를 텍스트 파일로 추출 2 file 영감쟁e 2013.10.15 3769
25 기타 아이템 합성 스크립트 4 file 스리아씨 2013.09.26 3138
24 기타 크리스탈 엔진 : 포켓몬 배틀 시스템 7 file 스리아씨 2013.09.24 3894
23 기타 이동제한 스크립트 5 file 스리아씨 2013.09.23 1769
22 기타 KGC 스텟 포인트 분배 스크립트 4 file 스리아씨 2013.09.21 1812
21 기타 시디 플레이어 1.0 by 77er 1 file 77ER. 2013.08.20 1627
20 기타 사칙연산 게임 by 77er 1 file 77ER. 2013.08.19 1606
19 기타 77er 월드 맵 1.0 by 77er 3 file 77ER. 2013.08.14 2281
Board Pagination Prev 1 2 Next
/ 2