mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #11694 from jnaidu360/skylanders-portal-window
Skylanders Portal Menu Navigational Improvements
This commit is contained in:
@@ -26,7 +26,7 @@ Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getSkylanderM
|
||||
|
||||
for (const auto& it : IOS::HLE::USB::list_skylanders)
|
||||
{
|
||||
const std::string& name = it.second;
|
||||
const std::string& name = it.second.name;
|
||||
jobject skylander_obj =
|
||||
env->NewObject(skylander_class, skylander_init, it.first.first, it.first.second);
|
||||
env->CallObjectMethod(hash_map_obj, IDCache::GetHashMapPut(), skylander_obj,
|
||||
@@ -51,7 +51,7 @@ Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getInverseSky
|
||||
|
||||
for (const auto& it : IOS::HLE::USB::list_skylanders)
|
||||
{
|
||||
const std::string& name = it.second;
|
||||
const std::string& name = it.second.name;
|
||||
jobject skylander_obj =
|
||||
env->NewObject(skylander_class, skylander_init, it.first.first, it.first.second);
|
||||
env->CallObjectMethod(hash_map_obj, IDCache::GetHashMapPut(), ToJString(env, name),
|
||||
@@ -104,7 +104,7 @@ Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_loadSkylander
|
||||
|
||||
if (it != IOS::HLE::USB::list_skylanders.end())
|
||||
{
|
||||
name = it->second;
|
||||
name = it->second.name;
|
||||
}
|
||||
|
||||
return env->NewObject(pair_class, pair_init,
|
||||
@@ -151,7 +151,7 @@ Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_createSkyland
|
||||
|
||||
if (it != IOS::HLE::USB::list_skylanders.end())
|
||||
{
|
||||
name = it->second;
|
||||
name = it->second.name;
|
||||
}
|
||||
|
||||
return env->NewObject(pair_class, pair_init,
|
||||
|
||||
@@ -33,6 +33,8 @@ enum
|
||||
D_CONFIG_IDX, // global settings
|
||||
D_GAMESETTINGS_IDX, // user-specified settings which override both the global and the default
|
||||
// settings (per game)
|
||||
D_SKYLANDERS_IDX,
|
||||
|
||||
D_MAPS_IDX,
|
||||
D_CACHE_IDX,
|
||||
D_COVERCACHE_IDX,
|
||||
|
||||
@@ -297,6 +297,8 @@ const Info<std::string> MAIN_WIRELESS_MAC{{System::Main, "General", "WirelessMac
|
||||
const Info<std::string> MAIN_GDB_SOCKET{{System::Main, "General", "GDBSocket"}, ""};
|
||||
const Info<int> MAIN_GDB_PORT{{System::Main, "General", "GDBPort"}, -1};
|
||||
const Info<int> MAIN_ISO_PATH_COUNT{{System::Main, "General", "ISOPaths"}, 0};
|
||||
const Info<std::string> MAIN_SKYLANDERS_PATH{{System::Main, "General", "SkylandersCollectionPath"},
|
||||
""};
|
||||
|
||||
static Info<std::string> MakeISOPathConfigInfo(size_t idx)
|
||||
{
|
||||
|
||||
@@ -196,6 +196,7 @@ extern const Info<std::string> MAIN_WIRELESS_MAC;
|
||||
extern const Info<std::string> MAIN_GDB_SOCKET;
|
||||
extern const Info<int> MAIN_GDB_PORT;
|
||||
extern const Info<int> MAIN_ISO_PATH_COUNT;
|
||||
extern const Info<std::string> MAIN_SKYLANDERS_PATH;
|
||||
std::vector<std::string> GetIsoPaths();
|
||||
void SetIsoPaths(const std::vector<std::string>& paths);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,36 @@ constexpr u8 MAX_SKYLANDERS = 16;
|
||||
|
||||
namespace IOS::HLE::USB
|
||||
{
|
||||
extern const std::map<const std::pair<const u16, const u16>, const char*> list_skylanders;
|
||||
enum class Game
|
||||
{
|
||||
SpyrosAdv,
|
||||
Giants,
|
||||
SwapForce,
|
||||
TrapTeam,
|
||||
Superchargers,
|
||||
Other,
|
||||
};
|
||||
enum class Element
|
||||
{
|
||||
Magic,
|
||||
Fire,
|
||||
Air,
|
||||
Life,
|
||||
Undead,
|
||||
Earth,
|
||||
Water,
|
||||
Tech,
|
||||
Other
|
||||
};
|
||||
|
||||
struct SkyData
|
||||
{
|
||||
const char* name = "";
|
||||
Game game = Game::Other;
|
||||
Element element = Element::Other;
|
||||
};
|
||||
|
||||
extern const std::map<const std::pair<const u16, const u16>, SkyData> list_skylanders;
|
||||
class SkylanderUSB final : public Device
|
||||
{
|
||||
public:
|
||||
@@ -93,7 +122,7 @@ public:
|
||||
void QueryBlock(u8 sky_num, u8 block, u8* reply_buf);
|
||||
void WriteBlock(u8 sky_num, u8 block, const u8* to_write_buf, u8* reply_buf);
|
||||
|
||||
bool CreateSkylander(const std::string& file_path, u16 sky_id, u16 sky_var);
|
||||
bool CreateSkylander(const std::string& file_path, u16 m_sky_id, u16 m_sky_var);
|
||||
bool RemoveSkylander(u8 sky_num);
|
||||
u8 LoadSkylander(u8* buf, File::IOFile in_file);
|
||||
std::pair<u16, u16> CalculateIDs(const std::array<u8, 0x40 * 0x10>& file_data);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,8 +6,11 @@
|
||||
#include <array>
|
||||
#include <optional>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QBrush>
|
||||
#include <QFrame>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
#include "Core/Core.h"
|
||||
@@ -16,12 +19,15 @@
|
||||
class QCheckBox;
|
||||
class QGroupBox;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class QListWidget;
|
||||
|
||||
struct Skylander
|
||||
{
|
||||
u8 portal_slot;
|
||||
u16 sky_id;
|
||||
u16 sky_var;
|
||||
u16 m_sky_id;
|
||||
u16 m_sky_var;
|
||||
};
|
||||
|
||||
class SkylanderPortalWindow : public QWidget
|
||||
@@ -36,29 +42,58 @@ protected:
|
||||
std::array<std::optional<Skylander>, MAX_SKYLANDERS> m_sky_slots;
|
||||
|
||||
private:
|
||||
// Window
|
||||
void CreateMainWindow();
|
||||
void OnEmulationStateChanged(Core::State state);
|
||||
void CreateSkylander(u8 slot);
|
||||
void ClearSkylander(u8 slot);
|
||||
void EmulatePortal(bool emulate);
|
||||
void LoadSkylander(u8 slot);
|
||||
void LoadSkylanderPath(u8 slot, const QString& path);
|
||||
void UpdateEdits();
|
||||
QVBoxLayout* CreateSlotLayout();
|
||||
QVBoxLayout* CreateFinderLayout();
|
||||
void closeEvent(QCloseEvent* bar) override;
|
||||
bool eventFilter(QObject* object, QEvent* event) final override;
|
||||
|
||||
QCheckBox* m_checkbox;
|
||||
QGroupBox* m_group_skylanders;
|
||||
};
|
||||
// UI
|
||||
void EmulatePortal(bool emulate);
|
||||
void SelectCollectionPath();
|
||||
void LoadSelected();
|
||||
void LoadFromFile();
|
||||
void ClearSlot(u8 slot);
|
||||
void CreateSkylanderAdvanced();
|
||||
|
||||
class CreateSkylanderDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
// Behind the scenes
|
||||
void OnEmulationStateChanged(Core::State state);
|
||||
void OnCollectionPathChanged();
|
||||
void RefreshList();
|
||||
void UpdateCurrentIDs();
|
||||
void CreateSkyfile(const QString& path, bool load_after);
|
||||
void LoadSkyfilePath(u8 slot, const QString& path);
|
||||
void UpdateSlotNames();
|
||||
|
||||
public:
|
||||
explicit CreateSkylanderDialog(QWidget* parent);
|
||||
QString GetFilePath() const;
|
||||
// Helpers
|
||||
bool PassesFilter(QString name, u16 id, u16 var);
|
||||
QString GetFilePath(u16 id, u16 var);
|
||||
u8 GetCurrentSlot();
|
||||
int GetElementRadio();
|
||||
QBrush GetBaseColor(std::pair<const u16, const u16> ids);
|
||||
int GetGameID(IOS::HLE::USB::Game game);
|
||||
int GetElementID(IOS::HLE::USB::Element elem);
|
||||
|
||||
protected:
|
||||
QString m_file_path;
|
||||
bool m_emulating;
|
||||
QCheckBox* m_enabled_checkbox;
|
||||
QFrame* m_group_skylanders;
|
||||
QFrame* m_command_buttons;
|
||||
std::array<QRadioButton*, 16> m_slot_radios;
|
||||
|
||||
// Qt is not guaranteed to keep track of file paths using native file pickers, so we use this
|
||||
// variable to ensure we open at the most recent Skylander file location
|
||||
QString m_last_skylander_path;
|
||||
|
||||
QString m_collection_path;
|
||||
QLineEdit* m_path_edit;
|
||||
QPushButton* m_path_select;
|
||||
|
||||
std::array<QCheckBox*, 5> m_game_filters;
|
||||
std::array<QRadioButton*, 10> m_element_filter;
|
||||
QCheckBox* m_only_show_collection;
|
||||
QLineEdit* m_sky_search;
|
||||
QListWidget* m_skylander_list;
|
||||
u16 m_sky_id = 0;
|
||||
u16 m_sky_var = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user