[v0.1.2] return reverse order of pids in find_dolphin()

This commit is contained in:
sup39 2022-07-20 04:13:52 +09:00
parent b891a9496a
commit 5960fe211b
3 changed files with 7 additions and 3 deletions

View file

@ -1,4 +1,8 @@
# Change Log # Change Log
## \[v0.1.2] return reverse order of pids in `find_dolphin()` (2022/07/20)
- Return pids from the newest to the oldest
- Add optional self to `Dolphin.find_dolphin()`, making it available to call from instance
## \[v0.1.1] use psutil to find pid of dolphin (2022/06/26) ## \[v0.1.1] use psutil to find pid of dolphin (2022/06/26)
Use psutil to achieve cross-platform pid finding. Use psutil to achieve cross-platform pid finding.
This also fixes the dependency issue on Linux. This also fixes the dependency issue on Linux.

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = sup-dolphin-memory-lib name = sup-dolphin-memory-lib
version = 0.1.1 version = 0.1.2
author = sup39 author = sup39
author_email = sms@sup39.dev author_email = sms@sup39.dev
description = A Python library for reading and writing the memory of an emulated game in Dolphin description = A Python library for reading and writing the memory of an emulated game in Dolphin

View file

@ -21,12 +21,12 @@ dolphinProcNames = \
('Dolphin.exe', 'DolphinQt2.exe', 'DolphinWx.exe') if os.name == 'nt' \ ('Dolphin.exe', 'DolphinQt2.exe', 'DolphinWx.exe') if os.name == 'nt' \
else ('dolphin-emu', 'dolphin-emu-qt2', 'dolphin-emu-wx') else ('dolphin-emu', 'dolphin-emu-qt2', 'dolphin-emu-wx')
def find_dolphin(): def find_dolphin(self=None):
return [ return [
proc.pid proc.pid
for proc in process_iter() for proc in process_iter()
if proc.name() in dolphinProcNames if proc.name() in dolphinProcNames
] ][::-1] # newest to oldest
''' '''
@typedef {(int|str) | [(int|str), ...int[]]} Addr @typedef {(int|str) | [(int|str), ...int[]]} Addr