Crates.io | royal |
lib.rs | royal |
version | 0.1.4 |
source | src |
created_at | 2024-12-02 16:36:18.788767 |
updated_at | 2024-12-11 19:12:17.413799 |
description | A parser for game dialogue message formats |
homepage | |
repository | https://github.com/emirsassan/royal |
max_upload_size | |
id | 1468892 |
size | 47,518 |
A Rust library for parsing Persona 5 Royal dialogue message format.
Add this to your Cargo.toml
:
[dependencies]
royal = "0.1.4"
Example usage:
use royal::Message;
fn main() {
let input = "[msg MSG_BTTL_2 [Morgana]][s][f 4 10 65535 0 0]Hello world![f 1 3 65535][w][e]";
if let Some(message) = Message::parse(input) {
println!("Character: {}", message.header.character.unwrap_or_default());
println!("Content: {}", message.content);
}
}
Parse a file:
use royal::Message;
fn main() {
let messages = Message::parse_msg("test/test_data.msg");
for message in messages {
println!("Message ID: {}", message.header.message_id);
println!("Content: {}", message.content);
}
}
The parser handles messages in the following format:
[msg MESSAGE_TYPE_MESSAGE_ID [CHARACTER]]
[s]
: Start of message[f 4 10 65535 0 0]
: Lipsync marker[f 5 13 confidant_id points model_id]
: Confidant points parser[f 1 3 65535]
: Message end marker[w]
: Wait for input[e]
: End of messageThis project is licensed under the GNU General Public License v3.0 or later - see the LICENSE file for details.