Skip to content

Commit e8ca0db

Browse files
authored
Add files via upload
1 parent a32ac3d commit e8ca0db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4958
-10296
lines changed

FFX_Auto_Main.py

Lines changed: 97 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,59 @@
11
# Libraries and Core Files
22
import time
33
import FFX_Logs
4-
#import FFX_core
4+
import FFX_core
55
import FFX_Screen
66
import FFX_Battle
7+
import FFX_memory
8+
9+
#Plug in controller
710
import FFX_Xbox
8-
FFXC = FFX_Xbox.FFXC
11+
FFXC = FFX_Xbox.controllerHandle()
12+
13+
#Speed run sectional files
14+
import FFX_DreamZan
15+
import FFX_Baaj
16+
import FFX_Besaid1
17+
#import FFX_Besaid2
18+
import FFX_Boats
19+
import FFX_Kilika
20+
import FFX_Luca
21+
import FFX_Blitz
22+
import FFX_Miihen
23+
import FFX_MRR
24+
import FFX_Djose
25+
import FFX_Moonflow
26+
import FFX_Guadosalam
27+
import FFX_ThunderPlains
28+
import FFX_mWoods
29+
import FFX_mTemple
30+
import FFX_home
31+
import FFX_rescueYuna
32+
import FFX_Gagazet
33+
import FFX_Zanarkand
34+
import FFX_Sin
935

1036
#Gamestate, "none" for new game, or set to a specific section to start from the first save.
1137
#See the if statement tree below to determine starting position for Gamestate.
1238
#These are the popular ones. New Game ('none') is the last one.
39+
#Gamestate = "Baaj"
40+
#StepCounter = 1
1341
#Gamestate = "Besaid"
1442
#StepCounter = 3
1543
#Gamestate = "Kilika"
1644
#StepCounter = 1
1745
#Gamestate = "Luca"
1846
#StepCounter = 1
19-
#Gamestate = "Luca"
47+
#StepCounter = 3
2048
#StepCounter = 5
49+
#Gamestate = "Miihen"
50+
#StepCounter = 1
2151
#Gamestate = "MRR"
2252
#StepCounter = 1
2353
#Gamestate = "Djose"
2454
#StepCounter = 1
55+
#Gamestate = "Moonflow"
56+
#StepCounter = 2
2557
#Gamestate = "Guadosalam"
2658
#StepCounter = 2
2759
#Gamestate = "Macalania"
@@ -30,9 +62,15 @@
3062
#Gamestate = "Home"
3163
#StepCounter = 1
3264
#Gamestate = "rescueYuna"
65+
#StepCounter = 1
3366
#StepCounter = 2
3467
#Gamestate = "Gagazet"
3568
#StepCounter = 1
69+
#Gamestate = "Zanarkand"
70+
#StepCounter = 4
71+
#Gamestate = "Sin"
72+
#StepCounter = 2
73+
#StepCounter = 4
3674
Gamestate = "none"
3775
StepCounter = 1
3876

@@ -44,9 +82,10 @@
4482

4583
####################################################################################################
4684
#RNG - Using Rossy's FFX.exe fix, this allows us to choose the RNG seed we want. From 0-255
47-
#rngSeedNum = 31 #Favorite one so far
48-
#rngSeedNum = 45 #Another good possibility
49-
rngSeedNum = 46
85+
#rngSeedNum = 31 #Potential
86+
#rngSeedNum = 45 #Potential
87+
#rngSeedNum = 49 #Favorite one so far, but problem on Chocobo Eater
88+
rngSeedNum = 56
5089
rngReviewOnly = True
5190
print("Game type will be: ", gameLength)
5291
####################################################################################################
@@ -57,6 +96,7 @@
5796
strengthCount = 0
5897
endGameVersion = 0
5998
gems = 0 #Set to 2 if loading in after Evrae Altana with two gems
99+
earlyHaste = 0
60100
earlyTidusGrid = False
61101
if forceBlitzWin == True:
62102
blitzWin = True
@@ -92,7 +132,7 @@ def reportGamestate():
92132
FFX_Screen.clearMouse(0)
93133

94134
#Initiate memory reading, after we know the game is open.
95-
import FFX_memory
135+
#import FFX_memory
96136
FFX_memory.start()
97137
FFX_memory.setRngSeed(rngSeedNum) #Using Rossy's FFX.exe fix, this allows us to choose the RNG seed we want. From 0-255
98138
rngSeed = FFX_memory.rngSeed()
@@ -110,7 +150,8 @@ def reportGamestate():
110150
import FFX_LoadGame
111151

