8000 add exit logic · sha0coder/libscemu@9bfd597 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 9bfd597

Browse files
committed
add exit logic
1 parent f075c3c commit 9bfd597

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/emu/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ impl Emu {
417417
pub fn init(&mut self, clear_registers: bool, clear_flags: bool) {
418418
self.pos = 0;
419419

420-
421420
if !atty::is(Stream::Stdout) {
422421
self.cfg.nocolors = true;
423422
self.colors.disable();
@@ -4422,6 +4421,12 @@ impl Emu {
44224421
pub fn step(&mut self) -> bool {
44234422
self.pos += 1;
44244423

4424+
// exit
4425+
if self.cfg.exit_position != 0 && self.pos == self.cfg.exit_position {
4426+
log::info!("exit position reached");
4427+
std::process::exit(0);
4428+
}
4429+
44254430
// code
44264431
let code = match self.maps.get_mem_by_addr(self.regs.rip) {
44274432
Some(c) => c,
@@ -4437,8 +4442,8 @@ impl Emu {
44374442

44384443
// block
44394444
let block = code.read_from(self.regs.rip).to_vec(); // reduce code block for more speed
4440-
//
4441-
// decoder
4445+
4446+
// decoder
44424447
let mut decoder;
44434448
if self.cfg.is_64bits {
44444449
decoder = Decoder::with_ip(64, &block, self.regs.rip, DecoderOptions::NONE);

0 commit comments

Comments
 (0)
0