mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-04-09 18:01:30 -06:00
nsyshid: Emulate Dimensions Toypad
This commit is contained in:
parent
6dc73f5d79
commit
b409d5d139
@ -465,6 +465,8 @@ add_library(CemuCafe
|
||||
OS/libs/nsyshid/BackendLibusb.h
|
||||
OS/libs/nsyshid/BackendWindowsHID.cpp
|
||||
OS/libs/nsyshid/BackendWindowsHID.h
|
||||
OS/libs/nsyshid/Dimensions.cpp
|
||||
OS/libs/nsyshid/Dimensions.h
|
||||
OS/libs/nsyshid/Infinity.cpp
|
||||
OS/libs/nsyshid/Infinity.h
|
||||
OS/libs/nsyshid/Skylander.cpp
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
#include "BackendEmulated.h"
|
||||
|
||||
#include "Dimensions.h"
|
||||
#include "Infinity.h"
|
||||
#include "Skylander.h"
|
||||
#include "config/CemuConfig.h"
|
||||
@ -33,5 +35,12 @@ namespace nsyshid::backend::emulated
|
||||
auto device = std::make_shared<InfinityBaseDevice>();
|
||||
AttachDevice(device);
|
||||
}
|
||||
if (GetConfig().emulated_usb_devices.emulate_dimensions_toypad && !FindDeviceById(0x0E6F, 0x0241))
|
||||
{
|
||||
cemuLog_logDebug(LogType::Force, "Attaching Emulated Toypad");
|
||||
// Add Dimensions Toypad
|
||||
auto device = std::make_shared<DimensionsToypadDevice>();
|
||||
AttachDevice(device);
|
||||
}
|
||||
}
|
||||
} // namespace nsyshid::backend::emulated
|
||||
1076
src/Cafe/OS/libs/nsyshid/Dimensions.cpp
Normal file
1076
src/Cafe/OS/libs/nsyshid/Dimensions.cpp
Normal file
File diff suppressed because it is too large
Load Diff
102
src/Cafe/OS/libs/nsyshid/Dimensions.h
Normal file
102
src/Cafe/OS/libs/nsyshid/Dimensions.h
Normal file
@ -0,0 +1,102 @@
|
||||
#include <mutex>
|
||||
|
||||
#include "nsyshid.h"
|
||||
#include "Backend.h"
|
||||
|
||||
#include "Common/FileStream.h"
|
||||
|
||||
namespace nsyshid
|
||||
{
|
||||
class DimensionsToypadDevice final : public Device
|
||||
{
|
||||
public:
|
||||
DimensionsToypadDevice();
|
||||
~DimensionsToypadDevice() = default;
|
||||
|
||||
bool Open() override;
|
||||
|
||||
void Close() override;
|
||||
|
||||
bool IsOpened() override;
|
||||
|
||||
ReadResult Read(ReadMessage* message) override;
|
||||
|
||||
WriteResult Write(WriteMessage* message) override;
|
||||
|
||||
bool GetDescriptor(uint8 descType,
|
||||
uint8 descIndex,
|
||||
uint8 lang,
|
||||
uint8* output,
|
||||
uint32 outputMaxLength) override;
|
||||
|
||||
bool SetProtocol(uint8 ifIndex, uint8 protocol) override;
|
||||
|
||||
bool SetReport(ReportMessage* message) override;
|
||||
|
||||
private:
|
||||
bool m_IsOpened;
|
||||
};
|
||||
|
||||
class DimensionsUSB
|
||||
{
|
||||
public:
|
||||
struct DimensionsMini final
|
||||
{
|
||||
std::unique_ptr<FileStream> dimFile;
|
||||
std::array<uint8, 0x2D * 0x04> data{};
|
||||
uint8 index = 255;
|
||||
uint8 pad = 255;
|
||||
uint32 id = 0;
|
||||
void Save();
|
||||
};
|
||||
|
||||
void SendCommand(uint8* buf, sint32 originalLength);
|
||||
std::array<uint8, 32> GetStatus();
|
||||
|
||||
void GenerateRandomNumber(uint8* buf, uint8 sequence,
|
||||
std::array<uint8, 32>& replyBuf);
|
||||
void InitializeRNG(uint32 seed);
|
||||
void GetChallengeResponse(uint8* buf, uint8 sequence,
|
||||
std::array<uint8, 32>& replyBuf);
|
||||
void QueryBlock(uint8 index, uint8 page, std::array<uint8, 32>& replyBuf,
|
||||
uint8 sequence);
|
||||
void WriteBlock(uint8 index, uint8 page, const uint8* toWriteBuf, std::array<uint8, 32>& replyBuf,
|
||||
uint8 sequence);
|
||||
void GetModel(uint8* buf, uint8 sequence,
|
||||
std::array<uint8, 32>& replyBuf);
|
||||
|
||||
bool RemoveFigure(uint8 pad, uint8 index);
|
||||
uint32 LoadFigure(const std::array<uint8, 0x2D * 0x04>& buf, std::unique_ptr<FileStream> file, uint8 pad, uint8 index);
|
||||
bool CreateFigure(fs::path pathName, uint32 id);
|
||||
static std::map<const uint32, const char*> GetListMinifigs();
|
||||
std::string FindFigure(uint32 figNum);
|
||||
|
||||
protected:
|
||||
std::mutex m_dimensionsMutex;
|
||||
std::array<DimensionsMini, 7> figures;
|
||||
|
||||
private:
|
||||
void RandomUID(uint8* uidBuffer);
|
||||
uint8 GenerateChecksum(const std::array<uint8, 32>& data,
|
||||
int numOfBytes) const;
|
||||
std::array<uint8, 8> Decrypt(const uint8* buf, std::optional<std::array<uint8, 16>> key);
|
||||
std::array<uint8, 8> Encrypt(const uint8* buf, std::optional<std::array<uint8, 16>> key);
|
||||
std::array<uint8, 16> GenerateFigureKey(const std::array<uint8, 0x2D * 0x04>& uid);
|
||||
std::array<uint8, 4> PWDGenerate(const std::array<uint8, 0x2D * 0x04>& uid);
|
||||
std::array<uint8, 4> DimensionsRandomize(const std::vector<uint8> key, uint8 count);
|
||||
uint32 GetFigureId(const std::array<uint8, 0x2D * 0x04>& buf);
|
||||
uint32 Scramble(const std::array<uint8, 7>& uid, uint8 count);
|
||||
uint32 GetNext();
|
||||
DimensionsMini& GetFigureByIndex(uint8 index);
|
||||
|
||||
uint32 m_randomA;
|
||||
uint32 m_randomB;
|
||||
uint32 m_randomC;
|
||||
uint32 m_randomD;
|
||||
|
||||
std::queue<std::array<uint8, 32>> m_figureAddedRemovedResponses;
|
||||
std::queue<std::array<uint8, 32>> m_queries;
|
||||
};
|
||||
extern DimensionsUSB g_dimensionstoypad;
|
||||
|
||||
} // namespace nsyshid
|
||||
@ -346,6 +346,7 @@ void CemuConfig::Load(XMLConfigParser& parser)
|
||||
auto usbdevices = parser.get("EmulatedUsbDevices");
|
||||
emulated_usb_devices.emulate_skylander_portal = usbdevices.get("EmulateSkylanderPortal", emulated_usb_devices.emulate_skylander_portal);
|
||||
emulated_usb_devices.emulate_infinity_base = usbdevices.get("EmulateInfinityBase", emulated_usb_devices.emulate_infinity_base);
|
||||
emulated_usb_devices.emulate_dimensions_toypad = usbdevices.get("EmulateDimensionsToypad", emulated_usb_devices.emulate_dimensions_toypad);
|
||||
}
|
||||
|
||||
void CemuConfig::Save(XMLConfigParser& parser)
|
||||
@ -545,6 +546,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
|
||||
auto usbdevices = config.set("EmulatedUsbDevices");
|
||||
usbdevices.set("EmulateSkylanderPortal", emulated_usb_devices.emulate_skylander_portal.GetValue());
|
||||
usbdevices.set("EmulateInfinityBase", emulated_usb_devices.emulate_infinity_base.GetValue());
|
||||
usbdevices.set("EmulateDimensionsToypad", emulated_usb_devices.emulate_dimensions_toypad.GetValue());
|
||||
}
|
||||
|
||||
GameEntry* CemuConfig::GetGameEntryByTitleId(uint64 titleId)
|
||||
|
||||
@ -521,6 +521,7 @@ struct CemuConfig
|
||||
{
|
||||
ConfigValue<bool> emulate_skylander_portal{false};
|
||||
ConfigValue<bool> emulate_infinity_base{false};
|
||||
ConfigValue<bool> emulate_dimensions_toypad{false};
|
||||
}emulated_usb_devices{};
|
||||
|
||||
private:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "gui/EmulatedUSBDevices/EmulatedUSBDeviceFrame.h"
|
||||
#include "EmulatedUSBDeviceFrame.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -8,14 +8,17 @@
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
#include "Cafe/OS/libs/nsyshid/nsyshid.h"
|
||||
#include "Cafe/OS/libs/nsyshid/Dimensions.h"
|
||||
|
||||
#include "Common/FileStream.h"
|
||||
|
||||
#include <wx/arrstr.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/panel.h>
|
||||
@ -29,7 +32,6 @@
|
||||
#include <wx/wfstream.h>
|
||||
|
||||
#include "resource/embedded/resources.h"
|
||||
#include "EmulatedUSBDeviceFrame.h"
|
||||
|
||||
EmulatedUSBDeviceFrame::EmulatedUSBDeviceFrame(wxWindow* parent)
|
||||
: wxFrame(parent, wxID_ANY, _("Emulated USB Devices"), wxDefaultPosition,
|
||||
@ -44,6 +46,7 @@ EmulatedUSBDeviceFrame::EmulatedUSBDeviceFrame(wxWindow* parent)
|
||||
|
||||
notebook->AddPage(AddSkylanderPage(notebook), _("Skylanders Portal"));
|
||||
notebook->AddPage(AddInfinityPage(notebook), _("Infinity Base"));
|
||||
notebook->AddPage(AddDimensionsPage(notebook), _("Dimensions Toypad"));
|
||||
|
||||
sizer->Add(notebook, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
@ -120,6 +123,51 @@ wxPanel* EmulatedUSBDeviceFrame::AddInfinityPage(wxNotebook* notebook)
|
||||
return panel;
|
||||
}
|
||||
|
||||
wxPanel* EmulatedUSBDeviceFrame::AddDimensionsPage(wxNotebook* notebook)
|
||||
{
|
||||
auto* panel = new wxPanel(notebook);
|
||||
auto* panel_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
auto* box = new wxStaticBox(panel, wxID_ANY, _("Dimensions Manager"));
|
||||
auto* box_sizer = new wxStaticBoxSizer(box, wxVERTICAL);
|
||||
|
||||
auto* row = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_emulate_toypad =
|
||||
new wxCheckBox(box, wxID_ANY, _("Emulate Dimensions Toypad"));
|
||||
m_emulate_toypad->SetValue(
|
||||
GetConfig().emulated_usb_devices.emulate_dimensions_toypad);
|
||||
m_emulate_toypad->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
|
||||
GetConfig().emulated_usb_devices.emulate_dimensions_toypad =
|
||||
m_emulate_toypad->IsChecked();
|
||||
g_config.Save();
|
||||
});
|
||||
row->Add(m_emulate_toypad, 1, wxEXPAND | wxALL, 2);
|
||||
box_sizer->Add(row, 1, wxEXPAND | wxALL, 2);
|
||||
auto* top_row = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto* bottom_row = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto* dummy = new wxStaticText(box, wxID_ANY, "");
|
||||
|
||||
top_row->Add(AddDimensionPanel(2, 0, box), 1, wxEXPAND | wxALL, 2);
|
||||
top_row->Add(dummy, 1, wxEXPAND | wxLEFT | wxRIGHT, 2);
|
||||
top_row->Add(AddDimensionPanel(1, 1, box), 1, wxEXPAND | wxALL, 2);
|
||||
top_row->Add(dummy, 1, wxEXPAND | wxLEFT | wxRIGHT, 2);
|
||||
top_row->Add(AddDimensionPanel(3, 2, box), 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
bottom_row->Add(AddDimensionPanel(2, 3, box), 1, wxEXPAND | wxALL, 2);
|
||||
bottom_row->Add(AddDimensionPanel(2, 4, box), 1, wxEXPAND | wxALL, 2);
|
||||
bottom_row->Add(dummy, 1, wxEXPAND | wxLEFT | wxRIGHT, 0);
|
||||
bottom_row->Add(AddDimensionPanel(3, 5, box), 1, wxEXPAND | wxALL, 2);
|
||||
bottom_row->Add(AddDimensionPanel(3, 6, box), 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
box_sizer->Add(top_row, 1, wxEXPAND | wxALL, 2);
|
||||
box_sizer->Add(bottom_row, 1, wxEXPAND | wxALL, 2);
|
||||
panel_sizer->Add(box_sizer, 1, wxEXPAND | wxALL, 2);
|
||||
panel->SetSizerAndFit(panel_sizer);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
wxBoxSizer* EmulatedUSBDeviceFrame::AddSkylanderRow(uint8 rowNumber,
|
||||
wxStaticBox* box)
|
||||
{
|
||||
@ -184,6 +232,41 @@ wxBoxSizer* EmulatedUSBDeviceFrame::AddInfinityRow(wxString name, uint8 rowNumbe
|
||||
return row;
|
||||
}
|
||||
|
||||
wxBoxSizer* EmulatedUSBDeviceFrame::AddDimensionPanel(uint8 pad, uint8 index, wxStaticBox* box)
|
||||
{
|
||||
auto* panel = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
auto* combo_row = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_dimension_slots[index] = new wxTextCtrl(box, wxID_ANY, _("None"), wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_READONLY);
|
||||
combo_row->Add(m_dimension_slots[index], 1, wxEXPAND | wxALL, 2);
|
||||
auto* move_button = new wxButton(box, wxID_ANY, _("Move"));
|
||||
|
||||
combo_row->Add(move_button, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
auto* button_row = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto* load_button = new wxButton(box, wxID_ANY, _("Load"));
|
||||
load_button->Bind(wxEVT_BUTTON, [pad, index, this](wxCommandEvent&) {
|
||||
LoadMinifig(pad, index);
|
||||
});
|
||||
auto* clear_button = new wxButton(box, wxID_ANY, _("Clear"));
|
||||
clear_button->Bind(wxEVT_BUTTON, [pad, index, this](wxCommandEvent&) {
|
||||
ClearMinifig(pad, index);
|
||||
});
|
||||
auto* create_button = new wxButton(box, wxID_ANY, _("Create"));
|
||||
create_button->Bind(wxEVT_BUTTON, [pad, index, this](wxCommandEvent&) {
|
||||
CreateMinifig(pad, index);
|
||||
});
|
||||
button_row->Add(clear_button, 1, wxEXPAND | wxALL, 2);
|
||||
button_row->Add(create_button, 1, wxEXPAND | wxALL, 2);
|
||||
button_row->Add(load_button, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
panel->Add(combo_row, 1, wxEXPAND | wxALL, 2);
|
||||
panel->Add(button_row, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
void EmulatedUSBDeviceFrame::LoadSkylander(uint8 slot)
|
||||
{
|
||||
wxFileDialog openFileDialog(this, _("Open Skylander dump"), "", "",
|
||||
@ -307,8 +390,8 @@ CreateSkylanderDialog::CreateSkylanderDialog(wxWindow* parent, uint8 slot)
|
||||
return;
|
||||
|
||||
m_filePath = saveFileDialog.GetPath();
|
||||
|
||||
if(!nsyshid::g_skyportal.CreateSkylander(_utf8ToPath(m_filePath.utf8_string()), skyId, skyVar))
|
||||
|
||||
if (!nsyshid::g_skyportal.CreateSkylander(_utf8ToPath(m_filePath.utf8_string()), skyId, skyVar))
|
||||
{
|
||||
wxMessageDialog errorMessage(this, "Failed to create file");
|
||||
errorMessage.ShowModal();
|
||||
@ -447,6 +530,143 @@ wxString CreateInfinityFigureDialog::GetFilePath() const
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
CreateDimensionFigureDialog::CreateDimensionFigureDialog(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, _("Dimensions Figure Creator"), wxDefaultPosition, wxSize(500, 200))
|
||||
{
|
||||
auto* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
auto* comboRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto* comboBox = new wxComboBox(this, wxID_ANY);
|
||||
comboBox->Append("---Select---", reinterpret_cast<void*>(0xFFFFFFFF));
|
||||
wxArrayString filterlist;
|
||||
for (const auto& it : nsyshid::g_dimensionstoypad.GetListMinifigs())
|
||||
{
|
||||
const uint32 figure = it.first;
|
||||
comboBox->Append(it.second, reinterpret_cast<void*>(figure));
|
||||
filterlist.Add(it.second);
|
||||
}
|
||||
comboBox->SetSelection(0);
|
||||
bool enabled = comboBox->AutoComplete(filterlist);
|
||||
comboRow->Add(comboBox, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
auto* figNumRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxIntegerValidator<uint32> validator;
|
||||
|
||||
auto* labelFigNum = new wxStaticText(this, wxID_ANY, "Figure Number:");
|
||||
auto* editFigNum = new wxTextCtrl(this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0, validator);
|
||||
|
||||
figNumRow->Add(labelFigNum, 1, wxALL, 5);
|
||||
figNumRow->Add(editFigNum, 1, wxALL, 5);
|
||||
|
||||
auto* buttonRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto* createButton = new wxButton(this, wxID_ANY, _("Create"));
|
||||
createButton->Bind(wxEVT_BUTTON, [editFigNum, this](wxCommandEvent&) {
|
||||
long longFigNum;
|
||||
if (!editFigNum->GetValue().ToLong(&longFigNum) || longFigNum > 0xFFFF)
|
||||
{
|
||||
wxMessageDialog idError(this, "Error Converting Figure Number!", "Number Entered is Invalid");
|
||||
idError.ShowModal();
|
||||
this->EndModal(0);
|
||||
}
|
||||
uint16 figNum = longFigNum & 0xFFFF;
|
||||
auto figure = nsyshid::g_dimensionstoypad.FindFigure(figNum);
|
||||
wxString predefName = figure + ".bin";
|
||||
wxFileDialog
|
||||
saveFileDialog(this, _("Create Dimensions Figure file"), "", predefName,
|
||||
"BIN files (*.bin)|*.bin", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
|
||||
if (saveFileDialog.ShowModal() == wxID_CANCEL)
|
||||
this->EndModal(0);
|
||||
|
||||
m_filePath = saveFileDialog.GetPath();
|
||||
|
||||
nsyshid::g_dimensionstoypad.CreateFigure(_utf8ToPath(m_filePath.utf8_string()), figNum);
|
||||
|
||||
this->EndModal(1);
|
||||
});
|
||||
auto* cancelButton = new wxButton(this, wxID_ANY, _("Cancel"));
|
||||
cancelButton->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
|
||||
this->EndModal(0);
|
||||
});
|
||||
|
||||
comboBox->Bind(wxEVT_COMBOBOX, [comboBox, editFigNum, this](wxCommandEvent&) {
|
||||
const uint64 fig_info = reinterpret_cast<uint64>(comboBox->GetClientData(comboBox->GetSelection()));
|
||||
if (fig_info != 0xFFFF)
|
||||
{
|
||||
const uint16 figNum = fig_info & 0xFFFF;
|
||||
|
||||
editFigNum->SetValue(wxString::Format(wxT("%i"), figNum));
|
||||
}
|
||||
});
|
||||
|
||||
buttonRow->Add(createButton, 1, wxALL, 5);
|
||||
buttonRow->Add(cancelButton, 1, wxALL, 5);
|
||||
|
||||
sizer->Add(comboRow, 1, wxEXPAND | wxALL, 2);
|
||||
sizer->Add(figNumRow, 1, wxEXPAND | wxALL, 2);
|
||||
sizer->Add(buttonRow, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
this->SetSizer(sizer);
|
||||
this->Centre(wxBOTH);
|
||||
}
|
||||
|
||||
wxString CreateDimensionFigureDialog::GetFilePath() const
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
void EmulatedUSBDeviceFrame::LoadMinifig(uint8 pad, uint8 index)
|
||||
{
|
||||
wxFileDialog openFileDialog(this, _("Load Dimensions Figure"), "", "",
|
||||
"Dimensions files (*.bin)|*.bin",
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (openFileDialog.ShowModal() != wxID_OK || openFileDialog.GetPath().empty())
|
||||
return;
|
||||
|
||||
LoadMinifigPath(openFileDialog.GetPath(), pad, index);
|
||||
}
|
||||
void EmulatedUSBDeviceFrame::LoadMinifigPath(wxString path_name, uint8 pad, uint8 index)
|
||||
{
|
||||
std::unique_ptr<FileStream> dim_file(FileStream::openFile2(_utf8ToPath(path_name.utf8_string()), true));
|
||||
if (!dim_file)
|
||||
{
|
||||
wxMessageDialog errorMessage(this, "Failed to open minifig file");
|
||||
errorMessage.ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
std::array<uint8, 0x2D * 0x04> file_data;
|
||||
|
||||
if (dim_file->readData(file_data.data(), file_data.size()) != file_data.size())
|
||||
{
|
||||
wxMessageDialog errorMessage(this, "Failed to read minifig file data");
|
||||
errorMessage.ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
ClearMinifig(pad, index);
|
||||
|
||||
uint32 id = nsyshid::g_dimensionstoypad.LoadFigure(file_data, std::move(dim_file), pad, index);
|
||||
m_dimension_slots[index]->ChangeValue(nsyshid::g_dimensionstoypad.FindFigure(id));
|
||||
}
|
||||
void EmulatedUSBDeviceFrame::ClearMinifig(uint8 pad, uint8 index)
|
||||
{
|
||||
nsyshid::g_dimensionstoypad.RemoveFigure(pad, index);
|
||||
m_dimension_slots[index]->ChangeValue("None");
|
||||
}
|
||||
void EmulatedUSBDeviceFrame::CreateMinifig(uint8 pad, uint8 index)
|
||||
{
|
||||
CreateDimensionFigureDialog create_dlg(this);
|
||||
create_dlg.ShowModal();
|
||||
if (create_dlg.GetReturnCode() == 1)
|
||||
{
|
||||
LoadMinifigPath(create_dlg.GetFilePath(), pad, index);
|
||||
}
|
||||
}
|
||||
|
||||
void EmulatedUSBDeviceFrame::LoadFigure(uint8 slot)
|
||||
{
|
||||
wxFileDialog openFileDialog(this, _("Open Infinity Figure dump"), "", "",
|
||||
|
||||
@ -25,18 +25,27 @@ class EmulatedUSBDeviceFrame : public wxFrame {
|
||||
private:
|
||||
wxCheckBox* m_emulatePortal;
|
||||
wxCheckBox* m_emulateBase;
|
||||
wxCheckBox* m_emulate_toypad;
|
||||
std::array<wxTextCtrl*, nsyshid::MAX_SKYLANDERS> m_skylanderSlots;
|
||||
std::array<wxTextCtrl*, nsyshid::MAX_FIGURES> m_infinitySlots;
|
||||
std::array<wxTextCtrl*, 7> m_dimension_slots;
|
||||
std::array<std::optional<std::tuple<uint8, uint16, uint16>>, nsyshid::MAX_SKYLANDERS> m_skySlots;
|
||||
std::array<std::optional<std::tuple<uint8, uint8, uint8>>, 7> dim_slots;
|
||||
|
||||
wxPanel* AddSkylanderPage(wxNotebook* notebook);
|
||||
wxPanel* AddInfinityPage(wxNotebook* notebook);
|
||||
wxPanel* AddDimensionsPage(wxNotebook* notebook);
|
||||
wxBoxSizer* AddSkylanderRow(uint8 row_number, wxStaticBox* box);
|
||||
wxBoxSizer* AddInfinityRow(wxString name, uint8 row_number, wxStaticBox* box);
|
||||
wxBoxSizer* AddDimensionPanel(uint8 pad, uint8 index, wxStaticBox* box);
|
||||
void LoadSkylander(uint8 slot);
|
||||
void LoadSkylanderPath(uint8 slot, wxString path);
|
||||
void CreateSkylander(uint8 slot);
|
||||
void ClearSkylander(uint8 slot);
|
||||
void LoadMinifigPath(wxString path_name, uint8 pad, uint8 index);
|
||||
void LoadMinifig(uint8 pad, uint8 index);
|
||||
void CreateMinifig(uint8 pad, uint8 index);
|
||||
void ClearMinifig(uint8 pad, uint8 index);
|
||||
void LoadFigure(uint8 slot);
|
||||
void LoadFigurePath(uint8 slot, wxString path);
|
||||
void CreateFigure(uint8 slot);
|
||||
@ -57,6 +66,15 @@ class CreateInfinityFigureDialog : public wxDialog {
|
||||
explicit CreateInfinityFigureDialog(wxWindow* parent, uint8 slot);
|
||||
wxString GetFilePath() const;
|
||||
|
||||
protected:
|
||||
wxString m_filePath;
|
||||
};
|
||||
|
||||
class CreateDimensionFigureDialog : public wxDialog {
|
||||
public:
|
||||
explicit CreateDimensionFigureDialog(wxWindow* parent);
|
||||
wxString GetFilePath() const;
|
||||
|
||||
protected:
|
||||
wxString m_filePath;
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user