Compare commits

..
5 Commits
Author SHA1 Message Date
SonicSwordcane acd7a27c5b chore: Release lemur version 0.11.0 2026-02-20 01:40:40 -05:00
SonicSwordcane faf258bbda Fix broken LLVM install 2026-02-20 01:37:56 -05:00
SonicSwordcane 1b1fa3ced0 Update deps 2026-02-20 00:25:34 -05:00
SonicSwordcane 9dfc942dfc CLI flag to give P2 the controller 2026-02-20 00:02:04 -05:00
SonicSwordcane d269082c8b CLI flag to open player 2 (thx Elrinth) 2026-02-19 23:52:52 -05:00
8 changed files with 399 additions and 143 deletions
Generated
+345 -134
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -4,7 +4,7 @@ description = "An emulator for the Virtual Boy."
repository = "https://git.virtual-boy.com/PVB/lemur" repository = "https://git.virtual-boy.com/PVB/lemur"
publish = false publish = false
license = "MIT" license = "MIT"
version = "0.10.2" version = "0.11.0"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
@@ -36,7 +36,7 @@ num-traits = "0.2"
object = "0.38" object = "0.38"
oneshot = "0.1" oneshot = "0.1"
pollster = "0.4" pollster = "0.4"
rand = "0.9" rand = "0.10"
rfd = "0.17" rfd = "0.17"
rtrb = "0.3" rtrb = "0.3"
rubato = "1" rubato = "1"
+6 -2
View File
@@ -9,8 +9,10 @@ ADD "https://github.com/joseluisq/macosx-sdks/releases/download/14.5/MacOSX14.5.
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y ca-certificates apt-get install -y ca-certificates
COPY llvm.sources /etc/apt/sources.list.d/llvm.sources COPY llvm.sources /etc/apt/sources.list.d/llvm.sources
COPY install-llvm.sh .
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y bash bzip2 clang-21 git lld-21 llvm-21 make patch xz-utils && \ ./install-llvm.sh && \
apt-get install -y bash bzip2 git make patch xz-utils && \
ln -s $(which clang-21) /usr/bin/clang && \ ln -s $(which clang-21) /usr/bin/clang && \
ln -s $(which clang++-21) /usr/bin/clang++ && \ ln -s $(which clang++-21) /usr/bin/clang++ && \
ln -s $(which ld64.lld-21) /usr/bin/ld64.lld && \ ln -s $(which ld64.lld-21) /usr/bin/ld64.lld && \
@@ -19,11 +21,13 @@ RUN apt-get update && \
FROM rust:1.93-bookworm FROM rust:1.93-bookworm
ADD --chmod=644 "https://apt.llvm.org/llvm-snapshot.gpg.key" /etc/apt/trusted.gpg.d/apt.llvm.org.asc ADD --chmod=644 "https://apt.llvm.org/llvm-snapshot.gpg.key" /etc/apt/trusted.gpg.d/apt.llvm.org.asc
COPY llvm.sources /etc/apt/sources.list.d/llvm.sources COPY llvm.sources /etc/apt/sources.list.d/llvm.sources
COPY install-llvm.sh .
RUN rustup target add x86_64-pc-windows-msvc && \ RUN rustup target add x86_64-pc-windows-msvc && \
rustup target add x86_64-apple-darwin && \ rustup target add x86_64-apple-darwin && \
rustup target add aarch64-apple-darwin && \ rustup target add aarch64-apple-darwin && \
apt-get update && \ apt-get update && \
apt-get install -y clang-21 lld-21 libc6-dev libasound2-dev libudev-dev genisoimage mingw-w64 && \ ./install-llvm.sh && \
apt-get install -y libc6-dev libasound2-dev libudev-dev genisoimage mingw-w64 && \
cargo install cargo-bundle xwin && \ cargo install cargo-bundle xwin && \
xwin --accept-license splat --output xwin && \ xwin --accept-license splat --output xwin && \
rm -rf .xwin-cache && \ rm -rf .xwin-cache && \
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Hopefully temporary script to manually install working llvm packages.
# The apt index for these is broken in bookworm, and upgrading to trixie
# would make them depend on too new of a libc version.
# https://apt.llvm.org/bookworm/pool/main/l/llvm-toolchain-21/clang-21_21.1.5~%2B%2B20251023083151%2B45afac62e373-1~exp1~20251023083333.51_amd64.deb
PACKAGES=('clang-21' 'clang-tools-21' 'libclang-common-21-dev' 'libclang-cpp21' 'libclang-rt-21-dev' 'libclang1-21' 'libllvm21' 'lld-21' 'llvm-21' 'llvm-21-dev' 'llvm-21-linker-tools' 'llvm-21-runtime' 'llvm-21-tools')
FILES=()
URL='https://apt.llvm.org/bookworm/pool/main/l/llvm-toolchain-21'
VERSION='21.1.5~%2B%2B20251023083151%2B45afac62e373-1~exp1~20251023083333.51_amd64.deb'
apt-get install -y curl python3
for package in "${PACKAGES[@]}"; do
curl -O -L "$URL/${package}_$VERSION"
FILES+=("./${package}_$VERSION")
done
apt-get install -y "${FILES[@]}"
+11 -2
View File
@@ -74,7 +74,7 @@ impl Application {
) -> Self { ) -> Self {
let wgpu = WgpuState::new(); let wgpu = WgpuState::new();
let icon = load_icon().ok().map(Arc::new); let icon = load_icon().ok().map(Arc::new);
let mappings = MappingProvider::new(persistence.clone()); let mappings = MappingProvider::new(persistence.clone(), args.player2_controller);
let shortcuts = ShortcutProvider::new(persistence.clone()); let shortcuts = ShortcutProvider::new(persistence.clone());
let controllers = ControllerManager::new(client.clone(), &mappings); let controllers = ControllerManager::new(client.clone(), &mappings);
let memory = Arc::new(MemoryClient::new(client.clone())); let memory = Arc::new(MemoryClient::new(client.clone()));
@@ -84,7 +84,7 @@ impl Application {
let proxy = proxy.clone(); let proxy = proxy.clone();
thread::spawn(|| process_gamepad_input(mappings, proxy)); thread::spawn(|| process_gamepad_input(mappings, proxy));
} }
Self { let app = Self {
icon, icon,
wgpu, wgpu,
client, client,
@@ -106,7 +106,16 @@ impl Application {
init_framebuffers: args.frame_buffers, init_framebuffers: args.frame_buffers,
init_registers: args.registers, init_registers: args.registers,
init_terminal: args.terminal, init_terminal: args.terminal,
};
if args.player2 {
app.client
.send_command(EmulatorCommand::StartSecondSim(args.rom.clone()));
app.proxy
.send_event(UserEvent::OpenPlayer2)
.expect("Failed to open Player 2 window");
} }
app
} }
fn open(&mut self, event_loop: &ActiveEventLoop, window: Box<dyn AppWindow>) { fn open(&mut self, event_loop: &ActiveEventLoop, window: Box<dyn AppWindow>) {
+6
View File
@@ -40,6 +40,12 @@ pub struct CliArgs {
/// Watch ROM files for changes, automatically reload /// Watch ROM files for changes, automatically reload
#[arg(short, long)] #[arg(short, long)]
pub watch: bool, pub watch: bool,
/// Automatically open Player 2 for multiplayer
#[arg(long)]
pub player2: bool,
/// Map the first connected controller to Player 2
#[arg(long)]
pub player2_controller: bool,
} }
pub const COLOR_PRESETS: [[Color32; 2]; 3] = [ pub const COLOR_PRESETS: [[Color32; 2]; 3] = [
+1 -1
View File
@@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use notify::Watcher; use notify::Watcher;
use rand::Rng; use rand::RngExt;
use std::{ use std::{
fs::{self, File}, fs::{self, File},
io::{Read, Seek as _, SeekFrom, Write as _}, io::{Read, Seek as _, SeekFrom, Write as _},
+9 -2
View File
@@ -272,13 +272,14 @@ impl Mappings for InputMapping {
#[derive(Clone)] #[derive(Clone)]
pub struct MappingProvider { pub struct MappingProvider {
persistence: Persistence, persistence: Persistence,
first_gamepad_is_p2: bool,
device_mappings: Arc<RwLock<HashMap<DeviceId, Arc<RwLock<GamepadMapping>>>>>, device_mappings: Arc<RwLock<HashMap<DeviceId, Arc<RwLock<GamepadMapping>>>>>,
sim_mappings: HashMap<SimId, Arc<RwLock<InputMapping>>>, sim_mappings: HashMap<SimId, Arc<RwLock<InputMapping>>>,
gamepad_info: Arc<RwLock<HashMap<GamepadId, GamepadInfo>>>, gamepad_info: Arc<RwLock<HashMap<GamepadId, GamepadInfo>>>,
} }
impl MappingProvider { impl MappingProvider {
pub fn new(persistence: Persistence) -> Self { pub fn new(persistence: Persistence, first_gamepad_is_p2: bool) -> Self {
let mut sim_mappings = HashMap::new(); let mut sim_mappings = HashMap::new();
let mut device_mappings = HashMap::new(); let mut device_mappings = HashMap::new();
@@ -307,6 +308,7 @@ impl MappingProvider {
device_mappings: Arc::new(RwLock::new(device_mappings)), device_mappings: Arc::new(RwLock::new(device_mappings)),
gamepad_info: Arc::new(RwLock::new(HashMap::new())), gamepad_info: Arc::new(RwLock::new(HashMap::new())),
sim_mappings, sim_mappings,
first_gamepad_is_p2,
} }
} }
@@ -338,7 +340,12 @@ impl MappingProvider {
.clone(); .clone();
drop(lock); drop(lock);
let mut lock = self.gamepad_info.write().unwrap(); let mut lock = self.gamepad_info.write().unwrap();
let bound_to = SimId::values() let players = if self.first_gamepad_is_p2 {
vec![SimId::Player2, SimId::Player1]
} else {
vec![SimId::Player1, SimId::Player2]
};
let bound_to = players
.into_iter() .into_iter()
.find(|sim_id| lock.values().all(|info| info.bound_to != Some(*sim_id))); .find(|sim_id| lock.values().all(|info| info.bound_to != Some(*sim_id)));
if let Entry::Vacant(entry) = lock.entry(gamepad.id()) { if let Entry::Vacant(entry) = lock.entry(gamepad.id()) {