invscribe Posted January 10, 2016 Share Posted January 10, 2016 I have been trying to play back audio --- any audio --- from II, starting with the main menu screen. I am an audio guy and I will be using my own audio and/or PD. Perhaps I should have asked sooner, but I have tried the following 2 methods without success. Two other methods are planned and described as well. Method 1: Using FModI read once that it was not possible to replace a .fev directly. However, I figured that since I would not be using code referencing the original .fev, and I was not replacing anything in the kwad, I could get away with it given the function declaration. Please note that I have not used FMod Designer or FMod anything until II. I have only some idea as to what I am doing in FMod Designer, and I do not know anything about the FMod APIs. So going only by example, I modified main.lua to:----------------------------------------------------------------------- Sound initif #(config.SOUND_MEDIA or "") > 0 thenMOAIFmodDesigner.setMediaPath( config.SOUND_MEDIA )end-- MOAIFmodDesigner.setMediaPath( config.SOUND_MEDIA ) --invscribeif not config.NOSOUND thenSOUND_ENABLED = MOAIFmodDesigner.loadFEV("SpySociety.fev")SOUND_INV_ENABLED = MOAIFmodDesigner.loadFEV("InvScribe.fev") --invscribeelse SOUND_ENABLED = false --invscribe: value set but never referenced in luaSOUND_INV_ENABLED = falseendof note, SOUND_ENABLED is never declared or used in the lua portion of II. If you try to use it:scripts/client/strict.lua:26: variable 'SND_ENABLED' is not declared and I modified state-main-menu.lua toif not MOAIFmodDesigner.isPlaying("theme") then--MOAIFmodDesigner.playSound("SpySociety/Music/music_title","theme") --invscribeMOAIFmodDesigner.playSound("InvScribe/Music/title_music", "theme") --invscribeendand used the attached file: Add sound attempt 3.zip as a kwad which file structure is:sound/sound/<attachment contents> which is mounted using: main.luaKLEIResourceMgr.MountPackage( "invsound.kwad", "data" ) --invscribeKLEIResourceMgr.MountPackage( "sound.kwad", "data" )I have also used the structure which I originally thought it to be:sound/<attachment contents> I have also tried using:log:write(filesystem.pathLookup("sound/", "InvScribe.fev")) --invscribeassuming it would return where the fev is mounted, but it only returns the joined parameters. There is no error mounting it, but when playSound is used, I get the error:Failed to find sound 'InvScribe/Music/title_music' I gave up on this method because I do not know if it is my fev file, my kwad file (included in the zip), or something else. Method 2: localhost portSo I decide that either I have the wrong kwad folder structure, or the exposed function is hard-coded to the official fev. OK. Brute force. I used cloud-manager.lua to learn about the http available, and I programmed up a server on a localhost port. It uses a combination of http requests and C# to play the audio file requested. This method worked perfectly in a browser. for reference: cloud-manager.luamodule ( "cloud", package.seeall )I gave up on this method because I found that none of the http works on anything, except maybe https requests - something I overlooked since the code was there and it uses cloud storage on steam. All http requests, be it mine or from the official code return error code 0: 0 (http error 0, 0 bytes transferred). I'm using the GoG version of the game -- was it disabled in the non-steam version? Method 3: "filesystem interface". This method might be complete within a day and it is extremely likely to work, but I would still like to get all of the other methods to work for additional modding options. I have my misgivings about using methods 2 and 3. When we're starting to talk about brute force methods, we starting to talk about latency. Something that can be rather distracting in a game if the method is used in the wrong places. I don't know what the latency is for this method yet. http wasn't great when run from a browser, but it was something; and I'm dying to get some of my own audio into this game one way or another. Windows API System.IO.FileSystemWatcher has the ability to monitor the filesystem in "real-time" -- I don't know how fast it is, and have only theorized on using it in this way. I'll just try it and seesharp. There is a file copy command in the Klei code which I believe to be working. I will use this with FileSystemWatcher as a sort of interface to pass commands from II to my application. Method 4: dllpackage.loadlib Any help on methods 1 or 2? FMod .fev would be best, but I read somewhere that there is an FMod key that is passed (idk, I have never used it in an application), and I know a decryption password is given to the official SpySociety fev. Getting additional fev's to work might require a modification to the II source code to enable unencrypted fev modding, if that's even possible. It might also require the header file to be in the source, in which case a framework could be made available to play audio. DLL could work, but there would be more to learn just to test if it is exposed. I have never made a dll in C. HTTP would be OK for some of the sound, and even if I could use fmod I could really use this as a working function, even if for just localhost connections. Thanks in advance, thanks for reading. I've subscribed to this and will be responsive if anyone has any clues to any of these. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.