mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
make debug prints not too big that they crash
This commit is contained in:
parent
1ab79d6cb7
commit
0ba90ef44c
1 changed files with 41 additions and 5 deletions
|
@ -21,19 +21,44 @@ pub struct Color {
|
||||||
pub struct ChunkPtr(pub *mut &'static mut [CellPtr; 512 * 512]);
|
pub struct ChunkPtr(pub *mut &'static mut [CellPtr; 512 * 512]);
|
||||||
impl Debug for ChunkPtr {
|
impl Debug for ChunkPtr {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{:?}", unsafe { self.0.as_ref() })
|
write!(
|
||||||
|
f,
|
||||||
|
"ChunkPtr {{{:?} {:?}}}",
|
||||||
|
self.0,
|
||||||
|
unsafe { self.0.as_ref() }.map(|c| c.iter().filter(|c| !c.0.is_null()).count()),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsafe impl Sync for ChunkPtr {}
|
unsafe impl Sync for ChunkPtr {}
|
||||||
unsafe impl Send for ChunkPtr {}
|
unsafe impl Send for ChunkPtr {}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct ChunkMap {
|
pub struct ChunkMap {
|
||||||
unknown: [isize; 2],
|
unknown: [isize; 2],
|
||||||
pub cell_array: &'static [ChunkPtr; 512 * 512],
|
pub cell_array: &'static [ChunkPtr; 512 * 512],
|
||||||
unknown2: [isize; 8],
|
unknown2: [isize; 8],
|
||||||
}
|
}
|
||||||
|
impl Debug for ChunkMap {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"ChunkMap {{ unknown: {:?}, cell_array: {{{}}} ,unknown2: {:?} }}",
|
||||||
|
self.unknown,
|
||||||
|
self.cell_array
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.filter(|(_, c)| !c.0.is_null())
|
||||||
|
.map(|(i, c)| {
|
||||||
|
let x = i as isize % 512 - 256;
|
||||||
|
let y = i as isize / 512 - 256;
|
||||||
|
format!("{i}: {{ x: {x}, y: {y}, {c:?}}}",)
|
||||||
|
})
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(", "),
|
||||||
|
self.unknown2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -180,7 +205,7 @@ impl Default for ExplosionConfig {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct GridCosmeticParticleConfig {
|
pub struct GridCosmeticParticleConfig {
|
||||||
//TODO find some data maybe
|
//TODO find some data maybe
|
||||||
}
|
}
|
||||||
#[allow(clippy::derivable_impls)]
|
#[allow(clippy::derivable_impls)]
|
||||||
impl Default for GridCosmeticParticleConfig {
|
impl Default for GridCosmeticParticleConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
@ -699,7 +724,18 @@ impl Cell {
|
||||||
pub struct CellPtr(pub *const Cell);
|
pub struct CellPtr(pub *const Cell);
|
||||||
impl Debug for CellPtr {
|
impl Debug for CellPtr {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{:?}", unsafe { self.0.as_ref() })
|
let c = unsafe { self.0.as_ref() };
|
||||||
|
let Some(c) = c else {
|
||||||
|
return write!(f, "{c:?}");
|
||||||
|
};
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"CellPtr{{{:?}}}",
|
||||||
|
format!("{c:?}")
|
||||||
|
.split_once("material_ptr")
|
||||||
|
.unwrap_or_default()
|
||||||
|
.0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsafe impl Sync for CellPtr {}
|
unsafe impl Sync for CellPtr {}
|
||||||
|
@ -754,4 +790,4 @@ pub struct GameGlobal {
|
||||||
pub m_cell_factory: &'static CellFactory,
|
pub m_cell_factory: &'static CellFactory,
|
||||||
unknown2: [isize; 11],
|
unknown2: [isize; 11],
|
||||||
pub pause_state: isize,
|
pub pause_state: isize,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue