Skip to content

Commit

Permalink
add input sync ffw codes
Browse files Browse the repository at this point in the history
  • Loading branch information
JLaferri committed Sep 6, 2024
1 parent 396bc5f commit b765c00
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
21 changes: 21 additions & 0 deletions AI/LoopMainEngine/IncrementPadIndex.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
################################################################################
# Address: 80377544
################################################################################

# Credit to tauKhan

# If we are iterating without anything in the input buffer, move the pad input
# along so that we correctly restore the x analog value used by UCF to the
# correct place. Previously, there was a possibility for desyncs when doing a
# UCF dashback while in FFW.
#
# I believe the only time this would *not* skip is when we force a FFW.
# Skip if the input buffer is larger than zero (unused inputs are present).

bne+ SKIP

# Add "fake" input to the queue
li r0, 1
stb r0, 0x3(r30)

SKIP:
11 changes: 11 additions & 0 deletions AI/LoopMainEngine/PadAlwaysUseMasterIndex.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
################################################################################
# Address: 80376a88
################################################################################

# Credit to tauKhan
# From tauKhan:
# make it so that the renewStatus loads masterIndex instead of its own index
# for the block where it inserts inputs
# thus it'll always put inputs to the slot the next RenewMasterStatus uses
# and will never overwrite older data
lbz r0, 0x1(r31)
8 changes: 8 additions & 0 deletions AI/OverwriteInputs/OverwriteInputs.asm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ stw r3, 0(r8)
lwz r3, RXPB_PAD_DATA+4(r9)
stw r3, 4(r8)

lbz r3, 0xA(r8) # Load status byte for pad
extsb r3, r3
cmpwi r3, 0
beq LOOP_CONTINUE

lwz r5, frameIndex(r13)
logf LOG_LEVEL_NOTICE, "[Frame %d] Non 0 controller status byte: %d", "mr r6, 3"

LOOP_CONTINUE:
addi r10, r10, 1
cmpwi r10, 4
Expand Down
39 changes: 35 additions & 4 deletions Output/AIInputs/output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$Optional: Allow Bot Input Overrides [Fizzi]
*Allows bots to override inputs
C2377598 0000001F #AI/OverwriteInputs/OverwriteInputs.asm
C2377598 0000003A #AI/OverwriteInputs/OverwriteInputs.asm
48000010 4E800021
80000000 FFFFFFFF
C3A2EBD0 7C0802A6
Expand All @@ -24,11 +24,38 @@ A09E0004 7C032000
4E800421 39400000
1D2A0009 7D3F4A14
88690000 2C030000
4182001C 1D0A000C
418200F4 1D0A000C
7D194214 80690001
90680000 80690005
90680004 394A0001
2C0A0004 4180FFCC
90680004 8868000A
7C630774 2C030000
418200CC 80ADB654
48000034 4E800021
5B467261 6D652025
645D204E 6F6E2030
20636F6E 74726F6C
6C657220 73746174
75732062 7974653A
20256400 7C0802A6
90010004 9421FF00
BC610008 7C661B78
60000000 60000000
60000000 60000000
60000000 806DAFC4
38630003 4BFFFFA1
7C8802A6 4CC63242
3D808032 618C3CF4
7D8903A6 4E800421
806DAFC4 388000D0
98830000 38800000
98830001 38800001
98830002 38800080
38A00001 3D808000
618C55F0 7D8903A6
4E800421 B8610008
80010104 38210100
7C0803A6 394A0001
2C0A0004 4180FEF4
BA8100B0 800100E4
382100E0 7C0803A6
60000000 00000000
Expand Down Expand Up @@ -58,6 +85,10 @@ C21A4DA8 00000006 #AI/LoopMainEngine/ForceStartLoop.asm
3B600001 3D80801A
618C4DE4 7D8903A6
4E800420 00000000
C2377544 00000002 #AI/LoopMainEngine/IncrementPadIndex.asm
40A2000C 38000001
981E0003 00000000
04376A88 881F0001 #AI/LoopMainEngine/PadAlwaysUseMasterIndex.asm
C201960C 00000008 #AI/LoopMainEngine/PreventControllerReads.asm
3C608048 80639D30
5463443E 2C030202
Expand Down

0 comments on commit b765c00

Please sign in to comment.