mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
[Logs] Implement format_n for char[N]
This commit is contained in:
parent
bc4cd8dc4f
commit
d1651531c3
4 changed files with 48 additions and 31 deletions
|
|
@ -615,10 +615,10 @@ SysResult sys_jitshm_alias(Thread *thread /* TODO */);
|
|||
SysResult sys_dl_get_list(Thread *thread /* TODO */);
|
||||
SysResult sys_dl_get_info(Thread *thread /* TODO */);
|
||||
SysResult sys_dl_notify_event(Thread *thread /* TODO */);
|
||||
SysResult sys_evf_create(Thread *thread, ptr<char> name, sint attrs,
|
||||
SysResult sys_evf_create(Thread *thread, ptr<const char[32]> name, sint attrs,
|
||||
ptr<struct evFlag> evf);
|
||||
SysResult sys_evf_delete(Thread *thread, sint id);
|
||||
SysResult sys_evf_open(Thread *thread, ptr<char> name);
|
||||
SysResult sys_evf_open(Thread *thread, ptr<const char[32]> name);
|
||||
SysResult sys_evf_close(Thread *thread, sint id);
|
||||
SysResult sys_evf_wait(Thread *thread, sint id, uint64_t patternSet,
|
||||
uint64_t mode, ptr<uint64_t> pPatternSet,
|
||||
|
|
@ -640,7 +640,7 @@ SysResult sys_osem_wait(Thread *thread /* TODO */);
|
|||
SysResult sys_osem_trywait(Thread *thread /* TODO */);
|
||||
SysResult sys_osem_post(Thread *thread /* TODO */);
|
||||
SysResult sys_osem_cancel(Thread *thread /* TODO */);
|
||||
SysResult sys_namedobj_create(Thread *thread, ptr<const char> name,
|
||||
SysResult sys_namedobj_create(Thread *thread, ptr<const char[32]> name,
|
||||
ptr<void> object, uint16_t type);
|
||||
SysResult sys_namedobj_delete(Thread *thread, uint16_t id, uint16_t type);
|
||||
SysResult sys_set_vm_container(Thread *thread /* TODO */);
|
||||
|
|
|
|||
|
|
@ -34,18 +34,31 @@ template <typename T>
|
|||
struct log_class_string<T *, void> : log_class_string<void *, void> {};
|
||||
|
||||
template <> struct log_class_string<char *, void> {
|
||||
static void format_n(std::string &out, const void *str, std::size_t n);
|
||||
static void format(std::string &out, const void *arg);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct log_class_string<const char *, void> : log_class_string<char *> {};
|
||||
|
||||
template <std::size_t N> struct log_class_string<char[N]> {
|
||||
static void format(std::string &out, const void *arg) {
|
||||
out += reinterpret_cast<const char *>(arg);
|
||||
log_class_string<char *, void>::format_n(out, arg, N);
|
||||
}
|
||||
};
|
||||
|
||||
template <std::size_t N> struct log_class_string<const char[N]> {
|
||||
static void format(std::string &out, const void *arg) {
|
||||
log_class_string<char *, void>::format_n(out, arg, N);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct log_class_string<char8_t *, void> : log_class_string<char *> {};
|
||||
|
||||
template <>
|
||||
struct log_class_string<const char8_t *, void> : log_class_string<char *> {};
|
||||
|
||||
template <typename... Args>
|
||||
using log_args_t = const void *(&&)[sizeof...(Args) + 1];
|
||||
|
||||
|
|
@ -59,22 +72,9 @@ struct log_type_info {
|
|||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template <typename T> struct remove_const_data {
|
||||
using type = T;
|
||||
};
|
||||
template <typename T> struct remove_const_data<const T *> {
|
||||
using type = T *;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using remove_const_data_t = typename remove_const_data<T>::type;
|
||||
} // namespace detail
|
||||
|
||||
template <typename... Args>
|
||||
constexpr const log_type_info type_info_v[sizeof...(Args) + 1]{
|
||||
log_type_info::make<
|
||||
detail::remove_const_data_t<std::remove_cvref_t<Args>>>()...};
|
||||
log_type_info::make<std::remove_cvref_t<Args>>()...};
|
||||
|
||||
void _orbis_log_print(LogLevel lvl, const char *msg, std::string_view names,
|
||||
const log_type_info *sup, ...);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue