This commit is contained in:
spannerisms
2021-06-20 10:09:04 -04:00
parent d0fbd11d0f
commit 49afe7ca9b
5 changed files with 109 additions and 13 deletions

View File

@@ -91,6 +91,9 @@ db #$20, #$19, #$08, #$31 ; year/month/day
;!REG_MUSIC_CONTROL = $012C ;!REG_MUSIC_CONTROL = $012C
!REG_MUSIC_CONTROL_REQUEST = $012C !REG_MUSIC_CONTROL_REQUEST = $012C
!ONEMIND_ID = $7F5072
!ONEMIND_TIMER = $7F5073
;================================================================================ ;================================================================================
incsrc hooks.asm incsrc hooks.asm
@@ -182,7 +185,7 @@ incsrc endingsequence.asm
incsrc cuccostorm.asm incsrc cuccostorm.asm
incsrc compression.asm incsrc compression.asm
incsrc retro.asm incsrc retro.asm
incsrc dpadinvert.asm incsrc controllerjank.asm
incsrc boots.asm incsrc boots.asm
incsrc events.asm incsrc events.asm
incsrc fileselect.asm incsrc fileselect.asm

View File

@@ -5,9 +5,31 @@
; Filtered Joypad 1 Register: [AXLR | ????] ; Filtered Joypad 1 Register: [AXLR | ????]
; Filtered Joypad 1 Register: [BYST | udlr] [AXLR | ????] ; Filtered Joypad 1 Register: [BYST | udlr] [AXLR | ????]
!INVERT_DPAD = "$7F50CB" !INVERT_DPAD = "$7F50CB"
InvertDPad: InvertDPad:
LDA !INVERT_DPAD : BNE + : JMP .normal : + LDA.l OneMindPlayerCount : BEQ .crowd_control
DEC : BEQ .dpadOnly
LDA.l !ONEMIND_ID
AND.b #$03
TAX
LDA.l .onemind_controller_offset, X
TAX
LDA.w $4218,X : STA.w $00
LDA.w $4219,X : STA.w $01
LDA #$80 : STA $4201 ; reset this so latch can read it, otherwise RNG breaks
JML.l InvertDPadReturn
.crowd_control
LDA !INVERT_DPAD : BNE +
LDA $4218 : STA $00
LDA $4219 : STA $01
JML.l InvertDPadReturn
+ DEC : BEQ .dpadOnly
DEC : BEQ .buttonsOnly DEC : BEQ .buttonsOnly
DEC : BEQ .invertBoth DEC : BEQ .invertBoth
.swapSides .swapSides
@@ -45,8 +67,61 @@ JML.l InvertDPadReturn
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA $01 STA $01
JML.l InvertDPadReturn JML.l InvertDPadReturn
.normal
LDA $4218 : STA $00 .onemind_controller_offset
LDA $4219 : STA $01 db 0 ; player 0 - $4218 - joy1d1
JML.l InvertDPadReturn db 0 ; player 1 - $4218 - joy1d1
;-------------------------------------------------------------------------------- db 2 ; player 2 - $421A - joy2d1
db 6 ; player 3 - $421E - joy2d2
db 2 ; player 4 - $421A - joy2d1
db 6 ; player 5 - $421E - joy2d2
;--------------------------------------------------------------------------------
HandleOneMindController:
LDA.l OneMindPlayerCount
BEQ .no_onemind
REP #$20
LDA.l !ONEMIND_TIMER
DEC
BPL .no_switch
SEP #$20
LDA.l !ONEMIND_ID
INC
CMP.l OneMindPlayerCount
BCC .no_wrap
LDA.b #$01 ; reset to player 1
.no_wrap
STA.l !ONEMIND_ID
REP #$20
LDA.l OneMindTimer
.no_switch
STA.l !ONEMIND_TIMER
SEP #$20
LDA.l !ONEMIND_ID
CMP.b #$04 ; is it player 4 or 5?
BCC .no_multitap_switch
STZ.w $4201
.no_multitap_switch
.no_onemind
STZ.b $12
JML $008034 ; reset frame loop

View File

@@ -14,6 +14,8 @@ dl Init_PostRAMClear
org $008056 ; <- 56 - Bank00.asm : 77 org $008056 ; <- 56 - Bank00.asm : 77
JSL.l FrameHookAction JSL.l FrameHookAction
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $00805D
JML HandleOneMindController
;================================================================================ ;================================================================================
; NMI Hook ; NMI Hook
@@ -48,8 +50,8 @@ ReturnCheckZSNES:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;org $0083D9 ; <- 3D9 - Bank00.asm : 611 (LDA $4219 : STA $01) ;org $0083D9 ; <- 3D9 - Bank00.asm : 611 (LDA $4219 : STA $01)
;JSL.l InvertDPad : NOP ;JSL.l InvertDPad : NOP
org $0083D4 ; <- 3D4 - Bank00.asm : 610 (LDA $4218 : STA $00) org $0083D1 ; <- 3D1 - Bank00.asm (STZ.w JOYPAD - useless instruction here)
JML.l InvertDPad : SKIP 6 JML.l InvertDPad : SKIP 9
InvertDPadReturn: InvertDPadReturn:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -40,8 +40,13 @@ Init_Primary:
INX INX
CPX #$15 : !BLT - CPX #$15 : !BLT -
.done .done
REP #$20
LDA.l OneMindTimer : STA.l !ONEMIND_TIMER
SEP #$20
LDA.b #$01 : STA $420D ; enable fastrom access on upper banks LDA.b #$01 : STA $420D ; enable fastrom access on upper banks
STA.l !ONEMIND_ID
LDA.b #$10 : STA $BC ; set default player sprite bank LDA.b #$10 : STA $BC ; set default player sprite bank

View File

@@ -412,7 +412,16 @@ db #$02 ; #$02 - 2 Bows (default)
ProgressiveBowReplacement: ProgressiveBowReplacement:
db #$47 ; #$47 - 20 Rupees (default) db #$47 ; #$47 - 20 Rupees (default)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; 0x18009A - 0x18009F (unused) ; 0x18009A - 0x18009C one mind
;--------------------------------------------------------------------------------
org $30809A ; PC 0x18009A
OneMindPlayerCount:
db 0
org $30809B ; PC 0x18009B - 0x18009C
OneMindTimer:
dw 0
;--------------------------------------------------------------------------------
; 0x18009D - 0x18009F (unused)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $3080A0 ; PC 0x1800A0 - 0x1800A4 org $3080A0 ; PC 0x1800A0 - 0x1800A4
Bugfix_MirrorlessSQToLW: Bugfix_MirrorlessSQToLW:
@@ -1481,7 +1490,9 @@ dw #9999 ; Rupee Limit
; $7F5050 - $7F506F - Shop Block ; $7F5050 - $7F506F - Shop Block
; $7F5070 - Reserved for OneMind ; $7F5070 - Reserved for OneMind
; $7F5071 - Reserved for OneMind ; $7F5071 - Reserved for OneMind
; $7F5072 - $7F507D - Unused ; $7F5072 - OneMind player ID
; $7F5073 - $7F5074 - OneMind timer
; $7F5075 - $7F507D - Unused
; $7F507E - Clock Status ; $7F507E - Clock Status
; $7F507F - Always Zero ; $7F507F - Always Zero
; $7F5080 - $7F5083 - Clock Hours ; $7F5080 - $7F5083 - Clock Hours