112152
if Gamestate == "Baaj" and StepCounter == 1:
113-
FFX_LoadGame.LoadBaaj()
153+
FFX_LoadGame.loadOffset(21)
154+
#FFX_LoadGame.LoadBaaj()
114155
if Gamestate == "Baaj" and StepCounter == 5:
115156
FFX_LoadGame.LoadFirst()
116157
if Gamestate == "Besaid" and StepCounter == 1 : #Save pop-up after falling off of Rikku's boat
@@ -120,37 +161,31 @@ def reportGamestate():
120161
if Gamestate == "Besaid" and StepCounter == 3 : #Crusader's lodge after "Enough, Wakka!"
121162
FFX_LoadGame.loadOffset(29)
122163
while FFX_memory.userControl():
123-
FFXC.set_value('AxisLy', 1)
124164
if FFX_memory.getCoords()[0] > 0.5:
125-
FFXC.set_value('AxisLx', 1)
165+
FFXC.set_movement(1, 1)
126166
else:
127-
FFXC.set_value('AxisLx', 0)
167+
FFXC.set_movement(0, 1)
128168
if Gamestate == "Boat1" : #Besaid beach before boarding SS Liki ( nice alliteration :D )
129169
FFX_LoadGame.loadOffset(41)
130170
FFX_LoadGame.Boat1()
131171
if Gamestate == "Kilika" and StepCounter == 1: #Just after entering the woods
132172
FFX_LoadGame.loadOffset(32)
133-
FFXC.set_value('AxisLy', 1)
134-
time.sleep(5)
135-
FFXC.set_value('AxisLx', -1)
136-
FFXC.set_value('AxisLy', 0)
173+
FFXC.set_movement(0, 1)
137174
time.sleep(5)
138-
FFXC.set_value('AxisLx', 0)
139-
FFXC.set_value('AxisLy', 0)
140-
if Gamestate == "Kilika" and StepCounter == 3: #Temple save sphere before scene with Donna
141-
FFX_LoadGame.KilikaTrials()
175+
FFXC.set_neutral()
142176
if Gamestate == "Luca" and StepCounter == 1: # Approaching Luca via boat
143177
FFX_LoadGame.loadOffset(46)
144178
if Gamestate == "Luca" and StepCounter == 3: # after Oblitzerator, before Blitzball
145-
FFX_LoadGame.loadOffset(9)
179+
FFX_LoadGame.loadOffset(25)
180+
earlyHaste = 3
146181
if Gamestate == "Luca" and StepCounter == 5: # After Blitzball, before battles.
147182
FFX_LoadGame.loadOffsetBattle(8)
148-
earlyHaste = 1
183+
earlyHaste = 3
149184
#if Gamestate == "Luca" and StepCounter == 6: #After the talk with Auron
150185
# FFX_LoadGame.loadPostBlitz()
151186
if Gamestate == "Miihen" and StepCounter == 1: #After the talk with Auron
152-
FFX_LoadGame.loadOffset(20)
153-
FFX_LoadGame.LoadMiihenStart()
187+
FFX_LoadGame.loadOffset(33)
188+
FFX_LoadGame.LoadMiihenStart_Laugh()
154189
if Gamestate == "MRR" and StepCounter == 1: #Mi'ihen North after meeting Seymour
155190
FFX_LoadGame.loadOffset(18)
156191
FFX_LoadGame.LoadMRR()
@@ -162,6 +197,7 @@ def reportGamestate():
162197
if Gamestate == "Djose" and StepCounter == 2: #Just before the Djose temple
163198
FFX_LoadGame.djoseTemple()
164199
if Gamestate == "Moonflow" and StepCounter == 2: #North bank, before Rikku
200+
FFX_LoadGame.loadOffset(19)
165201
FFX_LoadGame.moonflow2()
166202
if Gamestate == "Guadosalam" and StepCounter == 2: #After the Farplane
167203
FFX_LoadGame.loadOffset(3)
@@ -181,9 +217,9 @@ def reportGamestate():
181217
if Gamestate == "Macalania" and StepCounter == 6: #Outside temple, before escaping.
182218
FFX_LoadGame.loadOffset(15)
183219
time.sleep(0.5)
184-
FFXC.set_value('AxisLy', 1)
220+
FFXC.set_movement(0, 1)
185221
time.sleep(1.5)
186-
FFXC.set_value('AxisLy', 0)
222+
FFXC.set_neutral()
187223
time.sleep(0.5)
188224
if Gamestate == "Macalania" and StepCounter == 7: #Before Wendigo
189225
FFX_LoadGame.loadWendigo()
@@ -192,6 +228,7 @@ def reportGamestate():
192228
if Gamestate == "Home" and StepCounter == 2:
193229
FFX_LoadGame.loadOffset(4)
194230
if Gamestate == "rescueYuna" and StepCounter == 1: # Airship, before pathing to the deck
231+
FFX_LoadGame.loadOffset(30)
195232
FFX_LoadGame.loadRescue()
196233
if Gamestate == "rescueYuna" and StepCounter == 2: # Bevelle trials
197234
FFX_LoadGame.loadOffset(42)
@@ -214,36 +251,15 @@ def reportGamestate():
214251
FFX_LoadGame.loadOffset(35)
215252
FFX_LoadGame.zanTrials()
216253
if Gamestate == "Zanarkand" and StepCounter == 4: # After Sanctuary Keeper
217-
FFX_LoadGame.loadOffset(1)
254+
FFX_LoadGame.loadOffset(9)
218255
if Gamestate == "Sin" and StepCounter == 2: #Save sphere on the Highbridge before talking to Shedinja
219-
FFX_LoadGame.loadOffset(22)
220-
if Gamestate == "Sin" and StepCounter == 3: #Before "inside sin" pathing
256+
FFX_LoadGame.loadOffset(27)
257+
if Gamestate == "Sin" and StepCounter == 4: #Before point of no return
221258
FFX_LoadGame.loadOffset(2)
222-
259+
FFX_LoadGame.loadEggHunt()
223260

