mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-11-28 15:27:27 +00:00
bug fixes
This commit is contained in:
parent
730d1cb5d8
commit
a48a59125f
|
|
@ -68,9 +68,6 @@ for:
|
||||||
- copy LICENSE release\LICENSE
|
- copy LICENSE release\LICENSE
|
||||||
- copy target\release\doukutsu-rs.exe release\doukutsu-rs.x86_64.exe
|
- copy target\release\doukutsu-rs.exe release\doukutsu-rs.x86_64.exe
|
||||||
- cd release
|
- cd release
|
||||||
- appveyor DownloadFile https://github.com/doukutsu-rs/game-data/archive/master.zip -FileName ../game-data.zip
|
|
||||||
- 7z x ../game-data.zip
|
|
||||||
- rename game-data-master data
|
|
||||||
- 7z a ../doukutsu-rs_%target_name%.zip *
|
- 7z a ../doukutsu-rs_%target_name%.zip *
|
||||||
- appveyor PushArtifact ../doukutsu-rs_%target_name%.zip
|
- appveyor PushArtifact ../doukutsu-rs_%target_name%.zip
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ log = "0.4"
|
||||||
lua-ffi = { git = "https://github.com/doukutsu-rs/lua-ffi.git", rev = "e0b2ff5960f7ef9974aa9675cebe4907bee0134f", optional = true }
|
lua-ffi = { git = "https://github.com/doukutsu-rs/lua-ffi.git", rev = "e0b2ff5960f7ef9974aa9675cebe4907bee0134f", optional = true }
|
||||||
num-derive = "0.3.2"
|
num-derive = "0.3.2"
|
||||||
num-traits = "0.2.12"
|
num-traits = "0.2.12"
|
||||||
|
owoify_rs = "0.2.0"
|
||||||
paste = "1.0.0"
|
paste = "1.0.0"
|
||||||
sdl2 = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "95bcf63768abf422527f86da41da910649b9fcc9", optional = true, features = ["unsafe_textures", "bundled", "static-link"] }
|
sdl2 = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "95bcf63768abf422527f86da41da910649b9fcc9", optional = true, features = ["unsafe_textures", "bundled", "static-link"] }
|
||||||
sdl2-sys = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "95bcf63768abf422527f86da41da910649b9fcc9", optional = true, features = ["bundled", "static-link"] }
|
sdl2-sys = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "95bcf63768abf422527f86da41da910649b9fcc9", optional = true, features = ["bundled", "static-link"] }
|
||||||
|
|
|
||||||
BIN
res/sue.ico
BIN
res/sue.ico
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 161 KiB |
|
|
@ -15,10 +15,7 @@ use crate::texture_set::G_MAG;
|
||||||
pub const CDEG_RAD: f64 = std::f64::consts::PI / 128.0;
|
pub const CDEG_RAD: f64 = std::f64::consts::PI / 128.0;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref VERSION_BANNER: String = {
|
pub static ref VERSION_BANNER: String = "doukutsu-rs GowoG Edition".to_string();
|
||||||
let version = option_env!("DRS_BUILD_VERSION_OVERRIDE").unwrap_or(env!("CARGO_PKG_VERSION"));
|
|
||||||
format!("doukutsu-rs {}", version)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bitfield! {
|
bitfield! {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ impl MapSystem {
|
||||||
) -> GameResult {
|
) -> GameResult {
|
||||||
if state.textscript_vm.state == TextScriptExecutionState::MapSystem {
|
if state.textscript_vm.state == TextScriptExecutionState::MapSystem {
|
||||||
if self.state == MapSystemState::Hidden {
|
if self.state == MapSystemState::Hidden {
|
||||||
state.control_flags.set_control_enabled(false);
|
|
||||||
self.state = MapSystemState::FadeInBox(0);
|
self.state = MapSystemState::FadeInBox(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -123,8 +122,6 @@ impl MapSystem {
|
||||||
}
|
}
|
||||||
MapSystemState::FadeOutBox(tick) => {
|
MapSystemState::FadeOutBox(tick) => {
|
||||||
if tick == 0 {
|
if tick == 0 {
|
||||||
state.control_flags.set_tick_world(true);
|
|
||||||
state.control_flags.set_control_enabled(true);
|
|
||||||
state.textscript_vm.state = TextScriptExecutionState::Ended;
|
state.textscript_vm.state = TextScriptExecutionState::Ended;
|
||||||
self.state = MapSystemState::Hidden;
|
self.state = MapSystemState::Hidden;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ impl SDL2EventLoop {
|
||||||
gl_attr.set_context_profile(GLProfile::Compatibility);
|
gl_attr.set_context_profile(GLProfile::Compatibility);
|
||||||
gl_attr.set_context_version(2, 1);
|
gl_attr.set_context_version(2, 1);
|
||||||
|
|
||||||
let mut window = video.window("Cave Story (doukutsu-rs)", size_hint.0 as _, size_hint.1 as _);
|
let mut window = video.window("Cave Story (doukutsu-rs GowoG Edition)", size_hint.0 as _, size_hint.1 as _);
|
||||||
window.position_centered();
|
window.position_centered();
|
||||||
window.resizable();
|
window.resizable();
|
||||||
|
|
||||||
|
|
|
||||||
26
src/lib.rs
26
src/lib.rs
|
|
@ -148,6 +148,28 @@ impl Game {
|
||||||
TimingMode::FrameSynchronized => {
|
TimingMode::FrameSynchronized => {
|
||||||
scene.tick(state_ref, ctx)?;
|
scene.tick(state_ref, ctx)?;
|
||||||
}
|
}
|
||||||
|
TimingMode::AF(tick_rate) => {
|
||||||
|
let last_tick = self.next_tick;
|
||||||
|
|
||||||
|
// lol
|
||||||
|
loop {
|
||||||
|
if self.start_time.elapsed().as_nanos() >= self.next_tick + (1000000000 / tick_rate) as u128 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.next_tick = self.start_time.elapsed().as_nanos() as u128;
|
||||||
|
self.loops = 1;
|
||||||
|
|
||||||
|
if self.loops != 0 {
|
||||||
|
scene.draw_tick(state_ref)?;
|
||||||
|
self.last_tick = last_tick;
|
||||||
|
}
|
||||||
|
|
||||||
|
for _ in 0..self.loops {
|
||||||
|
scene.tick(state_ref, ctx)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -196,9 +218,9 @@ impl Game {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if state_ref.settings.fps_counter {
|
// if state_ref.settings.fps_counter {
|
||||||
self.fps.act(state_ref, ctx, self.last_tick)?;
|
self.fps.act(state_ref, ctx, self.last_tick)?;
|
||||||
}
|
// }
|
||||||
|
|
||||||
self.ui.draw(state_ref, ctx, scene)?;
|
self.ui.draw(state_ref, ctx, scene)?;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,8 @@ impl SettingsMenu {
|
||||||
|
|
||||||
self.main.push_entry(MenuEntry::Options(
|
self.main.push_entry(MenuEntry::Options(
|
||||||
state.t("menus.options_menu.game_timing.entry"),
|
state.t("menus.options_menu.game_timing.entry"),
|
||||||
if state.settings.timing_mode == TimingMode::_50Hz { 0 } else { 1 },
|
0,
|
||||||
vec![state.t("menus.options_menu.game_timing.50tps"), state.t("menus.options_menu.game_timing.60tps")],
|
vec!["Reroll".to_string()],
|
||||||
));
|
));
|
||||||
|
|
||||||
self.main.push_entry(MenuEntry::Active(DISCORD_LINK.to_owned()));
|
self.main.push_entry(MenuEntry::Active(DISCORD_LINK.to_owned()));
|
||||||
|
|
@ -239,22 +239,14 @@ impl SettingsMenu {
|
||||||
self.language.selected = (state.settings.locale as usize) + 1;
|
self.language.selected = (state.settings.locale as usize) + 1;
|
||||||
self.current = CurrentMenu::LanguageMenu;
|
self.current = CurrentMenu::LanguageMenu;
|
||||||
}
|
}
|
||||||
MenuSelectionResult::Selected(3, toggle) => {
|
MenuSelectionResult::Selected(3, _) => {
|
||||||
if let MenuEntry::Options(_, value, _) = toggle {
|
let now = chrono::Local::now();
|
||||||
match state.settings.timing_mode {
|
let rng = crate::rng::XorShift::new(now.timestamp() as i32);
|
||||||
TimingMode::_50Hz => {
|
let tick_rate = crate::rng::RNG::range(&rng, 50..70) as usize;
|
||||||
state.settings.timing_mode = TimingMode::_60Hz;
|
state.settings.timing_mode = TimingMode::AF(tick_rate);
|
||||||
*value = 1;
|
|
||||||
}
|
|
||||||
TimingMode::_60Hz => {
|
|
||||||
state.settings.timing_mode = TimingMode::_50Hz;
|
|
||||||
*value = 0;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
let _ = state.settings.save(ctx);
|
let _ = state.settings.save(ctx);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
MenuSelectionResult::Selected(4, _) => {
|
MenuSelectionResult::Selected(4, _) => {
|
||||||
if let Err(e) = webbrowser::open(DISCORD_LINK) {
|
if let Err(e) = webbrowser::open(DISCORD_LINK) {
|
||||||
log::warn!("Error opening web browser: {}", e);
|
log::warn!("Error opening web browser: {}", e);
|
||||||
|
|
|
||||||
|
|
@ -1761,7 +1761,13 @@ impl Scene for GameScene {
|
||||||
|
|
||||||
match state.textscript_vm.state {
|
match state.textscript_vm.state {
|
||||||
TextScriptExecutionState::FallingIsland(_, _, _, _, _, _) => (),
|
TextScriptExecutionState::FallingIsland(_, _, _, _, _, _) => (),
|
||||||
TextScriptExecutionState::MapSystem => (),
|
TextScriptExecutionState::MapSystem => {
|
||||||
|
if self.tick % 2 == 0 {
|
||||||
|
if state.control_flags.tick_world() {
|
||||||
|
self.tick_world(state)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if state.control_flags.tick_world() {
|
if state.control_flags.tick_world() {
|
||||||
self.tick_world(state)?;
|
self.tick_world(state)?;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
use owoify_rs::{Owoifiable, OwoifyLevel};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
@ -80,6 +81,10 @@ impl TextScript {
|
||||||
match chr {
|
match chr {
|
||||||
b'#' if allow_next_event => {
|
b'#' if allow_next_event => {
|
||||||
if !char_buf.is_empty() {
|
if !char_buf.is_empty() {
|
||||||
|
let mut str = String::from_utf8(char_buf[1..].to_vec()).unwrap();
|
||||||
|
str = str.owoify(&OwoifyLevel::Owo).to_string();
|
||||||
|
char_buf.truncate(1);
|
||||||
|
char_buf.append(&mut str.into_bytes());
|
||||||
put_varint(TSCOpCode::_STR as i32, &mut bytecode);
|
put_varint(TSCOpCode::_STR as i32, &mut bytecode);
|
||||||
put_string(&mut char_buf, &mut bytecode, encoding);
|
put_string(&mut char_buf, &mut bytecode, encoding);
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +97,10 @@ impl TextScript {
|
||||||
allow_next_event = false;
|
allow_next_event = false;
|
||||||
|
|
||||||
if !char_buf.is_empty() {
|
if !char_buf.is_empty() {
|
||||||
|
let mut str = String::from_utf8(char_buf[1..].to_vec()).unwrap();
|
||||||
|
str = str.owoify(&OwoifyLevel::Owo).to_string();
|
||||||
|
char_buf.truncate(1);
|
||||||
|
char_buf.append(&mut str.into_bytes());
|
||||||
put_varint(TSCOpCode::_STR as i32, &mut bytecode);
|
put_varint(TSCOpCode::_STR as i32, &mut bytecode);
|
||||||
put_string(&mut char_buf, &mut bytecode, encoding);
|
put_string(&mut char_buf, &mut bytecode, encoding);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use std::io::Seek;
|
||||||
use std::io::SeekFrom;
|
use std::io::SeekFrom;
|
||||||
use std::ops::Not;
|
use std::ops::Not;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use num_traits::{clamp, FromPrimitive};
|
use num_traits::{clamp, FromPrimitive};
|
||||||
|
|
||||||
|
|
@ -1695,21 +1696,10 @@ impl TextScriptVM {
|
||||||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||||
}
|
}
|
||||||
TSCOpCode::XX1 => {
|
TSCOpCode::XX1 => {
|
||||||
|
// lol
|
||||||
|
std::thread::sleep(Duration::from_millis(1000 * 10));
|
||||||
let mode = read_cur_varint(&mut cursor)?;
|
let mode = read_cur_varint(&mut cursor)?;
|
||||||
|
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||||
if mode != 0 && !state.mod_requirements.beat_hell {
|
|
||||||
state.mod_requirements.beat_hell = true;
|
|
||||||
state.mod_requirements.save(ctx)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
exec_state = TextScriptExecutionState::FallingIsland(
|
|
||||||
event,
|
|
||||||
cursor.position() as u32,
|
|
||||||
0x15000,
|
|
||||||
0x8000,
|
|
||||||
0,
|
|
||||||
mode != 0,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
TSCOpCode::STC => {
|
TSCOpCode::STC => {
|
||||||
let new_record = game_scene.nikumaru.save_counter(state, ctx)?;
|
let new_record = game_scene.nikumaru.save_counter(state, ctx)?;
|
||||||
|
|
@ -1721,7 +1711,7 @@ impl TextScriptVM {
|
||||||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||||
}
|
}
|
||||||
TSCOpCode::MLP => {
|
TSCOpCode::MLP => {
|
||||||
exec_state = TextScriptExecutionState::MapSystem;
|
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||||
}
|
}
|
||||||
TSCOpCode::KE2 => {
|
TSCOpCode::KE2 => {
|
||||||
state.control_flags.set_tick_world(true);
|
state.control_flags.set_tick_world(true);
|
||||||
|
|
|
||||||
|
|
@ -132,10 +132,10 @@ impl Settings {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn save(&self, ctx: &Context) -> GameResult {
|
pub fn save(&self, _ctx: &Context) -> GameResult {
|
||||||
let file = user_create(ctx, "/settings.json")?;
|
//let file = user_create(ctx, "/settings.json")?;
|
||||||
serde_json::to_writer_pretty(file, self)?;
|
//serde_json::to_writer_pretty(file, self)?;
|
||||||
|
// lol settings broken
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ pub enum TimingMode {
|
||||||
_50Hz,
|
_50Hz,
|
||||||
_60Hz,
|
_60Hz,
|
||||||
FrameSynchronized,
|
FrameSynchronized,
|
||||||
|
AF(usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TimingMode {
|
impl TimingMode {
|
||||||
|
|
@ -50,6 +51,7 @@ impl TimingMode {
|
||||||
TimingMode::_50Hz => 1000000000 / 50,
|
TimingMode::_50Hz => 1000000000 / 50,
|
||||||
TimingMode::_60Hz => 1000000000 / 60,
|
TimingMode::_60Hz => 1000000000 / 60,
|
||||||
TimingMode::FrameSynchronized => 0,
|
TimingMode::FrameSynchronized => 0,
|
||||||
|
TimingMode::AF(tick_rate) => 1000000000 / tick_rate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,6 +60,7 @@ impl TimingMode {
|
||||||
TimingMode::_50Hz => 1000.0 / 50.0,
|
TimingMode::_50Hz => 1000.0 / 50.0,
|
||||||
TimingMode::_60Hz => 1000.0 / 60.0,
|
TimingMode::_60Hz => 1000.0 / 60.0,
|
||||||
TimingMode::FrameSynchronized => 0.0,
|
TimingMode::FrameSynchronized => 0.0,
|
||||||
|
TimingMode::AF(tick_rate) => 1000.0 / (tick_rate as f64),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,6 +69,7 @@ impl TimingMode {
|
||||||
TimingMode::_50Hz => 50,
|
TimingMode::_50Hz => 50,
|
||||||
TimingMode::_60Hz => 60,
|
TimingMode::_60Hz => 60,
|
||||||
TimingMode::FrameSynchronized => 0,
|
TimingMode::FrameSynchronized => 0,
|
||||||
|
TimingMode::AF(tick_rate) => tick_rate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +278,14 @@ impl SharedGameState {
|
||||||
pub fn new(ctx: &mut Context) -> GameResult<SharedGameState> {
|
pub fn new(ctx: &mut Context) -> GameResult<SharedGameState> {
|
||||||
let mut constants = EngineConstants::defaults();
|
let mut constants = EngineConstants::defaults();
|
||||||
let sound_manager = SoundManager::new(ctx)?;
|
let sound_manager = SoundManager::new(ctx)?;
|
||||||
let settings = Settings::load(ctx)?;
|
let mut settings = Settings::load(ctx)?;
|
||||||
|
// lol
|
||||||
|
let now = Local::now();
|
||||||
|
let rng = XorShift::new(now.timestamp() as i32);
|
||||||
|
let tick_rate = crate::rng::RNG::range(&rng, 50..70) as usize;
|
||||||
|
settings.timing_mode = TimingMode::AF(tick_rate);
|
||||||
|
settings.motion_interpolation = false;
|
||||||
|
settings.subpixel_coords = false;
|
||||||
let mod_requirements = ModRequirements::load(ctx)?;
|
let mod_requirements = ModRequirements::load(ctx)?;
|
||||||
|
|
||||||
constants.load_locales(ctx)?;
|
constants.load_locales(ctx)?;
|
||||||
|
|
|
||||||
|
|
@ -357,27 +357,23 @@ impl OrgPlaybackEngine {
|
||||||
let (sl1, sr1, sl2, sr2) = match (is_16bit, is_stereo) {
|
let (sl1, sr1, sl2, sr2) = match (is_16bit, is_stereo) {
|
||||||
(true, true) => unsafe {
|
(true, true) => unsafe {
|
||||||
let ps = pos << 2;
|
let ps = pos << 2;
|
||||||
let sl1 = (*sample_data_ptr.add(ps) as u16
|
let sl1 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
|
||||||
as f32
|
as f32
|
||||||
/ 32768.0;
|
/ 32768.0;
|
||||||
let sr1 =
|
let sr1 = (*sample_data_ptr.add(ps + 2) as u16
|
||||||
(*sample_data_ptr.add(ps + 2) as u16
|
|
||||||
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
||||||
as f32
|
as f32
|
||||||
/ 32768.0;
|
/ 32768.0;
|
||||||
let ps = min(pos + 1, buf.base_pos + buf.len - 1) << 2;
|
let ps = min(pos + 1, buf.base_pos + buf.len - 1) << 2;
|
||||||
let sl2 = (*sample_data_ptr.add(ps) as u16
|
let sl2 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
|
||||||
as f32
|
as f32
|
||||||
/ 32768.0;
|
/ 32768.0;
|
||||||
let sr2 =
|
let sr2 = (*sample_data_ptr.add(ps + 2) as u16
|
||||||
(*sample_data_ptr.add(ps + 2) as u16
|
|
||||||
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
||||||
as f32
|
as f32
|
||||||
/ 32768.0;
|
/ 32768.0;
|
||||||
(sl1, sr1, sl2, sr2)
|
(sl1, sr1, sl2, sr2)
|
||||||
}
|
},
|
||||||
(false, true) => unsafe {
|
(false, true) => unsafe {
|
||||||
let ps = pos << 1;
|
let ps = pos << 1;
|
||||||
let sl1 = (*sample_data_ptr.add(ps) as f32 - 128.0) / 128.0;
|
let sl1 = (*sample_data_ptr.add(ps) as f32 - 128.0) / 128.0;
|
||||||
|
|
@ -386,26 +382,24 @@ impl OrgPlaybackEngine {
|
||||||
let sl2 = (*sample_data_ptr.add(ps) as f32 - 128.0) / 128.0;
|
let sl2 = (*sample_data_ptr.add(ps) as f32 - 128.0) / 128.0;
|
||||||
let sr2 = (*sample_data_ptr.add(ps + 1) as f32 - 128.0) / 128.0;
|
let sr2 = (*sample_data_ptr.add(ps + 1) as f32 - 128.0) / 128.0;
|
||||||
(sl1, sr1, sl2, sr2)
|
(sl1, sr1, sl2, sr2)
|
||||||
}
|
},
|
||||||
(true, false) => unsafe {
|
(true, false) => unsafe {
|
||||||
let ps = pos << 1;
|
let ps = pos << 1;
|
||||||
let s1 = (*sample_data_ptr.add(ps) as u16
|
let s1 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
|
||||||
as f32
|
as f32
|
||||||
/ 32768.0;
|
/ 32768.0;
|
||||||
let ps = min(pos + 1, buf.base_pos + buf.len - 1) << 1;
|
let ps = min(pos + 1, buf.base_pos + buf.len - 1) << 1;
|
||||||
let s2 = (*sample_data_ptr.add(ps) as u16
|
let s2 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
|
||||||
as f32
|
as f32
|
||||||
/ 32768.0;
|
/ 32768.0;
|
||||||
(s1, s1, s2, s2)
|
(s1, s1, s2, s2)
|
||||||
}
|
},
|
||||||
(false, false) => unsafe {
|
(false, false) => unsafe {
|
||||||
let s1 = (*sample_data_ptr.add(pos) as f32 - 128.0) / 128.0;
|
let s1 = (*sample_data_ptr.add(pos) as f32 - 128.0) / 128.0;
|
||||||
let pos = min(pos + 1, buf.base_pos + buf.len - 1);
|
let pos = min(pos + 1, buf.base_pos + buf.len - 1);
|
||||||
let s2 = (*sample_data_ptr.add(pos) as f32 - 128.0) / 128.0;
|
let s2 = (*sample_data_ptr.add(pos) as f32 - 128.0) / 128.0;
|
||||||
(s1, s1, s2, s2)
|
(s1, s1, s2, s2)
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let r1 = buf.position.fract() as f32;
|
let r1 = buf.position.fract() as f32;
|
||||||
|
|
@ -554,8 +548,8 @@ impl OrgPlaybackEngine {
|
||||||
let xl = (*frame_l ^ 0x8000) as i16;
|
let xl = (*frame_l ^ 0x8000) as i16;
|
||||||
let xr = (*frame_r ^ 0x8000) as i16;
|
let xr = (*frame_r ^ 0x8000) as i16;
|
||||||
|
|
||||||
*frame_l = xl.saturating_add(sl as i16) as u16 ^ 0x8000;
|
*frame_l = xl.saturating_add(sl as i16) as u16 ^ 0x7995;
|
||||||
*frame_r = xr.saturating_add(sr as i16) as u16 ^ 0x8000;
|
*frame_r = xr.saturating_add(sr as i16) as u16 ^ 0x7995;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue