2022-05-08 04:20:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Runtime/GCNTypes.hpp"
|
2022-05-08 08:50:21 +00:00
|
|
|
#include "Runtime/Streams/CInputStream.hpp"
|
|
|
|
#include "Runtime/Streams/COutputStream.hpp"
|
2022-05-08 04:20:52 +00:00
|
|
|
#include "aurora/pad.hpp"
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <chrono>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace metaforce {
|
|
|
|
class ImGuiControllerConfig {
|
|
|
|
struct Button {
|
2022-05-08 08:50:21 +00:00
|
|
|
s32 button = -1; // the SDL button this entry corresponds to
|
|
|
|
u32 uvX = 0; // Offset if icon image in atlas from left (in pixels)
|
|
|
|
u32 uvY = 0; // Offset if icon image in atlas from top (in pixels)
|
|
|
|
u32 width = 32; // Width of button image (in pixels)
|
|
|
|
u32 height = 32; // Height of button image (in pixels)
|
|
|
|
float offX = 0.f; // Offset from left of config window
|
|
|
|
float offY = 0.f; // Offset from top of config window
|
|
|
|
|
|
|
|
Button() = default;
|
|
|
|
explicit Button(CInputStream& in);
|
|
|
|
void PutTo(COutputStream& in) const;
|
2022-05-08 04:20:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-08 08:50:21 +00:00
|
|
|
struct ControllerAtlas {
|
2022-05-08 04:20:52 +00:00
|
|
|
std::string name;
|
2022-05-08 08:50:21 +00:00
|
|
|
std::vector<std::pair<u16, u16>> vidPids;
|
2022-05-08 04:20:52 +00:00
|
|
|
std::string atlasFile; // Path to atlas relative to controller definition
|
|
|
|
std::vector<Button> buttons;
|
2022-05-08 08:50:21 +00:00
|
|
|
|
|
|
|
ControllerAtlas() = default;
|
|
|
|
explicit ControllerAtlas(CInputStream& in);
|
|
|
|
void PutTo(COutputStream& out) const;
|
2022-05-08 04:20:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
void show(bool& visible);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void showEditor(bool& visible);
|
|
|
|
|
|
|
|
PADButtonMapping* m_pendingMapping = nullptr;
|
2022-05-08 08:50:21 +00:00
|
|
|
s32 m_pendingPort = 0;
|
|
|
|
bool m_pendingValid = false;
|
2022-05-08 04:20:52 +00:00
|
|
|
bool m_editorVisible = false;
|
|
|
|
|
2022-05-08 08:50:21 +00:00
|
|
|
|
|
|
|
ControllerAtlas* m_currentAtlas = nullptr;
|
|
|
|
std::vector<ControllerAtlas> m_controllerAtlases;
|
2022-05-08 04:20:52 +00:00
|
|
|
};
|
|
|
|
} // namespace metaforce
|