Fix CreamAPI config issues & update help form
This commit is contained in:
parent
d2ff78a5f1
commit
ba46c3c529
2 changed files with 80 additions and 22 deletions
|
@ -52,8 +52,9 @@ internal class CustomForm : Form
|
|||
"Automatically finds all installed Steam, Epic and Ubisoft games with their respective DLC-related DLL locations on the user's computer,\n"
|
||||
+ "parses SteamCMD, Steam Store and Epic Games Store for user-selected games' DLCs, then provides a very simple graphical interface\n"
|
||||
+ "utilizing the gathered information for the maintenance of DLC unlockers.\n\n"
|
||||
+ $"The program utilizes the latest versions of [Koaloader]({acidicoala}/Koaloader), [SmokeAPI]({acidicoala}/SmokeAPI), [ScreamAPI]({acidicoala}/ScreamAPI), [Uplay R1 Unlocker]({acidicoala}/UplayR1Unlocker) and [Uplay R2 Unlocker]({acidicoala}/UplayR2Unlocker), all by\n"
|
||||
+ $"the wonderful [acidicoala]({acidicoala}), and all downloaded and embedded into the program itself; no further downloads necessary on your part!\n\n"
|
||||
+ $"The program utilizes the latest version of [CreamAPI](https://cs.rin.ru/forum/viewtopic.php?f=29&t=70576) by [deadmau5](https://cs.rin.ru/forum/viewtopic.php?f=29&t=70576). It also utilizes the latest versions of [Koaloader]({acidicoala}/Koaloader), [ScreamAPI]({acidicoala}/ScreamAPI), [Uplay R1\n"
|
||||
+ $"Unlocker]({acidicoala}/UplayR1Unlocker) and [Uplay R2 Unlocker]({acidicoala}/UplayR2Unlocker), all by [acidicoala]({acidicoala}). All unlockers are downloaded and embedded into the program itself; no further\n"
|
||||
+ "downloads necessary on your part!\n\n"
|
||||
+ "USAGE:\n" + " 1. Choose which programs and/or games the program should scan for DLC.\n"
|
||||
+ " The program automatically gathers all installed games from Steam, Epic and Ubisoft directories.\n"
|
||||
+ " 2. Wait for the program to download and install SteamCMD (if you chose a Steam game).\n"
|
||||
|
@ -63,8 +64,8 @@ internal class CustomForm : Form
|
|||
+ " Obviously none of the DLC unlockers are tested for every single game!\n"
|
||||
+ " 5. Choose whether or not to install with Koaloader, and if so then also pick the proxy DLL to use.\n"
|
||||
+ " If the default \'version.dll\' doesn't work, then see [here](https://cs.rin.ru/forum/viewtopic.php?p=2552172#p2552172) to find one that does.\n"
|
||||
+ " 6. Click the \"Generate and Install\" button.\n" +
|
||||
" 7. Click the \"OK\" button to close the program.\n"
|
||||
+ " 6. Click the \"Generate and Install\" button.\n"
|
||||
+ " 7. Click the \"OK\" button to close the program.\n"
|
||||
+ " 8. If any of the DLC unlockers cause problems with any of the games you installed them on, simply go back\n"
|
||||
+ " to step 5 and select what games you wish you revert changes to, and instead click the \"Uninstall\" button this time.\n\n"
|
||||
+ "NOTE: This program does not automatically download nor install actual DLC files for you; as the title of the program states, this program\n"
|
||||
|
@ -72,9 +73,10 @@ internal class CustomForm : Form
|
|||
+ "a good majority of games, you must find, download and install those to the game yourself. This process includes manually installing new\n"
|
||||
+ "DLCs and manually updating the previously manually installed DLCs after game updates.\n\n"
|
||||
+ $"For reliable and quick assistance, all bugs, crashes and other issues should be referred to the [GitHub Issues]({repository}/issues) page!\n\n"
|
||||
+ $"HOWEVER: Please read the [FAQ entry]({repository}#faq--common-issues) and/or [template issue]({repository}/issues/new/choose) corresponding to your problem should one exist! Also, note that the [GitHub Issues]({repository}/issues)\n"
|
||||
+ "page is not your personal assistance hotline, rather it is for genuine bugs/crashes/issues with the program itself. If you post an issue which\n"
|
||||
+ "has already been explained within the FAQ, template issues, and/or within this text in general, I will just close it and you will be ignored.\n\n"
|
||||
+ $"HOWEVER: Please read the [FAQ entry]({repository}#faq--common-issues) and/or [template issue]({repository}/issues/new/choose) corresponding to your problem should one exist! Also, note that the [GitHub\n"
|
||||
+ $"Issues]({repository}/issues) page is not your personal assistance hotline, rather it is for genuine bugs/crashes/issues with the program itself. If you post an\n"
|
||||
+ "issue which has already been explained within the FAQ, template issues, and/or within this text in general, I will just close it and you will\n"
|
||||
+ "be ignored.\n\n"
|
||||
+ "SteamCMD installation and appinfo cache can be found at [C:\\ProgramData\\CreamInstaller]().\n"
|
||||
+ $"The program automatically and very quickly updates from [GitHub]({repository}) by choice of the user through a dialog on startup.\n"
|
||||
+ $"The program source and other information can be found on [GitHub]({repository}).");
|
||||
|
|
|
@ -27,30 +27,78 @@ internal static class CreamAPI
|
|||
config = directory + @"\cream_api.ini";
|
||||
}
|
||||
|
||||
internal static void CheckConfig(string directory, Selection selection, InstallForm installForm = null)
|
||||
private static void CheckConfigOld(string directory, Selection selection, InstallForm installForm = null)
|
||||
{
|
||||
directory.GetCreamApiComponents(out _, out _, out _, out _, out string config);
|
||||
bool configExisted = config.FileExists();
|
||||
if (configExisted)
|
||||
config.DeleteFile();
|
||||
StreamWriter writer = null;
|
||||
|
||||
HashSet<SelectionDLC> dlc = selection.DLC.Where(dlc => dlc.Enabled).ToHashSet();
|
||||
if (dlc.Count > 0 && selection.Id != "PL")
|
||||
{
|
||||
config.CreateFile(true, installForm)?.Close();
|
||||
writer = new(config, true, Encoding.Default);
|
||||
|
||||
WriteConfig(writer, selection.Name, selection.Id,
|
||||
new(dlc.ToDictionary(_dlc => _dlc.Id, _dlc => _dlc.Name), PlatformIdComparer.String), installForm);
|
||||
}
|
||||
|
||||
foreach (Selection extraSelection in selection.ExtraSelections)
|
||||
{
|
||||
HashSet<SelectionDLC> extraDlc = extraSelection.DLC.Where(dlc => dlc.Enabled).ToHashSet();
|
||||
if (extraDlc.Count <= 0)
|
||||
continue;
|
||||
|
||||
if (writer is not null)
|
||||
writer.WriteLine();
|
||||
else
|
||||
{
|
||||
config.CreateFile(true, installForm)?.Close();
|
||||
writer = new(config, true, Encoding.Default);
|
||||
}
|
||||
|
||||
WriteConfig(writer, extraSelection.Name, extraSelection.Id,
|
||||
new(extraDlc.ToDictionary(_dlc => _dlc.Id, _dlc => _dlc.Name), PlatformIdComparer.String), installForm);
|
||||
}
|
||||
|
||||
if (writer is not null)
|
||||
{
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!configExisted)
|
||||
return;
|
||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action,
|
||||
false);
|
||||
}
|
||||
|
||||
private static void CheckConfig(string directory, Selection selection, InstallForm installForm = null)
|
||||
{
|
||||
directory.GetCreamApiComponents(out _, out _, out _, out _, out string config);
|
||||
HashSet<SelectionDLC> dlc = selection.DLC.Where(dlc => dlc.Enabled).ToHashSet();
|
||||
foreach (SelectionDLC extraDlc in selection.ExtraSelections.SelectMany(extraSelection =>
|
||||
extraSelection.DLC.Where(_dlc => _dlc.Enabled)))
|
||||
foreach (SelectionDLC extraDlc in selection.ExtraSelections
|
||||
.Select(extraSelection => extraSelection.DLC.Where(_dlc => _dlc.Enabled).ToHashSet())
|
||||
.SelectMany(extraDlc => extraDlc))
|
||||
_ = dlc.Add(extraDlc);
|
||||
|
||||
config.DeleteFile();
|
||||
if (dlc.Count > 0)
|
||||
{
|
||||
/*if (installForm is not null)
|
||||
installForm.UpdateUser("Generating CreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);*/
|
||||
config.CreateFile(true, installForm)?.Close();
|
||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||
WriteConfig(writer, selection.Name, selection.Id,
|
||||
StreamWriter writer = new(config, true, Encoding.Default);
|
||||
WriteConfig(writer, selection.Name, !int.TryParse(selection.Id, out _) ? "0" : selection.Id,
|
||||
new(dlc.ToDictionary(_dlc => _dlc.Id, _dlc => _dlc.Name), PlatformIdComparer.String), installForm);
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
return;
|
||||
}
|
||||
else if (config.FileExists())
|
||||
{
|
||||
config.DeleteFile();
|
||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action,
|
||||
false);
|
||||
}
|
||||
|
||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action,
|
||||
false);
|
||||
}
|
||||
|
||||
private static void WriteConfig(StreamWriter writer, string name, string appId,
|
||||
|
@ -59,10 +107,18 @@ internal static class CreamAPI
|
|||
writer.WriteLine($"; {name}");
|
||||
writer.WriteLine("[steam]");
|
||||
writer.WriteLine($"appid = {appId}");
|
||||
installForm?.UpdateUser($"Added game to cream_api.ini with appid {appId} ({name})",
|
||||
LogTextBox.Action, false);
|
||||
writer.WriteLine("unlockall = false");
|
||||
writer.WriteLine("orgapi = steam_api_o.dll");
|
||||
writer.WriteLine("orgapi64 = steam_api64_o.dll");
|
||||
writer.WriteLine("extraprotection = false"); // we may want to set this on by default?
|
||||
writer.WriteLine("forceoffline = false");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("[steam_misc]"); // this line seems to be required in v5.3.0.0, or the config won't be read
|
||||
writer.WriteLine("disableuserinterface = false");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("[dlc]");
|
||||
// installForm?.UpdateUser($"Added game to cream_api.ini with appid {appId} ({name})",
|
||||
// LogTextBox.Action, false);
|
||||
foreach ((string dlcId, string dlcName) in dlc)
|
||||
{
|
||||
writer.WriteLine($"{dlcId} = {dlcName}");
|
||||
|
|
Loading…
Reference in a new issue