mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2025-01-13 01:49:06 +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 <optional>
|
||||
#include <string>
|
||||
|
||||
namespace WUPSButtonComboAPI {
|
||||
class ButtonCombo {
|
||||
public:
|
||||
struct MetaOptions {
|
||||
std::string label;
|
||||
};
|
||||
static std::optional<ButtonCombo> Create(const WUPSButtonCombo_ComboOptions &options,
|
||||
WUPSButtonCombo_ComboStatus &outStatus,
|
||||
WUPSButtonCombo_Error &outError) noexcept;
|
||||
@ -29,7 +33,7 @@ namespace WUPSButtonComboAPI {
|
||||
|
||||
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;
|
||||
|
||||
@ -41,7 +45,7 @@ namespace WUPSButtonComboAPI {
|
||||
|
||||
[[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;
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include "wups/button_combo/WUPSButtonCombo.h"
|
||||
|
||||
#include <coreinit/debug.h>
|
||||
#include <stdexcept>
|
||||
#include <wups/button_combo/api.h>
|
||||
|
||||
#include <coreinit/debug.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace WUPSButtonComboAPI {
|
||||
std::optional<ButtonCombo> ButtonCombo::Create(const WUPSButtonCombo_ComboOptions &options,
|
||||
WUPSButtonCombo_ComboStatus &outStatus,
|
||||
@ -65,8 +68,9 @@ namespace WUPSButtonComboAPI {
|
||||
return WUPSButtonComboAPI_GetButtonComboStatus(mHandle, &outStatus);
|
||||
}
|
||||
|
||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboMeta(const WUPSButtonCombo_MetaOptions &metaOptions) const {
|
||||
return WUPSButtonComboAPI_UpdateButtonComboMeta(mHandle, &metaOptions);
|
||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboMeta(const MetaOptions &metaOptions) const {
|
||||
const WUPSButtonCombo_MetaOptions options = {.label = metaOptions.label.c_str()};
|
||||
return WUPSButtonComboAPI_UpdateButtonComboMeta(mHandle, &options);
|
||||
}
|
||||
|
||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const {
|
||||
@ -87,8 +91,15 @@ namespace WUPSButtonComboAPI {
|
||||
return WUPSButtonComboAPI_UpdateHoldDuration(mHandle, holdDurationInFrames);
|
||||
}
|
||||
|
||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::GetButtonComboMeta(WUPSButtonCombo_MetaOptionsOut &outOptions) const {
|
||||
return WUPSButtonComboAPI_GetButtonComboMeta(mHandle, &outOptions);
|
||||
[[nodiscard]] WUPSButtonCombo_Error ButtonCombo::GetButtonComboMeta(MetaOptions &outOptions) const {
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user