[PATCH] mscoree: Only override Microsoft.Xna.Framework version 4.

Esme Povirk esme at codeweavers.com
Sun Aug 8 09:32:34 CDT 2021

Signed-off-by: Esme Povirk <esme at codeweavers.com>

At some point when I wasn't paying attention, Wine Mono's
C++/CLI support got good enough to run the original XNA redists.
We only have a replacement for XNA version 4. This relaxes the
default so that XNA 3.x can still load and work.

In theory, we could get rid of this default entirely, but XNA has
been known to be picky about graphics drivers, and at the moment
FNA has more testing in this environment, so I still feel FNA is
the better choice when possible.

Also ideally we would add general version filtering capabilities
to the override settings, so the new default could be expressed
in that syntax, but I don't see an immediate need for it.

 dlls/mscoree/metahost.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index acefb2887ca..b3816600214 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -89,6 +89,7 @@ MonoImage* (CDECL *mono_assembly_get_image)(MonoAssembly *assembly);
 MonoAssembly* (CDECL *mono_assembly_load_from)(MonoImage *image, const char *fname, MonoImageOpenStatus *status);
 const char* (CDECL *mono_assembly_name_get_name)(MonoAssemblyName *aname);
 const char* (CDECL *mono_assembly_name_get_culture)(MonoAssemblyName *aname);
+WORD (CDECL *mono_assembly_name_get_version)(MonoAssemblyName *aname, WORD *minor, WORD *build, WORD *revision);
 MonoAssembly* (CDECL *mono_assembly_open)(const char *filename, MonoImageOpenStatus *status);
 void (CDECL *mono_callspec_set_assembly)(MonoAssembly *assembly);
 MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type);
@@ -199,6 +200,7 @@ static HRESULT load_mono(LPCWSTR mono_path)
+        LOAD_MONO_FUNCTION(mono_assembly_name_get_version);
@@ -1553,8 +1555,9 @@ static DWORD get_basename_search_flags(const char *basename, MonoAssemblyName *a
         return reg_entry.flags;
-    if (strcmp(basename, "Microsoft.Xna.Framework.*") == 0)
-        /* XNA redist is broken in Wine Mono, use FNA instead. */
+    if (strcmp(basename, "Microsoft.Xna.Framework.*") == 0 &&
+        mono_assembly_name_get_version(aname, NULL, NULL, NULL) == 4)
+        /* Use FNA as a replacement for XNA4. */
         return 0;

More information about the wine-devel mailing list