Compare commits

...

3 Commits
v0.1.1 ... main

4 changed files with 61 additions and 4 deletions

2
Cargo.lock generated
View File

@ -1770,7 +1770,7 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
[[package]]
name = "lemur"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"anyhow",
"bitflags 2.6.0",

View File

@ -4,7 +4,7 @@ description = "An emulator for the Virtual Boy."
repository = "https://git.virtual-boy.com/PVB/lemur"
publish = false
license = "MIT"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
[dependencies]

View File

@ -23,7 +23,25 @@ docker build -f build.Dockerfile -t lemur-build .
MSYS_NO_PATHCONV=1 docker run -it --rm -v .:/app -w /app --entrypoint bash lemur-build /app/scripts/do-bundle.sh
read -r -d EOF 'body' <<EOF
# v${version}
## How to install
The emulator can be found in the "Downloads" section of this release.
### Windows users
Download \`lemur.exe\`.
### MacOS users
If your Mac uses an Intel processor, download and install \`Lemur-Intel.dmg\`.
If it uses Apple Silicon, download and install \`Lemur-Apple-Silicon.dmg\`.
If you're not sure which to choose, use [this guide](https://support.apple.com/en-us/116943) to find out.
### Linux users
You can either download and run \`lemur-linux\`, or download and install the attached .deb file.
EOF
read -r -d EOF 'payload' <<EOF

View File

@ -1,7 +1,7 @@
// hide console in release mode
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use std::{path::PathBuf, process};
use std::{path::PathBuf, process, time::SystemTime};
use anyhow::Result;
use app::Application;
@ -24,6 +24,43 @@ struct Args {
rom: Option<PathBuf>,
}
fn set_panic_handler() {
std::panic::set_hook(Box::new(|info| {
let mut message = String::new();
if let Some(msg) = info.payload().downcast_ref::<&str>() {
message += &format!("{}\n", msg);
} else if let Some(msg) = info.payload().downcast_ref::<String>() {
message += &format!("{}\n", msg);
}
if let Some(location) = info.location() {
message += &format!(
" in file '{}' at line {}\n",
location.file(),
location.line()
);
}
let backtrace = std::backtrace::Backtrace::force_capture();
message += &format!("stack trace:\n{:#}\n", backtrace);
eprint!("{}", message);
let Some(project_dirs) = directories::ProjectDirs::from("com", "virtual-boy", "Lemur")
else {
return;
};
let data_dir = project_dirs.data_dir();
if std::fs::create_dir_all(data_dir).is_err() {
return;
}
let timestamp = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_millis();
let logfile_name = format!("crash-{}.txt", timestamp);
let _ = std::fs::write(data_dir.join(logfile_name), message);
}));
}
#[cfg(windows)]
fn set_process_priority_to_high() -> Result<()> {
use windows::Win32::{Foundation, System::Threading};
@ -34,6 +71,8 @@ fn set_process_priority_to_high() -> Result<()> {
}
fn main() -> Result<()> {
set_panic_handler();
#[cfg(windows)]
set_process_priority_to_high()?;