summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/time/time_zone_manager.cpp9
-rw-r--r--src/core/hle/service/time/time_zone_manager.h1
-rw-r--r--src/core/hle/service/time/time_zone_service.cpp24
-rw-r--r--src/core/hle/service/time/time_zone_service.h1
-rw-r--r--src/core/loader/nso.cpp11
-rw-r--r--src/core/loader/nso.h2
-rw-r--r--src/core/settings.h3
7 files changed, 47 insertions, 4 deletions
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp
index 717e81818..07b553a43 100644
--- a/src/core/hle/service/time/time_zone_manager.cpp
+++ b/src/core/hle/service/time/time_zone_manager.cpp
@@ -1019,6 +1019,15 @@ ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules,
return RESULT_SUCCESS;
}
+ResultCode TimeZoneManager::ToPosixTimeWithMyRule(const CalendarTime& calendar_time,
+ s64& posix_time) const {
+ if (is_initialized) {
+ return ToPosixTime(time_zone_rule, calendar_time, posix_time);
+ }
+ posix_time = 0;
+ return ERROR_UNINITIALIZED_CLOCK;
+}
+
ResultCode TimeZoneManager::GetDeviceLocationName(LocationName& value) const {
if (!is_initialized) {
return ERROR_UNINITIALIZED_CLOCK;
diff --git a/src/core/hle/service/time/time_zone_manager.h b/src/core/hle/service/time/time_zone_manager.h
index 7c6f975ae..aaab0a1e0 100644
--- a/src/core/hle/service/time/time_zone_manager.h
+++ b/src/core/hle/service/time/time_zone_manager.h
@@ -39,6 +39,7 @@ public:
ResultCode ParseTimeZoneRuleBinary(TimeZoneRule& rules, FileSys::VirtualFile& vfs_file) const;
ResultCode ToPosixTime(const TimeZoneRule& rules, const CalendarTime& calendar_time,
s64& posix_time) const;
+ ResultCode ToPosixTimeWithMyRule(const CalendarTime& calendar_time, s64& posix_time) const;
private:
bool is_initialized{};
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp
index 1566e778e..db57ae069 100644
--- a/src/core/hle/service/time/time_zone_service.cpp
+++ b/src/core/hle/service/time/time_zone_service.cpp
@@ -22,7 +22,7 @@ ITimeZoneService ::ITimeZoneService(TimeZone::TimeZoneContentManager& time_zone_
{100, &ITimeZoneService::ToCalendarTime, "ToCalendarTime"},
{101, &ITimeZoneService::ToCalendarTimeWithMyRule, "ToCalendarTimeWithMyRule"},
{201, &ITimeZoneService::ToPosixTime, "ToPosixTime"},
- {202, nullptr, "ToPosixTimeWithMyRule"},
+ {202, &ITimeZoneService::ToPosixTimeWithMyRule, "ToPosixTimeWithMyRule"},
};
RegisterHandlers(functions);
}
@@ -145,4 +145,26 @@ void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) {
ctx.WriteBuffer(&posix_time, sizeof(s64));
}
+void ITimeZoneService::ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) {
+ LOG_DEBUG(Service_Time, "called");
+
+ IPC::RequestParser rp{ctx};
+ const auto calendar_time{rp.PopRaw<TimeZone::CalendarTime>()};
+
+ s64 posix_time{};
+ if (const ResultCode result{
+ time_zone_content_manager.GetTimeZoneManager().ToPosixTimeWithMyRule(calendar_time,
+ posix_time)};
+ result != RESULT_SUCCESS) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(result);
+ return;
+ }
+
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushRaw<u32>(1); // Number of times we're returning
+ ctx.WriteBuffer(&posix_time, sizeof(s64));
+}
+
} // namespace Service::Time
diff --git a/src/core/hle/service/time/time_zone_service.h b/src/core/hle/service/time/time_zone_service.h
index a92b4312b..cb495748b 100644
--- a/src/core/hle/service/time/time_zone_service.h
+++ b/src/core/hle/service/time/time_zone_service.h
@@ -22,6 +22,7 @@ private:
void ToCalendarTime(Kernel::HLERequestContext& ctx);
void ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx);
void ToPosixTime(Kernel::HLERequestContext& ctx);
+ void ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx);
private:
TimeZone::TimeZoneContentManager& time_zone_content_manager;
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 515c5accb..044067a5b 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -97,7 +97,8 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,
if (nso_header.IsSegmentCompressed(i)) {
data = DecompressSegment(data, nso_header.segments[i]);
}
- program_image.resize(nso_header.segments[i].location + data.size());
+ program_image.resize(nso_header.segments[i].location +
+ PageAlignSize(static_cast<u32>(data.size())));
std::memcpy(program_image.data() + nso_header.segments[i].location, data.data(),
data.size());
codeset.segments[i].addr = nso_header.segments[i].location;
@@ -105,8 +106,12 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,
codeset.segments[i].size = PageAlignSize(static_cast<u32>(data.size()));
}
- if (should_pass_arguments && !Settings::values.program_args.empty()) {
- const auto arg_data = Settings::values.program_args;
+ if (should_pass_arguments) {
+ std::vector<u8> arg_data{Settings::values.program_args.begin(),
+ Settings::values.program_args.end()};
+ if (arg_data.empty()) {
+ arg_data.resize(NSO_ARGUMENT_DEFAULT_SIZE);
+ }
codeset.DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE;
NSOArgumentHeader args_header{
NSO_ARGUMENT_DATA_ALLOCATION_SIZE, static_cast<u32_le>(arg_data.size()), {}};
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h
index 58cbe162d..d2d600cd9 100644
--- a/src/core/loader/nso.h
+++ b/src/core/loader/nso.h
@@ -56,6 +56,8 @@ static_assert(sizeof(NSOHeader) == 0x100, "NSOHeader has incorrect size.");
static_assert(std::is_trivially_copyable_v<NSOHeader>, "NSOHeader must be trivially copyable.");
constexpr u64 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000;
+// NOTE: Official software default argument state is unverified.
+constexpr u64 NSO_ARGUMENT_DEFAULT_SIZE = 1;
struct NSOArgumentHeader {
u32_le allocated_size;
diff --git a/src/core/settings.h b/src/core/settings.h
index 9c98a9287..421e76f5f 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -401,6 +401,9 @@ struct Values {
std::string motion_device;
TouchscreenInput touchscreen;
std::atomic_bool is_device_reload_pending{true};
+ std::string udp_input_address;
+ u16 udp_input_port;
+ u8 udp_pad_index;
// Core
bool use_multi_core;