alexbatalov/fallout2-ce

Unable to save game if patches are also unpacked

roginvs opened this issue · 1 comments

I unpacked critter.dat, master.dat, and patch001.dat. When data is unpacked I am not able to save game.

As I understand the game creates temp file under patch001.dat/... path inside _proto_save_pid function and then tries to copy it from master.dat/... location in the _GameMap2Slot function.

This can be reproduced using Fallout Nevada Engish version and also with Fallout Sonora with DLC. Download game and unpack *.dat files using dat-unpacker to reproduce.

Original game works fine. Also fallout2-ce works fine if game is loaded from save so it fails only when new game is started

As workaround can I copy data from patch001.dat/ and patch002.dat/ into master.dat/critter.dat? Am i right that everything should go into master.dat/ except */art/critters/ ?

Up for now I'v found:

_proto_save_pid calls fileOpen which calls xfileOpen which tries to open a file from gXbaseHead.
That gXbaseHead is "" -> "patch001.dat" -> "data" -> "critter.dat" -> "master.dat".
If patch001.dat is a database then write access fails and xfileOpen opens file in data as it should.
If patch000.dat is a folder then it successfully opens it in that folder.

Next, _GameMap2Slot is using _patches = master_patches_path = "data" to access this file and it fails there because there is no file (it is created in patch001.dat folder)

A solution might be to add master_patches_path as second argument for dbOpen call inside gameDbInit function when it loads patches, but original game do not do this.

And I do not follow why original game works and why it saves file correctly into data folder inside proto_save_pid call.