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 diff -rN -u old-myth2/README new-myth2/README --- old-myth2/README 2014-10-30 08:05:10.000000000 +0100 +++ new-myth2/README 2014-10-30 08:05:10.000000000 +0100 @@ -8,7 +8,5 @@ By suppling an old meminfo this can be fixed: - -* Adjust the path in fopenRedirect.c:38 to match the supplied meminfo file. * Compile with: make * Start myth2: LD_PRELOAD=./fopenr.so myth2 diff -rN -u old-myth2/fopenRedirect.c new-myth2/fopenRedirect.c --- old-myth2/fopenRedirect.c 2014-10-30 08:05:10.000000000 +0100 +++ new-myth2/fopenRedirect.c 2014-10-30 08:05:10.000000000 +0100 @@ -29,13 +29,26 @@ #include #include +/* 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); } diff -rN -u old-myth2/meminfo new-myth2/meminfo --- old-myth2/meminfo 2014-10-30 08:05:10.000000000 +0100 +++ new-myth2/meminfo 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -root: total: used: free: shared: buffers: cached: -Mem: 1000000000 0 1000000000 0 0 0 -Swap: 1000000000 0 1000000000