Information - Coolsonickirby/the_csk_collection_api GitHub Wiki
libthe_csk_collection.nro
installed, and run cargo skyline update-std
Notice - If you run into crashes when trying to use the API, make sure you have Introduction
Welcome to the CSK Collection API wiki! Since the functions are pretty straight forward, I'll just be putting them all on the same page. Without further ado, let's start.
Adding the CSK Collection API to your project
To add the CSK Collection API to your project, just open up your Cargo.toml
and put this in your dependencies:
[dependencies]
the_csk_collection_api = { git = "https://github.com/Coolsonickirby/the_csk_collection_api.git" }
Functions
Now we're gonna cover the functions the CSK Collection API offers.
csk_collection_version() -> the_csk_collection_api::Version
This function returns the current version the CSK Collection plugin currently is on.
pub fn some_function(){
let version = the_csk_collection_api::csk_collection_version();
if version.major < 2 {
println!("You're using an outdated build of the CSK Collection plugin! Please make sure to update to the latest.");
}
}
is_online() -> bool
This is a simple function that returns whether or not the user is currently in the online menu. Example usage:
pub fn some_function(){
if the_csk_collection_api::is_online() {
// do specific online logic
} else {
// do specific offline logic
}
}
play_bgm(ui_bgm_hash: u64)
This is a straightforward function that allows you to play a track. Example usage:
pub fn some_function(){
if final_smash_used && is_sephiroth {
the_csk_collection_api::play_bgm(0x2049846514) // Hash40 of ui_bgm_ff08_ff7_katayokunotenshi
}
}
get_color_from_entry_id(entry_id: u32) -> u32
This function will return the color of the given fighter's entry id. Example usage:
pub fn some_function(){
let entry_0_color = the_csk_collection_api::get_color_from_entry_id(0);
// do w/e else
}
get_ui_chara_from_entry_id(entry_id: u32) -> u64
This function will return the ui_chara_id of the given fighter's entry id. Example usage:
pub fn some_function(){
let entry_0_ui_chara_id = the_csk_collection_api::get_ui_chara_from_entry_id(0);
// do w/e else
}
get_victor_color() -> u8
This function will return the winner's color (will only work during results) Example usage:
pub fn some_function(){
let winner_color = the_csk_collection_api::get_victor_color();
// do w/e else
}
change_entry_chara_ui(entry_id: u32, ui_chara_hash: u64, color_slot: u8)
This function will change the given entry_id's battle UI's ui_chara_id, given the target ui_chara_hash and the color they're currently using Example usage:
pub fn some_function(){
if fighter_is_dead {
the_csk_collection_api::change_entry_chara_ui(fighter_entry_id, 0xe63defad2 /* Hash40 of ui_chara_sadge */, fighter_color);
}
}
allow_ui_chara_hash_online(ui_chara_hash: u64)
This function explicitly lets the redirector know if it should show a ui_chara_hash entry online. Example usage:
pub fn some_function(){
the_csk_collection_api::allow_ui_chara_hash_online(0xfb6baa280); // Hash40 of ui_chara_shadow
}
disable_ui_chara_hash_online(ui_chara_hash: u64)
This function explicitly lets the redirector know if it should hide a ui_chara_hash entry online. Example usage:
pub fn some_function(){
the_csk_collection_api::disable_ui_chara_hash_online(0xfb6baa280); // Hash40 of ui_chara_shadow
}
add_chara_db_entry_info(chara_db_entry_info: the_csk_collection_api::CharacterDatabaseEntry)
This function allows you to add/modify a ui_chara_db entry without interfering with a user's modified database. Example Usage:
pub fn some_function(){
// This will clone ui_chara_mario's entry and use that as a base for this new entry
the_csk_collection_api::add_chara_db_entry_info(
the_csk_collection_api::CharacterDatabaseEntry {
ui_chara_id: 0xc3ff1e390, // Hash40 of ui_chara_lfg
clone_from_ui_chara_id: Some(0xedaf3c863), // Hash40 of ui_chara_mario
name_id: the_csk_collection_api::StringType::Overwrite(String::from("lfg")),
..Default::default()
},
);
// This will create an entirely brand new entry
the_csk_collection_api::add_chara_db_entry_info(
the_csk_collection_api::CharacterDatabaseEntry {
ui_chara_id: 0xe63defad2,
clone_from_ui_chara_id: None,
name_id: the_csk_collection_api::StringType::Optional(Some(String::from("sadge"))),
fighter_kind: the_csk_collection_api::Hash40Type::Optional(Some(0x1254206ce1)),
fighter_kind_corps: the_csk_collection_api::Hash40Type::Optional(Some(0x1254206ce1)),
ui_series_id: Default::default(),
fighter_type: Default::default(),
alt_chara_id: Default::default(),
exhibit_year: Default::default(),
exhibit_day_order: Default::default(),
ext_skill_page_num: Default::default(),
is_img_ext_skill_page0: Default::default(),
is_img_ext_skill_page1: Default::default(),
is_img_ext_skill_page2: Default::default(),
skill_list_order: Default::default(),
disp_order: the_csk_collection_api::SignedByteType::Optional(Some(-1)),
save_no: the_csk_collection_api::SignedByteType::Optional(Some(-1)),
chara_count: Default::default(),
can_select: the_csk_collection_api::BoolType::Optional(Some(false)),
is_usable_soundtest: Default::default(),
is_called_pokemon: Default::default(),
is_mii: Default::default(),
is_boss: Default::default(),
is_hidden_boss: Default::default(),
is_dlc: Default::default(),
is_patch: Default::default(),
is_plural_message: Default::default(),
is_plural_narration: Default::default(),
is_article: Default::default(),
extra_flags: Default::default(),
unk_0x112b7bb52a: Default::default(),
result_pf0: Default::default(),
result_pf1: Default::default(),
result_pf2: Default::default(),
color_num: the_csk_collection_api::UnsignedByteType::Optional(Some(8)),
extra_index_maps: Default::default(),
extra_hash_maps: Default::default(),
shop_item_tag: Default::default(),
},
);
// This creates a redirected ui_chara_db entry with ui_chara_mario as a base
the_csk_collection_api::add_chara_db_entry_info(
the_csk_collection_api::CharacterDatabaseEntry {
ui_chara_id: 0x10321edf2a, // Hash40 of ui_chara_mario64
clone_from_ui_chara_id: Some(0xedaf3c863), // Hash40 of ui_chara_mario
name_id: the_csk_collection_api::StringType::Overwrite(String::from("mario64")),
color_num: the_csk_collection_api::UnsignedByteType::Overwrite(8),
extra_index_maps: the_csk_collection_api::UnsignedByteMap::Overwrite(HashMap::from([
(0x11895f00fc /* Hash40 of color_start_index */, the_csk_collection_api::UnsignedByteType::Overwrite(8))
])),
extra_hash_maps: the_csk_collection_api::Hash40Map::Overwrite(HashMap::from([
(0x160ab9eb98 /* Hash40 of original_ui_chara_hash */, the_csk_collection_api::Hash40Type::Overwrite(0xedaf3c863) /* Hash40 of ui_chara_mario */)
])),
..Default::default()
},
);
}
add_chara_layout_db_entry_info(chara_layout_db_entry_info: the_csk_collection_api::CharacterLayoutDatabaseEntry)
This function allows you to add/modify a ui_layout_db entry without interfering with a user's modified database. Example Usage:
pub fn some_function(){
// This will clone ui_chara_mario's entry and use that as a base for this new entry
the_csk_collection_api::add_chara_layout_db_entry_info(
the_csk_collection_api::CharacterLayoutDatabaseEntry {
ui_layout_id: 0xf23c46caa, // Hash40 of ui_chara_lfg_00
clone_from_ui_layout_id: Some(0x110c383d83), // Hash40 of ui_chara_mario_00
ui_chara_id: the_csk_collection_api::Hash40Type::Overwrite(
0xc3ff1e390, // Hash40 of ui_chara_lfg
),
..Default::default()
},
);
// Same stuff from previous example apply here
}