Skip to content

Commit b511987

Browse files
committed
Attempt to Prevent Repair on Incompatible instalation
1 parent baec765 commit b511987

4 files changed

Lines changed: 40 additions & 21 deletions

File tree

include/launcher/isaac_installation.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,32 @@ class InstallationData {
6969
inline bool IsValid() const {
7070
return _isValid;
7171
}
72+
73+
inline std::string GetUpdatedReason() const { //instalationdata is a const in a lot of places and I dont think this alone justifies changing it(or maybe Im just too lazy to do it rn)...so, here goes nothing.
74+
if (_isCompatibleWithRepentogon) {
75+
if (_needsPatch) {
76+
return "Will work, the launcher has a patch to adapt it to a compatible version.";
77+
}
78+
else {
79+
return "Should just work.";
80+
}
81+
}
82+
else {
83+
if (!strncmp(GetVersion(), "v1.7", strlen("v1.7"))) {
84+
return "You need the Repentance+ dlc, you currently only have Repentance installed (WHICH IS NOT THE SAME).";
85+
}
86+
else {
87+
return "You dont have a proper version or your exe is corrupted/cracked \n(verify your files with steam or download the specific version rgon uses)";
88+
}
89+
}
90+
return _CompatReason;
91+
}
92+
93+
inline std::string UpdateReason() {
94+
_CompatReason = GetUpdatedReason();
95+
return _CompatReason;
96+
}
97+
7298
inline std::string GetReason() const {
7399
return _CompatReason;
74100
}

src/isaac_installation.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,7 @@ bool InstallationData::Validate(std::string const& sourcePath, bool repentogon)
291291
const bool alreadyCompatible = RepentogonInstallation::IsIsaacVersionCompatible(GetVersion());
292292
_needsPatch = !repentogon && !alreadyCompatible && PatchIsAvailable();
293293
_isCompatibleWithRepentogon = alreadyCompatible || _needsPatch;
294-
if (_isCompatibleWithRepentogon) {
295-
if (_needsPatch) {
296-
_CompatReason = "Will work, the launcher has a patch to adapt it to a compatible version.";
297-
}
298-
else {
299-
_CompatReason = "Should just work.";
300-
}
301-
}
302-
else {
303-
if (!strncmp(GetVersion(), "v1.7", strlen("v1.7"))) {
304-
_CompatReason = "You need the Repentance+ dlc, you currently only have Repentance installed.";
305-
}
306-
else {
307-
_CompatReason = "You dont have a proper version or your exe is corrupted/cracked (verify your files with steam or download the specific version rgon uses)";
308-
}
309-
}
310-
294+
UpdateReason();
311295
if (srgon::IsStandaloneFolder(sourcePath) && !repentogon) {
312296
_gui->LogWarn("The main Isaac executable is located in a Repentogon installation, this likely indicates a broken configuration\n");
313297
Logger::Error("Main Isaac executable %s is located inside a Repentogon installation", path.c_str());

src/windows/launcher.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ namespace Launcher {
707707
.GetRepentogonInstallation().GetExePath();
708708
if (repentogonPath.empty()) {
709709
_repentogonFileText->SetForegroundColour(*wxRED);
710-
_repentogonFileText->SetValue("No executable found");
710+
_repentogonFileText->SetValue("Didnt install properly! (Incompatible?)");
711711
} else {
712712
_repentogonFileText->SetForegroundColour(*wxBLACK);
713713
_repentogonFileText->SetValue(repentogonPath);
@@ -988,14 +988,23 @@ namespace Launcher {
988988
break;
989989
case ADVANCED_EVENT_REINSTALL:
990990
_logWindow.Log("Attempting Repair...");
991-
if (!Filesystem::SafeExists(_installation->GetIsaacInstallation().GetMainInstallation().GetFolderPath() + "Repentogon") || fs::remove_all(_installation->GetIsaacInstallation().GetMainInstallation().GetFolderPath() + "Repentogon")) {
991+
if (!_installation->GetIsaacInstallation().GetRepentogonInstallation().IsCompatibleWithRepentogon()) {
992+
std::string reason = _installation->GetIsaacInstallation().GetRepentogonInstallation().GetUpdatedReason();
993+
_logWindow.LogError("Repair Failed!, Not compatible!. Reason: %s", reason);
994+
wxMessageDialog dialog(this, "Repair Failed!, your Isaac instalation is not compatible with repentogon.\nReason: " + reason, "Incompatible Isaac Instalation!", wxOK);
995+
int result = dialog.ShowModal();
996+
}
997+
else if (!Filesystem::SafeExists(_installation->GetIsaacInstallation().GetMainInstallation().GetFolderPath() + "Repentogon") || fs::remove_all(_installation->GetIsaacInstallation().GetMainInstallation().GetFolderPath() + "Repentogon")) {
992998
ForceRepentogonUpdate(GetRepentogonUnstableUpdatesState());
993999
}
9941000
else {
9951001
_logWindow.Log("Repair Failed!, Could not remove the Repentogon folder!");
9961002
}
9971003
break;
9981004
case ADVANCED_EVENT_FORCE_REPENTOGON_UPDATE:
1005+
if (!_installation->GetIsaacInstallation().GetRepentogonInstallation().IsCompatibleWithRepentogon()) {
1006+
_logWindow.LogWarn("Update may Fail!, Vanilla not compatible!. Reason: %s", _installation->GetIsaacInstallation().GetRepentogonInstallation().GetUpdatedReason());
1007+
}
9991008
ForceRepentogonUpdate(GetRepentogonUnstableUpdatesState());
10001009
break;
10011010

src/windows/setup_wizard.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ void LauncherWizard::OnPageChanged(wxWizardEvent& event) {
319319

320320
void LauncherWizard::UpdateIsaacSetupNextButton() {
321321
wxWindow* button = FindWindowById(wxID_FORWARD, this);
322-
if (button) {
323-
button->Enable(_isaacFound);
322+
if (button) {
323+
button->Enable(_isaacFound && _installation->GetIsaacInstallation().GetRepentogonInstallation().IsCompatibleWithRepentogon());
324324
}
325325
}
326326

0 commit comments

Comments
 (0)