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

FS Features #1185

Merged
merged 12 commits into from Apr 7, 2024
Merged

FS Features #1185

merged 12 commits into from Apr 7, 2024

Conversation

Daggolin
Copy link
Contributor

@Daggolin Daggolin commented Nov 7, 2023

This pull request aims to improve a few FS related issues and to provide new features.

  1. [MP] The fs_forceGame cvar from jk2mv. The user can set the force game on startup to ensure configs, screenshots, etc. are written to and read from the specified folder. The server provided fs_game value is still used for reading, so mods in custom folders and pk3s downloaded from the server should still work.

  2. [MP] Files downloaded from the server get prefixed with dl_ in their name. Pk3s with this prefix are not loaded unless the server references them. If a server provides a pk3s that overrides all default textures, models, etc. it is only used on servers offering the same file for download. Playing on other servers the pk3 is ignored. This is ported form jk2mv as well.

  3. [MP] Reflists from jk2mv. The reflists can be used to control file referencing when sv_allowDownload is enabled. For instance to only offer selected files (ref_whitelist.txt), block specific files (ref_blocklist.txt) and to offer files that wouldn't automatically be picked up by the download system (ref_forcelist.txt).

  4. [Shared] Native libraries (dlls on Windows) are no longer automatically unpacked and used from pk3s, unless the game is started with com_unpackLibraries enabled.

  5. [Shared] The network initialization is now performed before the filesystem initialization to avoid undesired side effects from network sockets having high fd values. For instance high kernel load on some systems due to high values in select calls.

  6. [Shared] The fs_restart command from jk2mv. If no module has an active handle for a file within a pk3 the filesystem can be reloaded at runtime. This can be useful when testing/developing mods or when installing new maps, because intermediate map changes are no longer required to reload the filesystem.

  7. [Shared] Increase pk3 limit. The hardcoded limit of 1024 files has been removed. The game tries to set the fd limit to 4096 on launch now. The start argument -maxfds can be used to override the default limit of 4096 (if the operating system permits the user to do so). This is ported from jk2mv as well.

The code ported from jk2mv was written by @ouned, @aufau, myself and possibly other contributors over time.

…oaded pk3s when referenced by the server.

Ported from jk2mv.
Add ref_whitelist.txt, ref_blacklist.txt and ref_forcelist.txt.
Refactor reference handling to be more predictable (by making the reference conditions more explicit).
As many users don't review the content of pk3s when installing mods and as cl_allowDownload can download pk3s from the server the pk3 files in the gamne folder should not be considered trustworthy enough to run native libraries from. In case a user really needs it the unpacking of native libraries can be reenabled with a protected init cvar: com_unpackLibraries.
As the filesystem is initialized before the network socket the file descriptors
of the ip_socket turns out to be very high if many pk3s are loaded. When calling
NET_Sleep the select call is used to sleep unless something arrives on the
network socket. Due to its high number the highestfd value given to the select
call is very high and covers alls open files, leading to high load on some
systems. As a workaround this commit calls NET_Init before initializing the
filesystem.
…imum allowed file descriptors to 4096 on start (can be overriden with "-maxfds" on launch).

Ported from jk2mv.
@Daggolin Daggolin requested a review from a team as a code owner November 7, 2023 00:06
If cl_downloadPrompt is enabled users have to confirm each pk3 download now.
If cl_downloadOverlay is enabled the window used for the confirmation prompt is used to display a progress bar and details on the current download.
…led by default and requires user confirmation.
@Daggolin
Copy link
Contributor Author

Pushed additional changes:

  1. [MP] Ask users to confirm downloads (cvar: cl_downloadPromt) and print infos about the current download without relying on the ui module (cvar: cl_downloadOverlay). The prompt is similar in function to the one in jk2mv, but jk2mv uses a custom ui module (mvmenu) and menu files during the downloads. To avoid relying on matching ui modules the window in this pull request is drawn internally within the engine.

  2. [MP] Set default value of cl_allowDownload to 1, because cl_downloadPrompt defaults to 1 and thus a user is asked about every single download by default anyway.

@taysta taysta mentioned this pull request Nov 27, 2023
Since com_unpackLibraries defaults to 0 the game is not going to unpack the default libraries from the assets anymore, thus the OpenJK ones should now be used as default.
@Daggolin
Copy link
Contributor Author

Pushed additional changes:

  1. [MP] Skip download attempts if the server has sv_allowDownload set, but the value indicates it is disabled. This avoids showing the download prompt and trying to download files when the server doesn't even allow downloads.

  2. [MP] Adjust CMakeFiles to add the OpenJK modules to the base folder for win32 builds. As unpacking of dlls is disabled by default the user may decide to install OpenJK into a folder without any unpacked vanilla modules. Thus OpenJK should provide modules for base on win32 now, too.

Razish
Razish previously approved these changes Feb 8, 2024
SomaZ
SomaZ previously approved these changes Mar 6, 2024
@Daggolin Daggolin dismissed stale reviews from SomaZ and Razish via fda880e April 6, 2024 22:32
@Daggolin Daggolin merged commit 065d329 into JACoders:master Apr 7, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants