Gibberlings3 / iwdification

IWDification is a mod to bring some of the elements of Icewind Dale into the Baldur's Gate series of games. A lot of this project is based upon the work of the IWD-in-BG2 conversion project. The mod adds various elements such as selectable bard songs, two-handed axes, and over 65 new spells into your BG2, Tutu, BGT, or BGEE game. Every component can be installed independently of one another.
https://www.gibberlings3.net/mods/spells/iwdification/
12 stars 6 forks source link

Fix Linux oggdec conversion for oBG installs #26

Closed majcosta closed 1 year ago

majcosta commented 1 year ago

My minimal fix for #23 is on the first commit. Took the liberty to refactor and cleanup a bit on the others.

mehdiym commented 1 year ago

Hello, I tried your PR for my Linux install but it failed with directories. Also there are 2 audio files that are not OGG but WAVC and oggdec fails for them, which makes the whole step to fail. I give you here my dirs and audio fix, but the audio fix is too specific as I don't know how to detect wavc format with weidu.

      unix
      BEGIN
        OUTER_SET installed = 1
        OUTER_SPRINT wav_output ~weidu_external/iwdification/wav-output~
        MKDIR ~%wav_output%~
        ACTION_BASH_FOR ~%audio_path%~ ~.+\.wav$~ BEGIN
          OUTER_SPRINT wavfile ~%wav_output%/%BASH_FOR_RES%.wav~
//          COPY ~.../fl#inlined/null.file~ ~%wavfile%~
//          AT_NOW ~oggdec '%BASH_FOR_FILESPEC%'~
          ACTION_IF ("%BASH_FOR_RES%" STRING_EQUAL_CASE "#eff_e03" OR "%BASH_FOR_RES%" STRING_EQUAL_CASE "#eff_m13") BEGIN
            COPY ~%BASH_FOR_FILESPEC%~ ~%wav_output%~
          END
          ELSE BEGIN
            AT_NOW ~oggdec '%BASH_FOR_FILESPEC%' -o '%wavfile%'~
            COPY ~%wavfile%~ ~override~
          END
          ACTION_IF FILE_EXISTS ~%wavfile%~ AND !FILE_SIZE ~%wavfile%~ 0 BEGIN
//            MOVE ~%wavfile%~ ~%output_path%~
          END ELSE OUTER_SET installed = 0
        END
        ACTION_IF !installed BEGIN
          WARN "WARNING: audio was not installed because WAV files were not found. Are you sure you have oggdec installed?"
        END
      END
majcosta commented 1 year ago

I don't understand what "it failed with directories" means.

And you're mistaken, all the .wav files under the copyover directory are Vorbis files - including (#)eff_e03.wav - except #eff_m13.wav, which isn't any media file that any player I have knows of. Just run find -iname '*.wav' -exec file {} \; there and see for yourself.

I double checked, and the PR is working. It just still issues a warning because oggdec fails to convert #eff_m13.wav, leaving a file with its name but size truncated to zero.

mehdiym commented 1 year ago

Hello, I must have messed up with branches, because I just tried again and indeed it works well except for the #eff_m13.wav file. If you edit the file (basic editor), you'll see it starts with "WAVCV1.0" which means it's the old proprietary format from those games, and I've read that such files don't need to be converted with oggdec, you just have to copy them over the override directory. That's what I did in my code. A proper solution would be to detect them based on their header instead of their name (as I do). I guess weidu is capable of doing that, but I'm new with it.

majcosta commented 1 year ago

You're absolutely right. It looks like IWDSpells is the right place for this to be fixed, so I'm closing the PR

mehdiym commented 1 year ago

Alright. Will my solution will work on my game ? I mean: moving eff_m13 to the override dir.

majcosta commented 1 year ago

If it's based on this, yes. Otherwise oggdec will have truncated eff_m13 to zero bytes.