Files
GP2040-CE/headers/addons/snes_input.h
Luke A 2b2e528f3c 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
2025-03-13 12:17:02 -04:00

68 lines
1.5 KiB
C++

#ifndef _SNESpadAddon_H
#define _SNESpadAddon_H
#include <string>
#include <stdint.h>
#include "BoardConfig.h"
#include "gpaddon.h"
#include "gamepad.h"
#include "storagemanager.h"
#include "SNESpad.h"
// SNESpad Module Name
#define SNESpadName "SNESpad"
#ifndef SNES_PAD_ENABLED
#define SNES_PAD_ENABLED 0
#endif
#ifndef SNES_PAD_LATCH_PIN
#define SNES_PAD_LATCH_PIN -1
#endif
#ifndef SNES_PAD_CLOCK_PIN
#define SNES_PAD_CLOCK_PIN -1
#endif
#ifndef SNES_PAD_DATA_PIN
#define SNES_PAD_DATA_PIN -1
#endif
class SNESpadInput : public GPAddon {
public:
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;
uint32_t nextTimer;
bool buttonA = false;
bool buttonB = false;
bool buttonX = false;
bool buttonY = false;
bool buttonL = false;
bool buttonR = false;
bool buttonSelect = false;
bool buttonStart = false;
bool dpadUp = false;
bool dpadDown = false;
bool dpadLeft = false;
bool dpadRight = false;
uint16_t leftX = 0;
uint16_t leftY = 0;
uint16_t rightX = 0;
uint16_t rightY = 0;
uint16_t map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);
};
#endif // _SNESpadAddon_H