224-
#Movement files
225-
import FFX_DreamZan
226-
if gameLength != "short":
227-
import FFX_Baaj
228-
import FFX_Besaid1
229-
import FFX_Besaid2
230-
import FFX_Boats
231-
import FFX_Kilika
232-
import FFX_Luca
233-
import FFX_Blitz
234-
import FFX_Miihen
235-
import FFX_MRR
236-
import FFX_Djose
237-
import FFX_Moonflow
238-
import FFX_Guadosalam
239-
import FFX_ThunderPlains
240-
import FFX_mWoods
241-
import FFX_mTemple
242-
import FFX_home
243-
import FFX_rescueYuna
244-
import FFX_Gagazet
245-
import FFX_Zanarkand
246-
import FFX_Sin
261+
262+
#Movement files - moved to FFX_compileAll.py
247263

248264
#try:
249265
rikkucharged = 0
@@ -255,6 +271,7 @@ def reportGamestate():
255271
Gamestate = "DreamZan"
256272
time.sleep(0.5)
257273
FFX_DreamZan.NewGame(gameLength)
274+
FFX_DreamZan.NewGame2()
258275
startTime = FFX_Logs.timeStamp()
259276
FFX_Logs.writeStats("Start time:")
260277
FFX_Logs.writeStats(str(startTime))
@@ -409,32 +426,31 @@ def reportGamestate():
409426
if Gamestate == "Luca" and StepCounter == 2:
410427
reportGamestate()
411428
FFX_Luca.preBlitz()
429+
endTime = FFX_Logs.timeStamp()
430+
totalTime = endTime - startTime
431+
print("Pre-Blitz time: ", str(totalTime))
432+
FFX_Logs.writeStats("Pre Blitz time:")
433+
FFX_Logs.writeStats(totalTime)
412434
if rngReviewOnly == True and earlyHaste == -1: # Used to run multiple tests via a single execution
413435
Gamestate = "none"
414436
StepCounter = 1
415-
FFXC.set_value('AxisLy', -1) #Step away from the save sphere
416-
FFXC.set_value('AxisLx', 0)
437+
FFXC.set_movement(0, -1) #Step away from the save sphere
417438
time.sleep(2)
418-
FFXC.set_value('AxisLy', 0)
419-
FFXC.set_value('AxisLx', 0)
439+
FFXC.set_neutral()
420440
import FFX_Reset
421441
print("------------------------------------------")
422442
print("------------------------------------------")
423443
print("Resetting")
424444
print("------------------------------------------")
425445
print("------------------------------------------")
426-
FFXC.set_value('AxisLx', 0)
427-
FFXC.set_value('AxisLy', 0)
428446
FFX_memory.clickToControl()
429-
endTime = FFX_Logs.timeStamp()
430-
431-
totalTime = endTime - startTime
432-
print("The game duration (real time) was: ", str(totalTime))
447+
448+
433449
#FFX_Logs.writeStats("Test duration:")
434450
#FFX_Logs.writeStats(totalTime)
435451
time.sleep(2)
436452

