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

Commit cdfb94d

Browse files
committed
huge improvement in libscemu
1 parent 18aa9a4 commit cdfb94d

File tree

4 files changed

+27
-13
lines changed

4 files changed

+27
-13
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
pyo3 = "0.18.1"
13-
libscemu = "0.18.7"
13+
libscemu = "0.19.0"
1414
#libscemu = { path = "/home/sha0/src/libscemu/" }
1515
#libscemu = { path = "/Users/sha0coder/src/libscemu/" }
1616
#libscemu = { path = "/Users/jesus/src/libscemu/" }

DOCUMENTATION.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ disable_trace_reg()
8585

8686

8787
# inspect sequence like: inspect_seq('dword ptr [eax + 0x3c]')
88-
inspect_seq(seq:str)
88+
inspect_seq(seq:str)
8989

9090
# set the verbosity between 0 and 3.
9191
# 0: only show api calls.
@@ -215,7 +215,13 @@ set_xmm(reg:str, value:int) -> int
215215
# allocate a buffer on the emulated process address space. It returns an address.
216216
alloc(map_name:str, size:int) -> int
217217

218-
# load an aditional blob to the memory layout.
218+
# allocate a buffer on the emulated process at specific space, check first to avoid collisions.
219+
alloc_at(map_name:str, addr:int, size:int)
220+
221+
# Link DLL library
222+
link_library(filepath:str) -> int {
223+
224+
# load an aditional blob to the memory layout, check first to avoid collisions.
219225
load_map(name:str, filename:str, base_addr:int)
220226

221227
# write a little endian qword on memory.

src/lib.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,23 @@ impl Emu {
282282
return Ok(self.emu.alloc(name, size));
283283
}
284284

285+
/// allocate at specific address
286+
fn alloc_at(&mut self, name:&str, addr:u64, size:u64) {
287+
self.emu.maps.create_map(name, addr, size).expect("pyscemu alloc_at out of memory");
288+
}
289+
290+
/// load an aditional blob to the memory layout.
291+
fn load_map(&mut self, name:&str, filename:&str, base_addr:u64) {
292+
let map = self.emu.maps.create_map(name, base_addr, 1).expect("pyscemu load_map out of memory");
293+
map.load(filename);
294+
}
295+
296+
297+
/// link library
298+
fn link_library(&mut self, filepath:&str) -> PyResult<u64> {
299+
Ok(self.emu.link_library(filepath))
300+
}
301+
285302

286303
/// push a 32bits value to the stack.
287304
fn stack_push32(&mut self, value:u32) -> PyResult<bool> {
@@ -440,13 +457,6 @@ impl Emu {
440457
self.emu.maps.create_map(name);
441458
}*/
442459

443-
/// load an aditional blob to the memory layout.
444-
fn load_map(&mut self, name:&str, filename:&str, base_addr:u64) {
445-
//TODO: check if collision
446-
let map = self.emu.maps.create_map(name);
447-
map.set_base(base_addr);
448-
map.load(filename);
449-
}
450460

451461
/// write a little endian qword on memory.
452462
fn write_qword(&mut self, addr:u64, value:u64) -> PyResult<bool> {

0 commit comments

Comments
 (0)