allow menu control with 2nd joystick
This commit is contained in:
parent
c64e63cb51
commit
471a09c568
9 changed files with 96 additions and 124 deletions
|
|
@ -68,9 +68,7 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
static void snd_Reset(void)
|
||||||
|
|
||||||
PROGMEM static void snd_Reset(void)
|
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
chan[0].vol = 0;
|
chan[0].vol = 0;
|
||||||
|
|
@ -90,10 +88,13 @@ PROGMEM static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROGMEM static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +104,6 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -131,57 +131,59 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
this->reset();
|
||||||
this->reset();
|
|
||||||
setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::reset(void)
|
void AudioPlaySystem::reset(void)
|
||||||
{
|
{
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::stop(void)
|
void AudioPlaySystem::stop(void)
|
||||||
{
|
{
|
||||||
//__disable_irq();
|
//__disable_irq();
|
||||||
playing = false;
|
playing = false;
|
||||||
//__enable_irq();
|
//__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM bool AudioPlaySystem::isPlaying(void)
|
bool AudioPlaySystem::isPlaying(void)
|
||||||
{
|
{
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::update(void) {
|
#ifndef HAS_T4_VGA
|
||||||
audio_block_t *block;
|
void AudioPlaySystem::update(void) {
|
||||||
|
audio_block_t *block;
|
||||||
|
|
||||||
// only update if we're playing
|
// only update if we're playing
|
||||||
if (!playing) return;
|
if (!playing) return;
|
||||||
|
|
||||||
// allocate the audio blocks to transmit
|
// allocate the audio blocks to transmit
|
||||||
block = allocate();
|
block = allocate();
|
||||||
if (block == NULL) return;
|
if (block == NULL) return;
|
||||||
|
|
||||||
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
|
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
|
||||||
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
|
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
|
||||||
|
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
if (C < 6) {
|
if (C < 6) {
|
||||||
chan[C].vol = V;
|
chan[C].vol = V;
|
||||||
|
|
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,26 +3,52 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
|
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
|
||||||
void begin(void);
|
void begin(void);
|
||||||
void setSampleParameters(float clockfreq, float samplerate);
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
void reset(void);
|
void reset(void);
|
||||||
void start(void);
|
void start(void);
|
||||||
void stop(void);
|
void stop(void);
|
||||||
bool isPlaying(void);
|
bool isPlaying(void);
|
||||||
void sound(int C, int F, int V);
|
void sound(int C, int F, int V);
|
||||||
void buzz(int size, int val);
|
void buzz(int size, int val);
|
||||||
void step(void);
|
void step(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -389,36 +389,18 @@ int emu_ReadKeys(void)
|
||||||
uint16_t j2 = 0;
|
uint16_t j2 = 0;
|
||||||
|
|
||||||
// Second joystick
|
// Second joystick
|
||||||
#if INVY
|
|
||||||
#ifdef PIN_JOY1_1
|
|
||||||
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_DOWN;
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_2
|
|
||||||
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_UP;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef PIN_JOY1_1
|
#ifdef PIN_JOY1_1
|
||||||
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_UP;
|
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_UP;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_JOY1_2
|
#ifdef PIN_JOY1_2
|
||||||
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_DOWN;
|
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_DOWN;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if INVX
|
|
||||||
#ifdef PIN_JOY1_3
|
|
||||||
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_LEFT;
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_4
|
|
||||||
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef PIN_JOY1_3
|
#ifdef PIN_JOY1_3
|
||||||
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_JOY1_4
|
#ifdef PIN_JOY1_4
|
||||||
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_LEFT;
|
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_LEFT;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_BTN
|
#ifdef PIN_JOY1_BTN
|
||||||
if ( digitalRead(PIN_JOY1_BTN) == LOW ) j2 |= MASK_JOY2_BTN;
|
if ( digitalRead(PIN_JOY1_BTN) == LOW ) j2 |= MASK_JOY2_BTN;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -820,7 +802,7 @@ int handleMenu(uint16_t bClick)
|
||||||
int rx=0,ry=0,rw=0,rh=0;
|
int rx=0,ry=0,rw=0,rh=0;
|
||||||
char c = 0; //captureTouchZone(menutouchareas, menutouchactions, &rx,&ry,&rw,&rh);
|
char c = 0; //captureTouchZone(menutouchareas, menutouchactions, &rx,&ry,&rw,&rh);
|
||||||
|
|
||||||
if ( (bClick & MASK_JOY2_BTN) || (c == MKEY_TFT) ) {
|
if ( (bClick & MASK_JOY2_BTN) || (bClick & MASK_JOY1_BTN) || (c == MKEY_TFT) ) {
|
||||||
emu_printf(newpath);
|
emu_printf(newpath);
|
||||||
#ifdef USE_SDFS
|
#ifdef USE_SDFS
|
||||||
FILINFO entry;
|
FILINFO entry;
|
||||||
|
|
@ -851,7 +833,7 @@ int handleMenu(uint16_t bClick)
|
||||||
//tft.drawRectNoDma( rx,ry,rw,rh, KEYBOARD_HIT_COLOR );
|
//tft.drawRectNoDma( rx,ry,rw,rh, KEYBOARD_HIT_COLOR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bClick & MASK_JOY2_UP) {
|
else if ( (bClick & MASK_JOY2_UP) || (bClick & MASK_JOY1_UP) ) {
|
||||||
if (curFile!=0) {
|
if (curFile!=0) {
|
||||||
menuRedraw=true;
|
menuRedraw=true;
|
||||||
curFile--;
|
curFile--;
|
||||||
|
|
@ -866,7 +848,7 @@ int handleMenu(uint16_t bClick)
|
||||||
curFile--;
|
curFile--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bClick & MASK_JOY2_DOWN) {
|
else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) {
|
||||||
if ((curFile<(nbFiles-1)) && (nbFiles)) {
|
if ((curFile<(nbFiles-1)) && (nbFiles)) {
|
||||||
curFile++;
|
curFile++;
|
||||||
menuRedraw=true;
|
menuRedraw=true;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
#define HAS_T41 1
|
#define HAS_T41 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
//#define HAS_I2CKBD 1
|
//#define HAS_I2CKBD 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -267,34 +267,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -389,36 +389,18 @@ int emu_ReadKeys(void)
|
||||||
uint16_t j2 = 0;
|
uint16_t j2 = 0;
|
||||||
|
|
||||||
// Second joystick
|
// Second joystick
|
||||||
#if INVY
|
|
||||||
#ifdef PIN_JOY1_1
|
|
||||||
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_DOWN;
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_2
|
|
||||||
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_UP;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef PIN_JOY1_1
|
#ifdef PIN_JOY1_1
|
||||||
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_UP;
|
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_UP;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_JOY1_2
|
#ifdef PIN_JOY1_2
|
||||||
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_DOWN;
|
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_DOWN;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if INVX
|
|
||||||
#ifdef PIN_JOY1_3
|
|
||||||
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_LEFT;
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_4
|
|
||||||
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef PIN_JOY1_3
|
#ifdef PIN_JOY1_3
|
||||||
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_JOY1_4
|
#ifdef PIN_JOY1_4
|
||||||
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_LEFT;
|
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_LEFT;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_BTN
|
#ifdef PIN_JOY1_BTN
|
||||||
if ( digitalRead(PIN_JOY1_BTN) == LOW ) j2 |= MASK_JOY2_BTN;
|
if ( digitalRead(PIN_JOY1_BTN) == LOW ) j2 |= MASK_JOY2_BTN;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -778,7 +760,7 @@ int handleMenu(uint16_t bClick)
|
||||||
int rx=0,ry=0,rw=0,rh=0;
|
int rx=0,ry=0,rw=0,rh=0;
|
||||||
char c = 0; //captureTouchZone(menutouchareas, menutouchactions, &rx,&ry,&rw,&rh);
|
char c = 0; //captureTouchZone(menutouchareas, menutouchactions, &rx,&ry,&rw,&rh);
|
||||||
|
|
||||||
if ( (bClick & MASK_JOY2_BTN) || (c == MKEY_TFT) ) {
|
if ( (bClick & MASK_JOY2_BTN) || (bClick & MASK_JOY1_BTN) || (c == MKEY_TFT) ) {
|
||||||
emu_printf(newpath);
|
emu_printf(newpath);
|
||||||
#ifdef USE_SDFS
|
#ifdef USE_SDFS
|
||||||
FILINFO entry;
|
FILINFO entry;
|
||||||
|
|
@ -809,7 +791,7 @@ int handleMenu(uint16_t bClick)
|
||||||
//tft.drawRectNoDma( rx,ry,rw,rh, KEYBOARD_HIT_COLOR );
|
//tft.drawRectNoDma( rx,ry,rw,rh, KEYBOARD_HIT_COLOR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bClick & MASK_JOY2_UP) {
|
else if ( (bClick & MASK_JOY2_UP) || (bClick & MASK_JOY1_UP) ) {
|
||||||
if (curFile!=0) {
|
if (curFile!=0) {
|
||||||
menuRedraw=true;
|
menuRedraw=true;
|
||||||
curFile--;
|
curFile--;
|
||||||
|
|
@ -824,7 +806,7 @@ int handleMenu(uint16_t bClick)
|
||||||
curFile--;
|
curFile--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bClick & MASK_JOY2_DOWN) {
|
else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) {
|
||||||
if ((curFile<(nbFiles-1)) && (nbFiles)) {
|
if ((curFile<(nbFiles-1)) && (nbFiles)) {
|
||||||
curFile++;
|
curFile++;
|
||||||
menuRedraw=true;
|
menuRedraw=true;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
#define INVY 1
|
||||||
//#define HAS_SND 1
|
//#define HAS_SND 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
//#define HAS_I2CKBD 1
|
//#define HAS_I2CKBD 1
|
||||||
|
|
|
||||||
|
|
@ -392,36 +392,18 @@ int emu_ReadKeys(void)
|
||||||
uint16_t j2 = 0;
|
uint16_t j2 = 0;
|
||||||
|
|
||||||
// Second joystick
|
// Second joystick
|
||||||
#if INVY
|
|
||||||
#ifdef PIN_JOY1_1
|
|
||||||
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_DOWN;
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_2
|
|
||||||
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_UP;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef PIN_JOY1_1
|
#ifdef PIN_JOY1_1
|
||||||
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_UP;
|
if ( digitalRead(PIN_JOY1_1) == LOW ) j2 |= MASK_JOY2_UP;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_JOY1_2
|
#ifdef PIN_JOY1_2
|
||||||
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_DOWN;
|
if ( digitalRead(PIN_JOY1_2) == LOW ) j2 |= MASK_JOY2_DOWN;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if INVX
|
|
||||||
#ifdef PIN_JOY1_3
|
|
||||||
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_LEFT;
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_4
|
|
||||||
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef PIN_JOY1_3
|
#ifdef PIN_JOY1_3
|
||||||
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
if ( digitalRead(PIN_JOY1_3) == LOW ) j2 |= MASK_JOY2_RIGHT;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_JOY1_4
|
#ifdef PIN_JOY1_4
|
||||||
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_LEFT;
|
if ( digitalRead(PIN_JOY1_4) == LOW ) j2 |= MASK_JOY2_LEFT;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef PIN_JOY1_BTN
|
#ifdef PIN_JOY1_BTN
|
||||||
if ( digitalRead(PIN_JOY1_BTN) == LOW ) j2 |= MASK_JOY2_BTN;
|
if ( digitalRead(PIN_JOY1_BTN) == LOW ) j2 |= MASK_JOY2_BTN;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -810,7 +792,7 @@ int handleMenu(uint16_t bClick)
|
||||||
int rx=0,ry=0,rw=0,rh=0;
|
int rx=0,ry=0,rw=0,rh=0;
|
||||||
char c = 0; //captureTouchZone(menutouchareas, menutouchactions, &rx,&ry,&rw,&rh);
|
char c = 0; //captureTouchZone(menutouchareas, menutouchactions, &rx,&ry,&rw,&rh);
|
||||||
|
|
||||||
if ( (bClick & MASK_JOY2_BTN) || (c == MKEY_TFT) ) {
|
if ( (bClick & MASK_JOY2_BTN) || (bClick & MASK_JOY1_BTN) || (c == MKEY_TFT) ) {
|
||||||
emu_printf(newpath);
|
emu_printf(newpath);
|
||||||
#ifdef USE_SDFS
|
#ifdef USE_SDFS
|
||||||
FILINFO entry;
|
FILINFO entry;
|
||||||
|
|
@ -841,7 +823,7 @@ int handleMenu(uint16_t bClick)
|
||||||
//tft.drawRectNoDma( rx,ry,rw,rh, KEYBOARD_HIT_COLOR );
|
//tft.drawRectNoDma( rx,ry,rw,rh, KEYBOARD_HIT_COLOR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bClick & MASK_JOY2_UP) {
|
else if ( (bClick & MASK_JOY2_UP) || (bClick & MASK_JOY1_UP) ) {
|
||||||
if (curFile!=0) {
|
if (curFile!=0) {
|
||||||
menuRedraw=true;
|
menuRedraw=true;
|
||||||
curFile--;
|
curFile--;
|
||||||
|
|
@ -856,7 +838,7 @@ int handleMenu(uint16_t bClick)
|
||||||
curFile--;
|
curFile--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bClick & MASK_JOY2_DOWN) {
|
else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) {
|
||||||
if ((curFile<(nbFiles-1)) && (nbFiles)) {
|
if ((curFile<(nbFiles-1)) && (nbFiles)) {
|
||||||
curFile++;
|
curFile++;
|
||||||
menuRedraw=true;
|
menuRedraw=true;
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@ void uae_Input(int bClick) {
|
||||||
|
|
||||||
buttonstate[0] = 0;
|
buttonstate[0] = 0;
|
||||||
buttonstate[2] = 0;
|
buttonstate[2] = 0;
|
||||||
if (k & MASK_JOY2_BTN) buttonstate[0] = 1;
|
if ( (k & MASK_JOY1_BTN)|| ( k & MASK_JOY2_BTN)) buttonstate[0] = 1;
|
||||||
if (k & MASK_KEY_USER1) buttonstate[2] = 1;
|
if (k & MASK_KEY_USER1) buttonstate[2] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -420,11 +420,11 @@ void read_joystick(int nr, unsigned int *dir, int *button)
|
||||||
|
|
||||||
if (!isMouse)
|
if (!isMouse)
|
||||||
{
|
{
|
||||||
if (k & MASK_JOY2_DOWN) bot=1;
|
if ((k & MASK_JOY2_DOWN) || ( k & MASK_JOY1_DOWN)) bot=1;
|
||||||
if (k & MASK_JOY2_UP) top=1;
|
if ((k & MASK_JOY2_UP) || ( k & MASK_JOY1_UP)) top=1;
|
||||||
if (k & MASK_JOY2_LEFT) left=1;
|
if ((k & MASK_JOY2_LEFT) || ( k & MASK_JOY1_LEFT)) left=1;
|
||||||
if (k & MASK_JOY2_RIGHT) right=1;
|
if ((k & MASK_JOY2_RIGHT) || ( k & MASK_JOY1_RIGHT)) right=1;
|
||||||
if (k & MASK_JOY2_BTN) *button |=0xFF;
|
if ((k & MASK_JOY2_BTN) || ( k & MASK_JOY1_BTN)) *button |=0xFF;
|
||||||
|
|
||||||
if (left) top = !top;
|
if (left) top = !top;
|
||||||
if (right) bot = !bot;
|
if (right) bot = !bot;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue