Skip to content

Commit

Permalink
restore original .ini file name
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Feb 3, 2024
1 parent 3997c03 commit 93c6e12
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
16 changes: 8 additions & 8 deletions config/ConfigFormUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void __fastcall TConfigForm::CreateParams(TCreateParams & Params)

void __fastcall TConfigForm::LanguageImgClick(TObject *Sender)
{
auto *ini = new TIniFile(".\\dd-hd.ini");
auto *ini = new TIniFile(".\\ddraw.ini");
ini->WriteString("ddraw", "configlang", IsEnglish ? "auto" : "english");
delete ini;

Expand All @@ -57,7 +57,7 @@ void __fastcall TConfigForm::LanguageImgClick(TObject *Sender)

void __fastcall TConfigForm::ThemePnlClick(TObject *Sender)
{
auto *ini = new TIniFile(".\\dd-hd.ini");
auto *ini = new TIniFile(".\\ddraw.ini");
auto theme =
ThemePnl->Color == (TColor)RGB(31, 31, 31) ? "Cobalt XEMedia" : "Windows10";

Expand Down Expand Up @@ -86,7 +86,7 @@ void __fastcall TConfigForm::RestoreDefaultsBtnClick(TObject *Sender)
return;
}

DeleteFile(".\\dd-hd.ini");
DeleteFile(".\\ddraw.ini");

ShellExecute(
NULL,
Expand Down Expand Up @@ -676,8 +676,8 @@ void __fastcall TConfigForm::CompatibilityBtnClick(TObject *Sender)

void __fastcall TConfigForm::FormCreate(TObject *Sender)
{
/* Let cnc-ddraw create a new dd-hd.ini if it doesn't exist */
if (FileExists(".\\ddraw.dll") && !FileExists(".\\dd-hd.ini")) {
/* Let cnc-ddraw create a new ddraw.ini if it doesn't exist */
if (FileExists(".\\ddraw.dll") && !FileExists(".\\ddraw.ini")) {

SetEnvironmentVariableW(L"cnc_ddraw_config_init", L"1");

Expand All @@ -701,7 +701,7 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
}
}

auto *ini = new TIniFile(".\\dd-hd.ini");
auto *ini = new TIniFile(".\\ddraw.ini");
auto *hd_ini = new TIniFile(".\\Warcraft II BNE.ini");

if (ini->ReadString("ddraw", "configtheme", "Windows10") == "Cobalt XEMedia") {
Expand Down Expand Up @@ -906,7 +906,7 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)

RestoreDefaultsBtn->Visible =
FileExists(".\\ddraw.dll") &&
FileExists(".\\dd-hd.ini") &&
FileExists(".\\ddraw.ini") &&
GetBool(ini, "allow_reset", true);

delete ini;
Expand All @@ -920,7 +920,7 @@ void TConfigForm::SaveSettings()
if (!Initialized)
return;

auto *ini = new TIniFile(".\\dd-hd.ini");
auto *ini = new TIniFile(".\\ddraw.ini");
auto *hd_ini = new TIniFile(".\\Warcraft II BNE.ini");

/* Display Settings */
Expand Down
2 changes: 1 addition & 1 deletion config/cnc-ddraw config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
return 0;
}

auto *ini = new TIniFile(".\\dd-hd.ini");
auto *ini = new TIniFile(".\\ddraw.ini");
auto theme = ini->ReadString("ddraw", "configtheme", "Windows10");

TStyleManager::TrySetStyle(
Expand Down
10 changes: 9 additions & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,14 @@ static void cfg_create_ini()
"maintas=false\n"
"boxing=false\n"
"\n"
"; Diablo\n"
"[Diablo]\n"
"devmode=true\n"
"\n"
"; Diablo: Hellfire\n"
"[hellfire]\n"
"devmode=true\n"
"\n"
"; Eggsucker\n"
"[eggsucker]\n"
"fixpitch=true\n"
Expand Down Expand Up @@ -1003,7 +1011,7 @@ static void cfg_init()
}

/* set up settings ini */
strncpy(g_config.ini_path, ".\\dd-hd.ini", sizeof(g_config.ini_path) - 1);
strncpy(g_config.ini_path, ".\\ddraw.ini", sizeof(g_config.ini_path) - 1);

if (GetFileAttributes(g_config.ini_path) == INVALID_FILE_ATTRIBUTES)
cfg_create_ini();
Expand Down

0 comments on commit 93c6e12

Please sign in to comment.