Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/oasis-app-calculator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ oasis-types = { workspace = true }
oasis-sdi = { workspace = true }
oasis-skin = { workspace = true }
oasis-vfs = { workspace = true }
thiserror = { workspace = true }

[lints]
workspace = true
20 changes: 5 additions & 15 deletions crates/oasis-app-calculator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! pure recursive-descent parser with no external dependencies.

use std::any::Any;
use std::fmt;

use oasis_app_core::render::{
draw_content_windowed, hide_app_sdi, render_app_chrome, render_content_sdi,
Expand All @@ -22,31 +21,22 @@ use oasis_vfs::Vfs;
// ---------------------------------------------------------------

/// Errors that can occur during expression evaluation.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, thiserror::Error)]
pub enum CalcError {
/// Division or modulo by zero.
#[error("Division by zero")]
DivisionByZero,
/// Expression could not be parsed.
#[error("Invalid expression: {0}")]
InvalidExpression(String),
/// Mismatched parentheses.
#[error("Unmatched parentheses")]
UnmatchedParen,
/// Input was empty or whitespace-only.
#[error("Empty expression")]
EmptyExpression,
}

impl fmt::Display for CalcError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::DivisionByZero => write!(f, "Division by zero"),
Self::InvalidExpression(msg) => {
write!(f, "Invalid expression: {msg}")
},
Self::UnmatchedParen => write!(f, "Unmatched parentheses"),
Self::EmptyExpression => write!(f, "Empty expression"),
}
}
}

