diff --git a/config.json b/config.json index 61f16ae..5e2394d 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "SysDVR": true, "image": "./munchlax/eye.png", - "view": [470, 430, 50, 60] + "view": [470, 430, 50, 60], + "reidentify": "" } \ No newline at end of file diff --git a/config_cave.json b/config_cave.json index 76f5772..bcc406f 100644 --- a/config_cave.json +++ b/config_cave.json @@ -1,5 +1,6 @@ { "SysDVR": true, "image": "./trainer/cave/eye.png", - "view": [620, 340, 20, 20] + "view": [620, 340, 20, 20], + "reidentify": "0x37a35d28 0x488e6831 0xb7f56519 0x79a3b387" } \ No newline at end of file diff --git a/config_munchlax.json b/config_munchlax.json index 61f16ae..5e2394d 100644 --- a/config_munchlax.json +++ b/config_munchlax.json @@ -1,5 +1,6 @@ { "SysDVR": true, "image": "./munchlax/eye.png", - "view": [470, 430, 50, 60] + "view": [470, 430, 50, 60], + "reidentify": "" } \ No newline at end of file diff --git a/src/rngtool.py b/src/rngtool.py index 9e0a417..8c7d051 100644 --- a/src/rngtool.py +++ b/src/rngtool.py @@ -89,7 +89,6 @@ def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40, sysdvr max_loc = (max_loc[0] + roi_x,max_loc[1] + roi_y) bottom_right = (max_loc[0] + w, max_loc[1] + h) cv2.rectangle(frame,max_loc, bottom_right, 255, 2) - cv2.imshow("view", frame) keypress = cv2.waitKey(1) if keypress == ord('q'): diff --git a/src/wild.py b/src/wild.py index 8678b0a..6cbcaa9 100644 --- a/src/wild.py +++ b/src/wild.py @@ -20,9 +20,10 @@ def expr(): state = prng.getState() print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3])) + print("state(32bit 32bit 32bit 32bit)") + print(*[hex(s) for s in state]) advances = 0 - for _ in range(1000): advances += 1 r = prng.next() @@ -33,34 +34,16 @@ def expr(): next_time = waituntil - time.perf_counter() or 0 time.sleep(next_time) -def firstspecify(): - player_eye = cv2.imread("./trainer/ruins/eye.png", cv2.IMREAD_GRAYSCALE) - if player_eye is None: - print("path is wrong") - return - blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, 910, 485, 50, 60) - prng = rngtool.recov(blinks, intervals) - - waituntil = time.perf_counter() - diff = round(waituntil-offset_time) - prng.getNextRandSequence(diff) - - state = prng.getState() - print("state(64bit 64bit)") - print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3])) - print("state(32bit 32bit 32bit 32bit)") - print(*[hex(s) for s in state]) - def reidentify(): - print("input xorshift state(state[0] state[1] state[2] state[3])") - state = [int(x,0) for x in input().split()] + state = [int(x,0) for x in config["reidentify"].split()] + print("base state:", [hex(x) for x in state]) - player_eye = cv2.imread("./trainer/ruins/eye.png", cv2.IMREAD_GRAYSCALE) + player_eye = cv2.imread(config["image"], cv2.IMREAD_GRAYSCALE) if player_eye is None: print("path is wrong") return - observed_blinks, _, offset_time = rngtool.tracking_blink(player_eye, 910, 485, 50, 60,size=20) + observed_blinks, _, offset_time = rngtool.tracking_blink(player_eye, *config["view"], sysdvr=config["SysDVR"], size=20) reidentified_rng = rngtool.reidentifyByBlinks(Xorshift(*state), observed_blinks) waituntil = time.perf_counter() @@ -73,18 +56,11 @@ def reidentify(): print("state(32bit 32bit 32bit 32bit)") print(*[hex(s) for s in state]) - #timecounter reset - advances = 0 - wild_prng = Xorshift(*reidentified_rng.getState()) - isUnown = True - wild_prng.getNextRandSequence(2+isUnown) - advances = 0 while True: advances += 1 r = reidentified_rng.next() - wild_r = wild_prng.next() waituntil += 1.018 @@ -94,4 +70,9 @@ def reidentify(): time.sleep(next_time) if __name__ == "__main__": - expr() \ No newline at end of file + # inp = input("Find State or Reidentify? (S/R): ") + inp = "R" + if inp == "R": + reidentify() + else: + expr() \ No newline at end of file diff --git a/src/wild_manual.py b/src/wild_manual.py index c393aab..4a5e13f 100644 --- a/src/wild_manual.py +++ b/src/wild_manual.py @@ -1,11 +1,7 @@ import rngtool -import cv2 import time -import json from xorshift import Xorshift -config = json.load(open("config.json")) - def reidentify(): t0 = int(input("input state[0] (state 0/1): 0x"),16) t1 = int(input("input state[1] (state 0/1): 0x"),16)