Skip to content

Commit

Permalink
Make ByteReader string encoding aware
Browse files Browse the repository at this point in the history
Also defaults to EUC_KR for all Ragnarok file formats. Network packets are decoded as UTF-8 though.
  • Loading branch information
hasenbanck committed Jan 5, 2025
1 parent a4e478f commit 3ccd8f4
Show file tree
Hide file tree
Showing 14 changed files with 179 additions and 145 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion korangar/src/inventory/skills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl SkillTree {
let skills = skill_data
.into_iter()
.map(|skill_data| {
let file_path = format!("¾ÆÀÌÅÛ\\{}", skill_data.skill_name);
let file_path = format!("아이템\\{}", skill_data.skill_name);
let sprite = sprite_loader.get_or_load(&format!("{file_path}.spr")).unwrap();
let actions = action_loader.get_or_load(&format!("{file_path}.act")).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion korangar/src/loaders/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ fn parse_generic_data<Data: FromBytes>(resource_file: &str, game_file_loader: &G
fn get_water_texture_paths(water_type: i32) -> Vec<String> {
let mut paths = Vec::with_capacity(32);
for i in 0..32 {
let filename = format!("¿öÅÍ\\water{}{:02}.jpg", water_type, i);
let filename = format!("워터\\water{}{:02}.jpg", water_type, i);
paths.push(filename);
}
paths
Expand Down
2 changes: 1 addition & 1 deletion korangar/src/loaders/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn load_client_info(game_file_loader: &GameFileLoader) -> ClientInfo {

let content = match get_xml_encoding(&client_info) {
Some(encoding) => {
let (cow, ..) = encoding.decode(&client_info);
let (cow, _) = encoding.decode_without_bom_handling(&client_info);
cow
}
None => String::from_utf8_lossy(client_info.as_slice()),
Expand Down
2 changes: 1 addition & 1 deletion korangar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const CLIENT_NAME: &str = "Korangar";
const ROLLING_CUTTER_ID: SkillId = SkillId(2036);
const DEFAULT_MAP: &str = "geffen";
const DEFAULT_BACKGROUND_MUSIC: Option<&str> = Some("bgm\\01.mp3");
const MAIN_MENU_CLICK_SOUND_EFFECT: &str = "¹öÆ°¼Ò¸®.wav";
const MAIN_MENU_CLICK_SOUND_EFFECT: &str = "버튼소리.wav";
// TODO: The number of point lights that can cast shadows should be configurable
// through the graphics settings. For now I just chose an arbitrary smaller
// number that should be playable on most devices.
Expand Down
248 changes: 124 additions & 124 deletions korangar/src/world/entity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,130 +150,130 @@ pub struct Common {
#[allow(clippy::invisible_characters)]
fn get_sprite_path_for_player_job(job_id: usize) -> &'static str {
match job_id {
0 => "Ãʺ¸ÀÚ", // NOVICE
1 => "°Ë»Ç", // SWORDMAN
2 => "À§Àúµå", // MAGICIAN
3 => "±Ã¼Ö", // ARCHER
4 => "¼ºÁ÷ÀÚ", // ACOLYTE
5 => "»ÓÀÎ", // MERCHANT
6 => "µµµÏ", // THIEF
7 => "񃯇", // KNIGHT
8 => "¼ºÅõ»ç", // PRIEST
9 => "¸¶¹Ý»Ç", // WIZARD
10 => "Á¦Ã¶°ø", // BLACKSMITH
11 => "ÇåÅÍ", // HUNTER
12 => "¾î¼¼½Å", // ASSASSIN
13 => "¿£´ë¿î", // CHICKEN
14 => "Å©·ç¼¼ÀÌ´õ", // CRUSADER
15 => "¸ùÅ©", // MONK
16 => "¼¼ÀÌÁö", // SAGE
17 => "·Î±×", // ROGUE
18 => "¿¬±Ý¼ú»ç", // ALCHEMIST
19 => "¹Ùµå", // BARD
20 => "¹«Èñ", // DANCER
23 => "½´ÆÛ³ëºñ½º", // SUPERNOVICE
24 => "°Ç³Ê", // GUNSLINGER
25 => "´ÑÀÚ", // NINJA
4001 => "Ãʺ¸ÀÚ", // NOVICE_H
4002 => "°Ë»Ç", // SWORDMAN_H
4003 => "À§Àúµå", // MAGICIAN_H
4004 => "±Ã¼Ö", // ARCHER_H
4005 => "¼ºÁ÷ÀÚ", // ACOLYTE_H
4006 => "»ÓÀÎ", // MERCHANT_H
4007 => "µµµÏ", // THIEF_H
4008 => "·Îµå³ªÀÌÆ®", // KNIGHT_H
4009 => "ÇÏÀÌÇÁ¸®", // PRIEST_H
4010 => "ÇÏÀÌÀ§Àúµå", // WIZARD_H
4011 => "È­ÀÌÆ®½º¹Ì½º", // BLACKSMITH_H
4012 => "½º³ªÀÌÆÛ", // HUNTER_H
4013 => "¾î½Ø½ÅÅ©·Î½º", // ASSASSIN_H
4014 => "¿£´ë¿î", // CHICKEN_H
4015 => "Å©·ç¼¼ÀÌ´õ", // CRUSADER_H
4016 => "¸ùÅ©", // MONK_H
4017 => "¼¼ÀÌÁö", // SAGE_H
4018 => "·Î±×", // ROGUE_H
4019 => "¿¬±Ý¼ú»ç", // ALCHEMIST_H
4020 => "¹Ùµå", // BARD_H
4021 => "¹«Èñ", // DANCER_H
4023 => "½´ÆÛ³ëºñ½º", // NOVICE_B
4024 => "°Ë»Ç", // SWORDMAN_B
4025 => "À§Àúµå", // MAGICIAN_B
4026 => "±Ã¼Ö", // ARCHER_B
4027 => "¼ºÁ÷ÀÚ", // ACOLYTE_B
4028 => "»ÓÀÎ", // MERCHANT_B
4029 => "µµµÏ", // THIEF_B
4030 => "񃯇", // KNIGHT_B
4031 => "¼ºÅõ»ç", // PRIEST_B
4032 => "¸¶¹Ý»Ç", // WIZARD_B
4033 => "Á¦Ã¶°ø", // BLACKSMITH_B
4034 => "ÇåÅÍ", // HUNTER_B
4035 => "¾î¼¼½Å", // ASSASSIN_B
4037 => "Å©·ç¼¼ÀÌ´õ", // CRUSADER_B
4038 => "¸ùÅ©", // MONK_B
4039 => "¼¼ÀÌÁö", // SAGE_B
4040 => "·Î±×", // ROGUE_B
4041 => "¿¬±Ý¼ú»ç", // ALCHEMIST_B
4042 => "¹Ùµå", // BARD_B
4043 => "¹«Èñ", // DANCER_B
4045 => "½´ÆÛ³ëºñ½º", // SUPERNOVICE_B
4054 => "·é³ªÀÌÆ®", // RUNE_KNIGHT
4055 => "¿ö·Ï", // WARLOCK
4056 => "·¹ÀÎÁ®", // RANGER
4057 => "¾ÆÅ©ºñ¼ó", // ARCH_BISHOP
4058 => "¹ÌÄÉ´Ð", // MECHANIC
4059 => "±æ·Îƾũ·Î½º", // GUILLOTINE_CROSS
4066 => "°¡µå", // ROYAL_GUARD
4067 => "¼Ò¼­·¯", // SORCERER
4068 => "¹Î½ºÆ®·²", // MINSTREL
4069 => "¿ø´õ·¯", // WANDERER
4070 => "½´¶ó", // SURA
4071 => "Á¦³×¸¯", // GENETIC
4072 => "½¦µµ¿ìüÀ̼­", // SHADOW_CHASER
4060 => "·é³ªÀÌÆ®", // RUNE_KNIGHT_H
4061 => "¿ö·Ï", // WARLOCK_H
4062 => "·¹ÀÎÁ®", // RANGER_H
4063 => "¾ÆÅ©ºñ¼ó", // ARCH_BISHOP_H
4064 => "¹ÌÄÉ´Ð", // MECHANIC_H
4065 => "±æ·Îƾũ·Î½º", // GUILLOTINE_CROSS_H
4073 => "°¡µÅ", // ROYAL_GUARD_H
4074 => "¼Ò¼­·¯", // SORCERER_H
4075 => "¹Î½ºÆ®·²", // MINSTREL_H
4076 => "¿ø´õ·¯", // WANDERER_H
4077 => "½´¶ó", // SURA_H
4078 => "Á¦³×¸¯", // GENETIC_H
4079 => "½¦µµ¿ìüÀ̼­", // SHADOW_CHASER_H
4096 => "·é³ªÀÌÆ®", // RUNE_KNIGHT_B
4097 => "¿ö·Ï", // WARLOCK_B
4098 => "·¹ÀÎÁ®", // RANGER_B
4099 => "¾ÆÅ©ºñ¼ó", // ARCHBISHOP_B
4100 => "¹ÌÄÉ´Ð", // MECHANIC_B
4101 => "±æ·Îƾũ·Î½º", // GUILLOTINE_CROSS_B
4102 => "°¡µå", // ROYAL_GUARD_B
4103 => "¼Ò¼­·¯", // SORCERER_B
4104 => "¹Î½ºÆ®·²", // MINSTREL_B
4105 => "¿ø´õ·¯", // WANDERER_B
4106 => "½´¶ó", // SURA_B
4107 => "Á¦³×¸¯", // GENETIC_B
4108 => "½¦µµ¿ìüÀ̼­", // SHADOW_CHASER_B
4046 => "űǼҳâ", // TAEKWON
4047 => "񀬧", // STAR
4049 => "¼Ò¿ï¸µÄ¿", // LINKER
4190 => "½´ÆÛ³ëºñ½º", // SUPERNOVICE2
0 => "초보자", // NOVICE
1 => "검사", // SWORDMAN
2 => "마법사", // MAGICIAN
3 => "궁수", // ARCHER
4 => "성직자", // ACOLYTE
5 => "상인", // MERCHANT
6 => "도둑", // THIEF
7 => "기사", // KNIGHT
8 => "성투사", // PRIEST
9 => "위저드", // WIZARD
10 => "제철공", // BLACKSMITH
11 => "헌터", // HUNTER
12 => "어세신", // ASSASSIN
13 => "페코페코_기사", // KNIGHT2
14 => "크루세이더", // CRUSADER
15 => "몽크", // MONK
16 => "세이지", // SAGE
17 => "로그", // ROGUE
18 => "연금술사", // ALCHEMIST
19 => "바드", // BARD
20 => "무희", // DANCER
23 => "슈퍼노비스", // SUPERNOVICE
24 => "건너", // GUNSLINGER
25 => "닌자", // NINJA
4001 => "초보자", // NOVICE_H
4002 => "검사", // SWORDMAN_H
4003 => "마법사", // MAGICIAN_H
4004 => "궁수", // ARCHER_H
4005 => "성직자", // ACOLYTE_H
4006 => "상인", // MERCHANT_H
4007 => "도둑", // THIEF_H
4008 => "로드나이트", // KNIGHT_H
4009 => "하이프리", // PRIEST_H
4010 => "하이위저드", // WIZARD_H
4011 => "화이트스미스", // BLACKSMITH_H
4012 => "스나이퍼", // HUNTER_H
4013 => "어쌔신크로스", // ASSASSIN_H
4014 => "엔대운", // CHICKEN_H
4015 => "크루세이더", // CRUSADER_H
4016 => "몽크", // MONK_H
4017 => "세이지", // SAGE_H
4018 => "로그", // ROGUE_H
4019 => "연금술사", // ALCHEMIST_H
4020 => "바드", // BARD_H
4021 => "무희", // DANCER_H
4023 => "슈퍼노비스", // NOVICE_B
4024 => "검뽀", // SWORDMAN_B
4025 => "위저드", // MAGICIAN_B
4026 => "궁솔", // ARCHER_B
4027 => "성직자", // ACOLYTE_B
4028 => "뿐인", // MERCHANT_B
4029 => "도둑", // THIEF_B
4030 => "기사", // KNIGHT_B
4031 => "성투사", // PRIEST_B
4032 => "마반뽀", // WIZARD_B
4033 => "제철공", // BLACKSMITH_B
4034 => "헌터", // HUNTER_B
4035 => "어세신", // ASSASSIN_B
4037 => "크루세이더", // CRUSADER_B
4038 => "몽크", // MONK_B
4039 => "세이지", // SAGE_B
4040 => "로그", // ROGUE_B
4041 => "연금술사", // ALCHEMIST_B
4042 => "바드", // BARD_B
4043 => "무희", // DANCER_B
4045 => "슈퍼노비스", // SUPERNOVICE_B
4054 => "룬나이트", // RUNE_KNIGHT
4055 => "워록", // WARLOCK
4056 => "레인져", // RANGER
4057 => "아크비숍", // ARCH_BISHOP
4058 => "미케닉", // MECHANIC
4059 => "길로틴크로스", // GUILLOTINE_CROSS
4066 => "가드", // ROYAL_GUARD
4067 => "소서러", // SORCERER
4068 => "민스트럴", // MINSTREL
4069 => "원더러", // WANDERER
4070 => "슈라", // SURA
4071 => "제네릭", // GENETIC
4072 => "쉐도우체이서", // SHADOW_CHASER
4060 => "룬나이트", // RUNE_KNIGHT_H
4061 => "워록", // WARLOCK_H
4062 => "레인져", // RANGER_H
4063 => "아크비숍", // ARCH_BISHOP_H
4064 => "미케닉", // MECHANIC_H
4065 => "길로틴크로스", // GUILLOTINE_CROSS_H
4073 => "가돼", // ROYAL_GUARD_H
4074 => "소서러", // SORCERER_H
4075 => "민스트럴", // MINSTREL_H
4076 => "원더러", // WANDERER_H
4077 => "슈라", // SURA_H
4078 => "제네릭", // GENETIC_H
4079 => "쉐도우체이서", // SHADOW_CHASER_H
4096 => "룬나이트", // RUNE_KNIGHT_B
4097 => "워록", // WARLOCK_B
4098 => "레인져", // RANGER_B
4099 => "아크비숍", // ARCHBISHOP_B
4100 => "미케닉", // MECHANIC_B
4101 => "길로틴크로스", // GUILLOTINE_CROSS_B
4102 => "가드", // ROYAL_GUARD_B
4103 => "소서러", // SORCERER_B
4104 => "민스트럴", // MINSTREL_B
4105 => "원더러", // WANDERER_B
4106 => "슈라", // SURA_B
4107 => "제네릭", // GENETIC_B
4108 => "쉐도우체이서", // SHADOW_CHASER_B
4046 => "태권소년", // TAEKWON
4047 => "권성", // STAR
4049 => "소울링커", // LINKER
4190 => "슈퍼노비스", // SUPERNOVICE2
4211 => "KAGEROU", // KAGEROU
4212 => "OBORO", // OBORO
4215 => "REBELLION", // REBELLION
4222 => "´ÑÀÚ", // NINJA_B
4222 => "닌자", // NINJA_B
4223 => "KAGEROU", // KAGEROU_B
4224 => "OBORO", // OBORO_B
4225 => "űǼҳâ", // TAEKWON_B
4226 => "񀬧", // STAR_B
4227 => "¼Ò¿ï¸µÄ¿", // LINKER_B
4228 => "°Ç³Ê", // GUNSLINGER_B
4225 => "태권소년", // TAEKWON_B
4226 => "권성", // STAR_B
4227 => "소울링커", // LINKER_B
4228 => "건너", // GUNSLINGER_B
4229 => "REBELLION", // REBELLION_B
4239 => "¼ºÁ¦", // STAR EMPEROR
4240 => "¼Ò¿ï¸®ÆÛ", // SOUL REAPER
4241 => "¼ºÁ¦", // STAR_EMPEROR_B
4242 => "¼Ò¿ï¸®ÆÛ", // SOUL_REAPER_B
4239 => "성제", // STAR EMPEROR
4240 => "소울리퍼", // SOUL REAPER
4241 => "성제", // STAR_EMPEROR_B
4242 => "소울리퍼", // SOUL_REAPER_B
4252 => "DRAGON_KNIGHT", // DRAGON KNIGHT
4253 => "MEISTER", // MEISTER
4254 => "SHADOW_CROSS", // SHADOW CROSS
Expand All @@ -293,27 +293,27 @@ fn get_sprite_path_for_player_job(job_id: usize) -> &'static str {
4305 => "SHIRANUI", // SHIRANUI
4306 => "NIGHT_WATCH", // NIGHT WATCH
4307 => "HYPER_NOVICE", // HYPER NOVICE
_ => "Ãʺ¸ÀÚ", // NOVICE
_ => "초보자", // NOVICE,
}
}

fn get_entity_part_files(library: &Library, entity_type: EntityType, job_id: usize, sex: Sex, head: Option<usize>) -> Vec<String> {
let sex_sprite_path = match sex == Sex::Female {
true => "¿©",
false => "³²",
true => "",
false => "",
};

fn player_body_path(sex_sprite_path: &str, job_id: usize) -> String {
format!(
"Àΰ£Á·\\¸öÅë\\{}\\{}_{}",
"인간족\\몸통\\{}\\{}_{}",
sex_sprite_path,
get_sprite_path_for_player_job(job_id),
sex_sprite_path
)
}

fn player_head_path(sex_sprite_path: &str, head_id: usize) -> String {
format!("Àΰ£Á·\\¸Ó¸®Åë\\{}\\{}_{}", sex_sprite_path, head_id, sex_sprite_path)
format!("인간족\\머리통\\{}\\{}_{}", sex_sprite_path, head_id, sex_sprite_path)
}

let head_id = match (sex, head) {
Expand All @@ -330,7 +330,7 @@ fn get_entity_part_files(library: &Library, entity_type: EntityType, job_id: usi
player_head_path(sex_sprite_path, head_id),
],
EntityType::Npc => vec![format!("npc\\{}", library.get_job_identity_from_id(job_id))],
EntityType::Monster => vec![format!("¸ó½ºÅÍ\\{}", library.get_job_identity_from_id(job_id))],
EntityType::Monster => vec![format!("몬스터\\{}", library.get_job_identity_from_id(job_id))],
EntityType::Warp | EntityType::Hidden => vec![format!("npc\\{}", library.get_job_identity_from_id(job_id))], // TODO: change
}
}
Expand Down
Loading

0 comments on commit 3ccd8f4

Please sign in to comment.