D-Bug & Automation Forum | |
D-Bug & Automation Forum >> Coding >> STE/Falcon/Jaguar: How to detect teamtap reliably!
http://d-bug.mooo.com/dbugforums/cgi-bin/yabb2/YaBB.pl?num=1279994628 Message started by ggn on 24.07.10 at 18:03:47 |
Title: STE/Falcon/Jaguar: How to detect teamtap reliably! Post by ggn on 24.07.10 at 18:03:47
Recently I've been messing around with Jagpad input and while I sorted it out easily, I wanted to add support for the teamtap as well. Not wanting to reinvent the wheel, I asked around for some advice on the matter. Zerosquare of CVSD pointed me to two solutions for this.
One was to use heuristics (i.e. make the user press a jagpad button and see if the button press is shadowed on other pads on the same port - if yes, the user most certainly doesn't have one installed), and the other was in fact a method by Matthias Domin, which reads a seemingly unused bit on the jagpad matrix on jagpad #4. Matthias claimed that if this bit (C1 on the jaguar docs) is inactive (at least on Falcon, jagpad bits are all set to 1 when the user doesn't press any button on the pad), then there's a teamtap installed. That was just what I needed! So I quickly wrote a test program in GFA Basic and sent it to SH3 (I forgot to mention that I don't own a jagpad ;)). And that didn't work 100%. It turns out that this bit can change if there's no teamtap installed and the user presses the pause button. Fortunately we noticed that only bit C1 changes when you insert the teamtap in the port. So Matthias' claim was partly correct. The check that works 100% is:
(note: "unset" means that the bit is in it's natural state and "set" means it's changed. As I mentioned, on the Falcon it's 1 for unset and 0 for set :)) (note #2: there's a 4th combination of bits, but I don't think it's possible to achieve this with a normal teamtap, so it's left out) I hope I didn't screw anything up - after all, I tested at blind (sh3 was my eyes :)). If you find any inaccuracies, please mention them to me so I'll fix the text :) Addendum: The shitty GFA program I used to test all of the above. It's not anything brainblasting, but at least it works (it's for port #1 btw) and it displays all ports' pad bits in the same screen. [code]DO PRINT AT(0,1) PRINT "teamtap port a" SDPOKE &HFFFF9202,&HFFFE PRINT BIN$(DPEEK(&HFFFF9200),16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFFD PRINT BIN$(DPEEK(&HFFFF9200),16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFFB PRINT BIN$(DPEEK(&HFFFF9200),16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFF7 PRINT BIN$(DPEEK(&HFFFF9200),16)'BIN$(DPEEK(&HFFFF9202),16) ' PRINT "teamtap port b" SDPOKE &HFFFF9202,&HFFF0 PRINT BIN$(DPEEK(&HFFFF9200),16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFF1 PRINT BIN$(x1%,16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFF2 PRINT BIN$(x2%,16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFF3 PRINT BIN$(x3%,16)'BIN$(DPEEK(&HFFFF9202),16) ' PRINT "teamtap port c" SDPOKE &HFFFF9202,&HFFF4 PRINT BIN$(DPEEK(&HFFFF9200),16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFF5 PRINT BIN$(x1%,16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFF6 PRINT BIN$(x2%,16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFF8 PRINT BIN$(x3%,16)'BIN$(DPEEK(&HFFFF9202),16) ' PRINT "teamtap port d" SDPOKE &HFFFF9202,&HFFF9 PRINT BIN$(DPEEK(&HFFFF9200),16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFFA x1%=DPEEK(&HFFFF9200) PRINT BIN$(x1%,16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFFC x2%=DPEEK(&HFFFF9200) PRINT BIN$(x2%,16)'BIN$(DPEEK(&HFFFF9202),16) SDPOKE &HFFFF9202,&HFFFF x3%=DPEEK(&HFFFF9200) PRINT BIN$(x3%,16)'BIN$(DPEEK(&HFFFF9202),16) ' PRINT "C1=";BTST(x1%,0);", C2=";BTST(x2%,0);", C3=";BTST(x3%,0) PRINT "So..."' IF BTST(x1%,0)=1 AND BTST(x2%,0)=0 PRINT "you have a teamtap installed!" ELSE PRINT "you DO NOT have a teamtap installed!" ENDIF LOOP UNTIL INKEY$<>"" [/code] |
Title: Re: STE/Falcon/Jaguar: How to detect teamtap reliably! Post by sh3-rg on 27.07.10 at 06:54:09
So how does GodLib test for team taps? Does it use the force?
|
Title: Re: STE/Falcon/Jaguar: How to detect teamtap reliably! Post by ggn on 27.07.10 at 06:56:48 sh3-rg wrote on 27.07.10 at 06:54:09:
I found no specialised code that detects the teamtaps. My guess is that they have to be enabled from somewhere in the options menu. |
D-Bug & Automation Forum » Powered by YaBB 2.6.0! YaBB Forum Software © 2000-2024. All Rights Reserved. |