View Issue Details

IDProjectCategoryView StatusLast Update
0005661The Dark ModCodingpublic17.07.2021 06:25
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.09 
Target VersionTDM 2.10Fixed in VersionTDM 2.10 
Summary0005661: In-game downloader does not show updates of the currently installed mission
DescriptionIf the FM which is installed currently has a newer version in FM database, it is still NOT displayed in in-game mission downloader.
This is often confusing.

Indeed, we cannot download it and replace it the usual way, since the pk4 file of FM is opened and thus locked by OS.
However, we can indeed download it if we enforce two things:
1) Full engine restart is done (with a message) when download is over.
2) User can't leave the downloader menu while download is in progress (maybe another message about it).

Perhaps some of these limitations can be removed.
But it should not be too hard to implement them, and I think everyone will be much less confused in the result.
TagsNo tags attached.

Activities

stgatilov

stgatilov

16.07.2021 17:41

administrator   ~0014163

There is no problem in listing current FM for update.
No problem in downloading it either: it gets downloaded to {root}/fms/{fm}.pk4, while the actually used archive is {root}/fms/{fm}/{fm}.pk4
The problem happens when we try to accept this new pk4 and copy it to proper location, since that destination location is currently used = locked by TDM process.

In the code, this is located in CMissionManager::SearchForNewMods.
It looks for new pk4 files and copes them into proper place.
It is called on game initialization (alas, that's too late) and on "refreshMissionList" GUI command, which is called when user gos to FM selection screen.

Interestingly, the same problem should happen anyway if user manually downloads the FM package and puts it into {root}/fms/
What actually happens is: game says new FM is available, but fails to replace the old pk4 (and does not remove the new one either) --- that can repeat many times.
Restarting TDM afresh does not help, unless you restart it with different mission installed =(
stgatilov

stgatilov

16.07.2021 18:25

administrator   ~0014164

It seems that idCommonLocal::InitGameArguments is called just before filesystem is initialized.
In particular, this code handles current FM selection (check command line arguments, currentfm.txt, presence of .map/.pk4).

We can check here if pk4 for the selected FM is present in {foot}/fms/ directory, and replace it if it does.
stgatilov

stgatilov

17.07.2021 06:24

administrator   ~0014165

First of all, here is a small generic fix for pushing several GUI messages at once:
  r9468. Do not try to handle GUI messages while previous mesasge is still active.

Regarding the main issue:
  r9469. Allow downloading update for the currently installed FM, handle it properly.
  r16326. Added strings for GUI message about updating the currently installed FM.

Basically, there are two changes:
1) Accept incoming pk4 files of FMs (from {root}/fms/{fm}.pk4) in idCommonLocal::InitGameArguments.
  That's very early during engine startup, before filesystem is initialized.
  The Game is not initialized yet at that moment, so CMissionManager object is not available.
  To cope with that, I have refactored the necessary methods (SearchForNewMods) into static methods.
  Had to hack a bit in order to display message about updated mission (see AddToNewModList(newModsList)).
2) When update for the current FM is downloaded, display a new message asking to restart game.
  The new message is displayed after the old message "N missions downloaded".
  I have added "Later" button to cancel immediate game restart, although the game won't behave well after that.
stgatilov

stgatilov

17.07.2021 06:25

administrator   ~0014166

By the way, a bit of discussion here:
  https://forums.thedarkmod.com/index.php?/topic/11291-tdm-builtin-download-capability/&do=findComment&comment=462878

Issue History

Date Modified Username Field Change
03.07.2021 09:17 stgatilov New Issue
03.07.2021 09:17 stgatilov Status new => assigned
03.07.2021 09:17 stgatilov Assigned To => stgatilov
16.07.2021 17:41 stgatilov Note Added: 0014163
16.07.2021 18:25 stgatilov Note Added: 0014164
17.07.2021 06:24 stgatilov Note Added: 0014165
17.07.2021 06:25 stgatilov Status assigned => resolved
17.07.2021 06:25 stgatilov Resolution open => fixed
17.07.2021 06:25 stgatilov Fixed in Version => TDM 2.10
17.07.2021 06:25 stgatilov Target Version TDM 2.11 => TDM 2.10
17.07.2021 06:25 stgatilov Note Added: 0014166