mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
make world ptr grid world
This commit is contained in:
parent
07bdcd64b3
commit
62cd73bd96
3 changed files with 9 additions and 18 deletions
|
@ -51,26 +51,20 @@ pub unsafe extern "C" fn luaopen_blob_guy(lua: *mut lua_State) -> c_int {
|
|||
fn init_particle_world_state(lua: LuaState) -> eyre::Result<()> {
|
||||
STATE.with(|state| {
|
||||
let mut state = state.borrow_mut();
|
||||
#[cfg(target_arch = "x86")]
|
||||
let world_ptr = lua.to_integer(1) as *const c_void;
|
||||
let world_ptr = lua.to_integer(1) as *const noita::ntypes::GridWorld;
|
||||
let chunk_map_ptr = unsafe { (lua.to_integer(2) as *const c_void).offset(8) };
|
||||
let material_list_ptr = lua.to_integer(3) as *const noita::ntypes::CellData;
|
||||
#[cfg(target_arch = "x86")]
|
||||
let construct_ptr = lua.to_integer(4) as *const c_void;
|
||||
#[cfg(target_arch = "x86")]
|
||||
let remove_ptr = lua.to_integer(5) as *const c_void;
|
||||
let blob_guy = noita_api::raw::cell_factory_get_type("blob_guy".into())? as u16;
|
||||
state.blob_guy = blob_guy;
|
||||
let pws = ParticleWorldState {
|
||||
#[cfg(target_arch = "x86")]
|
||||
world_ptr,
|
||||
chunk_map_ptr,
|
||||
material_list_ptr,
|
||||
blob_guy,
|
||||
blob_ptr: unsafe { material_list_ptr.offset(blob_guy as isize) },
|
||||
#[cfg(target_arch = "x86")]
|
||||
construct_ptr,
|
||||
#[cfg(target_arch = "x86")]
|
||||
remove_ptr,
|
||||
};
|
||||
state.particle_world_state = pws;
|
||||
|
|
|
@ -7,15 +7,12 @@ pub(crate) mod ntypes;
|
|||
//pub(crate) mod pixel;
|
||||
#[derive(Default)]
|
||||
pub(crate) struct ParticleWorldState {
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub(crate) world_ptr: *const c_void,
|
||||
pub(crate) world_ptr: *const ntypes::GridWorld,
|
||||
pub(crate) chunk_map_ptr: *const c_void,
|
||||
pub(crate) material_list_ptr: *const ntypes::CellData,
|
||||
pub(crate) blob_guy: u16,
|
||||
pub(crate) blob_ptr: *const ntypes::CellData,
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub(crate) construct_ptr: *const c_void,
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub(crate) remove_ptr: *const c_void,
|
||||
}
|
||||
unsafe impl Sync for ParticleWorldState {}
|
||||
|
@ -50,7 +47,7 @@ impl ParticleWorldState {
|
|||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
{
|
||||
std::hint::black_box((x, y, material));
|
||||
std::hint::black_box((x, y, material, self.world_ptr, self.construct_ptr));
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +71,7 @@ impl ParticleWorldState {
|
|||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
{
|
||||
std::hint::black_box((x, y, cell));
|
||||
std::hint::black_box((x, y, cell, self.world_ptr, self.remove_ptr));
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ pub struct Colour {
|
|||
a: u8,
|
||||
}
|
||||
|
||||
/*impl Debug for CellArrayPtr {
|
||||
impl Debug for CellArrayPtr {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:?}", unsafe { self.0.as_ref() })
|
||||
}
|
||||
|
@ -27,17 +27,17 @@ impl Debug for CellPtr {
|
|||
write!(f, "{:?}", unsafe { self.0.as_ref() })
|
||||
}
|
||||
}
|
||||
impl Debug for CellDataPtr {
|
||||
/*impl Debug for CellDataPtr {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:?}", unsafe { self.0.as_ref() })
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub(crate) struct CellPtr(pub *const Cell);
|
||||
pub(crate) struct CellDataPtr(pub *const CellData);*/
|
||||
|
||||
#[repr(C)]
|
||||
pub(crate) struct CellDataPtr(pub *const CellData);
|
||||
pub(crate) struct CellPtr(pub *const Cell);
|
||||
|
||||
#[repr(C)]
|
||||
pub(crate) struct CellArrayPtr(pub *mut CellPtr);
|
||||
|
@ -87,7 +87,7 @@ pub struct GridWorld {
|
|||
pub chunk_map: ChunkMap,
|
||||
unknown2: [isize; 41],
|
||||
m_thread_impl: *const c_void,
|
||||
}*/
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
union Buffer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue