passport/src/patchers/polarware.a
2021-06-21 10:33:16 -04:00

51 lines
1.7 KiB
Plaintext

;-------------------------------
; #POLARWARE
; a delayed secondary protection check and anti-tamper check
; seen on Polarware games
; similar to #FBFFENCRYPTED but the encryption key is different
; and the routine ultimately returns regardless of success or failure
; (but the value in the accumulator is different and is used later
; to trigger hilarious in-game failure)
;
; tested on
; The Spy's Adventures in North America
; The Spy's Adventures in Europe
; The Crimson Crown
; Oo-Topos
;
;-------------------------------
!zone {
; gIsProDOS is TRUE here
ldy #$06
jsr SearchTrack ; (all bytes are XOR #$EF)
!byte $29,$6D ; DEC $82
!byte $3F,$EB ; BNE +4
!byte $29,$60 ; DEC $8F
bcs .tamper
inx ; passport-test-suite/The Crimson Crown.woz [C=0] reaches here
inx
inx
jsr PrintByID
!byte s_fbff
jsr modify1
!byte $B2 ; change encrypted BNE +4 to +5D so code exits with Death Counter > 0
lda #TRUE
sta gPolarwareTamperCheck
.tamper lda gPolarwareTamperCheck
bne .exit
ldy #$0C
jsr SearchTrack
!byte $01,$02,$03,$03,$03,$03;prologue marker (not code)
!byte $EC,WILDCARD,WILDCARD ; CPX absolute
!byte $F0,$09 ; BEQ +9
!byte $AE ; LDX
bcs .exit ; passport-test-suite/The Crimson Crown.woz [C=0] matches
jsr inx9
jsr PrintByID
!byte s_tamper
jsr modify1
!byte $50 ; change BEQ to BVC which acts as a branch-always
.exit
}