Hacking away at the Audio module

BadMinotaur

You can do it!
Veteran
Joined
Mar 13, 2012
Messages
260
Reaction score
114
First Language
English
Primarily Uses
RMVXA
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!
 

BadMinotaur

You can do it!
Veteran
Joined
Mar 13, 2012
Messages
260
Reaction score
114
First Language
English
Primarily Uses
RMVXA
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!
 

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
308
First Language
English
Primarily Uses
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 :)
 
Last edited by a moderator:

muramasa

Abomination of life, or life itself.
Veteran
Joined
Apr 29, 2012
Messages
581
Reaction score
294
First Language
Spanish
Primarily Uses
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
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

If there are any mods or admins online, could you please see about the re-translation pages for RPG Maker MV? They are all down :rsad:
Werewolf cons: you lose control of yourself once a month and could accidentally kill your friends. Vampire cons: no garlic bread. The choice is simple. Werewolf for sure.
2 huge market drops in 2 days. So glad I sold my non-dividend stocks about 2 weeks ago. And if the dividend ones drop heavily, hey more cheap stocks for me!
My tutorial is live! It covers using Yanfly's weapon unleash to replace the basic attack skill with a more dynamic version depending on which weapon type the actor has equipped. It also includes how to import a custom function used to generate a random number within supplied minimum and maximum values, used in the replaced skills, to give weapons a set damage range.
What can I sing for my sisters birthday...?

>.<'

Forum statistics

Threads
94,515
Messages
921,551
Members
124,373
Latest member
fullmetalparka
Top