forked from etc/pineapple-src
early-access version 3439
This commit is contained in:
parent
0de89fc8b6
commit
294b1b8c34
45 changed files with 377 additions and 432 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3438.
|
This is the source code for early-access 3439.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ Manager::Manager(Core::System& system_) : system{system_} {
|
||||||
Result Manager::AcquireSessionId(size_t& session_id) {
|
Result Manager::AcquireSessionId(size_t& session_id) {
|
||||||
if (num_free_sessions == 0) {
|
if (num_free_sessions == 0) {
|
||||||
LOG_ERROR(Service_Audio, "All 4 AudioIn sessions are in use, cannot create any more");
|
LOG_ERROR(Service_Audio, "All 4 AudioIn sessions are in use, cannot create any more");
|
||||||
return Service::Audio::ERR_MAXIMUM_SESSIONS_REACHED;
|
return Service::Audio::ResultOutOfSessions;
|
||||||
}
|
}
|
||||||
session_id = session_ids[next_session_id];
|
session_id = session_ids[next_session_id];
|
||||||
next_session_id = (next_session_id + 1) % MaxInSessions;
|
next_session_id = (next_session_id + 1) % MaxInSessions;
|
||||||
|
|
|
@ -19,7 +19,7 @@ void AudioManager::Shutdown() {
|
||||||
|
|
||||||
Result AudioManager::SetOutManager(BufferEventFunc buffer_func) {
|
Result AudioManager::SetOutManager(BufferEventFunc buffer_func) {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
return Service::Audio::ERR_OPERATION_FAILED;
|
return Service::Audio::ResultOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::scoped_lock l{lock};
|
std::scoped_lock l{lock};
|
||||||
|
@ -35,7 +35,7 @@ Result AudioManager::SetOutManager(BufferEventFunc buffer_func) {
|
||||||
|
|
||||||
Result AudioManager::SetInManager(BufferEventFunc buffer_func) {
|
Result AudioManager::SetInManager(BufferEventFunc buffer_func) {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
return Service::Audio::ERR_OPERATION_FAILED;
|
return Service::Audio::ResultOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::scoped_lock l{lock};
|
std::scoped_lock l{lock};
|
||||||
|
|
|
@ -19,7 +19,7 @@ Manager::Manager(Core::System& system_) : system{system_} {
|
||||||
Result Manager::AcquireSessionId(size_t& session_id) {
|
Result Manager::AcquireSessionId(size_t& session_id) {
|
||||||
if (num_free_sessions == 0) {
|
if (num_free_sessions == 0) {
|
||||||
LOG_ERROR(Service_Audio, "All 12 Audio Out sessions are in use, cannot create any more");
|
LOG_ERROR(Service_Audio, "All 12 Audio Out sessions are in use, cannot create any more");
|
||||||
return Service::Audio::ERR_MAXIMUM_SESSIONS_REACHED;
|
return Service::Audio::ResultOutOfSessions;
|
||||||
}
|
}
|
||||||
session_id = session_ids[next_session_id];
|
session_id = session_ids[next_session_id];
|
||||||
next_session_id = (next_session_id + 1) % MaxOutSessions;
|
next_session_id = (next_session_id + 1) % MaxOutSessions;
|
||||||
|
|
|
@ -28,7 +28,7 @@ SystemManager& Manager::GetSystemManager() {
|
||||||
Result Manager::GetWorkBufferSize(const AudioRendererParameterInternal& params,
|
Result Manager::GetWorkBufferSize(const AudioRendererParameterInternal& params,
|
||||||
u64& out_count) const {
|
u64& out_count) const {
|
||||||
if (!CheckValidRevision(params.revision)) {
|
if (!CheckValidRevision(params.revision)) {
|
||||||
return Service::Audio::ERR_INVALID_REVISION;
|
return Service::Audio::ResultInvalidRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_count = System::GetWorkBufferSize(params);
|
out_count = System::GetWorkBufferSize(params);
|
||||||
|
|
|
@ -46,7 +46,7 @@ Result In::AppendBuffer(const AudioInBuffer& buffer, u64 tag) {
|
||||||
if (system.AppendBuffer(buffer, tag)) {
|
if (system.AppendBuffer(buffer, tag)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
return Service::Audio::ERR_BUFFER_COUNT_EXCEEDED;
|
return Service::Audio::ResultBufferCountReached;
|
||||||
}
|
}
|
||||||
|
|
||||||
void In::ReleaseAndRegisterBuffers() {
|
void In::ReleaseAndRegisterBuffers() {
|
||||||
|
|
|
@ -45,11 +45,11 @@ Result System::IsConfigValid(const std::string_view device_name,
|
||||||
const AudioInParameter& in_params) const {
|
const AudioInParameter& in_params) const {
|
||||||
if ((device_name.size() > 0) &&
|
if ((device_name.size() > 0) &&
|
||||||
(device_name != GetDefaultDeviceName() && device_name != GetDefaultUacDeviceName())) {
|
(device_name != GetDefaultDeviceName() && device_name != GetDefaultUacDeviceName())) {
|
||||||
return Service::Audio::ERR_INVALID_DEVICE_NAME;
|
return Service::Audio::ResultNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.sample_rate != TargetSampleRate && in_params.sample_rate > 0) {
|
if (in_params.sample_rate != TargetSampleRate && in_params.sample_rate > 0) {
|
||||||
return Service::Audio::ERR_INVALID_SAMPLE_RATE;
|
return Service::Audio::ResultInvalidSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
|
@ -80,7 +80,7 @@ Result System::Initialize(std::string device_name, const AudioInParameter& in_pa
|
||||||
|
|
||||||
Result System::Start() {
|
Result System::Start() {
|
||||||
if (state != State::Stopped) {
|
if (state != State::Stopped) {
|
||||||
return Service::Audio::ERR_OPERATION_FAILED;
|
return Service::Audio::ResultOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->Initialize(name, sample_format, channel_count, session_id, handle,
|
session->Initialize(name, sample_format, channel_count, session_id, handle,
|
||||||
|
|
|
@ -46,7 +46,7 @@ Result Out::AppendBuffer(const AudioOutBuffer& buffer, const u64 tag) {
|
||||||
if (system.AppendBuffer(buffer, tag)) {
|
if (system.AppendBuffer(buffer, tag)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
return Service::Audio::ERR_BUFFER_COUNT_EXCEEDED;
|
return Service::Audio::ResultBufferCountReached;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Out::ReleaseAndRegisterBuffers() {
|
void Out::ReleaseAndRegisterBuffers() {
|
||||||
|
|
|
@ -33,11 +33,11 @@ std::string_view System::GetDefaultOutputDeviceName() const {
|
||||||
Result System::IsConfigValid(std::string_view device_name,
|
Result System::IsConfigValid(std::string_view device_name,
|
||||||
const AudioOutParameter& in_params) const {
|
const AudioOutParameter& in_params) const {
|
||||||
if ((device_name.size() > 0) && (device_name != GetDefaultOutputDeviceName())) {
|
if ((device_name.size() > 0) && (device_name != GetDefaultOutputDeviceName())) {
|
||||||
return Service::Audio::ERR_INVALID_DEVICE_NAME;
|
return Service::Audio::ResultNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.sample_rate != TargetSampleRate && in_params.sample_rate > 0) {
|
if (in_params.sample_rate != TargetSampleRate && in_params.sample_rate > 0) {
|
||||||
return Service::Audio::ERR_INVALID_SAMPLE_RATE;
|
return Service::Audio::ResultInvalidSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.channel_count == 0 || in_params.channel_count == 2 ||
|
if (in_params.channel_count == 0 || in_params.channel_count == 2 ||
|
||||||
|
@ -45,7 +45,7 @@ Result System::IsConfigValid(std::string_view device_name,
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Service::Audio::ERR_INVALID_CHANNEL_COUNT;
|
return Service::Audio::ResultInvalidChannelCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result System::Initialize(std::string device_name, const AudioOutParameter& in_params, u32 handle_,
|
Result System::Initialize(std::string device_name, const AudioOutParameter& in_params, u32 handle_,
|
||||||
|
@ -80,7 +80,7 @@ size_t System::GetSessionId() const {
|
||||||
|
|
||||||
Result System::Start() {
|
Result System::Start() {
|
||||||
if (state != State::Stopped) {
|
if (state != State::Stopped) {
|
||||||
return Service::Audio::ERR_OPERATION_FAILED;
|
return Service::Audio::ResultOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->Initialize(name, sample_format, channel_count, session_id, handle,
|
session->Initialize(name, sample_format, channel_count, session_id, handle,
|
||||||
|
|
|
@ -22,7 +22,7 @@ Result Renderer::Initialize(const AudioRendererParameterInternal& params,
|
||||||
if (!manager.AddSystem(system)) {
|
if (!manager.AddSystem(system)) {
|
||||||
LOG_ERROR(Service_Audio,
|
LOG_ERROR(Service_Audio,
|
||||||
"Both Audio Render sessions are in use, cannot create any more");
|
"Both Audio Render sessions are in use, cannot create any more");
|
||||||
return Service::Audio::ERR_MAXIMUM_SESSIONS_REACHED;
|
return Service::Audio::ResultOutOfSessions;
|
||||||
}
|
}
|
||||||
system_registered = true;
|
system_registered = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ Result InfoUpdater::UpdateVoiceChannelResources(VoiceContext& voice_context) {
|
||||||
LOG_ERROR(Service_Audio,
|
LOG_ERROR(Service_Audio,
|
||||||
"Consumed an incorrect voice resource size, header size={}, consumed={}",
|
"Consumed an incorrect voice resource size, header size={}, consumed={}",
|
||||||
in_header->voice_resources_size, consumed_input_size);
|
in_header->voice_resources_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
input += consumed_input_size;
|
input += consumed_input_size;
|
||||||
|
@ -123,7 +123,7 @@ Result InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
||||||
if (consumed_input_size != in_header->voices_size) {
|
if (consumed_input_size != in_header->voices_size) {
|
||||||
LOG_ERROR(Service_Audio, "Consumed an incorrect voices size, header size={}, consumed={}",
|
LOG_ERROR(Service_Audio, "Consumed an incorrect voices size, header size={}, consumed={}",
|
||||||
in_header->voices_size, consumed_input_size);
|
in_header->voices_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_header->voices_size = consumed_output_size;
|
out_header->voices_size = consumed_output_size;
|
||||||
|
@ -184,7 +184,7 @@ Result InfoUpdater::UpdateEffectsVersion1(EffectContext& effect_context, const b
|
||||||
if (consumed_input_size != in_header->effects_size) {
|
if (consumed_input_size != in_header->effects_size) {
|
||||||
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
|
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
|
||||||
in_header->effects_size, consumed_input_size);
|
in_header->effects_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_header->effects_size = consumed_output_size;
|
out_header->effects_size = consumed_output_size;
|
||||||
|
@ -239,7 +239,7 @@ Result InfoUpdater::UpdateEffectsVersion2(EffectContext& effect_context, const b
|
||||||
if (consumed_input_size != in_header->effects_size) {
|
if (consumed_input_size != in_header->effects_size) {
|
||||||
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
|
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
|
||||||
in_header->effects_size, consumed_input_size);
|
in_header->effects_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_header->effects_size = consumed_output_size;
|
out_header->effects_size = consumed_output_size;
|
||||||
|
@ -267,7 +267,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mix_buffer_count == 0) {
|
if (mix_buffer_count == 0) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<const MixInfo::InParameter> in_params{
|
std::span<const MixInfo::InParameter> in_params{
|
||||||
|
@ -281,13 +281,13 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||||
total_buffer_count += params.buffer_count;
|
total_buffer_count += params.buffer_count;
|
||||||
if (params.dest_mix_id > static_cast<s32>(mix_context.GetCount()) &&
|
if (params.dest_mix_id > static_cast<s32>(mix_context.GetCount()) &&
|
||||||
params.dest_mix_id != UnusedMixId && params.mix_id != FinalMixId) {
|
params.dest_mix_id != UnusedMixId && params.mix_id != FinalMixId) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (total_buffer_count > mix_buffer_count) {
|
if (total_buffer_count > mix_buffer_count) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mix_dirty{false};
|
bool mix_dirty{false};
|
||||||
|
@ -317,7 +317,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||||
if (mix_dirty) {
|
if (mix_dirty) {
|
||||||
if (behaviour.IsSplitterSupported() && splitter_context.UsingSplitter()) {
|
if (behaviour.IsSplitterSupported() && splitter_context.UsingSplitter()) {
|
||||||
if (!mix_context.TSortInfo(splitter_context)) {
|
if (!mix_context.TSortInfo(splitter_context)) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mix_context.SortInfo();
|
mix_context.SortInfo();
|
||||||
|
@ -327,7 +327,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||||
if (consumed_input_size != in_header->mix_size) {
|
if (consumed_input_size != in_header->mix_size) {
|
||||||
LOG_ERROR(Service_Audio, "Consumed an incorrect mixes size, header size={}, consumed={}",
|
LOG_ERROR(Service_Audio, "Consumed an incorrect mixes size, header size={}, consumed={}",
|
||||||
in_header->mix_size, consumed_input_size);
|
in_header->mix_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
input += mix_count * sizeof(MixInfo::InParameter);
|
input += mix_count * sizeof(MixInfo::InParameter);
|
||||||
|
@ -384,7 +384,7 @@ Result InfoUpdater::UpdateSinks(SinkContext& sink_context, std::span<MemoryPoolI
|
||||||
if (consumed_input_size != in_header->sinks_size) {
|
if (consumed_input_size != in_header->sinks_size) {
|
||||||
LOG_ERROR(Service_Audio, "Consumed an incorrect sinks size, header size={}, consumed={}",
|
LOG_ERROR(Service_Audio, "Consumed an incorrect sinks size, header size={}, consumed={}",
|
||||||
in_header->sinks_size, consumed_input_size);
|
in_header->sinks_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
input += consumed_input_size;
|
input += consumed_input_size;
|
||||||
|
@ -411,7 +411,7 @@ Result InfoUpdater::UpdateMemoryPools(std::span<MemoryPoolInfo> memory_pools,
|
||||||
state != MemoryPoolInfo::ResultState::MapFailed &&
|
state != MemoryPoolInfo::ResultState::MapFailed &&
|
||||||
state != MemoryPoolInfo::ResultState::InUse) {
|
state != MemoryPoolInfo::ResultState::InUse) {
|
||||||
LOG_WARNING(Service_Audio, "Invalid ResultState from updating memory pools");
|
LOG_WARNING(Service_Audio, "Invalid ResultState from updating memory pools");
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ Result InfoUpdater::UpdateMemoryPools(std::span<MemoryPoolInfo> memory_pools,
|
||||||
LOG_ERROR(Service_Audio,
|
LOG_ERROR(Service_Audio,
|
||||||
"Consumed an incorrect memory pool size, header size={}, consumed={}",
|
"Consumed an incorrect memory pool size, header size={}, consumed={}",
|
||||||
in_header->memory_pool_size, consumed_input_size);
|
in_header->memory_pool_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
input += consumed_input_size;
|
input += consumed_input_size;
|
||||||
|
@ -453,7 +453,7 @@ Result InfoUpdater::UpdatePerformanceBuffer(std::span<u8> performance_output,
|
||||||
LOG_ERROR(Service_Audio,
|
LOG_ERROR(Service_Audio,
|
||||||
"Consumed an incorrect performance size, header size={}, consumed={}",
|
"Consumed an incorrect performance size, header size={}, consumed={}",
|
||||||
in_header->performance_buffer_size, consumed_input_size);
|
in_header->performance_buffer_size, consumed_input_size);
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
input += consumed_input_size;
|
input += consumed_input_size;
|
||||||
|
@ -467,18 +467,18 @@ Result InfoUpdater::UpdateBehaviorInfo(BehaviorInfo& behaviour_) {
|
||||||
const auto in_params{reinterpret_cast<const BehaviorInfo::InParameter*>(input)};
|
const auto in_params{reinterpret_cast<const BehaviorInfo::InParameter*>(input)};
|
||||||
|
|
||||||
if (!CheckValidRevision(in_params->revision)) {
|
if (!CheckValidRevision(in_params->revision)) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params->revision != behaviour_.GetUserRevision()) {
|
if (in_params->revision != behaviour_.GetUserRevision()) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
behaviour_.ClearError();
|
behaviour_.ClearError();
|
||||||
behaviour_.UpdateFlags(in_params->flags);
|
behaviour_.UpdateFlags(in_params->flags);
|
||||||
|
|
||||||
if (in_header->behaviour_size != sizeof(BehaviorInfo::InParameter)) {
|
if (in_header->behaviour_size != sizeof(BehaviorInfo::InParameter)) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
input += sizeof(BehaviorInfo::InParameter);
|
input += sizeof(BehaviorInfo::InParameter);
|
||||||
|
@ -500,7 +500,7 @@ Result InfoUpdater::UpdateErrorInfo(const BehaviorInfo& behaviour_) {
|
||||||
Result InfoUpdater::UpdateSplitterInfo(SplitterContext& splitter_context) {
|
Result InfoUpdater::UpdateSplitterInfo(SplitterContext& splitter_context) {
|
||||||
u32 consumed_size{0};
|
u32 consumed_size{0};
|
||||||
if (!splitter_context.Update(input, consumed_size)) {
|
if (!splitter_context.Update(input, consumed_size)) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
input += consumed_size;
|
input += consumed_size;
|
||||||
|
@ -529,9 +529,9 @@ Result InfoUpdater::UpdateRendererInfo(const u64 elapsed_frames) {
|
||||||
|
|
||||||
Result InfoUpdater::CheckConsumedSize() {
|
Result InfoUpdater::CheckConsumedSize() {
|
||||||
if (CpuAddr(input) - CpuAddr(input_origin.data()) != expected_input_size) {
|
if (CpuAddr(input) - CpuAddr(input_origin.data()) != expected_input_size) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
} else if (CpuAddr(output) - CpuAddr(output_origin.data()) != expected_output_size) {
|
} else if (CpuAddr(output) - CpuAddr(output_origin.data()) != expected_output_size) {
|
||||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
return Service::Audio::ResultInvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ bool PoolMapper::TryAttachBuffer(BehaviorInfo::ErrorInfo& error_info, AddressInf
|
||||||
address_info.Setup(address, size);
|
address_info.Setup(address, size);
|
||||||
|
|
||||||
if (!FillDspAddr(address_info)) {
|
if (!FillDspAddr(address_info)) {
|
||||||
error_info.error_code = Service::Audio::ERR_POOL_MAPPING_FAILED;
|
error_info.error_code = Service::Audio::ResultInvalidAddressInfo;
|
||||||
error_info.address = address;
|
error_info.address = address;
|
||||||
return force_map;
|
return force_map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,15 +101,15 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
|
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
|
||||||
u32 process_handle_, u64 applet_resource_user_id_, s32 session_id_) {
|
u32 process_handle_, u64 applet_resource_user_id_, s32 session_id_) {
|
||||||
if (!CheckValidRevision(params.revision)) {
|
if (!CheckValidRevision(params.revision)) {
|
||||||
return Service::Audio::ERR_INVALID_REVISION;
|
return Service::Audio::ResultInvalidRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetWorkBufferSize(params) > transfer_memory_size) {
|
if (GetWorkBufferSize(params) > transfer_memory_size) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process_handle_ == 0) {
|
if (process_handle_ == 0) {
|
||||||
return Service::Audio::ERR_INVALID_PROCESS_HANDLE;
|
return Service::Audio::ResultInvalidHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
behavior.SetUserLibRevision(params.revision);
|
behavior.SetUserLibRevision(params.revision);
|
||||||
|
@ -143,19 +143,19 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
samples_workbuffer =
|
samples_workbuffer =
|
||||||
allocator.Allocate<s32>((voice_channels + mix_buffer_count) * sample_count, 0x10);
|
allocator.Allocate<s32>((voice_channels + mix_buffer_count) * sample_count, 0x10);
|
||||||
if (samples_workbuffer.empty()) {
|
if (samples_workbuffer.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto upsampler_workbuffer{allocator.Allocate<s32>(
|
auto upsampler_workbuffer{allocator.Allocate<s32>(
|
||||||
(voice_channels + mix_buffer_count) * TargetSampleCount * upsampler_count, 0x10)};
|
(voice_channels + mix_buffer_count) * TargetSampleCount * upsampler_count, 0x10)};
|
||||||
if (upsampler_workbuffer.empty()) {
|
if (upsampler_workbuffer.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
depop_buffer =
|
depop_buffer =
|
||||||
allocator.Allocate<s32>(Common::AlignUp(static_cast<u32>(mix_buffer_count), 0x40), 0x40);
|
allocator.Allocate<s32>(Common::AlignUp(static_cast<u32>(mix_buffer_count), 0x40), 0x40);
|
||||||
if (depop_buffer.empty()) {
|
if (depop_buffer.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// invalidate samples_workbuffer DSP cache
|
// invalidate samples_workbuffer DSP cache
|
||||||
|
@ -166,12 +166,12 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voice_infos.empty()) {
|
if (voice_infos.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto sorted_voice_infos{allocator.Allocate<VoiceInfo*>(params.voices, 0x10)};
|
auto sorted_voice_infos{allocator.Allocate<VoiceInfo*>(params.voices, 0x10)};
|
||||||
if (sorted_voice_infos.empty()) {
|
if (sorted_voice_infos.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(sorted_voice_infos.data(), 0, sorted_voice_infos.size_bytes());
|
std::memset(sorted_voice_infos.data(), 0, sorted_voice_infos.size_bytes());
|
||||||
|
@ -183,12 +183,12 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voice_channel_resources.empty()) {
|
if (voice_channel_resources.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto voice_cpu_states{allocator.Allocate<VoiceState>(params.voices, 0x10)};
|
auto voice_cpu_states{allocator.Allocate<VoiceState>(params.voices, 0x10)};
|
||||||
if (voice_cpu_states.empty()) {
|
if (voice_cpu_states.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& voice_state : voice_cpu_states) {
|
for (auto& voice_state : voice_cpu_states) {
|
||||||
|
@ -198,7 +198,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
auto mix_infos{allocator.Allocate<MixInfo>(params.sub_mixes + 1, 0x10)};
|
auto mix_infos{allocator.Allocate<MixInfo>(params.sub_mixes + 1, 0x10)};
|
||||||
|
|
||||||
if (mix_infos.empty()) {
|
if (mix_infos.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 effect_process_order_count{0};
|
u32 effect_process_order_count{0};
|
||||||
|
@ -208,7 +208,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
effect_process_order_count = params.effects * (params.sub_mixes + 1);
|
effect_process_order_count = params.effects * (params.sub_mixes + 1);
|
||||||
effect_process_order_buffer = allocator.Allocate<s32>(effect_process_order_count, 0x10);
|
effect_process_order_buffer = allocator.Allocate<s32>(effect_process_order_count, 0x10);
|
||||||
if (effect_process_order_buffer.empty()) {
|
if (effect_process_order_buffer.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
|
|
||||||
auto sorted_mix_infos{allocator.Allocate<MixInfo*>(params.sub_mixes + 1, 0x10)};
|
auto sorted_mix_infos{allocator.Allocate<MixInfo*>(params.sub_mixes + 1, 0x10)};
|
||||||
if (sorted_mix_infos.empty()) {
|
if (sorted_mix_infos.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(sorted_mix_infos.data(), 0, sorted_mix_infos.size_bytes());
|
std::memset(sorted_mix_infos.data(), 0, sorted_mix_infos.size_bytes());
|
||||||
|
@ -235,7 +235,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
auto edge_matrix_workbuffer{allocator.Allocate<u8>(edge_matrix_size, 1)};
|
auto edge_matrix_workbuffer{allocator.Allocate<u8>(edge_matrix_size, 1)};
|
||||||
|
|
||||||
if (node_states_workbuffer.empty() || edge_matrix_workbuffer.size() == 0) {
|
if (node_states_workbuffer.empty() || edge_matrix_workbuffer.size() == 0) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
mix_context.Initialize(sorted_mix_infos, mix_infos, params.sub_mixes + 1,
|
mix_context.Initialize(sorted_mix_infos, mix_infos, params.sub_mixes + 1,
|
||||||
|
@ -250,7 +250,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
|
|
||||||
upsampler_manager = allocator.Allocate<UpsamplerManager>(1, 0x10).data();
|
upsampler_manager = allocator.Allocate<UpsamplerManager>(1, 0x10).data();
|
||||||
if (upsampler_manager == nullptr) {
|
if (upsampler_manager == nullptr) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
memory_pool_workbuffer = allocator.Allocate<MemoryPoolInfo>(memory_pool_count, 0x10);
|
memory_pool_workbuffer = allocator.Allocate<MemoryPoolInfo>(memory_pool_count, 0x10);
|
||||||
|
@ -259,18 +259,18 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memory_pool_workbuffer.empty() && memory_pool_count > 0) {
|
if (memory_pool_workbuffer.empty() && memory_pool_count > 0) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!splitter_context.Initialize(behavior, params, allocator)) {
|
if (!splitter_context.Initialize(behavior, params, allocator)) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<EffectResultState> effect_result_states_cpu{};
|
std::span<EffectResultState> effect_result_states_cpu{};
|
||||||
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
|
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
|
||||||
effect_result_states_cpu = allocator.Allocate<EffectResultState>(params.effects, 0x10);
|
effect_result_states_cpu = allocator.Allocate<EffectResultState>(params.effects, 0x10);
|
||||||
if (effect_result_states_cpu.empty()) {
|
if (effect_result_states_cpu.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
std::memset(effect_result_states_cpu.data(), 0, effect_result_states_cpu.size_bytes());
|
std::memset(effect_result_states_cpu.data(), 0, effect_result_states_cpu.size_bytes());
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
upsampler_workbuffer);
|
upsampler_workbuffer);
|
||||||
|
|
||||||
if (upsampler_infos.empty()) {
|
if (upsampler_infos.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto effect_infos{allocator.Allocate<EffectInfoBase>(params.effects, 0x40)};
|
auto effect_infos{allocator.Allocate<EffectInfoBase>(params.effects, 0x40)};
|
||||||
|
@ -298,14 +298,14 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effect_infos.empty() && params.effects > 0) {
|
if (effect_infos.empty() && params.effects > 0) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<EffectResultState> effect_result_states_dsp{};
|
std::span<EffectResultState> effect_result_states_dsp{};
|
||||||
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
|
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
|
||||||
effect_result_states_dsp = allocator.Allocate<EffectResultState>(params.effects, 0x40);
|
effect_result_states_dsp = allocator.Allocate<EffectResultState>(params.effects, 0x40);
|
||||||
if (effect_result_states_dsp.empty()) {
|
if (effect_result_states_dsp.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
std::memset(effect_result_states_dsp.data(), 0, effect_result_states_dsp.size_bytes());
|
std::memset(effect_result_states_dsp.data(), 0, effect_result_states_dsp.size_bytes());
|
||||||
}
|
}
|
||||||
|
@ -319,14 +319,14 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sinks.empty()) {
|
if (sinks.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
sink_context.Initialize(sinks, params.sinks);
|
sink_context.Initialize(sinks, params.sinks);
|
||||||
|
|
||||||
auto voice_dsp_states{allocator.Allocate<VoiceState>(params.voices, 0x40)};
|
auto voice_dsp_states{allocator.Allocate<VoiceState>(params.voices, 0x40)};
|
||||||
if (voice_dsp_states.empty()) {
|
if (voice_dsp_states.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& voice_state : voice_dsp_states) {
|
for (auto& voice_state : voice_dsp_states) {
|
||||||
|
@ -344,7 +344,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
0xC};
|
0xC};
|
||||||
performance_workbuffer = allocator.Allocate<u8>(perf_workbuffer_size, 0x40);
|
performance_workbuffer = allocator.Allocate<u8>(perf_workbuffer_size, 0x40);
|
||||||
if (performance_workbuffer.empty()) {
|
if (performance_workbuffer.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
std::memset(performance_workbuffer.data(), 0, performance_workbuffer.size_bytes());
|
std::memset(performance_workbuffer.data(), 0, performance_workbuffer.size_bytes());
|
||||||
performance_manager.Initialize(performance_workbuffer, performance_workbuffer.size_bytes(),
|
performance_manager.Initialize(performance_workbuffer, performance_workbuffer.size_bytes(),
|
||||||
|
@ -360,7 +360,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||||
command_workbuffer_size = allocator.GetRemainingSize();
|
command_workbuffer_size = allocator.GetRemainingSize();
|
||||||
command_workbuffer = allocator.Allocate<u8>(command_workbuffer_size, 0x40);
|
command_workbuffer = allocator.Allocate<u8>(command_workbuffer_size, 0x40);
|
||||||
if (command_workbuffer.empty()) {
|
if (command_workbuffer.empty()) {
|
||||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
return Service::Audio::ResultInsufficientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_buffer_size = 0;
|
command_buffer_size = 0;
|
||||||
|
|
|
@ -181,7 +181,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||||
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
||||||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
||||||
LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!");
|
LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!");
|
||||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||||
error_info[0].address = wave_buffer_internal.address;
|
error_info[0].address = wave_buffer_internal.address;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||||
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
||||||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
||||||
LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!");
|
LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!");
|
||||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||||
error_info[0].address = wave_buffer_internal.address;
|
error_info[0].address = wave_buffer_internal.address;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||||
if (start > static_cast<s64>(wave_buffer_internal.size) ||
|
if (start > static_cast<s64>(wave_buffer_internal.size) ||
|
||||||
end > static_cast<s64>(wave_buffer_internal.size)) {
|
end > static_cast<s64>(wave_buffer_internal.size)) {
|
||||||
LOG_ERROR(Service_Audio, "Invalid ADPCM start/end wavebuffer sizes!");
|
LOG_ERROR(Service_Audio, "Invalid ADPCM start/end wavebuffer sizes!");
|
||||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||||
error_info[0].address = wave_buffer_internal.address;
|
error_info[0].address = wave_buffer_internal.address;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||||
|
|
||||||
if (wave_buffer_internal.start_offset < 0 || wave_buffer_internal.end_offset < 0) {
|
if (wave_buffer_internal.start_offset < 0 || wave_buffer_internal.end_offset < 0) {
|
||||||
LOG_ERROR(Service_Audio, "Invalid input start/end wavebuffer sizes!");
|
LOG_ERROR(Service_Audio, "Invalid input start/end wavebuffer sizes!");
|
||||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||||
error_info[0].address = wave_buffer_internal.address;
|
error_info[0].address = wave_buffer_internal.address;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,7 +454,6 @@ add_library(core STATIC
|
||||||
hle/service/filesystem/fsp_srv.h
|
hle/service/filesystem/fsp_srv.h
|
||||||
hle/service/fgm/fgm.cpp
|
hle/service/fgm/fgm.cpp
|
||||||
hle/service/fgm/fgm.h
|
hle/service/fgm/fgm.h
|
||||||
hle/service/friend/errors.h
|
|
||||||
hle/service/friend/friend.cpp
|
hle/service/friend/friend.cpp
|
||||||
hle/service/friend/friend.h
|
hle/service/friend/friend.h
|
||||||
hle/service/friend/friend_interface.cpp
|
hle/service/friend/friend_interface.cpp
|
||||||
|
|
|
@ -310,10 +310,10 @@ public:
|
||||||
/// Clears the signaled state of the process if and only if it's signaled.
|
/// Clears the signaled state of the process if and only if it's signaled.
|
||||||
///
|
///
|
||||||
/// @pre The process must not be already terminated. If this is called on a
|
/// @pre The process must not be already terminated. If this is called on a
|
||||||
/// terminated process, then ERR_INVALID_STATE will be returned.
|
/// terminated process, then ResultInvalidState will be returned.
|
||||||
///
|
///
|
||||||
/// @pre The process must be in a signaled state. If this is called on a
|
/// @pre The process must be in a signaled state. If this is called on a
|
||||||
/// process instance that is not signaled, ERR_INVALID_STATE will be
|
/// process instance that is not signaled, ResultInvalidState will be
|
||||||
/// returned.
|
/// returned.
|
||||||
Result Reset();
|
Result Reset();
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,6 @@
|
||||||
|
|
||||||
namespace Service::Account {
|
namespace Service::Account {
|
||||||
|
|
||||||
constexpr Result ERR_INVALID_USER_ID{ErrorModule::Account, 20};
|
|
||||||
constexpr Result ERR_INVALID_APPLICATION_ID{ErrorModule::Account, 22};
|
|
||||||
constexpr Result ERR_INVALID_BUFFER{ErrorModule::Account, 30};
|
|
||||||
constexpr Result ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 31};
|
|
||||||
constexpr Result ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100};
|
|
||||||
|
|
||||||
// Thumbnails are hard coded to be at least this size
|
// Thumbnails are hard coded to be at least this size
|
||||||
constexpr std::size_t THUMBNAIL_SIZE = 0x24000;
|
constexpr std::size_t THUMBNAIL_SIZE = 0x24000;
|
||||||
|
|
||||||
|
@ -384,7 +378,7 @@ protected:
|
||||||
if (user_data.size() < sizeof(UserData)) {
|
if (user_data.size() < sizeof(UserData)) {
|
||||||
LOG_ERROR(Service_ACC, "UserData buffer too small!");
|
LOG_ERROR(Service_ACC, "UserData buffer too small!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_BUFFER);
|
rb.Push(Account::ResultInvalidArrayLength);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +388,7 @@ protected:
|
||||||
if (!profile_manager.SetProfileBaseAndData(user_id, base, data)) {
|
if (!profile_manager.SetProfileBaseAndData(user_id, base, data)) {
|
||||||
LOG_ERROR(Service_ACC, "Failed to update user data and base!");
|
LOG_ERROR(Service_ACC, "Failed to update user data and base!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_FAILED_SAVE_DATA);
|
rb.Push(Account::ResultAccountUpdateFailed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +411,7 @@ protected:
|
||||||
if (user_data.size() < sizeof(UserData)) {
|
if (user_data.size() < sizeof(UserData)) {
|
||||||
LOG_ERROR(Service_ACC, "UserData buffer too small!");
|
LOG_ERROR(Service_ACC, "UserData buffer too small!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_BUFFER);
|
rb.Push(Account::ResultInvalidArrayLength);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +426,7 @@ protected:
|
||||||
!profile_manager.SetProfileBaseAndData(user_id, base, data)) {
|
!profile_manager.SetProfileBaseAndData(user_id, base, data)) {
|
||||||
LOG_ERROR(Service_ACC, "Failed to update profile data, base, and image!");
|
LOG_ERROR(Service_ACC, "Failed to update profile data, base, and image!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_FAILED_SAVE_DATA);
|
rb.Push(Account::ResultAccountUpdateFailed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +758,7 @@ void Module::Interface::InitializeApplicationInfoRestricted(HLERequestContext& c
|
||||||
Result Module::Interface::InitializeApplicationInfoBase() {
|
Result Module::Interface::InitializeApplicationInfoBase() {
|
||||||
if (application_info) {
|
if (application_info) {
|
||||||
LOG_ERROR(Service_ACC, "Application already initialized");
|
LOG_ERROR(Service_ACC, "Application already initialized");
|
||||||
return ERR_ACCOUNTINFO_ALREADY_INITIALIZED;
|
return Account::ResultApplicationInfoAlreadyInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ogniK): This should be changed to reflect the target process for when we have multiple
|
// TODO(ogniK): This should be changed to reflect the target process for when we have multiple
|
||||||
|
@ -775,7 +769,7 @@ Result Module::Interface::InitializeApplicationInfoBase() {
|
||||||
|
|
||||||
if (launch_property.Failed()) {
|
if (launch_property.Failed()) {
|
||||||
LOG_ERROR(Service_ACC, "Failed to get launch property");
|
LOG_ERROR(Service_ACC, "Failed to get launch property");
|
||||||
return ERR_ACCOUNTINFO_BAD_APPLICATION;
|
return Account::ResultInvalidApplication;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (launch_property->base_game_storage_id) {
|
switch (launch_property->base_game_storage_id) {
|
||||||
|
@ -791,7 +785,7 @@ Result Module::Interface::InitializeApplicationInfoBase() {
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}",
|
LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}",
|
||||||
launch_property->base_game_storage_id);
|
launch_property->base_game_storage_id);
|
||||||
return ERR_ACCOUNTINFO_BAD_APPLICATION;
|
return Account::ResultInvalidApplication;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_WARNING(Service_ACC, "ApplicationInfo init required");
|
LOG_WARNING(Service_ACC, "ApplicationInfo init required");
|
||||||
|
@ -899,20 +893,20 @@ void Module::Interface::StoreSaveDataThumbnail(HLERequestContext& ctx, const Com
|
||||||
|
|
||||||
if (tid == 0) {
|
if (tid == 0) {
|
||||||
LOG_ERROR(Service_ACC, "TitleID is not valid!");
|
LOG_ERROR(Service_ACC, "TitleID is not valid!");
|
||||||
rb.Push(ERR_INVALID_APPLICATION_ID);
|
rb.Push(Account::ResultInvalidApplication);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uuid.IsInvalid()) {
|
if (uuid.IsInvalid()) {
|
||||||
LOG_ERROR(Service_ACC, "User ID is not valid!");
|
LOG_ERROR(Service_ACC, "User ID is not valid!");
|
||||||
rb.Push(ERR_INVALID_USER_ID);
|
rb.Push(Account::ResultInvalidUserId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto thumbnail_size = ctx.GetReadBufferSize();
|
const auto thumbnail_size = ctx.GetReadBufferSize();
|
||||||
if (thumbnail_size != THUMBNAIL_SIZE) {
|
if (thumbnail_size != THUMBNAIL_SIZE) {
|
||||||
LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size,
|
LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size,
|
||||||
THUMBNAIL_SIZE);
|
THUMBNAIL_SIZE);
|
||||||
rb.Push(ERR_INVALID_BUFFER_SIZE);
|
rb.Push(Account::ResultInvalidArrayLength);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,13 @@
|
||||||
|
|
||||||
namespace Service::Account {
|
namespace Service::Account {
|
||||||
|
|
||||||
constexpr Result ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22};
|
constexpr Result ResultCancelledByUser{ErrorModule::Account, 1};
|
||||||
constexpr Result ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41};
|
constexpr Result ResultNoNotifications{ErrorModule::Account, 15};
|
||||||
|
constexpr Result ResultInvalidUserId{ErrorModule::Account, 20};
|
||||||
|
constexpr Result ResultInvalidApplication{ErrorModule::Account, 22};
|
||||||
|
constexpr Result ResultNullptr{ErrorModule::Account, 30};
|
||||||
|
constexpr Result ResultInvalidArrayLength{ErrorModule::Account, 32};
|
||||||
|
constexpr Result ResultApplicationInfoAlreadyInitialized{ErrorModule::Account, 41};
|
||||||
|
constexpr Result ResultAccountUpdateFailed{ErrorModule::Account, 100};
|
||||||
|
|
||||||
} // namespace Service::Account
|
} // namespace Service::Account
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
constexpr Result ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 2};
|
constexpr Result ResultNoDataInChannel{ErrorModule::AM, 2};
|
||||||
constexpr Result ERR_NO_MESSAGES{ErrorModule::AM, 3};
|
constexpr Result ResultNoMessages{ErrorModule::AM, 3};
|
||||||
constexpr Result ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 503};
|
constexpr Result ResultInvalidOffset{ErrorModule::AM, 503};
|
||||||
|
|
||||||
enum class LaunchParameterKind : u32 {
|
enum class LaunchParameterKind : u32 {
|
||||||
ApplicationSpecific = 1,
|
ApplicationSpecific = 1,
|
||||||
|
@ -758,7 +758,7 @@ void ICommonStateGetter::ReceiveMessage(HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (message == AppletMessageQueue::AppletMessage::None) {
|
if (message == AppletMessageQueue::AppletMessage::None) {
|
||||||
LOG_ERROR(Service_AM, "Message queue is empty");
|
LOG_ERROR(Service_AM, "Message queue is empty");
|
||||||
rb.Push(ERR_NO_MESSAGES);
|
rb.Push(AM::ResultNoMessages);
|
||||||
rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
|
rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1028,7 +1028,7 @@ private:
|
||||||
LOG_DEBUG(Service_AM,
|
LOG_DEBUG(Service_AM,
|
||||||
"storage is a nullptr. There is no data in the current normal channel");
|
"storage is a nullptr. There is no data in the current normal channel");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NO_DATA_IN_CHANNEL);
|
rb.Push(AM::ResultNoDataInChannel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,7 +1059,7 @@ private:
|
||||||
LOG_DEBUG(Service_AM,
|
LOG_DEBUG(Service_AM,
|
||||||
"storage is a nullptr. There is no data in the current interactive channel");
|
"storage is a nullptr. There is no data in the current interactive channel");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NO_DATA_IN_CHANNEL);
|
rb.Push(AM::ResultNoDataInChannel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ void IStorageAccessor::Write(HLERequestContext& ctx) {
|
||||||
backing.GetSize(), size, offset);
|
backing.GetSize(), size, offset);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_SIZE_OUT_OF_BOUNDS);
|
rb.Push(AM::ResultInvalidOffset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,7 +1161,7 @@ void IStorageAccessor::Read(HLERequestContext& ctx) {
|
||||||
backing.GetSize(), size, offset);
|
backing.GetSize(), size, offset);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_SIZE_OUT_OF_BOUNDS);
|
rb.Push(AM::ResultInvalidOffset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1502,7 +1502,7 @@ void IApplicationFunctions::PopLaunchParameter(HLERequestContext& ctx) {
|
||||||
|
|
||||||
LOG_ERROR(Service_AM, "Attempted to load launch parameter but none was found!");
|
LOG_ERROR(Service_AM, "Attempted to load launch parameter but none was found!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NO_DATA_IN_CHANNEL);
|
rb.Push(AM::ResultNoDataInChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx) {
|
void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx) {
|
||||||
|
@ -1799,7 +1799,7 @@ void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel(HLERequestC
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NO_DATA_IN_CHANNEL);
|
rb.Push(AM::ResultNoDataInChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IApplicationFunctions::GetNotificationStorageChannelEvent(HLERequestContext& ctx) {
|
void IApplicationFunctions::GetNotificationStorageChannelEvent(HLERequestContext& ctx) {
|
||||||
|
|
|
@ -19,10 +19,9 @@
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
// This error code (0x183ACA) is thrown when the applet fails to initialize.
|
[[maybe_unused]] constexpr Result ResultControllerSupportCanceled{ErrorModule::HID, 3101};
|
||||||
[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3101{ErrorModule::HID, 3101};
|
[[maybe_unused]] constexpr Result ResultControllerSupportNotSupportedNpadStyle{ErrorModule::HID,
|
||||||
// This error code (0x183CCA) is thrown when the u32 result in ControllerSupportResultInfo is 2.
|
3102};
|
||||||
[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3102{ErrorModule::HID, 3102};
|
|
||||||
|
|
||||||
static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
|
static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
|
||||||
ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text,
|
ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text,
|
||||||
|
|
|
@ -7,13 +7,12 @@
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/frontend/applets/profile_select.h"
|
#include "core/frontend/applets/profile_select.h"
|
||||||
|
#include "core/hle/service/acc/errors.h"
|
||||||
#include "core/hle/service/am/am.h"
|
#include "core/hle/service/am/am.h"
|
||||||
#include "core/hle/service/am/applets/applet_profile_select.h"
|
#include "core/hle/service/am/applets/applet_profile_select.h"
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
constexpr Result ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
|
|
||||||
|
|
||||||
ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
|
ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||||
const Core::Frontend::ProfileSelectApplet& frontend_)
|
const Core::Frontend::ProfileSelectApplet& frontend_)
|
||||||
: Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
|
: Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
|
||||||
|
@ -63,8 +62,8 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
|
||||||
output.result = 0;
|
output.result = 0;
|
||||||
output.uuid_selected = *uuid;
|
output.uuid_selected = *uuid;
|
||||||
} else {
|
} else {
|
||||||
status = ERR_USER_CANCELLED_SELECTION;
|
status = Account::ResultCancelledByUser;
|
||||||
output.result = ERR_USER_CANCELLED_SELECTION.raw;
|
output.result = Account::ResultCancelledByUser.raw;
|
||||||
output.uuid_selected = Common::InvalidUUID;
|
output.uuid_selected = Common::InvalidUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ private:
|
||||||
|
|
||||||
if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) {
|
if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NOT_SUPPORTED);
|
rb.Push(Audio::ResultNotSupported);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) {
|
||||||
if (impl->GetSessionCount() + 1 > AudioCore::MaxRendererSessions) {
|
if (impl->GetSessionCount() + 1 > AudioCore::MaxRendererSessions) {
|
||||||
LOG_ERROR(Service_Audio, "Too many AudioRenderer sessions open!");
|
LOG_ERROR(Service_Audio, "Too many AudioRenderer sessions open!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_MAXIMUM_SESSIONS_REACHED);
|
rb.Push(Audio::ResultOutOfSessions);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) {
|
||||||
if (session_id == -1) {
|
if (session_id == -1) {
|
||||||
LOG_ERROR(Service_Audio, "Tried to open a session that's already in use!");
|
LOG_ERROR(Service_Audio, "Tried to open a session that's already in use!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_MAXIMUM_SESSIONS_REACHED);
|
rb.Push(Audio::ResultOutOfSessions);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,17 @@
|
||||||
|
|
||||||
namespace Service::Audio {
|
namespace Service::Audio {
|
||||||
|
|
||||||
constexpr Result ERR_INVALID_DEVICE_NAME{ErrorModule::Audio, 1};
|
constexpr Result ResultNotFound{ErrorModule::Audio, 1};
|
||||||
constexpr Result ERR_OPERATION_FAILED{ErrorModule::Audio, 2};
|
constexpr Result ResultOperationFailed{ErrorModule::Audio, 2};
|
||||||
constexpr Result ERR_INVALID_SAMPLE_RATE{ErrorModule::Audio, 3};
|
constexpr Result ResultInvalidSampleRate{ErrorModule::Audio, 3};
|
||||||
constexpr Result ERR_INSUFFICIENT_BUFFER_SIZE{ErrorModule::Audio, 4};
|
constexpr Result ResultInsufficientBuffer{ErrorModule::Audio, 4};
|
||||||
constexpr Result ERR_MAXIMUM_SESSIONS_REACHED{ErrorModule::Audio, 5};
|
constexpr Result ResultOutOfSessions{ErrorModule::Audio, 5};
|
||||||
constexpr Result ERR_BUFFER_COUNT_EXCEEDED{ErrorModule::Audio, 8};
|
constexpr Result ResultBufferCountReached{ErrorModule::Audio, 8};
|
||||||
constexpr Result ERR_INVALID_CHANNEL_COUNT{ErrorModule::Audio, 10};
|
constexpr Result ResultInvalidChannelCount{ErrorModule::Audio, 10};
|
||||||
constexpr Result ERR_INVALID_UPDATE_DATA{ErrorModule::Audio, 41};
|
constexpr Result ResultInvalidUpdateInfo{ErrorModule::Audio, 41};
|
||||||
constexpr Result ERR_POOL_MAPPING_FAILED{ErrorModule::Audio, 42};
|
constexpr Result ResultInvalidAddressInfo{ErrorModule::Audio, 42};
|
||||||
constexpr Result ERR_NOT_SUPPORTED{ErrorModule::Audio, 513};
|
constexpr Result ResultNotSupported{ErrorModule::Audio, 513};
|
||||||
constexpr Result ERR_INVALID_PROCESS_HANDLE{ErrorModule::Audio, 1536};
|
constexpr Result ResultInvalidHandle{ErrorModule::Audio, 1536};
|
||||||
constexpr Result ERR_INVALID_REVISION{ErrorModule::Audio, 1537};
|
constexpr Result ResultInvalidRevision{ErrorModule::Audio, 1537};
|
||||||
|
|
||||||
} // namespace Service::Audio
|
} // namespace Service::Audio
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common/uuid.h"
|
#include "common/uuid.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/friend/errors.h"
|
#include "core/hle/service/acc/errors.h"
|
||||||
#include "core/hle/service/friend/friend.h"
|
#include "core/hle/service/friend/friend.h"
|
||||||
#include "core/hle/service/friend/friend_interface.h"
|
#include "core/hle/service/friend/friend_interface.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
@ -259,7 +259,7 @@ private:
|
||||||
if (notifications.empty()) {
|
if (notifications.empty()) {
|
||||||
LOG_ERROR(Service_Friend, "No notifications in queue!");
|
LOG_ERROR(Service_Friend, "No notifications in queue!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NO_NOTIFICATIONS);
|
rb.Push(Account::ResultNoNotifications);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ void ARP_R::GetApplicationLaunchProperty(HLERequestContext& ctx) {
|
||||||
if (!title_id.has_value()) {
|
if (!title_id.has_value()) {
|
||||||
LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!");
|
LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NOT_REGISTERED);
|
rb.Push(Glue::ResultProcessIdNotRegistered);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ void ARP_R::GetApplicationControlProperty(HLERequestContext& ctx) {
|
||||||
if (!title_id.has_value()) {
|
if (!title_id.has_value()) {
|
||||||
LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!");
|
LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NOT_REGISTERED);
|
rb.Push(Glue::ResultProcessIdNotRegistered);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ private:
|
||||||
if (process_id == 0) {
|
if (process_id == 0) {
|
||||||
LOG_ERROR(Service_ARP, "Must have non-zero process ID!");
|
LOG_ERROR(Service_ARP, "Must have non-zero process ID!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_PROCESS_ID);
|
rb.Push(Glue::ResultInvalidProcessId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ private:
|
||||||
LOG_ERROR(Service_ARP,
|
LOG_ERROR(Service_ARP,
|
||||||
"Attempted to issue registrar, but registrar is already issued!");
|
"Attempted to issue registrar, but registrar is already issued!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_ACCESS);
|
rb.Push(Glue::ResultAlreadyBound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ private:
|
||||||
Service_ARP,
|
Service_ARP,
|
||||||
"Attempted to set application launch property, but registrar is already issued!");
|
"Attempted to set application launch property, but registrar is already issued!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_ACCESS);
|
rb.Push(Glue::ResultAlreadyBound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ private:
|
||||||
Service_ARP,
|
Service_ARP,
|
||||||
"Attempted to set application control property, but registrar is already issued!");
|
"Attempted to set application control property, but registrar is already issued!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_ACCESS);
|
rb.Push(Glue::ResultAlreadyBound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ void ARP_W::AcquireRegistrar(HLERequestContext& ctx) {
|
||||||
system, [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) {
|
system, [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) {
|
||||||
const auto res = GetTitleIDForProcessID(system, process_id);
|
const auto res = GetTitleIDForProcessID(system, process_id);
|
||||||
if (!res.has_value()) {
|
if (!res.has_value()) {
|
||||||
return ERR_NOT_REGISTERED;
|
return Glue::ResultProcessIdNotRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
return manager.Register(*res, launch, std::move(control));
|
return manager.Register(*res, launch, std::move(control));
|
||||||
|
@ -283,7 +283,7 @@ void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) {
|
||||||
if (process_id == 0) {
|
if (process_id == 0) {
|
||||||
LOG_ERROR(Service_ARP, "Must have non-zero process ID!");
|
LOG_ERROR(Service_ARP, "Must have non-zero process ID!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_PROCESS_ID);
|
rb.Push(Glue::ResultInvalidProcessId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) {
|
||||||
if (!title_id.has_value()) {
|
if (!title_id.has_value()) {
|
||||||
LOG_ERROR(Service_ARP, "No title ID for process ID!");
|
LOG_ERROR(Service_ARP, "No title ID for process ID!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_NOT_REGISTERED);
|
rb.Push(Glue::ResultProcessIdNotRegistered);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,8 @@
|
||||||
|
|
||||||
namespace Service::Glue {
|
namespace Service::Glue {
|
||||||
|
|
||||||
constexpr Result ERR_INVALID_RESOURCE{ErrorModule::ARP, 30};
|
constexpr Result ResultInvalidProcessId{ErrorModule::ARP, 31};
|
||||||
constexpr Result ERR_INVALID_PROCESS_ID{ErrorModule::ARP, 31};
|
constexpr Result ResultAlreadyBound{ErrorModule::ARP, 42};
|
||||||
constexpr Result ERR_INVALID_ACCESS{ErrorModule::ARP, 42};
|
constexpr Result ResultProcessIdNotRegistered{ErrorModule::ARP, 102};
|
||||||
constexpr Result ERR_NOT_REGISTERED{ErrorModule::ARP, 102};
|
|
||||||
|
|
||||||
} // namespace Service::Glue
|
} // namespace Service::Glue
|
||||||
|
|
|
@ -17,12 +17,12 @@ ARPManager::~ARPManager() = default;
|
||||||
|
|
||||||
ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) const {
|
ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) const {
|
||||||
if (title_id == 0) {
|
if (title_id == 0) {
|
||||||
return ERR_INVALID_PROCESS_ID;
|
return Glue::ResultInvalidProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto iter = entries.find(title_id);
|
const auto iter = entries.find(title_id);
|
||||||
if (iter == entries.end()) {
|
if (iter == entries.end()) {
|
||||||
return ERR_NOT_REGISTERED;
|
return Glue::ResultProcessIdNotRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
return iter->second.launch;
|
return iter->second.launch;
|
||||||
|
@ -30,12 +30,12 @@ ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id)
|
||||||
|
|
||||||
ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
|
ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
|
||||||
if (title_id == 0) {
|
if (title_id == 0) {
|
||||||
return ERR_INVALID_PROCESS_ID;
|
return Glue::ResultInvalidProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto iter = entries.find(title_id);
|
const auto iter = entries.find(title_id);
|
||||||
if (iter == entries.end()) {
|
if (iter == entries.end()) {
|
||||||
return ERR_NOT_REGISTERED;
|
return Glue::ResultProcessIdNotRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
return iter->second.control;
|
return iter->second.control;
|
||||||
|
@ -44,12 +44,12 @@ ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
|
||||||
Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch,
|
Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch,
|
||||||
std::vector<u8> control) {
|
std::vector<u8> control) {
|
||||||
if (title_id == 0) {
|
if (title_id == 0) {
|
||||||
return ERR_INVALID_PROCESS_ID;
|
return Glue::ResultInvalidProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto iter = entries.find(title_id);
|
const auto iter = entries.find(title_id);
|
||||||
if (iter != entries.end()) {
|
if (iter != entries.end()) {
|
||||||
return ERR_INVALID_ACCESS;
|
return Glue::ResultAlreadyBound;
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)});
|
entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)});
|
||||||
|
@ -58,12 +58,12 @@ Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch,
|
||||||
|
|
||||||
Result ARPManager::Unregister(u64 title_id) {
|
Result ARPManager::Unregister(u64 title_id) {
|
||||||
if (title_id == 0) {
|
if (title_id == 0) {
|
||||||
return ERR_INVALID_PROCESS_ID;
|
return Glue::ResultInvalidProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto iter = entries.find(title_id);
|
const auto iter = entries.find(title_id);
|
||||||
if (iter == entries.end()) {
|
if (iter == entries.end()) {
|
||||||
return ERR_NOT_REGISTERED;
|
return Glue::ResultProcessIdNotRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.erase(iter);
|
entries.erase(iter);
|
||||||
|
|
|
@ -30,23 +30,23 @@ public:
|
||||||
~ARPManager();
|
~ARPManager();
|
||||||
|
|
||||||
// Returns the ApplicationLaunchProperty corresponding to the provided title ID if it was
|
// Returns the ApplicationLaunchProperty corresponding to the provided title ID if it was
|
||||||
// previously registered, otherwise ERR_NOT_REGISTERED if it was never registered or
|
// previously registered, otherwise ResultProcessIdNotRegistered if it was never registered or
|
||||||
// ERR_INVALID_PROCESS_ID if the title ID is 0.
|
// ResultInvalidProcessId if the title ID is 0.
|
||||||
ResultVal<ApplicationLaunchProperty> GetLaunchProperty(u64 title_id) const;
|
ResultVal<ApplicationLaunchProperty> GetLaunchProperty(u64 title_id) const;
|
||||||
|
|
||||||
// Returns a vector of the raw bytes of NACP data (necessarily 0x4000 in size) corresponding to
|
// Returns a vector of the raw bytes of NACP data (necessarily 0x4000 in size) corresponding to
|
||||||
// the provided title ID if it was previously registered, otherwise ERR_NOT_REGISTERED if it was
|
// the provided title ID if it was previously registered, otherwise ResultProcessIdNotRegistered
|
||||||
// never registered or ERR_INVALID_PROCESS_ID if the title ID is 0.
|
// if it was never registered or ResultInvalidProcessId if the title ID is 0.
|
||||||
ResultVal<std::vector<u8>> GetControlProperty(u64 title_id) const;
|
ResultVal<std::vector<u8>> GetControlProperty(u64 title_id) const;
|
||||||
|
|
||||||
// Adds a new entry to the internal database with the provided parameters, returning
|
// Adds a new entry to the internal database with the provided parameters, returning
|
||||||
// ERR_INVALID_ACCESS if attempting to re-register a title ID without an intermediate Unregister
|
// ResultProcessIdNotRegistered if attempting to re-register a title ID without an intermediate
|
||||||
// step, and ERR_INVALID_PROCESS_ID if the title ID is 0.
|
// Unregister step, and ResultInvalidProcessId if the title ID is 0.
|
||||||
Result Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control);
|
Result Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control);
|
||||||
|
|
||||||
// Removes the registration for the provided title ID from the database, returning
|
// Removes the registration for the provided title ID from the database, returning
|
||||||
// ERR_NOT_REGISTERED if it doesn't exist in the database and ERR_INVALID_PROCESS_ID if the
|
// ResultProcessIdNotRegistered if it doesn't exist in the database and ResultInvalidProcessId
|
||||||
// title ID is 0.
|
// if the title ID is 0.
|
||||||
Result Unregister(u64 title_id);
|
Result Unregister(u64 title_id);
|
||||||
|
|
||||||
// Removes all entries from the database, always succeeds. Should only be used when resetting
|
// Removes all entries from the database, always succeeds. Should only be used when resetting
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
|
||||||
constexpr Result ERR_REMOTE_PROCESS_DEAD{ErrorModule::HIPC, 301};
|
constexpr Result ResultSessionClosed{ErrorModule::HIPC, 301};
|
||||||
|
|
||||||
class RequestHelperBase {
|
class RequestHelperBase {
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -7,5 +7,6 @@
|
||||||
|
|
||||||
namespace Service::NS {
|
namespace Service::NS {
|
||||||
|
|
||||||
constexpr Result ERR_APPLICATION_LANGUAGE_NOT_FOUND{ErrorModule::NS, 300};
|
constexpr Result ResultApplicationLanguageNotFound{ErrorModule::NS, 300};
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
|
@ -416,14 +416,14 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
|
||||||
if (application_language == std::nullopt) {
|
if (application_language == std::nullopt) {
|
||||||
LOG_ERROR(Service_NS, "Could not convert application language! language_code={}",
|
LOG_ERROR(Service_NS, "Could not convert application language! language_code={}",
|
||||||
language_code);
|
language_code);
|
||||||
return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
|
return Service::NS::ResultApplicationLanguageNotFound;
|
||||||
}
|
}
|
||||||
const auto priority_list = GetApplicationLanguagePriorityList(*application_language);
|
const auto priority_list = GetApplicationLanguagePriorityList(*application_language);
|
||||||
if (!priority_list) {
|
if (!priority_list) {
|
||||||
LOG_ERROR(Service_NS,
|
LOG_ERROR(Service_NS,
|
||||||
"Could not find application language priorities! application_language={}",
|
"Could not find application language priorities! application_language={}",
|
||||||
*application_language);
|
*application_language);
|
||||||
return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
|
return Service::NS::ResultApplicationLanguageNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find a valid language.
|
// Try to find a valid language.
|
||||||
|
@ -436,7 +436,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
|
||||||
|
|
||||||
LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}",
|
LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}",
|
||||||
supported_languages);
|
supported_languages);
|
||||||
return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
|
return Service::NS::ResultApplicationLanguageNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
|
void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
|
||||||
|
@ -461,7 +461,7 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag
|
||||||
ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language));
|
ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language));
|
||||||
if (language_code == std::nullopt) {
|
if (language_code == std::nullopt) {
|
||||||
LOG_ERROR(Service_NS, "Language not found! application_language={}", application_language);
|
LOG_ERROR(Service_NS, "Language not found! application_language={}", application_language);
|
||||||
return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
|
return Service::NS::ResultApplicationLanguageNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<u64>(*language_code);
|
return static_cast<u64>(*language_code);
|
||||||
|
|
|
@ -404,7 +404,7 @@ Result ServerManager::CompleteSyncRequest(RequestState&& request) {
|
||||||
rc = request.session->SendReplyHLE();
|
rc = request.session->SendReplyHLE();
|
||||||
|
|
||||||
// If the session has been closed, we're done.
|
// If the session has been closed, we're done.
|
||||||
if (rc == Kernel::ResultSessionClosed || service_rc == IPC::ERR_REMOTE_PROCESS_DEAD) {
|
if (rc == Kernel::ResultSessionClosed || service_rc == IPC::ResultSessionClosed) {
|
||||||
// Close the session.
|
// Close the session.
|
||||||
request.session->Close();
|
request.session->Close();
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
|
||||||
case IPC::CommandType::TIPC_Close: {
|
case IPC::CommandType::TIPC_Close: {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
result = IPC::ERR_REMOTE_PROCESS_DEAD;
|
result = IPC::ResultSessionClosed;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPC::CommandType::ControlWithContext:
|
case IPC::CommandType::ControlWithContext:
|
||||||
|
|
|
@ -74,7 +74,7 @@ constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_la
|
||||||
constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF;
|
constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF;
|
||||||
constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40;
|
constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40;
|
||||||
|
|
||||||
constexpr Result ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625};
|
constexpr Result ResultInvalidLanguage{ErrorModule::Settings, 625};
|
||||||
|
|
||||||
void PushResponseLanguageCode(HLERequestContext& ctx, std::size_t num_language_codes) {
|
void PushResponseLanguageCode(HLERequestContext& ctx, std::size_t num_language_codes) {
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
@ -130,7 +130,7 @@ void SET::MakeLanguageCode(HLERequestContext& ctx) {
|
||||||
if (index >= available_language_codes.size()) {
|
if (index >= available_language_codes.size()) {
|
||||||
LOG_ERROR(Service_SET, "Invalid language code index! index={}", index);
|
LOG_ERROR(Service_SET, "Invalid language code index! index={}", index);
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_INVALID_LANGUAGE);
|
rb.Push(Set::ResultInvalidLanguage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
|
|
||||||
namespace Service::SM {
|
namespace Service::SM {
|
||||||
|
|
||||||
constexpr Result ERR_NOT_INITIALIZED(ErrorModule::SM, 2);
|
constexpr Result ResultInvalidClient(ErrorModule::SM, 2);
|
||||||
constexpr Result ERR_ALREADY_REGISTERED(ErrorModule::SM, 4);
|
constexpr Result ResultAlreadyRegistered(ErrorModule::SM, 4);
|
||||||
constexpr Result ERR_INVALID_NAME(ErrorModule::SM, 6);
|
constexpr Result ResultInvalidServiceName(ErrorModule::SM, 6);
|
||||||
constexpr Result ERR_SERVICE_NOT_REGISTERED(ErrorModule::SM, 7);
|
constexpr Result ResultNotRegistered(ErrorModule::SM, 7);
|
||||||
|
|
||||||
ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} {
|
ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} {
|
||||||
controller_interface = std::make_unique<Controller>(kernel.System());
|
controller_interface = std::make_unique<Controller>(kernel.System());
|
||||||
|
@ -45,7 +45,7 @@ void ServiceManager::InvokeControlRequest(HLERequestContext& context) {
|
||||||
static Result ValidateServiceName(const std::string& name) {
|
static Result ValidateServiceName(const std::string& name) {
|
||||||
if (name.empty() || name.size() > 8) {
|
if (name.empty() || name.size() > 8) {
|
||||||
LOG_ERROR(Service_SM, "Invalid service name! service={}", name);
|
LOG_ERROR(Service_SM, "Invalid service name! service={}", name);
|
||||||
return ERR_INVALID_NAME;
|
return Service::SM::ResultInvalidServiceName;
|
||||||
}
|
}
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ Result ServiceManager::RegisterService(std::string name, u32 max_sessions,
|
||||||
std::scoped_lock lk{lock};
|
std::scoped_lock lk{lock};
|
||||||
if (registered_services.find(name) != registered_services.end()) {
|
if (registered_services.find(name) != registered_services.end()) {
|
||||||
LOG_ERROR(Service_SM, "Service is already registered! service={}", name);
|
LOG_ERROR(Service_SM, "Service is already registered! service={}", name);
|
||||||
return ERR_ALREADY_REGISTERED;
|
return Service::SM::ResultAlreadyRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* port = Kernel::KPort::Create(kernel);
|
auto* port = Kernel::KPort::Create(kernel);
|
||||||
|
@ -80,7 +80,7 @@ Result ServiceManager::UnregisterService(const std::string& name) {
|
||||||
const auto iter = registered_services.find(name);
|
const auto iter = registered_services.find(name);
|
||||||
if (iter == registered_services.end()) {
|
if (iter == registered_services.end()) {
|
||||||
LOG_ERROR(Service_SM, "Server is not registered! service={}", name);
|
LOG_ERROR(Service_SM, "Server is not registered! service={}", name);
|
||||||
return ERR_SERVICE_NOT_REGISTERED;
|
return Service::SM::ResultNotRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
registered_services.erase(iter);
|
registered_services.erase(iter);
|
||||||
|
@ -96,7 +96,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name
|
||||||
auto it = service_ports.find(name);
|
auto it = service_ports.find(name);
|
||||||
if (it == service_ports.end()) {
|
if (it == service_ports.end()) {
|
||||||
LOG_WARNING(Service_SM, "Server is not registered! service={}", name);
|
LOG_WARNING(Service_SM, "Server is not registered! service={}", name);
|
||||||
return ERR_SERVICE_NOT_REGISTERED;
|
return Service::SM::ResultNotRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
return it->second;
|
return it->second;
|
||||||
|
@ -160,7 +160,7 @@ static std::string PopServiceName(IPC::RequestParser& rp) {
|
||||||
|
|
||||||
ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) {
|
ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) {
|
||||||
if (!ctx.GetManager()->GetIsInitializedForSm()) {
|
if (!ctx.GetManager()->GetIsInitializedForSm()) {
|
||||||
return ERR_NOT_INITIALIZED;
|
return Service::SM::ResultInvalidClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
@ -168,15 +168,15 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) {
|
||||||
|
|
||||||
// Find the named port.
|
// Find the named port.
|
||||||
auto port_result = service_manager.GetServicePort(name);
|
auto port_result = service_manager.GetServicePort(name);
|
||||||
if (port_result.Code() == ERR_INVALID_NAME) {
|
if (port_result.Code() == Service::SM::ResultInvalidServiceName) {
|
||||||
LOG_ERROR(Service_SM, "Invalid service name '{}'", name);
|
LOG_ERROR(Service_SM, "Invalid service name '{}'", name);
|
||||||
return ERR_INVALID_NAME;
|
return Service::SM::ResultInvalidServiceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port_result.Failed()) {
|
if (port_result.Failed()) {
|
||||||
LOG_INFO(Service_SM, "Waiting for service {} to become available", name);
|
LOG_INFO(Service_SM, "Waiting for service {} to become available", name);
|
||||||
ctx.SetIsDeferred();
|
ctx.SetIsDeferred();
|
||||||
return ERR_SERVICE_NOT_REGISTERED;
|
return Service::SM::ResultNotRegistered;
|
||||||
}
|
}
|
||||||
auto& port = port_result.Unwrap();
|
auto& port = port_result.Unwrap();
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra
|
||||||
buffer_cache(*this, cpu_memory_, buffer_cache_runtime),
|
buffer_cache(*this, cpu_memory_, buffer_cache_runtime),
|
||||||
shader_cache(*this, emu_window_, device, texture_cache, buffer_cache, program_manager,
|
shader_cache(*this, emu_window_, device, texture_cache, buffer_cache, program_manager,
|
||||||
state_tracker, gpu.ShaderNotify()),
|
state_tracker, gpu.ShaderNotify()),
|
||||||
query_cache(*this), accelerate_dma(buffer_cache),
|
query_cache(*this), accelerate_dma(buffer_cache, texture_cache),
|
||||||
fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache),
|
fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache),
|
||||||
blit_image(program_manager_) {}
|
blit_image(program_manager_) {}
|
||||||
|
|
||||||
|
@ -1262,7 +1262,8 @@ void RasterizerOpenGL::ReleaseChannel(s32 channel_id) {
|
||||||
query_cache.EraseChannel(channel_id);
|
query_cache.EraseChannel(channel_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
AccelerateDMA::AccelerateDMA(BufferCache& buffer_cache_) : buffer_cache{buffer_cache_} {}
|
AccelerateDMA::AccelerateDMA(BufferCache& buffer_cache_, TextureCache& texture_cache_)
|
||||||
|
: buffer_cache{buffer_cache_}, texture_cache{texture_cache_} {}
|
||||||
|
|
||||||
bool AccelerateDMA::BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) {
|
bool AccelerateDMA::BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
|
@ -1274,4 +1275,44 @@ bool AccelerateDMA::BufferClear(GPUVAddr src_address, u64 amount, u32 value) {
|
||||||
return buffer_cache.DMAClear(src_address, amount, value);
|
return buffer_cache.DMAClear(src_address, amount, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <bool IS_IMAGE_UPLOAD>
|
||||||
|
bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
|
const Tegra::DMA::BufferOperand& buffer_operand,
|
||||||
|
const Tegra::DMA::ImageOperand& image_operand) {
|
||||||
|
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
|
||||||
|
const auto image_id = texture_cache.DmaImageId(image_operand);
|
||||||
|
if (image_id == VideoCommon::NULL_IMAGE_ID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const u32 buffer_size = static_cast<u32>(buffer_operand.pitch * buffer_operand.height);
|
||||||
|
static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize;
|
||||||
|
const auto post_op = IS_IMAGE_UPLOAD ? VideoCommon::ObtainBufferOperation::DoNothing
|
||||||
|
: VideoCommon::ObtainBufferOperation::MarkAsWritten;
|
||||||
|
const auto [buffer, offset] =
|
||||||
|
buffer_cache.ObtainBuffer(buffer_operand.address, buffer_size, sync_info, post_op);
|
||||||
|
|
||||||
|
const auto [image, copy] = texture_cache.DmaBufferImageCopy(
|
||||||
|
copy_info, buffer_operand, image_operand, image_id, IS_IMAGE_UPLOAD);
|
||||||
|
const std::span copy_span{©, 1};
|
||||||
|
|
||||||
|
if constexpr (IS_IMAGE_UPLOAD) {
|
||||||
|
image->UploadMemory(buffer->Handle(), offset, copy_span);
|
||||||
|
} else {
|
||||||
|
image->DownloadMemory(buffer->Handle(), offset, copy_span);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AccelerateDMA::ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
|
const Tegra::DMA::ImageOperand& image_operand,
|
||||||
|
const Tegra::DMA::BufferOperand& buffer_operand) {
|
||||||
|
return DmaBufferImageCopy<false>(copy_info, buffer_operand, image_operand);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AccelerateDMA::BufferToImage(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
|
const Tegra::DMA::BufferOperand& buffer_operand,
|
||||||
|
const Tegra::DMA::ImageOperand& image_operand) {
|
||||||
|
return DmaBufferImageCopy<true>(copy_info, buffer_operand, image_operand);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
|
|
@ -50,24 +50,26 @@ static_assert(sizeof(BindlessSSBO) * CHAR_BIT == 128);
|
||||||
|
|
||||||
class AccelerateDMA : public Tegra::Engines::AccelerateDMAInterface {
|
class AccelerateDMA : public Tegra::Engines::AccelerateDMAInterface {
|
||||||
public:
|
public:
|
||||||
explicit AccelerateDMA(BufferCache& buffer_cache);
|
explicit AccelerateDMA(BufferCache& buffer_cache, TextureCache& texture_cache);
|
||||||
|
|
||||||
bool BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) override;
|
bool BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) override;
|
||||||
|
|
||||||
bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override;
|
bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override;
|
||||||
|
|
||||||
bool ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::ImageOperand& src,
|
bool ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::ImageOperand& src,
|
||||||
const Tegra::DMA::BufferOperand& dst) override {
|
const Tegra::DMA::BufferOperand& dst) override;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BufferToImage(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& src,
|
bool BufferToImage(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& src,
|
||||||
const Tegra::DMA::ImageOperand& dst) override {
|
const Tegra::DMA::ImageOperand& dst) override;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
template <bool IS_IMAGE_UPLOAD>
|
||||||
|
bool DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
|
const Tegra::DMA::BufferOperand& src,
|
||||||
|
const Tegra::DMA::ImageOperand& dst);
|
||||||
|
|
||||||
BufferCache& buffer_cache;
|
BufferCache& buffer_cache;
|
||||||
|
TextureCache& texture_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RasterizerOpenGL : public VideoCore::RasterizerAccelerated,
|
class RasterizerOpenGL : public VideoCore::RasterizerAccelerated,
|
||||||
|
|
|
@ -765,14 +765,14 @@ Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBas
|
||||||
|
|
||||||
Image::~Image() = default;
|
Image::~Image() = default;
|
||||||
|
|
||||||
void Image::UploadMemory(const ImageBufferMap& map,
|
void Image::UploadMemory(GLuint buffer_handle, size_t buffer_offset,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies) {
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
||||||
if (is_rescaled) {
|
if (is_rescaled) {
|
||||||
ScaleDown(true);
|
ScaleDown(true);
|
||||||
}
|
}
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, map.buffer);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_handle);
|
||||||
glFlushMappedBufferRange(GL_PIXEL_UNPACK_BUFFER, map.offset, unswizzled_size_bytes);
|
glFlushMappedBufferRange(GL_PIXEL_UNPACK_BUFFER, buffer_offset, unswizzled_size_bytes);
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
|
@ -791,21 +791,26 @@ void Image::UploadMemory(const ImageBufferMap& map,
|
||||||
current_image_height = copy.buffer_image_height;
|
current_image_height = copy.buffer_image_height;
|
||||||
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, current_image_height);
|
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, current_image_height);
|
||||||
}
|
}
|
||||||
CopyBufferToImage(copy, map.offset);
|
CopyBufferToImage(copy, buffer_offset);
|
||||||
}
|
}
|
||||||
if (is_rescaled) {
|
if (is_rescaled) {
|
||||||
ScaleUp();
|
ScaleUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::DownloadMemory(ImageBufferMap& map,
|
void Image::UploadMemory(const ImageBufferMap& map,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
|
UploadMemory(map.buffer, map.offset, copies);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Image::DownloadMemory(GLuint buffer_handle, size_t buffer_offset,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies) {
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
||||||
if (is_rescaled) {
|
if (is_rescaled) {
|
||||||
ScaleDown();
|
ScaleDown();
|
||||||
}
|
}
|
||||||
glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); // TODO: Move this to its own API
|
glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); // TODO: Move this to its own API
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, map.buffer);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer_handle);
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
u32 current_row_length = std::numeric_limits<u32>::max();
|
u32 current_row_length = std::numeric_limits<u32>::max();
|
||||||
|
@ -823,13 +828,18 @@ void Image::DownloadMemory(ImageBufferMap& map,
|
||||||
current_image_height = copy.buffer_image_height;
|
current_image_height = copy.buffer_image_height;
|
||||||
glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height);
|
glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height);
|
||||||
}
|
}
|
||||||
CopyImageToBuffer(copy, map.offset);
|
CopyImageToBuffer(copy, buffer_offset);
|
||||||
}
|
}
|
||||||
if (is_rescaled) {
|
if (is_rescaled) {
|
||||||
ScaleUp(true);
|
ScaleUp(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Image::DownloadMemory(ImageBufferMap& map,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
|
DownloadMemory(map.buffer, map.offset, copies);
|
||||||
|
}
|
||||||
|
|
||||||
GLuint Image::StorageHandle() noexcept {
|
GLuint Image::StorageHandle() noexcept {
|
||||||
switch (info.format) {
|
switch (info.format) {
|
||||||
case PixelFormat::A8B8G8R8_SRGB:
|
case PixelFormat::A8B8G8R8_SRGB:
|
||||||
|
|
|
@ -206,9 +206,15 @@ public:
|
||||||
Image(Image&&) = default;
|
Image(Image&&) = default;
|
||||||
Image& operator=(Image&&) = default;
|
Image& operator=(Image&&) = default;
|
||||||
|
|
||||||
|
void UploadMemory(GLuint buffer_handle, size_t buffer_offset,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
void UploadMemory(const ImageBufferMap& map,
|
void UploadMemory(const ImageBufferMap& map,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies);
|
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
|
void DownloadMemory(GLuint buffer_handle, size_t buffer_offset,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
void DownloadMemory(ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies);
|
void DownloadMemory(ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
GLuint StorageHandle() noexcept;
|
GLuint StorageHandle() noexcept;
|
||||||
|
|
|
@ -770,232 +770,44 @@ bool AccelerateDMA::BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64
|
||||||
return buffer_cache.DMACopy(src_address, dest_address, amount);
|
return buffer_cache.DMACopy(src_address, dest_address, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccelerateDMA::ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info,
|
template <bool IS_IMAGE_UPLOAD>
|
||||||
const Tegra::DMA::ImageOperand& src,
|
bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
const Tegra::DMA::BufferOperand& dst) {
|
const Tegra::DMA::BufferOperand& buffer_operand,
|
||||||
|
const Tegra::DMA::ImageOperand& image_operand) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
|
||||||
auto query_image = texture_cache.ObtainImage(src, false);
|
const auto image_id = texture_cache.DmaImageId(image_operand);
|
||||||
if (!query_image) {
|
if (image_id == VideoCommon::NULL_IMAGE_ID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto* image = query_image->first;
|
const u32 buffer_size = static_cast<u32>(buffer_operand.pitch * buffer_operand.height);
|
||||||
auto [level, base] = query_image->second;
|
static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize;
|
||||||
const u32 buffer_size = static_cast<u32>(dst.pitch * dst.height);
|
const auto post_op = IS_IMAGE_UPLOAD ? VideoCommon::ObtainBufferOperation::DoNothing
|
||||||
const auto [buffer, offset] = buffer_cache.ObtainBuffer(
|
: VideoCommon::ObtainBufferOperation::MarkAsWritten;
|
||||||
dst.address, buffer_size, VideoCommon::ObtainBufferSynchronize::FullSynchronize,
|
const auto [buffer, offset] =
|
||||||
VideoCommon::ObtainBufferOperation::MarkAsWritten);
|
buffer_cache.ObtainBuffer(buffer_operand.address, buffer_size, sync_info, post_op);
|
||||||
|
|
||||||
const bool is_rescaled = image->IsRescaled();
|
const auto [image, copy] = texture_cache.DmaBufferImageCopy(
|
||||||
if (is_rescaled) {
|
copy_info, buffer_operand, image_operand, image_id, IS_IMAGE_UPLOAD);
|
||||||
image->ScaleDown();
|
const std::span copy_span{©, 1};
|
||||||
}
|
|
||||||
VkImageSubresourceLayers subresources{
|
if constexpr (IS_IMAGE_UPLOAD) {
|
||||||
.aspectMask = image->AspectMask(),
|
image->UploadMemory(buffer->Handle(), offset, copy_span);
|
||||||
.mipLevel = level,
|
} else {
|
||||||
.baseArrayLayer = base,
|
image->DownloadMemory(buffer->Handle(), offset, copy_span);
|
||||||
.layerCount = 1,
|
|
||||||
};
|
|
||||||
const u32 bpp = VideoCore::Surface::BytesPerBlock(image->info.format);
|
|
||||||
const auto convert = [old_bpp = src.bytes_per_pixel, bpp](u32 value) {
|
|
||||||
return (old_bpp * value) / bpp;
|
|
||||||
};
|
|
||||||
const u32 base_x = convert(src.params.origin.x.Value());
|
|
||||||
const u32 base_y = src.params.origin.y.Value();
|
|
||||||
const u32 length_x = convert(copy_info.length_x);
|
|
||||||
const u32 length_y = copy_info.length_y;
|
|
||||||
VkOffset3D image_offset{
|
|
||||||
.x = static_cast<s32>(base_x),
|
|
||||||
.y = static_cast<s32>(base_y),
|
|
||||||
.z = 0,
|
|
||||||
};
|
|
||||||
VkExtent3D image_extent{
|
|
||||||
.width = length_x,
|
|
||||||
.height = length_y,
|
|
||||||
.depth = 1,
|
|
||||||
};
|
|
||||||
auto buff_info(dst);
|
|
||||||
buff_info.pitch = convert(dst.pitch);
|
|
||||||
scheduler.RequestOutsideRenderPassOperationContext();
|
|
||||||
scheduler.Record([src_image = image->Handle(), dst_buffer = buffer->Handle(),
|
|
||||||
buffer_offset = offset, subresources, image_offset, image_extent,
|
|
||||||
buff_info](vk::CommandBuffer cmdbuf) {
|
|
||||||
const std::array buffer_copy_info{
|
|
||||||
VkBufferImageCopy{
|
|
||||||
.bufferOffset = buffer_offset,
|
|
||||||
.bufferRowLength = buff_info.pitch,
|
|
||||||
.bufferImageHeight = buff_info.height,
|
|
||||||
.imageSubresource = subresources,
|
|
||||||
.imageOffset = image_offset,
|
|
||||||
.imageExtent = image_extent,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const VkImageSubresourceRange range{
|
|
||||||
.aspectMask = subresources.aspectMask,
|
|
||||||
.baseMipLevel = subresources.mipLevel,
|
|
||||||
.levelCount = 1,
|
|
||||||
.baseArrayLayer = subresources.baseArrayLayer,
|
|
||||||
.layerCount = 1,
|
|
||||||
};
|
|
||||||
static constexpr VkMemoryBarrier WRITE_BARRIER{
|
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
|
|
||||||
.pNext = nullptr,
|
|
||||||
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
|
|
||||||
.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
|
|
||||||
};
|
|
||||||
const std::array pre_barriers{
|
|
||||||
VkImageMemoryBarrier{
|
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
|
||||||
.pNext = nullptr,
|
|
||||||
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
|
|
||||||
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT |
|
|
||||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
|
||||||
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
|
|
||||||
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
|
|
||||||
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
|
||||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.image = src_image,
|
|
||||||
.subresourceRange = range,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const std::array post_barriers{
|
|
||||||
VkImageMemoryBarrier{
|
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
|
||||||
.pNext = nullptr,
|
|
||||||
.srcAccessMask = 0,
|
|
||||||
.dstAccessMask = 0,
|
|
||||||
.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
|
||||||
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
|
|
||||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.image = src_image,
|
|
||||||
.subresourceRange = range,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
||||||
0, {}, {}, pre_barriers);
|
|
||||||
cmdbuf.CopyImageToBuffer(src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_buffer,
|
|
||||||
buffer_copy_info);
|
|
||||||
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
|
||||||
0, WRITE_BARRIER, nullptr, post_barriers);
|
|
||||||
});
|
|
||||||
if (is_rescaled) {
|
|
||||||
image->ScaleUp(true);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AccelerateDMA::ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
|
const Tegra::DMA::ImageOperand& image_operand,
|
||||||
|
const Tegra::DMA::BufferOperand& buffer_operand) {
|
||||||
|
return DmaBufferImageCopy<false>(copy_info, buffer_operand, image_operand);
|
||||||
|
}
|
||||||
|
|
||||||
bool AccelerateDMA::BufferToImage(const Tegra::DMA::ImageCopy& copy_info,
|
bool AccelerateDMA::BufferToImage(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
const Tegra::DMA::BufferOperand& src,
|
const Tegra::DMA::BufferOperand& buffer_operand,
|
||||||
const Tegra::DMA::ImageOperand& dst) {
|
const Tegra::DMA::ImageOperand& image_operand) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
|
return DmaBufferImageCopy<true>(copy_info, buffer_operand, image_operand);
|
||||||
auto query_image = texture_cache.ObtainImage(dst, true);
|
|
||||||
if (!query_image) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
auto* image = query_image->first;
|
|
||||||
auto [level, base] = query_image->second;
|
|
||||||
const u32 buffer_size = static_cast<u32>(src.pitch * src.height);
|
|
||||||
const auto [buffer, offset] = buffer_cache.ObtainBuffer(
|
|
||||||
src.address, buffer_size, VideoCommon::ObtainBufferSynchronize::FullSynchronize,
|
|
||||||
VideoCommon::ObtainBufferOperation::DoNothing);
|
|
||||||
const bool is_rescaled = image->IsRescaled();
|
|
||||||
if (is_rescaled) {
|
|
||||||
image->ScaleDown(true);
|
|
||||||
}
|
|
||||||
VkImageSubresourceLayers subresources{
|
|
||||||
.aspectMask = image->AspectMask(),
|
|
||||||
.mipLevel = level,
|
|
||||||
.baseArrayLayer = base,
|
|
||||||
.layerCount = 1,
|
|
||||||
};
|
|
||||||
const u32 bpp = VideoCore::Surface::BytesPerBlock(image->info.format);
|
|
||||||
const auto convert = [old_bpp = dst.bytes_per_pixel, bpp](u32 value) {
|
|
||||||
return (old_bpp * value) / bpp;
|
|
||||||
};
|
|
||||||
const u32 base_x = convert(dst.params.origin.x.Value());
|
|
||||||
const u32 base_y = dst.params.origin.y.Value();
|
|
||||||
const u32 length_x = convert(copy_info.length_x);
|
|
||||||
const u32 length_y = copy_info.length_y;
|
|
||||||
VkOffset3D image_offset{
|
|
||||||
.x = static_cast<s32>(base_x),
|
|
||||||
.y = static_cast<s32>(base_y),
|
|
||||||
.z = 0,
|
|
||||||
};
|
|
||||||
VkExtent3D image_extent{
|
|
||||||
.width = length_x,
|
|
||||||
.height = length_y,
|
|
||||||
.depth = 1,
|
|
||||||
};
|
|
||||||
auto buff_info(src);
|
|
||||||
buff_info.pitch = convert(src.pitch);
|
|
||||||
scheduler.RequestOutsideRenderPassOperationContext();
|
|
||||||
scheduler.Record([dst_image = image->Handle(), src_buffer = buffer->Handle(),
|
|
||||||
buffer_offset = offset, subresources, image_offset, image_extent,
|
|
||||||
buff_info](vk::CommandBuffer cmdbuf) {
|
|
||||||
const std::array buffer_copy_info{
|
|
||||||
VkBufferImageCopy{
|
|
||||||
.bufferOffset = buffer_offset,
|
|
||||||
.bufferRowLength = buff_info.pitch,
|
|
||||||
.bufferImageHeight = buff_info.height,
|
|
||||||
.imageSubresource = subresources,
|
|
||||||
.imageOffset = image_offset,
|
|
||||||
.imageExtent = image_extent,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const VkImageSubresourceRange range{
|
|
||||||
.aspectMask = subresources.aspectMask,
|
|
||||||
.baseMipLevel = subresources.mipLevel,
|
|
||||||
.levelCount = 1,
|
|
||||||
.baseArrayLayer = subresources.baseArrayLayer,
|
|
||||||
.layerCount = 1,
|
|
||||||
};
|
|
||||||
static constexpr VkMemoryBarrier READ_BARRIER{
|
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
|
|
||||||
.pNext = nullptr,
|
|
||||||
.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT,
|
|
||||||
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT,
|
|
||||||
};
|
|
||||||
const std::array pre_barriers{
|
|
||||||
VkImageMemoryBarrier{
|
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
|
||||||
.pNext = nullptr,
|
|
||||||
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
|
|
||||||
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT |
|
|
||||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
|
||||||
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
|
|
||||||
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
|
|
||||||
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
|
||||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.image = dst_image,
|
|
||||||
.subresourceRange = range,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const std::array post_barriers{
|
|
||||||
VkImageMemoryBarrier{
|
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
|
||||||
.pNext = nullptr,
|
|
||||||
.srcAccessMask = 0,
|
|
||||||
.dstAccessMask = 0,
|
|
||||||
.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
|
||||||
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
|
|
||||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
||||||
.image = dst_image,
|
|
||||||
.subresourceRange = range,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
||||||
0, READ_BARRIER, {}, pre_barriers);
|
|
||||||
cmdbuf.CopyBufferToImage(src_buffer, dst_image, VK_IMAGE_LAYOUT_GENERAL, buffer_copy_info);
|
|
||||||
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
|
||||||
0, nullptr, nullptr, post_barriers);
|
|
||||||
});
|
|
||||||
if (is_rescaled) {
|
|
||||||
image->ScaleUp();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateDynamicStates() {
|
void RasterizerVulkan::UpdateDynamicStates() {
|
||||||
|
|
|
@ -59,6 +59,11 @@ public:
|
||||||
const Tegra::DMA::ImageOperand& dst) override;
|
const Tegra::DMA::ImageOperand& dst) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
template <bool IS_IMAGE_UPLOAD>
|
||||||
|
bool DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info,
|
||||||
|
const Tegra::DMA::BufferOperand& src,
|
||||||
|
const Tegra::DMA::ImageOperand& dst);
|
||||||
|
|
||||||
BufferCache& buffer_cache;
|
BufferCache& buffer_cache;
|
||||||
TextureCache& texture_cache;
|
TextureCache& texture_cache;
|
||||||
Scheduler& scheduler;
|
Scheduler& scheduler;
|
||||||
|
|
|
@ -1315,15 +1315,16 @@ Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBas
|
||||||
|
|
||||||
Image::~Image() = default;
|
Image::~Image() = default;
|
||||||
|
|
||||||
void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) {
|
void Image::UploadMemory(VkBuffer buffer, VkDeviceSize offset,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
// TODO: Move this to another API
|
// TODO: Move this to another API
|
||||||
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
||||||
if (is_rescaled) {
|
if (is_rescaled) {
|
||||||
ScaleDown(true);
|
ScaleDown(true);
|
||||||
}
|
}
|
||||||
scheduler->RequestOutsideRenderPassOperationContext();
|
scheduler->RequestOutsideRenderPassOperationContext();
|
||||||
std::vector vk_copies = TransformBufferImageCopies(copies, map.offset, aspect_mask);
|
std::vector vk_copies = TransformBufferImageCopies(copies, offset, aspect_mask);
|
||||||
const VkBuffer src_buffer = map.buffer;
|
const VkBuffer src_buffer = buffer;
|
||||||
const VkImage vk_image = *original_image;
|
const VkImage vk_image = *original_image;
|
||||||
const VkImageAspectFlags vk_aspect_mask = aspect_mask;
|
const VkImageAspectFlags vk_aspect_mask = aspect_mask;
|
||||||
const bool is_initialized = std::exchange(initialized, true);
|
const bool is_initialized = std::exchange(initialized, true);
|
||||||
|
@ -1336,14 +1337,19 @@ void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::DownloadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) {
|
void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) {
|
||||||
|
UploadMemory(map.buffer, map.offset, copies);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Image::DownloadMemory(VkBuffer buffer, VkDeviceSize offset,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
|
||||||
if (is_rescaled) {
|
if (is_rescaled) {
|
||||||
ScaleDown();
|
ScaleDown();
|
||||||
}
|
}
|
||||||
std::vector vk_copies = TransformBufferImageCopies(copies, map.offset, aspect_mask);
|
std::vector vk_copies = TransformBufferImageCopies(copies, offset, aspect_mask);
|
||||||
scheduler->RequestOutsideRenderPassOperationContext();
|
scheduler->RequestOutsideRenderPassOperationContext();
|
||||||
scheduler->Record([buffer = map.buffer, image = *original_image, aspect_mask = aspect_mask,
|
scheduler->Record([buffer, image = *original_image, aspect_mask = aspect_mask,
|
||||||
vk_copies](vk::CommandBuffer cmdbuf) {
|
vk_copies](vk::CommandBuffer cmdbuf) {
|
||||||
const VkImageMemoryBarrier read_barrier{
|
const VkImageMemoryBarrier read_barrier{
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||||
|
@ -1398,6 +1404,10 @@ void Image::DownloadMemory(const StagingBufferRef& map, std::span<const BufferIm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Image::DownloadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) {
|
||||||
|
DownloadMemory(map.buffer, map.offset, copies);
|
||||||
|
}
|
||||||
|
|
||||||
bool Image::IsRescaled() const noexcept {
|
bool Image::IsRescaled() const noexcept {
|
||||||
return True(flags & ImageFlagBits::Rescaled);
|
return True(flags & ImageFlagBits::Rescaled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,9 +132,15 @@ public:
|
||||||
Image(Image&&) = default;
|
Image(Image&&) = default;
|
||||||
Image& operator=(Image&&) = default;
|
Image& operator=(Image&&) = default;
|
||||||
|
|
||||||
|
void UploadMemory(VkBuffer buffer, VkDeviceSize offset,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
void UploadMemory(const StagingBufferRef& map,
|
void UploadMemory(const StagingBufferRef& map,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies);
|
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
|
void DownloadMemory(VkBuffer buffer, VkDeviceSize offset,
|
||||||
|
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
void DownloadMemory(const StagingBufferRef& map,
|
void DownloadMemory(const StagingBufferRef& map,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies);
|
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||||
|
|
||||||
|
|
|
@ -744,6 +744,25 @@ void TextureCache<P>::PopAsyncFlushes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class P>
|
||||||
|
ImageId TextureCache<P>::DmaImageId(const Tegra::DMA::ImageOperand& operand) {
|
||||||
|
const ImageInfo dst_info(operand);
|
||||||
|
const ImageId dst_id = FindDMAImage(dst_info, operand.address);
|
||||||
|
if (!dst_id) {
|
||||||
|
return NULL_IMAGE_ID;
|
||||||
|
}
|
||||||
|
const auto& image = slot_images[dst_id];
|
||||||
|
if (False(image.flags & ImageFlagBits::GpuModified)) {
|
||||||
|
// No need to waste time on an image that's synced with guest
|
||||||
|
return NULL_IMAGE_ID;
|
||||||
|
}
|
||||||
|
const auto base = image.TryFindBase(operand.address);
|
||||||
|
if (!base) {
|
||||||
|
return NULL_IMAGE_ID;
|
||||||
|
}
|
||||||
|
return dst_id;
|
||||||
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
bool TextureCache<P>::IsRescaling() const noexcept {
|
bool TextureCache<P>::IsRescaling() const noexcept {
|
||||||
return is_rescaling;
|
return is_rescaling;
|
||||||
|
@ -771,6 +790,49 @@ bool TextureCache<P>::IsRegionGpuModified(VAddr addr, size_t size) {
|
||||||
return is_modified;
|
return is_modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class P>
|
||||||
|
std::pair<typename TextureCache<P>::Image*, BufferImageCopy> TextureCache<P>::DmaBufferImageCopy(
|
||||||
|
const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& buffer_operand,
|
||||||
|
const Tegra::DMA::ImageOperand& image_operand, ImageId image_id, bool modifies_image) {
|
||||||
|
const auto [level, base] = PrepareDmaImage(image_id, image_operand.address, modifies_image);
|
||||||
|
auto* image = &slot_images[image_id];
|
||||||
|
const u32 buffer_size = static_cast<u32>(buffer_operand.pitch * buffer_operand.height);
|
||||||
|
const u32 bpp = VideoCore::Surface::BytesPerBlock(image->info.format);
|
||||||
|
const auto convert = [old_bpp = image_operand.bytes_per_pixel, bpp](u32 value) {
|
||||||
|
return (old_bpp * value) / bpp;
|
||||||
|
};
|
||||||
|
const u32 base_x = convert(image_operand.params.origin.x.Value());
|
||||||
|
const u32 base_y = image_operand.params.origin.y.Value();
|
||||||
|
const u32 length_x = convert(copy_info.length_x);
|
||||||
|
const u32 length_y = copy_info.length_y;
|
||||||
|
|
||||||
|
const BufferImageCopy copy{
|
||||||
|
.buffer_offset = 0,
|
||||||
|
.buffer_size = buffer_size,
|
||||||
|
.buffer_row_length = convert(buffer_operand.pitch),
|
||||||
|
.buffer_image_height = buffer_operand.height,
|
||||||
|
.image_subresource =
|
||||||
|
{
|
||||||
|
.base_level = static_cast<s32>(level),
|
||||||
|
.base_layer = static_cast<s32>(base),
|
||||||
|
.num_layers = 1,
|
||||||
|
},
|
||||||
|
.image_offset =
|
||||||
|
{
|
||||||
|
.x = static_cast<s32>(base_x),
|
||||||
|
.y = static_cast<s32>(base_y),
|
||||||
|
.z = 0,
|
||||||
|
},
|
||||||
|
.image_extent =
|
||||||
|
{
|
||||||
|
.width = length_x,
|
||||||
|
.height = length_y,
|
||||||
|
.depth = 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return {image, copy};
|
||||||
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) {
|
void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) {
|
||||||
if (False(image.flags & ImageFlagBits::CpuModified)) {
|
if (False(image.flags & ImageFlagBits::CpuModified)) {
|
||||||
|
@ -1405,26 +1467,14 @@ ImageId TextureCache<P>::FindDMAImage(const ImageInfo& info, GPUVAddr gpu_addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
std::optional<std::pair<typename TextureCache<P>::Image*, std::pair<u32, u32>>>
|
std::pair<u32, u32> TextureCache<P>::PrepareDmaImage(ImageId dst_id, GPUVAddr base_addr,
|
||||||
TextureCache<P>::ObtainImage(const Tegra::DMA::ImageOperand& operand, bool mark_as_modified) {
|
bool mark_as_modified) {
|
||||||
ImageInfo dst_info(operand);
|
const auto& image = slot_images[dst_id];
|
||||||
ImageId dst_id = FindDMAImage(dst_info, operand.address);
|
const auto base = image.TryFindBase(base_addr);
|
||||||
if (!dst_id) {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
auto& image = slot_images[dst_id];
|
|
||||||
auto base = image.TryFindBase(operand.address);
|
|
||||||
if (!base) {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
if (False(image.flags & ImageFlagBits::GpuModified)) {
|
|
||||||
// No need to waste time on an image that's synced with guest
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
PrepareImage(dst_id, mark_as_modified, false);
|
PrepareImage(dst_id, mark_as_modified, false);
|
||||||
auto& new_image = slot_images[dst_id];
|
const auto& new_image = slot_images[dst_id];
|
||||||
lru_cache.Touch(new_image.lru_index, frame_tick);
|
lru_cache.Touch(new_image.lru_index, frame_tick);
|
||||||
return std::make_pair(&new_image, std::make_pair(base->level, base->layer));
|
return std::make_pair(base->level, base->layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
|
|
|
@ -209,8 +209,11 @@ public:
|
||||||
/// Pop asynchronous downloads
|
/// Pop asynchronous downloads
|
||||||
void PopAsyncFlushes();
|
void PopAsyncFlushes();
|
||||||
|
|
||||||
[[nodiscard]] std::optional<std::pair<Image*, std::pair<u32, u32>>> ObtainImage(
|
[[nodiscard]] ImageId DmaImageId(const Tegra::DMA::ImageOperand& operand);
|
||||||
const Tegra::DMA::ImageOperand& operand, bool mark_as_modified);
|
|
||||||
|
[[nodiscard]] std::pair<Image*, BufferImageCopy> DmaBufferImageCopy(
|
||||||
|
const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& buffer_operand,
|
||||||
|
const Tegra::DMA::ImageOperand& image_operand, ImageId image_id, bool modifies_image);
|
||||||
|
|
||||||
/// Return true when a CPU region is modified from the GPU
|
/// Return true when a CPU region is modified from the GPU
|
||||||
[[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size);
|
[[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size);
|
||||||
|
@ -386,6 +389,9 @@ private:
|
||||||
/// Returns true if the current clear parameters clear the whole image of a given image view
|
/// Returns true if the current clear parameters clear the whole image of a given image view
|
||||||
[[nodiscard]] bool IsFullClear(ImageViewId id);
|
[[nodiscard]] bool IsFullClear(ImageViewId id);
|
||||||
|
|
||||||
|
[[nodiscard]] std::pair<u32, u32> PrepareDmaImage(ImageId dst_id, GPUVAddr base_addr,
|
||||||
|
bool mark_as_modified);
|
||||||
|
|
||||||
bool ImageCanRescale(ImageBase& image);
|
bool ImageCanRescale(ImageBase& image);
|
||||||
void InvalidateScale(Image& image);
|
void InvalidateScale(Image& image);
|
||||||
bool ScaleUp(Image& image);
|
bool ScaleUp(Image& image);
|
||||||
|
|
Loading…
Reference in a new issue