forked from coderwilson/FFX_TAS_Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFX_eggMem.py
More file actions
107 lines (94 loc) · 2.99 KB
/
FFX_eggMem.py
File metadata and controls
107 lines (94 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import FFX_memory
global process
global baseValue
def float_from_integer(integer):
return struct.unpack('!f', struct.pack('!I', integer))[0]
def userControl():
global baseValue
#Auto updating via reference to the baseValue above
global xPtr
global yPtr
xPtr = baseValue + 0x0084DED0
yPtr = baseValue + 0x0084DED8
coord1 = process.get_pointer(xPtr)
x = float_from_integer(process.read(coord1))
coord2 = process.get_pointer(yPtr)
y = float_from_integer(process.read(coord2))
if [x,y] == [0.0,0.0]:
return False
else:
return True
def clickToControl():
waitCounter = 0
print("Awaiting control (clicking)")
while not userControl():
FFXC.set_value('BtnB', 1)
time.sleep(0.04)
FFXC.set_value('BtnB', 0)
time.sleep(0.04)
waitCounter += 1
if waitCounter % 100 == 0:
print("Awaiting control - ", waitCounter / 100)
time.sleep(0.05)
return True
def getCoords():
global process
global baseValue
#Auto updating via reference to the baseValue above
global xPtr
global yPtr
global coordsCounter
coordsCounter += 1
xPtr = baseValue + 0x0084DED0
yPtr = baseValue + 0x0084DED8
#xPtr = 0x012DDED0
#yPtr = 0x012DDED8
coord1 = process.get_pointer(xPtr)
x = float_from_integer(process.read(coord1))
coord2 = process.get_pointer(yPtr)
y = float_from_integer(process.read(coord2))
#if [x,y] != [0.0,0.0]:
#if coordsCounter % 1000 == 99:
#print("Coordinates check: ")
#print(str(x).format(24), " | ",str(y).format(24))
#xPtr = baseValue + 0x0084DED0
return [x,y]
def getCamera():
global baseValue
angle = baseValue + 0x008A86B8
z = baseValue + 0x008A86FC
x = baseValue + 0x008A86F8
y = baseValue + 0x008A8700
key = process.get_pointer(angle)
angleVal = round(float_from_integer(process.read(key)),2)
key = process.get_pointer(x)
xVal = round(float_from_integer(process.read(key)),2)
key = process.get_pointer(y)
yVal = round(float_from_integer(process.read(key)),2)
key = process.get_pointer(z)
zVal = round(float_from_integer(process.read(key)),2)
retVal = [angleVal,xVal,yVal,zVal]
#print("Camera details: ", retVal)
return retVal
def menuOpen():
global baseValue
key = baseValue + 0x00F407E4
menuOpen = process.readBytes(key,1)
if menuOpen == 1:
return True
else:
return False
def closeMenu():
while menuOpen():
FFX_Xbox.menuA()
def openMenu():
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
while not userControl(): #Get out of combat or whatever
FFX_Xbox.menuB()
while userControl() and not menuOpen():
FFXC.set_value('BtnY',1)
time.sleep(0.035)
FFXC.set_value('BtnY',0)
time.sleep(0.035)
time.sleep(0.7)