Skip to content

Commit

Permalink
Fix breakpoints at 0x0
Browse files Browse the repository at this point in the history
  • Loading branch information
1whatleytay committed Sep 26, 2023
1 parent a6775e9 commit a296ce5
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri + Vue + TS</title>
<title>Saturn</title>
</head>

<style>
Expand Down
70 changes: 70 additions & 0 deletions src-tauri/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 src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ sha2 = "0.10.6"
uuid = "1.3.0"
async-trait = "0.1.68"
num = "0.4.1"
notify = "6.1.1"

titan = { git = "https://github.com/1whatleytay/titan.git", branch = "main" }

Expand Down
62 changes: 62 additions & 0 deletions src-tauri/src/auto_save.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
use std::path::PathBuf;
use std::sync::Mutex;
use notify::RecommendedWatcher;
use serde::{Deserialize, Serialize};
const AUTO_SAVE_VERSION: u32 = 1;
#[derive(Serialize, Deserialize)]
pub struct AutoSaveDetails {
version: u32,
files: Vec<PathBuf>
}
pub struct AutoSaveState {
details: AutoSaveDetails,
watcher: Option<RecommendedWatcher>
}
impl AutoSaveState {
pub fn new(app: tauri::AppHandle) -> AutoSaveState {
let watcher = notify::recommended_watcher(|event| {
let Ok(event) = event else { return };
}).ok();
AutoSaveState {
details: AutoSaveDetails {
version: AUTO_SAVE_VERSION,
files: vec![],
},
watcher
}
}
pub fn read_from_disc(app: tauri::AppHandle) -> AutoSaveState {
let path = tauri::api::path::app_data_dir(&app.config());
Self::new(app)
}
}
#[derive(Serialize)]
pub struct AutoSaveFile {
path: String,
name: String
}
#[tauri::command]
pub fn register_files(files: Vec<String>, state: tauri::State<Mutex<AutoSaveState>>, app_handle: tauri::AppHandle) {
let mut pointer = state.lock().unwrap();
}
#[tauri::command]
pub fn get_files(state: tauri::State<Mutex<AutoSaveState>>) -> Vec<AutoSaveFile> {
let mut pointer = state.lock().unwrap();
vec![]
}
*/
6 changes: 6 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod state;
mod testing;
mod decode;
mod hex_format;
mod auto_save;

use std::sync::{Arc, Mutex};
use tauri::Manager;
Expand Down Expand Up @@ -59,6 +60,11 @@ fn main() {
.manage(Arc::new(Mutex::new(FlushDisplayState::default())) as FlushDisplayBody)
.manage(Mutex::new(MidiProviderContainer::None))
.menu(menu)
// .setup(|app| {
// app.manage(Mutex::new(AutoSaveState::read_from_disc(app.handle())));
//
// Ok(())
// })
.on_window_event(|event| {
if let Destroyed = event.event() {
// Relieve some pressure on tokio.
Expand Down
2 changes: 2 additions & 0 deletions src/components/EditorBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ function handlePaste(event: ClipboardEvent) {
onMounted(() => {
handleScroll()
setTimeout(handleScroll, 0)
window.addEventListener('mousemove', handleMove)
window.addEventListener('mouseup', handleUp)
})
Expand Down
6 changes: 1 addition & 5 deletions src/utils/mips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ export class Breakpoints {
}

public mapLines(lines: number[]): number[] {
const x = lines
.flatMap((line) => this.findNextPc(line))
.filter((point) => !!point) as number[]

return x
return lines.flatMap((line) => this.findNextPc(line))
}

// pc -> line
Expand Down
16 changes: 8 additions & 8 deletions src/utils/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export function setupWindow() {
}
})

const handler = (event: Event) => {
// Don't bring up the "reload" context menu. It's note great!
event.preventDefault()
}

if (!import.meta.env.TAURI_DEBUG) {
window.addEventListener('contextmenu', handler)
}
// const handler = (event: Event) => {
// // Don't bring up the "reload" context menu. It's note great!
// event.preventDefault()
// }
//
// if (!import.meta.env.TAURI_DEBUG) {
// window.addEventListener('contextmenu', handler)
// }
}

// Restricting tauri calls to certain files.
Expand Down

0 comments on commit a296ce5

Please sign in to comment.