aparently free/malloc are legal idk, fix a mem reader crash

This commit is contained in:
bgkillas 2025-12-01 13:16:59 -05:00
parent aae64b63fc
commit 11e0f4c26e
3 changed files with 63 additions and 55 deletions

View file

@ -38,19 +38,19 @@ fn write(addr: *mut *const usize, new: *const usize) {
#[unsafe(no_mangle)]
pub extern "stdcall" fn DllMain(_: *const u8, _: u32, _: *const u8) -> u32 {
/*write(
write(
0x00f074f0 as *mut *const usize, //malloc
operator_new as *const usize,
);*/
);
write(
0x00f07500 as *mut *const usize, //operator_new
operator_new as *const usize,
);
/*write(
write(
0x00f074f4 as *mut *const usize, //free
operator_delete as *const usize,
);*/
);
write(
0x00f07504 as *mut *const usize, //operator_delete
operator_delete as *const usize,

View file

@ -106,7 +106,10 @@ impl eframe::App for App {
..Default::default()
},
|ui| {
egui::ScrollArea::vertical().id_salt("1").show(ui, |ui| {
egui::ScrollArea::vertical()
.id_salt("1")
.auto_shrink([false; 2])
.show(ui, |ui| {
if let Some(d) = self.elem.show(
ui,
&self.reader,
@ -128,7 +131,10 @@ impl eframe::App for App {
..Default::default()
},
|ui| {
egui::ScrollArea::vertical().id_salt("2").show(ui, |ui| {
egui::ScrollArea::vertical()
.id_salt("2")
.auto_shrink([false; 2])
.show(ui, |ui| {
if let Some(data) = &self.data {
match data {
Data::Values(refs, n) => {
@ -582,11 +588,13 @@ impl Struct {
s = i;
not_null = false;
v = None;
null = None
} else {
if let Some((i, k)) = mem::take(&mut null) {
if let Some((i, v)) = mem::take(&mut null) {
let (f, _): &(String, _) = &fields[i];
let f = f.clone();
let arr = fields.drain(i..k).map(|(_, b)| b).collect();
let arr: Vec<Elem> = fields.drain(i..v).map(|(_, b)| b).collect();
s -= arr.len();
fields.insert(i, (f, Elem::Array(arr)));
}
if s - k > 2 {
@ -602,6 +610,7 @@ impl Struct {
}
} else {
v = Some(i);
null = None
}
}
if not_null {

View file

@ -332,7 +332,6 @@ pub struct LiquidCellVTable {
#[derive(Clone, Debug, Copy)]
pub struct Cell {
pub vtable: CellVTable,
pub hp: isize,
unknown1: [isize; 2],
pub is_burning: bool,