Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Dependencies #96

Open
Sora-yx opened this issue Mar 29, 2024 · 7 comments
Open

Rework Dependencies #96

Sora-yx opened this issue Mar 29, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@Sora-yx
Copy link
Contributor

Sora-yx commented Mar 29, 2024

Currently the dependencies have two issues:

  • They don't have any update support, which means the Manager download and install them every time the user install or update the loader, it's not convenient and make the process longer than what it is for no reason.
  • They have too many DLLs, if we add the FFMPEG support for FMV, this will add about 50 mb of DLLs, in other word, each install or update of the loader will force a download of 50 mb which I find unacceptable. This would also make each Manager update bigger since they will need to be stored in the exe in case of offline installation.

Possible Solution:

  • Set up a specific repo to host all the dependencies, check for updates using commit ID so they only get downloaded when needed
  • Alternately, use manifests for the dependencies so only the needed ones are downloaded instead of all of them. (Probably the best)
  • Compiling our own version of FFMPEG to reduce the number of DLLs and avoid having unnecessary dependencies

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.

@Sora-yx Sora-yx added the enhancement New feature or request label Mar 29, 2024
@Sora-yx Sora-yx pinned this issue Mar 29, 2024
@PiKeyAr
Copy link
Member

PiKeyAr commented Apr 6, 2024

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
Copy link
Contributor Author

Sora-yx commented Apr 7, 2024

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
Copy link
Member

PiKeyAr commented Jun 1, 2024

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
Copy link
Member

PiKeyAr commented Jun 1, 2024

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:

  • libg719_decode (music from Namco games) - freed one DLL
  • LibAtrac9 (format of PS4 and Vita music) - freed one DLL
  • libcelt (.fsb and other related formats) - freed two DLLs
  • libspeex (voice format in some EA games) - freed one DLL

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
Copy link
Member

PiKeyAr commented Oct 21, 2024

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
Copy link
Contributor Author

Sora-yx commented Oct 21, 2024

Very nice, this will become much more manageable.

@PiKeyAr
Copy link
Member

PiKeyAr commented Oct 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants