Player Num Removal + Add-on Post Process Rewrite (#1285)
* Rewrote the add-ons and drivers a bit. This is a much cleaner way to do it, and should hopefully fix the timing in Turbo as well as any other add-ons having issues with USB reporting vs. actual timing. * Removed player num, updated post process add-on call with a boolean if the USB report was sent. Fixed up add-ons config page and config.proto appropriately * Moved headers for add-ons from tabs to spaces (we're not enforcing this yet but this gets us closer) * Removing bitmaps.h with our very temporary old logo Updated toaster and bounce to use current boot screen. Toaster now does a little more randomness Changed web config as well
This commit is contained in:
@@ -223,7 +223,6 @@ src/addons/i2canalog1219.cpp
|
||||
src/addons/i2c_gpio_pcf8575.cpp
|
||||
src/addons/display.cpp
|
||||
src/addons/neopicoleds.cpp
|
||||
src/addons/playernum.cpp
|
||||
src/addons/playerleds.cpp
|
||||
src/addons/reactiveleds.cpp
|
||||
src/addons/rotaryencoder.cpp
|
||||
|
||||
@@ -22,11 +22,12 @@ class AddonManager {
|
||||
public:
|
||||
AddonManager() {}
|
||||
~AddonManager() {}
|
||||
bool LoadAddon(GPAddon*, ADDON_PROCESS);
|
||||
bool LoadUSBAddon(GPAddon*, ADDON_PROCESS);
|
||||
void ReinitializeAddons(ADDON_PROCESS);
|
||||
void PreprocessAddons(ADDON_PROCESS);
|
||||
void ProcessAddons(ADDON_PROCESS);
|
||||
bool LoadAddon(GPAddon*);
|
||||
bool LoadUSBAddon(GPAddon*);
|
||||
void ReinitializeAddons();
|
||||
void PreprocessAddons();
|
||||
void ProcessAddons();
|
||||
void PostprocessAddons(bool);
|
||||
GPAddon * GetAddon(std::string); // hack for NeoPicoLED
|
||||
private:
|
||||
std::vector<AddonBlock*> addons; // addons currently loaded
|
||||
|
||||
@@ -101,6 +101,8 @@ public:
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void process(); // Analog Process
|
||||
virtual void preprocess() {}
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return AnalogName; }
|
||||
private:
|
||||
float readPin(Pin_t pin, uint16_t center);
|
||||
|
||||
@@ -26,16 +26,18 @@
|
||||
|
||||
class BoardLedAddon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // BoardLed Setup
|
||||
virtual void process(); // BoardLed Process
|
||||
virtual void preprocess() {}
|
||||
virtual std::string name() { return OnBoardLedName; }
|
||||
virtual bool available();
|
||||
virtual void setup(); // BoardLed Setup
|
||||
virtual void process(); // BoardLed Process
|
||||
virtual void preprocess() {}
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return OnBoardLedName; }
|
||||
private:
|
||||
OnBoardLedMode onBoardLedMode;
|
||||
bool isConfigMode;
|
||||
bool prevState;
|
||||
uint32_t timeSinceBlink;
|
||||
OnBoardLedMode onBoardLedMode;
|
||||
bool isConfigMode;
|
||||
bool prevState;
|
||||
uint32_t timeSinceBlink;
|
||||
};
|
||||
|
||||
#endif // _BoardLed_H_
|
||||
@@ -17,14 +17,16 @@
|
||||
|
||||
class BootselButtonAddon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // BootselButton Setup
|
||||
virtual void process() {} // BootselButton Process
|
||||
virtual void preprocess();
|
||||
virtual std::string name() { return BootselButtonName; }
|
||||
virtual bool available();
|
||||
virtual void setup(); // BootselButton Setup
|
||||
virtual void process() {} // BootselButton Process
|
||||
virtual void preprocess();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return BootselButtonName; }
|
||||
private:
|
||||
bool isBootselPressed();
|
||||
uint32_t bootselButtonMap;
|
||||
bool isBootselPressed();
|
||||
uint32_t bootselButtonMap;
|
||||
};
|
||||
|
||||
#endif // _BootselButton_H_
|
||||
@@ -25,129 +25,131 @@
|
||||
#define BuzzerSpeakerName "BuzzerSpeaker"
|
||||
|
||||
enum Tone {
|
||||
B0 = 31,
|
||||
C1 = 33,
|
||||
CS1 = 35,
|
||||
DS1 = 39,
|
||||
E1 = 41,
|
||||
F1 = 44,
|
||||
FS1 = 46,
|
||||
G1 = 49,
|
||||
GS1 = 52,
|
||||
A1 = 55,
|
||||
AS1 = 58,
|
||||
B1 = 62,
|
||||
C2 = 65,
|
||||
CS2 = 69,
|
||||
D2 = 73,
|
||||
DS2 = 78,
|
||||
E2 = 82,
|
||||
F2 = 87,
|
||||
FS2 = 93,
|
||||
G2 = 98,
|
||||
GS2 = 104,
|
||||
A2 = 110,
|
||||
AS2 = 117,
|
||||
B2 = 123,
|
||||
C3 = 131,
|
||||
CS3 = 139,
|
||||
D3 = 147,
|
||||
DS3 = 156,
|
||||
E3 = 165,
|
||||
F3 = 175,
|
||||
FS3 = 185,
|
||||
G3 = 196,
|
||||
GS3 = 208,
|
||||
A3 = 220,
|
||||
AS3 = 233,
|
||||
B3 = 247,
|
||||
C4 = 262,
|
||||
CS4 = 277,
|
||||
D4 = 294,
|
||||
DS4 = 311,
|
||||
E4 = 330,
|
||||
F4 = 349,
|
||||
FS4 = 370,
|
||||
G4 = 392,
|
||||
GS4 = 415,
|
||||
A4 = 440,
|
||||
AS4 = 466,
|
||||
B4 = 494,
|
||||
C5 = 523,
|
||||
CS5 = 554,
|
||||
D5 = 587,
|
||||
DS5 = 622,
|
||||
E5 = 659,
|
||||
F5 = 698,
|
||||
FS5 = 740,
|
||||
G5 = 784,
|
||||
GS5 = 831,
|
||||
A5 = 880,
|
||||
AS5 = 932,
|
||||
B5 = 988,
|
||||
C6 = 1047,
|
||||
CS6 = 1109,
|
||||
D6 = 1175,
|
||||
DS6 = 1245,
|
||||
E6 = 1319,
|
||||
F6 = 1397,
|
||||
FS6 = 1480,
|
||||
G6 = 1568,
|
||||
GS6 = 1661,
|
||||
A6 = 1760,
|
||||
AS6 = 1865,
|
||||
B6 = 1976,
|
||||
C7 = 2093,
|
||||
CS7 = 2217,
|
||||
D7 = 2349,
|
||||
DS7 = 2489,
|
||||
E7 = 2637,
|
||||
F7 = 2794,
|
||||
FS7 = 2960,
|
||||
G7 = 3136,
|
||||
GS7 = 3322,
|
||||
A7 = 3520,
|
||||
AS7 = 3729,
|
||||
B7 = 3951,
|
||||
C8 = 4186,
|
||||
CS8 = 4435,
|
||||
D8 = 4699,
|
||||
DS8 = 4978,
|
||||
PAUSE = 0
|
||||
B0 = 31,
|
||||
C1 = 33,
|
||||
CS1 = 35,
|
||||
DS1 = 39,
|
||||
E1 = 41,
|
||||
F1 = 44,
|
||||
FS1 = 46,
|
||||
G1 = 49,
|
||||
GS1 = 52,
|
||||
A1 = 55,
|
||||
AS1 = 58,
|
||||
B1 = 62,
|
||||
C2 = 65,
|
||||
CS2 = 69,
|
||||
D2 = 73,
|
||||
DS2 = 78,
|
||||
E2 = 82,
|
||||
F2 = 87,
|
||||
FS2 = 93,
|
||||
G2 = 98,
|
||||
GS2 = 104,
|
||||
A2 = 110,
|
||||
AS2 = 117,
|
||||
B2 = 123,
|
||||
C3 = 131,
|
||||
CS3 = 139,
|
||||
D3 = 147,
|
||||
DS3 = 156,
|
||||
E3 = 165,
|
||||
F3 = 175,
|
||||
FS3 = 185,
|
||||
G3 = 196,
|
||||
GS3 = 208,
|
||||
A3 = 220,
|
||||
AS3 = 233,
|
||||
B3 = 247,
|
||||
C4 = 262,
|
||||
CS4 = 277,
|
||||
D4 = 294,
|
||||
DS4 = 311,
|
||||
E4 = 330,
|
||||
F4 = 349,
|
||||
FS4 = 370,
|
||||
G4 = 392,
|
||||
GS4 = 415,
|
||||
A4 = 440,
|
||||
AS4 = 466,
|
||||
B4 = 494,
|
||||
C5 = 523,
|
||||
CS5 = 554,
|
||||
D5 = 587,
|
||||
DS5 = 622,
|
||||
E5 = 659,
|
||||
F5 = 698,
|
||||
FS5 = 740,
|
||||
G5 = 784,
|
||||
GS5 = 831,
|
||||
A5 = 880,
|
||||
AS5 = 932,
|
||||
B5 = 988,
|
||||
C6 = 1047,
|
||||
CS6 = 1109,
|
||||
D6 = 1175,
|
||||
DS6 = 1245,
|
||||
E6 = 1319,
|
||||
F6 = 1397,
|
||||
FS6 = 1480,
|
||||
G6 = 1568,
|
||||
GS6 = 1661,
|
||||
A6 = 1760,
|
||||
AS6 = 1865,
|
||||
B6 = 1976,
|
||||
C7 = 2093,
|
||||
CS7 = 2217,
|
||||
D7 = 2349,
|
||||
DS7 = 2489,
|
||||
E7 = 2637,
|
||||
F7 = 2794,
|
||||
FS7 = 2960,
|
||||
G7 = 3136,
|
||||
GS7 = 3322,
|
||||
A7 = 3520,
|
||||
AS7 = 3729,
|
||||
B7 = 3951,
|
||||
C8 = 4186,
|
||||
CS8 = 4435,
|
||||
D8 = 4699,
|
||||
DS8 = 4978,
|
||||
PAUSE = 0
|
||||
};
|
||||
|
||||
struct Song {
|
||||
uint16_t toneDuration;
|
||||
std::vector<Tone> song;
|
||||
Song(uint16_t t, std::vector<Tone> s){
|
||||
toneDuration = t;
|
||||
song = s;
|
||||
};
|
||||
uint16_t toneDuration;
|
||||
std::vector<Tone> song;
|
||||
Song(uint16_t t, std::vector<Tone> s){
|
||||
toneDuration = t;
|
||||
song = s;
|
||||
};
|
||||
};
|
||||
|
||||
// Buzzer Speaker
|
||||
class BuzzerSpeakerAddon : public GPAddon
|
||||
{
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual std::string name() { return BuzzerSpeakerName; }
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return BuzzerSpeakerName; }
|
||||
private:
|
||||
void processBuzzer();
|
||||
void play(Song *song);
|
||||
void playIntro();
|
||||
void stop();
|
||||
uint32_t pwmSetFreqDuty(uint slice, uint channel, uint32_t frequency, float duty);
|
||||
uint8_t buzzerPin;
|
||||
uint8_t buzzerEnablePin;
|
||||
uint8_t buzzerPinSlice;
|
||||
uint8_t buzzerPinChannel;
|
||||
uint8_t buzzerVolume;
|
||||
uint32_t startedSongMils;
|
||||
Song *currentSong;
|
||||
bool introPlayed;
|
||||
void processBuzzer();
|
||||
void play(Song *song);
|
||||
void playIntro();
|
||||
void stop();
|
||||
uint32_t pwmSetFreqDuty(uint slice, uint channel, uint32_t frequency, float duty);
|
||||
uint8_t buzzerPin;
|
||||
uint8_t buzzerEnablePin;
|
||||
uint8_t buzzerPinSlice;
|
||||
uint8_t buzzerPinChannel;
|
||||
uint8_t buzzerVolume;
|
||||
uint32_t startedSongMils;
|
||||
Song *currentSong;
|
||||
bool introPlayed;
|
||||
bool isSpeakerOn = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -116,70 +116,70 @@
|
||||
|
||||
#ifndef DEFAULT_SPLASH
|
||||
#define DEFAULT_SPLASH \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xDF,0xC0, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xC1,0xFF,0xA0, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCF,0xFE,0x80, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xE0,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xAB,0xC0,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00,0xFB,0x83,0xFF,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x01,0xFF,0x00,0x01,0xF3,0x07,0xFC,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x07,0xFF,0x00,0x03,0xE0,0x3F,0xF4,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x38,0x0A,0xE7,0x80,0x03,0xC0,0x5F,0x80,0x00, \
|
||||
0x00,0x00,0x00,0x20,0x07,0x81,0xFF,0x39,0xC3,0xC7,0x01,0xD7,0x80,0x3F,0x00,0x00, \
|
||||
0x00,0x00,0x00,0xE0,0x1F,0xE7,0xFF,0x79,0xC7,0x87,0x9F,0xA7,0x80,0x6E,0x3C,0x00, \
|
||||
0x00,0x00,0xA0,0xC0,0x3F,0xEA,0xE7,0xF3,0xEF,0x07,0x7F,0xC7,0x01,0xCF,0xFF,0x80, \
|
||||
0x00,0x03,0x8F,0xFC,0x7F,0xC3,0xC7,0x7F,0xFE,0x0F,0x7E,0x8F,0x87,0xDF,0xFC,0x00, \
|
||||
0x00,0x0F,0xFF,0xFF,0x73,0xC7,0x87,0xFF,0xDE,0x0E,0x50,0x07,0x1F,0x1F,0xD0,0x00, \
|
||||
0x00,0x1F,0x57,0xFF,0xE7,0x8F,0x07,0xFF,0x1C,0x3E,0x00,0x0F,0xFF,0x7F,0x00,0x00, \
|
||||
0x00,0x7E,0x0B,0x8F,0x8F,0x8E,0x0F,0xFF,0x9E,0x7C,0x00,0x07,0xFD,0xFC,0x00,0x00, \
|
||||
0x00,0x7C,0x37,0x9F,0x1F,0x1E,0x0F,0x87,0x1E,0xF8,0x00,0x07,0xF0,0x30,0x00,0x00, \
|
||||
0x00,0xF1,0xF7,0xFE,0x1E,0x1C,0x3E,0x0E,0x1F,0xF0,0x00,0x01,0x40,0x28,0x00,0x00, \
|
||||
0x01,0xEF,0xE7,0xF8,0x3C,0x3E,0x7C,0x0F,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x03,0xFF,0x8F,0xF0,0x7F,0xFE,0xF8,0x0E,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x03,0xFF,0xCF,0xC0,0xFF,0xFF,0xF0,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0x8B,0xFF,0x01,0xFF,0x8F,0xC0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0x87,0xFE,0x01,0xFE,0x0F,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0x1F,0xDE,0x03,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0xBF,0x9E,0x01,0xC0,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0xFF,0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0xFB,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x03,0xE7,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x01,0x47,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x0E,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xDF,0xC0, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xC1,0xFF,0xA0, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCF,0xFE,0x80, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xE0,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xAB,0xC0,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00,0xFB,0x83,0xFF,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x01,0xFF,0x00,0x01,0xF3,0x07,0xFC,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x07,0xFF,0x00,0x03,0xE0,0x3F,0xF4,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x38,0x0A,0xE7,0x80,0x03,0xC0,0x5F,0x80,0x00, \
|
||||
0x00,0x00,0x00,0x20,0x07,0x81,0xFF,0x39,0xC3,0xC7,0x01,0xD7,0x80,0x3F,0x00,0x00, \
|
||||
0x00,0x00,0x00,0xE0,0x1F,0xE7,0xFF,0x79,0xC7,0x87,0x9F,0xA7,0x80,0x6E,0x3C,0x00, \
|
||||
0x00,0x00,0xA0,0xC0,0x3F,0xEA,0xE7,0xF3,0xEF,0x07,0x7F,0xC7,0x01,0xCF,0xFF,0x80, \
|
||||
0x00,0x03,0x8F,0xFC,0x7F,0xC3,0xC7,0x7F,0xFE,0x0F,0x7E,0x8F,0x87,0xDF,0xFC,0x00, \
|
||||
0x00,0x0F,0xFF,0xFF,0x73,0xC7,0x87,0xFF,0xDE,0x0E,0x50,0x07,0x1F,0x1F,0xD0,0x00, \
|
||||
0x00,0x1F,0x57,0xFF,0xE7,0x8F,0x07,0xFF,0x1C,0x3E,0x00,0x0F,0xFF,0x7F,0x00,0x00, \
|
||||
0x00,0x7E,0x0B,0x8F,0x8F,0x8E,0x0F,0xFF,0x9E,0x7C,0x00,0x07,0xFD,0xFC,0x00,0x00, \
|
||||
0x00,0x7C,0x37,0x9F,0x1F,0x1E,0x0F,0x87,0x1E,0xF8,0x00,0x07,0xF0,0x30,0x00,0x00, \
|
||||
0x00,0xF1,0xF7,0xFE,0x1E,0x1C,0x3E,0x0E,0x1F,0xF0,0x00,0x01,0x40,0x28,0x00,0x00, \
|
||||
0x01,0xEF,0xE7,0xF8,0x3C,0x3E,0x7C,0x0F,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x03,0xFF,0x8F,0xF0,0x7F,0xFE,0xF8,0x0E,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x03,0xFF,0xCF,0xC0,0xFF,0xFF,0xF0,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0x8B,0xFF,0x01,0xFF,0x8F,0xC0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0x87,0xFE,0x01,0xFE,0x0F,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0x1F,0xDE,0x03,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0xBF,0x9E,0x01,0xC0,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0xFF,0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x07,0xFB,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x03,0xE7,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x01,0x47,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x0E,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
#endif
|
||||
|
||||
// i2c Display Module
|
||||
@@ -189,44 +189,46 @@
|
||||
class DisplayAddon : public GPAddon
|
||||
{
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual std::string name() { return DisplayName; }
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return DisplayName; }
|
||||
|
||||
void handleSystemRestart(GPEvent* e);
|
||||
void handleMenuNavigation(GPEvent* e);
|
||||
private:
|
||||
bool updateDisplayScreen();
|
||||
void drawStatusBar(Gamepad*);
|
||||
void initMenu(char**);
|
||||
bool pressedUp();
|
||||
bool pressedDown();
|
||||
bool pressedLeft();
|
||||
bool pressedRight();
|
||||
const DisplayOptions& getDisplayOptions();
|
||||
bool isDisplayPowerOff();
|
||||
void setDisplayPower(uint8_t status);
|
||||
uint32_t displaySaverTimeout = 0;
|
||||
int32_t displaySaverTimer;
|
||||
uint8_t displayIsPowerOn = 1;
|
||||
uint32_t prevMillis;
|
||||
std::string statusBar;
|
||||
Gamepad* gamepad;
|
||||
bool configMode;
|
||||
GPGFX* gpDisplay;
|
||||
GPScreen* gpScreen;
|
||||
DisplayMode currDisplayMode;
|
||||
DisplayMode prevDisplayMode;
|
||||
bool turnOffWhenSuspended;
|
||||
uint32_t bootMode;
|
||||
bool updateDisplayScreen();
|
||||
void drawStatusBar(Gamepad*);
|
||||
void initMenu(char**);
|
||||
bool pressedUp();
|
||||
bool pressedDown();
|
||||
bool pressedLeft();
|
||||
bool pressedRight();
|
||||
const DisplayOptions& getDisplayOptions();
|
||||
bool isDisplayPowerOff();
|
||||
void setDisplayPower(uint8_t status);
|
||||
uint32_t displaySaverTimeout = 0;
|
||||
int32_t displaySaverTimer;
|
||||
uint8_t displayIsPowerOn = 1;
|
||||
uint32_t prevMillis;
|
||||
std::string statusBar;
|
||||
Gamepad* gamepad;
|
||||
bool configMode;
|
||||
GPGFX* gpDisplay;
|
||||
GPScreen* gpScreen;
|
||||
DisplayMode currDisplayMode;
|
||||
DisplayMode prevDisplayMode;
|
||||
bool turnOffWhenSuspended;
|
||||
uint32_t bootMode;
|
||||
|
||||
DisplaySaverMode displaySaverMode;
|
||||
DisplaySaverMode displaySaverMode;
|
||||
|
||||
GPGFX_DisplayTypeOptions gpOptions;
|
||||
GPGFX_DisplayTypeOptions gpOptions;
|
||||
|
||||
GamepadButtonMapping *mapMenuToggle;
|
||||
GamepadButtonMapping *mapMenuToggle;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,29 +47,31 @@
|
||||
class DRV8833RumbleAddon : public GPAddon
|
||||
{
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual std::string name() { return DRV8833RumbleName; }
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return DRV8833RumbleName; }
|
||||
private:
|
||||
uint32_t pwmSetFreqDuty(uint slice, uint channel, uint32_t frequency, float duty);
|
||||
bool compareRumbleState(Gamepad * gamepad);
|
||||
void setRumbleState(Gamepad * gamepad);
|
||||
void disableMotors();
|
||||
void enableMotors(Gamepad * gamepad);
|
||||
uint8_t leftMotorPin;
|
||||
uint8_t rightMotorPin;
|
||||
uint8_t motorSleepPin;
|
||||
uint8_t leftMotorPinSlice;
|
||||
uint8_t leftMotorPinChannel;
|
||||
uint8_t rightMotorPinSlice;
|
||||
uint8_t rightMotorPinChannel;
|
||||
uint32_t pwmFrequency;
|
||||
float dutyMin;
|
||||
float dutyMax;
|
||||
uint32_t sysClock;
|
||||
GamepadAuxHaptics currentRumbleState;
|
||||
uint32_t pwmSetFreqDuty(uint slice, uint channel, uint32_t frequency, float duty);
|
||||
bool compareRumbleState(Gamepad * gamepad);
|
||||
void setRumbleState(Gamepad * gamepad);
|
||||
void disableMotors();
|
||||
void enableMotors(Gamepad * gamepad);
|
||||
uint8_t leftMotorPin;
|
||||
uint8_t rightMotorPin;
|
||||
uint8_t motorSleepPin;
|
||||
uint8_t leftMotorPinSlice;
|
||||
uint8_t leftMotorPinChannel;
|
||||
uint8_t rightMotorPinSlice;
|
||||
uint8_t rightMotorPinChannel;
|
||||
uint32_t pwmFrequency;
|
||||
float dutyMin;
|
||||
float dutyMax;
|
||||
uint32_t sysClock;
|
||||
GamepadAuxHaptics currentRumbleState;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // Dual Directional Setup
|
||||
virtual void process(); // Dual Directional Process
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit();
|
||||
virtual void preprocess(); // Dual Directional Pre-Process (Cheat)
|
||||
virtual std::string name() { return DualDirectionalName; }
|
||||
|
||||
@@ -37,14 +37,16 @@
|
||||
|
||||
class FocusModeAddon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // FocusMode Setup
|
||||
virtual void process(); // FocusMode Process
|
||||
virtual void preprocess() {}
|
||||
virtual std::string name() { return FocusModeName; }
|
||||
virtual bool available();
|
||||
virtual void setup(); // FocusMode Setup
|
||||
virtual void process(); // FocusMode Process
|
||||
virtual void preprocess() {}
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return FocusModeName; }
|
||||
private:
|
||||
uint32_t buttonLockMask;
|
||||
GamepadButtonMapping *mapFocusMode;
|
||||
uint32_t buttonLockMask;
|
||||
GamepadButtonMapping *mapFocusMode;
|
||||
};
|
||||
|
||||
#endif // _FocusMode_H_
|
||||
@@ -16,11 +16,13 @@
|
||||
|
||||
class GamepadUSBHostAddon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // GamepadUSBHost Setup
|
||||
virtual void process() {} // GamepadUSBHost Process
|
||||
virtual void preprocess();
|
||||
virtual std::string name() { return GamepadUSBHostName; }
|
||||
virtual bool available();
|
||||
virtual void setup(); // GamepadUSBHost Setup
|
||||
virtual void process() {} // GamepadUSBHost Process
|
||||
virtual void preprocess();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return GamepadUSBHostName; }
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -138,10 +138,12 @@
|
||||
|
||||
class PCF8575Addon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return PCF8575AddonName; }
|
||||
|
||||
std::map<uint8_t, GpioMappingInfo> pinRef;
|
||||
|
||||
@@ -36,22 +36,24 @@
|
||||
#define I2CAnalog1219Name "I2CAnalog"
|
||||
|
||||
typedef struct {
|
||||
float A[4];
|
||||
float A[4];
|
||||
} ADS_PINS;
|
||||
|
||||
class I2CAnalog1219Input : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // Analog Process
|
||||
virtual bool available();
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // Analog Process
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return I2CAnalog1219Name; }
|
||||
private:
|
||||
ADS1219Device * ads;
|
||||
ADS_PINS pins;
|
||||
int channelHop;
|
||||
uint32_t uIntervalMS; // ADS1219 Interval
|
||||
uint32_t nextTimer; // Turbo Timer
|
||||
ADS_PINS pins;
|
||||
int channelHop;
|
||||
uint32_t uIntervalMS; // ADS1219 Interval
|
||||
uint32_t nextTimer; // Turbo Timer
|
||||
};
|
||||
|
||||
#endif // _I2CAnalog_H_
|
||||
|
||||
@@ -34,31 +34,32 @@
|
||||
|
||||
class InputMacro : public GPAddon {
|
||||
public:
|
||||
virtual bool available(); // GPAddon available
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void process() {}; // Analog Process
|
||||
virtual void preprocess();
|
||||
virtual bool available(); // GPAddon available
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void process() {}; // Analog Process
|
||||
virtual void preprocess();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit();
|
||||
virtual std::string name() { return InputMacroName; }
|
||||
private:
|
||||
void checkMacroPress();
|
||||
void checkMacroAction();
|
||||
void runCurrentMacro();
|
||||
void reset();
|
||||
void restart(Macro& macro);
|
||||
bool isMacroRunning;
|
||||
bool isMacroTriggerHeld;
|
||||
int macroPosition;
|
||||
uint32_t macroButtonMask;
|
||||
uint32_t macroPinMasks[6];
|
||||
uint64_t macroStartTime;
|
||||
uint64_t currentMicros;
|
||||
int pressedMacro;
|
||||
int macroInputPosition;
|
||||
uint32_t macroInputHoldTime;
|
||||
bool prevMacroInputPressed;
|
||||
bool boardLedEnabled;
|
||||
MacroOptions * inputMacroOptions;
|
||||
void checkMacroPress();
|
||||
void checkMacroAction();
|
||||
void runCurrentMacro();
|
||||
void reset();
|
||||
void restart(Macro& macro);
|
||||
bool isMacroRunning;
|
||||
bool isMacroTriggerHeld;
|
||||
int macroPosition;
|
||||
uint32_t macroButtonMask;
|
||||
uint32_t macroPinMasks[6];
|
||||
uint64_t macroStartTime;
|
||||
uint64_t currentMicros;
|
||||
int pressedMacro;
|
||||
int macroInputPosition;
|
||||
uint32_t macroInputHoldTime;
|
||||
bool prevMacroInputPressed;
|
||||
bool boardLedEnabled;
|
||||
MacroOptions * inputMacroOptions;
|
||||
};
|
||||
|
||||
#endif // _InputMacro_H_
|
||||
@@ -20,11 +20,13 @@
|
||||
|
||||
class KeyboardHostAddon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // KeyboardHost Setup
|
||||
virtual void process() {} // KeyboardHost Process
|
||||
virtual void preprocess();
|
||||
virtual std::string name() { return KeyboardHostName; }
|
||||
virtual bool available();
|
||||
virtual void setup(); // KeyboardHost Setup
|
||||
virtual void process() {} // KeyboardHost Process
|
||||
virtual void preprocess();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return KeyboardHostName; }
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -7,60 +7,60 @@
|
||||
|
||||
struct KeyboardButtonMapping
|
||||
{
|
||||
uint8_t key;
|
||||
uint16_t buttonMask;
|
||||
uint8_t key;
|
||||
uint16_t buttonMask;
|
||||
|
||||
inline void setMask(uint16_t m) {
|
||||
buttonMask = m;
|
||||
}
|
||||
inline void setMask(uint16_t m) {
|
||||
buttonMask = m;
|
||||
}
|
||||
|
||||
inline void setKey(uint8_t p)
|
||||
{
|
||||
key = (p > HID_KEY_NONE && p <= HID_KEY_GUI_RIGHT) ? p : 0xff;
|
||||
}
|
||||
inline void setKey(uint8_t p)
|
||||
{
|
||||
key = (p > HID_KEY_NONE && p <= HID_KEY_GUI_RIGHT) ? p : 0xff;
|
||||
}
|
||||
|
||||
bool isAssigned() const { return key != 0xff; }
|
||||
bool isAssigned() const { return key != 0xff; }
|
||||
};
|
||||
|
||||
|
||||
class KeyboardHostListener : public USBListener {
|
||||
public:// USB Listener Features
|
||||
virtual void setup();
|
||||
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len);
|
||||
virtual void xmount(uint8_t dev_addr, uint8_t instance, uint8_t controllerType, uint8_t subtype) {}
|
||||
virtual void unmount(uint8_t dev_addr);
|
||||
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
|
||||
virtual void report_sent(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) {}
|
||||
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
|
||||
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
|
||||
void process();
|
||||
virtual void setup();
|
||||
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len);
|
||||
virtual void xmount(uint8_t dev_addr, uint8_t instance, uint8_t controllerType, uint8_t subtype) {}
|
||||
virtual void unmount(uint8_t dev_addr);
|
||||
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
|
||||
virtual void report_sent(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) {}
|
||||
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
|
||||
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
|
||||
void process();
|
||||
private:
|
||||
uint8_t getKeycodeFromModifier(uint8_t modifier);
|
||||
uint8_t getKeycodeFromModifier(uint8_t modifier);
|
||||
void preprocess_report();
|
||||
void process_kbd_report(uint8_t dev_addr, hid_keyboard_report_t const *report);
|
||||
void process_kbd_report(uint8_t dev_addr, hid_keyboard_report_t const *report);
|
||||
void process_mouse_report(uint8_t dev_addr, hid_mouse_report_t const *report);
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadUp;
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadDown;
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadLeft;
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadRight;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB4;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonL1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonR1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonL2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonR2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonS1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonS2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonL3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonR3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA4;
|
||||
GamepadState _keyboard_host_state;
|
||||
bool _keyboard_host_mounted;
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadUp;
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadDown;
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadLeft;
|
||||
KeyboardButtonMapping _keyboard_host_mapDpadRight;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonB4;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonL1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonR1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonL2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonR2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonS1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonS2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonL3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonR3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA1;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA2;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA3;
|
||||
KeyboardButtonMapping _keyboard_host_mapButtonA4;
|
||||
GamepadState _keyboard_host_state;
|
||||
bool _keyboard_host_mounted;
|
||||
uint8_t _keyboard_dev_addr;
|
||||
uint8_t _keyboard_instance;
|
||||
bool _mouse_host_mounted;
|
||||
|
||||
@@ -163,9 +163,9 @@ PixelMatrix createLedButtonLayout(ButtonLayout layout, std::vector<uint8_t> *pos
|
||||
class NeoPicoPlayerLEDs : public PlayerLEDs
|
||||
{
|
||||
public:
|
||||
virtual void setup(){}
|
||||
virtual void display(){}
|
||||
uint16_t * getLedLevels() { return ledLevels; }
|
||||
virtual void setup(){}
|
||||
virtual void display(){}
|
||||
uint16_t * getLedLevels() { return ledLevels; }
|
||||
};
|
||||
|
||||
#define NeoPicoLEDName "NeoPicoLED"
|
||||
@@ -173,32 +173,34 @@ public:
|
||||
// NeoPico LED Addon
|
||||
class NeoPicoLEDAddon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual std::string name() { return NeoPicoLEDName; }
|
||||
void configureLEDs();
|
||||
uint32_t frame[100];
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return NeoPicoLEDName; }
|
||||
void configureLEDs();
|
||||
uint32_t frame[100];
|
||||
private:
|
||||
std::vector<uint8_t> * getLEDPositions(std::string button, std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDButtons(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDStickless(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDWasd(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDWasdFBM(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> createLEDLayout(ButtonLayout layout, uint8_t ledsPerPixel, uint8_t ledButtonCount);
|
||||
uint8_t setupButtonPositions();
|
||||
const uint32_t intervalMS = 10;
|
||||
absolute_time_t nextRunTime;
|
||||
uint8_t ledCount;
|
||||
PixelMatrix matrix;
|
||||
NeoPico *neopico;
|
||||
InputMode inputMode; // HACK
|
||||
PLEDAnimationState animationState; // NeoPico can control the player LEDs
|
||||
NeoPicoPlayerLEDs * neoPLEDs = nullptr;
|
||||
AnimationStation as;
|
||||
std::map<std::string, int> buttonPositions;
|
||||
bool turnOffWhenSuspended;
|
||||
std::vector<uint8_t> * getLEDPositions(std::string button, std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDButtons(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDStickless(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDWasd(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> generatedLEDWasdFBM(std::vector<std::vector<uint8_t>> *positions);
|
||||
std::vector<std::vector<Pixel>> createLEDLayout(ButtonLayout layout, uint8_t ledsPerPixel, uint8_t ledButtonCount);
|
||||
uint8_t setupButtonPositions();
|
||||
const uint32_t intervalMS = 10;
|
||||
absolute_time_t nextRunTime;
|
||||
uint8_t ledCount;
|
||||
PixelMatrix matrix;
|
||||
NeoPico *neopico;
|
||||
InputMode inputMode; // HACK
|
||||
PLEDAnimationState animationState; // NeoPico can control the player LEDs
|
||||
NeoPicoPlayerLEDs * neoPLEDs = nullptr;
|
||||
AnimationStation as;
|
||||
std::map<std::string, int> buttonPositions;
|
||||
bool turnOffWhenSuspended;
|
||||
PLEDType ledType;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef _PlayerNum_H
|
||||
#define _PlayerNum_H
|
||||
|
||||
#include "gpaddon.h"
|
||||
|
||||
#include "GamepadEnums.h"
|
||||
|
||||
#include "BoardConfig.h"
|
||||
|
||||
#ifndef PLAYERNUM_ADDON_ENABLED
|
||||
#define PLAYERNUM_ADDON_ENABLED 0
|
||||
#endif
|
||||
|
||||
#ifndef PLAYER_NUMBER
|
||||
#define PLAYER_NUMBER 1
|
||||
#endif
|
||||
|
||||
// Analog Module Name
|
||||
#define PlayerNumName "PlayerNum"
|
||||
|
||||
class PlayerNumAddon : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void process(); // Analog Process
|
||||
virtual void preprocess() {}
|
||||
virtual std::string name() { return PlayerNumName; }
|
||||
private:
|
||||
void handleLED(int);
|
||||
uint8_t assigned;
|
||||
uint8_t playerNum;
|
||||
uint8_t xinputIDs[4];
|
||||
};
|
||||
|
||||
#endif // _PlayerNum_H
|
||||
@@ -23,8 +23,8 @@ extern AnimationStation as;
|
||||
class PWMPlayerLEDs : public PlayerLEDs
|
||||
{
|
||||
public:
|
||||
void setup();
|
||||
void display();
|
||||
void setup();
|
||||
void display();
|
||||
};
|
||||
|
||||
// Player LED Module
|
||||
@@ -34,23 +34,25 @@ public:
|
||||
class PlayerLEDAddon : public GPAddon
|
||||
{
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual std::string name() { return PLEDName; }
|
||||
PlayerLEDAddon() {
|
||||
type = static_cast<PLEDType>(Storage::getInstance().getLedOptions().pledType);
|
||||
}
|
||||
PlayerLEDAddon(PLEDType type) : type(type) {}
|
||||
virtual bool available();
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return PLEDName; }
|
||||
PlayerLEDAddon() {
|
||||
type = static_cast<PLEDType>(Storage::getInstance().getLedOptions().pledType);
|
||||
}
|
||||
PlayerLEDAddon(PLEDType type) : type(type) {}
|
||||
|
||||
protected:
|
||||
PLEDType type;
|
||||
PWMPlayerLEDs *pwmLEDs = nullptr;
|
||||
PLEDAnimationState animationState;
|
||||
PLEDType type;
|
||||
PWMPlayerLEDs *pwmLEDs = nullptr;
|
||||
PLEDAnimationState animationState;
|
||||
|
||||
private:
|
||||
bool turnOffWhenSuspended;
|
||||
bool turnOffWhenSuspended;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,6 +34,8 @@ class ReactiveLEDAddon : public GPAddon
|
||||
virtual void setup();
|
||||
virtual void preprocess() {}
|
||||
virtual void process();
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return ReactiveLEDName; }
|
||||
private:
|
||||
struct ReactiveLEDPinState {
|
||||
|
||||
@@ -38,27 +38,29 @@
|
||||
|
||||
class ReverseInput : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // Reverse Button Setup
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // Reverse process
|
||||
virtual bool available();
|
||||
virtual void setup(); // Reverse Button Setup
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // Reverse process
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return ReverseName; }
|
||||
private:
|
||||
void update();
|
||||
uint8_t input(uint32_t valueMask, uint16_t buttonMask, uint16_t buttonMaskReverse, uint8_t action, bool invertAxis);
|
||||
|
||||
bool state;
|
||||
bool state;
|
||||
|
||||
uint8_t pinLED;
|
||||
uint8_t pinLED;
|
||||
|
||||
GamepadButtonMapping *mapDpadUp;
|
||||
GamepadButtonMapping *mapDpadDown;
|
||||
GamepadButtonMapping *mapDpadLeft;
|
||||
GamepadButtonMapping *mapDpadRight;
|
||||
GamepadButtonMapping *mapInputReverse;
|
||||
GamepadButtonMapping *mapDpadUp;
|
||||
GamepadButtonMapping *mapDpadDown;
|
||||
GamepadButtonMapping *mapDpadLeft;
|
||||
GamepadButtonMapping *mapDpadRight;
|
||||
GamepadButtonMapping *mapInputReverse;
|
||||
|
||||
bool invertXAxis;
|
||||
bool invertYAxis;
|
||||
bool invertXAxis;
|
||||
bool invertYAxis;
|
||||
|
||||
// 0 - Ignore, 1 - Enabled, 2 - Neutral
|
||||
uint8_t actionUp;
|
||||
|
||||
@@ -84,9 +84,11 @@
|
||||
class RotaryEncoderInput : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // Rotary Setup
|
||||
virtual void setup(); // Rotary Setup
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // Rotary process
|
||||
virtual void process(); // Rotary process
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return RotaryEncoderName; }
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -28,10 +28,11 @@
|
||||
class SliderSOCDInput : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // SliderSOCD Button Setup
|
||||
virtual void setup(); // SliderSOCD Button Setup
|
||||
virtual void reinit();
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // SliderSOCD process
|
||||
virtual void process(); // SliderSOCD process
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual std::string name() { return SliderSOCDName; }
|
||||
private:
|
||||
SOCDMode read();
|
||||
|
||||
@@ -30,11 +30,13 @@
|
||||
|
||||
class SNESpadInput : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // SNESpad Setup
|
||||
virtual void process(); // SNESpad Process
|
||||
virtual void preprocess() {}
|
||||
virtual std::string name() { return SNESpadName; }
|
||||
virtual bool available();
|
||||
virtual void setup(); // SNESpad Setup
|
||||
virtual void process(); // SNESpad Process
|
||||
virtual void preprocess() {}
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return SNESpadName; }
|
||||
private:
|
||||
SNESpad * snes;
|
||||
uint32_t uIntervalMS;
|
||||
|
||||
@@ -34,10 +34,12 @@
|
||||
|
||||
class SPIAnalog1256Input : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // Analog Process
|
||||
virtual bool available();
|
||||
virtual void setup(); // Analog Setup
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // Analog Process
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return SPIAnalog1256Name; }
|
||||
private:
|
||||
uint8_t convert24to8bit(float voltage);
|
||||
|
||||
@@ -90,27 +90,29 @@
|
||||
|
||||
class TiltInput : public GPAddon {
|
||||
public:
|
||||
virtual bool available();
|
||||
virtual void setup(); // Tilt Setup
|
||||
virtual void process(); // Tilt Process
|
||||
virtual void preprocess(); // Tilt Pre-Process (Cheat)
|
||||
virtual std::string name() { return TiltName; }
|
||||
virtual bool available();
|
||||
virtual void setup(); // Tilt Setup
|
||||
virtual void process(); // Tilt Process
|
||||
virtual void preprocess(); // Tilt Pre-Process (Cheat)
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return TiltName; }
|
||||
private:
|
||||
void SOCDTiltClean(SOCDMode);
|
||||
uint8_t SOCDCombine(SOCDMode, uint8_t);
|
||||
uint8_t SOCDGamepadClean(uint8_t);
|
||||
void OverrideGamepad(Gamepad*, uint8_t, uint8_t);
|
||||
void SOCDTiltClean(SOCDMode);
|
||||
uint8_t SOCDCombine(SOCDMode, uint8_t);
|
||||
uint8_t SOCDGamepadClean(uint8_t);
|
||||
void OverrideGamepad(Gamepad*, uint8_t, uint8_t);
|
||||
uint16_t getAnalogValue(bool isMin, bool isMax);
|
||||
uint8_t tiltLeftState; // Tilt State
|
||||
uint8_t tiltRightState; // Tilt Right Analog State
|
||||
DpadDirection lastGPUD; // Gamepad Last Up-Down
|
||||
DpadDirection lastGPLR; // Gamepad Last Left-Right
|
||||
DpadDirection leftLastTiltUD; // Tilt Last Up-Down
|
||||
DpadDirection leftLastTiltLR; // Gamepad Last Left-Right
|
||||
DpadDirection rightLastTiltUD; // Tilt Last Up-Down
|
||||
DpadDirection rightLastTiltLR; // Gamepad Last Left-Right
|
||||
uint32_t dpadTime[4];
|
||||
uint8_t tilt1FactorLeftX;
|
||||
uint8_t tiltLeftState; // Tilt State
|
||||
uint8_t tiltRightState; // Tilt Right Analog State
|
||||
DpadDirection lastGPUD; // Gamepad Last Up-Down
|
||||
DpadDirection lastGPLR; // Gamepad Last Left-Right
|
||||
DpadDirection leftLastTiltUD; // Tilt Last Up-Down
|
||||
DpadDirection leftLastTiltLR; // Gamepad Last Left-Right
|
||||
DpadDirection rightLastTiltUD; // Tilt Last Up-Down
|
||||
DpadDirection rightLastTiltLR; // Gamepad Last Left-Right
|
||||
uint32_t dpadTime[4];
|
||||
uint8_t tilt1FactorLeftX;
|
||||
uint8_t tilt1FactorLeftY;
|
||||
uint8_t tilt1FactorRightX;
|
||||
uint8_t tilt1FactorRightY;
|
||||
@@ -118,17 +120,17 @@ private:
|
||||
uint8_t tilt2FactorLeftY;
|
||||
uint8_t tilt2FactorRightX;
|
||||
uint8_t tilt2FactorRightY;
|
||||
SOCDMode tiltSOCDMode;
|
||||
GamepadButtonMapping *mapAnalogLSXNeg;
|
||||
GamepadButtonMapping *mapAnalogLSXPos;
|
||||
GamepadButtonMapping *mapAnalogLSYNeg;
|
||||
GamepadButtonMapping *mapAnalogLSYPos;
|
||||
GamepadButtonMapping *mapAnalogRSXNeg;
|
||||
GamepadButtonMapping *mapAnalogRSXPos;
|
||||
GamepadButtonMapping *mapAnalogRSYNeg;
|
||||
GamepadButtonMapping *mapAnalogRSYPos;
|
||||
GamepadButtonMapping *mapAnalogModLow;
|
||||
GamepadButtonMapping *mapAnalogModHigh;
|
||||
SOCDMode tiltSOCDMode;
|
||||
GamepadButtonMapping *mapAnalogLSXNeg;
|
||||
GamepadButtonMapping *mapAnalogLSXPos;
|
||||
GamepadButtonMapping *mapAnalogLSYNeg;
|
||||
GamepadButtonMapping *mapAnalogLSYPos;
|
||||
GamepadButtonMapping *mapAnalogRSXNeg;
|
||||
GamepadButtonMapping *mapAnalogRSXPos;
|
||||
GamepadButtonMapping *mapAnalogRSYNeg;
|
||||
GamepadButtonMapping *mapAnalogRSYPos;
|
||||
GamepadButtonMapping *mapAnalogModLow;
|
||||
GamepadButtonMapping *mapAnalogModHigh;
|
||||
};
|
||||
|
||||
#endif // _Tilt_H
|
||||
|
||||
@@ -106,6 +106,7 @@ public:
|
||||
virtual void reinit();
|
||||
virtual void preprocess() {}
|
||||
virtual void process(); // TURBO Setting of buttons (Enable/Disable)
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual std::string name() { return TurboName; }
|
||||
|
||||
void handleEncoder(GPEvent* e);
|
||||
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
virtual void setup(); // WiiExtension Setup
|
||||
virtual void process(); // WiiExtension Process
|
||||
virtual void preprocess() {}
|
||||
virtual void postprocess(bool sent) {}
|
||||
virtual void reinit() {}
|
||||
virtual std::string name() { return WiiExtensionName; }
|
||||
private:
|
||||
WiiExtensionDevice * wii;
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
#ifndef BITMAPS_H_
|
||||
#define BITMAPS_H_
|
||||
|
||||
// Split up images for boot animation without a huge byte array.
|
||||
const unsigned char bootLogoTop[] = {
|
||||
// 'gp2040logot', 43x39px
|
||||
0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x01, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfc,
|
||||
0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xc0, 0x00, 0x0f, 0xff,
|
||||
0xff, 0xff, 0xfe, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x7f, 0xb0, 0x00, 0x00, 0x1c, 0x0f, 0x33,
|
||||
0x78, 0x00, 0x00, 0x3e, 0x06, 0x60, 0x78, 0x00, 0x00, 0x3e, 0x00, 0xf6, 0x30, 0x00, 0x00, 0x1c,
|
||||
0x06, 0xff, 0x60, 0x00, 0x00, 0x00, 0x0f, 0x6f, 0xf0, 0x00, 0x00, 0x00, 0x0f, 0x06, 0xf0, 0x00,
|
||||
0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
||||
0x00, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x00,
|
||||
0x00, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x30, 0x00, 0x00, 0x00, 0x01, 0x80,
|
||||
0x1f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x7f, 0xff, 0xff,
|
||||
0xc0, 0x00, 0x00, 0x1f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x01,
|
||||
0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00
|
||||
};
|
||||
const unsigned char bootLogoBottom[] = {
|
||||
// 'gp2040logotb', 128x35px
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xDF,0xC0,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xC1,0xFF,0xA0,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCF,0xFE,0x80,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xE0,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xAB,0xC0,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00,0xFB,0x83,0xFF,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x01,0xFF,0x00,0x01,0xF3,0x07,0xFC,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x07,0xFF,0x00,0x03,0xE0,0x3F,0xF4,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x38,0x0A,0xE7,0x80,0x03,0xC0,0x5F,0x80,0x00,
|
||||
0x00,0x00,0x00,0x20,0x07,0x81,0xFF,0x39,0xC3,0xC7,0x01,0xD7,0x80,0x3F,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE0,0x1F,0xE7,0xFF,0x79,0xC7,0x87,0x9F,0xA7,0x80,0x6E,0x3C,0x00,
|
||||
0x00,0x00,0xA0,0xC0,0x3F,0xEA,0xE7,0xF3,0xEF,0x07,0x7F,0xC7,0x01,0xCF,0xFF,0x80,
|
||||
0x00,0x03,0x8F,0xFC,0x7F,0xC3,0xC7,0x7F,0xFE,0x0F,0x7E,0x8F,0x87,0xDF,0xFC,0x00,
|
||||
0x00,0x0F,0xFF,0xFF,0x73,0xC7,0x87,0xFF,0xDE,0x0E,0x50,0x07,0x1F,0x1F,0xD0,0x00,
|
||||
0x00,0x1F,0x57,0xFF,0xE7,0x8F,0x07,0xFF,0x1C,0x3E,0x00,0x0F,0xFF,0x7F,0x00,0x00,
|
||||
0x00,0x7E,0x0B,0x8F,0x8F,0x8E,0x0F,0xFF,0x9E,0x7C,0x00,0x07,0xFD,0xFC,0x00,0x00,
|
||||
0x00,0x7C,0x37,0x9F,0x1F,0x1E,0x0F,0x87,0x1E,0xF8,0x00,0x07,0xF0,0x30,0x00,0x00,
|
||||
0x00,0xF1,0xF7,0xFE,0x1E,0x1C,0x3E,0x0E,0x1F,0xF0,0x00,0x01,0x40,0x28,0x00,0x00,
|
||||
0x01,0xEF,0xE7,0xF8,0x3C,0x3E,0x7C,0x0F,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x03,0xFF,0x8F,0xF0,0x7F,0xFE,0xF8,0x0E,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x03,0xFF,0xCF,0xC0,0xFF,0xFF,0xF0,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x07,0x8B,0xFF,0x01,0xFF,0x8F,0xC0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x07,0x87,0xFE,0x01,0xFE,0x0F,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x07,0x1F,0xDE,0x03,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x07,0xBF,0x9E,0x01,0xC0,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x07,0xFF,0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x07,0xFB,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x03,0xE7,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x01,0x47,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x0E,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <vector>
|
||||
#include "GPGFX_UI_widgets.h"
|
||||
#include "bitmaps.h"
|
||||
|
||||
const uint8_t SCREEN_WIDTH = 128;
|
||||
const uint8_t SCREEN_HEIGHT = 64;
|
||||
@@ -30,7 +29,7 @@ class DisplaySaverScreen : public GPScreen {
|
||||
uint16_t bounceSpriteX = 0;
|
||||
uint16_t bounceSpriteY = 0;
|
||||
uint16_t bounceSpriteWidth = 128;
|
||||
uint16_t bounceSpriteHeight = 35;
|
||||
uint16_t bounceSpriteHeight = 64;
|
||||
double bounceSpriteVelocityX = 1;
|
||||
double bounceSpriteVelocityY = 1;
|
||||
double bounceScale = 0.5;
|
||||
@@ -41,9 +40,6 @@ class DisplaySaverScreen : public GPScreen {
|
||||
|
||||
// toaster
|
||||
struct ToastParams {
|
||||
uint8_t* image;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
double scale;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
@@ -53,8 +49,10 @@ class DisplaySaverScreen : public GPScreen {
|
||||
|
||||
std::vector<ToastParams> toasters;
|
||||
uint16_t numberOfToasters = 10;
|
||||
uint16_t toasterSpriteWidth = 43;
|
||||
uint16_t toasterSpriteHeight = 39;
|
||||
//uint16_t toasterSpriteWidth = 43;
|
||||
//uint16_t toasterSpriteHeight = 39;
|
||||
uint16_t toasterSpriteWidth = 128;
|
||||
uint16_t toasterSpriteHeight = 64;
|
||||
void initToasters();
|
||||
void drawToasterScene();
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define _RESTARTSCREEN_H_
|
||||
|
||||
#include "GPGFX_UI_widgets.h"
|
||||
#include "bitmaps.h"
|
||||
|
||||
class RestartScreen : public GPScreen {
|
||||
public:
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define _SPLASHSCREEN_H_
|
||||
|
||||
#include "GPGFX_UI_widgets.h"
|
||||
#include "bitmaps.h"
|
||||
|
||||
class SplashScreen : public GPScreen {
|
||||
public:
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class AstroDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class EgretDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class HIDDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
class KeyboardDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class MDMiniDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class NeoGeoDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class NetDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class PCEngineDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class PS3Driver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -39,7 +39,7 @@ class PS4Driver : public GPDriver {
|
||||
public:
|
||||
PS4Driver(uint32_t type): controllerType(type) {}
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux();
|
||||
virtual void processAux();
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class PSClassicDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class SwitchDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class XBOneDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux();
|
||||
virtual void processAux();
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class XboxOriginalDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux() {}
|
||||
virtual void processAux() {}
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
class XInputDriver : public GPDriver {
|
||||
public:
|
||||
virtual void initialize();
|
||||
virtual void process(Gamepad * gamepad);
|
||||
virtual bool process(Gamepad * gamepad);
|
||||
virtual void initializeAux();
|
||||
virtual void processAux();
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen);
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
virtual void setup() = 0;
|
||||
virtual void process() = 0;
|
||||
virtual void preprocess() = 0;
|
||||
virtual void postprocess(bool) = 0;
|
||||
virtual std::string name() = 0;
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,7 @@ public:
|
||||
* addon allows its pin assignments to be changed, in which case it needs to rebuild
|
||||
* its pin masks, as is needed for DDI and sliders.
|
||||
*/
|
||||
virtual void reinit() { }
|
||||
virtual void reinit() = 0;
|
||||
|
||||
// For add-ons that require a USB-host listener, get listener
|
||||
virtual USBListener * getListener() { return listener; }
|
||||
|
||||
@@ -27,7 +27,7 @@ class GPDriver {
|
||||
public:
|
||||
virtual void initialize() = 0;
|
||||
virtual void initializeAux() = 0;
|
||||
virtual void process(Gamepad * gamepad) = 0;
|
||||
virtual bool process(Gamepad * gamepad) = 0;
|
||||
virtual void processAux() = 0;
|
||||
virtual uint16_t get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen) = 0;
|
||||
virtual void set_report(uint8_t report_id, hid_report_type_t report_type, uint8_t const *buffer, uint16_t bufsize) = 0;
|
||||
|
||||
@@ -541,16 +541,16 @@ message BuzzerOptions
|
||||
|
||||
message ExtraButtonOptions
|
||||
{
|
||||
optional bool enabled = 1;
|
||||
optional bool enabled = 1 [deprecated = true];
|
||||
|
||||
optional int32 pin = 2;
|
||||
optional uint32 buttonMap = 3;
|
||||
optional int32 pin = 2 [deprecated = true];
|
||||
optional uint32 buttonMap = 3 [deprecated = true];
|
||||
}
|
||||
|
||||
message PlayerNumberOptions
|
||||
{
|
||||
optional bool enabled = 1;
|
||||
optional uint32 number = 2;
|
||||
optional bool enabled = 1 [deprecated = true];
|
||||
optional uint32 number = 2 [deprecated = true];
|
||||
}
|
||||
|
||||
message PS4Options
|
||||
@@ -836,7 +836,7 @@ message AddonOptions
|
||||
optional DualDirectionalOptions dualDirectionalOptions = 8;
|
||||
optional BuzzerOptions buzzerOptions = 9;
|
||||
optional ExtraButtonOptions deprecatedExtraButtonOptions = 10 [deprecated = true];
|
||||
optional PlayerNumberOptions playerNumberOptions = 11;
|
||||
optional PlayerNumberOptions playerNumberOptions = 11 [deprecated = true];
|
||||
optional PS4Options ps4Options = 12 [(nanopb).disallow_export = true];
|
||||
optional WiiOptions wiiOptions = 13;
|
||||
optional SOCDSliderOptions socdSliderOptions = 14;
|
||||
|
||||
@@ -93,8 +93,8 @@ enum SplashMode
|
||||
option (nanopb_enumopt).long_names = false;
|
||||
|
||||
SPLASH_MODE_STATIC = 0;
|
||||
SPLASH_MODE_CLOSEIN = 1;
|
||||
SPLASH_MODE_CLOSEINCUSTOM = 2;
|
||||
SPLASH_MODE_RESERVED_01 = 1;
|
||||
SPLASH_MODE_RESERVED_02 = 2;
|
||||
SPLASH_MODE_NONE = 3;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#include "addonmanager.h"
|
||||
#include "usbhostmanager.h"
|
||||
|
||||
bool AddonManager::LoadAddon(GPAddon* addon, ADDON_PROCESS processAt) {
|
||||
bool AddonManager::LoadAddon(GPAddon* addon) {
|
||||
if (addon->available()) {
|
||||
AddonBlock * block = new AddonBlock;
|
||||
addon->setup();
|
||||
block->ptr = addon;
|
||||
block->process = processAt;
|
||||
addons.push_back(block);
|
||||
return true;
|
||||
} else {
|
||||
@@ -16,34 +15,38 @@ bool AddonManager::LoadAddon(GPAddon* addon, ADDON_PROCESS processAt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AddonManager::LoadUSBAddon(GPAddon* addon, ADDON_PROCESS processAt) {
|
||||
bool ret = LoadAddon(addon, processAt);
|
||||
bool AddonManager::LoadUSBAddon(GPAddon* addon) {
|
||||
bool ret = LoadAddon(addon);
|
||||
if ( ret == true )
|
||||
USBHostManager::getInstance().pushListener(addon->getListener());
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AddonManager::ReinitializeAddons(ADDON_PROCESS processType) {
|
||||
void AddonManager::ReinitializeAddons() {
|
||||
// Loop through all addons and process any that match our type
|
||||
for (std::vector<AddonBlock*>::iterator it = addons.begin(); it != addons.end(); it++) {
|
||||
if ( (*it)->process == processType )
|
||||
(*it)->ptr->reinit();
|
||||
(*it)->ptr->reinit();
|
||||
}
|
||||
}
|
||||
|
||||
void AddonManager::PreprocessAddons(ADDON_PROCESS processType) {
|
||||
void AddonManager::PreprocessAddons() {
|
||||
// Loop through all addons and process any that match our type
|
||||
for (std::vector<AddonBlock*>::iterator it = addons.begin(); it != addons.end(); it++) {
|
||||
if ( (*it)->process == processType )
|
||||
(*it)->ptr->preprocess();
|
||||
(*it)->ptr->preprocess();
|
||||
}
|
||||
}
|
||||
|
||||
void AddonManager::ProcessAddons(ADDON_PROCESS processType) {
|
||||
void AddonManager::ProcessAddons() {
|
||||
// Loop through all addons and process any that match our type
|
||||
for (std::vector<AddonBlock*>::iterator it = addons.begin(); it != addons.end(); it++) {
|
||||
if ( (*it)->process == processType )
|
||||
(*it)->ptr->process();
|
||||
(*it)->ptr->process();
|
||||
}
|
||||
}
|
||||
|
||||
void AddonManager::PostprocessAddons(bool reportSent) {
|
||||
// Loop through all addons and process any that match our type
|
||||
for (std::vector<AddonBlock*>::iterator it = addons.begin(); it != addons.end(); it++) {
|
||||
(*it)->ptr->postprocess(reportSent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "enums.h"
|
||||
#include "storagemanager.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "bitmaps.h"
|
||||
|
||||
#include "drivermanager.h"
|
||||
#include "usbdriver.h"
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
#include "addons/playernum.h"
|
||||
#include "storagemanager.h"
|
||||
#include "system.h"
|
||||
#include "helper.h"
|
||||
#include "config.pb.h"
|
||||
#include "device/usbd.h"
|
||||
|
||||
// Move to Proto Enums
|
||||
typedef enum
|
||||
{
|
||||
XINPUT_PLED_OFF = 0x00, // All off
|
||||
XINPUT_PLED_BLINKALL = 0x01, // All blinking
|
||||
XINPUT_PLED_FLASH1 = 0x02, // 1 flashes, then on
|
||||
XINPUT_PLED_FLASH2 = 0x03, // 2 flashes, then on
|
||||
XINPUT_PLED_FLASH3 = 0x04, // 3 flashes, then on
|
||||
XINPUT_PLED_FLASH4 = 0x05, // 4 flashes, then on
|
||||
XINPUT_PLED_ON1 = 0x06, // 1 on
|
||||
XINPUT_PLED_ON2 = 0x07, // 2 on
|
||||
XINPUT_PLED_ON3 = 0x08, // 3 on
|
||||
XINPUT_PLED_ON4 = 0x09, // 4 on
|
||||
XINPUT_PLED_ROTATE = 0x0A, // Rotating (e.g. 1-2-4-3)
|
||||
XINPUT_PLED_BLINK = 0x0B, // Blinking*
|
||||
XINPUT_PLED_SLOWBLINK = 0x0C, // Slow blinking*
|
||||
XINPUT_PLED_ALTERNATE = 0x0D, // Alternating (e.g. 1+4-2+3), then back to previous*
|
||||
} XInputPLEDPattern;
|
||||
|
||||
bool PlayerNumAddon::available() {
|
||||
return Storage::getInstance().getAddonOptions().playerNumberOptions.enabled;
|
||||
}
|
||||
|
||||
void PlayerNumAddon::setup() {
|
||||
const PlayerNumberOptions& options = Storage::getInstance().getAddonOptions().playerNumberOptions;
|
||||
|
||||
xinputIDs[0] = XINPUT_PLED_ON1;
|
||||
xinputIDs[1] = XINPUT_PLED_ON2;
|
||||
xinputIDs[2] = XINPUT_PLED_ON3;
|
||||
xinputIDs[3] = XINPUT_PLED_ON4;
|
||||
playerNum = options.number;
|
||||
if ( playerNum < 1 || playerNum > 4 ) {
|
||||
playerNum = 1; // error checking, set to 1 if we're off
|
||||
}
|
||||
assigned = 0; // what player ID did we get assigned to
|
||||
}
|
||||
|
||||
void PlayerNumAddon::process()
|
||||
{
|
||||
if ( assigned == 0 ) {
|
||||
Gamepad * gamepad = Storage::getInstance().GetGamepad();
|
||||
InputMode inputMode = static_cast<InputMode>(gamepad->getOptions().inputMode);
|
||||
if ( inputMode == INPUT_MODE_XINPUT ) {
|
||||
if (gamepad->auxState.playerID.enabled && gamepad->auxState.playerID.active) {
|
||||
if ( gamepad->auxState.playerID.value != 0 )
|
||||
handleLED(gamepad->auxState.playerID.value);
|
||||
}
|
||||
} else {
|
||||
assigned = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerNumAddon::handleLED(int num) {
|
||||
if ( playerNum != num ) {
|
||||
tud_disconnect();
|
||||
sleep_ms(2000 * playerNum);
|
||||
System::reboot(System::BootMode::GAMEPAD);
|
||||
} else {
|
||||
assigned = 1;
|
||||
}
|
||||
}
|
||||
@@ -37,12 +37,10 @@ bool TurboInput::available() {
|
||||
return Storage::getInstance().getAddonOptions().turboOptions.enabled && (hasTurboAssigned == true);
|
||||
}
|
||||
|
||||
void TurboInput::setup()
|
||||
{
|
||||
void TurboInput::setup(){
|
||||
const TurboOptions& options = Storage::getInstance().getAddonOptions().turboOptions;
|
||||
uint32_t now = getMillis();
|
||||
|
||||
|
||||
// Turbo Dial
|
||||
uint8_t shotCount = std::clamp<uint8_t>(options.shotCount, TURBO_SHOT_MIN, TURBO_SHOT_MAX);
|
||||
if (isValidPin(options.shmupDialPin)) {
|
||||
@@ -237,13 +235,11 @@ void TurboInput::process()
|
||||
}
|
||||
}
|
||||
|
||||
void TurboInput::updateInterval(uint8_t shotCount)
|
||||
{
|
||||
void TurboInput::updateInterval(uint8_t shotCount) {
|
||||
uIntervalUS = (uint32_t)std::floor(1000000.0 / (shotCount * 2));
|
||||
}
|
||||
|
||||
void TurboInput::updateTurboShotCount(uint8_t shotCount)
|
||||
{
|
||||
void TurboInput::updateTurboShotCount(uint8_t shotCount) {
|
||||
TurboOptions& options = Storage::getInstance().getAddonOptions().turboOptions;
|
||||
shotCount = std::clamp<uint8_t>(shotCount, TURBO_SHOT_MIN, TURBO_SHOT_MAX);
|
||||
if (shotCount != options.shotCount) {
|
||||
|
||||
@@ -265,7 +265,6 @@ namespace ConfigLegacy
|
||||
uint32_t extraButtonMap;
|
||||
uint8_t buzzerPin;
|
||||
uint8_t buzzerVolume;
|
||||
uint8_t playerNumber;
|
||||
uint8_t shmupMode; // Turbo SHMUP Mode
|
||||
uint8_t shmupMixMode; // How we mix turbo and non-turbo buttons
|
||||
uint16_t shmupAlwaysOn1;
|
||||
@@ -1008,11 +1007,6 @@ bool ConfigUtils::fromLegacyStorage(Config& config)
|
||||
SET_PROPERTY(analogADS1219Options, deprecatedI2cAddress, legacyAddonOptions.i2cAnalog1219Address);
|
||||
SET_PROPERTY(analogADS1219Options, deprecatedI2cSpeed, legacyAddonOptions.i2cAnalog1219Speed);
|
||||
|
||||
PlayerNumberOptions& playerNumberOptions = config.addonOptions.playerNumberOptions;
|
||||
config.addonOptions.has_playerNumberOptions = true;
|
||||
SET_PROPERTY(playerNumberOptions, enabled, legacyAddonOptions.PlayerNumAddonEnabled);
|
||||
SET_PROPERTY(playerNumberOptions, number, legacyAddonOptions.playerNumber);
|
||||
|
||||
ReverseOptions& reverseOptions = config.addonOptions.reverseOptions;
|
||||
config.addonOptions.has_reverseOptions = true;
|
||||
SET_PROPERTY(reverseOptions, enabled, legacyAddonOptions.ReverseInputEnabled);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "addons/display.h"
|
||||
#include "addons/keyboard_host.h"
|
||||
#include "addons/neopicoleds.h"
|
||||
#include "addons/playernum.h"
|
||||
#include "addons/pleds.h"
|
||||
#include "addons/reactiveleds.h"
|
||||
#include "addons/reverse.h"
|
||||
@@ -691,10 +690,6 @@ void ConfigUtils::initUnsetPropertiesWithDefaults(Config& config)
|
||||
INIT_UNSET_PROPERTY(config.addonOptions.buzzerOptions, volume, BUZZER_VOLUME);
|
||||
INIT_UNSET_PROPERTY(config.addonOptions.buzzerOptions, enablePin, BUZZER_ENABLE_PIN);
|
||||
|
||||
// addonOptions.playerNumberOptions
|
||||
INIT_UNSET_PROPERTY(config.addonOptions.playerNumberOptions, enabled, !!PLAYERNUM_ADDON_ENABLED);
|
||||
INIT_UNSET_PROPERTY(config.addonOptions.playerNumberOptions, number, PLAYER_NUMBER);
|
||||
|
||||
// addonOptions.ps4Options
|
||||
INIT_UNSET_PROPERTY_BYTES(config.addonOptions.ps4Options, serial, emptyByteArray);
|
||||
INIT_UNSET_PROPERTY_BYTES(config.addonOptions.ps4Options, signature, emptyByteArray);
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
#include "lwip/mem.h"
|
||||
#include "addons/input_macro.h"
|
||||
|
||||
#include "bitmaps.h"
|
||||
|
||||
#define PATH_CGI_ACTION "/cgi/action"
|
||||
|
||||
#define LWIP_HTTPD_POST_MAX_PAYLOAD_LEN (1024 * 16)
|
||||
@@ -1561,10 +1559,6 @@ std::string setAddonOptions()
|
||||
AnalogADS1219Options& analogADS1219Options = Storage::getInstance().getAddonOptions().analogADS1219Options;
|
||||
docToValue(analogADS1219Options.enabled, doc, "I2CAnalog1219InputEnabled");
|
||||
|
||||
PlayerNumberOptions& playerNumberOptions = Storage::getInstance().getAddonOptions().playerNumberOptions;
|
||||
docToValue(playerNumberOptions.number, doc, "playerNumber");
|
||||
docToValue(playerNumberOptions.enabled, doc, "PlayerNumAddonEnabled");
|
||||
|
||||
ReverseOptions& reverseOptions = Storage::getInstance().getAddonOptions().reverseOptions;
|
||||
docToValue(reverseOptions.enabled, doc, "ReverseInputEnabled");
|
||||
docToPin(reverseOptions.ledPin, doc, "reversePinLED");
|
||||
@@ -1979,10 +1973,6 @@ std::string getAddonOptions()
|
||||
const AnalogADS1219Options& analogADS1219Options = Storage::getInstance().getAddonOptions().analogADS1219Options;
|
||||
writeDoc(doc, "I2CAnalog1219InputEnabled", analogADS1219Options.enabled);
|
||||
|
||||
const PlayerNumberOptions& playerNumberOptions = Storage::getInstance().getAddonOptions().playerNumberOptions;
|
||||
writeDoc(doc, "playerNumber", playerNumberOptions.number);
|
||||
writeDoc(doc, "PlayerNumAddonEnabled", playerNumberOptions.enabled);
|
||||
|
||||
const ReverseOptions& reverseOptions = Storage::getInstance().getAddonOptions().reverseOptions;
|
||||
writeDoc(doc, "reversePinLED", cleanPin(reverseOptions.ledPin));
|
||||
writeDoc(doc, "reverseActionUp", reverseOptions.actionUp);
|
||||
|
||||
@@ -117,7 +117,7 @@ void DisplaySaverScreen::drawBounceScene() {
|
||||
|
||||
if (bounceSpriteY <= 0 || bounceSpriteY + scaledHeight >= SCREEN_HEIGHT) bounceSpriteVelocityY = -bounceSpriteVelocityY;
|
||||
|
||||
getRenderer()->drawSprite((uint8_t *)bootLogoBottom, bounceSpriteWidth, bounceSpriteHeight, 0, bounceSpriteX, bounceSpriteY, 0, bounceScale);
|
||||
getRenderer()->drawSprite((uint8_t *)getDisplayOptions().splashImage.bytes, bounceSpriteWidth, bounceSpriteHeight, 0, bounceSpriteX, bounceSpriteY, 0, bounceScale);
|
||||
}
|
||||
|
||||
void DisplaySaverScreen::drawPipeScene() {
|
||||
@@ -159,14 +159,11 @@ void DisplaySaverScreen::drawPipeScene() {
|
||||
|
||||
void DisplaySaverScreen::initToasters() {
|
||||
for (uint16_t i = 0; i < numberOfToasters; ++i) {
|
||||
double scale = (static_cast<double>(rand()) / RAND_MAX);
|
||||
double scale = 1.0 / ((i/2)+2);
|
||||
int16_t dx = (-1 - rand() % 3);
|
||||
int16_t dy = (1 + rand() % 3);
|
||||
|
||||
toasters.push_back({
|
||||
(uint8_t *)bootLogoTop,
|
||||
toasterSpriteWidth,
|
||||
toasterSpriteHeight,
|
||||
scale,
|
||||
static_cast<int16_t>(SCREEN_WIDTH - toasterSpriteWidth * scale),
|
||||
static_cast<int16_t>(rand() % (SCREEN_HEIGHT - static_cast<int16_t>(toasterSpriteHeight * scale))),
|
||||
@@ -180,14 +177,16 @@ void DisplaySaverScreen::drawToasterScene() {
|
||||
for (uint16_t i = 0; i < toasters.size(); ++i) {
|
||||
ToastParams& sprite = toasters[i];
|
||||
|
||||
getRenderer()->drawSprite(sprite.image, sprite.width, sprite.height, 0, sprite.x, sprite.y, 0, sprite.scale);
|
||||
getRenderer()->drawSprite((uint8_t *) getDisplayOptions().splashImage.bytes, toasterSpriteWidth, toasterSpriteHeight, 0, sprite.x, sprite.y, 0, sprite.scale);
|
||||
|
||||
sprite.x += sprite.dx;
|
||||
sprite.y += sprite.dy;
|
||||
|
||||
if (sprite.x + sprite.width * sprite.scale < 0) {
|
||||
if (sprite.x + toasterSpriteWidth * sprite.scale < 0) {
|
||||
sprite.x = SCREEN_WIDTH;
|
||||
sprite.y = rand() % (SCREEN_HEIGHT - static_cast<int16_t>(sprite.height * sprite.scale));
|
||||
sprite.y = rand() % (SCREEN_HEIGHT - static_cast<int16_t>(toasterSpriteHeight * sprite.scale));
|
||||
sprite.dx = (-1 - rand() % 3);
|
||||
sprite.dy = (1 + rand() % 3);
|
||||
}
|
||||
|
||||
if (sprite.y > SCREEN_HEIGHT) {
|
||||
|
||||
@@ -14,8 +14,8 @@ void RestartScreen::shutdown() {
|
||||
}
|
||||
|
||||
void RestartScreen::drawScreen() {
|
||||
getRenderer()->drawSprite((uint8_t *)bootLogoBottom, 128, 35, 10, 0, 2, 1);
|
||||
|
||||
getRenderer()->drawText(1, 1, "....:GP2040-CE:....");
|
||||
|
||||
switch ((System::BootMode)this->bootMode) {
|
||||
case System::BootMode::USB:
|
||||
getRenderer()->drawText(1, 6, "Rebooting to BOOTSEL");
|
||||
|
||||
@@ -16,26 +16,8 @@ void SplashScreen::drawScreen() {
|
||||
if (getDisplayOptions().splashMode == static_cast<SplashMode>(SPLASH_MODE_NONE)) {
|
||||
getRenderer()->drawText(0, 4, " Splash NOT enabled.");
|
||||
} else {
|
||||
int splashMode = getDisplayOptions().splashMode;
|
||||
int splashSpeed = 40;
|
||||
if (splashMode == SPLASH_MODE_STATIC) {
|
||||
// Default, display static or custom image
|
||||
getRenderer()->drawSprite((uint8_t*) getDisplayOptions().splashImage.bytes, 128, 64, 16, 0, 0, 1);
|
||||
} else if (splashMode == SPLASH_MODE_CLOSEIN) {
|
||||
// Close-in. Animate the GP2040 logo
|
||||
int timeMS = getMillis();
|
||||
getRenderer()->drawSprite((uint8_t *)bootLogoTop, 43, 39, 6, 43, std::min<int>((timeMS / splashSpeed) - 39, 0), 1);
|
||||
getRenderer()->drawSprite((uint8_t *)bootLogoBottom, 128, 35, 10, 0, std::max<int>(64 - (timeMS / (splashSpeed * 2)), 30), 1);
|
||||
} else if (splashMode == SPLASH_MODE_CLOSEINCUSTOM) {
|
||||
// Close-in on custom image or delayed close-in if custom image does not exist
|
||||
getRenderer()->drawSprite((uint8_t*) getDisplayOptions().splashImage.bytes, 128, 64, 16, 0, 0, 1);
|
||||
int timeMS = getMillis();
|
||||
if (timeMS > 1000) {
|
||||
int offsetMS = timeMS - 1000;
|
||||
getRenderer()->drawRectangle(0, 63, 127, 62 - (offsetMS / (splashSpeed * 2)), 0, 1);
|
||||
getRenderer()->drawSprite((uint8_t *)bootLogoBottom, 128, 35, 10, 0, std::max<int>(64 - (timeMS / splashSpeed), 20), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ void AstroDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void AstroDriver::process(Gamepad * gamepad) {
|
||||
bool AstroDriver::process(Gamepad * gamepad) {
|
||||
astroReport.lx = 0x7f;
|
||||
astroReport.ly = 0x7f;
|
||||
|
||||
@@ -65,8 +65,10 @@ void AstroDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -21,7 +21,7 @@ void EgretDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void EgretDriver::process(Gamepad * gamepad) {
|
||||
bool EgretDriver::process(Gamepad * gamepad) {
|
||||
switch (gamepad->state.dpad & GAMEPAD_MASK_DPAD)
|
||||
{
|
||||
case GAMEPAD_MASK_UP: egretReport.lx = EGRET_JOYSTICK_MID; egretReport.ly = EGRET_JOYSTICK_MIN; break;
|
||||
@@ -58,8 +58,10 @@ void EgretDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -35,7 +35,7 @@ void HIDDriver::initialize() {
|
||||
}
|
||||
|
||||
// Generate HID report from gamepad and send to TUSB Device
|
||||
void HIDDriver::process(Gamepad * gamepad) {
|
||||
bool HIDDriver::process(Gamepad * gamepad) {
|
||||
switch (gamepad->state.dpad & GAMEPAD_MASK_DPAD)
|
||||
{
|
||||
case GAMEPAD_MASK_UP: hidReport.direction = HID_HAT_UP; break;
|
||||
@@ -104,8 +104,11 @@ void HIDDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -57,7 +57,7 @@ uint8_t KeyboardDriver::getMultimedia(uint8_t code) {
|
||||
}
|
||||
|
||||
|
||||
void KeyboardDriver::process(Gamepad * gamepad) {
|
||||
bool KeyboardDriver::process(Gamepad * gamepad) {
|
||||
const KeyboardMapping& keyboardMapping = Storage::getInstance().getKeyboardMapping();
|
||||
releaseAllKeys();
|
||||
if(gamepad->pressedUp()) { pressKey(keyboardMapping.keyDpadUp); }
|
||||
@@ -128,9 +128,12 @@ void KeyboardDriver::process(Gamepad * gamepad) {
|
||||
} else if ( volumeChange < 0 ) {
|
||||
volumeChange++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void KeyboardDriver::pressKey(uint8_t code) {
|
||||
|
||||
@@ -25,7 +25,7 @@ void MDMiniDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void MDMiniDriver::process(Gamepad * gamepad) {
|
||||
bool MDMiniDriver::process(Gamepad * gamepad) {
|
||||
mdminiReport.lx = 0x7f;
|
||||
mdminiReport.ly = 0x7f;
|
||||
|
||||
@@ -56,8 +56,11 @@ void MDMiniDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -38,7 +38,7 @@ void NeoGeoDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void NeoGeoDriver::process(Gamepad * gamepad) {
|
||||
bool NeoGeoDriver::process(Gamepad * gamepad) {
|
||||
switch (gamepad->state.dpad & GAMEPAD_MASK_DPAD)
|
||||
{
|
||||
case GAMEPAD_MASK_UP: neogeoReport.hat = NEOGEO_HAT_UP; break;
|
||||
@@ -77,8 +77,11 @@ void NeoGeoDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -56,7 +56,7 @@ void NetDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void NetDriver::process(Gamepad * gamepad) {}
|
||||
bool NetDriver::process(Gamepad * gamepad) {return false;}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
uint16_t NetDriver::get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen) {
|
||||
|
||||
@@ -25,7 +25,7 @@ void PCEngineDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void PCEngineDriver::process(Gamepad * gamepad) {
|
||||
bool PCEngineDriver::process(Gamepad * gamepad) {
|
||||
switch (gamepad->state.dpad & GAMEPAD_MASK_DPAD)
|
||||
{
|
||||
case GAMEPAD_MASK_UP: pcengineReport.hat = PCENGINE_HAT_UP; break;
|
||||
@@ -57,8 +57,10 @@ void PCEngineDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -65,7 +65,7 @@ void PS3Driver::initialize() {
|
||||
}
|
||||
|
||||
// Generate PS3 report from gamepad and send to TUSB Device
|
||||
void PS3Driver::process(Gamepad * gamepad) {
|
||||
bool PS3Driver::process(Gamepad * gamepad) {
|
||||
ps3Report.dpad_left = gamepad->pressedLeft();
|
||||
ps3Report.dpad_down = gamepad->pressedDown();
|
||||
ps3Report.dpad_right = gamepad->pressedRight();
|
||||
@@ -133,6 +133,7 @@ void PS3Driver::process(Gamepad * gamepad) {
|
||||
if (tud_suspended())
|
||||
tud_remote_wakeup();
|
||||
|
||||
bool reportSent = false;
|
||||
void * report = &ps3Report;
|
||||
uint16_t report_size = sizeof(ps3Report);
|
||||
if (memcmp(last_report, report, report_size) != 0)
|
||||
@@ -140,6 +141,7 @@ void PS3Driver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
reportSent = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,6 +164,8 @@ void PS3Driver::process(Gamepad * gamepad) {
|
||||
gamepad->auxState.playerID.ledValue = ps3Features.playerLED;
|
||||
gamepad->auxState.playerID.value = (ps3Features.playerLED & 0x0F);
|
||||
}
|
||||
|
||||
return reportSent;
|
||||
}
|
||||
|
||||
// unknown
|
||||
|
||||
@@ -161,7 +161,7 @@ void PS4Driver::initializeAux() {
|
||||
}
|
||||
}
|
||||
|
||||
void PS4Driver::process(Gamepad * gamepad) {
|
||||
bool PS4Driver::process(Gamepad * gamepad) {
|
||||
const GamepadOptions & options = gamepad->getOptions();
|
||||
switch (gamepad->state.dpad & GAMEPAD_MASK_DPAD)
|
||||
{
|
||||
@@ -272,6 +272,8 @@ void PS4Driver::process(Gamepad * gamepad) {
|
||||
if (tud_suspended())
|
||||
tud_remote_wakeup();
|
||||
|
||||
bool reportSent = false;
|
||||
|
||||
uint32_t now = to_ms_since_boot(get_absolute_time());
|
||||
void * report = &ps4Report;
|
||||
uint16_t report_size = sizeof(ps4Report);
|
||||
@@ -280,6 +282,7 @@ void PS4Driver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
reportSent = true;
|
||||
}
|
||||
// keep track of our last successful report, for keepalive purposes
|
||||
last_report_timer = now;
|
||||
@@ -342,6 +345,8 @@ void PS4Driver::process(Gamepad * gamepad) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reportSent;
|
||||
}
|
||||
|
||||
// Called by Core1, PS4 key signing will lock the CPU
|
||||
|
||||
@@ -19,7 +19,7 @@ void PSClassicDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void PSClassicDriver::process(Gamepad * gamepad) {
|
||||
bool PSClassicDriver::process(Gamepad * gamepad) {
|
||||
psClassicReport.buttons = PSCLASSIC_MASK_CENTER;
|
||||
|
||||
switch (gamepad->state.dpad & GAMEPAD_MASK_DPAD)
|
||||
@@ -58,8 +58,10 @@ void PSClassicDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -25,7 +25,7 @@ void SwitchDriver::initialize() {
|
||||
};
|
||||
}
|
||||
|
||||
void SwitchDriver::process(Gamepad * gamepad) {
|
||||
bool SwitchDriver::process(Gamepad * gamepad) {
|
||||
switch (gamepad->state.dpad & GAMEPAD_MASK_DPAD)
|
||||
{
|
||||
case GAMEPAD_MASK_UP: switchReport.hat = SWITCH_HAT_UP; break;
|
||||
@@ -71,8 +71,10 @@ void SwitchDriver::process(Gamepad * gamepad) {
|
||||
// HID ready + report sent, copy previous report
|
||||
if (tud_hid_ready() && tud_hid_report(0, report, report_size) == true ) {
|
||||
memcpy(last_report, report, report_size);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -385,10 +385,10 @@ USBListener * XBOneDriver::get_usb_auth_listener() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void XBOneDriver::process(Gamepad * gamepad) {
|
||||
bool XBOneDriver::process(Gamepad * gamepad) {
|
||||
// Do nothing if we couldn't setup our auth listener
|
||||
if ( xboxOneAuthData == nullptr) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t xboneReportSize = 0;
|
||||
@@ -410,7 +410,7 @@ void XBOneDriver::process(Gamepad * gamepad) {
|
||||
memcpy((void*)&((uint8_t*)&xboneReport)[4], xboneIdle, sizeof(xboneIdle));
|
||||
xboneReportSize = sizeof(XboxOneGamepad_Data_t);
|
||||
send_xbone_usb((uint8_t*)&xboneReport, xboneReportSize);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t now = to_ms_since_boot(get_absolute_time());
|
||||
@@ -429,7 +429,7 @@ void XBOneDriver::process(Gamepad * gamepad) {
|
||||
if ( keep_alive_sequence == 0 )
|
||||
keep_alive_sequence = 1;
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Virtual Keycode for Guide Button
|
||||
@@ -460,7 +460,7 @@ void XBOneDriver::process(Gamepad * gamepad) {
|
||||
virtual_keycode_sequence = new_sequence;
|
||||
xb1_guide_pressed = !xb1_guide_pressed;
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only change xbox one input report if we have different inputs!
|
||||
@@ -518,9 +518,12 @@ void XBOneDriver::process(Gamepad * gamepad) {
|
||||
if (last_report_counter == 0)
|
||||
last_report_counter = 1;
|
||||
memcpy(last_report, &xboneReport, xboneReportSize);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void XBOneDriver::processAux() {
|
||||
|
||||
@@ -23,7 +23,7 @@ void XboxOriginalDriver::initialize() {
|
||||
memcpy(&class_driver, xid_get_driver(), sizeof(usbd_class_driver_t));
|
||||
}
|
||||
|
||||
void XboxOriginalDriver::process(Gamepad * gamepad) {
|
||||
bool XboxOriginalDriver::process(Gamepad * gamepad) {
|
||||
// digital buttons
|
||||
xboxOriginalReport.dButtons = 0
|
||||
| (gamepad->pressedUp() ? XID_DUP : 0)
|
||||
@@ -62,10 +62,12 @@ void XboxOriginalDriver::process(Gamepad * gamepad) {
|
||||
if (tud_suspended())
|
||||
tud_remote_wakeup();
|
||||
|
||||
bool reportSent = false;
|
||||
uint8_t xIndex = xid_get_index_by_type(0, XID_TYPE_GAMECONTROLLER);
|
||||
if (memcmp(last_report, &xboxOriginalReport, sizeof(XboxOriginalReport)) != 0) {
|
||||
if ( xid_send_report(xIndex, &xboxOriginalReport, sizeof(XboxOriginalReport)) == true ) {
|
||||
memcpy(last_report, &xboxOriginalReport, sizeof(XboxOriginalReport));
|
||||
reportSent = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +86,8 @@ void XboxOriginalDriver::process(Gamepad * gamepad) {
|
||||
gamepad->auxState.haptics.rightActuator.intensity = rightValue;
|
||||
}
|
||||
}
|
||||
|
||||
return reportSent;
|
||||
}
|
||||
|
||||
// tud_hid_get_report_cb
|
||||
|
||||
@@ -177,7 +177,7 @@ bool XInputDriver::getAuthEnabled() {
|
||||
return (xAuthDriver != nullptr);
|
||||
}
|
||||
|
||||
void XInputDriver::process(Gamepad * gamepad) {
|
||||
bool XInputDriver::process(Gamepad * gamepad) {
|
||||
Gamepad * processedGamepad = Storage::getInstance().GetProcessedGamepad();
|
||||
|
||||
xinputReport.buttons1 = 0
|
||||
@@ -217,6 +217,8 @@ void XInputDriver::process(Gamepad * gamepad) {
|
||||
xinputReport.rt = gamepad->pressedR2() ? 0xFF : 0;
|
||||
}
|
||||
|
||||
bool reportSent = false;
|
||||
|
||||
// compare against previous report and send new
|
||||
if ( memcmp(last_report, &xinputReport, sizeof(XInputReport)) != 0) {
|
||||
if ( tud_ready() && // Is the device ready?
|
||||
@@ -226,6 +228,7 @@ void XInputDriver::process(Gamepad * gamepad) {
|
||||
usbd_edpt_xfer(0, endpoint_in, (uint8_t *)&xinputReport, sizeof(XInputReport)); // Send report buffer
|
||||
usbd_edpt_release(0, endpoint_in); // Release control of IN endpoint
|
||||
memcpy(last_report, &xinputReport, sizeof(XInputReport)); // save if we sent it
|
||||
reportSent = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,6 +279,8 @@ void XInputDriver::process(Gamepad * gamepad) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return reportSent;
|
||||
}
|
||||
|
||||
void XInputDriver::processAux() {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "addons/tilt.h"
|
||||
#include "addons/keyboard_host.h"
|
||||
#include "addons/i2canalog1219.h"
|
||||
#include "addons/playernum.h"
|
||||
#include "addons/reverse.h"
|
||||
#include "addons/turbo.h"
|
||||
#include "addons/slider_socd.h"
|
||||
@@ -94,26 +93,25 @@ void GP2040::setup() {
|
||||
adc_init();
|
||||
|
||||
// Setup Add-ons
|
||||
addons.LoadUSBAddon(new KeyboardHostAddon(), CORE0_INPUT);
|
||||
addons.LoadUSBAddon(new GamepadUSBHostAddon(), CORE0_INPUT);
|
||||
addons.LoadAddon(new AnalogInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new BootselButtonAddon(), CORE0_INPUT);
|
||||
addons.LoadAddon(new DualDirectionalInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new FocusModeAddon(), CORE0_INPUT);
|
||||
addons.LoadAddon(new I2CAnalog1219Input(), CORE0_INPUT);
|
||||
addons.LoadAddon(new SPIAnalog1256Input(), CORE0_INPUT);
|
||||
addons.LoadAddon(new WiiExtensionInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new SNESpadInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new PlayerNumAddon(), CORE0_USBREPORT);
|
||||
addons.LoadAddon(new SliderSOCDInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new TiltInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new RotaryEncoderInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new PCF8575Addon(), CORE0_INPUT);
|
||||
addons.LoadUSBAddon(new KeyboardHostAddon());
|
||||
addons.LoadUSBAddon(new GamepadUSBHostAddon());
|
||||
addons.LoadAddon(new AnalogInput());
|
||||
addons.LoadAddon(new BootselButtonAddon());
|
||||
addons.LoadAddon(new DualDirectionalInput());
|
||||
addons.LoadAddon(new FocusModeAddon());
|
||||
addons.LoadAddon(new I2CAnalog1219Input());
|
||||
addons.LoadAddon(new SPIAnalog1256Input());
|
||||
addons.LoadAddon(new WiiExtensionInput());
|
||||
addons.LoadAddon(new SNESpadInput());
|
||||
addons.LoadAddon(new SliderSOCDInput());
|
||||
addons.LoadAddon(new TiltInput());
|
||||
addons.LoadAddon(new RotaryEncoderInput());
|
||||
addons.LoadAddon(new PCF8575Addon());
|
||||
|
||||
// Input override addons
|
||||
addons.LoadAddon(new ReverseInput(), CORE0_INPUT);
|
||||
addons.LoadAddon(new TurboInput(), CORE0_INPUT); // Turbo overrides button states and should be close to the end
|
||||
addons.LoadAddon(new InputMacro(), CORE0_INPUT);
|
||||
addons.LoadAddon(new ReverseInput());
|
||||
addons.LoadAddon(new TurboInput()); // Turbo overrides button states and should be close to the end
|
||||
addons.LoadAddon(new InputMacro());
|
||||
|
||||
InputMode inputMode = gamepad->getOptions().inputMode;
|
||||
const BootAction bootAction = getBootAction();
|
||||
@@ -301,7 +299,7 @@ void GP2040::run() {
|
||||
USBHostManager::getInstance().process();
|
||||
|
||||
// Pre-Process add-ons for MPGS
|
||||
addons.PreprocessAddons(ADDON_PROCESS::CORE0_INPUT);
|
||||
addons.PreprocessAddons();
|
||||
|
||||
gamepad->hotkey(); // check for MPGS hotkeys
|
||||
rebootHotkeys.process(gamepad, configMode);
|
||||
@@ -309,7 +307,7 @@ void GP2040::run() {
|
||||
gamepad->process(); // process through MPGS
|
||||
|
||||
// (Post) Process for add-ons
|
||||
addons.ProcessAddons(ADDON_PROCESS::CORE0_INPUT);
|
||||
addons.ProcessAddons();
|
||||
|
||||
checkProcessedState(processedGamepad->state, gamepad->state);
|
||||
|
||||
@@ -317,13 +315,13 @@ void GP2040::run() {
|
||||
memcpy(&processedGamepad->state, &gamepad->state, sizeof(GamepadState));
|
||||
|
||||
// Process Input Driver
|
||||
inputDriver->process(gamepad);
|
||||
|
||||
// Process USB Report Addons
|
||||
addons.ProcessAddons(ADDON_PROCESS::CORE0_USBREPORT);
|
||||
bool processed = inputDriver->process(gamepad);
|
||||
|
||||
tud_task(); // TinyUSB Task update
|
||||
|
||||
// Post-Process Add-ons with USB Report Processed Sent
|
||||
addons.PostprocessAddons(processed);
|
||||
|
||||
if (rebootRequested) {
|
||||
rebootRequested = false;
|
||||
if (saveRequested) {
|
||||
@@ -365,7 +363,7 @@ void GP2040::getReinitGamepad(Gamepad * gamepad) {
|
||||
gamepad->reinit();
|
||||
// ...and addons on this core, if they implemented reinit (just things
|
||||
// with simple GPIO pin usage, at time of writing)
|
||||
addons.ReinitializeAddons(ADDON_PROCESS::CORE0_INPUT);
|
||||
addons.ReinitializeAddons();
|
||||
|
||||
// and we're done
|
||||
gamepad->userRequestedReinit = false;
|
||||
@@ -387,12 +385,12 @@ GP2040::BootAction GP2040::getBootAction() {
|
||||
gamepad->read();
|
||||
|
||||
// Pre-Process add-ons for MPGS
|
||||
addons.PreprocessAddons(ADDON_PROCESS::CORE0_INPUT);
|
||||
addons.PreprocessAddons();
|
||||
|
||||
gamepad->process(); // process through MPGS
|
||||
|
||||
// (Post) Process for add-ons
|
||||
addons.ProcessAddons(ADDON_PROCESS::CORE0_INPUT);
|
||||
// Process for add-ons
|
||||
addons.ProcessAddons();
|
||||
|
||||
// Copy Processed Gamepad for Core1 (race condition otherwise)
|
||||
memcpy(&processedGamepad->state, &gamepad->state, sizeof(GamepadState));
|
||||
|
||||
@@ -42,13 +42,13 @@ void GP2040Aux::setup() {
|
||||
}
|
||||
|
||||
// Setup Add-ons
|
||||
addons.LoadAddon(new DisplayAddon(), CORE1_LOOP);
|
||||
addons.LoadAddon(new NeoPicoLEDAddon(), CORE1_LOOP);
|
||||
addons.LoadAddon(new PlayerLEDAddon(), CORE1_LOOP);
|
||||
addons.LoadAddon(new BoardLedAddon(), CORE1_LOOP);
|
||||
addons.LoadAddon(new BuzzerSpeakerAddon(), CORE1_LOOP);
|
||||
addons.LoadAddon(new DRV8833RumbleAddon(), CORE1_LOOP);
|
||||
addons.LoadAddon(new ReactiveLEDAddon(), CORE1_LOOP);
|
||||
addons.LoadAddon(new DisplayAddon());
|
||||
addons.LoadAddon(new NeoPicoLEDAddon());
|
||||
addons.LoadAddon(new PlayerLEDAddon());
|
||||
addons.LoadAddon(new BoardLedAddon());
|
||||
addons.LoadAddon(new BuzzerSpeakerAddon());
|
||||
addons.LoadAddon(new DRV8833RumbleAddon());
|
||||
addons.LoadAddon(new ReactiveLEDAddon());
|
||||
|
||||
// Initialize our USB manager
|
||||
USBHostManager::getInstance().start();
|
||||
@@ -59,7 +59,9 @@ void GP2040Aux::setup() {
|
||||
|
||||
void GP2040Aux::run() {
|
||||
while (1) {
|
||||
addons.ProcessAddons(CORE1_LOOP);
|
||||
// Pre, Process, and Post
|
||||
addons.PreprocessAddons();
|
||||
addons.ProcessAddons();
|
||||
|
||||
// Run auxiliary functions for input driver on Core1
|
||||
if ( inputDriver != nullptr ) {
|
||||
|
||||
@@ -479,7 +479,6 @@ app.get('/api/getAddonsOptions', (req, res) => {
|
||||
focusModePin: -1,
|
||||
focusModeButtonLockMask: 0,
|
||||
focusModeButtonLockEnabled: 0,
|
||||
playerNumber: 1,
|
||||
shmupMode: 0,
|
||||
shmupMixMode: 0,
|
||||
shmupAlwaysOn1: 0,
|
||||
|
||||
@@ -31,10 +31,6 @@ import OnBoardLed, {
|
||||
onBoardLedScheme,
|
||||
onBoardLedState,
|
||||
} from '../Addons/OnBoardLed';
|
||||
import PlayerNumber, {
|
||||
playerNumberScheme,
|
||||
playerNumberState,
|
||||
} from '../Addons/PlayerNumber';
|
||||
import Reverse, { reverseScheme, reverseState } from '../Addons/Reverse';
|
||||
import SOCD, { socdScheme, socdState } from '../Addons/SOCD';
|
||||
import Tilt, { tiltScheme, tiltState } from '../Addons/Tilt';
|
||||
@@ -72,7 +68,6 @@ const schema = yup.object().shape({
|
||||
...dualDirectionScheme,
|
||||
...tiltScheme,
|
||||
...buzzerScheme,
|
||||
...playerNumberScheme,
|
||||
...socdScheme,
|
||||
...wiiScheme,
|
||||
...focusModeScheme,
|
||||
@@ -95,7 +90,6 @@ const defaultValues = {
|
||||
...dualDirectionState,
|
||||
...tiltState,
|
||||
...buzzerState,
|
||||
...playerNumberState,
|
||||
...socdState,
|
||||
...wiiState,
|
||||
...snesState,
|
||||
@@ -119,7 +113,6 @@ const ADDONS = [
|
||||
DualDirection,
|
||||
Tilt,
|
||||
Buzzer,
|
||||
PlayerNumber,
|
||||
SOCD,
|
||||
Wii,
|
||||
SNES,
|
||||
|
||||
@@ -19,8 +19,6 @@ const ON_OFF_OPTIONS = [
|
||||
|
||||
const SPLASH_MODES = [
|
||||
{ label: 'form.splash-modes.enabled', value: 0 }, // STATICSPLASH
|
||||
{ label: 'form.splash-modes.close-in', value: 1 }, // CLOSEIN
|
||||
{ label: 'form.splash-modes.close-in-custom', value: 2 }, // CLOSEINCUSTOM
|
||||
{ label: 'form.splash-modes.disabled', value: 3 }, // NOSPLASH
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user