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 5605
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 29441
177 기타 Map Screenshot by Tsukihime 2 Alkaid 2014.02.13 1859
176 키입력 Improved Imput System(part of DP Core) by DiamondandPlatinum3 1 Alkaid 2014.02.12 1307
175 버그픽스 Large Sprite ☆ Display Fix by Neon Black Alkaid 2014.02.08 1285
174 장비 Equipment Set Bonuses by modern algebra 2 Alkaid 2014.02.08 1517
173 메시지 한국어 조사 처리 스크립트 (140130) 2 치리 2014.01.31 2701
172 기타 regendo - MenuScreen While Message 혜인 2014.01.23 1450
171 그래픽 RGSS3 - CompositeGraphics 1 file 쿠쿠밥솥 2014.01.17 2654
170 기타 Dialog Extractor 1.04 (VXA/VX/XP) 6 AltusZeon 2014.01.16 11741
169 이동 및 탈것 [RPG VX ACE]CSCA 텔레포트 스크립트 스리아씨 2014.01.05 2456
168 기타 Falcao - Falcao Pets Servants 6 file 혜인 2014.01.04 1877
167 그래픽 Galy`s 캐릭터 그래픽 커스텀 3 스리아씨 2013.12.17 4936
166 타이틀/게임오버 [VX ACE]타이틀 화면에 맵을 표시하는 스크립트 4 file 스리아씨 2013.12.07 3579
165 전투 Yanfly 엔진 - 몬스터의 레벨 설정 6 file 스리아씨 2013.11.08 13055
164 전투 데미지의 한계치를 정하는 스크립트 3 file 스리아씨 2013.11.07 2086
163 맵/타일 MGC님의 Mode 7 Ace 6 file 습작 2013.10.27 3514
162 메뉴 시스템 칼라 스크립트 3 file 스리아씨 2013.10.27 3290
» 기타 VX ACE 오디오 암호화 스크립트 3 스리아씨 2013.10.22 1965
160 메뉴 XS 메뉴 스크립트 4 file 스리아씨 2013.10.22 3881
159 상태/속성 Etude87's_Param_BG_Gauge ver.1.00 7 file 습작 2013.10.19 2207
158 아이템 아이템 팝업 스크립트 15 스리아씨 2013.10.17 3273
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11