bfirsh / jsnes

A JavaScript NES emulator.
https://jsnes.org
Apache License 2.0
6.12k stars 828 forks source link

Additional Joystick buttons AA & BB #30

Open alexashx opened 11 years ago

alexashx commented 11 years ago

On standard joystick has two buttons A and two buttons B. A lot of games controlled by including two keys AA and BB, access to which is not in the current edition.

lazyxu commented 7 years ago

I implemented this function by setInterval and clearInterval and I wonder if there is an built-in solution @bfirsh

if (value==0x41) {
    if (this.interval[i].X) {
        clearInterval(this.interval[i].X);
    }
    this.interval[i].X = setInterval( () => {
        this.state[i][this.keys.A] = 0x81 - this.state[i][this.keys.A];
    }, 50);
}
else if (value==0x40) {
    clearInterval(this.interval[i].X);
    this.state[i][this.keys.A] = 0x40;
}
stoneWeb commented 6 years ago

@bfirsh I have the same problem. @MeteorKL Does this way work?

lazyxu commented 6 years ago

@stoneWeb yeh, it works.