Remove the need for a meminfo file by just creating
fopenRedirect.c
Sat Feb 21 09:37:57 CET 2009 Alan Swanson
* Remove the need for a meminfo file by just creating
one at /tmp/meminfo-mythe
--- old-myth2/fopenRedirect.c 2014-10-30 08:05:13.000000000 +0100
+++ new-myth2/fopenRedirect.c 2014-10-30 08:05:13.000000000 +0100
@@ -29,13 +29,26 @@
#include <string.h>
#include <dlfcn.h>
+/* Old meminfo emulating 256Mb */
+char const *str = "root: total: used: free: shared: buffers: cached:\n"
+ "Mem: 268435456 0 268435456 0 0 0\n"
+ "Swap: 268435456 0 268435456\n";
+
FILE* fopen(const char *filename, const char *modes)
{
FILE* (*_fopen) (const char*,const char*) = dlsym(RTLD_NEXT, "fopen");
+ FILE* fp;
if (strcmp(filename,"/proc/meminfo") == 0) {
- printf("meminfo fix\n");
- return _fopen("/usr/local/games/myth2/meminfo", modes); //change this path
+ printf("Compatibility meminfo fix for OpenGL and cutscenes by Tobias Rautenkranz\n");
+
+ fp = fopen("/tmp/meminfo-myth2", "w");
+ if (fp != NULL) {
+ fwrite(str, strlen(str), 1, fp);
+ fclose(fp);
+ }
+
+ return _fopen("/tmp/meminfo-myth2", modes);
} else
return _fopen(filename, modes);
}