mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-22 05:33:02 +00:00
Fix #208 and add a different log level for file logging
This commit is contained in:
parent
19e0da519f
commit
50ff888141
|
@ -1759,6 +1759,10 @@ impl EngineConstants {
|
|||
let _ = sound_manager.set_sample_params(2, typewriter_sample);
|
||||
}
|
||||
|
||||
pub fn is_base(&self) -> bool {
|
||||
!self.is_switch && !self.is_cs_plus && !self.is_demo
|
||||
}
|
||||
|
||||
pub fn apply_csplus_nx_patches(&mut self) {
|
||||
log::info!("Applying Switch-specific Cave Story+ constants patches...");
|
||||
|
||||
|
|
|
@ -267,8 +267,12 @@ fn init_logger() -> GameResult {
|
|||
message
|
||||
))
|
||||
})
|
||||
.level(log::LevelFilter::Debug)
|
||||
.chain(
|
||||
fern::Dispatch::new()
|
||||
.level(log::LevelFilter::Info)
|
||||
.chain(std::io::stderr());
|
||||
.chain(std::io::stderr())
|
||||
);
|
||||
|
||||
|
||||
let date = chrono::Utc::now();
|
||||
|
@ -276,7 +280,11 @@ fn init_logger() -> GameResult {
|
|||
file.push(format!("log_{}", date.format("%Y-%m-%d")));
|
||||
file.set_extension("txt");
|
||||
|
||||
dispatcher = dispatcher.chain(fern::log_file(file).unwrap());
|
||||
dispatcher = dispatcher.chain(
|
||||
fern::Dispatch::new()
|
||||
.level(log::LevelFilter::Debug)
|
||||
.chain(fern::log_file(file).unwrap())
|
||||
);
|
||||
dispatcher.apply()?;
|
||||
|
||||
//log::info!("===GAME LAUNCH===");
|
||||
|
|
|
@ -409,11 +409,11 @@ impl SharedGameState {
|
|||
constants.load_locales(ctx)?;
|
||||
|
||||
let locale = SharedGameState::get_locale(&constants, &settings.locale).unwrap_or_default();
|
||||
constants.textscript.encoding = if locale.code == "jp" && !constants.is_switch {
|
||||
TextScriptEncoding::ShiftJIS
|
||||
if (locale.code == "jp" || locale.code == "en") && constants.is_base() {
|
||||
constants.textscript.encoding = TextScriptEncoding::ShiftJIS
|
||||
} else {
|
||||
TextScriptEncoding::UTF8
|
||||
};
|
||||
constants.textscript.encoding = TextScriptEncoding::UTF8
|
||||
}
|
||||
|
||||
let font = BMFont::load(&constants.base_paths, &locale.font.path, ctx, locale.font.scale).or_else(|e| {
|
||||
log::warn!("Failed to load font, using built-in: {}", e);
|
||||
|
@ -561,11 +561,11 @@ impl SharedGameState {
|
|||
pub fn update_locale(&mut self, ctx: &mut Context) {
|
||||
if let Some(locale) = SharedGameState::get_locale(&self.constants, &self.settings.locale) {
|
||||
self.loc = locale;
|
||||
self.constants.textscript.encoding = if self.loc.code == "jp" && !self.constants.is_switch {
|
||||
TextScriptEncoding::ShiftJIS
|
||||
if (self.loc.code == "jp" || self.loc.code == "en") && self.constants.is_base() {
|
||||
self.constants.textscript.encoding = TextScriptEncoding::ShiftJIS
|
||||
} else {
|
||||
TextScriptEncoding::UTF8
|
||||
};
|
||||
self.constants.textscript.encoding = TextScriptEncoding::UTF8
|
||||
}
|
||||
}
|
||||
|
||||
let font = BMFont::load(&self.constants.base_paths, &self.loc.font.path, ctx, self.loc.font.scale)
|
||||
|
|
Loading…
Reference in a new issue