- fixed startup.

This commit is contained in:
Christoph Oelckers 2019-10-30 19:55:03 +01:00
parent 266dc9e04e
commit 5b1036093c
4 changed files with 13 additions and 12 deletions

View file

@ -475,9 +475,10 @@ GameInterface *CheckFrontend()
void ChooseGame()
{
#if 0
gi = CheckFrontend();
return;
#if 0
#else
auto dir = Args->CheckValue("-game");
if (dir && !chdir(dir))
{
@ -646,20 +647,21 @@ int main(int argc, char *argv[])
}
std::unique_ptr<FResourceFile> engine_res;
static std::unique_ptr<FResourceFile> demolition_pk3;
// The resourge manager in cache1d is far too broken to add some arbitrary file without some adjustment.
// For now, keep this file here, until the resource management can be redone in a more workable fashion.
extern FString progdir;
extern FString LumpFilter;
void InitBaseRes()
{
if (!engine_res)
if (!demolition_pk3)
{
// If we get here for the first time, load the engine-internal data.
FString baseres = progdir + "demolition.pk3";
engine_res.reset(FResourceFile::OpenResourceFile(baseres, true, true));
if (!engine_res)
demolition_pk3.reset(FResourceFile::OpenResourceFile(baseres, true, true));
if (!demolition_pk3)
{
I_Error("Engine resources (%s) not found", baseres.GetChars());
}
@ -669,11 +671,11 @@ void InitBaseRes()
FileReader openFromBaseResource(const char* fn)
{
InitBaseRes();
auto lump = engine_res->FindLump(fn);
auto lump = demolition_pk3->FindLump(fn);
if (lump) return lump->NewReader();
// Also look in game filtered directories.
FStringf filtername("filter/game-%s/%s", currentGame.GetChars(), fn);
lump = engine_res->FindLump(filtername);
FStringf filtername("filter/%s/%s", LumpFilter.GetChars(), fn);
lump = demolition_pk3->FindLump(filtername);
if (lump) return lump->NewReader();
return FileReader(nullptr);

View file

@ -218,7 +218,6 @@ bool FZipFile::Open(bool quiet)
int len = LittleShort(zip_fh->NameLength);
FString name(dirptr + sizeof(FZipCentralDirectoryInfo), len);
if (name.IsNotEmpty()) name = name.Mid(name.Len());
dirptr += sizeof(FZipCentralDirectoryInfo) +
LittleShort(zip_fh->NameLength) +
LittleShort(zip_fh->ExtraLength) +

View file

@ -190,7 +190,7 @@ FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileReade
for(size_t i = 0; i < countof(funcs) - containeronly; i++)
{
FResourceFile *resfile = funcs[i](filename, file, quiet);
if (resfile != NULL) return resfile;
if (resfile != NULL && resfile->Open(quiet)) return resfile;
}
return NULL;
}

View file

@ -318,7 +318,8 @@ void CONFIG_Init()
if (LumpFilter.Compare("Redneck") == 0) LumpFilter = "Redneck.Redneck";
else if (LumpFilter.Compare("RedneckRides") == 0) LumpFilter = "Redneck.RidesAgain";
CONFIG_ReadCombatMacros();
//CONFIG_ReadCombatMacros();
//CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
G_ReadConfig(currentGame);
@ -344,7 +345,6 @@ void CONFIG_Init()
}
SetupButtonFunctions();
CONTROL_ClearAssignments();
CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
CONFIG_InitMouseAndController();
CONFIG_SetGameControllerDefaultsStandard();
}