import sys
import time
sys.path.append('.')
from src.assistant_tool.core_shm_bridge import CoreShmBridge

def main():
    bridge = CoreShmBridge()
    if not bridge.connect():
        print("Loi: Khong the ket noi voi C++ Core. Dam bao ban da chay run_full_system.bat")
        sys.exit(1)
        
    print("Da ket noi voi C++ Core (Shared Memory).")
    print("Gui lenh EXECUTE_MAP_DEVICE_ROUTINE (doc bang RAM, do chinh xac tuyet doi)...")
    
    # Gui lenh mo Map Device voi Waystone o cot 0, hang 0
    success = bridge.send_map_device(waystone_col=0, waystone_row=0, use_tablet=False, timeout_ms=30000)
    
    if success:
        print("Da gui lenh thanh cong! Vui long theo doi nhan vat trong game.")
    else:
        print("Loi: Khong the gui lenh toi C++ Core.")

if __name__ == '__main__':
    main()
