use sylpheed_formats::{game_data, localization::TextIndex, PakArchive};
fn main(){
    let disc=std::env::var("SYLPHEED_DISC").unwrap();
    let pak=PakArchive::open(format!("{disc}/dat/GP_MAIN_GAME_E.pak")).unwrap();
    let text=TextIndex::build(&pak);
    let msgs=game_data::load_demo_messages(&pak);
    println!("{} dialogue lines total\n", msgs.len());
    for m in msgs.iter().filter(|m|m.character.is_some()&&!m.page_keys.is_empty()).take(8){
        let who=m.character.as_deref().unwrap_or("?").trim_start_matches("Character");
        let line:String=m.page_keys.iter().filter_map(|k|text.get(k)).collect::<Vec<_>>().join(" ");
        println!("  {who:10} [{}]  “{}”", m.voice_clip.as_deref().unwrap_or("-"), line.chars().take(64).collect::<String>());
    }
}
