@@ -70,29 +70,21 @@ func fingerprintAce(loader cartridgeloader.Loader) (bool, bool) {
7070}
7171
7272func (cart * Cartridge ) fingerprintPlusROM (loader cartridgeloader.Loader ) bool {
73- // there is a second fingerprint that occurs in the NewPlusROM() function
74-
75- b := make ([]byte , 3 )
73+ // search for "STA $1ff1"
74+ //
75+ // previous version searched the first 1024 bytes of the ROM only. however,
76+ // this was incorrect in the case of "KoviKovi_R1_NTSC.bin", in which the
77+ // sequence appears after 1024 bytes
78+ //
79+ // also, previous version searched for the STA instruction in any mirror of
80+ // that address (ie. "STA $XFF1"). however, I now believe this is incorrect
81+ // and likely to lead to false positions
82+ //
83+ // false positives will likely be eliminated by the NewPlusROM() function in
84+ // which the URL is checked. if the URL is not valid then the PlusROM will
85+ // be rejected
7686 loader .Seek (0 , io .SeekStart )
77-
78- // fingerprinting beyond the first 1k can easily result in a false positive
79- const fingerprintLimit = 1024
80-
81- for i := 0 ; i < fingerprintLimit - len (b ); i ++ {
82- n , err := loader .Read (b )
83- if n < len (b ) {
84- break
85- }
86- if b [0 ] == 0x8d && b [1 ] == 0xf1 && b [2 ]& 0x10 == 0x10 {
87- return true
88- }
89- if err == io .EOF {
90- break
91- }
92- loader .Seek (int64 (1 - len (b )), io .SeekCurrent )
93- }
94-
95- return false
87+ return loader .Contains ([]byte {0x8d , 0xf1 , 0x1f })
9688}
9789
9890func fingerprint3e (loader cartridgeloader.Loader ) bool {
0 commit comments