xy = array(values, dtype=dtype) key_frames = [] prev_key_value = 0 for frame in frames: key_value = frame[3] if not key_value == prev_key_value: prev_key_value = key_value new_data = array([(frame[0], frame[1], frame[2])], dtype=dtype) xy = append(xy, new_data, 0) key_array = parse_keys(key_value, keys) key_frames.append([frame[0], key_array]) xy = sort(xy, order='time') return xy, key_frames if __name__ == '__main__': # Test select from multiple from replay_parser import ReplayParser import os import psutil import cProfile replay = ReplayParser("Cynesta_-_S3RL_feat_Mixie_Moon_-_FriendZoned_Slayeds_Insane_2020-04-21_Osu.osr") frames, times = replay.get_frames() replay.dump_frames("whitecat_frames.txt") #xy_pos, key_frames = preprocess_frames(frames, {'left': 'F', 'right': 'G', 'smoke': 'D'})
elif len(handle_info['matches']) > 1: window_title, hwnd = select_from_multiple(handle_info['matches']) else: window_title, hwnd = handle_info['matches'][0] PROCESS_VM_READ = 0x0010 PID = win32process.GetWindowThreadProcessId(hwnd)[1] # Get process PID process = win32api.OpenProcess(PROCESS_VM_READ, False, PID) # Open Process in READ mode time_ptr = getTimePointer( process.handle) # Get pointer address to game time game_time = readTime(time_ptr, process.handle) # Read game time with given address replay = ReplayParser(sys.argv[1]) # Parse replay file frames, times = replay.get_frames() # Get replay frames mouse_frames, key_frames = preprocess_frames(frames, keyDict) speed_modifier = 1.5 if replay.mods & 64 == 64 else 1 # If it's dt, we need to wait less for game time to catch up k1_message_queue = Queue() mouse_message_queue = Queue() key_listener_queue = Queue() k1p = Process(target=keyProcessor, args=(k1_message_queue, )) klp = Process(target=keyListenerProcess, args=(keyQuickRetry, 'Q', key_listener_queue)) mousep = Process(target=mouseProcessor, args=(mouse_message_queue, )) k1p.start()