import mmap
import struct
import time

SHM_NAME = "Local\\POE2_Auto_SharedMem_v1"
SHM_SIZE = 4 * 1024 * 1024

try:
    shm = mmap.mmap(-1, SHM_SIZE, tagname=SHM_NAME)
    # is_running offset 12..16
    shm[12:16] = struct.pack("<I", 0)
    print("Da gui tin hieu RequestStop (is_running = 0) toi AutoPOE2_Core thanh cong!")
    shm.close()
except Exception as e:
    print(f"Loi khi gui RequestStop: {e}")