// ---------------------------------------------------------------
// Tokenizer
// ---------------------------------------------------------------
Expand Down
17 changes: 13 additions & 4 deletions crates/oasis-app/src/tv_controller/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,18 @@ fn stream_download_inner(
// For moov-at-end: the tail probe already stored moov
// separately; only retain if base_offset is still 0
// (moov-at-start case).
if s.base_offset == 0 && s.moov.is_some() && !s.buf.is_empty() {
let full_header = s.buf.clone();
s.moov = Some((s.base_offset, full_header));
// For moov-at-start: retain the current buffer as a
// combined header (ftyp + moov + mdat leader) so
// symphonia can probe after the Range restart.
// Only do this if moov hasn't already been retained
// separately by the tail probe (moov-at-end case) --
// otherwise we'd overwrite the correct moov data with
// a raw buffer that isn't a valid moov atom.
if s.base_offset == 0 && !s.buf.is_empty() {
let current_len = s.header.as_ref().map_or(0, |h| h.len());
if s.buf.len() > current_len {
s.header = Some(s.buf.clone());
}
}
s.base_offset = start_from;
s.bytes_received = start_from;
Expand All @@ -955,7 +964,7 @@ fn stream_download_inner(
// the seek restart offset).
buffer
.decoder_pos
.store(start_from, std::sync::atomic::Ordering::Relaxed);
.store(start_from, std::sync::atomic::Ordering::Release);
log::info!(
"TV: restarting download from byte {:.1}MB via Range",
start_from as f64 / (1024.0 * 1024.0),
Expand Down
13 changes: 8 additions & 5 deletions crates/oasis-app/src/tv_controller/streaming_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,13 @@ impl StreamingInner {

/// Disable probe mode so reads block on real data instead of
/// returning zeros. Called after the decoder's probe phase completes.
///
/// Uses `Release` ordering so that the store is visible to the reader
/// thread (which loads with `Acquire`) before any subsequent reads.
pub(crate) fn disable_probe_mode(&self) {
log::info!("TV: StreamingBuffer probe_mode disabled -- reads will now block");
self.probe_mode
.store(false, std::sync::atomic::Ordering::Relaxed);
.store(false, std::sync::atomic::Ordering::Release);
}

/// Returns `true` if the download is far enough ahead of the decoder
Expand All @@ -430,7 +433,7 @@ impl StreamingInner {
let received = s.bytes_received;
drop(s);

let decoder = self.decoder_pos.load(std::sync::atomic::Ordering::Relaxed);
let decoder = self.decoder_pos.load(std::sync::atomic::Ordering::Acquire);
should_throttle_pure(decoder, received, has_moov, buf_size)
}
}
Expand Down Expand Up @@ -606,7 +609,7 @@ impl std::io::Read for StreamingBuffer {
let in_probe = self
.inner
.probe_mode
.load(std::sync::atomic::Ordering::Relaxed);
.load(std::sync::atomic::Ordering::Acquire);
if in_probe {
// Fill with zeros up to base_offset, total_size, or
// buf.len() -- whichever comes first.
Expand Down Expand Up @@ -677,11 +680,11 @@ impl std::io::Read for StreamingBuffer {
&& !self
.inner
.probe_mode
.load(std::sync::atomic::Ordering::Relaxed)
.load(std::sync::atomic::Ordering::Acquire)
{
self.inner
.decoder_pos
.store(self.pos, std::sync::atomic::Ordering::Relaxed);
.store(self.pos, std::sync::atomic::Ordering::Release);
self.maybe_evict();
}

Expand Down
1 change: 1 addition & 0 deletions crates/oasis-backend-psp/src/chrome.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Dashboard + shell chrome rendering (status bar, bottom bar, icons).
#![allow(dead_code)]

use oasis_backend_psp::{AudioHandle, Color, PspBackend, SCREEN_WIDTH, WindowManager};

Expand Down
3 changes: 3 additions & 0 deletions crates/oasis-backend-psp/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl PspBackend {
///
/// Returns `(dx, dy)` in pixels, or `(0, 0)` if both axes are zero.
/// `ax` and `ay` are the deadzone-filtered analog values in `[-1.0, 1.0]`.
#[allow(dead_code)]
pub(crate) fn analog_to_cursor_delta(ax: f32, ay: f32) -> (i32, i32) {
if ax == 0.0 && ay == 0.0 {
return (0, 0);
Expand All @@ -92,6 +93,7 @@ pub(crate) fn analog_to_cursor_delta(ax: f32, ay: f32) -> (i32, i32) {
}

/// Clamp cursor position within screen bounds.
#[allow(dead_code)]
pub(crate) fn clamp_cursor(
cursor_x: i32,
cursor_y: i32,
Expand All @@ -108,6 +110,7 @@ pub(crate) fn clamp_cursor(
/// Apply analog deadzone: returns 0.0 if `|value| < deadzone`.
///
/// This mirrors the logic in `psp::input::Controller::analog_x_f32`.
#[allow(dead_code)]
pub(crate) fn apply_deadzone(value: f32, deadzone: f32) -> f32 {
if value.abs() < deadzone { 0.0 } else { value }
}
Expand Down
7 changes: 3 additions & 4 deletions crates/oasis-backend-psp/src/input_dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use psp::sys::CtrlButtons;

use oasis_backend_psp::{
AudioCmd, Button, InputEvent, IoCmd, PspBackend, SCREEN_HEIGHT, SCREEN_WIDTH, SdiRegistry,
SfxId, TextureId, Trigger, TvCatalogRequest, WindowManager,
SfxId, Trigger, TvCatalogRequest, WindowManager,
};

use oasis_core::dashboard::DashboardState;
Expand All @@ -21,7 +21,6 @@ use crate::desktop;
use crate::skins;
use crate::theme::*;
use crate::types::*;
use crate::views;

use oasis_backend_psp::AudioHandle;
use oasis_backend_psp::threading::IoHandle;
Expand Down Expand Up @@ -703,10 +702,10 @@ fn dispatch_dashboard_confirm(
title: &str,
classic_view: &mut ClassicView,
app_mode: &mut AppMode,
dashboard: &mut DashboardState,
_dashboard: &mut DashboardState,
wm: &mut WindowManager,
sdi: &mut SdiRegistry,
audio: &AudioHandle,
_audio: &AudioHandle,
io: &IoHandle,
fm: &mut FileManagerState,
pv: &mut PhotoViewerState,
Expand Down
3 changes: 1 addition & 2 deletions crates/oasis-backend-psp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//! - `input_dispatch` -- input event routing for Classic and Desktop modes

#![feature(restricted_std)]
#![feature(asm_experimental_arch)]
#![no_main]

use oasis_backend_psp::{
Expand Down Expand Up @@ -1010,7 +1009,7 @@ fn render_desktop(
pv: &PhotoViewerState,
mp: &MusicPlayerState,
audio: &oasis_backend_psp::AudioHandle,
br: &BrowserState,
_br: &BrowserState,
) {
let settings_clock = config.get_i32("clock_mhz").unwrap_or(333);
let settings_bus = config.get_i32("bus_mhz").unwrap_or(166);
Expand Down
2 changes: 2 additions & 0 deletions crates/oasis-backend-psp/src/skins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ impl PspSkinPreset {
}

/// Cycle to the next preset in the list.
#[allow(dead_code)]
pub(crate) fn next(self) -> Self {
let idx = Self::ALL.iter().position(|&p| p == self).unwrap_or(0);
Self::ALL[(idx + 1) % Self::ALL.len()]
}

/// Cycle to the previous preset in the list.
#[allow(dead_code)]
pub(crate) fn prev(self) -> Self {
let idx = Self::ALL.iter().position(|&p| p == self).unwrap_or(0);
Self::ALL[(idx + Self::ALL.len() - 1) % Self::ALL.len()]
Expand Down
1 change: 1 addition & 0 deletions crates/oasis-backend-psp/src/textures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub(crate) struct VolatileAllocator {

impl VolatileAllocator {
/// Create a new allocator over the given memory region.
#[allow(dead_code)]
pub(crate) fn new(base: *mut u8, size: usize) -> Self {
Self {
base,
Expand Down
1 change: 1 addition & 0 deletions crates/oasis-backend-psp/src/theme.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Theme constants (matching oasis-core/src/theme.rs).
#![allow(dead_code)]

use oasis_backend_psp::{Color, SCREEN_HEIGHT, SCREEN_WIDTH};

Expand Down
Loading
Loading