qb-0 / PyMeow-

Python Game Hacking Library
MIT License
158 stars 21 forks source link

Crashes after calling any library functions in the threads #15

Closed MichaelDeCortix closed 2 years ago

MichaelDeCortix commented 2 years ago

Library ver: 1.6 Python: 3.10.4; 3.9.10 | Both have the same problem OC: Windows 11

Simple example:

from pymeow import *
import threading

csgo_proc = process_by_name("csgo.exe")
game_module = csgo_proc["modules"]["client.dll"]["baseaddr"]

def thread_f():
    local_player_addr = read_int(csgo_proc, game_module + 0xDB65DC)
    print(local_player_addr)

t = threading.Thread(target=thread_f)
t.daemon = True
t.start()
t.join()

In this example, the script crashes after calling read_int(). The same goes for any other function in the thread.

try/except doesn't help. It crashes without any errors.

qb-0 commented 2 years ago

Thank you. I've noticed that issue some time ago as well and created a issue on nimpy (https://github.com/yglukhov/nimpy/issues/189).

Guess the only solution to this is using another c compiler (clang/vcc) to compile pymeow. I'll give it some test's in the next release.

MichaelDeCortix commented 2 years ago

Thank you. I've noticed that issue some time ago as well and created a issue on nimpy (yglukhov/nimpy#189).

I see that the problem is quite old and apparently no one is interested in solving it...

Guess the only solution to this is using another c compiler (clang/vcc) to compile pymeow. I'll give it some test's in the next release.

I will look forward to the new release, because serious projects cannot be done with your library at the moment, threads are required (especially for overlay). If I succeed, I will try to compile your source code in other compilers and test the library with threads. No promises, but if I get results, I'll be sure to let you know.

Thank you for your work!

qb-0 commented 2 years ago

So here's a VCC build of the current master branch. If you could check it out and let me know if everything works I'll make it standard for windows.

Uninstall pymeow via pip and use the library in the same directory as your script pymeow_vcc.zip .

qb-0 commented 2 years ago

So I made a small test on my windows vm which seems to work

from pymeow import *
import threading
import requests
from time import sleep
from random import randint

colors = requests.get("https://gist.githubusercontent.com/mordka/c65affdefccb7264efff77b836b5e717/raw/e65646a07849665b28a7ee641e5846a1a6a4a758/colors-list.txt").text.splitlines()
threads = list()

def thread_f(i, name):
    sleep(randint(1, 3))
    print(f"({i}) Color: {name} RGB: {rgb(name)}")

for i, c in enumerate(colors):
    t = threading.Thread(target=thread_f, args=(i, c))
    threads.append(t)

[t.start() for t in threads]
[t.join() for t in threads]
MichaelDeCortix commented 2 years ago

It works! But I don't have time to test everything yet. If there are any problems, I'll be sure to write here.

Thanks again!