Hacking away at the Audio module

Hello everyone. There's a small story to this request for help:

I'm working on a commercial project, and my musician is (understandably) very concerned about how music files don't get shoved into the encrypted archive with everything else. Thankfully, he's not particularly picky about protecting the music, he just doesn't want it out in the open for everyone to nab.

This has led me down a few different paths, but the current one I'm on is where I modify the music file in some way and then un-modify it prior to playback. Here is where my problem comes in. I was under the impression that the Audio.bgm_play method took in a filestream that was supplied by RPG::BGM's play method, but I was wrong. Apparently it only takes in a file name, which sucks because with a filestream I could just unpack the file, pass the unpacked stream to the method, and call it a day.

So after failing to understand the basics of how RPG Maker works, I decided to get risky and override some of the methods of built-in classes/modules. As it turns out, Audio.bgm_play seems to use its own file loading routine -- overriding File.open, File.new, Kernel.open, Kernel.load_data, etc. all failed to do anything. (as an aside, my test was pretty simple -- I'd just alias the method and throw in a puts to see if bgm_play was using that method)

So I'm pretty sure this avenue is a dead end, but I wanted to post this and get some feedback just in case you all know something I don't. Some of you are very thorough and enterprising so I figure running this by all of you would make sure I didn't forget any loose ends.

And, of course, if you all know of a way to make music work in the encrypted archive (yes, even though tools exist to crack it wide open), I would appreciate that as well.

Thank you!
Have you tried this?

http://forums.rpgmakerweb.com/index.php?/topic/15579-oc-audio-encryption/

Of course though there's sadly no such thing as a full-on audio encryption.
I did see it, but in general I'm trying to avoid using others' scripts that are not free for commercial use. If it comes down to it I could probably scrape up whatever Ocedic would want for it but I'd like to try and find a solution myself first if at all possible.

Thank you for the link though, I do appreciate it!
You could pack the music up (encrypted, of course) into a single file like (i think) starcraft and other similar games did, basically like C# does with resources. Then, just in-game, decrypt and either cache the music (less safe) or decrypt on the fly (safer, slower). That is about all you can do, and even then people can still 'record' the music. But they are hackers and will (usually) be caught, at least in the community 🙂
I did this as a little test

module Audio  class << self    alias bbgm_play bgm_play  end   def self.bgm_play(filename, volume=100, pitch=100, pos=0)  print filename  self.bbgm_play(filename, volume, pitch, pos)  endendInstead of a print, it could work by doing the actual decryption. Thing is, OGG works streamed (it is being cache'd on the fly), so it needs the file being present while it is being played. So you will need to check if a file is being used, and when it's not, delete the uncrypted file.

Also remember you don't need to save decrypted files inside your game's directory, you can always save them in one of Windows' TMP directories, and change the resulting filename accordingly.

Salut,

OZ

Original thread: https://forums.rpgmakerweb.com/threads/hacking-away-at-the-audio-module.18121/