notaz.gp2x.de
/
ginge.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
handle another palette write
[ginge.git]
/
loader
/
dl.c
diff --git
a/loader/dl.c
b/loader/dl.c
index
154e012
..
4282764
100644
(file)
--- a/
loader/dl.c
+++ b/
loader/dl.c
@@
-1,4
+1,9
@@
-// vim:shiftwidth=2:expandtab
+/*
+ * GINGE - GINGE Is Not Gp2x Emulator
+ * (C) notaz, 2010-2011
+ *
+ * This work is licensed under the MAME license, see COPYING file for details.
+ */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
@@
-9,6
+14,14
@@
#define DL
#include "override.c"
#define DL
#include "override.c"
+static void next_line(FILE *f)
+{
+ int c;
+ do {
+ c = fgetc(f);
+ } while (c != EOF && c != '\n');
+}
+
__attribute__((constructor))
static void ginge_init(void)
{
__attribute__((constructor))
static void ginge_init(void)
{
@@
-32,7
+45,7
@@
static void ginge_init(void)
exit(1);
}
exit(1);
}
- ret = fscanf(f, "%x-%x
%*s %*s %*s %*s %*s\n
", &start, &end);
+ ret = fscanf(f, "%x-%x ", &start, &end);
if (ret != 2) {
perror("parse maps");
exit(1);
if (ret != 2) {
perror("parse maps");
exit(1);
@@
-46,6
+59,8
@@
static void ginge_init(void)
perror("warning: mprotect");
while (1) {
perror("warning: mprotect");
while (1) {
+ next_line(f);
+
ret = fscanf(f, "%x-%*s %*s %*s %*s %*s %*s\n", &start);
if (ret <= 0)
break;
ret = fscanf(f, "%x-%*s %*s %*s %*s %*s %*s\n", &start);
if (ret <= 0)
break;
@@
-62,6
+77,12
@@
static void ginge_init(void)
#endif
fclose(f);
#endif
fclose(f);
+ // remove self from preload, further commands (from system() and such)
+ // will be handled by ginge_prep.
+ unsetenv("LD_PRELOAD");
+ unsetenv("LD_LIBRARY_PATH");
+
emu_init((void *)lowest_segment);
}
emu_init((void *)lowest_segment);
}
+// vim:shiftwidth=2:expandtab