-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use unity::prelude::*; | ||
|
||
use super::{Gamedata, StructBaseFields}; | ||
|
||
#[unity::class("App", "AccessoryData")] | ||
pub struct AccessoryData { | ||
pub parent: StructBaseFields, | ||
pub aid: &'static Il2CppString, | ||
pub name: &'static Il2CppString, | ||
pub help: &'static Il2CppString, | ||
pub name_m: &'static Il2CppString, | ||
pub help_m: &'static Il2CppString, | ||
pub name_f: &'static Il2CppString, | ||
pub help_f: &'static Il2CppString, | ||
pub first: bool, | ||
pub amiibo: bool, | ||
pub condition_cid: &'static Il2CppString, | ||
pub condition_gender: i32, | ||
pub condition_skills: &'static [Il2CppString; 0], | ||
pub gid: &'static Il2CppString, | ||
pub asset: &'static Il2CppString, | ||
pub price: i32, | ||
pub iron: i32, | ||
pub steel: i32, | ||
pub silver: i32, | ||
pub mask: i32, | ||
pub kind: i32, | ||
pub god_data: u64, | ||
pub flag_name: &'static Il2CppString, | ||
|
||
// ... | ||
} | ||
|
||
impl Gamedata for AccessoryData { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use unity::prelude::*; | ||
use unity::engine::Sprite; | ||
|
||
use crate::spriteatlasmanager::SpriteAtlasManager; | ||
|
||
#[unity::class("App", "GameIcon")] | ||
#[static_fields(GameIconStaticFields)] | ||
pub struct GameIcon { } | ||
|
||
impl GameIcon { | ||
pub fn try_get_system<'a>(icon_name: impl Into<&'a Il2CppString>) -> Option<&'static mut Sprite> { | ||
unsafe { gameicon_trygetsystem(icon_name.into(), None) } | ||
} | ||
} | ||
|
||
pub struct GameIconStaticFields { | ||
skill: SpriteAtlasManager, | ||
item: SpriteAtlasManager, | ||
efficacy: SpriteAtlasManager, | ||
efficacy_outline: SpriteAtlasManager, | ||
item_kinds: SpriteAtlasManager, | ||
item_outline_kinds: SpriteAtlasManager, | ||
god_symbol: SpriteAtlasManager, | ||
god_ring: SpriteAtlasManager, | ||
system: SpriteAtlasManager, | ||
unit_icon_index: SpriteAtlasManager, | ||
unit_icon_pallete: SpriteAtlasManager, | ||
} | ||
|
||
#[unity::from_offset("App", "GameIcon", "TryGetSystem")] | ||
extern "C" fn gameicon_trygetsystem(icon_name: &Il2CppString, method_info: OptionalMethod) -> Option<&'static mut Sprite>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#[unity::class("App", "SpriteAtlasManager")] | ||
pub struct SpriteAtlasManager { | ||
handle: i32, | ||
spriteatlas: i32, | ||
cachetable: i32, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use std::io; | ||
|
||
use unity::prelude::*; | ||
|
||
#[unity::class("App", "Stream")] | ||
pub struct Stream { | ||
buffer: &'static mut Il2CppArray<u8>, | ||
position: i32, | ||
stack: *const u8 , | ||
} | ||
|
||
#[unity::from_offset("App", "Stream", "WriteInt")] | ||
extern "C" fn stream_write_int(this: &mut Stream, data: i32, method_info: OptionalMethod); | ||
|
||
#[unity::from_offset("App", "Stream", "ReadInt")] | ||
extern "C" fn stream_read_int(this: &mut Stream, method_info: OptionalMethod) -> i32; | ||
|
||
impl Stream { | ||
pub fn get_position(&self) -> usize { | ||
self.position as _ | ||
} | ||
|
||
/// /!\ To be deprecated in favor of a std::io::Write implementation in due time. | ||
/// | ||
/// Write a i32 into the stream and returns how many bytes were written. | ||
/// An error of type WriteZero is returned if the buffer was too small to write the value. | ||
/// | ||
/// While useless at the moment, this result type was chosen to facilitate migrating to proper Rust utilities later. | ||
pub fn write_int(&mut self, data: i32) -> io::Result<usize> { | ||
if self.buffer.len() >= self.get_position() + 4 { | ||
unsafe { stream_write_int(self, data, None) } | ||
Ok(4) | ||
} else { | ||
Err(io::Error::from(io::ErrorKind::WriteZero)) | ||
} | ||
} | ||
|
||
/// /!\ To be deprecated in favor of a std::io::Read implementation in due time. | ||
/// | ||
/// Read a i32 from the stream and returns the value. | ||
/// An error of type UnexpectedEof is returned if the buffer did not have enough bytes left to read the value. | ||
/// | ||
/// While useless at the moment, this result type was chosen to facilitate migrating to proper Rust utilities later. | ||
pub fn read_int(&mut self) -> io::Result<i32> { | ||
if self.buffer.len() >= self.get_position() + 4 { | ||
Ok(unsafe { stream_read_int(self, None) }) | ||
} else { | ||
Err(io::Error::from(io::ErrorKind::UnexpectedEof)) | ||
} | ||
} | ||
} |