add names field to mods thingy

This commit is contained in:
bgkillas 2025-07-24 22:02:52 -04:00
parent 5663b1ec04
commit 69f4eb30a2
3 changed files with 22 additions and 2 deletions

View file

@ -229,7 +229,7 @@ impl Globals {
let platform = 0x1221bc0 as *mut Platform;
let filenames = 0x1207bd4 as *mut StdVec<StdString>;
let inventory = 0x12224f0 as *mut Inventory;
let mods = 0x1207e9c as *mut Mods;
let mods = 0x1207e90 as *mut Mods;
Self {
world_seed,
new_game_count,

View file

@ -174,6 +174,25 @@ impl Debug for CString {
f.debug_tuple("CString").field(&self.to_string()).finish()
}
}
#[repr(transparent)]
pub struct CStr<const N: usize>(pub [u8; N]);
impl<const N: usize> Display for CStr<N> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut string = String::new();
for c in self.0 {
if c == 0 {
break;
}
string.push(char::from(c));
}
write!(f, "{string}")
}
}
impl<const N: usize> Debug for CStr<N> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("CStr").field(&self.to_string()).finish()
}
}
#[repr(C)]
pub struct StdVec<T> {
pub start: *mut T,

View file

@ -1,5 +1,5 @@
use crate::lua::LuaState;
use crate::noita::types::{StdMap, StdString, StdVec, Vec2};
use crate::noita::types::{CStr, StdMap, StdString, StdVec, Vec2};
#[derive(Debug)]
pub struct GlobalStatsVTable {}
#[derive(Debug)]
@ -95,6 +95,7 @@ pub struct Language {
#[derive(Debug)]
#[repr(C)]
pub struct Mods {
pub names: StdVec<CStr<0x28>>,
pub list: StdVec<Mod>,
}
#[derive(Debug)]