437-
FFX_Reset.resetToMainMenu(FFX_memory.getMap())
453+
FFX_Reset.resetToMainMenu()
438454
StepCounter = 1
439455
rngSeedNum += 1
440456
FFX_Logs.nextStats(rngSeedNum) #Start next stats file
@@ -454,7 +470,7 @@ def reportGamestate():
454470
if Gamestate == "Luca" and StepCounter == 4:
455471
reportGamestate()
456472
blitzWin = FFX_Blitz.blitzMain(forceBlitzWin)
457-
FFX_Screen.awaitSave()
473+
FFX_Xbox.awaitSave()
458474
StepCounter = 5
459475

460476

@@ -476,7 +492,14 @@ def reportGamestate():
476492

477493
if Gamestate == "Miihen" and StepCounter == 2:
478494
reportGamestate()
479-
#FFX_Miihen.wrapUp()
495+
496+
#Report duration at the end of Mi'ihen section for all runs.
497+
endTime = FFX_Logs.timeStamp()
498+
totalTime = endTime - startTime
499+
print("Mi'ihen End timer is: ", str(totalTime))
500+
FFX_Logs.writeStats("Miihen End time:")
501+
FFX_Logs.writeStats(totalTime)
502+
480503
if rngReviewOnly == True and rngSeedNum - rngSeedOrig < 5: # Used to run multiple tests via a single execution
481504
Gamestate = "none"
482505
StepCounter = 1
@@ -486,18 +509,12 @@ def reportGamestate():
486509
print("Resetting")
487510
print("------------------------------------------")
488511
print("------------------------------------------")
489-
FFXC.set_value('AxisLx', 0)
490-
FFXC.set_value('AxisLy', 0)
512+
FFXC.set_neutral()
491513
FFX_memory.clickToControl()
492-
endTime = FFX_Logs.timeStamp()
493514

494-
totalTime = endTime - startTime
495-
print("The game duration (real time) was: ", str(totalTime))
496-
FFX_Logs.writeStats("Test duration:")
497-
FFX_Logs.writeStats(totalTime)
498515
time.sleep(2)
499516

500-
FFX_Reset.resetToMainMenu(FFX_memory.getMap())
517+
FFX_Reset.resetToMainMenu()
501518
StepCounter = 1
502519
rngSeedNum += 1 #Start next stats file
503520
FFX_Logs.nextStats(rngSeedNum)
@@ -513,7 +530,7 @@ def reportGamestate():
513530
if Gamestate == "MRR" and StepCounter == 1:
514531
reportGamestate()
515532
wakkaLateMenu = FFX_MRR.arrival()
516-
FFX_MRR.mainPath(wakkaLateMenu)
533+
FFX_MRR.mainPath(wakkaLateMenu[0])
517534
if FFX_memory.gameOver():
518535
Gamestate = "gameOverError"
519536
StepCounter = 2
@@ -684,7 +701,7 @@ def reportGamestate():
684701

685702
#In case we're loading mid game...
686703
if endGameVersion == 0:
687-
endGameVersion = 4
704+
endGameVersion = 1
688705
# 1 = two Return spheres, two Friend spheres
689706
# 2 = two Return spheres, two Friend spheres
690707
# 3 = Game over (four Friend spheres)
@@ -748,9 +765,12 @@ def reportGamestate():
748765

749766
if Gamestate == "Sin" and StepCounter == 3:
750767
reportGamestate()
751-
FFX_Sin.insideSin(gameLength, autoEggHunt, rngSeedNum)
752-
FFX_Battle.BFA()
768+
FFX_Sin.insideSin()
753769
StepCounter = 4
770+
771+
if Gamestate == "Sin" and StepCounter == 4:
772+
FFX_Sin.eggHunt(autoEggHunt)
773+
FFX_Battle.BFA()
754774
Gamestate = "End"
755775

756776
#print("Waiting for Yu Yevon to die.")

0 commit comments

Comments
 (0)