Sat Feb 21 12:08:59 CET 2009 tobias@rautenkranz.ch * create meminfo in memory diff -rN -u old-myth2/Makefile new-myth2/Makefile --- old-myth2/Makefile 2014-10-30 08:04:45.000000000 +0100 +++ new-myth2/Makefile 2014-10-30 08:04:45.000000000 +0100 @@ -20,4 +20,4 @@ clean: rm -f -- *.o rm -f -- *.so - rm -f -- test/*.o test/fopen-cat + rm -f -- tests/*.o tests/fopen-cat diff -rN -u old-myth2/README new-myth2/README --- old-myth2/README 2014-10-30 08:04:45.000000000 +0100 +++ new-myth2/README 2014-10-30 08:04:45.000000000 +0100 @@ -1,6 +1,7 @@ -Myth2 for Linux parses /proc/meminfo, +Myth2 (1.3e) for Linux parses /proc/meminfo, but its format changed some time ago. Therefore it won't activate OpenGL. +It should also fix the cut scenes crash. Error message: ~$ myth2 @@ -15,3 +16,6 @@ 21.2.2009: Release 0.2 (thanks to Alan Swanson) * link to ld library * create meminfo dynamically + +Contact: + tobias@rautenkranz.ch diff -rN -u old-myth2/fopenRedirect.c new-myth2/fopenRedirect.c --- old-myth2/fopenRedirect.c 2014-10-30 08:04:45.000000000 +0100 +++ new-myth2/fopenRedirect.c 2014-10-30 08:04:45.000000000 +0100 @@ -23,50 +23,22 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#define _GNU_SOURCE #include - -#define __USE_GNU #include -#include -#include -#include #include /* Old meminfo emulating 256Mb */ -static const char meminfo_str[] = +static char meminfo_str[] = "root: total: used: free: shared: buffers: cached:\n" "Mem: 268435456 0 268435456 0 0 0\n" "Swap: 268435456 0 268435456\n"; -int tmp_meminfo = -1; - -/** Returns a stream to an meminfo file. */ FILE* -make_meminfo() -{ - FILE* tmp_meminfo = tmpfile(); - - if (!tmp_meminfo) - { - perror("myth-meminfo: creating temponary meminfo"); - return NULL; - } - - size_t len = fwrite(meminfo_str, 1, sizeof(meminfo_str), tmp_meminfo); - if (len != sizeof(meminfo_str)) - { - perror("myth-meminfo: writing temporary meminfo"); - return NULL; - } - - rewind(tmp_meminfo); - - return tmp_meminfo; -} - -FILE* fopen(const char *filename, const char *mode) +fopen(const char *filename, const char *mode) { FILE* (*_fopen)(const char*,const char*) = dlsym(RTLD_NEXT, "fopen"); + if (!_fopen) { fprintf(stderr, "myth-meminfo: dlsym: %s\n", dlerror()); @@ -77,7 +49,7 @@ { fprintf(stderr, "myth-meminfo: fixing /proc/meminfo\n"); - return make_meminfo(); + return fmemopen(meminfo_str, sizeof(meminfo_str), mode); } else return _fopen(filename, mode);