mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2025-01-27 16:25:38 +01:00
ButtonComboAPI: Add Metaoptions class for C++ api to get/update meta options
This commit is contained in:
parent
d195b0b8e2
commit
f7a11e41bc
@ -5,10 +5,14 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace WUPSButtonComboAPI {
|
namespace WUPSButtonComboAPI {
|
||||||
class ButtonCombo {
|
class ButtonCombo {
|
||||||
public:
|
public:
|
||||||
|
struct MetaOptions {
|
||||||
|
std::string label;
|
||||||
|
};
|
||||||
static std::optional<ButtonCombo> Create(const WUPSButtonCombo_ComboOptions &options,
|
static std::optional<ButtonCombo> Create(const WUPSButtonCombo_ComboOptions &options,
|
||||||
WUPSButtonCombo_ComboStatus &outStatus,
|
WUPSButtonCombo_ComboStatus &outStatus,
|
||||||
WUPSButtonCombo_Error &outError) noexcept;
|
WUPSButtonCombo_Error &outError) noexcept;
|
||||||
@ -29,7 +33,7 @@ namespace WUPSButtonComboAPI {
|
|||||||
|
|
||||||
WUPSButtonCombo_Error GetButtonComboStatus(WUPSButtonCombo_ComboStatus &outStatus) const;
|
WUPSButtonCombo_Error GetButtonComboStatus(WUPSButtonCombo_ComboStatus &outStatus) const;
|
||||||
|
|
||||||
[[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboMeta(const WUPSButtonCombo_MetaOptions &metaOptions) const;
|
[[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboMeta(const MetaOptions &metaOptions) const;
|
||||||
|
|
||||||
[[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const;
|
[[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const;
|
||||||
|
|
||||||
@ -41,7 +45,7 @@ namespace WUPSButtonComboAPI {
|
|||||||
|
|
||||||
[[nodiscard]] WUPSButtonCombo_Error UpdateHoldDuration(uint32_t holdDurationInFrames) const;
|
[[nodiscard]] WUPSButtonCombo_Error UpdateHoldDuration(uint32_t holdDurationInFrames) const;
|
||||||
|
|
||||||
[[nodiscard]] WUPSButtonCombo_Error GetButtonComboMeta(WUPSButtonCombo_MetaOptionsOut &outOptions) const;
|
[[nodiscard]] WUPSButtonCombo_Error GetButtonComboMeta(MetaOptions &outOptions) const;
|
||||||
|
|
||||||
WUPSButtonCombo_Error GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const;
|
WUPSButtonCombo_Error GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const;
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
#include "wups/button_combo/WUPSButtonCombo.h"
|
#include "wups/button_combo/WUPSButtonCombo.h"
|
||||||
|
|
||||||
#include <coreinit/debug.h>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <wups/button_combo/api.h>
|
#include <wups/button_combo/api.h>
|
||||||
|
|
||||||
|
#include <coreinit/debug.h>
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace WUPSButtonComboAPI {
|
namespace WUPSButtonComboAPI {
|
||||||
std::optional<ButtonCombo> ButtonCombo::Create(const WUPSButtonCombo_ComboOptions &options,
|
std::optional<ButtonCombo> ButtonCombo::Create(const WUPSButtonCombo_ComboOptions &options,
|
||||||
WUPSButtonCombo_ComboStatus &outStatus,
|
WUPSButtonCombo_ComboStatus &outStatus,
|
||||||
@ -65,8 +68,9 @@ namespace WUPSButtonComboAPI {
|
|||||||
return WUPSButtonComboAPI_GetButtonComboStatus(mHandle, &outStatus);
|
return WUPSButtonComboAPI_GetButtonComboStatus(mHandle, &outStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboMeta(const WUPSButtonCombo_MetaOptions &metaOptions) const {
|
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboMeta(const MetaOptions &metaOptions) const {
|
||||||
return WUPSButtonComboAPI_UpdateButtonComboMeta(mHandle, &metaOptions);
|
const WUPSButtonCombo_MetaOptions options = {.label = metaOptions.label.c_str()};
|
||||||
|
return WUPSButtonComboAPI_UpdateButtonComboMeta(mHandle, &options);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const {
|
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const {
|
||||||
@ -87,8 +91,15 @@ namespace WUPSButtonComboAPI {
|
|||||||
return WUPSButtonComboAPI_UpdateHoldDuration(mHandle, holdDurationInFrames);
|
return WUPSButtonComboAPI_UpdateHoldDuration(mHandle, holdDurationInFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::GetButtonComboMeta(WUPSButtonCombo_MetaOptionsOut &outOptions) const {
|
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::GetButtonComboMeta(MetaOptions &outOptions) const {
|
||||||
return WUPSButtonComboAPI_GetButtonComboMeta(mHandle, &outOptions);
|
outOptions.label.resize(512);
|
||||||
|
memset(outOptions.label.data(), 0, outOptions.label.size());
|
||||||
|
WUPSButtonCombo_MetaOptionsOut options;
|
||||||
|
options.labelBuffer = outOptions.label.data();
|
||||||
|
options.labelBufferLength = outOptions.label.size();
|
||||||
|
const auto res = WUPSButtonComboAPI_GetButtonComboMeta(mHandle, &options);
|
||||||
|
outOptions.label.resize(outOptions.label.find_first_of('\0'));
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
WUPSButtonCombo_Error ButtonCombo::GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const {
|
WUPSButtonCombo_Error ButtonCombo::GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user