Now About Social Code
summaryrefslogtreecommitdiff
path: root/src/wrap.c
diff options
context:
space:
mode:
authorLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-08-07 08:07:39 +0100
committerLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-08-07 08:07:39 +0100
commit24ec7446266ff2fae00ddc6124d8d3237ec1841d (patch)
tree946035039c96afb8b782d3bd8b943d5a313f8c88 /src/wrap.c
parent499cc60e728ff7225fd7cac158ff772435c27b62 (diff)
wrap: Fix crashing from missing mmap offset
Diffstat (limited to 'src/wrap.c')
-rw-r--r--src/wrap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wrap.c b/src/wrap.c
index 7115b53..2801211 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -210,7 +210,7 @@ static void clear_mem(struct mem_entry *mem) {
|| heap == PVR_HEAP_PDS_VERTEX_CODE_DATA
|| heap == PVR_HEAP_PDS_PIXEL_CODE_DATA
|| heap == PVR_HEAP_GENERAL
- //|| heap == PVR_HEAP_KERNEL_DATA
+ || heap == PVR_HEAP_KERNEL_DATA
|| heap == PVR_HEAP_PERCONTEXT_3DPARAMETERS
|| heap == PVR_HEAP_SYNC_INFO
|| heap == PVR_HEAP_TA_DATA;
@@ -250,7 +250,7 @@ static struct mem_entry *add_mmap_pointer(void* data, int prot, size_t length, u
for (int j = 0; j < 2; j++) {
if (mem->in_use && mem->has_mmap[j]) {
if (mem->mmap_data[j].uiMMapOffset == pgoffset && mem->mmap_data[j].uiRealByteSize == length) {
- mem->data[j] = data;
+ mem->data[j] = data + mem->mmap_data[j].uiByteOffset;
mem->prot[j] = prot;
return mem;
}
@@ -1103,7 +1103,7 @@ long syscall(long number, ...) {
va_end(args);
long ret = orig_syscall(number, addr, length, prot, flags, fd, pgoffset);
if (is_pvr(fd)) {
- printf("mmap2 called with 0x%lx 0x%x 0x%x %x\n", ret, flags, addr, pgoffset);
+ printf("mmap2 called with 0x%lx 0x%lx 0x%lx %lx\n", ret, flags, addr, pgoffset);
last_mem_entry = add_mmap_pointer((void*)ret, prot, length, pgoffset);
clear_mem(last_mem_entry);
}