X-Hax / SA-Mod-Manager

A new mod manager for the Sonic Adventure games.
MIT License
72 stars 17 forks source link

Rework Dependencies #96

Open Sora-yx opened 7 months ago

Sora-yx commented 7 months ago

Currently the dependencies have two issues:

Possible Solution:

Ideally, I'd love to be able to do the last solution with BASS, as I don't like how it requires 14 DLLs alone, but sadly merging them would be complicated.

PiKeyAr commented 6 months ago

There are a few things that can be done:

  1. Maximum compression with 7Z: 16MB for all dependencies including FFMPEG, 2MB without FFMPEG
  2. Reusing the same FFMPEG libraries for both the video player and bass_vgmstream. This could save about 2MB and 4 DLLs, although FFMPEG adds another 6.

Compiling our own version of FFMPEG could help reduce file size of the avcodec, avformat and avutil DLLs, but it probably won't help reduce the number of DLLs, and figuring out how to compile it is not easy. I don't know if merging everything into a single DLL is realistic, but if the goal is just to have fewer files we could put the DLLs in archives and unpack them on mod loader startup or something.

As for something that could be done right now: 1) It would be nice if the dependencies installer/updater used a single window for all dependencies (like when updating multiple mods) instead of creating a new window for each dependency. This would make the process seem faster and less distracting. 2) There are a lot of places in the UI when the Manager sits there doing nothing because of Task.Delay(), which makes mod and loader installation feel slower. These delays could be shortened (ideally removed) on release builds, and only enabled on debug builds or under some specific conditions for testing purposes, like when holding the Shift key.

Sora-yx commented 6 months ago

Yeah, I plan to merge the installation of the dependencies in a single task, but it's gonna take a bit since the class wasn't made with multiple downloads in mind. As for Task.Delay, it's been a while so I don't recall why they got implemented, but I can probably reduce or remove some.

As for moving to 7z, one issue is all the previous versions of the Manager will continue to look for the zip link, which would force us to have both the zip and 7z version hosted and I'm not super fan of that, but I don't think there is any other solution sadly, unless there is a way to redirect the link.

Meanwhile FFMPEG gets implemented, we can probably implement the manifest already since I think the most important part is to not re download the dependencies every time.

PiKeyAr commented 4 months ago

I was able to rework bass_vgmstream and its vgmstream submodule to reuse the same avutil, avcodec, avformat and swresample DLLs as those required for the FFMPEG player. avcodec and avformat DLLs are much larger than vgmstream-exclusive DLLs but at least we won't need two sets of DLLs anymore.

PiKeyAr commented 4 months ago

More progress: I recompiled vgmstream and bass_vgmstream to use the latest FFMPEG 7.1 DLLs (XP compatible build, audio confirmed working on XP), so we can now use the latest versions of FFMPEG DLLs for both the video and audio players.

I've also disabled support for the following in vgmstream and bass_vgmstream:

Total: -5 DLLs, -8 if you count shared avcodec, avformat etc. that are now reused

The BASS/FFMPEG dependencier folder looks like this: image

The FFMPEG video player will require swscale (already there in the screenshot) and the sadx-ffmpeg-player DLL, so that's 11 DLLs in total. 15MB at maximum 7Z compression without the player DLL.

Another idea: we could merge sadx-ffmpeg-player with bass_vgmstream and use a single DLL for the ModLoader to play both video and audio. That would make it 10 DLLs in total.

PiKeyAr commented 6 days ago

I made some changes to the "SADX" version of bass_vgmstream and built a version without libspeex.dll, libatrac9.dll, libcelt-0061.dll, libcelt-0110.dll and libg719_decode.dll. It works with vgmstream's custom FFMPEG DLLs and is ready to be used with the current version of the Mod Loader. Also got rid of jansson.dll which is no longer used.

{2E73A51C-9E6F-41F6-A097-38ED9B61F47C}
Sora-yx commented 6 days ago

Very nice, this will become much more manageable.

PiKeyAr commented 6 days ago

As for moving to 7z, one issue is all the previous versions of the Manager will continue to look for the zip link, which would force us to have both the zip and 7z version hosted and I'm not super fan of that, but I don't think there is any other solution sadly, unless there is a way to redirect the link.

Now that I learned that the archive is shipped inside the Manager's EXE, this point doesn't make sense to me.