changeset 33862:5d19df9dfda8

Add some runtime patching magic required for latest Cineform decoder.
author reimar
date Sat, 30 Jul 2011 20:44:37 +0000
parents bf10aa37e4f5
children c11ca83a9965
files loader/module.c
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/loader/module.c	Sat Jul 30 20:26:29 2011 +0000
+++ b/loader/module.c	Sat Jul 30 20:44:37 2011 +0000
@@ -435,6 +435,25 @@
 	    printf("Win32 LoadLibrary failed to load: %s\n", checked);
 
 #define RVA(x) ((char *)wm->module+(unsigned int)(x))
+	if (strstr(libname, "CFDecode2.ax") && wm)
+	{
+	    if (PE_FindExportedFunction(wm, "DllGetClassObject", TRUE) == RVA(0xd00e0))
+	    {
+	        // Patch some movdqa to movdqu
+	        // It is currently unclear why this is necessary, it seems
+	        // to be some output frame, but our frame seems correctly
+	        // aligned
+	        int offsets[] = {0x7318c, 0x731ba, 0x731e0, 0x731fe, 0};
+	        int i;
+	        for (i = 0; offsets[i]; i++)
+	        {
+	            int ofs = offsets[i];
+	            if (RVA(ofs)[0] == 0x66 && RVA(ofs)[1] == 0x0f &&
+	                RVA(ofs)[2] == 0x7f)
+	                RVA(ofs)[0] = 0xf3;
+	        }
+	    }
+	}
 	if (strstr(libname,"vp31vfw.dll") && wm)
 	{
 	    int i;