Skip to content

Commit 97080ab

Browse files
committed
[Imp] Wine Integration: Provide the user with reasons why Wine Integration is not available.
git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@23684 56274372-70c3-4bfc-bfc3-4c3a0b034d27
1 parent 360dea0 commit 97080ab

1 file changed

Lines changed: 50 additions & 14 deletions

File tree

mptrack/MPTrackWine.cpp

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,14 @@ mpt::ustring WineGetSystemInfoString(mpt::OS::Wine::VersionContext & wineVersion
153153
}
154154

155155

156-
bool WineSetupIsSupported(mpt::OS::Wine::VersionContext & wineVersion)
156+
bool WineSetupIsSupported(mpt::OS::Wine::VersionContext & wineVersion, std::vector<mpt::ustring> & reasons)
157157
{
158158
bool supported = true;
159-
if(wineVersion.RawBuildID().empty()) supported = false;
159+
if(wineVersion.RawBuildID().empty())
160+
{
161+
supported = false;
162+
reasons.push_back(MPT_USTRING("Empty result from wine_get_build_id()."));
163+
}
160164
if(!TrackerSettings::Instance().WineSupportAllowUnknownHost)
161165
{
162166
if((wineVersion.HostClass() == mpt::osinfo::osclass::Linux) || ((wineVersion.HostClass() == mpt::osinfo::osclass::BSD_) && wineVersion.RawHostSysName() == "FreeBSD"))
@@ -165,33 +169,64 @@ bool WineSetupIsSupported(mpt::OS::Wine::VersionContext & wineVersion)
165169
} else
166170
{
167171
supported = false;
172+
reasons.push_back(MPT_UFORMAT("Unsupported host OS type: {}")(mpt::ToUnicode(mpt::Charset::UTF8, wineVersion.RawHostSysName())));
168173
}
169174
}
170-
if(!wineVersion.Version().IsValid()) supported = false;
175+
if(!wineVersion.Version().IsValid())
176+
{
177+
supported = false;
178+
reasons.push_back(MPT_UFORMAT("Failed to parse Wine version: {}")(mpt::ToUnicode(mpt::Charset::UTF8, wineVersion.RawVersion())));
179+
}
171180
if(wineVersion.Version().IsAtLeast(mpt::osinfo::windows::wine::version{10, 11, 0}) && wineVersion.Version().IsBefore(mpt::osinfo::windows::wine::version{10, 12, 0}))
172181
{
173182
// Blacklisted due to <https://bugs.openmpt.org/view.php?id=1904>.
174183
// Probably caused by <https://gitlab.winehq.org/wine/wine/-/commit/96cd811903e3d3f227c39e12235725baf793f4b9>,
175184
// and maybe fixed by <https://gitlab.winehq.org/wine/wine/-/commit/aae0f624d48d1e4f79e6947798e61b4d1006bf76>.
185+
// Upstream bug: <https://bugs.winehq.org/show_bug.cgi?id=58435>.
176186
supported = false;
187+
reasons.push_back(MPT_USTRING("Buggy Wine version 10.11.x: https://bugs.openmpt.org/view.php?id=1904"));
177188
}
178189
return supported;
179190
}
180191

181-
bool WineSetupIsSupported(mpt::Wine::Context & wine)
192+
bool WineSetupIsSupported(mpt::Wine::Context & wine, std::vector<mpt::ustring> & reasons)
182193
{
183194
bool supported = true;
184-
if(theApp.GetInstallPath().empty()) supported = false;
185-
if(wine.PathToPosix(theApp.GetInstallPath()).empty()) supported = false;
186-
if(wine.PathToPosix(theApp.GetConfigPath()).empty()) supported = false;
187-
if(wine.PathToWindows("/").empty()) supported = false;
195+
if(theApp.GetInstallPath().empty())
196+
{
197+
supported = false;
198+
reasons.push_back(MPT_USTRING("Empty OpenMPT install path."));
199+
}
200+
if(wine.PathToPosix(theApp.GetInstallPath()).empty())
201+
{
202+
supported = false;
203+
reasons.push_back(MPT_USTRING("Empty Unix OpenMPT install path."));
204+
}
205+
if(wine.PathToPosix(theApp.GetConfigPath()).empty())
206+
{
207+
supported = false;
208+
reasons.push_back(MPT_USTRING("Empty Unix OpenMPT config path."));
209+
}
210+
if(wine.PathToWindows("/").empty())
211+
{
212+
supported = false;
213+
reasons.push_back(MPT_USTRING("Empty Windows root path."));
214+
}
188215
if(supported)
189216
{
190-
if(wine.HOME().empty()) supported = false;
217+
if(wine.HOME().empty())
218+
{
219+
supported = false;
220+
reasons.push_back(MPT_USTRING("Empty $HOME path."));
221+
}
191222
}
192223
if(supported)
193224
{
194-
if(wine.Uname_m() == "x86_64" && mpt::pointer_size != 8) supported = false;
225+
if(wine.Uname_m() == "x86_64" && mpt::pointer_size != 8)
226+
{
227+
supported = false;
228+
reasons.push_back(MPT_USTRING("Architecture mismatch."));
229+
}
195230
}
196231
return supported;
197232
}
@@ -269,18 +304,19 @@ void Initialize()
269304
}
270305

271306
mpt::OS::Wine::VersionContext wineVersion = *theApp.GetWineVersion();
272-
if(!WineSetupIsSupported(wineVersion))
307+
std::vector<mpt::ustring> reasons;
308+
if(!WineSetupIsSupported(wineVersion, reasons))
273309
{
274-
Reporting::Notification(U_("OpenMPT does not support Wine integration on your current Wine setup."), WineGetWindowTitle());
310+
Reporting::Notification(MPT_UFORMAT("OpenMPT does not support Wine integration on your current Wine setup.\nReasons:\n{}")(mpt::join(reasons, MPT_USTRING("\n"))), WineGetWindowTitle());
275311
return;
276312
}
277313

278314
try
279315
{
280316
mpt::Wine::Context wine = mpt::Wine::Context(wineVersion);
281-
if(!WineSetupIsSupported(wine))
317+
if(!WineSetupIsSupported(wine, reasons))
282318
{
283-
Reporting::Notification(U_("OpenMPT does not support Wine integration on your current Wine setup."), WineGetWindowTitle());
319+
Reporting::Notification(MPT_UFORMAT("OpenMPT does not support Wine integration on your current Wine setup.\nReasons:\n{}")(mpt::join(reasons, MPT_USTRING("\n"))), WineGetWindowTitle());
284320
return;
285321
}
286322
theApp.SetWine(std::make_shared<mpt::Wine::Context>(wine));

0 commit comments

Comments
 (0)