Browse Source

Remove hard-coded value to patch W_CacheLumpNum

master
Alec Murphy 3 months ago
parent
commit
79c95e774c
  1. 13
      Lib/LibC.HC

13
Lib/LibC.HC

@ -1,7 +1,16 @@
extern U64 get_symbol_address(U8 *entry_name);
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
U64 find_u32_in_memory(U64 offset, U32 value) {
I64 i = 0;
while (MemCmp(offset + i, &value, 4))
i++;
return offset + i;
}
U8 *f_whence[3];
f_whence[0] = "SEEK_SET";
f_whence[1] = "SEEK_CUR";
@ -396,7 +405,9 @@ U0 lseek() {
U8 *@mmap(I64 fd) {
no_warn fd;
MemSetU32(0x4136ae, iwad_fp->data, 1);
MemSetU32(
find_u32_in_memory(get_symbol_address("W_CacheLumpNum"), 0xcafef00d),
iwad_fp->data, 1);
return iwad_fp->data;
}

Loading…
Cancel
Save