Skip to content

Commit

Permalink
Move CPU to seperate thread
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Dec 9, 2023
1 parent fc0c873 commit 4b6edaf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ async fn main() -> Result<(), impl std::error::Error> {
let game_name = std::str::from_utf8(&name_data[0..index]).expect("Failed to get game name!");
println!("Starting \"{game_name}\"...");

let buffer_copy = buffer.clone();
// Start CPU
let mut cpu = CPU::new(GBMode::Classic, buffer.clone());
tokio::spawn(async move {
let mut cpu = CPU::new(GBMode::Classic, buffer_copy);

while true {
cpu.cycle();
}
while true {
cpu.cycle();
}
});

let event_loop = EventLoop::new().unwrap();

Expand Down

0 comments on commit 4b6edaf

Please sign in to comment.