mirror of
https://github.com/izzy2lost/xenia-edge.git
synced 2026-07-06 00:20:26 -07:00
Merge remote-tracking branch 'upstream/canary_experimental' into edge
This commit is contained in:
+10
-18
@@ -75,11 +75,10 @@ struct NtSystemClock {
|
||||
}
|
||||
|
||||
// To convert XSystemClock to sys, do clock_cast<WinSystemTime>(tp) first
|
||||
// SFINAE hack https://stackoverflow.com/a/58813009
|
||||
template <Domain domain_fresh_ = domain_>
|
||||
static constexpr std::enable_if_t<domain_fresh_ == Domain::Host,
|
||||
std::chrono::system_clock::time_point>
|
||||
to_sys(const time_point& tp) {
|
||||
static constexpr std::chrono::system_clock::time_point to_sys(
|
||||
const time_point& tp)
|
||||
requires(domain_ == Domain::Host)
|
||||
{
|
||||
using sys_duration = std::chrono::system_clock::duration;
|
||||
using sys_time = std::chrono::system_clock::time_point;
|
||||
|
||||
@@ -91,22 +90,15 @@ struct NtSystemClock {
|
||||
|
||||
// TODO(Gliniak): Disable until WINE will implement tzdb.
|
||||
/*
|
||||
template <Domain domain_fresh_ = domain_>
|
||||
static constexpr std::enable_if_t<
|
||||
domain_fresh_ == Domain::Host,
|
||||
std::chrono::local_time<std::chrono::system_clock::duration>>
|
||||
to_local(const time_point& tp) {
|
||||
// Return UTC time instead of local to avoid Wine timezone API issues
|
||||
auto sys_tp = to_sys(tp);
|
||||
return std::chrono::local_time<std::chrono::system_clock::duration>(
|
||||
sys_tp.time_since_epoch());
|
||||
}
|
||||
static constexpr std::chrono::local_time<std::chrono::system_clock::duration>
|
||||
to_local(const time_point& tp) requires (domain_ == Domain::Host) {
|
||||
return std::chrono::current_zone()->to_local(to_sys(tp));
|
||||
}*/
|
||||
|
||||
template <Domain domain_fresh_ = domain_>
|
||||
static constexpr std::enable_if_t<domain_fresh_ == Domain::Host, time_point>
|
||||
from_sys(const std::chrono::system_clock::time_point& tp) {
|
||||
static constexpr time_point from_sys(
|
||||
const std::chrono::system_clock::time_point& tp)
|
||||
requires(domain_ == Domain::Host)
|
||||
{
|
||||
auto ctp = std::chrono::time_point_cast<duration>(tp);
|
||||
auto dp = time_point{ctp.time_since_epoch()};
|
||||
dp -= unix_epoch_delta();
|
||||
|
||||
@@ -421,16 +421,6 @@ inline vec128_t from_string<vec128_t>(const std::string_view value,
|
||||
return v;
|
||||
}
|
||||
|
||||
inline std::u16string read_u16string_and_swap(const char16_t* string_ptr) {
|
||||
std::u16string input_str = std::u16string(string_ptr);
|
||||
|
||||
std::u16string output_str = {};
|
||||
output_str.resize(input_str.size() + 1);
|
||||
copy_and_swap_truncating(output_str.data(), input_str, input_str.size() + 1);
|
||||
output_str.pop_back(); // Remove nullptr added by copy_and_swap.
|
||||
return output_str;
|
||||
}
|
||||
|
||||
inline size_t size_in_bytes(std::variant<std::string, std::u16string> string,
|
||||
bool include_terminator = true) {
|
||||
if (std::holds_alternative<std::string>(string)) {
|
||||
@@ -444,6 +434,17 @@ inline size_t size_in_bytes(std::variant<std::string, std::u16string> string,
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline std::u16string read_u16string_and_swap(const char16_t* string_ptr) {
|
||||
std::u16string input_str = std::u16string(string_ptr);
|
||||
|
||||
std::u16string output_str = {};
|
||||
output_str.resize(input_str.size() + 1);
|
||||
copy_and_swap_truncating(output_str.data(), input_str,
|
||||
size_in_bytes(input_str, false));
|
||||
output_str.pop_back(); // Remove nullptr added by copy_and_swap.
|
||||
return output_str;
|
||||
}
|
||||
|
||||
} // namespace string_util
|
||||
} // namespace xe
|
||||
|
||||
|
||||
@@ -500,15 +500,16 @@ enum class KernelModuleId {
|
||||
};
|
||||
|
||||
template <size_t I = 0, typename... Ps>
|
||||
typename std::enable_if<I == sizeof...(Ps)>::type AppendKernelCallParams(
|
||||
StringBuffer& string_buffer, xe::cpu::Export* export_entry,
|
||||
const std::tuple<Ps...>&) {}
|
||||
requires(I == sizeof...(Ps))
|
||||
void AppendKernelCallParams(StringBuffer& string_buffer,
|
||||
xe::cpu::Export* export_entry,
|
||||
const std::tuple<Ps...>&) {}
|
||||
|
||||
template <size_t I = 0, typename... Ps>
|
||||
typename std::enable_if <
|
||||
I<sizeof...(Ps)>::type AppendKernelCallParams(
|
||||
StringBuffer& string_buffer, xe::cpu::Export* export_entry,
|
||||
const std::tuple<Ps...>& params) {
|
||||
requires(I < sizeof...(Ps))
|
||||
void AppendKernelCallParams(StringBuffer& string_buffer,
|
||||
xe::cpu::Export* export_entry,
|
||||
const std::tuple<Ps...>& params) {
|
||||
if (I) {
|
||||
string_buffer.Append(", ");
|
||||
}
|
||||
|
||||
@@ -242,9 +242,7 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
xe::be<uint32_t> results_guest_address;
|
||||
}* data = reinterpret_cast<XUserReadStats*>(buffer);
|
||||
|
||||
if (!data->results_guest_address) {
|
||||
return 1;
|
||||
}
|
||||
return 0x80151802; // X_ONLINE_E_LOGON_NOT_LOGGED_ON
|
||||
}
|
||||
case 0x000B0036: {
|
||||
// Called after opening xbox live arcade and clicking on xbox live v5759
|
||||
|
||||
@@ -53,44 +53,38 @@ X_HRESULT XLiveBaseApp::DispatchMessageSync(uint32_t message,
|
||||
return X_E_FAIL;
|
||||
}
|
||||
case 0x00058003: {
|
||||
// Called on startup of dashboard (netplay build)
|
||||
XELOGD("XLiveBaseLogonGetHR, unimplemented");
|
||||
return X_E_SUCCESS;
|
||||
/* Notes:
|
||||
- Called on startup of dashboard (netplay build)
|
||||
- used by other internet funtions to check if online (e.g.
|
||||
XamGetLiveHiveValueA)
|
||||
- Return is Saved elsewhere and used here
|
||||
*/
|
||||
XELOGD("XLiveBaseLogonGetHR, implemented in netplay");
|
||||
return 0x001510F1; // X_ONLINE_S_LOGON_DISCONNECTED
|
||||
}
|
||||
case 0x00058004: {
|
||||
// Called on startup, seems to just return a bool in the buffer.
|
||||
/* Notes:
|
||||
- Called on startup, seems to just return a bool in the buffer.
|
||||
- It is Saved elsewhere and used here
|
||||
*/
|
||||
assert_true(!buffer_length || buffer_length == 4);
|
||||
XELOGD("XLiveBaseGetLogonId({:08X})", buffer_ptr);
|
||||
xe::store_and_swap<uint32_t>(buffer + 0, 1); // ?
|
||||
xe::store_and_swap<uint32_t>(buffer, 1); // ?
|
||||
return X_E_SUCCESS;
|
||||
}
|
||||
case 0x00058006: {
|
||||
// Buffer only set when online
|
||||
assert_true(!buffer_length || buffer_length == 4);
|
||||
XELOGD("XLiveBaseGetNatType({:08X})", buffer_ptr);
|
||||
xe::store_and_swap<uint32_t>(buffer + 0, 1); // XONLINE_NAT_OPEN
|
||||
return X_E_SUCCESS;
|
||||
return 0x80151802; // X_ONLINE_E_LOGON_NOT_LOGGED_ON
|
||||
}
|
||||
case 0x00058007: {
|
||||
// Occurs if title calls XOnlineGetServiceInfo, expects dwServiceId
|
||||
// and pServiceInfo. pServiceInfo should contain pointer to
|
||||
// XONLINE_SERVICE_INFO structure.
|
||||
XELOGD("CXLiveLogon::GetServiceInfo({:08X}, {:08X})", buffer_ptr,
|
||||
XELOGD("XLiveBaseOnlineGetServiceInfo({:08X}, {:08X})", buffer_ptr,
|
||||
buffer_length);
|
||||
XONLINE_SERVICE_INFO* service_info =
|
||||
reinterpret_cast<XONLINE_SERVICE_INFO*>(
|
||||
memory_->TranslateVirtual(buffer_length));
|
||||
memset(service_info, 0, sizeof(XONLINE_SERVICE_INFO));
|
||||
XELOGD("IP is {}", service_info->ip.s_addr);
|
||||
service_info->id = buffer_ptr;
|
||||
service_info->ip.s_addr = htonl(INADDR_LOOPBACK);
|
||||
return X_ERROR_SUCCESS;
|
||||
// return 0x80151802; // ERROR_CONNECTION_INVALID
|
||||
}
|
||||
case 0x00050008: {
|
||||
// Required to be successful for 534507D4
|
||||
XELOGD("XUserCheckPrivilege({:08x}, {:08x}) unimplemented", buffer_ptr,
|
||||
buffer_length);
|
||||
return X_E_SUCCESS;
|
||||
return 0x80151802; // X_ONLINE_E_LOGON_NOT_LOGGED_ON
|
||||
}
|
||||
case 0x00058020: {
|
||||
// 0x00058004 is called right before this.
|
||||
|
||||
@@ -451,15 +451,18 @@ struct GamerPictureKey {
|
||||
char small_tile_id[8];
|
||||
|
||||
uint32_t GetTitleId() const {
|
||||
return string_util::from_string<uint32_t>(title_id, true);
|
||||
return string_util::from_string<uint32_t>(
|
||||
std::string(title_id, std::size(title_id)), true);
|
||||
}
|
||||
|
||||
uint32_t GetBigTileId() const {
|
||||
return string_util::from_string<uint32_t>(big_tile_id, true);
|
||||
return string_util::from_string<uint32_t>(
|
||||
std::string(big_tile_id, std::size(big_tile_id)), true);
|
||||
}
|
||||
|
||||
uint32_t GetSmallTileId() const {
|
||||
return string_util::from_string<uint32_t>(small_tile_id, true);
|
||||
return string_util::from_string<uint32_t>(
|
||||
std::string(small_tile_id, std::size(small_tile_id)), true);
|
||||
}
|
||||
};
|
||||
static_assert_size(GamerPictureKey, 0x18);
|
||||
|
||||
@@ -840,7 +840,7 @@ void UserTracker::UpsertSetting(uint64_t xuid, uint32_t title_id,
|
||||
// Sometimes games like to ignore providing expicitly title_id, so we need to
|
||||
// check it.
|
||||
if (!title_id) {
|
||||
title_id = spa_data_->title_id();
|
||||
title_id = spa_data_ ? spa_data_->title_id() : kernel_state()->title_id();
|
||||
}
|
||||
|
||||
GpdInfo* info = user->GetGpd(title_id);
|
||||
|
||||
@@ -286,8 +286,8 @@ class object_ref {
|
||||
reset(right.get());
|
||||
if (value_) value_->Retain();
|
||||
}
|
||||
template <class V, class = typename std::enable_if<
|
||||
std::is_convertible<V*, T*>::value, void>::type>
|
||||
template <class V>
|
||||
requires std::is_convertible_v<V*, T*>
|
||||
object_ref(const object_ref<V>& right) noexcept {
|
||||
reset(right.get());
|
||||
if (value_) value_->Retain();
|
||||
@@ -379,8 +379,8 @@ bool operator!=(std::nullptr_t _Left, const object_ref<_Ty>& _Right) noexcept {
|
||||
}
|
||||
|
||||
template <class T, class... Args>
|
||||
std::enable_if_t<!std::is_array<T>::value, object_ref<T>> make_object(
|
||||
Args&&... args) {
|
||||
requires(!std::is_array_v<T>)
|
||||
object_ref<T> make_object(Args&&... args) {
|
||||
return object_ref<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user