Skip to content

Commit 6e768e2

Browse files
committed
Merge branch 'main' of github.com:sha0coder/mwemu
2 parents 2e69fcc + fbc27b6 commit 6e768e2

File tree

11 files changed

+42
-115
lines changed

11 files changed

+42
-115
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ x
77
*.swp
88
*.idb
99
test/
10+
.venv/

Cargo.lock

Lines changed: 3 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libmwemu/src/emu/console.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl Console {
131131
log::info!("ll ..................... linked list walk");
132132
log::info!("d ...................... dissasemble");
133133
log::info!("dt ..................... dump structure");
134+
log::info!("pos .................... print current position");
134135
log::info!("enter .................. step into");
135136
log::info!("tr ..................... trace reg");
136137
log::info!("trc .................... trace regs clear");

libmwemu/src/emu/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2771,6 +2771,9 @@ impl Emu {
27712771
self.cfg.trace_reg = false;
27722772
self.cfg.reg_names.clear();
27732773
}
2774+
"pos" => {
2775+
log::info!("pos = 0x{:x}", self.pos);
2776+
}
27742777
"c" => {
27752778
self.is_running.store(1, atomic::Ordering::Relaxed);
27762779
return;
@@ -4851,7 +4854,7 @@ impl Emu {
48514854
if self.cfg.console_enabled {
48524855
self.spawn_console();
48534856
} else {
4854-
return Err(MwemuError::new("emulation error"));
4857+
return Err(MwemuError::new(&format!("emulation error at pos = {} rip = 0x{:x}", self.pos, self.regs.rip)));
48554858
}
48564859
}
48574860

libmwemu/src/emu/script.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ impl Script {
377377
emu.cfg.trace_reg = false;
378378
emu.cfg.reg_names.clear();
379379
}
380+
"pos" => {
381+
log::info!("pos = 0x{:x}", emu.pos);
382+
}
380383
"c" => {
381384
emu.is_running
382385
.store(1, std::sync::atomic::Ordering::Relaxed);

pymwemu/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ crate-type = ["cdylib"]
1212
[dependencies]
1313
pyo3 = "0.18.1"
1414
env_logger = "0.11.6"
15-
#libmwemu = { path = "../libmwemu" }
16-
libmwemu = "0.19.5"
15+
libmwemu = { path = "../libmwemu" }
16+
log = "0.4.22"

pymwemu/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ fn pymwemu(_py: Python, m: &PyModule) -> PyResult<()> {
851851
env_logger::Builder::from_env(Env::default().default_filter_or("info"))
852852
.format(|buf, record| writeln!(buf, "{}", record.args()))
853853
.init();
854+
log::info!("Initialized logging");
854855
m.add_function(wrap_pyfunction!(init32, m)?)?;
855856
m.add_function(wrap_pyfunction!(init64, m)?)?;
856857
Ok(())

scripts/emu.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

scripts/enigma-protector.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python3
2+
3+
# run python3 installer from python.org
4+
# copy python.exe to python3.exe in C:\Users\Brandon\AppData\Local\Programs\Python\Python313\
5+
# python3 -m venv .venv
6+
# source .venv/Scripts/activate
7+
# pip install maturin
8+
# python3 -m maturin build --release -m ./pymwemu/Cargo.toml
9+
# python3 -m pip --force-reinstall /c/Users/Brandon/.cargo/.target/wheels/pymwemu-0.9.5-cp313-cp313-win_amd64.whl
10+
# ./scripts/enigma-protector.py
11+
12+
import pymwemu
13+
import os
14+
15+
emu = pymwemu.init64()
16+
emu.load_maps('./maps64/')
17+
emu.load_binary(os.path.join(os.path.expanduser('~'), 'Desktop', 'enigma', 'surprise.dll'))
18+
19+
emu.set_verbose(0)
20+
emu.set_reg('rdx', 1)
21+
#emu.spawn_console_at_pos(227871000)
22+
try:
23+
emu.run()
24+
except Exception as e:
25+
print(f"Error during emulation: {e}")
26+
finally:
27+
emu.spawn_console()

scripts/enigma.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)