2019-01-29 17:29:55 +01:00
|
|
|
|
#pragma once
|
2020-01-03 13:41:34 +01:00
|
|
|
|
#include "overlay_animation.h"
|
2018-01-17 17:14:00 +01:00
|
|
|
|
#include "overlay_controls.h"
|
|
|
|
|
|
|
2018-07-23 07:54:53 +02:00
|
|
|
|
#include "../../../Utilities/date_time.h"
|
2018-05-20 22:05:00 +02:00
|
|
|
|
#include "../../../Utilities/Thread.h"
|
|
|
|
|
|
#include "../../Io/PadHandler.h"
|
2018-01-17 17:14:00 +01:00
|
|
|
|
#include "Emu/Memory/vm.h"
|
|
|
|
|
|
#include "Emu/IdManager.h"
|
2019-12-22 17:39:42 +01:00
|
|
|
|
#include "Input/pad_thread.h"
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
|
|
|
|
|
#include "Emu/Cell/ErrorCodes.h"
|
|
|
|
|
|
#include "Emu/Cell/Modules/cellSaveData.h"
|
|
|
|
|
|
#include "Emu/Cell/Modules/cellMsgDialog.h"
|
2019-01-29 17:29:55 +01:00
|
|
|
|
#include "Emu/Cell/Modules/cellOskDialog.h"
|
2018-01-17 17:14:00 +01:00
|
|
|
|
#include "Emu/Cell/Modules/sceNpTrophy.h"
|
2018-05-29 23:38:21 +02:00
|
|
|
|
#include "Utilities/CPUStats.h"
|
|
|
|
|
|
#include "Utilities/Timer.h"
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-01-29 17:29:55 +01:00
|
|
|
|
// Utils
|
2019-01-31 18:43:40 +01:00
|
|
|
|
std::string utf8_to_ascii8(const std::string& utf8_string);
|
|
|
|
|
|
std::string utf16_to_ascii8(const std::u16string& utf16_string);
|
2019-06-08 08:22:09 +02:00
|
|
|
|
std::u16string ascii8_to_utf16(const std::string& ascii_string);
|
2018-01-17 17:14:00 +01:00
|
|
|
|
extern u64 get_system_time();
|
|
|
|
|
|
|
|
|
|
|
|
// Definition of user interface implementations
|
|
|
|
|
|
namespace rsx
|
|
|
|
|
|
{
|
|
|
|
|
|
namespace overlays
|
|
|
|
|
|
{
|
2018-05-29 23:37:59 +02:00
|
|
|
|
// Non-interactable UI element
|
|
|
|
|
|
struct overlay
|
|
|
|
|
|
{
|
|
|
|
|
|
u32 uid = UINT32_MAX;
|
|
|
|
|
|
u32 type_index = UINT32_MAX;
|
|
|
|
|
|
|
|
|
|
|
|
u16 virtual_width = 1280;
|
|
|
|
|
|
u16 virtual_height = 720;
|
|
|
|
|
|
|
2018-07-11 22:51:29 +02:00
|
|
|
|
u32 min_refresh_duration_us = 16600;
|
|
|
|
|
|
|
2018-05-29 23:37:59 +02:00
|
|
|
|
virtual ~overlay() = default;
|
|
|
|
|
|
|
|
|
|
|
|
virtual void update() {}
|
|
|
|
|
|
virtual compiled_resource get_compiled() = 0;
|
2018-05-29 23:38:21 +02:00
|
|
|
|
|
|
|
|
|
|
void refresh();
|
2018-05-29 23:37:59 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Interactable UI element
|
|
|
|
|
|
struct user_interface : overlay
|
2018-01-17 17:14:00 +01:00
|
|
|
|
{
|
2018-12-28 14:05:57 +01:00
|
|
|
|
// Move this somewhere to avoid duplication
|
2018-01-17 17:14:00 +01:00
|
|
|
|
enum selection_code
|
|
|
|
|
|
{
|
|
|
|
|
|
new_save = -1,
|
|
|
|
|
|
canceled = -2,
|
|
|
|
|
|
error = -3
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum pad_button : u8
|
|
|
|
|
|
{
|
|
|
|
|
|
dpad_up = 0,
|
|
|
|
|
|
dpad_down,
|
|
|
|
|
|
dpad_left,
|
|
|
|
|
|
dpad_right,
|
2019-01-30 10:50:29 +01:00
|
|
|
|
select,
|
|
|
|
|
|
start,
|
2018-01-17 17:14:00 +01:00
|
|
|
|
triangle,
|
|
|
|
|
|
circle,
|
|
|
|
|
|
square,
|
2019-01-30 10:50:29 +01:00
|
|
|
|
cross,
|
|
|
|
|
|
L1,
|
|
|
|
|
|
R1,
|
|
|
|
|
|
|
|
|
|
|
|
pad_button_max_enum
|
2018-01-17 17:14:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
2018-10-02 20:25:36 +02:00
|
|
|
|
Timer input_timer;
|
|
|
|
|
|
bool exit = false;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
|
|
|
|
|
s32 return_code = CELL_OK;
|
|
|
|
|
|
std::function<void(s32 status)> on_close;
|
|
|
|
|
|
|
2019-06-08 09:49:47 +02:00
|
|
|
|
void update() override {}
|
|
|
|
|
|
compiled_resource get_compiled() override = 0;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2018-02-10 09:52:44 +01:00
|
|
|
|
virtual void on_button_pressed(pad_button /*button_press*/)
|
2018-01-17 17:14:00 +01:00
|
|
|
|
{
|
|
|
|
|
|
close();
|
2018-05-29 23:38:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-01 09:46:45 +02:00
|
|
|
|
void close(bool use_callback = true);
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2018-12-30 02:34:15 +01:00
|
|
|
|
s32 run_input_loop();
|
2018-01-17 17:14:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
2018-05-20 22:05:00 +02:00
|
|
|
|
class display_manager
|
|
|
|
|
|
{
|
|
|
|
|
|
private:
|
2019-08-26 02:08:16 +02:00
|
|
|
|
atomic_t<u32> m_uid_ctr = 0;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
std::vector<std::shared_ptr<overlay>> m_iface_list;
|
|
|
|
|
|
std::vector<std::shared_ptr<overlay>> m_dirty_list;
|
2018-05-20 22:05:00 +02:00
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
shared_mutex m_list_mutex;
|
|
|
|
|
|
std::vector<u32> m_uids_to_remove;
|
|
|
|
|
|
std::vector<u32> m_type_ids_to_remove;
|
|
|
|
|
|
|
|
|
|
|
|
bool remove_type(u32 type_id)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool found = false;
|
|
|
|
|
|
for (auto It = m_iface_list.begin(); It != m_iface_list.end();)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (It->get()->type_index == type_id)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_dirty_list.push_back(std::move(*It));
|
|
|
|
|
|
It = m_iface_list.erase(It);
|
|
|
|
|
|
found = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
++It;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return found;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool remove_uid(u32 uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (auto It = m_iface_list.begin(); It != m_iface_list.end(); It++)
|
|
|
|
|
|
{
|
|
|
|
|
|
const auto e = It->get();
|
|
|
|
|
|
if (e->uid == uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_dirty_list.push_back(std::move(*It));
|
|
|
|
|
|
m_iface_list.erase(It);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cleanup_internal()
|
|
|
|
|
|
{
|
|
|
|
|
|
for (const auto &uid : m_uids_to_remove)
|
|
|
|
|
|
{
|
|
|
|
|
|
remove_uid(uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (const auto &type_id : m_type_ids_to_remove)
|
|
|
|
|
|
{
|
|
|
|
|
|
remove_type(type_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_uids_to_remove.clear();
|
|
|
|
|
|
m_type_ids_to_remove.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-20 22:05:00 +02:00
|
|
|
|
public:
|
2019-08-26 02:08:16 +02:00
|
|
|
|
// Disable default construction to make it conditionally available in g_fxo
|
|
|
|
|
|
explicit display_manager(int) noexcept
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2018-05-20 22:05:00 +02:00
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Adds an object to the internal list. Optionally removes other objects of the same type.
|
|
|
|
|
|
// Original handle loses ownership but a usable pointer is returned
|
2018-05-20 22:05:00 +02:00
|
|
|
|
template <typename T>
|
2019-01-29 17:29:55 +01:00
|
|
|
|
std::shared_ptr<T> add(std::shared_ptr<T>& entry, bool remove_existing = true)
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-09-03 21:28:33 +02:00
|
|
|
|
std::lock_guard lock(m_list_mutex);
|
2018-05-25 14:34:48 +02:00
|
|
|
|
|
2019-01-29 17:29:55 +01:00
|
|
|
|
entry->uid = m_uid_ctr.fetch_add(1);
|
|
|
|
|
|
entry->type_index = id_manager::typeinfo::get_index<T>();
|
2018-05-20 22:05:00 +02:00
|
|
|
|
|
|
|
|
|
|
if (remove_existing)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (auto It = m_iface_list.begin(); It != m_iface_list.end(); It++)
|
|
|
|
|
|
{
|
2019-01-29 17:29:55 +01:00
|
|
|
|
if (It->get()->type_index == entry->type_index)
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
|
|
|
|
|
// Replace
|
2018-05-21 14:21:59 +02:00
|
|
|
|
m_dirty_list.push_back(std::move(*It));
|
2019-01-29 17:29:55 +01:00
|
|
|
|
*It = std::move(entry);
|
|
|
|
|
|
return std::static_pointer_cast<T>(*It);
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_iface_list.push_back(std::move(entry));
|
2019-01-29 17:29:55 +01:00
|
|
|
|
return std::static_pointer_cast<T>(m_iface_list.back());
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Allocates object and adds to internal list. Returns pointer to created object
|
2018-05-20 22:05:00 +02:00
|
|
|
|
template <typename T, typename ...Args>
|
2019-01-29 17:29:55 +01:00
|
|
|
|
std::shared_ptr<T> create(Args&&... args)
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2019-01-29 17:29:55 +01:00
|
|
|
|
auto object = std::make_shared<T>(std::forward<Args>(args)...);
|
2018-05-20 22:05:00 +02:00
|
|
|
|
return add(object);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Removes item from list if it matches the uid
|
|
|
|
|
|
void remove(u32 uid)
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-05-25 14:34:48 +02:00
|
|
|
|
if (m_list_mutex.try_lock())
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-05-25 14:34:48 +02:00
|
|
|
|
remove_uid(uid);
|
|
|
|
|
|
m_list_mutex.unlock();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_uids_to_remove.push_back(uid);
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Removes all objects of this type from the list
|
2018-05-20 22:05:00 +02:00
|
|
|
|
template <typename T>
|
2018-05-25 14:34:48 +02:00
|
|
|
|
void remove()
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
|
|
|
|
|
const auto type_id = id_manager::typeinfo::get_index<T>();
|
2018-05-25 14:34:48 +02:00
|
|
|
|
if (m_list_mutex.try_lock())
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-05-25 14:34:48 +02:00
|
|
|
|
remove_type(type_id);
|
|
|
|
|
|
m_list_mutex.unlock();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_type_ids_to_remove.push_back(type_id);
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// True if any visible elements to draw exist
|
|
|
|
|
|
bool has_visible() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return !m_iface_list.empty();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// True if any elements have been deleted but their resources may not have been cleaned up
|
|
|
|
|
|
bool has_dirty() const
|
|
|
|
|
|
{
|
2018-05-21 14:21:59 +02:00
|
|
|
|
return !m_dirty_list.empty();
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Returns current list for reading. Caller must ensure synchronization by first locking the list
|
2019-01-29 17:29:55 +01:00
|
|
|
|
const std::vector<std::shared_ptr<overlay>>& get_views() const
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
|
|
|
|
|
return m_iface_list;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Returns current list of removed objects not yet deallocated for reading.
|
|
|
|
|
|
// Caller must ensure synchronization by first locking the list
|
2019-01-29 17:29:55 +01:00
|
|
|
|
const std::vector<std::shared_ptr<overlay>>& get_dirty() const
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-05-21 14:21:59 +02:00
|
|
|
|
return m_dirty_list;
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Deallocate object. Object must first be removed via the remove() functions
|
|
|
|
|
|
void dispose(const std::vector<u32>& uids)
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-09-03 21:28:33 +02:00
|
|
|
|
std::lock_guard lock(m_list_mutex);
|
2018-05-25 14:34:48 +02:00
|
|
|
|
|
|
|
|
|
|
if (!m_uids_to_remove.empty() || !m_type_ids_to_remove.empty())
|
|
|
|
|
|
{
|
|
|
|
|
|
cleanup_internal();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_dirty_list.erase
|
|
|
|
|
|
(
|
2019-01-29 17:29:55 +01:00
|
|
|
|
std::remove_if(m_dirty_list.begin(), m_dirty_list.end(), [&uids](std::shared_ptr<overlay>& e)
|
2018-05-25 14:34:48 +02:00
|
|
|
|
{
|
|
|
|
|
|
return std::find(uids.begin(), uids.end(), e->uid) != uids.end();
|
2018-05-29 15:00:54 +02:00
|
|
|
|
}),
|
|
|
|
|
|
m_dirty_list.end()
|
2018-05-25 14:34:48 +02:00
|
|
|
|
);
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Returns pointer to the object matching the given uid
|
2019-01-29 17:29:55 +01:00
|
|
|
|
std::shared_ptr<overlay> get(u32 uid)
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-05-25 14:34:48 +02:00
|
|
|
|
reader_lock lock(m_list_mutex);
|
|
|
|
|
|
|
2018-05-20 22:05:00 +02:00
|
|
|
|
for (const auto& iface : m_iface_list)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (iface->uid == uid)
|
2019-01-29 17:29:55 +01:00
|
|
|
|
return iface;
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-01-29 17:29:55 +01:00
|
|
|
|
return {};
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 14:34:48 +02:00
|
|
|
|
// Returns pointer to the first object matching the given type
|
2018-05-20 22:05:00 +02:00
|
|
|
|
template <typename T>
|
2019-01-29 17:29:55 +01:00
|
|
|
|
std::shared_ptr<T> get()
|
2018-05-20 22:05:00 +02:00
|
|
|
|
{
|
2018-05-25 14:34:48 +02:00
|
|
|
|
reader_lock lock(m_list_mutex);
|
|
|
|
|
|
|
2018-05-20 22:05:00 +02:00
|
|
|
|
const auto type_id = id_manager::typeinfo::get_index<T>();
|
|
|
|
|
|
for (const auto& iface : m_iface_list)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (iface->type_index == type_id)
|
|
|
|
|
|
{
|
2019-01-29 17:29:55 +01:00
|
|
|
|
return std::static_pointer_cast<T>(iface);
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-01-29 17:29:55 +01:00
|
|
|
|
return {};
|
2018-05-20 22:05:00 +02:00
|
|
|
|
}
|
2018-05-25 14:34:48 +02:00
|
|
|
|
|
|
|
|
|
|
// Lock for read-only access (BasicLockable)
|
|
|
|
|
|
void lock()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_list_mutex.lock_shared();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Release read-only lock (BasicLockable). May perform internal cleanup before returning
|
|
|
|
|
|
void unlock()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_list_mutex.unlock_shared();
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_uids_to_remove.empty() || !m_type_ids_to_remove.empty())
|
|
|
|
|
|
{
|
2018-09-03 21:28:33 +02:00
|
|
|
|
std::lock_guard lock(m_list_mutex);
|
2018-05-25 14:34:48 +02:00
|
|
|
|
cleanup_internal();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-05-20 22:05:00 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
2019-01-29 17:29:55 +01:00
|
|
|
|
struct osk_dialog : public user_interface, public OskDialogBase
|
|
|
|
|
|
{
|
|
|
|
|
|
using callback_t = std::function<void(const std::string&)>;
|
|
|
|
|
|
|
|
|
|
|
|
enum border_flags
|
|
|
|
|
|
{
|
|
|
|
|
|
top = 1,
|
|
|
|
|
|
bottom = 2,
|
|
|
|
|
|
left = 4,
|
|
|
|
|
|
right = 8,
|
|
|
|
|
|
|
|
|
|
|
|
start_cell = top | bottom | left,
|
|
|
|
|
|
end_cell = top | bottom | right,
|
|
|
|
|
|
middle_cell = top | bottom,
|
|
|
|
|
|
default_cell = top | bottom | left | right
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2019-01-31 12:01:34 +01:00
|
|
|
|
enum button_flags
|
|
|
|
|
|
{
|
|
|
|
|
|
_default = 0,
|
|
|
|
|
|
_return = 1,
|
|
|
|
|
|
_space = 2
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2019-01-29 17:29:55 +01:00
|
|
|
|
struct cell
|
|
|
|
|
|
{
|
|
|
|
|
|
position2u pos;
|
|
|
|
|
|
color4f backcolor{};
|
|
|
|
|
|
border_flags flags = default_cell;
|
|
|
|
|
|
bool selected = false;
|
2019-01-30 10:50:29 +01:00
|
|
|
|
bool enabled = false;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> outputs;
|
|
|
|
|
|
callback_t callback;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct grid_entry_ctor
|
|
|
|
|
|
{
|
|
|
|
|
|
std::vector<std::string> outputs;
|
|
|
|
|
|
color4f color;
|
|
|
|
|
|
u32 num_cell_hz;
|
2019-01-31 12:01:34 +01:00
|
|
|
|
button_flags type_flags;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
callback_t callback;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Base UI
|
|
|
|
|
|
overlay_element m_frame;
|
|
|
|
|
|
overlay_element m_background;
|
|
|
|
|
|
label m_title;
|
2019-01-31 12:01:34 +01:00
|
|
|
|
edit_text m_preview;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
image_button m_btn_accept;
|
|
|
|
|
|
image_button m_btn_cancel;
|
|
|
|
|
|
image_button m_btn_shift;
|
2019-01-30 10:50:29 +01:00
|
|
|
|
image_button m_btn_space;
|
|
|
|
|
|
image_button m_btn_delete;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
|
|
|
|
|
|
// Grid
|
|
|
|
|
|
u32 cell_size_x = 0;
|
|
|
|
|
|
u32 cell_size_y = 0;
|
|
|
|
|
|
u32 num_columns = 0;
|
|
|
|
|
|
u32 num_rows = 0;
|
|
|
|
|
|
u32 num_layers = 0;
|
|
|
|
|
|
u32 selected_x = 0;
|
|
|
|
|
|
u32 selected_y = 0;
|
|
|
|
|
|
u32 selected_z = 0;
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<cell> m_grid;
|
|
|
|
|
|
|
2020-01-07 15:12:32 +01:00
|
|
|
|
// Fade in/out
|
|
|
|
|
|
animation_color_interpolate fade_animation;
|
|
|
|
|
|
|
2019-01-29 17:29:55 +01:00
|
|
|
|
bool m_visible = false;
|
|
|
|
|
|
bool m_update = true;
|
|
|
|
|
|
compiled_resource m_cached_resource;
|
|
|
|
|
|
|
|
|
|
|
|
u32 flags = 0;
|
|
|
|
|
|
u32 char_limit = UINT32_MAX;
|
|
|
|
|
|
|
2019-06-08 09:33:48 +02:00
|
|
|
|
osk_dialog() = default;
|
2019-06-08 09:49:47 +02:00
|
|
|
|
~osk_dialog() override = default;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
|
|
|
|
|
|
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 options) override = 0;
|
2019-06-08 08:22:09 +02:00
|
|
|
|
void Close(bool ok) override;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
|
|
|
|
|
|
void initialize_layout(const std::vector<grid_entry_ctor>& layout, const std::string& title, const std::string& initial_text);
|
2020-01-07 15:12:32 +01:00
|
|
|
|
void update() override;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
|
|
|
|
|
|
void on_button_pressed(pad_button button_press) override;
|
|
|
|
|
|
void on_text_changed();
|
|
|
|
|
|
|
|
|
|
|
|
void on_default_callback(const std::string&);
|
|
|
|
|
|
void on_shift(const std::string&);
|
|
|
|
|
|
void on_space(const std::string&);
|
|
|
|
|
|
void on_backspace(const std::string&);
|
|
|
|
|
|
void on_enter(const std::string&);
|
|
|
|
|
|
|
|
|
|
|
|
compiled_resource get_compiled() override;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2019-09-26 20:35:27 +02:00
|
|
|
|
struct osk_latin : osk_dialog
|
2019-01-29 17:29:55 +01:00
|
|
|
|
{
|
|
|
|
|
|
using osk_dialog::osk_dialog;
|
|
|
|
|
|
|
2019-06-08 09:49:47 +02:00
|
|
|
|
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 options) override;
|
2019-01-29 17:29:55 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
2018-01-17 17:14:00 +01:00
|
|
|
|
struct save_dialog : public user_interface
|
|
|
|
|
|
{
|
|
|
|
|
|
private:
|
|
|
|
|
|
struct save_dialog_entry : horizontal_layout
|
|
|
|
|
|
{
|
|
|
|
|
|
private:
|
|
|
|
|
|
std::unique_ptr<image_info> icon_data;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
2019-05-16 22:48:05 +02:00
|
|
|
|
save_dialog_entry(const std::string& text1, const std::string& text2, const std::string& text3, u8 resource_id, const std::vector<u8>& icon_buf);
|
2018-01-17 17:14:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<overlay_element> m_dim_background;
|
|
|
|
|
|
std::unique_ptr<list_view> m_list;
|
|
|
|
|
|
std::unique_ptr<label> m_description;
|
|
|
|
|
|
std::unique_ptr<label> m_time_thingy;
|
2018-01-30 14:26:00 +01:00
|
|
|
|
std::unique_ptr<label> m_no_saves_text;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2018-01-30 14:26:00 +01:00
|
|
|
|
bool m_no_saves = false;
|
|
|
|
|
|
|
2018-01-17 17:14:00 +01:00
|
|
|
|
public:
|
2019-05-16 22:48:05 +02:00
|
|
|
|
save_dialog();
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
void update() override;
|
|
|
|
|
|
void on_button_pressed(pad_button button_press) override;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
compiled_resource get_compiled() override;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-07-13 21:43:02 +02:00
|
|
|
|
s32 show(std::vector<SaveDataEntry>& save_entries, u32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet);
|
2018-01-17 17:14:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct message_dialog : public user_interface
|
|
|
|
|
|
{
|
|
|
|
|
|
private:
|
|
|
|
|
|
label text_display;
|
|
|
|
|
|
image_button btn_ok;
|
|
|
|
|
|
image_button btn_cancel;
|
|
|
|
|
|
|
|
|
|
|
|
overlay_element bottom_bar, background;
|
2018-07-28 18:06:19 +02:00
|
|
|
|
image_view background_poster;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
progress_bar progress_1, progress_2;
|
|
|
|
|
|
u8 num_progress_bars = 0;
|
2018-06-08 15:20:38 +02:00
|
|
|
|
s32 taskbar_index = 0;
|
|
|
|
|
|
s32 taskbar_limit = 0;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
|
|
|
|
|
bool interactive = false;
|
|
|
|
|
|
bool ok_only = false;
|
|
|
|
|
|
bool cancel_only = false;
|
|
|
|
|
|
|
2018-07-28 18:06:19 +02:00
|
|
|
|
std::unique_ptr<image_info> background_image;
|
|
|
|
|
|
|
2018-01-17 17:14:00 +01:00
|
|
|
|
public:
|
2019-05-16 22:48:05 +02:00
|
|
|
|
message_dialog(bool use_custom_background = false);
|
2018-07-28 18:06:19 +02:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
compiled_resource get_compiled() override;
|
2018-06-08 15:20:38 +02:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
void on_button_pressed(pad_button button_press) override;
|
2018-06-01 18:49:29 +02:00
|
|
|
|
|
2019-12-29 01:01:54 +01:00
|
|
|
|
error_code show(bool is_blocking, const std::string& text, const MsgDialogType& type, std::function<void(s32 status)> on_close);
|
2018-06-01 18:49:29 +02:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
u32 progress_bar_count();
|
|
|
|
|
|
void progress_bar_set_taskbar_index(s32 index);
|
|
|
|
|
|
error_code progress_bar_set_message(u32 index, const std::string& msg);
|
|
|
|
|
|
error_code progress_bar_increment(u32 index, f32 value);
|
|
|
|
|
|
error_code progress_bar_reset(u32 index);
|
|
|
|
|
|
error_code progress_bar_set_limit(u32 index, u32 limit);
|
2018-01-17 17:14:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct trophy_notification : public user_interface
|
|
|
|
|
|
{
|
|
|
|
|
|
private:
|
|
|
|
|
|
overlay_element frame;
|
|
|
|
|
|
image_view image;
|
|
|
|
|
|
label text_view;
|
|
|
|
|
|
|
2020-01-03 18:43:00 +01:00
|
|
|
|
u64 display_sched_id = 0;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
u64 creation_time = 0;
|
|
|
|
|
|
std::unique_ptr<image_info> icon_info;
|
|
|
|
|
|
|
2020-01-03 13:41:34 +01:00
|
|
|
|
animation_translate sliding_animation;
|
|
|
|
|
|
|
2018-01-17 17:14:00 +01:00
|
|
|
|
public:
|
2019-05-16 22:48:05 +02:00
|
|
|
|
trophy_notification();
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
void update() override;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
compiled_resource get_compiled() override;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
s32 show(const SceNpTrophyDetails& trophy, const std::vector<uchar>& trophy_icon_buffer);
|
2018-01-17 17:14:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct shader_compile_notification : user_interface
|
|
|
|
|
|
{
|
|
|
|
|
|
label m_text;
|
|
|
|
|
|
|
|
|
|
|
|
overlay_element dots[3];
|
|
|
|
|
|
u8 current_dot = 255;
|
|
|
|
|
|
|
|
|
|
|
|
u64 creation_time = 0;
|
2018-12-28 14:05:57 +01:00
|
|
|
|
u64 expire_time = 0; // Time to end the prompt
|
|
|
|
|
|
u64 urgency_ctr = 0; // How critical it is to show to the user
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
shader_compile_notification();
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
void update_animation(u64 t);
|
|
|
|
|
|
void touch();
|
|
|
|
|
|
void update() override;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
|
2019-05-16 22:48:05 +02:00
|
|
|
|
compiled_resource get_compiled() override;
|
2018-01-17 17:14:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|