mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
Merge pull request #3894 from wwylele/log-finalize
Finalize logging system migration
This commit is contained in:
commit
f9a89ff410
@ -27,7 +27,7 @@ struct CubebSink::Impl {
|
|||||||
|
|
||||||
CubebSink::CubebSink() : impl(std::make_unique<Impl>()) {
|
CubebSink::CubebSink() : impl(std::make_unique<Impl>()) {
|
||||||
if (cubeb_init(&impl->ctx, "Citra", nullptr) != CUBEB_OK) {
|
if (cubeb_init(&impl->ctx, "Citra", nullptr) != CUBEB_OK) {
|
||||||
NGLOG_CRITICAL(Audio_Sink, "cubeb_init failed");
|
LOG_CRITICAL(Audio_Sink, "cubeb_init failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,11 +44,11 @@ CubebSink::CubebSink() : impl(std::make_unique<Impl>()) {
|
|||||||
|
|
||||||
u32 minimum_latency = 0;
|
u32 minimum_latency = 0;
|
||||||
if (cubeb_get_min_latency(impl->ctx, ¶ms, &minimum_latency) != CUBEB_OK)
|
if (cubeb_get_min_latency(impl->ctx, ¶ms, &minimum_latency) != CUBEB_OK)
|
||||||
NGLOG_CRITICAL(Audio_Sink, "Error getting minimum latency");
|
LOG_CRITICAL(Audio_Sink, "Error getting minimum latency");
|
||||||
|
|
||||||
cubeb_device_collection collection;
|
cubeb_device_collection collection;
|
||||||
if (cubeb_enumerate_devices(impl->ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection) != CUBEB_OK) {
|
if (cubeb_enumerate_devices(impl->ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection) != CUBEB_OK) {
|
||||||
NGLOG_WARNING(Audio_Sink, "Audio output device enumeration not supported");
|
LOG_WARNING(Audio_Sink, "Audio output device enumeration not supported");
|
||||||
} else {
|
} else {
|
||||||
if (collection.count >= 1 && Settings::values.audio_device_id != "auto" &&
|
if (collection.count >= 1 && Settings::values.audio_device_id != "auto" &&
|
||||||
!Settings::values.audio_device_id.empty()) {
|
!Settings::values.audio_device_id.empty()) {
|
||||||
@ -72,12 +72,12 @@ CubebSink::CubebSink() : impl(std::make_unique<Impl>()) {
|
|||||||
if (cubeb_stream_init(impl->ctx, &impl->stream, "Citra Audio Output", nullptr, nullptr,
|
if (cubeb_stream_init(impl->ctx, &impl->stream, "Citra Audio Output", nullptr, nullptr,
|
||||||
output_device, ¶ms, std::max(512u, minimum_latency),
|
output_device, ¶ms, std::max(512u, minimum_latency),
|
||||||
&Impl::DataCallback, &Impl::StateCallback, impl.get()) != CUBEB_OK) {
|
&Impl::DataCallback, &Impl::StateCallback, impl.get()) != CUBEB_OK) {
|
||||||
NGLOG_CRITICAL(Audio_Sink, "Error initializing cubeb stream");
|
LOG_CRITICAL(Audio_Sink, "Error initializing cubeb stream");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cubeb_stream_start(impl->stream) != CUBEB_OK) {
|
if (cubeb_stream_start(impl->stream) != CUBEB_OK) {
|
||||||
NGLOG_CRITICAL(Audio_Sink, "Error starting cubeb stream");
|
LOG_CRITICAL(Audio_Sink, "Error starting cubeb stream");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ CubebSink::~CubebSink() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (cubeb_stream_stop(impl->stream) != CUBEB_OK) {
|
if (cubeb_stream_stop(impl->stream) != CUBEB_OK) {
|
||||||
NGLOG_CRITICAL(Audio_Sink, "Error stopping cubeb stream");
|
LOG_CRITICAL(Audio_Sink, "Error stopping cubeb stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
cubeb_stream_destroy(impl->stream);
|
cubeb_stream_destroy(impl->stream);
|
||||||
|
@ -84,19 +84,19 @@ std::vector<u8> DspHle::Impl::PipeRead(DspPipe pipe_number, u32 length) {
|
|||||||
const size_t pipe_index = static_cast<size_t>(pipe_number);
|
const size_t pipe_index = static_cast<size_t>(pipe_number);
|
||||||
|
|
||||||
if (pipe_index >= num_dsp_pipe) {
|
if (pipe_index >= num_dsp_pipe) {
|
||||||
NGLOG_ERROR(Audio_DSP, "pipe_number = {} invalid", pipe_index);
|
LOG_ERROR(Audio_DSP, "pipe_number = {} invalid", pipe_index);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length > UINT16_MAX) { // Can only read at most UINT16_MAX from the pipe
|
if (length > UINT16_MAX) { // Can only read at most UINT16_MAX from the pipe
|
||||||
NGLOG_ERROR(Audio_DSP, "length of {} greater than max of {}", length, UINT16_MAX);
|
LOG_ERROR(Audio_DSP, "length of {} greater than max of {}", length, UINT16_MAX);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8>& data = pipe_data[pipe_index];
|
std::vector<u8>& data = pipe_data[pipe_index];
|
||||||
|
|
||||||
if (length > data.size()) {
|
if (length > data.size()) {
|
||||||
NGLOG_WARNING(
|
LOG_WARNING(
|
||||||
Audio_DSP,
|
Audio_DSP,
|
||||||
"pipe_number = {} is out of data, application requested read of {} but {} remain",
|
"pipe_number = {} is out of data, application requested read of {} but {} remain",
|
||||||
pipe_index, length, data.size());
|
pipe_index, length, data.size());
|
||||||
@ -115,7 +115,7 @@ size_t DspHle::Impl::GetPipeReadableSize(DspPipe pipe_number) const {
|
|||||||
const size_t pipe_index = static_cast<size_t>(pipe_number);
|
const size_t pipe_index = static_cast<size_t>(pipe_number);
|
||||||
|
|
||||||
if (pipe_index >= num_dsp_pipe) {
|
if (pipe_index >= num_dsp_pipe) {
|
||||||
NGLOG_ERROR(Audio_DSP, "pipe_number = {} invalid", pipe_index);
|
LOG_ERROR(Audio_DSP, "pipe_number = {} invalid", pipe_index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +126,8 @@ void DspHle::Impl::PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer)
|
|||||||
switch (pipe_number) {
|
switch (pipe_number) {
|
||||||
case DspPipe::Audio: {
|
case DspPipe::Audio: {
|
||||||
if (buffer.size() != 4) {
|
if (buffer.size() != 4) {
|
||||||
NGLOG_ERROR(Audio_DSP, "DspPipe::Audio: Unexpected buffer length {} was written",
|
LOG_ERROR(Audio_DSP, "DspPipe::Audio: Unexpected buffer length {} was written",
|
||||||
buffer.size());
|
buffer.size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,30 +146,30 @@ void DspHle::Impl::PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer)
|
|||||||
|
|
||||||
switch (static_cast<StateChange>(buffer[0])) {
|
switch (static_cast<StateChange>(buffer[0])) {
|
||||||
case StateChange::Initialize:
|
case StateChange::Initialize:
|
||||||
NGLOG_INFO(Audio_DSP, "Application has requested initialization of DSP hardware");
|
LOG_INFO(Audio_DSP, "Application has requested initialization of DSP hardware");
|
||||||
ResetPipes();
|
ResetPipes();
|
||||||
AudioPipeWriteStructAddresses();
|
AudioPipeWriteStructAddresses();
|
||||||
dsp_state = DspState::On;
|
dsp_state = DspState::On;
|
||||||
break;
|
break;
|
||||||
case StateChange::Shutdown:
|
case StateChange::Shutdown:
|
||||||
NGLOG_INFO(Audio_DSP, "Application has requested shutdown of DSP hardware");
|
LOG_INFO(Audio_DSP, "Application has requested shutdown of DSP hardware");
|
||||||
dsp_state = DspState::Off;
|
dsp_state = DspState::Off;
|
||||||
break;
|
break;
|
||||||
case StateChange::Wakeup:
|
case StateChange::Wakeup:
|
||||||
NGLOG_INFO(Audio_DSP, "Application has requested wakeup of DSP hardware");
|
LOG_INFO(Audio_DSP, "Application has requested wakeup of DSP hardware");
|
||||||
ResetPipes();
|
ResetPipes();
|
||||||
AudioPipeWriteStructAddresses();
|
AudioPipeWriteStructAddresses();
|
||||||
dsp_state = DspState::On;
|
dsp_state = DspState::On;
|
||||||
break;
|
break;
|
||||||
case StateChange::Sleep:
|
case StateChange::Sleep:
|
||||||
NGLOG_INFO(Audio_DSP, "Application has requested sleep of DSP hardware");
|
LOG_INFO(Audio_DSP, "Application has requested sleep of DSP hardware");
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
dsp_state = DspState::Sleeping;
|
dsp_state = DspState::Sleeping;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Audio_DSP,
|
LOG_ERROR(Audio_DSP,
|
||||||
"Application has requested unknown state transition of DSP hardware {}",
|
"Application has requested unknown state transition of DSP hardware {}",
|
||||||
buffer[0]);
|
buffer[0]);
|
||||||
dsp_state = DspState::Off;
|
dsp_state = DspState::Off;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -177,8 +177,7 @@ void DspHle::Impl::PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
NGLOG_CRITICAL(Audio_DSP, "pipe_number = {} unimplemented",
|
LOG_CRITICAL(Audio_DSP, "pipe_number = {} unimplemented", static_cast<size_t>(pipe_number));
|
||||||
static_cast<size_t>(pipe_number));
|
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -38,49 +38,49 @@ void Mixers::ParseConfig(DspConfiguration& config) {
|
|||||||
if (config.mixer1_enabled_dirty) {
|
if (config.mixer1_enabled_dirty) {
|
||||||
config.mixer1_enabled_dirty.Assign(0);
|
config.mixer1_enabled_dirty.Assign(0);
|
||||||
state.mixer1_enabled = config.mixer1_enabled != 0;
|
state.mixer1_enabled = config.mixer1_enabled != 0;
|
||||||
NGLOG_TRACE(Audio_DSP, "mixers mixer1_enabled = {}", config.mixer1_enabled);
|
LOG_TRACE(Audio_DSP, "mixers mixer1_enabled = {}", config.mixer1_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.mixer2_enabled_dirty) {
|
if (config.mixer2_enabled_dirty) {
|
||||||
config.mixer2_enabled_dirty.Assign(0);
|
config.mixer2_enabled_dirty.Assign(0);
|
||||||
state.mixer2_enabled = config.mixer2_enabled != 0;
|
state.mixer2_enabled = config.mixer2_enabled != 0;
|
||||||
NGLOG_TRACE(Audio_DSP, "mixers mixer2_enabled = {}", config.mixer2_enabled);
|
LOG_TRACE(Audio_DSP, "mixers mixer2_enabled = {}", config.mixer2_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.volume_0_dirty) {
|
if (config.volume_0_dirty) {
|
||||||
config.volume_0_dirty.Assign(0);
|
config.volume_0_dirty.Assign(0);
|
||||||
state.intermediate_mixer_volume[0] = config.volume[0];
|
state.intermediate_mixer_volume[0] = config.volume[0];
|
||||||
NGLOG_TRACE(Audio_DSP, "mixers volume[0] = {}", config.volume[0]);
|
LOG_TRACE(Audio_DSP, "mixers volume[0] = {}", config.volume[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.volume_1_dirty) {
|
if (config.volume_1_dirty) {
|
||||||
config.volume_1_dirty.Assign(0);
|
config.volume_1_dirty.Assign(0);
|
||||||
state.intermediate_mixer_volume[1] = config.volume[1];
|
state.intermediate_mixer_volume[1] = config.volume[1];
|
||||||
NGLOG_TRACE(Audio_DSP, "mixers volume[1] = {}", config.volume[1]);
|
LOG_TRACE(Audio_DSP, "mixers volume[1] = {}", config.volume[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.volume_2_dirty) {
|
if (config.volume_2_dirty) {
|
||||||
config.volume_2_dirty.Assign(0);
|
config.volume_2_dirty.Assign(0);
|
||||||
state.intermediate_mixer_volume[2] = config.volume[2];
|
state.intermediate_mixer_volume[2] = config.volume[2];
|
||||||
NGLOG_TRACE(Audio_DSP, "mixers volume[2] = {}", config.volume[2]);
|
LOG_TRACE(Audio_DSP, "mixers volume[2] = {}", config.volume[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.output_format_dirty) {
|
if (config.output_format_dirty) {
|
||||||
config.output_format_dirty.Assign(0);
|
config.output_format_dirty.Assign(0);
|
||||||
state.output_format = config.output_format;
|
state.output_format = config.output_format;
|
||||||
NGLOG_TRACE(Audio_DSP, "mixers output_format = {}",
|
LOG_TRACE(Audio_DSP, "mixers output_format = {}",
|
||||||
static_cast<size_t>(config.output_format));
|
static_cast<size_t>(config.output_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.headphones_connected_dirty) {
|
if (config.headphones_connected_dirty) {
|
||||||
config.headphones_connected_dirty.Assign(0);
|
config.headphones_connected_dirty.Assign(0);
|
||||||
// Do nothing. (Note: Whether headphones are connected does affect coefficients used for
|
// Do nothing. (Note: Whether headphones are connected does affect coefficients used for
|
||||||
// surround sound.)
|
// surround sound.)
|
||||||
NGLOG_TRACE(Audio_DSP, "mixers headphones_connected={}", config.headphones_connected);
|
LOG_TRACE(Audio_DSP, "mixers headphones_connected={}", config.headphones_connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.dirty_raw) {
|
if (config.dirty_raw) {
|
||||||
NGLOG_DEBUG(Audio_DSP, "mixers remaining_dirty={:x}", config.dirty_raw);
|
LOG_DEBUG(Audio_DSP, "mixers remaining_dirty={:x}", config.dirty_raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
config.dirty_raw = 0;
|
config.dirty_raw = 0;
|
||||||
|
@ -54,35 +54,35 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config,
|
|||||||
if (config.reset_flag) {
|
if (config.reset_flag) {
|
||||||
config.reset_flag.Assign(0);
|
config.reset_flag.Assign(0);
|
||||||
Reset();
|
Reset();
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} reset", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} reset", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.partial_reset_flag) {
|
if (config.partial_reset_flag) {
|
||||||
config.partial_reset_flag.Assign(0);
|
config.partial_reset_flag.Assign(0);
|
||||||
state.input_queue = std::priority_queue<Buffer, std::vector<Buffer>, BufferOrder>{};
|
state.input_queue = std::priority_queue<Buffer, std::vector<Buffer>, BufferOrder>{};
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} partial_reset", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} partial_reset", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.enable_dirty) {
|
if (config.enable_dirty) {
|
||||||
config.enable_dirty.Assign(0);
|
config.enable_dirty.Assign(0);
|
||||||
state.enabled = config.enable != 0;
|
state.enabled = config.enable != 0;
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} enable={}", source_id, state.enabled);
|
LOG_TRACE(Audio_DSP, "source_id={} enable={}", source_id, state.enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.sync_dirty) {
|
if (config.sync_dirty) {
|
||||||
config.sync_dirty.Assign(0);
|
config.sync_dirty.Assign(0);
|
||||||
state.sync = config.sync;
|
state.sync = config.sync;
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} sync={}", source_id, state.sync);
|
LOG_TRACE(Audio_DSP, "source_id={} sync={}", source_id, state.sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.rate_multiplier_dirty) {
|
if (config.rate_multiplier_dirty) {
|
||||||
config.rate_multiplier_dirty.Assign(0);
|
config.rate_multiplier_dirty.Assign(0);
|
||||||
state.rate_multiplier = config.rate_multiplier;
|
state.rate_multiplier = config.rate_multiplier;
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} rate={}", source_id, state.rate_multiplier);
|
LOG_TRACE(Audio_DSP, "source_id={} rate={}", source_id, state.rate_multiplier);
|
||||||
|
|
||||||
if (state.rate_multiplier <= 0) {
|
if (state.rate_multiplier <= 0) {
|
||||||
NGLOG_ERROR(Audio_DSP, "Was given an invalid rate multiplier: source_id={} rate={}",
|
LOG_ERROR(Audio_DSP, "Was given an invalid rate multiplier: source_id={} rate={}",
|
||||||
source_id, state.rate_multiplier);
|
source_id, state.rate_multiplier);
|
||||||
state.rate_multiplier = 1.0f;
|
state.rate_multiplier = 1.0f;
|
||||||
// Note: Actual firmware starts producing garbage if this occurs.
|
// Note: Actual firmware starts producing garbage if this occurs.
|
||||||
}
|
}
|
||||||
@ -93,69 +93,69 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config,
|
|||||||
std::transform(adpcm_coeffs, adpcm_coeffs + state.adpcm_coeffs.size(),
|
std::transform(adpcm_coeffs, adpcm_coeffs + state.adpcm_coeffs.size(),
|
||||||
state.adpcm_coeffs.begin(),
|
state.adpcm_coeffs.begin(),
|
||||||
[](const auto& coeff) { return static_cast<s16>(coeff); });
|
[](const auto& coeff) { return static_cast<s16>(coeff); });
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} adpcm update", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} adpcm update", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.gain_0_dirty) {
|
if (config.gain_0_dirty) {
|
||||||
config.gain_0_dirty.Assign(0);
|
config.gain_0_dirty.Assign(0);
|
||||||
std::transform(config.gain[0], config.gain[0] + state.gain[0].size(), state.gain[0].begin(),
|
std::transform(config.gain[0], config.gain[0] + state.gain[0].size(), state.gain[0].begin(),
|
||||||
[](const auto& coeff) { return static_cast<float>(coeff); });
|
[](const auto& coeff) { return static_cast<float>(coeff); });
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} gain 0 update", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} gain 0 update", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.gain_1_dirty) {
|
if (config.gain_1_dirty) {
|
||||||
config.gain_1_dirty.Assign(0);
|
config.gain_1_dirty.Assign(0);
|
||||||
std::transform(config.gain[1], config.gain[1] + state.gain[1].size(), state.gain[1].begin(),
|
std::transform(config.gain[1], config.gain[1] + state.gain[1].size(), state.gain[1].begin(),
|
||||||
[](const auto& coeff) { return static_cast<float>(coeff); });
|
[](const auto& coeff) { return static_cast<float>(coeff); });
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} gain 1 update", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} gain 1 update", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.gain_2_dirty) {
|
if (config.gain_2_dirty) {
|
||||||
config.gain_2_dirty.Assign(0);
|
config.gain_2_dirty.Assign(0);
|
||||||
std::transform(config.gain[2], config.gain[2] + state.gain[2].size(), state.gain[2].begin(),
|
std::transform(config.gain[2], config.gain[2] + state.gain[2].size(), state.gain[2].begin(),
|
||||||
[](const auto& coeff) { return static_cast<float>(coeff); });
|
[](const auto& coeff) { return static_cast<float>(coeff); });
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} gain 2 update", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} gain 2 update", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.filters_enabled_dirty) {
|
if (config.filters_enabled_dirty) {
|
||||||
config.filters_enabled_dirty.Assign(0);
|
config.filters_enabled_dirty.Assign(0);
|
||||||
state.filters.Enable(config.simple_filter_enabled.ToBool(),
|
state.filters.Enable(config.simple_filter_enabled.ToBool(),
|
||||||
config.biquad_filter_enabled.ToBool());
|
config.biquad_filter_enabled.ToBool());
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} enable_simple={} enable_biquad={}", source_id,
|
LOG_TRACE(Audio_DSP, "source_id={} enable_simple={} enable_biquad={}", source_id,
|
||||||
config.simple_filter_enabled.Value(), config.biquad_filter_enabled.Value());
|
config.simple_filter_enabled.Value(), config.biquad_filter_enabled.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.simple_filter_dirty) {
|
if (config.simple_filter_dirty) {
|
||||||
config.simple_filter_dirty.Assign(0);
|
config.simple_filter_dirty.Assign(0);
|
||||||
state.filters.Configure(config.simple_filter);
|
state.filters.Configure(config.simple_filter);
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} simple filter update", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} simple filter update", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.biquad_filter_dirty) {
|
if (config.biquad_filter_dirty) {
|
||||||
config.biquad_filter_dirty.Assign(0);
|
config.biquad_filter_dirty.Assign(0);
|
||||||
state.filters.Configure(config.biquad_filter);
|
state.filters.Configure(config.biquad_filter);
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} biquad filter update", source_id);
|
LOG_TRACE(Audio_DSP, "source_id={} biquad filter update", source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.interpolation_dirty) {
|
if (config.interpolation_dirty) {
|
||||||
config.interpolation_dirty.Assign(0);
|
config.interpolation_dirty.Assign(0);
|
||||||
state.interpolation_mode = config.interpolation_mode;
|
state.interpolation_mode = config.interpolation_mode;
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} interpolation_mode={}", source_id,
|
LOG_TRACE(Audio_DSP, "source_id={} interpolation_mode={}", source_id,
|
||||||
static_cast<size_t>(state.interpolation_mode));
|
static_cast<size_t>(state.interpolation_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.format_dirty || config.embedded_buffer_dirty) {
|
if (config.format_dirty || config.embedded_buffer_dirty) {
|
||||||
config.format_dirty.Assign(0);
|
config.format_dirty.Assign(0);
|
||||||
state.format = config.format;
|
state.format = config.format;
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} format={}", source_id,
|
LOG_TRACE(Audio_DSP, "source_id={} format={}", source_id,
|
||||||
static_cast<size_t>(state.format));
|
static_cast<size_t>(state.format));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.mono_or_stereo_dirty || config.embedded_buffer_dirty) {
|
if (config.mono_or_stereo_dirty || config.embedded_buffer_dirty) {
|
||||||
config.mono_or_stereo_dirty.Assign(0);
|
config.mono_or_stereo_dirty.Assign(0);
|
||||||
state.mono_or_stereo = config.mono_or_stereo;
|
state.mono_or_stereo = config.mono_or_stereo;
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} mono_or_stereo={}", source_id,
|
LOG_TRACE(Audio_DSP, "source_id={} mono_or_stereo={}", source_id,
|
||||||
static_cast<size_t>(state.mono_or_stereo));
|
static_cast<size_t>(state.mono_or_stereo));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_dsp play_position = {};
|
u32_dsp play_position = {};
|
||||||
@ -182,15 +182,15 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config,
|
|||||||
play_position,
|
play_position,
|
||||||
false,
|
false,
|
||||||
});
|
});
|
||||||
NGLOG_TRACE(Audio_DSP, "enqueuing embedded addr={:#010x} len={} id={} start={}",
|
LOG_TRACE(Audio_DSP, "enqueuing embedded addr={:#010x} len={} id={} start={}",
|
||||||
config.physical_address, config.length, config.buffer_id,
|
config.physical_address, config.length, config.buffer_id,
|
||||||
static_cast<u32>(config.play_position));
|
static_cast<u32>(config.play_position));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.loop_related_dirty && config.loop_related != 0) {
|
if (config.loop_related_dirty && config.loop_related != 0) {
|
||||||
config.loop_related_dirty.Assign(0);
|
config.loop_related_dirty.Assign(0);
|
||||||
NGLOG_WARNING(Audio_DSP, "Unhandled complex loop with loop_related={:#010x}",
|
LOG_WARNING(Audio_DSP, "Unhandled complex loop with loop_related={:#010x}",
|
||||||
static_cast<u32>(config.loop_related));
|
static_cast<u32>(config.loop_related));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.buffer_queue_dirty) {
|
if (config.buffer_queue_dirty) {
|
||||||
@ -212,15 +212,15 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config,
|
|||||||
{}, // 0 in u32_dsp
|
{}, // 0 in u32_dsp
|
||||||
false,
|
false,
|
||||||
});
|
});
|
||||||
NGLOG_TRACE(Audio_DSP, "enqueuing queued {} addr={:#010x} len={} id={}", i,
|
LOG_TRACE(Audio_DSP, "enqueuing queued {} addr={:#010x} len={} id={}", i,
|
||||||
b.physical_address, b.length, b.buffer_id);
|
b.physical_address, b.length, b.buffer_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config.buffers_dirty = 0;
|
config.buffers_dirty = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.dirty_raw) {
|
if (config.dirty_raw) {
|
||||||
NGLOG_DEBUG(Audio_DSP, "source_id={} remaining_dirty={:x}", source_id, config.dirty_raw);
|
LOG_DEBUG(Audio_DSP, "source_id={} remaining_dirty={:x}", source_id, config.dirty_raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
config.dirty_raw = 0;
|
config.dirty_raw = 0;
|
||||||
@ -255,7 +255,7 @@ void Source::GenerateFrame() {
|
|||||||
break;
|
break;
|
||||||
case InterpolationMode::Polyphase:
|
case InterpolationMode::Polyphase:
|
||||||
// TODO(merry): Implement polyphase interpolation
|
// TODO(merry): Implement polyphase interpolation
|
||||||
NGLOG_DEBUG(Audio_DSP, "Polyphase interpolation unimplemented; falling back to linear");
|
LOG_DEBUG(Audio_DSP, "Polyphase interpolation unimplemented; falling back to linear");
|
||||||
AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier,
|
AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier,
|
||||||
current_frame, frame_position);
|
current_frame, frame_position);
|
||||||
break;
|
break;
|
||||||
@ -304,9 +304,9 @@ bool Source::DequeueBuffer() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NGLOG_WARNING(Audio_DSP,
|
LOG_WARNING(Audio_DSP,
|
||||||
"source_id={} buffer_id={} length={}: Invalid physical address {:#010x}",
|
"source_id={} buffer_id={} length={}: Invalid physical address {:#010x}",
|
||||||
source_id, buf.buffer_id, buf.length, buf.physical_address);
|
source_id, buf.buffer_id, buf.length, buf.physical_address);
|
||||||
state.current_buffer.clear();
|
state.current_buffer.clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -322,8 +322,8 @@ bool Source::DequeueBuffer() {
|
|||||||
state.input_queue.push(buf);
|
state.input_queue.push(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Audio_DSP, "source_id={} buffer_id={} from_queue={} current_buffer.size()={}",
|
LOG_TRACE(Audio_DSP, "source_id={} buffer_id={} from_queue={} current_buffer.size()={}",
|
||||||
source_id, buf.buffer_id, buf.from_queue, state.current_buffer.size());
|
source_id, buf.buffer_id, buf.from_queue, state.current_buffer.size());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ struct SDL2Sink::Impl {
|
|||||||
|
|
||||||
SDL2Sink::SDL2Sink() : impl(std::make_unique<Impl>()) {
|
SDL2Sink::SDL2Sink() : impl(std::make_unique<Impl>()) {
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||||
NGLOG_CRITICAL(Audio_Sink, "SDL_Init(SDL_INIT_AUDIO) failed with: {}", SDL_GetError());
|
LOG_CRITICAL(Audio_Sink, "SDL_Init(SDL_INIT_AUDIO) failed with: {}", SDL_GetError());
|
||||||
impl->audio_device_id = 0;
|
impl->audio_device_id = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,8 +58,8 @@ SDL2Sink::SDL2Sink() : impl(std::make_unique<Impl>()) {
|
|||||||
impl->audio_device_id = SDL_OpenAudioDevice(
|
impl->audio_device_id = SDL_OpenAudioDevice(
|
||||||
device, false, &desired_audiospec, &obtained_audiospec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
|
device, false, &desired_audiospec, &obtained_audiospec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
|
||||||
if (impl->audio_device_id <= 0) {
|
if (impl->audio_device_id <= 0) {
|
||||||
NGLOG_CRITICAL(Audio_Sink, "SDL_OpenAudioDevice failed with code {} for device \"{}\"",
|
LOG_CRITICAL(Audio_Sink, "SDL_OpenAudioDevice failed with code {} for device \"{}\"",
|
||||||
impl->audio_device_id, Settings::values.audio_device_id);
|
impl->audio_device_id, Settings::values.audio_device_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ const SinkDetails& GetSinkDetails(std::string sink_id) {
|
|||||||
|
|
||||||
if (sink_id == "auto" || iter == g_sink_details.end()) {
|
if (sink_id == "auto" || iter == g_sink_details.end()) {
|
||||||
if (sink_id != "auto") {
|
if (sink_id != "auto") {
|
||||||
NGLOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id {}", sink_id);
|
LOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id {}", sink_id);
|
||||||
}
|
}
|
||||||
// Auto-select.
|
// Auto-select.
|
||||||
// g_sink_details is ordered in terms of desirability, with the best choice at the front.
|
// g_sink_details is ordered in terms of desirability, with the best choice at the front.
|
||||||
|
@ -55,7 +55,7 @@ std::vector<s16> TimeStretcher::Process(size_t samples_in_queue) {
|
|||||||
std::vector<s16> samples = GetSamples();
|
std::vector<s16> samples = GetSamples();
|
||||||
if (samples_in_queue >= DROP_FRAMES_SAMPLE_DELAY) {
|
if (samples_in_queue >= DROP_FRAMES_SAMPLE_DELAY) {
|
||||||
samples.clear();
|
samples.clear();
|
||||||
NGLOG_DEBUG(Audio, "Dropping frames!");
|
LOG_DEBUG(Audio, "Dropping frames!");
|
||||||
}
|
}
|
||||||
return samples;
|
return samples;
|
||||||
}
|
}
|
||||||
|
@ -69,39 +69,39 @@ static void PrintVersion() {
|
|||||||
static void OnStateChanged(const Network::RoomMember::State& state) {
|
static void OnStateChanged(const Network::RoomMember::State& state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Network::RoomMember::State::Idle:
|
case Network::RoomMember::State::Idle:
|
||||||
NGLOG_DEBUG(Network, "Network is idle");
|
LOG_DEBUG(Network, "Network is idle");
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::Joining:
|
case Network::RoomMember::State::Joining:
|
||||||
NGLOG_DEBUG(Network, "Connection sequence to room started");
|
LOG_DEBUG(Network, "Connection sequence to room started");
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::Joined:
|
case Network::RoomMember::State::Joined:
|
||||||
NGLOG_DEBUG(Network, "Successfully joined to the room");
|
LOG_DEBUG(Network, "Successfully joined to the room");
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::LostConnection:
|
case Network::RoomMember::State::LostConnection:
|
||||||
NGLOG_DEBUG(Network, "Lost connection to the room");
|
LOG_DEBUG(Network, "Lost connection to the room");
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::CouldNotConnect:
|
case Network::RoomMember::State::CouldNotConnect:
|
||||||
NGLOG_ERROR(Network, "State: CouldNotConnect");
|
LOG_ERROR(Network, "State: CouldNotConnect");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::NameCollision:
|
case Network::RoomMember::State::NameCollision:
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(
|
||||||
Network,
|
Network,
|
||||||
"You tried to use the same nickname then another user that is connected to the Room");
|
"You tried to use the same nickname then another user that is connected to the Room");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::MacCollision:
|
case Network::RoomMember::State::MacCollision:
|
||||||
NGLOG_ERROR(Network, "You tried to use the same MAC-Address then another user that is "
|
LOG_ERROR(Network, "You tried to use the same MAC-Address then another user that is "
|
||||||
"connected to the Room");
|
"connected to the Room");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::WrongPassword:
|
case Network::RoomMember::State::WrongPassword:
|
||||||
NGLOG_ERROR(Network, "Room replied with: Wrong password");
|
LOG_ERROR(Network, "Room replied with: Wrong password");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::WrongVersion:
|
case Network::RoomMember::State::WrongVersion:
|
||||||
NGLOG_ERROR(Network,
|
LOG_ERROR(Network,
|
||||||
"You are using a different version then the room you are trying to connect to");
|
"You are using a different version then the room you are trying to connect to");
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -128,7 +128,7 @@ int main(int argc, char** argv) {
|
|||||||
auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w);
|
auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w);
|
||||||
|
|
||||||
if (argv_w == nullptr) {
|
if (argv_w == nullptr) {
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to get command line arguments");
|
LOG_CRITICAL(Frontend, "Failed to get command line arguments");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -170,7 +170,7 @@ int main(int argc, char** argv) {
|
|||||||
break;
|
break;
|
||||||
case 'i': {
|
case 'i': {
|
||||||
const auto cia_progress = [](size_t written, size_t total) {
|
const auto cia_progress = [](size_t written, size_t total) {
|
||||||
NGLOG_INFO(Frontend, "{:02d}%", (written * 100 / total));
|
LOG_INFO(Frontend, "{:02d}%", (written * 100 / total));
|
||||||
};
|
};
|
||||||
if (Service::AM::InstallCIA(std::string(optarg), cia_progress) !=
|
if (Service::AM::InstallCIA(std::string(optarg), cia_progress) !=
|
||||||
Service::AM::InstallStatus::Success)
|
Service::AM::InstallStatus::Success)
|
||||||
@ -219,7 +219,7 @@ int main(int argc, char** argv) {
|
|||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
NGLOG_INFO(Frontend, "Starting in fullscreen mode...");
|
LOG_INFO(Frontend, "Starting in fullscreen mode...");
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
PrintHelp(argv[0]);
|
PrintHelp(argv[0]);
|
||||||
@ -246,12 +246,12 @@ int main(int argc, char** argv) {
|
|||||||
SCOPE_EXIT({ MicroProfileShutdown(); });
|
SCOPE_EXIT({ MicroProfileShutdown(); });
|
||||||
|
|
||||||
if (filepath.empty()) {
|
if (filepath.empty()) {
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
|
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!movie_record.empty() && !movie_play.empty()) {
|
if (!movie_record.empty() && !movie_play.empty()) {
|
||||||
NGLOG_CRITICAL(Frontend, "Cannot both play and record a movie");
|
LOG_CRITICAL(Frontend, "Cannot both play and record a movie");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,28 +281,28 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
switch (load_result) {
|
switch (load_result) {
|
||||||
case Core::System::ResultStatus::ErrorGetLoader:
|
case Core::System::ResultStatus::ErrorGetLoader:
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath);
|
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath);
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorLoader:
|
case Core::System::ResultStatus::ErrorLoader:
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to load ROM!");
|
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted:
|
case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted:
|
||||||
NGLOG_CRITICAL(Frontend, "The game that you are trying to load must be decrypted before "
|
LOG_CRITICAL(Frontend, "The game that you are trying to load must be decrypted before "
|
||||||
"being used with Citra. \n\n For more information on dumping and "
|
"being used with Citra. \n\n For more information on dumping and "
|
||||||
"decrypting games, please refer to: "
|
"decrypting games, please refer to: "
|
||||||
"https://citra-emu.org/wiki/dumping-game-cartridges/");
|
"https://citra-emu.org/wiki/dumping-game-cartridges/");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
|
case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
|
||||||
NGLOG_CRITICAL(Frontend, "Error while loading ROM: The ROM format is not supported.");
|
LOG_CRITICAL(Frontend, "Error while loading ROM: The ROM format is not supported.");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorNotInitialized:
|
case Core::System::ResultStatus::ErrorNotInitialized:
|
||||||
NGLOG_CRITICAL(Frontend, "CPUCore not initialized");
|
LOG_CRITICAL(Frontend, "CPUCore not initialized");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorSystemMode:
|
case Core::System::ResultStatus::ErrorSystemMode:
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to determine system mode!");
|
LOG_CRITICAL(Frontend, "Failed to determine system mode!");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorVideoCore:
|
case Core::System::ResultStatus::ErrorVideoCore:
|
||||||
NGLOG_CRITICAL(Frontend, "VideoCore not initialized");
|
LOG_CRITICAL(Frontend, "VideoCore not initialized");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::Success:
|
case Core::System::ResultStatus::Success:
|
||||||
break; // Expected case
|
break; // Expected case
|
||||||
@ -314,11 +314,11 @@ int main(int argc, char** argv) {
|
|||||||
if (auto member = Network::GetRoomMember().lock()) {
|
if (auto member = Network::GetRoomMember().lock()) {
|
||||||
member->BindOnChatMessageRecieved(OnMessageReceived);
|
member->BindOnChatMessageRecieved(OnMessageReceived);
|
||||||
member->BindOnStateChanged(OnStateChanged);
|
member->BindOnStateChanged(OnStateChanged);
|
||||||
NGLOG_DEBUG(Network, "Start connection to {}:{} with nickname {}", address, port,
|
LOG_DEBUG(Network, "Start connection to {}:{} with nickname {}", address, port,
|
||||||
nickname);
|
nickname);
|
||||||
member->Join(nickname, address.c_str(), port, 0, Network::NoPreferredMac, password);
|
member->Join(nickname, address.c_str(), port, 0, Network::NoPreferredMac, password);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Network, "Could not access RoomMember");
|
LOG_ERROR(Network, "Could not access RoomMember");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,17 +27,17 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
|
|||||||
const char* location = this->sdl2_config_loc.c_str();
|
const char* location = this->sdl2_config_loc.c_str();
|
||||||
if (sdl2_config->ParseError() < 0) {
|
if (sdl2_config->ParseError() < 0) {
|
||||||
if (retry) {
|
if (retry) {
|
||||||
NGLOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location);
|
LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location);
|
||||||
FileUtil::CreateFullPath(location);
|
FileUtil::CreateFullPath(location);
|
||||||
FileUtil::WriteStringToFile(true, default_contents, location);
|
FileUtil::WriteStringToFile(true, default_contents, location);
|
||||||
sdl2_config = std::make_unique<INIReader>(location); // Reopen file
|
sdl2_config = std::make_unique<INIReader>(location); // Reopen file
|
||||||
|
|
||||||
return LoadINI(default_contents, false);
|
return LoadINI(default_contents, false);
|
||||||
}
|
}
|
||||||
NGLOG_ERROR(Config, "Failed.");
|
LOG_ERROR(Config, "Failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NGLOG_INFO(Config, "Successfully loaded {}", location);
|
LOG_INFO(Config, "Successfully loaded {}", location);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,19 +63,19 @@ void EmuWindow_SDL2::Fullscreen() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
|
LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
|
||||||
|
|
||||||
// Try a different fullscreening method
|
// Try a different fullscreening method
|
||||||
NGLOG_INFO(Frontend, "Attempting to use borderless fullscreen...");
|
LOG_INFO(Frontend, "Attempting to use borderless fullscreen...");
|
||||||
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
|
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError());
|
LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError());
|
||||||
|
|
||||||
// Fallback algorithm: Maximise window.
|
// Fallback algorithm: Maximise window.
|
||||||
// Works on all systems (unless something is seriously wrong), so no fallback for this one.
|
// Works on all systems (unless something is seriously wrong), so no fallback for this one.
|
||||||
NGLOG_INFO(Frontend, "Falling back on a maximised window...");
|
LOG_INFO(Frontend, "Falling back on a maximised window...");
|
||||||
SDL_MaximizeWindow(render_window);
|
SDL_MaximizeWindow(render_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
|
|||||||
|
|
||||||
// Initialize the window
|
// Initialize the window
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting...");
|
LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting...");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
|
|||||||
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
|
|
||||||
if (render_window == nullptr) {
|
if (render_window == nullptr) {
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to create SDL2 window: {}", SDL_GetError());
|
LOG_CRITICAL(Frontend, "Failed to create SDL2 window: {}", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,12 +121,12 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
|
|||||||
gl_context = SDL_GL_CreateContext(render_window);
|
gl_context = SDL_GL_CreateContext(render_window);
|
||||||
|
|
||||||
if (gl_context == nullptr) {
|
if (gl_context == nullptr) {
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to create SDL2 GL context: {}", SDL_GetError());
|
LOG_CRITICAL(Frontend, "Failed to create SDL2 GL context: {}", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) {
|
if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) {
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to initialize GL functions: {}", SDL_GetError());
|
LOG_CRITICAL(Frontend, "Failed to initialize GL functions: {}", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,8 +134,8 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
|
|||||||
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
|
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
SDL_GL_SetSwapInterval(Settings::values.use_vsync);
|
SDL_GL_SetSwapInterval(Settings::values.use_vsync);
|
||||||
NGLOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname,
|
LOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch,
|
||||||
Common::g_scm_branch, Common::g_scm_desc);
|
Common::g_scm_desc);
|
||||||
|
|
||||||
DoneCurrent();
|
DoneCurrent();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ void QtCameraInterface::SetFlip(Service::CAM::Flip flip) {
|
|||||||
|
|
||||||
void QtCameraInterface::SetEffect(Service::CAM::Effect effect) {
|
void QtCameraInterface::SetEffect(Service::CAM::Effect effect) {
|
||||||
if (effect != Service::CAM::Effect::None) {
|
if (effect != Service::CAM::Effect::None) {
|
||||||
NGLOG_ERROR(Service_CAM, "Unimplemented effect {}", static_cast<int>(effect));
|
LOG_ERROR(Service_CAM, "Unimplemented effect {}", static_cast<int>(effect));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,13 +133,13 @@ std::shared_ptr<QtMultimediaCameraHandler> QtMultimediaCameraHandler::GetHandler
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < handlers.size(); i++) {
|
for (int i = 0; i < handlers.size(); i++) {
|
||||||
if (!status[i]) {
|
if (!status[i]) {
|
||||||
NGLOG_INFO(Service_CAM, "Successfully got handler {}", i);
|
LOG_INFO(Service_CAM, "Successfully got handler {}", i);
|
||||||
status[i] = true;
|
status[i] = true;
|
||||||
loaded.emplace(camera_name, handlers[i]);
|
loaded.emplace(camera_name, handlers[i]);
|
||||||
return handlers[i];
|
return handlers[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NGLOG_CRITICAL(Service_CAM, "All handlers taken up");
|
LOG_CRITICAL(Service_CAM, "All handlers taken up");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ void QtMultimediaCameraHandler::ReleaseHandler(
|
|||||||
const std::shared_ptr<Camera::QtMultimediaCameraHandler>& handler) {
|
const std::shared_ptr<Camera::QtMultimediaCameraHandler>& handler) {
|
||||||
for (int i = 0; i < handlers.size(); i++) {
|
for (int i = 0; i < handlers.size(); i++) {
|
||||||
if (handlers[i] == handler) {
|
if (handlers[i] == handler) {
|
||||||
NGLOG_INFO(Service_CAM, "Successfully released handler {}", i);
|
LOG_INFO(Service_CAM, "Successfully released handler {}", i);
|
||||||
status[i] = false;
|
status[i] = false;
|
||||||
handlers[i]->started = false;
|
handlers[i]->started = false;
|
||||||
for (auto it = loaded.begin(); it != loaded.end(); it++) {
|
for (auto it = loaded.begin(); it != loaded.end(); it++) {
|
||||||
@ -192,7 +192,7 @@ bool QtMultimediaCameraHandler::CameraAvailable() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QtMultimediaCameraHandler::StopCameras() {
|
void QtMultimediaCameraHandler::StopCameras() {
|
||||||
NGLOG_INFO(Service_CAM, "Stopping all cameras");
|
LOG_INFO(Service_CAM, "Stopping all cameras");
|
||||||
for (auto& handler : handlers) {
|
for (auto& handler : handlers) {
|
||||||
if (handler && handler->started) {
|
if (handler && handler->started) {
|
||||||
handler->StopCamera();
|
handler->StopCamera();
|
||||||
@ -210,7 +210,7 @@ void QtMultimediaCameraHandler::ResumeCameras() {
|
|||||||
|
|
||||||
void QtMultimediaCameraHandler::ReleaseHandlers() {
|
void QtMultimediaCameraHandler::ReleaseHandlers() {
|
||||||
StopCameras();
|
StopCameras();
|
||||||
NGLOG_INFO(Service_CAM, "Releasing all handlers");
|
LOG_INFO(Service_CAM, "Releasing all handlers");
|
||||||
for (int i = 0; i < handlers.size(); i++) {
|
for (int i = 0; i < handlers.size(); i++) {
|
||||||
status[i] = false;
|
status[i] = false;
|
||||||
handlers[i]->started = false;
|
handlers[i]->started = false;
|
||||||
|
@ -62,7 +62,7 @@ std::unique_ptr<CameraInterface> StillImageCameraFactory::Create(const std::stri
|
|||||||
}
|
}
|
||||||
QImage image(QString::fromStdString(real_config));
|
QImage image(QString::fromStdString(real_config));
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
NGLOG_ERROR(Service_CAM, "Couldn't load image \"{}\"", real_config.c_str());
|
LOG_ERROR(Service_CAM, "Couldn't load image \"{}\"", real_config.c_str());
|
||||||
}
|
}
|
||||||
return std::make_unique<StillImageCamera>(image, flip);
|
return std::make_unique<StillImageCamera>(image, flip);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ void CompatDB::Submit() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CompatDBPage::Final:
|
case CompatDBPage::Final:
|
||||||
NGLOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId());
|
LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId());
|
||||||
Core::Telemetry().AddField(Telemetry::FieldType::UserFeedback, "Compatibility",
|
Core::Telemetry().AddField(Telemetry::FieldType::UserFeedback, "Compatibility",
|
||||||
compatibility->checkedId());
|
compatibility->checkedId());
|
||||||
// older versions of QT don't support the "NoCancelButtonOnLastPage" option, this is a
|
// older versions of QT don't support the "NoCancelButtonOnLastPage" option, this is a
|
||||||
@ -50,7 +50,7 @@ void CompatDB::Submit() {
|
|||||||
button(QWizard::CancelButton)->setVisible(false);
|
button(QWizard::CancelButton)->setVisible(false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Frontend, "Unexpected page: {}", currentId());
|
LOG_ERROR(Frontend, "Unexpected page: {}", currentId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void ConfigureCamera::updateImageSourceUI() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Service_CAM, "Unknown image source {}", image_source);
|
LOG_ERROR(Service_CAM, "Unknown image source {}", image_source);
|
||||||
}
|
}
|
||||||
ui->system_camera_label->setHidden(image_source != 2);
|
ui->system_camera_label->setHidden(image_source != 2);
|
||||||
ui->system_camera->setHidden(image_source != 2);
|
ui->system_camera->setHidden(image_source != 2);
|
||||||
@ -302,7 +302,7 @@ ConfigureCamera::CameraPosition ConfigureCamera::getCameraSelection() {
|
|||||||
: CameraPosition::RearRight;
|
: CameraPosition::RearRight;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Frontend, "Unknown camera selection");
|
LOG_ERROR(Frontend, "Unknown camera selection");
|
||||||
return CameraPosition::Front;
|
return CameraPosition::Front;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -533,18 +533,18 @@ void GameList::LoadCompatibilityList() {
|
|||||||
QFile compat_list{":compatibility_list/compatibility_list.json"};
|
QFile compat_list{":compatibility_list/compatibility_list.json"};
|
||||||
|
|
||||||
if (!compat_list.open(QFile::ReadOnly | QFile::Text)) {
|
if (!compat_list.open(QFile::ReadOnly | QFile::Text)) {
|
||||||
NGLOG_ERROR(Frontend, "Unable to open game compatibility list");
|
LOG_ERROR(Frontend, "Unable to open game compatibility list");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compat_list.size() == 0) {
|
if (compat_list.size() == 0) {
|
||||||
NGLOG_ERROR(Frontend, "Game compatibility list is empty");
|
LOG_ERROR(Frontend, "Game compatibility list is empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QByteArray content = compat_list.readAll();
|
const QByteArray content = compat_list.readAll();
|
||||||
if (content.isEmpty()) {
|
if (content.isEmpty()) {
|
||||||
NGLOG_ERROR(Frontend, "Unable to completely read game compatibility list");
|
LOG_ERROR(Frontend, "Unable to completely read game compatibility list");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ static bool HasSupportedFileExtension(const std::string& file_name) {
|
|||||||
|
|
||||||
void GameList::RefreshGameDirectory() {
|
void GameList::RefreshGameDirectory() {
|
||||||
if (!UISettings::values.game_dirs.isEmpty() && current_worker != nullptr) {
|
if (!UISettings::values.game_dirs.isEmpty() && current_worker != nullptr) {
|
||||||
NGLOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
|
LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
|
||||||
PopulateAsync(UISettings::values.game_dirs);
|
PopulateAsync(UISettings::values.game_dirs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ public:
|
|||||||
|
|
||||||
auto iterator = status_data.find(compatiblity);
|
auto iterator = status_data.find(compatiblity);
|
||||||
if (iterator == status_data.end()) {
|
if (iterator == status_data.end()) {
|
||||||
NGLOG_WARNING(Frontend, "Invalid compatibility number {}", compatiblity.toStdString());
|
LOG_WARNING(Frontend, "Invalid compatibility number {}", compatiblity.toStdString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompatStatus status = iterator->second;
|
CompatStatus status = iterator->second;
|
||||||
|
@ -137,8 +137,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
|||||||
ConnectWidgetEvents();
|
ConnectWidgetEvents();
|
||||||
|
|
||||||
SetupUIStrings();
|
SetupUIStrings();
|
||||||
NGLOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname,
|
LOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch,
|
||||||
Common::g_scm_branch, Common::g_scm_desc);
|
Common::g_scm_desc);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
@ -528,20 +528,20 @@ void GMainWindow::OnCheckForUpdates() {
|
|||||||
|
|
||||||
void GMainWindow::CheckForUpdates() {
|
void GMainWindow::CheckForUpdates() {
|
||||||
if (updater->CheckForUpdates()) {
|
if (updater->CheckForUpdates()) {
|
||||||
NGLOG_INFO(Frontend, "Update check started");
|
LOG_INFO(Frontend, "Update check started");
|
||||||
} else {
|
} else {
|
||||||
NGLOG_WARNING(Frontend, "Unable to start check for updates");
|
LOG_WARNING(Frontend, "Unable to start check for updates");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnUpdateFound(bool found, bool error) {
|
void GMainWindow::OnUpdateFound(bool found, bool error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
NGLOG_WARNING(Frontend, "Update check failed");
|
LOG_WARNING(Frontend, "Update check failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
NGLOG_INFO(Frontend, "No updates found");
|
LOG_INFO(Frontend, "No updates found");
|
||||||
|
|
||||||
// If the user explicitly clicked the "Check for Updates" button, we are
|
// If the user explicitly clicked the "Check for Updates" button, we are
|
||||||
// going to want to show them a prompt anyway.
|
// going to want to show them a prompt anyway.
|
||||||
@ -553,12 +553,12 @@ void GMainWindow::OnUpdateFound(bool found, bool error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (emulation_running && !explicit_update_check) {
|
if (emulation_running && !explicit_update_check) {
|
||||||
NGLOG_INFO(Frontend, "Update found, deferring as game is running");
|
LOG_INFO(Frontend, "Update found, deferring as game is running");
|
||||||
defer_update_prompt = true;
|
defer_update_prompt = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_INFO(Frontend, "Update found!");
|
LOG_INFO(Frontend, "Update found!");
|
||||||
explicit_update_check = false;
|
explicit_update_check = false;
|
||||||
|
|
||||||
ShowUpdatePrompt();
|
ShowUpdatePrompt();
|
||||||
@ -610,13 +610,13 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
|||||||
if (result != Core::System::ResultStatus::Success) {
|
if (result != Core::System::ResultStatus::Success) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Core::System::ResultStatus::ErrorGetLoader:
|
case Core::System::ResultStatus::ErrorGetLoader:
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
|
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
|
||||||
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
||||||
tr("The ROM format is not supported."));
|
tr("The ROM format is not supported."));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Core::System::ResultStatus::ErrorSystemMode:
|
case Core::System::ResultStatus::ErrorSystemMode:
|
||||||
NGLOG_CRITICAL(Frontend, "Failed to load ROM!");
|
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
||||||
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
||||||
tr("Could not determine the system mode."));
|
tr("Could not determine the system mode."));
|
||||||
break;
|
break;
|
||||||
@ -672,7 +672,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::BootGame(const QString& filename) {
|
void GMainWindow::BootGame(const QString& filename) {
|
||||||
NGLOG_INFO(Frontend, "Citra starting...");
|
LOG_INFO(Frontend, "Citra starting...");
|
||||||
StoreRecentFile(filename); // Put the filename on top of the list
|
StoreRecentFile(filename); // Put the filename on top of the list
|
||||||
|
|
||||||
if (!LoadROM(filename))
|
if (!LoadROM(filename))
|
||||||
@ -825,7 +825,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|||||||
"content/";
|
"content/";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Frontend, "Unexpected target {}", static_cast<int>(target));
|
LOG_ERROR(Frontend, "Unexpected target {}", static_cast<int>(target));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,7 +839,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_INFO(Frontend, "Opening {} path for program_id={:016x}", open_target, program_id);
|
LOG_INFO(Frontend, "Opening {} path for program_id={:016x}", open_target, program_id);
|
||||||
|
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(qpath));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(qpath));
|
||||||
}
|
}
|
||||||
@ -894,7 +894,7 @@ void GMainWindow::OnGameListAddDirectory() {
|
|||||||
UISettings::values.game_dirs.append(game_dir);
|
UISettings::values.game_dirs.append(game_dir);
|
||||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_WARNING(Frontend, "Selected directory is already in the game list");
|
LOG_WARNING(Frontend, "Selected directory is already in the game list");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1362,7 +1362,7 @@ void GMainWindow::UpdateUITheme() {
|
|||||||
QString theme_uri(":" + UISettings::values.theme + "/style.qss");
|
QString theme_uri(":" + UISettings::values.theme + "/style.qss");
|
||||||
QFile f(theme_uri);
|
QFile f(theme_uri);
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
NGLOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
|
LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
|
||||||
} else {
|
} else {
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
f.open(QFile::ReadOnly | QFile::Text);
|
||||||
QTextStream ts(&f);
|
QTextStream ts(&f);
|
||||||
|
@ -150,7 +150,7 @@ void ChatRoom::OnChatReceive(const Network::ChatEntry& chat) {
|
|||||||
return member.nickname == chat.nickname;
|
return member.nickname == chat.nickname;
|
||||||
});
|
});
|
||||||
if (it == members.end()) {
|
if (it == members.end()) {
|
||||||
NGLOG_INFO(Network, "Chat message received from unknown player. Ignoring it.");
|
LOG_INFO(Network, "Chat message received from unknown player. Ignoring it.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto player = std::distance(members.begin(), it);
|
auto player = std::distance(members.begin(), it);
|
||||||
@ -177,7 +177,7 @@ void ChatRoom::OnSendChat() {
|
|||||||
return member.nickname == chat.nickname;
|
return member.nickname == chat.nickname;
|
||||||
});
|
});
|
||||||
if (it == members.end()) {
|
if (it == members.end()) {
|
||||||
NGLOG_INFO(Network, "Cannot find self in the player list when sending a message.");
|
LOG_INFO(Network, "Cannot find self in the player list when sending a message.");
|
||||||
}
|
}
|
||||||
auto player = std::distance(members.begin(), it);
|
auto player = std::distance(members.begin(), it);
|
||||||
ChatMessage m(chat);
|
ChatMessage m(chat);
|
||||||
|
@ -103,7 +103,7 @@ void HostRoomWindow::Host() {
|
|||||||
ui->max_player->value(), game_name.toStdString(), game_id);
|
ui->max_player->value(), game_name.toStdString(), game_id);
|
||||||
if (!created) {
|
if (!created) {
|
||||||
NetworkMessage::ShowError(NetworkMessage::COULD_NOT_CREATE_ROOM);
|
NetworkMessage::ShowError(NetworkMessage::COULD_NOT_CREATE_ROOM);
|
||||||
NGLOG_ERROR(Network, "Could not create room!");
|
LOG_ERROR(Network, "Could not create room!");
|
||||||
ui->host->setEnabled(true);
|
ui->host->setEnabled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ void HostRoomWindow::OnConnection() {
|
|||||||
if (auto session = announce_multiplayer_session.lock()) {
|
if (auto session = announce_multiplayer_session.lock()) {
|
||||||
session->Start();
|
session->Start();
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Network, "Starting announce session failed");
|
LOG_ERROR(Network, "Starting announce session failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
|
@ -66,7 +66,7 @@ void MultiplayerState::Close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& state) {
|
void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& state) {
|
||||||
NGLOG_DEBUG(Frontend, "Network State: {}", Network::GetStateStr(state));
|
LOG_DEBUG(Frontend, "Network State: {}", Network::GetStateStr(state));
|
||||||
bool is_connected = false;
|
bool is_connected = false;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Network::RoomMember::State::LostConnection:
|
case Network::RoomMember::State::LostConnection:
|
||||||
@ -147,7 +147,7 @@ bool MultiplayerState::OnCloseRoom() {
|
|||||||
// if you are in a room, leave it
|
// if you are in a room, leave it
|
||||||
if (auto member = Network::GetRoomMember().lock()) {
|
if (auto member = Network::GetRoomMember().lock()) {
|
||||||
member->Leave();
|
member->Leave();
|
||||||
NGLOG_DEBUG(Frontend, "Left the room (as a client)");
|
LOG_DEBUG(Frontend, "Left the room (as a client)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if you are hosting a room, also stop hosting
|
// if you are hosting a room, also stop hosting
|
||||||
@ -156,7 +156,7 @@ bool MultiplayerState::OnCloseRoom() {
|
|||||||
}
|
}
|
||||||
room->Destroy();
|
room->Destroy();
|
||||||
announce_multiplayer_session->Stop();
|
announce_multiplayer_session->Stop();
|
||||||
NGLOG_DEBUG(Frontend, "Closed the room (as a server)");
|
LOG_DEBUG(Frontend, "Closed the room (as a server)");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ XMLParseResult UpdaterPrivate::ParseResult(const QByteArray& output,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reader.hasError()) {
|
if (reader.hasError()) {
|
||||||
NGLOG_ERROR(Frontend, "Cannot read xml for update: {}", reader.errorString().toStdString());
|
LOG_ERROR(Frontend, "Cannot read xml for update: {}", reader.errorString().toStdString());
|
||||||
return XMLParseResult::InvalidXML;
|
return XMLParseResult::InvalidXML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,18 +275,18 @@ void UpdaterPrivate::LaunchWithArguments(const QStringList& args) {
|
|||||||
QFileInfo tool_info(QCoreApplication::applicationDirPath(), tool_path);
|
QFileInfo tool_info(QCoreApplication::applicationDirPath(), tool_path);
|
||||||
|
|
||||||
if (!QProcess::startDetached(tool_info.absoluteFilePath(), args, tool_info.absolutePath())) {
|
if (!QProcess::startDetached(tool_info.absoluteFilePath(), args, tool_info.absolutePath())) {
|
||||||
NGLOG_WARNING(Frontend, "Unable to start program {}",
|
LOG_WARNING(Frontend, "Unable to start program {}",
|
||||||
tool_info.absoluteFilePath().toStdString());
|
tool_info.absoluteFilePath().toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdaterPrivate::LaunchUI() {
|
void UpdaterPrivate::LaunchUI() {
|
||||||
NGLOG_INFO(Frontend, "Launching update UI...");
|
LOG_INFO(Frontend, "Launching update UI...");
|
||||||
LaunchWithArguments(run_arguments);
|
LaunchWithArguments(run_arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdaterPrivate::SilentlyUpdate() {
|
void UpdaterPrivate::SilentlyUpdate() {
|
||||||
NGLOG_INFO(Frontend, "Launching silent update...");
|
LOG_INFO(Frontend, "Launching silent update...");
|
||||||
LaunchWithArguments(silent_arguments);
|
LaunchWithArguments(silent_arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,15 +30,14 @@ __declspec(noinline, noreturn)
|
|||||||
#define ASSERT(_a_) \
|
#define ASSERT(_a_) \
|
||||||
do \
|
do \
|
||||||
if (!(_a_)) { \
|
if (!(_a_)) { \
|
||||||
assert_noinline_call([] { NGLOG_CRITICAL(Debug, "Assertion Failed!"); }); \
|
assert_noinline_call([] { LOG_CRITICAL(Debug, "Assertion Failed!"); }); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
#define ASSERT_MSG(_a_, ...) \
|
#define ASSERT_MSG(_a_, ...) \
|
||||||
do \
|
do \
|
||||||
if (!(_a_)) { \
|
if (!(_a_)) { \
|
||||||
assert_noinline_call( \
|
assert_noinline_call([&] { LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); }); \
|
||||||
[&] { NGLOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); }); \
|
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
@ -53,5 +52,5 @@ __declspec(noinline, noreturn)
|
|||||||
#define DEBUG_ASSERT_MSG(_a_, _desc_, ...)
|
#define DEBUG_ASSERT_MSG(_a_, _desc_, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define UNIMPLEMENTED() NGLOG_CRITICAL(Debug, "Unimplemented code!")
|
#define UNIMPLEMENTED() LOG_CRITICAL(Debug, "Unimplemented code!")
|
||||||
#define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__)
|
#define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__)
|
||||||
|
@ -159,8 +159,8 @@ public:
|
|||||||
Do(foundVersion);
|
Do(foundVersion);
|
||||||
|
|
||||||
if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) {
|
if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) {
|
||||||
NGLOG_ERROR(Common, "Savestate failure: wrong version {} found for {}", foundVersion,
|
LOG_ERROR(Common, "Savestate failure: wrong version {} found for {}", foundVersion,
|
||||||
title);
|
title);
|
||||||
SetError(ERROR_FAILURE);
|
SetError(ERROR_FAILURE);
|
||||||
return PointerWrapSection(*this, -1, title);
|
return PointerWrapSection(*this, -1, title);
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ public:
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Common, "Savestate error: invalid mode {}.", mode);
|
LOG_ERROR(Common, "Savestate error: invalid mode {}.", mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,10 +607,10 @@ public:
|
|||||||
u32 cookie = arbitraryNumber;
|
u32 cookie = arbitraryNumber;
|
||||||
Do(cookie);
|
Do(cookie);
|
||||||
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) {
|
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) {
|
||||||
NGLOG_ERROR(Common,
|
LOG_ERROR(Common,
|
||||||
"After \"{}\", found {} ({:#X}) instead of save marker {} ({:#X}). "
|
"After \"{}\", found {} ({:#X}) instead of save marker {} ({:#X}). "
|
||||||
"Aborting savestate load...",
|
"Aborting savestate load...",
|
||||||
prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
|
prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
|
||||||
SetError(ERROR_FAILURE);
|
SetError(ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ bool IsDirectory(const std::string& filename) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
NGLOG_DEBUG(Common_Filesystem, "stat failed on {}: {}", filename, GetLastErrorMsg());
|
LOG_DEBUG(Common_Filesystem, "stat failed on {}: {}", filename, GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,29 +128,29 @@ bool IsDirectory(const std::string& filename) {
|
|||||||
// Deletes a given filename, return true on success
|
// Deletes a given filename, return true on success
|
||||||
// Doesn't supports deleting a directory
|
// Doesn't supports deleting a directory
|
||||||
bool Delete(const std::string& filename) {
|
bool Delete(const std::string& filename) {
|
||||||
NGLOG_TRACE(Common_Filesystem, "file {}", filename);
|
LOG_TRACE(Common_Filesystem, "file {}", filename);
|
||||||
|
|
||||||
// Return true because we care about the file no
|
// Return true because we care about the file no
|
||||||
// being there, not the actual delete.
|
// being there, not the actual delete.
|
||||||
if (!Exists(filename)) {
|
if (!Exists(filename)) {
|
||||||
NGLOG_DEBUG(Common_Filesystem, "{} does not exist", filename);
|
LOG_DEBUG(Common_Filesystem, "{} does not exist", filename);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can't delete a directory
|
// We can't delete a directory
|
||||||
if (IsDirectory(filename)) {
|
if (IsDirectory(filename)) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "Failed: {} is a directory", filename);
|
LOG_ERROR(Common_Filesystem, "Failed: {} is a directory", filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) {
|
if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "DeleteFile failed on {}: {}", filename, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "DeleteFile failed on {}: {}", filename, GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (unlink(filename.c_str()) == -1) {
|
if (unlink(filename.c_str()) == -1) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "unlink failed on {}: {}", filename, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "unlink failed on {}: {}", filename, GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -160,16 +160,16 @@ bool Delete(const std::string& filename) {
|
|||||||
|
|
||||||
// Returns true if successful, or path already exists.
|
// Returns true if successful, or path already exists.
|
||||||
bool CreateDir(const std::string& path) {
|
bool CreateDir(const std::string& path) {
|
||||||
NGLOG_TRACE(Common_Filesystem, "directory {}", path);
|
LOG_TRACE(Common_Filesystem, "directory {}", path);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (::CreateDirectoryW(Common::UTF8ToUTF16W(path).c_str(), nullptr))
|
if (::CreateDirectoryW(Common::UTF8ToUTF16W(path).c_str(), nullptr))
|
||||||
return true;
|
return true;
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
if (error == ERROR_ALREADY_EXISTS) {
|
if (error == ERROR_ALREADY_EXISTS) {
|
||||||
NGLOG_DEBUG(Common_Filesystem, "CreateDirectory failed on {}: already exists", path);
|
LOG_DEBUG(Common_Filesystem, "CreateDirectory failed on {}: already exists", path);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
NGLOG_ERROR(Common_Filesystem, "CreateDirectory failed on {}: {}", path, error);
|
LOG_ERROR(Common_Filesystem, "CreateDirectory failed on {}: {}", path, error);
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
if (mkdir(path.c_str(), 0755) == 0)
|
if (mkdir(path.c_str(), 0755) == 0)
|
||||||
@ -178,11 +178,11 @@ bool CreateDir(const std::string& path) {
|
|||||||
int err = errno;
|
int err = errno;
|
||||||
|
|
||||||
if (err == EEXIST) {
|
if (err == EEXIST) {
|
||||||
NGLOG_DEBUG(Common_Filesystem, "mkdir failed on {}: already exists", path);
|
LOG_DEBUG(Common_Filesystem, "mkdir failed on {}: already exists", path);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Common_Filesystem, "mkdir failed on {}: {}", path, strerror(err));
|
LOG_ERROR(Common_Filesystem, "mkdir failed on {}: {}", path, strerror(err));
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -190,10 +190,10 @@ bool CreateDir(const std::string& path) {
|
|||||||
// Creates the full path of fullPath returns true on success
|
// Creates the full path of fullPath returns true on success
|
||||||
bool CreateFullPath(const std::string& fullPath) {
|
bool CreateFullPath(const std::string& fullPath) {
|
||||||
int panicCounter = 100;
|
int panicCounter = 100;
|
||||||
NGLOG_TRACE(Common_Filesystem, "path {}", fullPath);
|
LOG_TRACE(Common_Filesystem, "path {}", fullPath);
|
||||||
|
|
||||||
if (FileUtil::Exists(fullPath)) {
|
if (FileUtil::Exists(fullPath)) {
|
||||||
NGLOG_DEBUG(Common_Filesystem, "path exists {}", fullPath);
|
LOG_DEBUG(Common_Filesystem, "path exists {}", fullPath);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,14 +209,14 @@ bool CreateFullPath(const std::string& fullPath) {
|
|||||||
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
|
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
|
||||||
std::string const subPath(fullPath.substr(0, position + 1));
|
std::string const subPath(fullPath.substr(0, position + 1));
|
||||||
if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) {
|
if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) {
|
||||||
NGLOG_ERROR(Common, "CreateFullPath: directory creation failed");
|
LOG_ERROR(Common, "CreateFullPath: directory creation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A safety check
|
// A safety check
|
||||||
panicCounter--;
|
panicCounter--;
|
||||||
if (panicCounter <= 0) {
|
if (panicCounter <= 0) {
|
||||||
NGLOG_ERROR(Common, "CreateFullPath: directory structure is too deep");
|
LOG_ERROR(Common, "CreateFullPath: directory structure is too deep");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
position++;
|
position++;
|
||||||
@ -225,11 +225,11 @@ bool CreateFullPath(const std::string& fullPath) {
|
|||||||
|
|
||||||
// Deletes a directory filename, returns true on success
|
// Deletes a directory filename, returns true on success
|
||||||
bool DeleteDir(const std::string& filename) {
|
bool DeleteDir(const std::string& filename) {
|
||||||
NGLOG_TRACE(Common_Filesystem, "directory {}", filename);
|
LOG_TRACE(Common_Filesystem, "directory {}", filename);
|
||||||
|
|
||||||
// check if a directory
|
// check if a directory
|
||||||
if (!FileUtil::IsDirectory(filename)) {
|
if (!FileUtil::IsDirectory(filename)) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "Not a directory {}", filename);
|
LOG_ERROR(Common_Filesystem, "Not a directory {}", filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,14 +240,14 @@ bool DeleteDir(const std::string& filename) {
|
|||||||
if (rmdir(filename.c_str()) == 0)
|
if (rmdir(filename.c_str()) == 0)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// renames file srcFilename to destFilename, returns true on success
|
// renames file srcFilename to destFilename, returns true on success
|
||||||
bool Rename(const std::string& srcFilename, const std::string& destFilename) {
|
bool Rename(const std::string& srcFilename, const std::string& destFilename) {
|
||||||
NGLOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename);
|
LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(),
|
if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(),
|
||||||
Common::UTF8ToUTF16W(destFilename).c_str()) == 0)
|
Common::UTF8ToUTF16W(destFilename).c_str()) == 0)
|
||||||
@ -256,21 +256,21 @@ bool Rename(const std::string& srcFilename, const std::string& destFilename) {
|
|||||||
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
|
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename,
|
LOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename,
|
||||||
GetLastErrorMsg());
|
GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copies file srcFilename to destFilename, returns true on success
|
// copies file srcFilename to destFilename, returns true on success
|
||||||
bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
||||||
NGLOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename);
|
LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(),
|
if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(),
|
||||||
Common::UTF8ToUTF16W(destFilename).c_str(), FALSE))
|
Common::UTF8ToUTF16W(destFilename).c_str(), FALSE))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename,
|
LOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename,
|
||||||
GetLastErrorMsg());
|
GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -282,8 +282,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
|||||||
// Open input file
|
// Open input file
|
||||||
FILE* input = fopen(srcFilename.c_str(), "rb");
|
FILE* input = fopen(srcFilename.c_str(), "rb");
|
||||||
if (!input) {
|
if (!input) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "opening input failed {} --> {}: {}", srcFilename,
|
LOG_ERROR(Common_Filesystem, "opening input failed {} --> {}: {}", srcFilename,
|
||||||
destFilename, GetLastErrorMsg());
|
destFilename, GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,8 +291,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
|||||||
FILE* output = fopen(destFilename.c_str(), "wb");
|
FILE* output = fopen(destFilename.c_str(), "wb");
|
||||||
if (!output) {
|
if (!output) {
|
||||||
fclose(input);
|
fclose(input);
|
||||||
NGLOG_ERROR(Common_Filesystem, "opening output failed {} --> {}: {}", srcFilename,
|
LOG_ERROR(Common_Filesystem, "opening output failed {} --> {}: {}", srcFilename,
|
||||||
destFilename, GetLastErrorMsg());
|
destFilename, GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,8 +302,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
|||||||
size_t rnum = fread(buffer, sizeof(char), BSIZE, input);
|
size_t rnum = fread(buffer, sizeof(char), BSIZE, input);
|
||||||
if (rnum != BSIZE) {
|
if (rnum != BSIZE) {
|
||||||
if (ferror(input) != 0) {
|
if (ferror(input) != 0) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}",
|
LOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}",
|
||||||
srcFilename, destFilename, GetLastErrorMsg());
|
srcFilename, destFilename, GetLastErrorMsg());
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,8 +311,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
|||||||
// write output
|
// write output
|
||||||
size_t wnum = fwrite(buffer, sizeof(char), rnum, output);
|
size_t wnum = fwrite(buffer, sizeof(char), rnum, output);
|
||||||
if (wnum != rnum) {
|
if (wnum != rnum) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename,
|
LOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename,
|
||||||
destFilename, GetLastErrorMsg());
|
destFilename, GetLastErrorMsg());
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,12 +332,12 @@ bail:
|
|||||||
// Returns the size of filename (64bit)
|
// Returns the size of filename (64bit)
|
||||||
u64 GetSize(const std::string& filename) {
|
u64 GetSize(const std::string& filename) {
|
||||||
if (!Exists(filename)) {
|
if (!Exists(filename)) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed {}: No such file", filename);
|
LOG_ERROR(Common_Filesystem, "failed {}: No such file", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDirectory(filename)) {
|
if (IsDirectory(filename)) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed {}: is a directory", filename);
|
LOG_ERROR(Common_Filesystem, "failed {}: is a directory", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,11 +348,11 @@ u64 GetSize(const std::string& filename) {
|
|||||||
if (stat(filename.c_str(), &buf) == 0)
|
if (stat(filename.c_str(), &buf) == 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
NGLOG_TRACE(Common_Filesystem, "{}: {}", filename, buf.st_size);
|
LOG_TRACE(Common_Filesystem, "{}: {}", filename, buf.st_size);
|
||||||
return buf.st_size;
|
return buf.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Common_Filesystem, "Stat failed {}: {}", filename, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "Stat failed {}: {}", filename, GetLastErrorMsg());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ u64 GetSize(const std::string& filename) {
|
|||||||
u64 GetSize(const int fd) {
|
u64 GetSize(const int fd) {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
if (fstat(fd, &buf) != 0) {
|
if (fstat(fd, &buf) != 0) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "GetSize: stat failed {}: {}", fd, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "GetSize: stat failed {}: {}", fd, GetLastErrorMsg());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return buf.st_size;
|
return buf.st_size;
|
||||||
@ -371,12 +371,12 @@ u64 GetSize(FILE* f) {
|
|||||||
// can't use off_t here because it can be 32-bit
|
// can't use off_t here because it can be 32-bit
|
||||||
u64 pos = ftello(f);
|
u64 pos = ftello(f);
|
||||||
if (fseeko(f, 0, SEEK_END) != 0) {
|
if (fseeko(f, 0, SEEK_END) != 0) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", (void*)f, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", (void*)f, GetLastErrorMsg());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
u64 size = ftello(f);
|
u64 size = ftello(f);
|
||||||
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) {
|
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", (void*)f, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", (void*)f, GetLastErrorMsg());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
@ -384,10 +384,10 @@ u64 GetSize(FILE* f) {
|
|||||||
|
|
||||||
// creates an empty file filename, returns true on success
|
// creates an empty file filename, returns true on success
|
||||||
bool CreateEmptyFile(const std::string& filename) {
|
bool CreateEmptyFile(const std::string& filename) {
|
||||||
NGLOG_TRACE(Common_Filesystem, "{}", filename);
|
LOG_TRACE(Common_Filesystem, "{}", filename);
|
||||||
|
|
||||||
if (!FileUtil::IOFile(filename, "wb")) {
|
if (!FileUtil::IOFile(filename, "wb")) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ bool CreateEmptyFile(const std::string& filename) {
|
|||||||
|
|
||||||
bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory,
|
bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory,
|
||||||
DirectoryEntryCallable callback) {
|
DirectoryEntryCallable callback) {
|
||||||
NGLOG_TRACE(Common_Filesystem, "directory {}", directory);
|
LOG_TRACE(Common_Filesystem, "directory {}", directory);
|
||||||
|
|
||||||
// How many files + directories we found
|
// How many files + directories we found
|
||||||
unsigned found_entries = 0;
|
unsigned found_entries = 0;
|
||||||
@ -554,7 +554,7 @@ std::string GetCurrentDir() {
|
|||||||
char* dir;
|
char* dir;
|
||||||
if (!(dir = getcwd(nullptr, 0))) {
|
if (!(dir = getcwd(nullptr, 0))) {
|
||||||
#endif
|
#endif
|
||||||
NGLOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: {}", GetLastErrorMsg());
|
LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: {}", GetLastErrorMsg());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -674,7 +674,7 @@ std::string GetSysDirectory() {
|
|||||||
#endif
|
#endif
|
||||||
sysDir += DIR_SEP;
|
sysDir += DIR_SEP;
|
||||||
|
|
||||||
NGLOG_DEBUG(Common_Filesystem, "Setting to {}:", sysDir);
|
LOG_DEBUG(Common_Filesystem, "Setting to {}:", sysDir);
|
||||||
return sysDir;
|
return sysDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,7 +690,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
|
|||||||
if (!FileUtil::IsDirectory(paths[D_USER_IDX])) {
|
if (!FileUtil::IsDirectory(paths[D_USER_IDX])) {
|
||||||
paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
|
paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
|
||||||
} else {
|
} else {
|
||||||
NGLOG_INFO(Common_Filesystem, "Using the local user directory");
|
LOG_INFO(Common_Filesystem, "Using the local user directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
|
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
|
||||||
@ -719,7 +719,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
|
|||||||
|
|
||||||
if (!newPath.empty()) {
|
if (!newPath.empty()) {
|
||||||
if (!FileUtil::IsDirectory(newPath)) {
|
if (!FileUtil::IsDirectory(newPath)) {
|
||||||
NGLOG_ERROR(Common_Filesystem, "Invalid path specified {}", newPath);
|
LOG_ERROR(Common_Filesystem, "Invalid path specified {}", newPath);
|
||||||
return paths[DirIDX];
|
return paths[DirIDX];
|
||||||
} else {
|
} else {
|
||||||
paths[DirIDX] = newPath;
|
paths[DirIDX] = newPath;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <cstdio>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -275,22 +274,6 @@ Backend* GetBackend(const std::string& backend_name) {
|
|||||||
return Impl::Instance().GetBackend(backend_name);
|
return Impl::Instance().GetBackend(backend_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
|
||||||
const char* function, const char* format, ...) {
|
|
||||||
auto filter = Impl::Instance().GetGlobalFilter();
|
|
||||||
if (!filter.CheckMessage(log_class, log_level))
|
|
||||||
return;
|
|
||||||
std::array<char, 4 * 1024> formatting_buffer;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
vsnprintf(formatting_buffer.data(), formatting_buffer.size(), format, args);
|
|
||||||
va_end(args);
|
|
||||||
Entry entry = CreateEntry(log_class, log_level, filename, line_num, function,
|
|
||||||
std::string(formatting_buffer.data()));
|
|
||||||
|
|
||||||
Impl::Instance().PushEntry(std::move(entry));
|
|
||||||
}
|
|
||||||
|
|
||||||
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
||||||
unsigned int line_num, const char* function, const char* format,
|
unsigned int line_num, const char* function, const char* format,
|
||||||
const fmt::format_args& args) {
|
const fmt::format_args& args) {
|
||||||
|
@ -65,14 +65,14 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin,
|
|||||||
const std::string::const_iterator end) {
|
const std::string::const_iterator end) {
|
||||||
auto level_separator = std::find(begin, end, ':');
|
auto level_separator = std::find(begin, end, ':');
|
||||||
if (level_separator == end) {
|
if (level_separator == end) {
|
||||||
NGLOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: {}",
|
LOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: {}",
|
||||||
std::string(begin, end));
|
std::string(begin, end));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Level level = GetLevelByName(level_separator + 1, end);
|
const Level level = GetLevelByName(level_separator + 1, end);
|
||||||
if (level == Level::Count) {
|
if (level == Level::Count) {
|
||||||
NGLOG_ERROR(Log, "Unknown log level in filter: {}", std::string(begin, end));
|
LOG_ERROR(Log, "Unknown log level in filter: {}", std::string(begin, end));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin,
|
|||||||
|
|
||||||
const Class log_class = GetClassByName(begin, level_separator);
|
const Class log_class = GetClassByName(begin, level_separator);
|
||||||
if (log_class == Class::Count) {
|
if (log_class == Class::Count) {
|
||||||
NGLOG_ERROR(Log, "Unknown log class in filter: {}", std::string(begin, end));
|
LOG_ERROR(Log, "Unknown log class in filter: {}", std::string(begin, end));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,19 +98,6 @@ enum class Class : ClassType {
|
|||||||
Count ///< Total number of logging classes
|
Count ///< Total number of logging classes
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Logs a message to the global logger.
|
|
||||||
void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
|
||||||
const char* function,
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
_Printf_format_string_
|
|
||||||
#endif
|
|
||||||
const char* format,
|
|
||||||
...)
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__attribute__((format(printf, 6, 7)))
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/// Logs a message to the global logger, using fmt
|
/// Logs a message to the global logger, using fmt
|
||||||
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
||||||
unsigned int line_num, const char* function, const char* format,
|
unsigned int line_num, const char* function, const char* format,
|
||||||
@ -125,51 +112,30 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig
|
|||||||
|
|
||||||
} // namespace Log
|
} // namespace Log
|
||||||
|
|
||||||
#define LOG_GENERIC(log_class, log_level, ...) \
|
|
||||||
::Log::LogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define LOG_TRACE(log_class, ...) \
|
|
||||||
LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Trace, __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define LOG_TRACE(log_class, ...) (void(0))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LOG_DEBUG(log_class, ...) \
|
|
||||||
LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Debug, __VA_ARGS__)
|
|
||||||
#define LOG_INFO(log_class, ...) \
|
|
||||||
LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Info, __VA_ARGS__)
|
|
||||||
#define LOG_WARNING(log_class, ...) \
|
|
||||||
LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Warning, __VA_ARGS__)
|
|
||||||
#define LOG_ERROR(log_class, ...) \
|
|
||||||
LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__)
|
|
||||||
#define LOG_CRITICAL(log_class, ...) \
|
|
||||||
LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__)
|
|
||||||
|
|
||||||
// Define the fmt lib macros
|
// Define the fmt lib macros
|
||||||
#define NGLOG_GENERIC(log_class, log_level, ...) \
|
#define LOG_GENERIC(log_class, log_level, ...) \
|
||||||
::Log::FmtLogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
::Log::FmtLogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define NGLOG_TRACE(log_class, ...) \
|
#define LOG_TRACE(log_class, ...) \
|
||||||
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Trace, __FILE__, __LINE__, \
|
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Trace, __FILE__, __LINE__, \
|
||||||
__func__, __VA_ARGS__)
|
__func__, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define NGLOG_TRACE(log_class, fmt, ...) (void(0))
|
#define LOG_TRACE(log_class, fmt, ...) (void(0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NGLOG_DEBUG(log_class, ...) \
|
#define LOG_DEBUG(log_class, ...) \
|
||||||
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Debug, __FILE__, __LINE__, \
|
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Debug, __FILE__, __LINE__, \
|
||||||
__func__, __VA_ARGS__)
|
__func__, __VA_ARGS__)
|
||||||
#define NGLOG_INFO(log_class, ...) \
|
#define LOG_INFO(log_class, ...) \
|
||||||
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Info, __FILE__, __LINE__, \
|
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Info, __FILE__, __LINE__, \
|
||||||
__func__, __VA_ARGS__)
|
__func__, __VA_ARGS__)
|
||||||
#define NGLOG_WARNING(log_class, ...) \
|
#define LOG_WARNING(log_class, ...) \
|
||||||
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Warning, __FILE__, __LINE__, \
|
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Warning, __FILE__, __LINE__, \
|
||||||
__func__, __VA_ARGS__)
|
__func__, __VA_ARGS__)
|
||||||
#define NGLOG_ERROR(log_class, ...) \
|
#define LOG_ERROR(log_class, ...) \
|
||||||
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Error, __FILE__, __LINE__, \
|
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Error, __FILE__, __LINE__, \
|
||||||
__func__, __VA_ARGS__)
|
__func__, __VA_ARGS__)
|
||||||
#define NGLOG_CRITICAL(log_class, ...) \
|
#define LOG_CRITICAL(log_class, ...) \
|
||||||
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Critical, __FILE__, __LINE__, \
|
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Critical, __FILE__, __LINE__, \
|
||||||
__func__, __VA_ARGS__)
|
__func__, __VA_ARGS__)
|
||||||
|
@ -55,7 +55,7 @@ void* AllocateExecutableMemory(size_t size, bool low) {
|
|||||||
if (ptr == MAP_FAILED) {
|
if (ptr == MAP_FAILED) {
|
||||||
ptr = nullptr;
|
ptr = nullptr;
|
||||||
#endif
|
#endif
|
||||||
NGLOG_ERROR(Common_Memory, "Failed to allocate executable memory");
|
LOG_ERROR(Common_Memory, "Failed to allocate executable memory");
|
||||||
}
|
}
|
||||||
#if !defined(_WIN32) && defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT)
|
#if !defined(_WIN32) && defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT)
|
||||||
else {
|
else {
|
||||||
@ -68,7 +68,7 @@ void* AllocateExecutableMemory(size_t size, bool low) {
|
|||||||
|
|
||||||
#if EMU_ARCH_BITS == 64
|
#if EMU_ARCH_BITS == 64
|
||||||
if ((u64)ptr >= 0x80000000 && low == true)
|
if ((u64)ptr >= 0x80000000 && low == true)
|
||||||
NGLOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!");
|
LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
@ -85,7 +85,7 @@ void* AllocateMemoryPages(size_t size) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ptr == nullptr)
|
if (ptr == nullptr)
|
||||||
NGLOG_ERROR(Common_Memory, "Failed to allocate raw memory");
|
LOG_ERROR(Common_Memory, "Failed to allocate raw memory");
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
@ -99,12 +99,12 @@ void* AllocateAlignedMemory(size_t size, size_t alignment) {
|
|||||||
ptr = memalign(alignment, size);
|
ptr = memalign(alignment, size);
|
||||||
#else
|
#else
|
||||||
if (posix_memalign(&ptr, alignment, size) != 0)
|
if (posix_memalign(&ptr, alignment, size) != 0)
|
||||||
NGLOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
|
LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ptr == nullptr)
|
if (ptr == nullptr)
|
||||||
NGLOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
|
LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ void FreeMemoryPages(void* ptr, size_t size) {
|
|||||||
if (ptr) {
|
if (ptr) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||||
NGLOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n{}", GetLastErrorMsg());
|
LOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n{}", GetLastErrorMsg());
|
||||||
#else
|
#else
|
||||||
munmap(ptr, size);
|
munmap(ptr, size);
|
||||||
#endif
|
#endif
|
||||||
@ -134,7 +134,7 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute) {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD oldValue;
|
DWORD oldValue;
|
||||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
||||||
NGLOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n{}", GetLastErrorMsg());
|
LOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n{}", GetLastErrorMsg());
|
||||||
#else
|
#else
|
||||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
|
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
|
||||||
#endif
|
#endif
|
||||||
@ -145,7 +145,7 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute) {
|
|||||||
DWORD oldValue;
|
DWORD oldValue;
|
||||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE,
|
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE,
|
||||||
&oldValue))
|
&oldValue))
|
||||||
NGLOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n{}", GetLastErrorMsg());
|
LOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n{}", GetLastErrorMsg());
|
||||||
#else
|
#else
|
||||||
mprotect(ptr, size,
|
mprotect(ptr, size,
|
||||||
allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
|
allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
|
||||||
|
@ -25,7 +25,7 @@ ParamPackage::ParamPackage(const std::string& serialized) {
|
|||||||
std::vector<std::string> key_value;
|
std::vector<std::string> key_value;
|
||||||
Common::SplitString(pair, KEY_VALUE_SEPARATOR, key_value);
|
Common::SplitString(pair, KEY_VALUE_SEPARATOR, key_value);
|
||||||
if (key_value.size() != 2) {
|
if (key_value.size() != 2) {
|
||||||
NGLOG_ERROR(Common, "invalid key pair {}", pair);
|
LOG_ERROR(Common, "invalid key pair {}", pair);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ std::string ParamPackage::Serialize() const {
|
|||||||
std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const {
|
std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const {
|
||||||
auto pair = data.find(key);
|
auto pair = data.find(key);
|
||||||
if (pair == data.end()) {
|
if (pair == data.end()) {
|
||||||
NGLOG_DEBUG(Common, "key {} not found", key);
|
LOG_DEBUG(Common, "key {} not found", key);
|
||||||
return default_value;
|
return default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,14 +74,14 @@ std::string ParamPackage::Get(const std::string& key, const std::string& default
|
|||||||
int ParamPackage::Get(const std::string& key, int default_value) const {
|
int ParamPackage::Get(const std::string& key, int default_value) const {
|
||||||
auto pair = data.find(key);
|
auto pair = data.find(key);
|
||||||
if (pair == data.end()) {
|
if (pair == data.end()) {
|
||||||
NGLOG_DEBUG(Common, "key {} not found", key);
|
LOG_DEBUG(Common, "key {} not found", key);
|
||||||
return default_value;
|
return default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return std::stoi(pair->second);
|
return std::stoi(pair->second);
|
||||||
} catch (const std::logic_error&) {
|
} catch (const std::logic_error&) {
|
||||||
NGLOG_ERROR(Common, "failed to convert {} to int", pair->second);
|
LOG_ERROR(Common, "failed to convert {} to int", pair->second);
|
||||||
return default_value;
|
return default_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,14 +89,14 @@ int ParamPackage::Get(const std::string& key, int default_value) const {
|
|||||||
float ParamPackage::Get(const std::string& key, float default_value) const {
|
float ParamPackage::Get(const std::string& key, float default_value) const {
|
||||||
auto pair = data.find(key);
|
auto pair = data.find(key);
|
||||||
if (pair == data.end()) {
|
if (pair == data.end()) {
|
||||||
NGLOG_DEBUG(Common, "key {} not found", key);
|
LOG_DEBUG(Common, "key {} not found", key);
|
||||||
return default_value;
|
return default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return std::stof(pair->second);
|
return std::stof(pair->second);
|
||||||
} catch (const std::logic_error&) {
|
} catch (const std::logic_error&) {
|
||||||
NGLOG_ERROR(Common, "failed to convert {} to float", pair->second);
|
LOG_ERROR(Common, "failed to convert {} to float", pair->second);
|
||||||
return default_value;
|
return default_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ std::string StringFromFormat(const char* format, ...) {
|
|||||||
#else
|
#else
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
if (vasprintf(&buf, format, args) < 0)
|
if (vasprintf(&buf, format, args) < 0)
|
||||||
NGLOG_ERROR(Common, "Unable to allocate memory for string");
|
LOG_ERROR(Common, "Unable to allocate memory for string");
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
std::string temp = buf;
|
std::string temp = buf;
|
||||||
@ -347,7 +347,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
|
|||||||
|
|
||||||
iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
|
iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
|
||||||
if ((iconv_t)(-1) == conv_desc) {
|
if ((iconv_t)(-1) == conv_desc) {
|
||||||
NGLOG_ERROR(Common, "Iconv initialization failure [{}]: {}", fromcode, strerror(errno));
|
LOG_ERROR(Common, "Iconv initialization failure [{}]: {}", fromcode, strerror(errno));
|
||||||
iconv_close(conv_desc);
|
iconv_close(conv_desc);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
|
|||||||
++src_buffer;
|
++src_buffer;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Common, "iconv failure [{}]: {}", fromcode, strerror(errno));
|
LOG_ERROR(Common, "iconv failure [{}]: {}", fromcode, strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,7 +395,7 @@ std::u16string UTF8ToUTF16(const std::string& input) {
|
|||||||
|
|
||||||
iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8");
|
iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8");
|
||||||
if ((iconv_t)(-1) == conv_desc) {
|
if ((iconv_t)(-1) == conv_desc) {
|
||||||
NGLOG_ERROR(Common, "Iconv initialization failure [UTF-8]: {}", strerror(errno));
|
LOG_ERROR(Common, "Iconv initialization failure [UTF-8]: {}", strerror(errno));
|
||||||
iconv_close(conv_desc);
|
iconv_close(conv_desc);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -424,7 +424,7 @@ std::u16string UTF8ToUTF16(const std::string& input) {
|
|||||||
++src_buffer;
|
++src_buffer;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Common, "iconv failure [UTF-8]: {}", strerror(errno));
|
LOG_ERROR(Common, "iconv failure [UTF-8]: {}", strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ static unsigned int DPO(RotateRightByRegister)(ARMul_State* cpu, unsigned int sh
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define DEBUG_MSG \
|
#define DEBUG_MSG \
|
||||||
NGLOG_DEBUG(Core_ARM11, "inst is {:x}", inst); \
|
LOG_DEBUG(Core_ARM11, "inst is {:x}", inst); \
|
||||||
CITRA_IGNORE_EXIT(0)
|
CITRA_IGNORE_EXIT(0)
|
||||||
|
|
||||||
#define LnSWoUB(s) glue(LnSWoUB, s)
|
#define LnSWoUB(s) glue(LnSWoUB, s)
|
||||||
@ -770,7 +770,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins
|
|||||||
inst_index = table_length - 4;
|
inst_index = table_length - 4;
|
||||||
*ptr_inst_base = arm_instruction_trans[inst_index](tinstr, inst_index);
|
*ptr_inst_base = arm_instruction_trans[inst_index](tinstr, inst_index);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Core_ARM11, "thumb decoder error");
|
LOG_ERROR(Core_ARM11, "thumb decoder error");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28:
|
case 28:
|
||||||
@ -828,10 +828,10 @@ static unsigned int InterpreterTranslateInstruction(const ARMul_State* cpu, cons
|
|||||||
|
|
||||||
int idx;
|
int idx;
|
||||||
if (DecodeARMInstruction(inst, &idx) == ARMDecodeStatus::FAILURE) {
|
if (DecodeARMInstruction(inst, &idx) == ARMDecodeStatus::FAILURE) {
|
||||||
NGLOG_ERROR(Core_ARM11, "Decode failure.\tPC: [{:#010X}]\tInstruction: {:08X}", phys_addr,
|
LOG_ERROR(Core_ARM11, "Decode failure.\tPC: [{:#010X}]\tInstruction: {:08X}", phys_addr,
|
||||||
inst);
|
inst);
|
||||||
NGLOG_ERROR(Core_ARM11, "cpsr={:#X}, cpu->TFlag={}, r15={:#010X}", cpu->Cpsr, cpu->TFlag,
|
LOG_ERROR(Core_ARM11, "cpsr={:#X}, cpu->TFlag={}, r15={:#010X}", cpu->Cpsr, cpu->TFlag,
|
||||||
cpu->Reg[15]);
|
cpu->Reg[15]);
|
||||||
CITRA_IGNORE_EXIT(-1);
|
CITRA_IGNORE_EXIT(-1);
|
||||||
}
|
}
|
||||||
inst_base = arm_instruction_trans[idx](inst, idx);
|
inst_base = arm_instruction_trans[idx](inst, idx);
|
||||||
@ -1802,7 +1802,7 @@ BIC_INST : {
|
|||||||
BKPT_INST : {
|
BKPT_INST : {
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
bkpt_inst* const inst_cream = (bkpt_inst*)inst_base->component;
|
bkpt_inst* const inst_cream = (bkpt_inst*)inst_base->component;
|
||||||
NGLOG_DEBUG(Core_ARM11, "Breakpoint instruction hit. Immediate: {:#010X}", inst_cream->imm);
|
LOG_DEBUG(Core_ARM11, "Breakpoint instruction hit. Immediate: {:#010X}", inst_cream->imm);
|
||||||
}
|
}
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
INC_PC(sizeof(bkpt_inst));
|
INC_PC(sizeof(bkpt_inst));
|
||||||
@ -2017,7 +2017,7 @@ EOR_INST : {
|
|||||||
}
|
}
|
||||||
LDC_INST : {
|
LDC_INST : {
|
||||||
// Instruction not implemented
|
// Instruction not implemented
|
||||||
// NGLOG_CRITICAL(Core_ARM11, "unimplemented instruction");
|
// LOG_CRITICAL(Core_ARM11, "unimplemented instruction");
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
INC_PC(sizeof(ldc_inst));
|
INC_PC(sizeof(ldc_inst));
|
||||||
FETCH_INST;
|
FETCH_INST;
|
||||||
@ -2368,10 +2368,9 @@ MCRR_INST : {
|
|||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
||||||
|
|
||||||
NGLOG_ERROR(Core_ARM11,
|
LOG_ERROR(Core_ARM11, "MCRR executed | Coprocessor: {}, CRm {}, opc1: {}, Rt: {}, Rt2: {}",
|
||||||
"MCRR executed | Coprocessor: {}, CRm {}, opc1: {}, Rt: {}, Rt2: {}",
|
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt,
|
||||||
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt,
|
inst_cream->rt2);
|
||||||
inst_cream->rt2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
@ -2452,10 +2451,9 @@ MRRC_INST : {
|
|||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
||||||
|
|
||||||
NGLOG_ERROR(Core_ARM11,
|
LOG_ERROR(Core_ARM11, "MRRC executed | Coprocessor: {}, CRm {}, opc1: {}, Rt: {}, Rt2: {}",
|
||||||
"MRRC executed | Coprocessor: {}, CRm {}, opc1: {}, Rt: {}, Rt2: {}",
|
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt,
|
||||||
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt,
|
inst_cream->rt2);
|
||||||
inst_cream->rt2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
@ -3080,7 +3078,7 @@ SETEND_INST : {
|
|||||||
else
|
else
|
||||||
cpu->Cpsr &= ~(1 << 9);
|
cpu->Cpsr &= ~(1 << 9);
|
||||||
|
|
||||||
NGLOG_WARNING(Core_ARM11, "SETEND {} executed", big_endian ? "BE" : "LE");
|
LOG_WARNING(Core_ARM11, "SETEND {} executed", big_endian ? "BE" : "LE");
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
INC_PC(sizeof(setend_inst));
|
INC_PC(sizeof(setend_inst));
|
||||||
@ -3091,7 +3089,7 @@ SETEND_INST : {
|
|||||||
SEV_INST : {
|
SEV_INST : {
|
||||||
// Stubbed, as SEV is a hint instruction.
|
// Stubbed, as SEV is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
NGLOG_TRACE(Core_ARM11, "SEV executed.");
|
LOG_TRACE(Core_ARM11, "SEV executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
@ -3541,7 +3539,7 @@ SSAT16_INST : {
|
|||||||
|
|
||||||
STC_INST : {
|
STC_INST : {
|
||||||
// Instruction not implemented
|
// Instruction not implemented
|
||||||
// NGLOG_CRITICAL(Core_ARM11, "unimplemented instruction");
|
// LOG_CRITICAL(Core_ARM11, "unimplemented instruction");
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
INC_PC(sizeof(stc_inst));
|
INC_PC(sizeof(stc_inst));
|
||||||
FETCH_INST;
|
FETCH_INST;
|
||||||
@ -4537,7 +4535,7 @@ UXTB16_INST : {
|
|||||||
WFE_INST : {
|
WFE_INST : {
|
||||||
// Stubbed, as WFE is a hint instruction.
|
// Stubbed, as WFE is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
NGLOG_TRACE(Core_ARM11, "WFE executed.");
|
LOG_TRACE(Core_ARM11, "WFE executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
@ -4549,7 +4547,7 @@ WFE_INST : {
|
|||||||
WFI_INST : {
|
WFI_INST : {
|
||||||
// Stubbed, as WFI is a hint instruction.
|
// Stubbed, as WFI is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
NGLOG_TRACE(Core_ARM11, "WFI executed.");
|
LOG_TRACE(Core_ARM11, "WFI executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
@ -4561,7 +4559,7 @@ WFI_INST : {
|
|||||||
YIELD_INST : {
|
YIELD_INST : {
|
||||||
// Stubbed, as YIELD is a hint instruction.
|
// Stubbed, as YIELD is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
NGLOG_TRACE(Core_ARM11, "YIELD executed.");
|
LOG_TRACE(Core_ARM11, "YIELD executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
|
@ -184,7 +184,7 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index) {
|
|||||||
inst_cream->opcode_1 = BITS(inst, 20, 23);
|
inst_cream->opcode_1 = BITS(inst, 20, 23);
|
||||||
inst_cream->inst = inst;
|
inst_cream->inst = inst;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "inst {:x} index {:x}", inst, index);
|
LOG_TRACE(Core_ARM11, "inst {:x} index {:x}", inst, index);
|
||||||
return inst_base;
|
return inst_base;
|
||||||
}
|
}
|
||||||
static ARM_INST_PTR INTERPRETER_TRANSLATE(clrex)(unsigned int inst, int index) {
|
static ARM_INST_PTR INTERPRETER_TRANSLATE(clrex)(unsigned int inst, int index) {
|
||||||
|
@ -183,7 +183,7 @@ void ARMul_State::ResetMPCoreCP15Registers() {
|
|||||||
|
|
||||||
static void CheckMemoryBreakpoint(u32 address, GDBStub::BreakpointType type) {
|
static void CheckMemoryBreakpoint(u32 address, GDBStub::BreakpointType type) {
|
||||||
if (GDBStub::IsServerEnabled() && GDBStub::CheckBreakpoint(address, type)) {
|
if (GDBStub::IsServerEnabled() && GDBStub::CheckBreakpoint(address, type)) {
|
||||||
NGLOG_DEBUG(Debug, "Found memory breakpoint @ {:08x}", address);
|
LOG_DEBUG(Debug, "Found memory breakpoint @ {:08x}", address);
|
||||||
GDBStub::Break(true);
|
GDBStub::Break(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,8 +428,8 @@ u32 ARMul_State::ReadCP15Register(u32 crn, u32 opcode_1, u32 crm, u32 opcode_2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Core_ARM11, "MRC CRn={}, CRm={}, OP1={} OP2={} is not implemented. Returning zero.",
|
LOG_ERROR(Core_ARM11, "MRC CRn={}, CRm={}, OP1={} OP2={} is not implemented. Returning zero.",
|
||||||
crn, crm, opcode_1, opcode_2);
|
crn, crm, opcode_1, opcode_2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,24 +90,24 @@ void VMOVR(ARMul_State* state, u32 single, u32 d, u32 m) {
|
|||||||
|
|
||||||
/* Miscellaneous functions */
|
/* Miscellaneous functions */
|
||||||
s32 vfp_get_float(ARMul_State* state, unsigned int reg) {
|
s32 vfp_get_float(ARMul_State* state, unsigned int reg) {
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP get float: s{}=[{:08x}]", reg, state->ExtReg[reg]);
|
LOG_TRACE(Core_ARM11, "VFP get float: s{}=[{:08x}]", reg, state->ExtReg[reg]);
|
||||||
return state->ExtReg[reg];
|
return state->ExtReg[reg];
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfp_put_float(ARMul_State* state, s32 val, unsigned int reg) {
|
void vfp_put_float(ARMul_State* state, s32 val, unsigned int reg) {
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP put float: s{} <= [{:08x}]", reg, val);
|
LOG_TRACE(Core_ARM11, "VFP put float: s{} <= [{:08x}]", reg, val);
|
||||||
state->ExtReg[reg] = val;
|
state->ExtReg[reg] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 vfp_get_double(ARMul_State* state, unsigned int reg) {
|
u64 vfp_get_double(ARMul_State* state, unsigned int reg) {
|
||||||
u64 result = ((u64)state->ExtReg[reg * 2 + 1]) << 32 | state->ExtReg[reg * 2];
|
u64 result = ((u64)state->ExtReg[reg * 2 + 1]) << 32 | state->ExtReg[reg * 2];
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP get double: s[{}-{}]=[{:016llx}]", reg * 2 + 1, reg * 2, result);
|
LOG_TRACE(Core_ARM11, "VFP get double: s[{}-{}]=[{:016llx}]", reg * 2 + 1, reg * 2, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfp_put_double(ARMul_State* state, u64 val, unsigned int reg) {
|
void vfp_put_double(ARMul_State* state, u64 val, unsigned int reg) {
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP put double: s[{}-{}] <= [{:08x}-{:08x}]", reg * 2 + 1, reg * 2,
|
LOG_TRACE(Core_ARM11, "VFP put double: s[{}-{}] <= [{:08x}-{:08x}]", reg * 2 + 1, reg * 2,
|
||||||
(u32)(val >> 32), (u32)(val & 0xffffffff));
|
(u32)(val >> 32), (u32)(val & 0xffffffff));
|
||||||
state->ExtReg[reg * 2] = (u32)(val & 0xffffffff);
|
state->ExtReg[reg * 2] = (u32)(val & 0xffffffff);
|
||||||
state->ExtReg[reg * 2 + 1] = (u32)(val >> 32);
|
state->ExtReg[reg * 2 + 1] = (u32)(val >> 32);
|
||||||
}
|
}
|
||||||
@ -116,10 +116,10 @@ void vfp_put_double(ARMul_State* state, u64 val, unsigned int reg) {
|
|||||||
* Process bitmask of exception conditions. (from vfpmodule.c)
|
* Process bitmask of exception conditions. (from vfpmodule.c)
|
||||||
*/
|
*/
|
||||||
void vfp_raise_exceptions(ARMul_State* state, u32 exceptions, u32 inst, u32 fpscr) {
|
void vfp_raise_exceptions(ARMul_State* state, u32 exceptions, u32 inst, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: raising exceptions {:08x}", exceptions);
|
LOG_TRACE(Core_ARM11, "VFP: raising exceptions {:08x}", exceptions);
|
||||||
|
|
||||||
if (exceptions == VFP_EXCEPTION_ERROR) {
|
if (exceptions == VFP_EXCEPTION_ERROR) {
|
||||||
NGLOG_CRITICAL(Core_ARM11, "unhandled bounce {:x}", inst);
|
LOG_CRITICAL(Core_ARM11, "unhandled bounce {:x}", inst);
|
||||||
Crash();
|
Crash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "core/arm/skyeye_common/vfp/vfp_helper.h" /* for references to cdp SoftFloat functions */
|
#include "core/arm/skyeye_common/vfp/vfp_helper.h" /* for references to cdp SoftFloat functions */
|
||||||
|
|
||||||
#define VFP_DEBUG_UNTESTED(x) NGLOG_TRACE(Core_ARM11, "in func {}, " #x " untested", __FUNCTION__);
|
#define VFP_DEBUG_UNTESTED(x) LOG_TRACE(Core_ARM11, "in func {}, " #x " untested", __FUNCTION__);
|
||||||
#define CHECK_VFP_ENABLED
|
#define CHECK_VFP_ENABLED
|
||||||
#define CHECK_VFP_CDP_RET vfp_raise_exceptions(cpu, ret, inst_cream->instr, cpu->VFP[VFP_FPSCR]);
|
#define CHECK_VFP_CDP_RET vfp_raise_exceptions(cpu, ret, inst_cream->instr, cpu->VFP[VFP_FPSCR]);
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ static struct vfp_double vfp_double_default_qnan = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void vfp_double_dump(const char* str, struct vfp_double* d) {
|
static void vfp_double_dump(const char* str, struct vfp_double* d) {
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: {}: sign={} exponent={} significand={:016llx}", str, d->sign != 0,
|
LOG_TRACE(Core_ARM11, "VFP: {}: sign={} exponent={} significand={:016llx}", str, d->sign != 0,
|
||||||
d->exponent, d->significand);
|
d->exponent, d->significand);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfp_double_normalise_denormal(struct vfp_double* vd) {
|
static void vfp_double_normalise_denormal(struct vfp_double* vd) {
|
||||||
@ -166,7 +166,7 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double* vd,
|
|||||||
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vd->sign != 0))
|
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vd->sign != 0))
|
||||||
incr = (1ULL << (VFP_DOUBLE_LOW_BITS + 1)) - 1;
|
incr = (1ULL << (VFP_DOUBLE_LOW_BITS + 1)) - 1;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x{:08llx}", incr);
|
LOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x{:08llx}", incr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is our rounding going to overflow?
|
* Is our rounding going to overflow?
|
||||||
@ -221,8 +221,8 @@ pack:
|
|||||||
vfp_double_dump("pack: final", vd);
|
vfp_double_dump("pack: final", vd);
|
||||||
{
|
{
|
||||||
s64 d = vfp_double_pack(vd);
|
s64 d = vfp_double_pack(vd);
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: {}: d(d{})={:016llx} exceptions={:08x}", func, dd, d,
|
LOG_TRACE(Core_ARM11, "VFP: {}: d(d{})={:016llx} exceptions={:08x}", func, dd, d,
|
||||||
exceptions);
|
exceptions);
|
||||||
vfp_put_double(state, d, dd);
|
vfp_put_double(state, d, dd);
|
||||||
}
|
}
|
||||||
return exceptions;
|
return exceptions;
|
||||||
@ -275,25 +275,25 @@ static u32 vfp_propagate_nan(struct vfp_double* vdd, struct vfp_double* vdn, str
|
|||||||
* Extended operations
|
* Extended operations
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fabs(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fabs(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
vfp_put_double(state, vfp_double_packed_abs(vfp_get_double(state, dm)), dd);
|
vfp_put_double(state, vfp_double_packed_abs(vfp_get_double(state, dm)), dd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcpy(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fcpy(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
vfp_put_double(state, vfp_get_double(state, dm), dd);
|
vfp_put_double(state, vfp_get_double(state, dm), dd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fneg(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fneg(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
vfp_put_double(state, vfp_double_packed_negate(vfp_get_double(state, dm)), dd);
|
vfp_put_double(state, vfp_double_packed_negate(vfp_get_double(state, dm)), dd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fsqrt(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fsqrt(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
vfp_double vdm, vdd, *vdp;
|
vfp_double vdm, vdd, *vdp;
|
||||||
int ret, tm;
|
int ret, tm;
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
@ -390,8 +390,7 @@ static u32 vfp_compare(ARMul_State* state, int dd, int signal_on_qnan, s64 m, u3
|
|||||||
s64 d;
|
s64 d;
|
||||||
u32 ret = 0;
|
u32 ret = 0;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}, state=0x{}, fpscr=0x{:x}", __FUNCTION__, fmt::ptr(state),
|
LOG_TRACE(Core_ARM11, "In {}, state=0x{}, fpscr=0x{:x}", __FUNCTION__, fmt::ptr(state), fpscr);
|
||||||
fpscr);
|
|
||||||
if (vfp_double_packed_exponent(m) == 2047 && vfp_double_packed_mantissa(m)) {
|
if (vfp_double_packed_exponent(m) == 2047 && vfp_double_packed_mantissa(m)) {
|
||||||
ret |= FPSCR_CFLAG | FPSCR_VFLAG;
|
ret |= FPSCR_CFLAG | FPSCR_VFLAG;
|
||||||
if (signal_on_qnan ||
|
if (signal_on_qnan ||
|
||||||
@ -447,28 +446,28 @@ static u32 vfp_compare(ARMul_State* state, int dd, int signal_on_qnan, s64 m, u3
|
|||||||
ret |= FPSCR_CFLAG;
|
ret |= FPSCR_CFLAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}, state=0x{}, ret=0x{:x}", __FUNCTION__, fmt::ptr(state), ret);
|
LOG_TRACE(Core_ARM11, "In {}, state=0x{}, ret=0x{:x}", __FUNCTION__, fmt::ptr(state), ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmp(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fcmp(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 0, vfp_get_double(state, dm), fpscr);
|
return vfp_compare(state, dd, 0, vfp_get_double(state, dm), fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmpe(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fcmpe(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 1, vfp_get_double(state, dm), fpscr);
|
return vfp_compare(state, dd, 1, vfp_get_double(state, dm), fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmpz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fcmpz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 0, 0, fpscr);
|
return vfp_compare(state, dd, 0, 0, fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmpez(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_fcmpez(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 1, 0, fpscr);
|
return vfp_compare(state, dd, 1, 0, fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +477,7 @@ static u32 vfp_double_fcvts(ARMul_State* state, int sd, int unused, int dm, u32
|
|||||||
int tm;
|
int tm;
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
||||||
|
|
||||||
tm = vfp_double_type(&vdm);
|
tm = vfp_double_type(&vdm);
|
||||||
@ -519,7 +518,7 @@ static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32
|
|||||||
struct vfp_double vdm;
|
struct vfp_double vdm;
|
||||||
u32 m = vfp_get_float(state, dm);
|
u32 m = vfp_get_float(state, dm);
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
vdm.sign = 0;
|
vdm.sign = 0;
|
||||||
vdm.exponent = 1023 + 63 - 1;
|
vdm.exponent = 1023 + 63 - 1;
|
||||||
vdm.significand = (u64)m;
|
vdm.significand = (u64)m;
|
||||||
@ -531,7 +530,7 @@ static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32
|
|||||||
struct vfp_double vdm;
|
struct vfp_double vdm;
|
||||||
u32 m = vfp_get_float(state, dm);
|
u32 m = vfp_get_float(state, dm);
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
vdm.sign = (m & 0x80000000) >> 16;
|
vdm.sign = (m & 0x80000000) >> 16;
|
||||||
vdm.exponent = 1023 + 63 - 1;
|
vdm.exponent = 1023 + 63 - 1;
|
||||||
vdm.significand = vdm.sign ? (~m + 1) : m;
|
vdm.significand = vdm.sign ? (~m + 1) : m;
|
||||||
@ -545,7 +544,7 @@ static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32
|
|||||||
int rmode = fpscr & FPSCR_RMODE_MASK;
|
int rmode = fpscr & FPSCR_RMODE_MASK;
|
||||||
int tm;
|
int tm;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -614,7 +613,7 @@ static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: ftoui: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
LOG_TRACE(Core_ARM11, "VFP: ftoui: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
|
|
||||||
@ -622,7 +621,7 @@ static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32
|
|||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_ftouiz(ARMul_State* state, int sd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_ftouiz(ARMul_State* state, int sd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_double_ftoui(state, sd, unused, dm,
|
return vfp_double_ftoui(state, sd, unused, dm,
|
||||||
(fpscr & ~FPSCR_RMODE_MASK) | FPSCR_ROUND_TOZERO);
|
(fpscr & ~FPSCR_RMODE_MASK) | FPSCR_ROUND_TOZERO);
|
||||||
}
|
}
|
||||||
@ -633,7 +632,7 @@ static u32 vfp_double_ftosi(ARMul_State* state, int sd, int unused, int dm, u32
|
|||||||
int rmode = fpscr & FPSCR_RMODE_MASK;
|
int rmode = fpscr & FPSCR_RMODE_MASK;
|
||||||
int tm;
|
int tm;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
||||||
vfp_double_dump("VDM", &vdm);
|
vfp_double_dump("VDM", &vdm);
|
||||||
|
|
||||||
@ -697,7 +696,7 @@ static u32 vfp_double_ftosi(ARMul_State* state, int sd, int unused, int dm, u32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: ftosi: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
LOG_TRACE(Core_ARM11, "VFP: ftosi: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, (s32)d, sd);
|
vfp_put_float(state, (s32)d, sd);
|
||||||
|
|
||||||
@ -705,7 +704,7 @@ static u32 vfp_double_ftosi(ARMul_State* state, int sd, int unused, int dm, u32
|
|||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_ftosiz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
static u32 vfp_double_ftosiz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_double_ftosi(state, dd, unused, dm,
|
return vfp_double_ftosi(state, dd, unused, dm,
|
||||||
(fpscr & ~FPSCR_RMODE_MASK) | FPSCR_ROUND_TOZERO);
|
(fpscr & ~FPSCR_RMODE_MASK) | FPSCR_ROUND_TOZERO);
|
||||||
}
|
}
|
||||||
@ -787,7 +786,7 @@ u32 vfp_double_add(struct vfp_double* vdd, struct vfp_double* vdn, struct vfp_do
|
|||||||
u64 m_sig;
|
u64 m_sig;
|
||||||
|
|
||||||
if (vdn->significand & (1ULL << 63) || vdm->significand & (1ULL << 63)) {
|
if (vdn->significand & (1ULL << 63) || vdm->significand & (1ULL << 63)) {
|
||||||
NGLOG_INFO(Core_ARM11, "VFP: bad FP values in {}", __func__);
|
LOG_INFO(Core_ARM11, "VFP: bad FP values in {}", __func__);
|
||||||
vfp_double_dump("VDN", vdn);
|
vfp_double_dump("VDN", vdn);
|
||||||
vfp_double_dump("VDM", vdm);
|
vfp_double_dump("VDM", vdm);
|
||||||
}
|
}
|
||||||
@ -852,7 +851,7 @@ u32 vfp_double_multiply(struct vfp_double* vdd, struct vfp_double* vdn, struct v
|
|||||||
*/
|
*/
|
||||||
if (vdn->exponent < vdm->exponent) {
|
if (vdn->exponent < vdm->exponent) {
|
||||||
std::swap(vdm, vdn);
|
std::swap(vdm, vdn);
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: swapping M <-> N");
|
LOG_TRACE(Core_ARM11, "VFP: swapping M <-> N");
|
||||||
}
|
}
|
||||||
|
|
||||||
vdd->sign = vdn->sign ^ vdm->sign;
|
vdd->sign = vdn->sign ^ vdm->sign;
|
||||||
@ -934,7 +933,7 @@ static u32 vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, in
|
|||||||
* sd = sd + (sn * sm)
|
* sd = sd + (sn * sm)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, 0, "fmac");
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, 0, "fmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,7 +941,7 @@ static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
|||||||
* sd = sd - (sn * sm)
|
* sd = sd - (sn * sm)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_MULTIPLY, "fnmac");
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_MULTIPLY, "fnmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,7 +949,7 @@ static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
|
|||||||
* sd = -sd + (sn * sm)
|
* sd = -sd + (sn * sm)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT, "fmsc");
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT, "fmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -958,7 +957,7 @@ static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
|||||||
* sd = -sd - (sn * sm)
|
* sd = -sd - (sn * sm)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fnmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
static u32 vfp_double_fnmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT | NEG_MULTIPLY,
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT | NEG_MULTIPLY,
|
||||||
"fnmsc");
|
"fnmsc");
|
||||||
}
|
}
|
||||||
@ -970,7 +969,7 @@ static u32 vfp_double_fmul(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
|||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
@ -990,7 +989,7 @@ static u32 vfp_double_fnmul(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
|
|||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
@ -1012,7 +1011,7 @@ static u32 vfp_double_fadd(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
|||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
@ -1033,7 +1032,7 @@ static u32 vfp_double_fsub(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
|||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
@ -1060,7 +1059,7 @@ static u32 vfp_double_fdiv(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
|||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
int tm, tn;
|
int tm, tn;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
|
||||||
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
|
||||||
|
|
||||||
@ -1178,7 +1177,7 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
|
|||||||
unsigned int vecitr, veclen, vecstride;
|
unsigned int vecitr, veclen, vecstride;
|
||||||
struct op* fop;
|
struct op* fop;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
LOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
|
||||||
vecstride = (1 + ((fpscr & FPSCR_STRIDE_MASK) == FPSCR_STRIDE_MASK));
|
vecstride = (1 + ((fpscr & FPSCR_STRIDE_MASK) == FPSCR_STRIDE_MASK));
|
||||||
|
|
||||||
fop = (op == FOP_EXT) ? &fops_ext[FEXT_TO_IDX(inst)] : &fops[FOP_TO_IDX(op)];
|
fop = (op == FOP_EXT) ? &fops_ext[FEXT_TO_IDX(inst)] : &fops[FOP_TO_IDX(op)];
|
||||||
@ -1209,11 +1208,11 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
|
|||||||
else
|
else
|
||||||
veclen = fpscr & FPSCR_LENGTH_MASK;
|
veclen = fpscr & FPSCR_LENGTH_MASK;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: vecstride={} veclen={}", vecstride,
|
LOG_TRACE(Core_ARM11, "VFP: vecstride={} veclen={}", vecstride,
|
||||||
(veclen >> FPSCR_LENGTH_BIT) + 1);
|
(veclen >> FPSCR_LENGTH_BIT) + 1);
|
||||||
|
|
||||||
if (!fop->fn) {
|
if (!fop->fn) {
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: could not find double op {}", FEXT_TO_IDX(inst));
|
LOG_TRACE(Core_ARM11, "VFP: could not find double op {}", FEXT_TO_IDX(inst));
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,15 +1222,14 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
|
|||||||
|
|
||||||
type = (fop->flags & OP_SD) ? 's' : 'd';
|
type = (fop->flags & OP_SD) ? 's' : 'd';
|
||||||
if (op == FOP_EXT)
|
if (op == FOP_EXT)
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: itr{} ({}{}) = op[{}] (d{})", vecitr >> FPSCR_LENGTH_BIT,
|
LOG_TRACE(Core_ARM11, "VFP: itr{} ({}{}) = op[{}] (d{})", vecitr >> FPSCR_LENGTH_BIT,
|
||||||
type, dest, dn, dm);
|
type, dest, dn, dm);
|
||||||
else
|
else
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: itr{} ({}{}) = (d{}) op[{}] (d{})",
|
LOG_TRACE(Core_ARM11, "VFP: itr{} ({}{}) = (d{}) op[{}] (d{})",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, type, dest, dn, FOP_TO_IDX(op), dm);
|
vecitr >> FPSCR_LENGTH_BIT, type, dest, dn, FOP_TO_IDX(op), dm);
|
||||||
|
|
||||||
except = fop->fn(state, dest, dn, dm, fpscr);
|
except = fop->fn(state, dest, dn, dm, fpscr);
|
||||||
NGLOG_TRACE(Core_ARM11, "VFP: itr{}: exceptions={:08x}", vecitr >> FPSCR_LENGTH_BIT,
|
LOG_TRACE(Core_ARM11, "VFP: itr{}: exceptions={:08x}", vecitr >> FPSCR_LENGTH_BIT, except);
|
||||||
except);
|
|
||||||
|
|
||||||
exceptions |= except & ~VFP_NAN_FLAG;
|
exceptions |= except & ~VFP_NAN_FLAG;
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ static struct vfp_single vfp_single_default_qnan = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void vfp_single_dump(const char* str, struct vfp_single* s) {
|
static void vfp_single_dump(const char* str, struct vfp_single* s) {
|
||||||
NGLOG_TRACE(Core_ARM11, "{}: sign={} exponent={} significand={:08x}", str, s->sign != 0,
|
LOG_TRACE(Core_ARM11, "{}: sign={} exponent={} significand={:08x}", str, s->sign != 0,
|
||||||
s->exponent, s->significand);
|
s->exponent, s->significand);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfp_single_normalise_denormal(struct vfp_single* vs) {
|
static void vfp_single_normalise_denormal(struct vfp_single* vs) {
|
||||||
@ -168,7 +168,7 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single* vs,
|
|||||||
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vs->sign != 0))
|
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vs->sign != 0))
|
||||||
incr = (1 << (VFP_SINGLE_LOW_BITS + 1)) - 1;
|
incr = (1 << (VFP_SINGLE_LOW_BITS + 1)) - 1;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "rounding increment = 0x{:08x}", incr);
|
LOG_TRACE(Core_ARM11, "rounding increment = 0x{:08x}", incr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is our rounding going to overflow?
|
* Is our rounding going to overflow?
|
||||||
@ -223,7 +223,7 @@ pack:
|
|||||||
vfp_single_dump("pack: final", vs);
|
vfp_single_dump("pack: final", vs);
|
||||||
{
|
{
|
||||||
s32 d = vfp_single_pack(vs);
|
s32 d = vfp_single_pack(vs);
|
||||||
NGLOG_TRACE(Core_ARM11, "{}: d(s{})={:08x} exceptions={:08x}", func, sd, d, exceptions);
|
LOG_TRACE(Core_ARM11, "{}: d(s{})={:08x} exceptions={:08x}", func, sd, d, exceptions);
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand) {
|
|||||||
u32 z, a;
|
u32 z, a;
|
||||||
|
|
||||||
if ((significand & 0xc0000000) != 0x40000000) {
|
if ((significand & 0xc0000000) != 0x40000000) {
|
||||||
NGLOG_TRACE(Core_ARM11, "invalid significand");
|
LOG_TRACE(Core_ARM11, "invalid significand");
|
||||||
}
|
}
|
||||||
|
|
||||||
a = significand << 1;
|
a = significand << 1;
|
||||||
@ -396,7 +396,7 @@ static u32 vfp_single_fsqrt(ARMul_State* state, int sd, int unused, s32 m, u32 f
|
|||||||
term = (u64)vsd.significand * vsd.significand;
|
term = (u64)vsd.significand * vsd.significand;
|
||||||
rem = ((u64)vsm.significand << 32) - term;
|
rem = ((u64)vsm.significand << 32) - term;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "term={} rem={}", term, rem);
|
LOG_TRACE(Core_ARM11, "term={} rem={}", term, rem);
|
||||||
|
|
||||||
while (rem < 0) {
|
while (rem < 0) {
|
||||||
vsd.significand -= 1;
|
vsd.significand -= 1;
|
||||||
@ -635,7 +635,7 @@ static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "ftoui: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
LOG_TRACE(Core_ARM11, "ftoui: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
|
|
||||||
@ -716,7 +716,7 @@ static u32 vfp_single_ftosi(ARMul_State* state, int sd, int unused, s32 m, u32 f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "ftosi: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
LOG_TRACE(Core_ARM11, "ftosi: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, (s32)d, sd);
|
vfp_put_float(state, (s32)d, sd);
|
||||||
|
|
||||||
@ -803,7 +803,7 @@ static u32 vfp_single_add(struct vfp_single* vsd, struct vfp_single* vsn, struct
|
|||||||
u32 exp_diff, m_sig;
|
u32 exp_diff, m_sig;
|
||||||
|
|
||||||
if (vsn->significand & 0x80000000 || vsm->significand & 0x80000000) {
|
if (vsn->significand & 0x80000000 || vsm->significand & 0x80000000) {
|
||||||
NGLOG_WARNING(Core_ARM11, "bad FP values");
|
LOG_WARNING(Core_ARM11, "bad FP values");
|
||||||
vfp_single_dump("VSN", vsn);
|
vfp_single_dump("VSN", vsn);
|
||||||
vfp_single_dump("VSM", vsm);
|
vfp_single_dump("VSM", vsm);
|
||||||
}
|
}
|
||||||
@ -868,7 +868,7 @@ static u32 vfp_single_multiply(struct vfp_single* vsd, struct vfp_single* vsn,
|
|||||||
*/
|
*/
|
||||||
if (vsn->exponent < vsm->exponent) {
|
if (vsn->exponent < vsm->exponent) {
|
||||||
std::swap(vsm, vsn);
|
std::swap(vsm, vsn);
|
||||||
NGLOG_TRACE(Core_ARM11, "swapping M <-> N");
|
LOG_TRACE(Core_ARM11, "swapping M <-> N");
|
||||||
}
|
}
|
||||||
|
|
||||||
vsd->sign = vsn->sign ^ vsm->sign;
|
vsd->sign = vsn->sign ^ vsm->sign;
|
||||||
@ -920,7 +920,7 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
|
|||||||
s32 v;
|
s32 v;
|
||||||
|
|
||||||
v = vfp_get_float(state, sn);
|
v = vfp_get_float(state, sn);
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, v);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, v);
|
||||||
exceptions |= vfp_single_unpack(&vsn, v, fpscr);
|
exceptions |= vfp_single_unpack(&vsn, v, fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
vfp_single_normalise_denormal(&vsn);
|
vfp_single_normalise_denormal(&vsn);
|
||||||
@ -935,7 +935,7 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
|
|||||||
vsp.sign = vfp_sign_negate(vsp.sign);
|
vsp.sign = vfp_sign_negate(vsp.sign);
|
||||||
|
|
||||||
v = vfp_get_float(state, sd);
|
v = vfp_get_float(state, sd);
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sd, v);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sd, v);
|
||||||
exceptions |= vfp_single_unpack(&vsn, v, fpscr);
|
exceptions |= vfp_single_unpack(&vsn, v, fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand != 0)
|
if (vsn.exponent == 0 && vsn.significand != 0)
|
||||||
vfp_single_normalise_denormal(&vsn);
|
vfp_single_normalise_denormal(&vsn);
|
||||||
@ -956,7 +956,7 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
|
|||||||
* sd = sd + (sn * sm)
|
* sd = sd + (sn * sm)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -965,7 +965,7 @@ static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
|||||||
*/
|
*/
|
||||||
static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
||||||
// TODO: this one has its arguments inverted, investigate.
|
// TODO: this one has its arguments inverted, investigate.
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sd, sn);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sd, sn);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -973,7 +973,7 @@ static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
|
|||||||
* sd = -sd + (sn * sm)
|
* sd = -sd + (sn * sm)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,7 +981,7 @@ static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
|||||||
* sd = -sd - (sn * sm)
|
* sd = -sd - (sn * sm)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fnmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
static u32 vfp_single_fnmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY,
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY,
|
||||||
"fnmsc");
|
"fnmsc");
|
||||||
}
|
}
|
||||||
@ -994,7 +994,7 @@ static u32 vfp_single_fmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
|||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
||||||
|
|
||||||
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
|
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
@ -1016,7 +1016,7 @@ static u32 vfp_single_fnmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
|
|||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
||||||
|
|
||||||
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
|
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
@ -1039,7 +1039,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
|||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unpack and normalise denormals.
|
* Unpack and normalise denormals.
|
||||||
@ -1061,7 +1061,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
|||||||
* sd = sn - sm
|
* sd = sn - sm
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
|
||||||
/*
|
/*
|
||||||
* Subtraction is addition with one sign inverted. Unpack the second operand to perform FTZ if
|
* Subtraction is addition with one sign inverted. Unpack the second operand to perform FTZ if
|
||||||
* necessary, we can't let fadd do this because a denormal in m might get flushed to +0 in FTZ
|
* necessary, we can't let fadd do this because a denormal in m might get flushed to +0 in FTZ
|
||||||
@ -1090,7 +1090,7 @@ static u32 vfp_single_fdiv(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
|||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
int tm, tn;
|
int tm, tn;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
LOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
|
||||||
|
|
||||||
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
|
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
|
||||||
exceptions |= vfp_single_unpack(&vsm, m, fpscr);
|
exceptions |= vfp_single_unpack(&vsm, m, fpscr);
|
||||||
@ -1230,11 +1230,11 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
|
|||||||
else
|
else
|
||||||
veclen = fpscr & FPSCR_LENGTH_MASK;
|
veclen = fpscr & FPSCR_LENGTH_MASK;
|
||||||
|
|
||||||
NGLOG_TRACE(Core_ARM11, "vecstride={} veclen={}", vecstride, (veclen >> FPSCR_LENGTH_BIT) + 1);
|
LOG_TRACE(Core_ARM11, "vecstride={} veclen={}", vecstride, (veclen >> FPSCR_LENGTH_BIT) + 1);
|
||||||
|
|
||||||
if (!fop->fn) {
|
if (!fop->fn) {
|
||||||
NGLOG_CRITICAL(Core_ARM11, "could not find single op {}, inst=0x{:x}@0x{:x}",
|
LOG_CRITICAL(Core_ARM11, "could not find single op {}, inst=0x{:x}@0x{:x}",
|
||||||
FEXT_TO_IDX(inst), inst, state->Reg[15]);
|
FEXT_TO_IDX(inst), inst, state->Reg[15]);
|
||||||
Crash();
|
Crash();
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
@ -1246,14 +1246,14 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
|
|||||||
|
|
||||||
type = (fop->flags & OP_DD) ? 'd' : 's';
|
type = (fop->flags & OP_DD) ? 'd' : 's';
|
||||||
if (op == FOP_EXT)
|
if (op == FOP_EXT)
|
||||||
NGLOG_TRACE(Core_ARM11, "itr{} ({}{}) = op[{}] (s{}={:08x})",
|
LOG_TRACE(Core_ARM11, "itr{} ({}{}) = op[{}] (s{}={:08x})", vecitr >> FPSCR_LENGTH_BIT,
|
||||||
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn, sm, m);
|
type, dest, sn, sm, m);
|
||||||
else
|
else
|
||||||
NGLOG_TRACE(Core_ARM11, "itr{} ({}{}) = (s{}) op[{}] (s{}={:08x})",
|
LOG_TRACE(Core_ARM11, "itr{} ({}{}) = (s{}) op[{}] (s{}={:08x})",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn, FOP_TO_IDX(op), sm, m);
|
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn, FOP_TO_IDX(op), sm, m);
|
||||||
|
|
||||||
except = fop->fn(state, dest, sn, m, fpscr);
|
except = fop->fn(state, dest, sn, m, fpscr);
|
||||||
NGLOG_TRACE(Core_ARM11, "itr{}: exceptions={:08x}", vecitr >> FPSCR_LENGTH_BIT, except);
|
LOG_TRACE(Core_ARM11, "itr{}: exceptions={:08x}", vecitr >> FPSCR_LENGTH_BIT, except);
|
||||||
|
|
||||||
exceptions |= except & ~VFP_NAN_FLAG;
|
exceptions |= except & ~VFP_NAN_FLAG;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ System::ResultStatus System::RunLoop(bool tight_loop) {
|
|||||||
// If we don't have a currently active thread then don't execute instructions,
|
// If we don't have a currently active thread then don't execute instructions,
|
||||||
// instead advance to the next event and try to yield to the next thread
|
// instead advance to the next event and try to yield to the next thread
|
||||||
if (Kernel::GetCurrentThread() == nullptr) {
|
if (Kernel::GetCurrentThread() == nullptr) {
|
||||||
NGLOG_TRACE(Core_ARM11, "Idling");
|
LOG_TRACE(Core_ARM11, "Idling");
|
||||||
CoreTiming::Idle();
|
CoreTiming::Idle();
|
||||||
CoreTiming::Advance();
|
CoreTiming::Advance();
|
||||||
PrepareReschedule();
|
PrepareReschedule();
|
||||||
@ -84,15 +84,15 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
|
|||||||
app_loader = Loader::GetLoader(filepath);
|
app_loader = Loader::GetLoader(filepath);
|
||||||
|
|
||||||
if (!app_loader) {
|
if (!app_loader) {
|
||||||
NGLOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
|
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
|
||||||
return ResultStatus::ErrorGetLoader;
|
return ResultStatus::ErrorGetLoader;
|
||||||
}
|
}
|
||||||
std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode =
|
std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode =
|
||||||
app_loader->LoadKernelSystemMode();
|
app_loader->LoadKernelSystemMode();
|
||||||
|
|
||||||
if (system_mode.second != Loader::ResultStatus::Success) {
|
if (system_mode.second != Loader::ResultStatus::Success) {
|
||||||
NGLOG_CRITICAL(Core, "Failed to determine system mode (Error {})!",
|
LOG_CRITICAL(Core, "Failed to determine system mode (Error {})!",
|
||||||
static_cast<int>(system_mode.second));
|
static_cast<int>(system_mode.second));
|
||||||
|
|
||||||
switch (system_mode.second) {
|
switch (system_mode.second) {
|
||||||
case Loader::ResultStatus::ErrorEncrypted:
|
case Loader::ResultStatus::ErrorEncrypted:
|
||||||
@ -106,15 +106,15 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
|
|||||||
|
|
||||||
ResultStatus init_result{Init(emu_window, system_mode.first.get())};
|
ResultStatus init_result{Init(emu_window, system_mode.first.get())};
|
||||||
if (init_result != ResultStatus::Success) {
|
if (init_result != ResultStatus::Success) {
|
||||||
NGLOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
|
LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
|
||||||
static_cast<u32>(init_result));
|
static_cast<u32>(init_result));
|
||||||
System::Shutdown();
|
System::Shutdown();
|
||||||
return init_result;
|
return init_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Loader::ResultStatus load_result{app_loader->Load(Kernel::g_current_process)};
|
const Loader::ResultStatus load_result{app_loader->Load(Kernel::g_current_process)};
|
||||||
if (Loader::ResultStatus::Success != load_result) {
|
if (Loader::ResultStatus::Success != load_result) {
|
||||||
NGLOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<u32>(load_result));
|
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<u32>(load_result));
|
||||||
System::Shutdown();
|
System::Shutdown();
|
||||||
|
|
||||||
switch (load_result) {
|
switch (load_result) {
|
||||||
@ -150,7 +150,7 @@ void System::Reschedule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
|
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
|
||||||
NGLOG_DEBUG(HW_Memory, "initialized OK");
|
LOG_DEBUG(HW_Memory, "initialized OK");
|
||||||
|
|
||||||
CoreTiming::Init();
|
CoreTiming::Init();
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
|
|||||||
cpu_core = std::make_unique<ARM_Dynarmic>(USER32MODE);
|
cpu_core = std::make_unique<ARM_Dynarmic>(USER32MODE);
|
||||||
#else
|
#else
|
||||||
cpu_core = std::make_unique<ARM_DynCom>(USER32MODE);
|
cpu_core = std::make_unique<ARM_DynCom>(USER32MODE);
|
||||||
NGLOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
|
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
cpu_core = std::make_unique<ARM_DynCom>(USER32MODE);
|
cpu_core = std::make_unique<ARM_DynCom>(USER32MODE);
|
||||||
@ -182,7 +182,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
|
|||||||
return ResultStatus::ErrorVideoCore;
|
return ResultStatus::ErrorVideoCore;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Core, "Initialized OK");
|
LOG_DEBUG(Core, "Initialized OK");
|
||||||
|
|
||||||
// Reset counters and set time origin to current frame
|
// Reset counters and set time origin to current frame
|
||||||
GetAndResetPerfStats();
|
GetAndResetPerfStats();
|
||||||
@ -228,7 +228,7 @@ void System::Shutdown() {
|
|||||||
room_member->SendGameInfo(game_info);
|
room_member->SendGameInfo(game_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Core, "Shutdown OK");
|
LOG_DEBUG(Core, "Shutdown OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@ -53,11 +53,11 @@ inline s64 usToCycles(int us) {
|
|||||||
|
|
||||||
inline s64 usToCycles(s64 us) {
|
inline s64 usToCycles(s64 us) {
|
||||||
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
|
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
LOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
||||||
return std::numeric_limits<s64>::max();
|
return std::numeric_limits<s64>::max();
|
||||||
}
|
}
|
||||||
if (us > MAX_VALUE_TO_MULTIPLY) {
|
if (us > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
LOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
||||||
return BASE_CLOCK_RATE_ARM11 * (us / 1000000);
|
return BASE_CLOCK_RATE_ARM11 * (us / 1000000);
|
||||||
}
|
}
|
||||||
return (BASE_CLOCK_RATE_ARM11 * us) / 1000000;
|
return (BASE_CLOCK_RATE_ARM11 * us) / 1000000;
|
||||||
@ -65,11 +65,11 @@ inline s64 usToCycles(s64 us) {
|
|||||||
|
|
||||||
inline s64 usToCycles(u64 us) {
|
inline s64 usToCycles(u64 us) {
|
||||||
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
|
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
LOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
||||||
return std::numeric_limits<s64>::max();
|
return std::numeric_limits<s64>::max();
|
||||||
}
|
}
|
||||||
if (us > MAX_VALUE_TO_MULTIPLY) {
|
if (us > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
LOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
||||||
return BASE_CLOCK_RATE_ARM11 * static_cast<s64>(us / 1000000);
|
return BASE_CLOCK_RATE_ARM11 * static_cast<s64>(us / 1000000);
|
||||||
}
|
}
|
||||||
return (BASE_CLOCK_RATE_ARM11 * static_cast<s64>(us)) / 1000000;
|
return (BASE_CLOCK_RATE_ARM11 * static_cast<s64>(us)) / 1000000;
|
||||||
@ -85,11 +85,11 @@ inline s64 nsToCycles(int ns) {
|
|||||||
|
|
||||||
inline s64 nsToCycles(s64 ns) {
|
inline s64 nsToCycles(s64 ns) {
|
||||||
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
|
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
LOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
||||||
return std::numeric_limits<s64>::max();
|
return std::numeric_limits<s64>::max();
|
||||||
}
|
}
|
||||||
if (ns > MAX_VALUE_TO_MULTIPLY) {
|
if (ns > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
LOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
||||||
return BASE_CLOCK_RATE_ARM11 * (ns / 1000000000);
|
return BASE_CLOCK_RATE_ARM11 * (ns / 1000000000);
|
||||||
}
|
}
|
||||||
return (BASE_CLOCK_RATE_ARM11 * ns) / 1000000000;
|
return (BASE_CLOCK_RATE_ARM11 * ns) / 1000000000;
|
||||||
@ -97,11 +97,11 @@ inline s64 nsToCycles(s64 ns) {
|
|||||||
|
|
||||||
inline s64 nsToCycles(u64 ns) {
|
inline s64 nsToCycles(u64 ns) {
|
||||||
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
|
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
LOG_ERROR(Core_Timing, "Integer overflow, use max value");
|
||||||
return std::numeric_limits<s64>::max();
|
return std::numeric_limits<s64>::max();
|
||||||
}
|
}
|
||||||
if (ns > MAX_VALUE_TO_MULTIPLY) {
|
if (ns > MAX_VALUE_TO_MULTIPLY) {
|
||||||
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
LOG_DEBUG(Core_Timing, "Time very big, do rounding");
|
||||||
return BASE_CLOCK_RATE_ARM11 * (static_cast<s64>(ns) / 1000000000);
|
return BASE_CLOCK_RATE_ARM11 * (static_cast<s64>(ns) / 1000000000);
|
||||||
}
|
}
|
||||||
return (BASE_CLOCK_RATE_ARM11 * static_cast<s64>(ns)) / 1000000000;
|
return (BASE_CLOCK_RATE_ARM11 * static_cast<s64>(ns)) / 1000000000;
|
||||||
|
@ -70,7 +70,7 @@ std::string Path::AsString() const {
|
|||||||
case LowPathType::Binary:
|
case LowPathType::Binary:
|
||||||
default:
|
default:
|
||||||
// TODO(yuriks): Add assert
|
// TODO(yuriks): Add assert
|
||||||
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
|
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ std::u16string Path::AsU16Str() const {
|
|||||||
case LowPathType::Invalid:
|
case LowPathType::Invalid:
|
||||||
case LowPathType::Binary:
|
case LowPathType::Binary:
|
||||||
// TODO(yuriks): Add assert
|
// TODO(yuriks): Add assert
|
||||||
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ std::vector<u8> Path::AsBinary() const {
|
|||||||
case LowPathType::Invalid:
|
case LowPathType::Invalid:
|
||||||
default:
|
default:
|
||||||
// TODO(yuriks): Add assert
|
// TODO(yuriks): Add assert
|
||||||
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
|
LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,22 +87,22 @@ public:
|
|||||||
|
|
||||||
ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
|
ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
|
||||||
const Mode& mode) const override {
|
const Mode& mode) const override {
|
||||||
NGLOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
LOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
||||||
|
|
||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.hex == 0) {
|
if (mode.hex == 0) {
|
||||||
NGLOG_ERROR(Service_FS, "Empty open mode");
|
LOG_ERROR(Service_FS, "Empty open mode");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.create_flag) {
|
if (mode.create_flag) {
|
||||||
NGLOG_ERROR(Service_FS, "Create flag is not supported");
|
LOG_ERROR(Service_FS, "Create flag is not supported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,17 +110,17 @@ public:
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} not found", full_path);
|
LOG_ERROR(Service_FS, "{} not found", full_path);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -128,7 +128,7 @@ public:
|
|||||||
|
|
||||||
FileUtil::IOFile file(full_path, "r+b");
|
FileUtil::IOFile file(full_path, "r+b");
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ public:
|
|||||||
|
|
||||||
ResultCode CreateFile(const Path& path, u64 size) const override {
|
ResultCode CreateFile(const Path& path, u64 size) const override {
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
NGLOG_ERROR(Service_FS, "Zero-size file is not supported");
|
LOG_ERROR(Service_FS, "Zero-size file is not supported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
return SaveDataArchive::CreateFile(path, size);
|
return SaveDataArchive::CreateFile(path, size);
|
||||||
@ -192,12 +192,12 @@ Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {
|
|||||||
ArchiveFactory_ExtSaveData::ArchiveFactory_ExtSaveData(const std::string& mount_location,
|
ArchiveFactory_ExtSaveData::ArchiveFactory_ExtSaveData(const std::string& mount_location,
|
||||||
bool shared)
|
bool shared)
|
||||||
: shared(shared), mount_point(GetExtDataContainerPath(mount_location, shared)) {
|
: shared(shared), mount_point(GetExtDataContainerPath(mount_location, shared)) {
|
||||||
NGLOG_DEBUG(Service_FS, "Directory {} set as base for ExtSaveData.", mount_point);
|
LOG_DEBUG(Service_FS, "Directory {} set as base for ExtSaveData.", mount_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArchiveFactory_ExtSaveData::Initialize() {
|
bool ArchiveFactory_ExtSaveData::Initialize() {
|
||||||
if (!FileUtil::CreateFullPath(mount_point)) {
|
if (!FileUtil::CreateFullPath(mount_point)) {
|
||||||
NGLOG_ERROR(Service_FS, "Unable to create ExtSaveData base path.");
|
LOG_ERROR(Service_FS, "Unable to create ExtSaveData base path.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
|
|||||||
FileUtil::IOFile file(metadata_path, "rb");
|
FileUtil::IOFile file(metadata_path, "rb");
|
||||||
|
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
NGLOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||||
// TODO(Subv): Verify error code
|
// TODO(Subv): Verify error code
|
||||||
return ERR_NOT_FORMATTED;
|
return ERR_NOT_FORMATTED;
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,13 @@ static_assert(sizeof(NCCHFilePath) == 0x14, "NCCHFilePath has wrong size!");
|
|||||||
ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
||||||
const Mode& mode) const {
|
const Mode& mode) const {
|
||||||
if (path.GetType() != LowPathType::Binary) {
|
if (path.GetType() != LowPathType::Binary) {
|
||||||
NGLOG_ERROR(Service_FS, "Path need to be Binary");
|
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> binary = path.AsBinary();
|
std::vector<u8> binary = path.AsBinary();
|
||||||
if (binary.size() != sizeof(NCCHFilePath)) {
|
if (binary.size() != sizeof(NCCHFilePath)) {
|
||||||
NGLOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||||||
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<ExeFSDelayGenerator>();
|
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<ExeFSDelayGenerator>();
|
||||||
file = std::make_unique<NCCHFile>(std::move(buffer), std::move(delay_generator));
|
file = std::make_unique<NCCHFile>(std::move(buffer), std::move(delay_generator));
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_FS, "Unknown NCCH archive type {}!", openfile_path.filepath_type);
|
LOG_ERROR(Service_FS, "Unknown NCCH archive type {}!", openfile_path.filepath_type);
|
||||||
result = Loader::ResultStatus::Error;
|
result = Loader::ResultStatus::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||||||
u32 high = static_cast<u32>(title_id >> 32);
|
u32 high = static_cast<u32>(title_id >> 32);
|
||||||
u32 low = static_cast<u32>(title_id & 0xFFFFFFFF);
|
u32 low = static_cast<u32>(title_id & 0xFFFFFFFF);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Full Path: {}. Category: 0x{:X}. Path: 0x{:X}.", path.DebugStr(),
|
LOG_DEBUG(Service_FS, "Full Path: {}. Category: 0x{:X}. Path: 0x{:X}.", path.DebugStr(),
|
||||||
high, low);
|
high, low);
|
||||||
|
|
||||||
std::string archive_name;
|
std::string archive_name;
|
||||||
if (high == shared_data_archive) {
|
if (high == shared_data_archive) {
|
||||||
@ -121,8 +121,8 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!archive_name.empty()) {
|
if (!archive_name.empty()) {
|
||||||
NGLOG_ERROR(Service_FS, "Failed to get a handle for shared data archive: {}. ",
|
LOG_ERROR(Service_FS, "Failed to get a handle for shared data archive: {}. ",
|
||||||
archive_name);
|
archive_name);
|
||||||
Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
|
Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
|
||||||
archive_name.c_str());
|
archive_name.c_str());
|
||||||
}
|
}
|
||||||
@ -133,63 +133,60 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NCCHArchive::DeleteFile(const Path& path) const {
|
ResultCode NCCHArchive::DeleteFile(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an NCCH archive ({}).", GetName());
|
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an NCCH archive ({}).", GetName());
|
||||||
// TODO(Subv): Verify error code
|
// TODO(Subv): Verify error code
|
||||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||||
ErrorLevel::Status);
|
ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NCCHArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
ResultCode NCCHArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).", GetName());
|
||||||
GetName());
|
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NCCHArchive::DeleteDirectory(const Path& path) const {
|
ResultCode NCCHArchive::DeleteDirectory(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
|
||||||
GetName());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NCCHArchive::DeleteDirectoryRecursively(const Path& path) const {
|
ResultCode NCCHArchive::DeleteDirectoryRecursively(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
|
||||||
GetName());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NCCHArchive::CreateFile(const Path& path, u64 size) const {
|
ResultCode NCCHArchive::CreateFile(const Path& path, u64 size) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an NCCH archive ({}).", GetName());
|
LOG_CRITICAL(Service_FS, "Attempted to create a file in an NCCH archive ({}).", GetName());
|
||||||
// TODO: Verify error code
|
// TODO: Verify error code
|
||||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
||||||
ErrorLevel::Permanent);
|
ErrorLevel::Permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NCCHArchive::CreateDirectory(const Path& path) const {
|
ResultCode NCCHArchive::CreateDirectory(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an NCCH archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to create a directory in an NCCH archive ({}).", GetName());
|
||||||
GetName());
|
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NCCHArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
ResultCode NCCHArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).", GetName());
|
||||||
GetName());
|
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<std::unique_ptr<DirectoryBackend>> NCCHArchive::OpenDirectory(const Path& path) const {
|
ResultVal<std::unique_ptr<DirectoryBackend>> NCCHArchive::OpenDirectory(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to open a directory within an NCCH archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to open a directory within an NCCH archive ({}).",
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
// TODO(shinyquagsire23): Use correct error code
|
// TODO(shinyquagsire23): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 NCCHArchive::GetFreeBytes() const {
|
u64 NCCHArchive::GetFreeBytes() const {
|
||||||
NGLOG_WARNING(Service_FS, "Attempted to get the free space in an NCCH archive");
|
LOG_WARNING(Service_FS, "Attempted to get the free space in an NCCH archive");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +198,7 @@ NCCHFile::NCCHFile(std::vector<u8> buffer, std::unique_ptr<DelayGenerator> delay
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<size_t> NCCHFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
ResultVal<size_t> NCCHFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||||
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
||||||
size_t length_left = static_cast<size_t>(data_size - offset);
|
size_t length_left = static_cast<size_t>(data_size - offset);
|
||||||
size_t read_length = static_cast<size_t>(std::min(length, length_left));
|
size_t read_length = static_cast<size_t>(std::min(length, length_left));
|
||||||
|
|
||||||
@ -214,7 +211,7 @@ ResultVal<size_t> NCCHFile::Read(const u64 offset, const size_t length, u8* buff
|
|||||||
|
|
||||||
ResultVal<size_t> NCCHFile::Write(const u64 offset, const size_t length, const bool flush,
|
ResultVal<size_t> NCCHFile::Write(const u64 offset, const size_t length, const bool flush,
|
||||||
const u8* buffer) {
|
const u8* buffer) {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to write to NCCH file");
|
LOG_ERROR(Service_FS, "Attempted to write to NCCH file");
|
||||||
// TODO(shinyquagsire23): Find error code
|
// TODO(shinyquagsire23): Find error code
|
||||||
return MakeResult<size_t>(0);
|
return MakeResult<size_t>(0);
|
||||||
}
|
}
|
||||||
@ -224,7 +221,7 @@ u64 NCCHFile::GetSize() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool NCCHFile::SetSize(const u64 size) const {
|
bool NCCHFile::SetSize(const u64 size) const {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to set the size of an NCCH file");
|
LOG_ERROR(Service_FS, "Attempted to set the size of an NCCH file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,13 +231,13 @@ ArchiveFactory_NCCH::ArchiveFactory_NCCH() {}
|
|||||||
|
|
||||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) {
|
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) {
|
||||||
if (path.GetType() != LowPathType::Binary) {
|
if (path.GetType() != LowPathType::Binary) {
|
||||||
NGLOG_ERROR(Service_FS, "Path need to be Binary");
|
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> binary = path.AsBinary();
|
std::vector<u8> binary = path.AsBinary();
|
||||||
if (binary.size() != sizeof(NCCHArchivePath)) {
|
if (binary.size() != sizeof(NCCHArchivePath)) {
|
||||||
NGLOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +251,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
|
|||||||
|
|
||||||
ResultCode ArchiveFactory_NCCH::Format(const Path& path,
|
ResultCode ArchiveFactory_NCCH::Format(const Path& path,
|
||||||
const FileSys::ArchiveFormatInfo& format_info) {
|
const FileSys::ArchiveFormatInfo& format_info) {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to format a NCCH archive.");
|
LOG_ERROR(Service_FS, "Attempted to format a NCCH archive.");
|
||||||
// TODO: Verify error code
|
// TODO: Verify error code
|
||||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
||||||
ErrorLevel::Permanent);
|
ErrorLevel::Permanent);
|
||||||
@ -262,7 +259,7 @@ ResultCode ArchiveFactory_NCCH::Format(const Path& path,
|
|||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_NCCH::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> ArchiveFactory_NCCH::GetFormatInfo(const Path& path) const {
|
||||||
// TODO(Subv): Implement
|
// TODO(Subv): Implement
|
||||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,14 +23,14 @@ namespace {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_reader) {
|
ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_reader) {
|
||||||
if (path.GetType() != LowPathType::Binary) {
|
if (path.GetType() != LowPathType::Binary) {
|
||||||
NGLOG_ERROR(Service_FS, "Wrong path type {}", static_cast<int>(path.GetType()));
|
LOG_ERROR(Service_FS, "Wrong path type {}", static_cast<int>(path.GetType()));
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> vec_data = path.AsBinary();
|
std::vector<u8> vec_data = path.AsBinary();
|
||||||
|
|
||||||
if (vec_data.size() != 12) {
|
if (vec_data.size() != 12) {
|
||||||
NGLOG_ERROR(Service_FS, "Wrong path length {}", vec_data.size());
|
LOG_ERROR(Service_FS, "Wrong path length {}", vec_data.size());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_r
|
|||||||
auto media_type = static_cast<MediaType>(data[0]);
|
auto media_type = static_cast<MediaType>(data[0]);
|
||||||
|
|
||||||
if (media_type != MediaType::SDMC && media_type != MediaType::GameCard) {
|
if (media_type != MediaType::SDMC && media_type != MediaType::GameCard) {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported media type {}", static_cast<u32>(media_type));
|
LOG_ERROR(Service_FS, "Unsupported media type {}", static_cast<u32>(media_type));
|
||||||
|
|
||||||
// Note: this is strange, but the error code was verified with a real 3DS
|
// Note: this is strange, but the error code was verified with a real 3DS
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
@ -70,7 +70,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataPermitted
|
|||||||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path));
|
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path));
|
||||||
|
|
||||||
if (media_type == MediaType::GameCard) {
|
if (media_type == MediaType::GameCard) {
|
||||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||||
return ERROR_GAMECARD_NOT_INSERTED;
|
return ERROR_GAMECARD_NOT_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataPermitted
|
|||||||
|
|
||||||
ResultCode ArchiveFactory_OtherSaveDataPermitted::Format(
|
ResultCode ArchiveFactory_OtherSaveDataPermitted::Format(
|
||||||
const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
|
const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive.");
|
LOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive.");
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataPermitted::GetFormatInf
|
|||||||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path));
|
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path));
|
||||||
|
|
||||||
if (media_type == MediaType::GameCard) {
|
if (media_type == MediaType::GameCard) {
|
||||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||||
return ERROR_GAMECARD_NOT_INSERTED;
|
return ERROR_GAMECARD_NOT_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataGeneral::
|
|||||||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
||||||
|
|
||||||
if (media_type == MediaType::GameCard) {
|
if (media_type == MediaType::GameCard) {
|
||||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||||
return ERROR_GAMECARD_NOT_INSERTED;
|
return ERROR_GAMECARD_NOT_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ ResultCode ArchiveFactory_OtherSaveDataGeneral::Format(
|
|||||||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
||||||
|
|
||||||
if (media_type == MediaType::GameCard) {
|
if (media_type == MediaType::GameCard) {
|
||||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||||
return ERROR_GAMECARD_NOT_INSERTED;
|
return ERROR_GAMECARD_NOT_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataGeneral::GetFormatInfo(
|
|||||||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
||||||
|
|
||||||
if (media_type == MediaType::GameCard) {
|
if (media_type == MediaType::GameCard) {
|
||||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||||
return ERROR_GAMECARD_NOT_INSERTED;
|
return ERROR_GAMECARD_NOT_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,22 +44,22 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path,
|
|||||||
|
|
||||||
ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& path,
|
ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& path,
|
||||||
const Mode& mode) const {
|
const Mode& mode) const {
|
||||||
NGLOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
LOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
||||||
|
|
||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.hex == 0) {
|
if (mode.hex == 0) {
|
||||||
NGLOG_ERROR(Service_FS, "Empty open mode");
|
LOG_ERROR(Service_FS, "Empty open mode");
|
||||||
return ERROR_INVALID_OPEN_FLAGS;
|
return ERROR_INVALID_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.create_flag && !mode.write_flag) {
|
if (mode.create_flag && !mode.write_flag) {
|
||||||
NGLOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
LOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||||
return ERROR_INVALID_OPEN_FLAGS;
|
return ERROR_INVALID_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,19 +67,19 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} is not a file", full_path);
|
LOG_ERROR(Service_FS, "{} is not a file", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
if (!mode.create_flag) {
|
if (!mode.create_flag) {
|
||||||
NGLOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
||||||
full_path);
|
full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
// Create the file
|
// Create the file
|
||||||
@ -92,7 +92,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
|
|||||||
|
|
||||||
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,15 +113,15 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} not found", full_path);
|
LOG_ERROR(Service_FS, "{} not found", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} is not a file", full_path);
|
LOG_ERROR(Service_FS, "{} is not a file", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -131,7 +131,7 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,14 +140,14 @@ ResultCode SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path)
|
|||||||
|
|
||||||
// TODO: Verify these return codes with HW
|
// TODO: Verify these return codes with HW
|
||||||
if (!path_parser_src.IsValid()) {
|
if (!path_parser_src.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PathParser path_parser_dest(dest_path);
|
const PathParser path_parser_dest(dest_path);
|
||||||
|
|
||||||
if (!path_parser_dest.IsValid()) {
|
if (!path_parser_dest.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,15 +181,15 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -199,7 +199,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
LOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,17 +224,17 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||||
return ERROR_ALREADY_EXISTS;
|
return ERROR_ALREADY_EXISTS;
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -252,7 +252,7 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Service_FS, "Too large file");
|
LOG_ERROR(Service_FS, "Too large file");
|
||||||
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
|
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
|
||||||
ErrorLevel::Info);
|
ErrorLevel::Info);
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,15 +269,15 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||||
return ERROR_ALREADY_EXISTS;
|
return ERROR_ALREADY_EXISTS;
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -287,7 +287,7 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
|
||||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||||
ErrorLevel::Status);
|
ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
@ -297,14 +297,14 @@ ResultCode SDMCArchive::RenameDirectory(const Path& src_path, const Path& dest_p
|
|||||||
|
|
||||||
// TODO: Verify these return codes with HW
|
// TODO: Verify these return codes with HW
|
||||||
if (!path_parser_src.IsValid()) {
|
if (!path_parser_src.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PathParser path_parser_dest(dest_path);
|
const PathParser path_parser_dest(dest_path);
|
||||||
|
|
||||||
if (!path_parser_dest.IsValid()) {
|
if (!path_parser_dest.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,15 +333,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} not found", full_path);
|
LOG_ERROR(Service_FS, "{} not found", full_path);
|
||||||
return ERROR_NOT_FOUND;
|
return ERROR_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -359,17 +359,17 @@ u64 SDMCArchive::GetFreeBytes() const {
|
|||||||
ArchiveFactory_SDMC::ArchiveFactory_SDMC(const std::string& sdmc_directory)
|
ArchiveFactory_SDMC::ArchiveFactory_SDMC(const std::string& sdmc_directory)
|
||||||
: sdmc_directory(sdmc_directory) {
|
: sdmc_directory(sdmc_directory) {
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Directory {} set as SDMC.", sdmc_directory);
|
LOG_DEBUG(Service_FS, "Directory {} set as SDMC.", sdmc_directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArchiveFactory_SDMC::Initialize() {
|
bool ArchiveFactory_SDMC::Initialize() {
|
||||||
if (!Settings::values.use_virtual_sd) {
|
if (!Settings::values.use_virtual_sd) {
|
||||||
NGLOG_WARNING(Service_FS, "SDMC disabled by config.");
|
LOG_WARNING(Service_FS, "SDMC disabled by config.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FileUtil::CreateFullPath(sdmc_directory)) {
|
if (!FileUtil::CreateFullPath(sdmc_directory)) {
|
||||||
NGLOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
LOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ ResultCode ArchiveFactory_SDMC::Format(const Path& path,
|
|||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path) const {
|
||||||
// TODO(Subv): Implement
|
// TODO(Subv): Implement
|
||||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
@ -18,7 +18,7 @@ namespace FileSys {
|
|||||||
ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Path& path,
|
ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Path& path,
|
||||||
const Mode& mode) const {
|
const Mode& mode) const {
|
||||||
if (mode.read_flag) {
|
if (mode.read_flag) {
|
||||||
NGLOG_ERROR(Service_FS, "Read flag is not supported");
|
LOG_ERROR(Service_FS, "Read flag is not supported");
|
||||||
return ERROR_INVALID_READ_FLAG;
|
return ERROR_INVALID_READ_FLAG;
|
||||||
}
|
}
|
||||||
return SDMCArchive::OpenFileBase(path, mode);
|
return SDMCArchive::OpenFileBase(path, mode);
|
||||||
@ -26,23 +26,23 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Pat
|
|||||||
|
|
||||||
ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory(
|
ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory(
|
||||||
const Path& path) const {
|
const Path& path) const {
|
||||||
NGLOG_ERROR(Service_FS, "Not supported");
|
LOG_ERROR(Service_FS, "Not supported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point)
|
ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point)
|
||||||
: sdmc_directory(mount_point) {
|
: sdmc_directory(mount_point) {
|
||||||
NGLOG_DEBUG(Service_FS, "Directory {} set as SDMCWriteOnly.", sdmc_directory);
|
LOG_DEBUG(Service_FS, "Directory {} set as SDMCWriteOnly.", sdmc_directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArchiveFactory_SDMCWriteOnly::Initialize() {
|
bool ArchiveFactory_SDMCWriteOnly::Initialize() {
|
||||||
if (!Settings::values.use_virtual_sd) {
|
if (!Settings::values.use_virtual_sd) {
|
||||||
NGLOG_WARNING(Service_FS, "SDMC disabled by config.");
|
LOG_WARNING(Service_FS, "SDMC disabled by config.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FileUtil::CreateFullPath(sdmc_directory)) {
|
if (!FileUtil::CreateFullPath(sdmc_directory)) {
|
||||||
NGLOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
LOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,13 +57,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMCWriteOnly::Open(co
|
|||||||
ResultCode ArchiveFactory_SDMCWriteOnly::Format(const Path& path,
|
ResultCode ArchiveFactory_SDMCWriteOnly::Format(const Path& path,
|
||||||
const FileSys::ArchiveFormatInfo& format_info) {
|
const FileSys::ArchiveFormatInfo& format_info) {
|
||||||
// TODO(wwylele): hwtest this
|
// TODO(wwylele): hwtest this
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to format a SDMC write-only archive.");
|
LOG_ERROR(Service_FS, "Attempted to format a SDMC write-only archive.");
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMCWriteOnly::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMCWriteOnly::GetFormatInfo(const Path& path) const {
|
||||||
// TODO(Subv): Implement
|
// TODO(Subv): Implement
|
||||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ public:
|
|||||||
|
|
||||||
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override {
|
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override {
|
||||||
if (offset != 0) {
|
if (offset != 0) {
|
||||||
NGLOG_ERROR(Service_FS, "offset must be zero!");
|
LOG_ERROR(Service_FS, "offset must be zero!");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length != data->size()) {
|
if (length != data->size()) {
|
||||||
NGLOG_ERROR(Service_FS, "size must match the file size!");
|
LOG_ERROR(Service_FS, "size must match the file size!");
|
||||||
return ERROR_INCORRECT_EXEFS_READ_SIZE;
|
return ERROR_INCORRECT_EXEFS_READ_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override {
|
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override {
|
||||||
NGLOG_ERROR(Service_FS, "The file is read-only!");
|
LOG_ERROR(Service_FS, "The file is read-only!");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,13 +88,13 @@ public:
|
|||||||
// Note: SelfNCCHArchive doesn't check the open mode.
|
// Note: SelfNCCHArchive doesn't check the open mode.
|
||||||
|
|
||||||
if (path.GetType() != LowPathType::Binary) {
|
if (path.GetType() != LowPathType::Binary) {
|
||||||
NGLOG_ERROR(Service_FS, "Path need to be Binary");
|
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> binary = path.AsBinary();
|
std::vector<u8> binary = path.AsBinary();
|
||||||
if (binary.size() != sizeof(SelfNCCHFilePath)) {
|
if (binary.size() != sizeof(SelfNCCHFilePath)) {
|
||||||
NGLOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ public:
|
|||||||
return OpenRomFS();
|
return OpenRomFS();
|
||||||
|
|
||||||
case SelfNCCHFilePathType::Code:
|
case SelfNCCHFilePathType::Code:
|
||||||
NGLOG_ERROR(Service_FS, "Reading the code section is not supported!");
|
LOG_ERROR(Service_FS, "Reading the code section is not supported!");
|
||||||
return ERROR_COMMAND_NOT_ALLOWED;
|
return ERROR_COMMAND_NOT_ALLOWED;
|
||||||
|
|
||||||
case SelfNCCHFilePathType::ExeFS: {
|
case SelfNCCHFilePathType::ExeFS: {
|
||||||
@ -119,48 +119,48 @@ public:
|
|||||||
return OpenExeFS(filename);
|
return OpenExeFS(filename);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Service_FS, "Unknown file type {}!", static_cast<u32>(file_path.type));
|
LOG_ERROR(Service_FS, "Unknown file type {}!", static_cast<u32>(file_path.type));
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode DeleteFile(const Path& path) const override {
|
ResultCode DeleteFile(const Path& path) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override {
|
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode DeleteDirectory(const Path& path) const override {
|
ResultCode DeleteDirectory(const Path& path) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode DeleteDirectoryRecursively(const Path& path) const override {
|
ResultCode DeleteDirectoryRecursively(const Path& path) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode CreateFile(const Path& path, u64 size) const override {
|
ResultCode CreateFile(const Path& path, u64 size) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode CreateDirectory(const Path& path) const override {
|
ResultCode CreateDirectory(const Path& path) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override {
|
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override {
|
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
LOG_ERROR(Service_FS, "Unsupported");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ private:
|
|||||||
std::make_unique<IVFCFile>(ncch_data.romfs_file, ncch_data.romfs_offset,
|
std::make_unique<IVFCFile>(ncch_data.romfs_file, ncch_data.romfs_offset,
|
||||||
ncch_data.romfs_size, std::move(delay_generator)));
|
ncch_data.romfs_size, std::move(delay_generator)));
|
||||||
} else {
|
} else {
|
||||||
NGLOG_INFO(Service_FS, "Unable to read RomFS");
|
LOG_INFO(Service_FS, "Unable to read RomFS");
|
||||||
return ERROR_ROMFS_NOT_FOUND;
|
return ERROR_ROMFS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ private:
|
|||||||
ncch_data.update_romfs_file, ncch_data.update_romfs_offset,
|
ncch_data.update_romfs_file, ncch_data.update_romfs_offset,
|
||||||
ncch_data.update_romfs_size, std::move(delay_generator)));
|
ncch_data.update_romfs_size, std::move(delay_generator)));
|
||||||
} else {
|
} else {
|
||||||
NGLOG_INFO(Service_FS, "Unable to read update RomFS");
|
LOG_INFO(Service_FS, "Unable to read update RomFS");
|
||||||
return ERROR_ROMFS_NOT_FOUND;
|
return ERROR_ROMFS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ private:
|
|||||||
std::make_unique<ExeFSSectionFile>(ncch_data.icon));
|
std::make_unique<ExeFSSectionFile>(ncch_data.icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS, "Unable to read icon");
|
LOG_WARNING(Service_FS, "Unable to read icon");
|
||||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ private:
|
|||||||
std::make_unique<ExeFSSectionFile>(ncch_data.logo));
|
std::make_unique<ExeFSSectionFile>(ncch_data.logo));
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS, "Unable to read logo");
|
LOG_WARNING(Service_FS, "Unable to read logo");
|
||||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,11 +222,11 @@ private:
|
|||||||
std::make_unique<ExeFSSectionFile>(ncch_data.banner));
|
std::make_unique<ExeFSSectionFile>(ncch_data.banner));
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS, "Unable to read banner");
|
LOG_WARNING(Service_FS, "Unable to read banner");
|
||||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Service_FS, "Unknown ExeFS section {}!", filename);
|
LOG_ERROR(Service_FS, "Unknown ExeFS section {}!", filename);
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,18 +236,18 @@ private:
|
|||||||
void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) {
|
void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) {
|
||||||
u64 program_id = 0;
|
u64 program_id = 0;
|
||||||
if (app_loader.ReadProgramId(program_id) != Loader::ResultStatus::Success) {
|
if (app_loader.ReadProgramId(program_id) != Loader::ResultStatus::Success) {
|
||||||
NGLOG_WARNING(
|
LOG_WARNING(
|
||||||
Service_FS,
|
Service_FS,
|
||||||
"Could not read program id when registering with SelfNCCH, this might be a 3dsx file");
|
"Could not read program id when registering with SelfNCCH, this might be a 3dsx file");
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Registering program {:016X} with the SelfNCCH archive factory",
|
LOG_DEBUG(Service_FS, "Registering program {:016X} with the SelfNCCH archive factory",
|
||||||
program_id);
|
program_id);
|
||||||
|
|
||||||
if (ncch_data.find(program_id) != ncch_data.end()) {
|
if (ncch_data.find(program_id) != ncch_data.end()) {
|
||||||
NGLOG_WARNING(Service_FS,
|
LOG_WARNING(Service_FS,
|
||||||
"Registering program {:016X} with SelfNCCH will override existing mapping",
|
"Registering program {:016X} with SelfNCCH will override existing mapping",
|
||||||
program_id);
|
program_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NCCHData& data = ncch_data[program_id];
|
NCCHData& data = ncch_data[program_id];
|
||||||
@ -288,12 +288,12 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SelfNCCH::Open(const P
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultCode ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&) {
|
ResultCode ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&) {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to format a SelfNCCH archive.");
|
LOG_ERROR(Service_FS, "Attempted to format a SelfNCCH archive.");
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SelfNCCH::GetFormatInfo(const Path&) const {
|
ResultVal<ArchiveFormatInfo> ArchiveFactory_SelfNCCH::GetFormatInfo(const Path&) const {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to get format info of a SelfNCCH archive");
|
LOG_ERROR(Service_FS, "Attempted to get format info of a SelfNCCH archive");
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 progr
|
|||||||
|
|
||||||
ArchiveSource_SDSaveData::ArchiveSource_SDSaveData(const std::string& sdmc_directory)
|
ArchiveSource_SDSaveData::ArchiveSource_SDSaveData(const std::string& sdmc_directory)
|
||||||
: mount_point(GetSaveDataContainerPath(sdmc_directory)) {
|
: mount_point(GetSaveDataContainerPath(sdmc_directory)) {
|
||||||
NGLOG_DEBUG(Service_FS, "Directory {} set as SaveData.", mount_point);
|
LOG_DEBUG(Service_FS, "Directory {} set as SaveData.", mount_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 program_id) {
|
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 program_id) {
|
||||||
@ -79,7 +79,7 @@ ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program
|
|||||||
FileUtil::IOFile file(metadata_path, "rb");
|
FileUtil::IOFile file(metadata_path, "rb");
|
||||||
|
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
NGLOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||||
// TODO(Subv): Verify error code
|
// TODO(Subv): Verify error code
|
||||||
return ERR_NOT_FORMATTED;
|
return ERR_NOT_FORMATTED;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ ResultCode ArchiveFactory_SystemSaveData::Format(const Path& path,
|
|||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SystemSaveData::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> ArchiveFactory_SystemSaveData::GetFormatInfo(const Path& path) const {
|
||||||
// TODO(Subv): Implement
|
// TODO(Subv): Implement
|
||||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,21 +208,21 @@ u64 CIAContainer::GetContentSize(u16 index) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CIAContainer::Print() const {
|
void CIAContainer::Print() const {
|
||||||
NGLOG_DEBUG(Service_FS, "Type: {}", static_cast<u32>(cia_header.type));
|
LOG_DEBUG(Service_FS, "Type: {}", static_cast<u32>(cia_header.type));
|
||||||
NGLOG_DEBUG(Service_FS, "Version: {}\n", static_cast<u32>(cia_header.version));
|
LOG_DEBUG(Service_FS, "Version: {}\n", static_cast<u32>(cia_header.version));
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Certificate Size: 0x{:08x} bytes", GetCertificateSize());
|
LOG_DEBUG(Service_FS, "Certificate Size: 0x{:08x} bytes", GetCertificateSize());
|
||||||
NGLOG_DEBUG(Service_FS, "Ticket Size: 0x{:08x} bytes", GetTicketSize());
|
LOG_DEBUG(Service_FS, "Ticket Size: 0x{:08x} bytes", GetTicketSize());
|
||||||
NGLOG_DEBUG(Service_FS, "TMD Size: 0x{:08x} bytes", GetTitleMetadataSize());
|
LOG_DEBUG(Service_FS, "TMD Size: 0x{:08x} bytes", GetTitleMetadataSize());
|
||||||
NGLOG_DEBUG(Service_FS, "Meta Size: 0x{:08x} bytes", GetMetadataSize());
|
LOG_DEBUG(Service_FS, "Meta Size: 0x{:08x} bytes", GetMetadataSize());
|
||||||
NGLOG_DEBUG(Service_FS, "Content Size: 0x{:08x} bytes\n", GetTotalContentSize());
|
LOG_DEBUG(Service_FS, "Content Size: 0x{:08x} bytes\n", GetTotalContentSize());
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Certificate Offset: 0x{:08x} bytes", GetCertificateOffset());
|
LOG_DEBUG(Service_FS, "Certificate Offset: 0x{:08x} bytes", GetCertificateOffset());
|
||||||
NGLOG_DEBUG(Service_FS, "Ticket Offset: 0x{:08x} bytes", GetTicketOffset());
|
LOG_DEBUG(Service_FS, "Ticket Offset: 0x{:08x} bytes", GetTicketOffset());
|
||||||
NGLOG_DEBUG(Service_FS, "TMD Offset: 0x{:08x} bytes", GetTitleMetadataOffset());
|
LOG_DEBUG(Service_FS, "TMD Offset: 0x{:08x} bytes", GetTitleMetadataOffset());
|
||||||
NGLOG_DEBUG(Service_FS, "Meta Offset: 0x{:08x} bytes", GetMetadataOffset());
|
LOG_DEBUG(Service_FS, "Meta Offset: 0x{:08x} bytes", GetMetadataOffset());
|
||||||
for (u16 i = 0; i < cia_tmd.GetContentCount(); i++) {
|
for (u16 i = 0; i < cia_tmd.GetContentCount(); i++) {
|
||||||
NGLOG_DEBUG(Service_FS, "Content {:x} Offset: 0x{:08x} bytes", i, GetContentOffset(i));
|
LOG_DEBUG(Service_FS, "Content {:x} Offset: 0x{:08x} bytes", i, GetContentOffset(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
@ -67,7 +67,7 @@ u32 DiskDirectory::Read(const u32 count, Entry* entries) {
|
|||||||
const std::string& filename = file.virtualName;
|
const std::string& filename = file.virtualName;
|
||||||
Entry& entry = entries[entries_read];
|
Entry& entry = entries[entries_read];
|
||||||
|
|
||||||
NGLOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
|
LOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
|
||||||
|
|
||||||
// TODO(Link Mauve): use a proper conversion to UTF-16.
|
// TODO(Link Mauve): use a proper conversion to UTF-16.
|
||||||
for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
|
for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
if (delay_generator != nullptr) {
|
if (delay_generator != nullptr) {
|
||||||
return delay_generator->GetReadDelayNs(length);
|
return delay_generator->GetReadDelayNs(length);
|
||||||
}
|
}
|
||||||
NGLOG_ERROR(Service_FS, "Delay generator was not initalized. Using default");
|
LOG_ERROR(Service_FS, "Delay generator was not initalized. Using default");
|
||||||
delay_generator = std::make_unique<DefaultDelayGenerator>();
|
delay_generator = std::make_unique<DefaultDelayGenerator>();
|
||||||
return delay_generator->GetReadDelayNs(length);
|
return delay_generator->GetReadDelayNs(length);
|
||||||
}
|
}
|
||||||
|
@ -29,50 +29,47 @@ ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::DeleteFile(const Path& path) const {
|
ResultCode IVFCArchive::DeleteFile(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive ({}).", GetName());
|
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive ({}).", GetName());
|
||||||
// TODO(Subv): Verify error code
|
// TODO(Subv): Verify error code
|
||||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||||
ErrorLevel::Status);
|
ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
ResultCode IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).", GetName());
|
||||||
GetName());
|
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::DeleteDirectory(const Path& path) const {
|
ResultCode IVFCArchive::DeleteDirectory(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
|
||||||
GetName());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::DeleteDirectoryRecursively(const Path& path) const {
|
ResultCode IVFCArchive::DeleteDirectoryRecursively(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
|
||||||
GetName());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const {
|
ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive ({}).", GetName());
|
LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive ({}).", GetName());
|
||||||
// TODO: Verify error code
|
// TODO: Verify error code
|
||||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
||||||
ErrorLevel::Permanent);
|
ErrorLevel::Permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::CreateDirectory(const Path& path) const {
|
ResultCode IVFCArchive::CreateDirectory(const Path& path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive ({}).", GetName());
|
||||||
GetName());
|
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
ResultCode IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
||||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).",
|
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).", GetName());
|
||||||
GetName());
|
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
@ -82,7 +79,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> IVFCArchive::OpenDirectory(const Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
u64 IVFCArchive::GetFreeBytes() const {
|
u64 IVFCArchive::GetFreeBytes() const {
|
||||||
NGLOG_WARNING(Service_FS, "Attempted to get the free space in an IVFC archive");
|
LOG_WARNING(Service_FS, "Attempted to get the free space in an IVFC archive");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +92,7 @@ IVFCFile::IVFCFile(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||||
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
||||||
romfs_file->Seek(data_offset + offset, SEEK_SET);
|
romfs_file->Seek(data_offset + offset, SEEK_SET);
|
||||||
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
|
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
|
||||||
|
|
||||||
@ -104,7 +101,7 @@ ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buff
|
|||||||
|
|
||||||
ResultVal<size_t> IVFCFile::Write(const u64 offset, const size_t length, const bool flush,
|
ResultVal<size_t> IVFCFile::Write(const u64 offset, const size_t length, const bool flush,
|
||||||
const u8* buffer) {
|
const u8* buffer) {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to write to IVFC file");
|
LOG_ERROR(Service_FS, "Attempted to write to IVFC file");
|
||||||
// TODO(Subv): Find error code
|
// TODO(Subv): Find error code
|
||||||
return MakeResult<size_t>(0);
|
return MakeResult<size_t>(0);
|
||||||
}
|
}
|
||||||
@ -114,7 +111,7 @@ u64 IVFCFile::GetSize() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IVFCFile::SetSize(const u64 size) const {
|
bool IVFCFile::SetSize(const u64 size) const {
|
||||||
NGLOG_ERROR(Service_FS, "Attempted to set the size of an IVFC file");
|
LOG_ERROR(Service_FS, "Attempted to set the size of an IVFC file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,11 +110,11 @@ Loader::ResultStatus NCCHContainer::OpenFile(const std::string& filepath, u32 nc
|
|||||||
file = FileUtil::IOFile(filepath, "rb");
|
file = FileUtil::IOFile(filepath, "rb");
|
||||||
|
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
NGLOG_WARNING(Service_FS, "Failed to open {}", filepath);
|
LOG_WARNING(Service_FS, "Failed to open {}", filepath);
|
||||||
return Loader::ResultStatus::Error;
|
return Loader::ResultStatus::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Opened {}", filepath);
|
LOG_DEBUG(Service_FS, "Opened {}", filepath);
|
||||||
return Loader::ResultStatus::Success;
|
return Loader::ResultStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||||||
|
|
||||||
// Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)...
|
// Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)...
|
||||||
if (Loader::MakeMagic('N', 'C', 'S', 'D') == ncch_header.magic) {
|
if (Loader::MakeMagic('N', 'C', 'S', 'D') == ncch_header.magic) {
|
||||||
NGLOG_DEBUG(Service_FS, "Only loading the first (bootable) NCCH within the NCSD file!");
|
LOG_DEBUG(Service_FS, "Only loading the first (bootable) NCCH within the NCSD file!");
|
||||||
ncch_offset += 0x4000;
|
ncch_offset += 0x4000;
|
||||||
file.Seek(ncch_offset, SEEK_SET);
|
file.Seek(ncch_offset, SEEK_SET);
|
||||||
file.ReadBytes(&ncch_header, sizeof(NCCH_Header));
|
file.ReadBytes(&ncch_header, sizeof(NCCH_Header));
|
||||||
@ -159,24 +159,23 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||||||
u8 resource_limit_category =
|
u8 resource_limit_category =
|
||||||
exheader_header.arm11_system_local_caps.resource_limit_category;
|
exheader_header.arm11_system_local_caps.resource_limit_category;
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Name: {}",
|
LOG_DEBUG(Service_FS, "Name: {}",
|
||||||
exheader_header.codeset_info.name);
|
exheader_header.codeset_info.name);
|
||||||
NGLOG_DEBUG(Service_FS, "Program ID: {:016X}", ncch_header.program_id);
|
LOG_DEBUG(Service_FS, "Program ID: {:016X}", ncch_header.program_id);
|
||||||
NGLOG_DEBUG(Service_FS, "Code compressed: {}",
|
LOG_DEBUG(Service_FS, "Code compressed: {}", is_compressed ? "yes" : "no");
|
||||||
is_compressed ? "yes" : "no");
|
LOG_DEBUG(Service_FS, "Entry point: 0x{:08X}", entry_point);
|
||||||
NGLOG_DEBUG(Service_FS, "Entry point: 0x{:08X}", entry_point);
|
LOG_DEBUG(Service_FS, "Code size: 0x{:08X}", code_size);
|
||||||
NGLOG_DEBUG(Service_FS, "Code size: 0x{:08X}", code_size);
|
LOG_DEBUG(Service_FS, "Stack size: 0x{:08X}", stack_size);
|
||||||
NGLOG_DEBUG(Service_FS, "Stack size: 0x{:08X}", stack_size);
|
LOG_DEBUG(Service_FS, "Bss size: 0x{:08X}", bss_size);
|
||||||
NGLOG_DEBUG(Service_FS, "Bss size: 0x{:08X}", bss_size);
|
LOG_DEBUG(Service_FS, "Core version: {}", core_version);
|
||||||
NGLOG_DEBUG(Service_FS, "Core version: {}", core_version);
|
LOG_DEBUG(Service_FS, "Thread priority: 0x{:X}", priority);
|
||||||
NGLOG_DEBUG(Service_FS, "Thread priority: 0x{:X}", priority);
|
LOG_DEBUG(Service_FS, "Resource limit category: {}", resource_limit_category);
|
||||||
NGLOG_DEBUG(Service_FS, "Resource limit category: {}", resource_limit_category);
|
LOG_DEBUG(Service_FS, "System Mode: {}",
|
||||||
NGLOG_DEBUG(Service_FS, "System Mode: {}",
|
static_cast<int>(exheader_header.arm11_system_local_caps.system_mode));
|
||||||
static_cast<int>(exheader_header.arm11_system_local_caps.system_mode));
|
|
||||||
|
|
||||||
if (exheader_header.system_info.jump_id != ncch_header.program_id) {
|
if (exheader_header.system_info.jump_id != ncch_header.program_id) {
|
||||||
NGLOG_ERROR(Service_FS,
|
LOG_ERROR(Service_FS,
|
||||||
"ExHeader Program ID mismatch: the ROM is probably encrypted.");
|
"ExHeader Program ID mismatch: the ROM is probably encrypted.");
|
||||||
return Loader::ResultStatus::ErrorEncrypted;
|
return Loader::ResultStatus::ErrorEncrypted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +187,8 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||||||
exefs_offset = ncch_header.exefs_offset * kBlockSize;
|
exefs_offset = ncch_header.exefs_offset * kBlockSize;
|
||||||
u32 exefs_size = ncch_header.exefs_size * kBlockSize;
|
u32 exefs_size = ncch_header.exefs_size * kBlockSize;
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "ExeFS offset: 0x{:08X}", exefs_offset);
|
LOG_DEBUG(Service_FS, "ExeFS offset: 0x{:08X}", exefs_offset);
|
||||||
NGLOG_DEBUG(Service_FS, "ExeFS size: 0x{:08X}", exefs_size);
|
LOG_DEBUG(Service_FS, "ExeFS size: 0x{:08X}", exefs_size);
|
||||||
|
|
||||||
file.Seek(exefs_offset + ncch_offset, SEEK_SET);
|
file.Seek(exefs_offset + ncch_offset, SEEK_SET);
|
||||||
if (file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header))
|
if (file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header))
|
||||||
@ -227,7 +226,7 @@ Loader::ResultStatus NCCHContainer::LoadOverrides() {
|
|||||||
exefs_file = FileUtil::IOFile(exefs_override, "rb");
|
exefs_file = FileUtil::IOFile(exefs_override, "rb");
|
||||||
|
|
||||||
if (exefs_file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) == sizeof(ExeFs_Header)) {
|
if (exefs_file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) == sizeof(ExeFs_Header)) {
|
||||||
NGLOG_DEBUG(Service_FS, "Loading ExeFS section from {}", exefs_override);
|
LOG_DEBUG(Service_FS, "Loading ExeFS section from {}", exefs_override);
|
||||||
exefs_offset = 0;
|
exefs_offset = 0;
|
||||||
is_tainted = true;
|
is_tainted = true;
|
||||||
has_exefs = true;
|
has_exefs = true;
|
||||||
@ -239,9 +238,9 @@ Loader::ResultStatus NCCHContainer::LoadOverrides() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_tainted)
|
if (is_tainted)
|
||||||
NGLOG_WARNING(Service_FS,
|
LOG_WARNING(Service_FS,
|
||||||
"Loaded NCCH {} is tainted, application behavior may not be as expected!",
|
"Loaded NCCH {} is tainted, application behavior may not be as expected!",
|
||||||
filepath);
|
filepath);
|
||||||
|
|
||||||
return Loader::ResultStatus::Success;
|
return Loader::ResultStatus::Success;
|
||||||
}
|
}
|
||||||
@ -267,12 +266,12 @@ Loader::ResultStatus NCCHContainer::LoadSectionExeFS(const char* name, std::vect
|
|||||||
file.Seek(ncch_offset + logo_offset, SEEK_SET);
|
file.Seek(ncch_offset + logo_offset, SEEK_SET);
|
||||||
|
|
||||||
if (file.ReadBytes(buffer.data(), logo_size) != logo_size) {
|
if (file.ReadBytes(buffer.data(), logo_size) != logo_size) {
|
||||||
NGLOG_ERROR(Service_FS, "Could not read NCCH logo");
|
LOG_ERROR(Service_FS, "Could not read NCCH logo");
|
||||||
return Loader::ResultStatus::Error;
|
return Loader::ResultStatus::Error;
|
||||||
}
|
}
|
||||||
return Loader::ResultStatus::Success;
|
return Loader::ResultStatus::Success;
|
||||||
} else {
|
} else {
|
||||||
NGLOG_INFO(Service_FS, "Attempting to load logo from the ExeFS");
|
LOG_INFO(Service_FS, "Attempting to load logo from the ExeFS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,15 +279,15 @@ Loader::ResultStatus NCCHContainer::LoadSectionExeFS(const char* name, std::vect
|
|||||||
if (!exefs_file.IsOpen())
|
if (!exefs_file.IsOpen())
|
||||||
return Loader::ResultStatus::Error;
|
return Loader::ResultStatus::Error;
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "{} sections:", kMaxSections);
|
LOG_DEBUG(Service_FS, "{} sections:", kMaxSections);
|
||||||
// Iterate through the ExeFs archive until we find a section with the specified name...
|
// Iterate through the ExeFs archive until we find a section with the specified name...
|
||||||
for (unsigned section_number = 0; section_number < kMaxSections; section_number++) {
|
for (unsigned section_number = 0; section_number < kMaxSections; section_number++) {
|
||||||
const auto& section = exefs_header.section[section_number];
|
const auto& section = exefs_header.section[section_number];
|
||||||
|
|
||||||
// Load the specified section...
|
// Load the specified section...
|
||||||
if (strcmp(section.name, name) == 0) {
|
if (strcmp(section.name, name) == 0) {
|
||||||
NGLOG_DEBUG(Service_FS, "{} - offset: 0x{:08X}, size: 0x{:08X}, name: {}",
|
LOG_DEBUG(Service_FS, "{} - offset: 0x{:08X}, size: 0x{:08X}, name: {}", section_number,
|
||||||
section_number, section.offset, section.size, section.name);
|
section.offset, section.size, section.name);
|
||||||
|
|
||||||
s64 section_offset =
|
s64 section_offset =
|
||||||
(section.offset + exefs_offset + sizeof(ExeFs_Header) + ncch_offset);
|
(section.offset + exefs_offset + sizeof(ExeFs_Header) + ncch_offset);
|
||||||
@ -348,7 +347,7 @@ Loader::ResultStatus NCCHContainer::LoadOverrideExeFSSection(const char* name,
|
|||||||
|
|
||||||
section_file.Seek(0, SEEK_SET);
|
section_file.Seek(0, SEEK_SET);
|
||||||
if (section_file.ReadBytes(&buffer[0], section_size) == section_size) {
|
if (section_file.ReadBytes(&buffer[0], section_size) == section_size) {
|
||||||
NGLOG_WARNING(Service_FS, "File {} overriding built-in ExeFS file", section_override);
|
LOG_WARNING(Service_FS, "File {} overriding built-in ExeFS file", section_override);
|
||||||
return Loader::ResultStatus::Success;
|
return Loader::ResultStatus::Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,7 +364,7 @@ Loader::ResultStatus NCCHContainer::ReadRomFS(std::shared_ptr<FileUtil::IOFile>&
|
|||||||
return Loader::ResultStatus::Success;
|
return Loader::ResultStatus::Success;
|
||||||
|
|
||||||
if (!has_romfs) {
|
if (!has_romfs) {
|
||||||
NGLOG_DEBUG(Service_FS, "RomFS requested from NCCH which has no RomFS");
|
LOG_DEBUG(Service_FS, "RomFS requested from NCCH which has no RomFS");
|
||||||
return Loader::ResultStatus::ErrorNotUsed;
|
return Loader::ResultStatus::ErrorNotUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,8 +374,8 @@ Loader::ResultStatus NCCHContainer::ReadRomFS(std::shared_ptr<FileUtil::IOFile>&
|
|||||||
u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000;
|
u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000;
|
||||||
u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000;
|
u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000;
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "RomFS offset: 0x{:08X}", romfs_offset);
|
LOG_DEBUG(Service_FS, "RomFS offset: 0x{:08X}", romfs_offset);
|
||||||
NGLOG_DEBUG(Service_FS, "RomFS size: 0x{:08X}", romfs_size);
|
LOG_DEBUG(Service_FS, "RomFS size: 0x{:08X}", romfs_size);
|
||||||
|
|
||||||
if (file.GetSize() < romfs_offset + romfs_size)
|
if (file.GetSize() < romfs_offset + romfs_size)
|
||||||
return Loader::ResultStatus::Error;
|
return Loader::ResultStatus::Error;
|
||||||
@ -399,7 +398,7 @@ Loader::ResultStatus NCCHContainer::ReadOverrideRomFS(std::shared_ptr<FileUtil::
|
|||||||
if (FileUtil::Exists(split_filepath)) {
|
if (FileUtil::Exists(split_filepath)) {
|
||||||
romfs_file = std::make_shared<FileUtil::IOFile>(split_filepath, "rb");
|
romfs_file = std::make_shared<FileUtil::IOFile>(split_filepath, "rb");
|
||||||
if (romfs_file->IsOpen()) {
|
if (romfs_file->IsOpen()) {
|
||||||
NGLOG_WARNING(Service_FS, "File {} overriding built-in RomFS", split_filepath);
|
LOG_WARNING(Service_FS, "File {} overriding built-in RomFS", split_filepath);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
size = romfs_file->GetSize();
|
size = romfs_file->GetSize();
|
||||||
return Loader::ResultStatus::Success;
|
return Loader::ResultStatus::Success;
|
||||||
|
@ -29,22 +29,22 @@ public:
|
|||||||
|
|
||||||
ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& path,
|
ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& path,
|
||||||
const Mode& mode) const {
|
const Mode& mode) const {
|
||||||
NGLOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
LOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
||||||
|
|
||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.hex == 0) {
|
if (mode.hex == 0) {
|
||||||
NGLOG_ERROR(Service_FS, "Empty open mode");
|
LOG_ERROR(Service_FS, "Empty open mode");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.create_flag && !mode.write_flag) {
|
if (mode.create_flag && !mode.write_flag) {
|
||||||
NGLOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
LOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,19 +52,19 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
if (!mode.create_flag) {
|
if (!mode.create_flag) {
|
||||||
NGLOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
||||||
full_path);
|
full_path);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
// Create the file
|
// Create the file
|
||||||
@ -77,7 +77,7 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
|
|||||||
|
|
||||||
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,15 +98,15 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
NGLOG_ERROR(Service_FS, "File not found {}", full_path);
|
LOG_ERROR(Service_FS, "File not found {}", full_path);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -116,7 +116,7 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,14 +125,14 @@ ResultCode SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_pa
|
|||||||
|
|
||||||
// TODO: Verify these return codes with HW
|
// TODO: Verify these return codes with HW
|
||||||
if (!path_parser_src.IsValid()) {
|
if (!path_parser_src.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PathParser path_parser_dest(dest_path);
|
const PathParser path_parser_dest(dest_path);
|
||||||
|
|
||||||
if (!path_parser_dest.IsValid()) {
|
if (!path_parser_dest.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,15 +166,15 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file or directory {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file or directory {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -184,7 +184,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
LOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
||||||
return ERROR_DIRECTORY_NOT_EMPTY;
|
return ERROR_DIRECTORY_NOT_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,17 +209,17 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||||
return ERROR_FILE_ALREADY_EXISTS;
|
return ERROR_FILE_ALREADY_EXISTS;
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -237,7 +237,7 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Service_FS, "Too large file");
|
LOG_ERROR(Service_FS, "Too large file");
|
||||||
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
|
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
|
||||||
ErrorLevel::Info);
|
ErrorLevel::Info);
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,17 +254,17 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||||
return ERROR_DIRECTORY_ALREADY_EXISTS;
|
return ERROR_DIRECTORY_ALREADY_EXISTS;
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
@ -274,7 +274,7 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
|
||||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||||
ErrorLevel::Status);
|
ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
@ -284,14 +284,14 @@ ResultCode SaveDataArchive::RenameDirectory(const Path& src_path, const Path& de
|
|||||||
|
|
||||||
// TODO: Verify these return codes with HW
|
// TODO: Verify these return codes with HW
|
||||||
if (!path_parser_src.IsValid()) {
|
if (!path_parser_src.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PathParser path_parser_dest(dest_path);
|
const PathParser path_parser_dest(dest_path);
|
||||||
|
|
||||||
if (!path_parser_dest.IsValid()) {
|
if (!path_parser_dest.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
|
|||||||
const PathParser path_parser(path);
|
const PathParser path_parser(path);
|
||||||
|
|
||||||
if (!path_parser.IsValid()) {
|
if (!path_parser.IsValid()) {
|
||||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||||
return ERROR_INVALID_PATH;
|
return ERROR_INVALID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,15 +321,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
|
|||||||
|
|
||||||
switch (path_parser.GetHostStatus(mount_point)) {
|
switch (path_parser.GetHostStatus(mount_point)) {
|
||||||
case PathParser::InvalidMountPoint:
|
case PathParser::InvalidMountPoint:
|
||||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||||
return ERROR_FILE_NOT_FOUND;
|
return ERROR_FILE_NOT_FOUND;
|
||||||
case PathParser::PathNotFound:
|
case PathParser::PathNotFound:
|
||||||
case PathParser::NotFound:
|
case PathParser::NotFound:
|
||||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||||
return ERROR_PATH_NOT_FOUND;
|
return ERROR_PATH_NOT_FOUND;
|
||||||
case PathParser::FileInPath:
|
case PathParser::FileInPath:
|
||||||
case PathParser::FileFound:
|
case PathParser::FileFound:
|
||||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||||
case PathParser::DirectoryFound:
|
case PathParser::DirectoryFound:
|
||||||
break; // Expected 'success' case
|
break; // Expected 'success' case
|
||||||
|
@ -45,7 +45,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::string& file_path) {
|
|||||||
|
|
||||||
Loader::ResultStatus result = Load(file_data);
|
Loader::ResultStatus result = Load(file_data);
|
||||||
if (result != Loader::ResultStatus::Success)
|
if (result != Loader::ResultStatus::Success)
|
||||||
NGLOG_ERROR(Service_FS, "Failed to load TMD from file {}!", file_path);
|
LOG_ERROR(Service_FS, "Failed to load TMD from file {}!", file_path);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -75,8 +75,8 @@ Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, size_t
|
|||||||
size_t expected_size =
|
size_t expected_size =
|
||||||
body_start + sizeof(Body) + tmd_body.content_count * sizeof(ContentChunk);
|
body_start + sizeof(Body) + tmd_body.content_count * sizeof(ContentChunk);
|
||||||
if (total_size < expected_size) {
|
if (total_size < expected_size) {
|
||||||
NGLOG_ERROR(Service_FS, "Malformed TMD, expected size 0x{:x}, got 0x{:x}!", expected_size,
|
LOG_ERROR(Service_FS, "Malformed TMD, expected size 0x{:x}, got 0x{:x}!", expected_size,
|
||||||
total_size);
|
total_size);
|
||||||
return Loader::ResultStatus::ErrorInvalidFormat;
|
return Loader::ResultStatus::ErrorInvalidFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,17 +209,17 @@ void TitleMetadata::AddContentChunk(const ContentChunk& chunk) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TitleMetadata::Print() const {
|
void TitleMetadata::Print() const {
|
||||||
NGLOG_DEBUG(Service_FS, "{} chunks", static_cast<u32>(tmd_body.content_count));
|
LOG_DEBUG(Service_FS, "{} chunks", static_cast<u32>(tmd_body.content_count));
|
||||||
|
|
||||||
// Content info describes ranges of content chunks
|
// Content info describes ranges of content chunks
|
||||||
NGLOG_DEBUG(Service_FS, "Content info:");
|
LOG_DEBUG(Service_FS, "Content info:");
|
||||||
for (size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
|
for (size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
|
||||||
if (tmd_body.contentinfo[i].command_count == 0)
|
if (tmd_body.contentinfo[i].command_count == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, " Index {:04X}, Command Count {:04X}",
|
LOG_DEBUG(Service_FS, " Index {:04X}, Command Count {:04X}",
|
||||||
static_cast<u32>(tmd_body.contentinfo[i].index),
|
static_cast<u32>(tmd_body.contentinfo[i].index),
|
||||||
static_cast<u32>(tmd_body.contentinfo[i].command_count));
|
static_cast<u32>(tmd_body.contentinfo[i].command_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
// For each content info, print their content chunk range
|
// For each content info, print their content chunk range
|
||||||
@ -230,16 +230,16 @@ void TitleMetadata::Print() const {
|
|||||||
if (count == 0)
|
if (count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "Content chunks for content info index {}:", i);
|
LOG_DEBUG(Service_FS, "Content chunks for content info index {}:", i);
|
||||||
for (u16 j = index; j < index + count; j++) {
|
for (u16 j = index; j < index + count; j++) {
|
||||||
// Don't attempt to print content we don't have
|
// Don't attempt to print content we don't have
|
||||||
if (j > tmd_body.content_count)
|
if (j > tmd_body.content_count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const ContentChunk& chunk = tmd_chunks[j];
|
const ContentChunk& chunk = tmd_chunks[j];
|
||||||
NGLOG_DEBUG(Service_FS, " ID {:08X}, Index {:04X}, Type {:04x}, Size {:016X}",
|
LOG_DEBUG(Service_FS, " ID {:08X}, Index {:04X}, Type {:04x}, Size {:016X}",
|
||||||
static_cast<u32>(chunk.id), static_cast<u32>(chunk.index),
|
static_cast<u32>(chunk.id), static_cast<u32>(chunk.index),
|
||||||
static_cast<u32>(chunk.type), static_cast<u64>(chunk.size));
|
static_cast<u32>(chunk.type), static_cast<u64>(chunk.size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ std::unique_ptr<CameraInterface> CreateCamera(const std::string& name, const std
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name != "blank") {
|
if (name != "blank") {
|
||||||
NGLOG_ERROR(Service_CAM, "Unknown camera {}", name);
|
LOG_ERROR(Service_CAM, "Unknown camera {}", name);
|
||||||
}
|
}
|
||||||
return std::make_unique<BlankCamera>();
|
return std::make_unique<BlankCamera>();
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ std::unique_ptr<CameraInterface> CreateCameraPreview(const std::string& name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name != "blank") {
|
if (name != "blank") {
|
||||||
NGLOG_ERROR(Service_CAM, "Unknown camera {}", name);
|
LOG_ERROR(Service_CAM, "Unknown camera {}", name);
|
||||||
}
|
}
|
||||||
return std::make_unique<BlankCamera>();
|
return std::make_unique<BlankCamera>();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
* @param flip The image flip to apply
|
* @param flip The image flip to apply
|
||||||
* @returns a unique_ptr to the created camera object.
|
* @returns a unique_ptr to the created camera object.
|
||||||
* Note: The default implementation for this is to call Create(). Derived classes may have other
|
* Note: The default implementation for this is to call Create(). Derived classes may have other
|
||||||
* Implementations. For example, A dialog may be used instead of NGLOG_ERROR when error
|
* Implementations. For example, A dialog may be used instead of LOG_ERROR when error
|
||||||
* occurs.
|
* occurs.
|
||||||
*/
|
*/
|
||||||
virtual std::unique_ptr<CameraInterface> CreatePreview(const std::string& config, int width,
|
virtual std::unique_ptr<CameraInterface> CreatePreview(const std::string& config, int width,
|
||||||
|
@ -59,7 +59,7 @@ template <typename InputDeviceType>
|
|||||||
void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDeviceType>> factory) {
|
void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDeviceType>> factory) {
|
||||||
auto pair = std::make_pair(name, std::move(factory));
|
auto pair = std::make_pair(name, std::move(factory));
|
||||||
if (!Impl::FactoryList<InputDeviceType>::list.insert(std::move(pair)).second) {
|
if (!Impl::FactoryList<InputDeviceType>::list.insert(std::move(pair)).second) {
|
||||||
NGLOG_ERROR(Input, "Factory {} already registered", name);
|
LOG_ERROR(Input, "Factory {} already registered", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDevic
|
|||||||
template <typename InputDeviceType>
|
template <typename InputDeviceType>
|
||||||
void UnregisterFactory(const std::string& name) {
|
void UnregisterFactory(const std::string& name) {
|
||||||
if (Impl::FactoryList<InputDeviceType>::list.erase(name) == 0) {
|
if (Impl::FactoryList<InputDeviceType>::list.erase(name) == 0) {
|
||||||
NGLOG_ERROR(Input, "Factory {} not registered", name);
|
LOG_ERROR(Input, "Factory {} not registered", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ std::unique_ptr<InputDeviceType> CreateDevice(const std::string& params) {
|
|||||||
const auto pair = factory_list.find(engine);
|
const auto pair = factory_list.find(engine);
|
||||||
if (pair == factory_list.end()) {
|
if (pair == factory_list.end()) {
|
||||||
if (engine != "null") {
|
if (engine != "null") {
|
||||||
NGLOG_ERROR(Input, "Unknown engine name: {}", engine);
|
LOG_ERROR(Input, "Unknown engine name: {}", engine);
|
||||||
}
|
}
|
||||||
return std::make_unique<InputDeviceType>();
|
return std::make_unique<InputDeviceType>();
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ static u8 HexCharToValue(u8 hex) {
|
|||||||
return hex - 'A' + 0xA;
|
return hex - 'A' + 0xA;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Debug_GDBStub, "Invalid nibble: {:c} {:02x}\n", hex, hex);
|
LOG_ERROR(Debug_GDBStub, "Invalid nibble: {:c} {:02x}\n", hex, hex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ static u8 ReadByte() {
|
|||||||
u8 c;
|
u8 c;
|
||||||
size_t received_size = recv(gdbserver_socket, reinterpret_cast<char*>(&c), 1, MSG_WAITALL);
|
size_t received_size = recv(gdbserver_socket, reinterpret_cast<char*>(&c), 1, MSG_WAITALL);
|
||||||
if (received_size != 1) {
|
if (received_size != 1) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "recv failed : {}", received_size);
|
LOG_ERROR(Debug_GDBStub, "recv failed : {}", received_size);
|
||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,8 +301,8 @@ static void RemoveBreakpoint(BreakpointType type, PAddr addr) {
|
|||||||
|
|
||||||
auto bp = p.find(addr);
|
auto bp = p.find(addr);
|
||||||
if (bp != p.end()) {
|
if (bp != p.end()) {
|
||||||
NGLOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:08x} bytes at {:08x} of type {}\n",
|
LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:08x} bytes at {:08x} of type {}\n",
|
||||||
bp->second.len, bp->second.addr, static_cast<int>(type));
|
bp->second.len, bp->second.addr, static_cast<int>(type));
|
||||||
p.erase(addr);
|
p.erase(addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,9 +347,9 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) {
|
if (bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) {
|
||||||
NGLOG_DEBUG(Debug_GDBStub,
|
LOG_DEBUG(Debug_GDBStub,
|
||||||
"Found breakpoint type {} @ {:08x}, range: {:08x} - {:08x} ({} bytes)\n",
|
"Found breakpoint type {} @ {:08x}, range: {:08x} - {:08x} ({} bytes)\n",
|
||||||
static_cast<int>(type), addr, bp->second.addr, bp->second.addr + len, len);
|
static_cast<int>(type), addr, bp->second.addr, bp->second.addr + len, len);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) {
|
|||||||
static void SendPacket(const char packet) {
|
static void SendPacket(const char packet) {
|
||||||
size_t sent_size = send(gdbserver_socket, &packet, 1, 0);
|
size_t sent_size = send(gdbserver_socket, &packet, 1, 0);
|
||||||
if (sent_size != 1) {
|
if (sent_size != 1) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "send failed");
|
LOG_ERROR(Debug_GDBStub, "send failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ static void SendReply(const char* reply) {
|
|||||||
|
|
||||||
command_length = static_cast<u32>(strlen(reply));
|
command_length = static_cast<u32>(strlen(reply));
|
||||||
if (command_length + 4 > sizeof(command_buffer)) {
|
if (command_length + 4 > sizeof(command_buffer)) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "command_buffer overflow in SendReply");
|
LOG_ERROR(Debug_GDBStub, "command_buffer overflow in SendReply");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ static void SendReply(const char* reply) {
|
|||||||
while (left > 0) {
|
while (left > 0) {
|
||||||
int sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0);
|
int sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0);
|
||||||
if (sent_size < 0) {
|
if (sent_size < 0) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "gdb: send failed");
|
LOG_ERROR(Debug_GDBStub, "gdb: send failed");
|
||||||
return Shutdown();
|
return Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ static void SendReply(const char* reply) {
|
|||||||
|
|
||||||
/// Handle query command from gdb client.
|
/// Handle query command from gdb client.
|
||||||
static void HandleQuery() {
|
static void HandleQuery() {
|
||||||
NGLOG_DEBUG(Debug_GDBStub, "gdb: query '{}'\n", command_buffer + 1);
|
LOG_DEBUG(Debug_GDBStub, "gdb: query '{}'\n", command_buffer + 1);
|
||||||
|
|
||||||
const char* query = reinterpret_cast<const char*>(command_buffer + 1);
|
const char* query = reinterpret_cast<const char*>(command_buffer + 1);
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ static void SendSignal(u32 signal) {
|
|||||||
std::string buffer =
|
std::string buffer =
|
||||||
Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15,
|
Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15,
|
||||||
htonl(Core::CPU().GetPC()), 13, htonl(Core::CPU().GetReg(13)));
|
htonl(Core::CPU().GetPC()), 13, htonl(Core::CPU().GetReg(13)));
|
||||||
NGLOG_DEBUG(Debug_GDBStub, "Response: {}", buffer);
|
LOG_DEBUG(Debug_GDBStub, "Response: {}", buffer);
|
||||||
SendReply(buffer.c_str());
|
SendReply(buffer.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,18 +467,18 @@ static void ReadCommand() {
|
|||||||
// ignore ack
|
// ignore ack
|
||||||
return;
|
return;
|
||||||
} else if (c == 0x03) {
|
} else if (c == 0x03) {
|
||||||
NGLOG_INFO(Debug_GDBStub, "gdb: found break command\n");
|
LOG_INFO(Debug_GDBStub, "gdb: found break command\n");
|
||||||
halt_loop = true;
|
halt_loop = true;
|
||||||
SendSignal(SIGTRAP);
|
SendSignal(SIGTRAP);
|
||||||
return;
|
return;
|
||||||
} else if (c != GDB_STUB_START) {
|
} else if (c != GDB_STUB_START) {
|
||||||
NGLOG_DEBUG(Debug_GDBStub, "gdb: read invalid byte {:02x}\n", c);
|
LOG_DEBUG(Debug_GDBStub, "gdb: read invalid byte {:02x}\n", c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((c = ReadByte()) != GDB_STUB_END) {
|
while ((c = ReadByte()) != GDB_STUB_END) {
|
||||||
if (command_length >= sizeof(command_buffer)) {
|
if (command_length >= sizeof(command_buffer)) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "gdb: command_buffer overflow\n");
|
LOG_ERROR(Debug_GDBStub, "gdb: command_buffer overflow\n");
|
||||||
SendPacket(GDB_STUB_NACK);
|
SendPacket(GDB_STUB_NACK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -491,7 +491,7 @@ static void ReadCommand() {
|
|||||||
u8 checksum_calculated = CalculateChecksum(command_buffer, command_length);
|
u8 checksum_calculated = CalculateChecksum(command_buffer, command_length);
|
||||||
|
|
||||||
if (checksum_received != checksum_calculated) {
|
if (checksum_received != checksum_calculated) {
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(
|
||||||
Debug_GDBStub,
|
Debug_GDBStub,
|
||||||
"gdb: invalid checksum: calculated {:02x} and read {:02x} for ${}# (length: {})\n",
|
"gdb: invalid checksum: calculated {:02x} and read {:02x} for ${}# (length: {})\n",
|
||||||
checksum_calculated, checksum_received, command_buffer, command_length);
|
checksum_calculated, checksum_received, command_buffer, command_length);
|
||||||
@ -521,7 +521,7 @@ static bool IsDataAvailable() {
|
|||||||
t.tv_usec = 0;
|
t.tv_usec = 0;
|
||||||
|
|
||||||
if (select(gdbserver_socket + 1, &fd_socket, nullptr, nullptr, &t) < 0) {
|
if (select(gdbserver_socket + 1, &fd_socket, nullptr, nullptr, &t) < 0) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "select failed");
|
LOG_ERROR(Debug_GDBStub, "select failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ static void ReadMemory() {
|
|||||||
u32 len =
|
u32 len =
|
||||||
HexToInt(start_offset, static_cast<u32>((command_buffer + command_length) - start_offset));
|
HexToInt(start_offset, static_cast<u32>((command_buffer + command_length) - start_offset));
|
||||||
|
|
||||||
NGLOG_DEBUG(Debug_GDBStub, "gdb: addr: {:08x} len: {:08x}\n", addr, len);
|
LOG_DEBUG(Debug_GDBStub, "gdb: addr: {:08x} len: {:08x}\n", addr, len);
|
||||||
|
|
||||||
if (len * 2 > sizeof(reply)) {
|
if (len * 2 > sizeof(reply)) {
|
||||||
SendReply("E01");
|
SendReply("E01");
|
||||||
@ -739,8 +739,8 @@ static bool CommitBreakpoint(BreakpointType type, PAddr addr, u32 len) {
|
|||||||
breakpoint.len = len;
|
breakpoint.len = len;
|
||||||
p.insert({addr, breakpoint});
|
p.insert({addr, breakpoint});
|
||||||
|
|
||||||
NGLOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:08x} bytes at {:08x}\n",
|
LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:08x} bytes at {:08x}\n",
|
||||||
static_cast<int>(type), breakpoint.len, breakpoint.addr);
|
static_cast<int>(type), breakpoint.len, breakpoint.addr);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -847,7 +847,7 @@ void HandlePacket() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer);
|
LOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer);
|
||||||
|
|
||||||
switch (command_buffer[0]) {
|
switch (command_buffer[0]) {
|
||||||
case 'q':
|
case 'q':
|
||||||
@ -861,7 +861,7 @@ void HandlePacket() {
|
|||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
Shutdown();
|
Shutdown();
|
||||||
NGLOG_INFO(Debug_GDBStub, "killed by gdb");
|
LOG_INFO(Debug_GDBStub, "killed by gdb");
|
||||||
return;
|
return;
|
||||||
case 'g':
|
case 'g':
|
||||||
ReadRegisters();
|
ReadRegisters();
|
||||||
@ -940,7 +940,7 @@ static void Init(u16 port) {
|
|||||||
breakpoints_write.clear();
|
breakpoints_write.clear();
|
||||||
|
|
||||||
// Start gdb server
|
// Start gdb server
|
||||||
NGLOG_INFO(Debug_GDBStub, "Starting GDB server on port {}...", port);
|
LOG_INFO(Debug_GDBStub, "Starting GDB server on port {}...", port);
|
||||||
|
|
||||||
sockaddr_in saddr_server = {};
|
sockaddr_in saddr_server = {};
|
||||||
saddr_server.sin_family = AF_INET;
|
saddr_server.sin_family = AF_INET;
|
||||||
@ -953,28 +953,28 @@ static void Init(u16 port) {
|
|||||||
|
|
||||||
int tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0));
|
int tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0));
|
||||||
if (tmpsock == -1) {
|
if (tmpsock == -1) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "Failed to create gdb socket");
|
LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set socket to SO_REUSEADDR so it can always bind on the same port
|
// Set socket to SO_REUSEADDR so it can always bind on the same port
|
||||||
int reuse_enabled = 1;
|
int reuse_enabled = 1;
|
||||||
if (setsockopt(tmpsock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse_enabled,
|
if (setsockopt(tmpsock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse_enabled,
|
||||||
sizeof(reuse_enabled)) < 0) {
|
sizeof(reuse_enabled)) < 0) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "Failed to set gdb socket option");
|
LOG_ERROR(Debug_GDBStub, "Failed to set gdb socket option");
|
||||||
}
|
}
|
||||||
|
|
||||||
const sockaddr* server_addr = reinterpret_cast<const sockaddr*>(&saddr_server);
|
const sockaddr* server_addr = reinterpret_cast<const sockaddr*>(&saddr_server);
|
||||||
socklen_t server_addrlen = sizeof(saddr_server);
|
socklen_t server_addrlen = sizeof(saddr_server);
|
||||||
if (bind(tmpsock, server_addr, server_addrlen) < 0) {
|
if (bind(tmpsock, server_addr, server_addrlen) < 0) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "Failed to bind gdb socket");
|
LOG_ERROR(Debug_GDBStub, "Failed to bind gdb socket");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listen(tmpsock, 1) < 0) {
|
if (listen(tmpsock, 1) < 0) {
|
||||||
NGLOG_ERROR(Debug_GDBStub, "Failed to listen to gdb socket");
|
LOG_ERROR(Debug_GDBStub, "Failed to listen to gdb socket");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for gdb to connect
|
// Wait for gdb to connect
|
||||||
NGLOG_INFO(Debug_GDBStub, "Waiting for gdb to connect...\n");
|
LOG_INFO(Debug_GDBStub, "Waiting for gdb to connect...\n");
|
||||||
sockaddr_in saddr_client;
|
sockaddr_in saddr_client;
|
||||||
sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client);
|
sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client);
|
||||||
socklen_t client_addrlen = sizeof(saddr_client);
|
socklen_t client_addrlen = sizeof(saddr_client);
|
||||||
@ -985,9 +985,9 @@ static void Init(u16 port) {
|
|||||||
halt_loop = false;
|
halt_loop = false;
|
||||||
step_loop = false;
|
step_loop = false;
|
||||||
|
|
||||||
NGLOG_ERROR(Debug_GDBStub, "Failed to accept gdb client");
|
LOG_ERROR(Debug_GDBStub, "Failed to accept gdb client");
|
||||||
} else {
|
} else {
|
||||||
NGLOG_INFO(Debug_GDBStub, "Client connected.\n");
|
LOG_INFO(Debug_GDBStub, "Client connected.\n");
|
||||||
saddr_client.sin_addr.s_addr = ntohl(saddr_client.sin_addr.s_addr);
|
saddr_client.sin_addr.s_addr = ntohl(saddr_client.sin_addr.s_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,7 +1006,7 @@ void Shutdown() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_INFO(Debug_GDBStub, "Stopping GDB ...");
|
LOG_INFO(Debug_GDBStub, "Stopping GDB ...");
|
||||||
if (gdbserver_socket != -1) {
|
if (gdbserver_socket != -1) {
|
||||||
shutdown(gdbserver_socket, SHUT_RDWR);
|
shutdown(gdbserver_socket, SHUT_RDWR);
|
||||||
gdbserver_socket = -1;
|
gdbserver_socket = -1;
|
||||||
@ -1016,7 +1016,7 @@ void Shutdown() {
|
|||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NGLOG_INFO(Debug_GDBStub, "GDB stopped.");
|
LOG_INFO(Debug_GDBStub, "GDB stopped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsServerEnabled() {
|
bool IsServerEnabled() {
|
||||||
|
@ -62,7 +62,7 @@ ResultCode Applet::Create(Service::APT::AppletId id,
|
|||||||
applets[id] = std::make_shared<Mint>(id, std::move(manager));
|
applets[id] = std::make_shared<Mint>(id, std::move(manager));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Service_APT, "Could not create applet {}", static_cast<u32>(id));
|
LOG_ERROR(Service_APT, "Could not create applet {}", static_cast<u32>(id));
|
||||||
// TODO(Subv): Find the right error code
|
// TODO(Subv): Find the right error code
|
||||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet,
|
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet,
|
||||||
ErrorSummary::NotSupported, ErrorLevel::Permanent);
|
ErrorSummary::NotSupported, ErrorLevel::Permanent);
|
||||||
@ -114,7 +114,7 @@ void Applet::SendParameter(const Service::APT::MessageParameter& parameter) {
|
|||||||
if (auto locked = manager.lock()) {
|
if (auto locked = manager.lock()) {
|
||||||
locked->CancelAndSendParameter(parameter);
|
locked->CancelAndSendParameter(parameter);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_APT, "called after destructing applet manager");
|
LOG_ERROR(Service_APT, "called after destructing applet manager");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ namespace Applets {
|
|||||||
|
|
||||||
ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
|
ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
|
||||||
if (parameter.signal != Service::APT::SignalType::Request) {
|
if (parameter.signal != Service::APT::SignalType::Request) {
|
||||||
NGLOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
LOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
// TODO(Subv): Find the right error code
|
// TODO(Subv): Find the right error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
|
@ -19,7 +19,7 @@ namespace Applets {
|
|||||||
|
|
||||||
ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
|
ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
|
||||||
if (parameter.signal != Service::APT::SignalType::Request) {
|
if (parameter.signal != Service::APT::SignalType::Request) {
|
||||||
NGLOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
LOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
// TODO(Subv): Find the right error code
|
// TODO(Subv): Find the right error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
|
@ -11,7 +11,7 @@ namespace Applets {
|
|||||||
|
|
||||||
ResultCode Mint::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
|
ResultCode Mint::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
|
||||||
if (parameter.signal != Service::APT::SignalType::Request) {
|
if (parameter.signal != Service::APT::SignalType::Request) {
|
||||||
NGLOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
LOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
// TODO(Subv): Find the right error code
|
// TODO(Subv): Find the right error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
|
@ -22,7 +22,7 @@ namespace Applets {
|
|||||||
|
|
||||||
ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter const& parameter) {
|
ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter const& parameter) {
|
||||||
if (parameter.signal != Service::APT::SignalType::Request) {
|
if (parameter.signal != Service::APT::SignalType::Request) {
|
||||||
NGLOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
LOG_ERROR(Service_APT, "unsupported signal {}", static_cast<u32>(parameter.signal));
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
// TODO(Subv): Find the right error code
|
// TODO(Subv): Find the right error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
|
@ -135,7 +135,7 @@ ResultCode AddressArbiter::ArbitrateAddress(SharedPtr<Thread> thread, Arbitratio
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel, "unknown type={}", static_cast<u32>(type));
|
LOG_ERROR(Kernel, "unknown type={}", static_cast<u32>(type));
|
||||||
return ERR_INVALID_ENUM_VALUE_FND;
|
return ERR_INVALID_ENUM_VALUE_FND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
|
|||||||
|
|
||||||
u16 slot = next_free_slot;
|
u16 slot = next_free_slot;
|
||||||
if (slot >= generations.size()) {
|
if (slot >= generations.size()) {
|
||||||
NGLOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
|
LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
|
||||||
return ERR_OUT_OF_HANDLES;
|
return ERR_OUT_OF_HANDLES;
|
||||||
}
|
}
|
||||||
next_free_slot = generations[slot];
|
next_free_slot = generations[slot];
|
||||||
@ -47,7 +47,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
|
|||||||
ResultVal<Handle> HandleTable::Duplicate(Handle handle) {
|
ResultVal<Handle> HandleTable::Duplicate(Handle handle) {
|
||||||
SharedPtr<Object> object = GetGeneric(handle);
|
SharedPtr<Object> object = GetGeneric(handle);
|
||||||
if (object == nullptr) {
|
if (object == nullptr) {
|
||||||
NGLOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle);
|
LOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle);
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
return Create(std::move(object));
|
return Create(std::move(object));
|
||||||
|
@ -115,8 +115,8 @@ void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mappin
|
|||||||
|
|
||||||
VAddr mapping_limit = mapping.address + mapping.size;
|
VAddr mapping_limit = mapping.address + mapping.size;
|
||||||
if (mapping_limit < mapping.address) {
|
if (mapping_limit < mapping.address) {
|
||||||
NGLOG_CRITICAL(Loader, "Mapping size overflowed: address=0x{:08X} size=0x{:X}",
|
LOG_CRITICAL(Loader, "Mapping size overflowed: address=0x{:08X} size=0x{:X}",
|
||||||
mapping.address, mapping.size);
|
mapping.address, mapping.size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,17 +126,17 @@ void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mappin
|
|||||||
mapping_limit <= area.vaddr_base + area.size;
|
mapping_limit <= area.vaddr_base + area.size;
|
||||||
});
|
});
|
||||||
if (area == std::end(memory_areas)) {
|
if (area == std::end(memory_areas)) {
|
||||||
NGLOG_ERROR(Loader,
|
LOG_ERROR(Loader,
|
||||||
"Unhandled special mapping: address=0x{:08X} size=0x{:X}"
|
"Unhandled special mapping: address=0x{:08X} size=0x{:X}"
|
||||||
" read_only={} unk_flag={}",
|
" read_only={} unk_flag={}",
|
||||||
mapping.address, mapping.size, mapping.read_only, mapping.unk_flag);
|
mapping.address, mapping.size, mapping.read_only, mapping.unk_flag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 offset_into_region = mapping.address - area->vaddr_base;
|
u32 offset_into_region = mapping.address - area->vaddr_base;
|
||||||
if (area->paddr_base == IO_AREA_PADDR) {
|
if (area->paddr_base == IO_AREA_PADDR) {
|
||||||
NGLOG_ERROR(Loader, "MMIO mappings are not supported yet. phys_addr=0x{:08X}",
|
LOG_ERROR(Loader, "MMIO mappings are not supported yet. phys_addr=0x{:08X}",
|
||||||
area->paddr_base + offset_into_region);
|
area->paddr_base + offset_into_region);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ ResultCode Mutex::Release(Thread* thread) {
|
|||||||
// We can only release the mutex if it's held by the calling thread.
|
// We can only release the mutex if it's held by the calling thread.
|
||||||
if (thread != holding_thread) {
|
if (thread != holding_thread) {
|
||||||
if (holding_thread) {
|
if (holding_thread) {
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(
|
||||||
Kernel,
|
Kernel,
|
||||||
"Tried to release a mutex (owned by thread id {}) from a different thread id {}",
|
"Tried to release a mutex (owned by thread id {}) from a different thread id {}",
|
||||||
holding_thread->thread_id, thread->thread_id);
|
holding_thread->thread_id, thread->thread_id);
|
||||||
|
@ -56,7 +56,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
|
|||||||
continue;
|
continue;
|
||||||
} else if ((type & 0xF00) == 0xE00) { // 0x0FFF
|
} else if ((type & 0xF00) == 0xE00) { // 0x0FFF
|
||||||
// Allowed interrupts list
|
// Allowed interrupts list
|
||||||
NGLOG_WARNING(Loader, "ExHeader allowed interrupts list ignored");
|
LOG_WARNING(Loader, "ExHeader allowed interrupts list ignored");
|
||||||
} else if ((type & 0xF80) == 0xF00) { // 0x07FF
|
} else if ((type & 0xF80) == 0xF00) { // 0x07FF
|
||||||
// Allowed syscalls mask
|
// Allowed syscalls mask
|
||||||
unsigned int index = ((descriptor >> 24) & 7) * 24;
|
unsigned int index = ((descriptor >> 24) & 7) * 24;
|
||||||
@ -76,7 +76,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
|
|||||||
} else if ((type & 0xFFE) == 0xFF8) { // 0x001F
|
} else if ((type & 0xFFE) == 0xFF8) { // 0x001F
|
||||||
// Mapped memory range
|
// Mapped memory range
|
||||||
if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) {
|
if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) {
|
||||||
NGLOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored.");
|
LOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
u32 end_desc = kernel_caps[i + 1];
|
u32 end_desc = kernel_caps[i + 1];
|
||||||
@ -111,9 +111,9 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
|
|||||||
|
|
||||||
int minor = kernel_version & 0xFF;
|
int minor = kernel_version & 0xFF;
|
||||||
int major = (kernel_version >> 8) & 0xFF;
|
int major = (kernel_version >> 8) & 0xFF;
|
||||||
NGLOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor);
|
LOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor);
|
LOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ SharedPtr<ResourceLimit> ResourceLimit::GetForCategory(ResourceLimitCategory cat
|
|||||||
case ResourceLimitCategory::OTHER:
|
case ResourceLimitCategory::OTHER:
|
||||||
return resource_limits[static_cast<u8>(category)];
|
return resource_limits[static_cast<u8>(category)];
|
||||||
default:
|
default:
|
||||||
NGLOG_CRITICAL(Kernel, "Unknown resource limit category");
|
LOG_CRITICAL(Kernel, "Unknown resource limit category");
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ s32 ResourceLimit::GetCurrentResourceValue(u32 resource) const {
|
|||||||
case CPU_TIME:
|
case CPU_TIME:
|
||||||
return current_cpu_time;
|
return current_cpu_time;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", resource);
|
LOG_ERROR(Kernel, "Unknown resource type={:08X}", resource);
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ u32 ResourceLimit::GetMaxResourceValue(u32 resource) const {
|
|||||||
case CPU_TIME:
|
case CPU_TIME:
|
||||||
return max_cpu_time;
|
return max_cpu_time;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", resource);
|
LOG_ERROR(Kernel, "Unknown resource type={:08X}", resource);
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -106,23 +106,23 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
|
|||||||
|
|
||||||
// Error out if the requested permissions don't match what the creator process allows.
|
// Error out if the requested permissions don't match what the creator process allows.
|
||||||
if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) {
|
if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) {
|
||||||
NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
|
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
|
||||||
GetObjectId(), address, name);
|
GetObjectId(), address, name);
|
||||||
return ERR_INVALID_COMBINATION;
|
return ERR_INVALID_COMBINATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heap-backed memory blocks can not be mapped with other_permissions = DontCare
|
// Heap-backed memory blocks can not be mapped with other_permissions = DontCare
|
||||||
if (base_address != 0 && other_permissions == MemoryPermission::DontCare) {
|
if (base_address != 0 && other_permissions == MemoryPermission::DontCare) {
|
||||||
NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{08X} name={}, permissions don't match",
|
LOG_ERROR(Kernel, "cannot map id={}, address=0x{08X} name={}, permissions don't match",
|
||||||
GetObjectId(), address, name);
|
GetObjectId(), address, name);
|
||||||
return ERR_INVALID_COMBINATION;
|
return ERR_INVALID_COMBINATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error out if the provided permissions are not compatible with what the creator process needs.
|
// Error out if the provided permissions are not compatible with what the creator process needs.
|
||||||
if (other_permissions != MemoryPermission::DontCare &&
|
if (other_permissions != MemoryPermission::DontCare &&
|
||||||
static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
|
static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
|
||||||
NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
|
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
|
||||||
GetObjectId(), address, name);
|
GetObjectId(), address, name);
|
||||||
return ERR_WRONG_PERMISSION;
|
return ERR_WRONG_PERMISSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,8 +137,8 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
|
|||||||
|
|
||||||
if (address != 0) {
|
if (address != 0) {
|
||||||
if (address < Memory::HEAP_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) {
|
if (address < Memory::HEAP_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) {
|
||||||
NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, invalid address",
|
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, invalid address",
|
||||||
GetObjectId(), address, name);
|
GetObjectId(), address, name);
|
||||||
return ERR_INVALID_ADDRESS;
|
return ERR_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
|
|||||||
auto result = target_process->vm_manager.MapMemoryBlock(
|
auto result = target_process->vm_manager.MapMemoryBlock(
|
||||||
target_address, backing_block, backing_block_offset, size, MemoryState::Shared);
|
target_address, backing_block, backing_block_offset, size, MemoryState::Shared);
|
||||||
if (result.Failed()) {
|
if (result.Failed()) {
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(
|
||||||
Kernel,
|
Kernel,
|
||||||
"cannot map id={}, target_address=0x{:08X} name={}, error mapping to virtual memory",
|
"cannot map id={}, target_address=0x{:08X} name={}, error mapping to virtual memory",
|
||||||
GetObjectId(), target_address, name);
|
GetObjectId(), target_address, name);
|
||||||
|
@ -58,10 +58,10 @@ enum ControlMemoryOperation {
|
|||||||
/// Map application or GSP heap memory
|
/// Map application or GSP heap memory
|
||||||
static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size,
|
static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size,
|
||||||
u32 permissions) {
|
u32 permissions) {
|
||||||
NGLOG_DEBUG(Kernel_SVC,
|
LOG_DEBUG(Kernel_SVC,
|
||||||
"called operation=0x{:08X}, addr0=0x{:08X}, addr1=0x{:08X}, "
|
"called operation=0x{:08X}, addr0=0x{:08X}, addr1=0x{:08X}, "
|
||||||
"size=0x{:X}, permissions=0x{:08X}",
|
"size=0x{:X}, permissions=0x{:08X}",
|
||||||
operation, addr0, addr1, size, permissions);
|
operation, addr0, addr1, size, permissions);
|
||||||
|
|
||||||
if ((addr0 & Memory::PAGE_MASK) != 0 || (addr1 & Memory::PAGE_MASK) != 0) {
|
if ((addr0 & Memory::PAGE_MASK) != 0 || (addr1 & Memory::PAGE_MASK) != 0) {
|
||||||
return ERR_MISALIGNED_ADDRESS;
|
return ERR_MISALIGNED_ADDRESS;
|
||||||
@ -74,8 +74,8 @@ static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 add
|
|||||||
operation &= ~MEMOP_REGION_MASK;
|
operation &= ~MEMOP_REGION_MASK;
|
||||||
|
|
||||||
if (region != 0) {
|
if (region != 0) {
|
||||||
NGLOG_WARNING(Kernel_SVC, "ControlMemory with specified region not supported, region={:X}",
|
LOG_WARNING(Kernel_SVC, "ControlMemory with specified region not supported, region={:X}",
|
||||||
region);
|
region);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((permissions & (u32)MemoryPermission::ReadWrite) != permissions) {
|
if ((permissions & (u32)MemoryPermission::ReadWrite) != permissions) {
|
||||||
@ -135,7 +135,7 @@ static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 add
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel_SVC, "unknown operation=0x{:08X}", operation);
|
LOG_ERROR(Kernel_SVC, "unknown operation=0x{:08X}", operation);
|
||||||
return ERR_INVALID_COMBINATION;
|
return ERR_INVALID_COMBINATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 add
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ExitProcess() {
|
static void ExitProcess() {
|
||||||
NGLOG_INFO(Kernel_SVC, "Process {} exiting", g_current_process->process_id);
|
LOG_INFO(Kernel_SVC, "Process {} exiting", g_current_process->process_id);
|
||||||
|
|
||||||
ASSERT_MSG(g_current_process->status == ProcessStatus::Running, "Process has already exited");
|
ASSERT_MSG(g_current_process->status == ProcessStatus::Running, "Process has already exited");
|
||||||
|
|
||||||
@ -176,10 +176,10 @@ static void ExitProcess() {
|
|||||||
|
|
||||||
/// Maps a memory block to specified address
|
/// Maps a memory block to specified address
|
||||||
static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
|
static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
|
||||||
NGLOG_TRACE(Kernel_SVC,
|
LOG_TRACE(Kernel_SVC,
|
||||||
"called memblock=0x{:08X}, addr=0x{:08X}, mypermissions=0x{:08X}, "
|
"called memblock=0x{:08X}, addr=0x{:08X}, mypermissions=0x{:08X}, "
|
||||||
"otherpermission={}",
|
"otherpermission={}",
|
||||||
handle, addr, permissions, other_permissions);
|
handle, addr, permissions, other_permissions);
|
||||||
|
|
||||||
SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(handle);
|
SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(handle);
|
||||||
if (shared_memory == nullptr)
|
if (shared_memory == nullptr)
|
||||||
@ -198,14 +198,14 @@ static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 o
|
|||||||
return shared_memory->Map(g_current_process.get(), addr, permissions_type,
|
return shared_memory->Map(g_current_process.get(), addr, permissions_type,
|
||||||
static_cast<MemoryPermission>(other_permissions));
|
static_cast<MemoryPermission>(other_permissions));
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions);
|
LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERR_INVALID_COMBINATION;
|
return ERR_INVALID_COMBINATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) {
|
static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called memblock=0x{:08X}, addr=0x{:08X}", handle, addr);
|
LOG_TRACE(Kernel_SVC, "called memblock=0x{:08X}, addr=0x{:08X}", handle, addr);
|
||||||
|
|
||||||
// TODO(Subv): Return E0A01BF5 if the address is not in the application's heap
|
// TODO(Subv): Return E0A01BF5 if the address is not in the application's heap
|
||||||
|
|
||||||
@ -227,11 +227,11 @@ static ResultCode ConnectToPort(Handle* out_handle, VAddr port_name_address) {
|
|||||||
if (port_name.size() > PortNameMaxLength)
|
if (port_name.size() > PortNameMaxLength)
|
||||||
return ERR_PORT_NAME_TOO_LONG;
|
return ERR_PORT_NAME_TOO_LONG;
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called port_name={}", port_name);
|
LOG_TRACE(Kernel_SVC, "called port_name={}", port_name);
|
||||||
|
|
||||||
auto it = Service::g_kernel_named_ports.find(port_name);
|
auto it = Service::g_kernel_named_ports.find(port_name);
|
||||||
if (it == Service::g_kernel_named_ports.end()) {
|
if (it == Service::g_kernel_named_ports.end()) {
|
||||||
NGLOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name);
|
LOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name);
|
||||||
return ERR_NOT_FOUND;
|
return ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ static ResultCode SendSyncRequest(Handle handle) {
|
|||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
|
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
|
||||||
|
|
||||||
Core::System::GetInstance().PrepareReschedule();
|
Core::System::GetInstance().PrepareReschedule();
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ static ResultCode SendSyncRequest(Handle handle) {
|
|||||||
|
|
||||||
/// Close a handle
|
/// Close a handle
|
||||||
static ResultCode CloseHandle(Handle handle) {
|
static ResultCode CloseHandle(Handle handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
|
||||||
return g_handle_table.Close(handle);
|
return g_handle_table.Close(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,8 +273,8 @@ static ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds) {
|
|||||||
if (object == nullptr)
|
if (object == nullptr)
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({}:{}), nanoseconds={}", handle,
|
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({}:{}), nanoseconds={}", handle,
|
||||||
object->GetTypeName(), object->GetName(), nano_seconds);
|
object->GetTypeName(), object->GetName(), nano_seconds);
|
||||||
|
|
||||||
if (object->ShouldWait(thread)) {
|
if (object->ShouldWait(thread)) {
|
||||||
|
|
||||||
@ -617,16 +617,15 @@ static ResultCode ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_
|
|||||||
static ResultCode CreateAddressArbiter(Handle* out_handle) {
|
static ResultCode CreateAddressArbiter(Handle* out_handle) {
|
||||||
SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create();
|
SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create();
|
||||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(arbiter)));
|
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(arbiter)));
|
||||||
NGLOG_TRACE(Kernel_SVC, "returned handle=0x{:08X}", *out_handle);
|
LOG_TRACE(Kernel_SVC, "returned handle=0x{:08X}", *out_handle);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Arbitrate address
|
/// Arbitrate address
|
||||||
static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value,
|
static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value,
|
||||||
s64 nanoseconds) {
|
s64 nanoseconds) {
|
||||||
NGLOG_TRACE(Kernel_SVC,
|
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}, address=0x{:08X}, type=0x{:08X}, value=0x{:08X}",
|
||||||
"called handle=0x{:08X}, address=0x{:08X}, type=0x{:08X}, value=0x{:08X}", handle,
|
handle, address, type, value);
|
||||||
address, type, value);
|
|
||||||
|
|
||||||
SharedPtr<AddressArbiter> arbiter = g_handle_table.Get<AddressArbiter>(handle);
|
SharedPtr<AddressArbiter> arbiter = g_handle_table.Get<AddressArbiter>(handle);
|
||||||
if (arbiter == nullptr)
|
if (arbiter == nullptr)
|
||||||
@ -642,7 +641,7 @@ static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 val
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void Break(u8 break_reason) {
|
static void Break(u8 break_reason) {
|
||||||
NGLOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!");
|
LOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!");
|
||||||
std::string reason_str;
|
std::string reason_str;
|
||||||
switch (break_reason) {
|
switch (break_reason) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -658,19 +657,19 @@ static void Break(u8 break_reason) {
|
|||||||
reason_str = "UNKNOWN";
|
reason_str = "UNKNOWN";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NGLOG_CRITICAL(Debug_Emulated, "Break reason: {}", reason_str);
|
LOG_CRITICAL(Debug_Emulated, "Break reason: {}", reason_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
|
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
|
||||||
static void OutputDebugString(VAddr address, int len) {
|
static void OutputDebugString(VAddr address, int len) {
|
||||||
std::string string(len, ' ');
|
std::string string(len, ' ');
|
||||||
Memory::ReadBlock(address, string.data(), len);
|
Memory::ReadBlock(address, string.data(), len);
|
||||||
NGLOG_DEBUG(Debug_Emulated, "{}", string);
|
LOG_DEBUG(Debug_Emulated, "{}", string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get resource limit
|
/// Get resource limit
|
||||||
static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle) {
|
static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
|
LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
|
||||||
|
|
||||||
SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
|
SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
|
||||||
if (process == nullptr)
|
if (process == nullptr)
|
||||||
@ -684,8 +683,8 @@ static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle
|
|||||||
/// Get resource limit current values
|
/// Get resource limit current values
|
||||||
static ResultCode GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_handle,
|
static ResultCode GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_handle,
|
||||||
VAddr names, u32 name_count) {
|
VAddr names, u32 name_count) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called resource_limit={:08X}, names={:08X}, name_count={}",
|
LOG_TRACE(Kernel_SVC, "called resource_limit={:08X}, names={:08X}, name_count={}",
|
||||||
resource_limit_handle, names, name_count);
|
resource_limit_handle, names, name_count);
|
||||||
|
|
||||||
SharedPtr<ResourceLimit> resource_limit =
|
SharedPtr<ResourceLimit> resource_limit =
|
||||||
g_handle_table.Get<ResourceLimit>(resource_limit_handle);
|
g_handle_table.Get<ResourceLimit>(resource_limit_handle);
|
||||||
@ -704,8 +703,8 @@ static ResultCode GetResourceLimitCurrentValues(VAddr values, Handle resource_li
|
|||||||
/// Get resource limit max values
|
/// Get resource limit max values
|
||||||
static ResultCode GetResourceLimitLimitValues(VAddr values, Handle resource_limit_handle,
|
static ResultCode GetResourceLimitLimitValues(VAddr values, Handle resource_limit_handle,
|
||||||
VAddr names, u32 name_count) {
|
VAddr names, u32 name_count) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called resource_limit={:08X}, names={:08X}, name_count={}",
|
LOG_TRACE(Kernel_SVC, "called resource_limit={:08X}, names={:08X}, name_count={}",
|
||||||
resource_limit_handle, names, name_count);
|
resource_limit_handle, names, name_count);
|
||||||
|
|
||||||
SharedPtr<ResourceLimit> resource_limit =
|
SharedPtr<ResourceLimit> resource_limit =
|
||||||
g_handle_table.Get<ResourceLimit>(resource_limit_handle);
|
g_handle_table.Get<ResourceLimit>(resource_limit_handle);
|
||||||
@ -745,12 +744,12 @@ static ResultCode CreateThread(Handle* out_handle, u32 priority, u32 entry_point
|
|||||||
case THREADPROCESSORID_0:
|
case THREADPROCESSORID_0:
|
||||||
break;
|
break;
|
||||||
case THREADPROCESSORID_ALL:
|
case THREADPROCESSORID_ALL:
|
||||||
NGLOG_INFO(Kernel_SVC,
|
LOG_INFO(Kernel_SVC,
|
||||||
"Newly created thread is allowed to be run in any Core, unimplemented.");
|
"Newly created thread is allowed to be run in any Core, unimplemented.");
|
||||||
break;
|
break;
|
||||||
case THREADPROCESSORID_1:
|
case THREADPROCESSORID_1:
|
||||||
NGLOG_ERROR(Kernel_SVC,
|
LOG_ERROR(Kernel_SVC,
|
||||||
"Newly created thread must run in the SysCore (Core1), unimplemented.");
|
"Newly created thread must run in the SysCore (Core1), unimplemented.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO(bunnei): Implement support for other processor IDs
|
// TODO(bunnei): Implement support for other processor IDs
|
||||||
@ -769,17 +768,17 @@ static ResultCode CreateThread(Handle* out_handle, u32 priority, u32 entry_point
|
|||||||
|
|
||||||
Core::System::GetInstance().PrepareReschedule();
|
Core::System::GetInstance().PrepareReschedule();
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC,
|
LOG_TRACE(Kernel_SVC,
|
||||||
"called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, "
|
"called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, "
|
||||||
"threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}",
|
"threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}",
|
||||||
entry_point, name, arg, stack_top, priority, processor_id, *out_handle);
|
entry_point, name, arg, stack_top, priority, processor_id, *out_handle);
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when a thread exits
|
/// Called when a thread exits
|
||||||
static void ExitThread() {
|
static void ExitThread() {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CPU().GetPC());
|
LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CPU().GetPC());
|
||||||
|
|
||||||
ExitCurrentThread();
|
ExitCurrentThread();
|
||||||
Core::System::GetInstance().PrepareReschedule();
|
Core::System::GetInstance().PrepareReschedule();
|
||||||
@ -829,15 +828,15 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) {
|
|||||||
mutex->name = Common::StringFromFormat("mutex-%08x", Core::CPU().GetReg(14));
|
mutex->name = Common::StringFromFormat("mutex-%08x", Core::CPU().GetReg(14));
|
||||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(mutex)));
|
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(mutex)));
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called initial_locked={} : created handle=0x{:08X}",
|
LOG_TRACE(Kernel_SVC, "called initial_locked={} : created handle=0x{:08X}",
|
||||||
initial_locked ? "true" : "false", *out_handle);
|
initial_locked ? "true" : "false", *out_handle);
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Release a mutex
|
/// Release a mutex
|
||||||
static ResultCode ReleaseMutex(Handle handle) {
|
static ResultCode ReleaseMutex(Handle handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called handle=0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}", handle);
|
||||||
|
|
||||||
SharedPtr<Mutex> mutex = g_handle_table.Get<Mutex>(handle);
|
SharedPtr<Mutex> mutex = g_handle_table.Get<Mutex>(handle);
|
||||||
if (mutex == nullptr)
|
if (mutex == nullptr)
|
||||||
@ -848,7 +847,7 @@ static ResultCode ReleaseMutex(Handle handle) {
|
|||||||
|
|
||||||
/// Get the ID of the specified process
|
/// Get the ID of the specified process
|
||||||
static ResultCode GetProcessId(u32* process_id, Handle process_handle) {
|
static ResultCode GetProcessId(u32* process_id, Handle process_handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
|
LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
|
||||||
|
|
||||||
const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
|
const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
|
||||||
if (process == nullptr)
|
if (process == nullptr)
|
||||||
@ -860,7 +859,7 @@ static ResultCode GetProcessId(u32* process_id, Handle process_handle) {
|
|||||||
|
|
||||||
/// Get the ID of the process that owns the specified thread
|
/// Get the ID of the process that owns the specified thread
|
||||||
static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
|
static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
|
LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
|
||||||
|
|
||||||
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
|
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
|
||||||
if (thread == nullptr)
|
if (thread == nullptr)
|
||||||
@ -876,7 +875,7 @@ static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
|
|||||||
|
|
||||||
/// Get the ID for the specified thread.
|
/// Get the ID for the specified thread.
|
||||||
static ResultCode GetThreadId(u32* thread_id, Handle handle) {
|
static ResultCode GetThreadId(u32* thread_id, Handle handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", handle);
|
||||||
|
|
||||||
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(handle);
|
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(handle);
|
||||||
if (thread == nullptr)
|
if (thread == nullptr)
|
||||||
@ -892,14 +891,14 @@ static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max
|
|||||||
semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::CPU().GetReg(14));
|
semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::CPU().GetReg(14));
|
||||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(semaphore)));
|
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(semaphore)));
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called initial_count={}, max_count={}, created handle=0x{:08X}",
|
LOG_TRACE(Kernel_SVC, "called initial_count={}, max_count={}, created handle=0x{:08X}",
|
||||||
initial_count, max_count, *out_handle);
|
initial_count, max_count, *out_handle);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Releases a certain number of slots in a semaphore
|
/// Releases a certain number of slots in a semaphore
|
||||||
static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
|
static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called release_count={}, handle=0x{:08X}", release_count, handle);
|
LOG_TRACE(Kernel_SVC, "called release_count={}, handle=0x{:08X}", release_count, handle);
|
||||||
|
|
||||||
SharedPtr<Semaphore> semaphore = g_handle_table.Get<Semaphore>(handle);
|
SharedPtr<Semaphore> semaphore = g_handle_table.Get<Semaphore>(handle);
|
||||||
if (semaphore == nullptr)
|
if (semaphore == nullptr)
|
||||||
@ -928,7 +927,7 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_inf
|
|||||||
memory_info->state = static_cast<u32>(vma->second.meminfo_state);
|
memory_info->state = static_cast<u32>(vma->second.meminfo_state);
|
||||||
|
|
||||||
page_info->flags = 0;
|
page_info->flags = 0;
|
||||||
NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr=0x{:08X}", process_handle, addr);
|
LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr=0x{:08X}", process_handle, addr);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,21 +942,21 @@ static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) {
|
|||||||
evt->name = Common::StringFromFormat("event-%08x", Core::CPU().GetReg(14));
|
evt->name = Common::StringFromFormat("event-%08x", Core::CPU().GetReg(14));
|
||||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(evt)));
|
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(evt)));
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called reset_type=0x{:08X} : created handle=0x{:08X}", reset_type,
|
LOG_TRACE(Kernel_SVC, "called reset_type=0x{:08X} : created handle=0x{:08X}", reset_type,
|
||||||
*out_handle);
|
*out_handle);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Duplicates a kernel handle
|
/// Duplicates a kernel handle
|
||||||
static ResultCode DuplicateHandle(Handle* out, Handle handle) {
|
static ResultCode DuplicateHandle(Handle* out, Handle handle) {
|
||||||
CASCADE_RESULT(*out, g_handle_table.Duplicate(handle));
|
CASCADE_RESULT(*out, g_handle_table.Duplicate(handle));
|
||||||
NGLOG_TRACE(Kernel_SVC, "duplicated 0x{:08X} to 0x{:08X}", handle, *out);
|
LOG_TRACE(Kernel_SVC, "duplicated 0x{:08X} to 0x{:08X}", handle, *out);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Signals an event
|
/// Signals an event
|
||||||
static ResultCode SignalEvent(Handle handle) {
|
static ResultCode SignalEvent(Handle handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
|
||||||
|
|
||||||
SharedPtr<Event> evt = g_handle_table.Get<Event>(handle);
|
SharedPtr<Event> evt = g_handle_table.Get<Event>(handle);
|
||||||
if (evt == nullptr)
|
if (evt == nullptr)
|
||||||
@ -970,7 +969,7 @@ static ResultCode SignalEvent(Handle handle) {
|
|||||||
|
|
||||||
/// Clears an event
|
/// Clears an event
|
||||||
static ResultCode ClearEvent(Handle handle) {
|
static ResultCode ClearEvent(Handle handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
|
||||||
|
|
||||||
SharedPtr<Event> evt = g_handle_table.Get<Event>(handle);
|
SharedPtr<Event> evt = g_handle_table.Get<Event>(handle);
|
||||||
if (evt == nullptr)
|
if (evt == nullptr)
|
||||||
@ -986,14 +985,14 @@ static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) {
|
|||||||
timer->name = Common::StringFromFormat("timer-%08x", Core::CPU().GetReg(14));
|
timer->name = Common::StringFromFormat("timer-%08x", Core::CPU().GetReg(14));
|
||||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(timer)));
|
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(timer)));
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called reset_type=0x{:08X} : created handle=0x{:08X}", reset_type,
|
LOG_TRACE(Kernel_SVC, "called reset_type=0x{:08X} : created handle=0x{:08X}", reset_type,
|
||||||
*out_handle);
|
*out_handle);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clears a timer
|
/// Clears a timer
|
||||||
static ResultCode ClearTimer(Handle handle) {
|
static ResultCode ClearTimer(Handle handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
|
||||||
|
|
||||||
SharedPtr<Timer> timer = g_handle_table.Get<Timer>(handle);
|
SharedPtr<Timer> timer = g_handle_table.Get<Timer>(handle);
|
||||||
if (timer == nullptr)
|
if (timer == nullptr)
|
||||||
@ -1005,7 +1004,7 @@ static ResultCode ClearTimer(Handle handle) {
|
|||||||
|
|
||||||
/// Starts a timer
|
/// Starts a timer
|
||||||
static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) {
|
static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
|
||||||
|
|
||||||
if (initial < 0 || interval < 0) {
|
if (initial < 0 || interval < 0) {
|
||||||
return ERR_OUT_OF_RANGE_KERNEL;
|
return ERR_OUT_OF_RANGE_KERNEL;
|
||||||
@ -1022,7 +1021,7 @@ static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) {
|
|||||||
|
|
||||||
/// Cancels a timer
|
/// Cancels a timer
|
||||||
static ResultCode CancelTimer(Handle handle) {
|
static ResultCode CancelTimer(Handle handle) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
|
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
|
||||||
|
|
||||||
SharedPtr<Timer> timer = g_handle_table.Get<Timer>(handle);
|
SharedPtr<Timer> timer = g_handle_table.Get<Timer>(handle);
|
||||||
if (timer == nullptr)
|
if (timer == nullptr)
|
||||||
@ -1035,7 +1034,7 @@ static ResultCode CancelTimer(Handle handle) {
|
|||||||
|
|
||||||
/// Sleep the current thread
|
/// Sleep the current thread
|
||||||
static void SleepThread(s64 nanoseconds) {
|
static void SleepThread(s64 nanoseconds) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds);
|
LOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds);
|
||||||
|
|
||||||
// Don't attempt to yield execution if there are no available threads to run,
|
// Don't attempt to yield execution if there are no available threads to run,
|
||||||
// this way we avoid a useless reschedule to the idle thread.
|
// this way we avoid a useless reschedule to the idle thread.
|
||||||
@ -1106,7 +1105,7 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32
|
|||||||
static_cast<MemoryPermission>(other_permission), addr, region);
|
static_cast<MemoryPermission>(other_permission), addr, region);
|
||||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(shared_memory)));
|
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(shared_memory)));
|
||||||
|
|
||||||
NGLOG_WARNING(Kernel_SVC, "called addr=0x{:08X}", addr);
|
LOG_WARNING(Kernel_SVC, "called addr=0x{:08X}", addr);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,7 +1122,7 @@ static ResultCode CreatePort(Handle* server_port, Handle* client_port, VAddr nam
|
|||||||
CASCADE_RESULT(*server_port,
|
CASCADE_RESULT(*server_port,
|
||||||
g_handle_table.Create(std::move(std::get<SharedPtr<ServerPort>>(ports))));
|
g_handle_table.Create(std::move(std::get<SharedPtr<ServerPort>>(ports))));
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called max_sessions={}", max_sessions);
|
LOG_TRACE(Kernel_SVC, "called max_sessions={}", max_sessions);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1146,7 +1145,7 @@ static ResultCode CreateSession(Handle* server_session, Handle* client_session)
|
|||||||
auto& client = std::get<SharedPtr<ClientSession>>(sessions);
|
auto& client = std::get<SharedPtr<ClientSession>>(sessions);
|
||||||
CASCADE_RESULT(*client_session, g_handle_table.Create(std::move(client)));
|
CASCADE_RESULT(*client_session, g_handle_table.Create(std::move(client)));
|
||||||
|
|
||||||
NGLOG_TRACE(Kernel_SVC, "called");
|
LOG_TRACE(Kernel_SVC, "called");
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,7 +1160,7 @@ static ResultCode AcceptSession(Handle* out_server_session, Handle server_port_h
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
|
static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called type={} param={}", type, param);
|
LOG_TRACE(Kernel_SVC, "called type={} param={}", type, param);
|
||||||
|
|
||||||
switch ((SystemInfoType)type) {
|
switch ((SystemInfoType)type) {
|
||||||
case SystemInfoType::REGION_MEMORY_USAGE:
|
case SystemInfoType::REGION_MEMORY_USAGE:
|
||||||
@ -1181,20 +1180,20 @@ static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
|
|||||||
*out = GetMemoryRegion(MemoryRegion::BASE)->used;
|
*out = GetMemoryRegion(MemoryRegion::BASE)->used;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type=0 region: param={}", param);
|
LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type=0 region: param={}", param);
|
||||||
*out = 0;
|
*out = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SystemInfoType::KERNEL_ALLOCATED_PAGES:
|
case SystemInfoType::KERNEL_ALLOCATED_PAGES:
|
||||||
NGLOG_ERROR(Kernel_SVC, "unimplemented GetSystemInfo type=2 param={}", param);
|
LOG_ERROR(Kernel_SVC, "unimplemented GetSystemInfo type=2 param={}", param);
|
||||||
*out = 0;
|
*out = 0;
|
||||||
break;
|
break;
|
||||||
case SystemInfoType::KERNEL_SPAWNED_PIDS:
|
case SystemInfoType::KERNEL_SPAWNED_PIDS:
|
||||||
*out = 5;
|
*out = 5;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type={} param={}", type, param);
|
LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type={} param={}", type, param);
|
||||||
*out = 0;
|
*out = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1204,7 +1203,7 @@ static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
|
static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
|
||||||
NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X} type={}", process_handle, type);
|
LOG_TRACE(Kernel_SVC, "called process=0x{:08X} type={}", process_handle, type);
|
||||||
|
|
||||||
SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
|
SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
|
||||||
if (process == nullptr)
|
if (process == nullptr)
|
||||||
@ -1217,7 +1216,7 @@ static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
|
|||||||
// what's the difference between them.
|
// what's the difference between them.
|
||||||
*out = process->heap_used + process->linear_heap_used + process->misc_memory_used;
|
*out = process->heap_used + process->linear_heap_used + process->misc_memory_used;
|
||||||
if (*out % Memory::PAGE_SIZE != 0) {
|
if (*out % Memory::PAGE_SIZE != 0) {
|
||||||
NGLOG_ERROR(Kernel_SVC, "called, memory size not page-aligned");
|
LOG_ERROR(Kernel_SVC, "called, memory size not page-aligned");
|
||||||
return ERR_MISALIGNED_SIZE;
|
return ERR_MISALIGNED_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1229,7 +1228,7 @@ static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
|
|||||||
case 7:
|
case 7:
|
||||||
case 8:
|
case 8:
|
||||||
// These are valid, but not implemented yet
|
// These are valid, but not implemented yet
|
||||||
NGLOG_ERROR(Kernel_SVC, "unimplemented GetProcessInfo type={}", type);
|
LOG_ERROR(Kernel_SVC, "unimplemented GetProcessInfo type={}", type);
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
*out = Memory::FCRAM_PADDR - process->GetLinearHeapAreaAddress();
|
*out = Memory::FCRAM_PADDR - process->GetLinearHeapAreaAddress();
|
||||||
@ -1238,10 +1237,10 @@ static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
|
|||||||
case 22:
|
case 22:
|
||||||
case 23:
|
case 23:
|
||||||
// These return a different error value than higher invalid values
|
// These return a different error value than higher invalid values
|
||||||
NGLOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type);
|
LOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type);
|
||||||
return ERR_NOT_IMPLEMENTED;
|
return ERR_NOT_IMPLEMENTED;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type);
|
LOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type);
|
||||||
return ERR_INVALID_ENUM_VALUE;
|
return ERR_INVALID_ENUM_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1389,7 +1388,7 @@ static const FunctionDef SVC_Table[] = {
|
|||||||
|
|
||||||
static const FunctionDef* GetSVCInfo(u32 func_num) {
|
static const FunctionDef* GetSVCInfo(u32 func_num) {
|
||||||
if (func_num >= ARRAY_SIZE(SVC_Table)) {
|
if (func_num >= ARRAY_SIZE(SVC_Table)) {
|
||||||
NGLOG_ERROR(Kernel_SVC, "unknown svc=0x{:02X}", func_num);
|
LOG_ERROR(Kernel_SVC, "unknown svc=0x{:02X}", func_num);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return &SVC_Table[func_num];
|
return &SVC_Table[func_num];
|
||||||
@ -1411,7 +1410,7 @@ void CallSVC(u32 immediate) {
|
|||||||
if (info->func) {
|
if (info->func) {
|
||||||
info->func();
|
info->func();
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Kernel_SVC, "unimplemented SVC function {}(..)", info->name);
|
LOG_ERROR(Kernel_SVC, "unimplemented SVC function {}(..)", info->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ void ExitCurrentThread() {
|
|||||||
static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
|
static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
|
||||||
SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>((Handle)thread_handle);
|
SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>((Handle)thread_handle);
|
||||||
if (thread == nullptr) {
|
if (thread == nullptr) {
|
||||||
NGLOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", (Handle)thread_handle);
|
LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", (Handle)thread_handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,16 +264,16 @@ void Thread::ResumeFromWait() {
|
|||||||
static void DebugThreadQueue() {
|
static void DebugThreadQueue() {
|
||||||
Thread* thread = GetCurrentThread();
|
Thread* thread = GetCurrentThread();
|
||||||
if (!thread) {
|
if (!thread) {
|
||||||
NGLOG_DEBUG(Kernel, "Current: NO CURRENT THREAD");
|
LOG_DEBUG(Kernel, "Current: NO CURRENT THREAD");
|
||||||
} else {
|
} else {
|
||||||
NGLOG_DEBUG(Kernel, "0x{:02X} {} (current)", thread->current_priority,
|
LOG_DEBUG(Kernel, "0x{:02X} {} (current)", thread->current_priority,
|
||||||
GetCurrentThread()->GetObjectId());
|
GetCurrentThread()->GetObjectId());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& t : thread_list) {
|
for (auto& t : thread_list) {
|
||||||
u32 priority = ready_queue.contains(t.get());
|
u32 priority = ready_queue.contains(t.get());
|
||||||
if (priority != -1) {
|
if (priority != -1) {
|
||||||
NGLOG_DEBUG(Kernel, "0x{:02X} {}", priority, t->GetObjectId());
|
LOG_DEBUG(Kernel, "0x{:02X} {}", priority, t->GetObjectId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,19 +324,19 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
|
|||||||
SharedPtr<Process> owner_process) {
|
SharedPtr<Process> owner_process) {
|
||||||
// Check if priority is in ranged. Lowest priority -> highest priority id.
|
// Check if priority is in ranged. Lowest priority -> highest priority id.
|
||||||
if (priority > THREADPRIO_LOWEST) {
|
if (priority > THREADPRIO_LOWEST) {
|
||||||
NGLOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority);
|
LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority);
|
||||||
return ERR_OUT_OF_RANGE;
|
return ERR_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processor_id > THREADPROCESSORID_MAX) {
|
if (processor_id > THREADPROCESSORID_MAX) {
|
||||||
NGLOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id);
|
LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id);
|
||||||
return ERR_OUT_OF_RANGE_KERNEL;
|
return ERR_OUT_OF_RANGE_KERNEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(yuriks): Other checks, returning 0xD9001BEA
|
// TODO(yuriks): Other checks, returning 0xD9001BEA
|
||||||
|
|
||||||
if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) {
|
if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) {
|
||||||
NGLOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:08x}", name, entry_point);
|
LOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:08x}", name, entry_point);
|
||||||
// TODO: Verify error
|
// TODO: Verify error
|
||||||
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
|
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
|
||||||
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
|
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
|
||||||
@ -375,8 +375,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
|
|||||||
auto& linheap_memory = memory_region->linear_heap_memory;
|
auto& linheap_memory = memory_region->linear_heap_memory;
|
||||||
|
|
||||||
if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) {
|
if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) {
|
||||||
NGLOG_ERROR(Kernel_SVC,
|
LOG_ERROR(Kernel_SVC,
|
||||||
"Not enough space in region to allocate a new TLS page for thread");
|
"Not enough space in region to allocate a new TLS page for thread");
|
||||||
return ERR_OUT_OF_MEMORY;
|
return ERR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,11 +469,11 @@ void Reschedule() {
|
|||||||
Thread* next = PopNextReadyThread();
|
Thread* next = PopNextReadyThread();
|
||||||
|
|
||||||
if (cur && next) {
|
if (cur && next) {
|
||||||
NGLOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId());
|
LOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId());
|
||||||
} else if (cur) {
|
} else if (cur) {
|
||||||
NGLOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId());
|
LOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId());
|
||||||
} else if (next) {
|
} else if (next) {
|
||||||
NGLOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId());
|
LOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId());
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitchContext(next);
|
SwitchContext(next);
|
||||||
|
@ -77,7 +77,7 @@ void Timer::WakeupAllWaitingThreads() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Timer::Signal(int cycles_late) {
|
void Timer::Signal(int cycles_late) {
|
||||||
NGLOG_TRACE(Kernel, "Timer {} fired", GetObjectId());
|
LOG_TRACE(Kernel, "Timer {} fired", GetObjectId());
|
||||||
|
|
||||||
signaled = true;
|
signaled = true;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
|
|||||||
timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle));
|
timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle));
|
||||||
|
|
||||||
if (timer == nullptr) {
|
if (timer == nullptr) {
|
||||||
NGLOG_CRITICAL(Kernel, "Callback fired for invalid timer {:08x}", timer_handle);
|
LOG_CRITICAL(Kernel, "Callback fired for invalid timer {:08x}", timer_handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,12 +260,12 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector<u8>* block) {
|
|||||||
void VMManager::LogLayout(Log::Level log_level) const {
|
void VMManager::LogLayout(Log::Level log_level) const {
|
||||||
for (const auto& p : vma_map) {
|
for (const auto& p : vma_map) {
|
||||||
const VirtualMemoryArea& vma = p.second;
|
const VirtualMemoryArea& vma = p.second;
|
||||||
NGLOG_GENERIC(::Log::Class::Kernel, log_level, "{:08X} - {:08X} size: {:8X} {}{}{} {}",
|
LOG_GENERIC(::Log::Class::Kernel, log_level, "{:08X} - {:08X} size: {:8X} {}{}{} {}",
|
||||||
vma.base, vma.base + vma.size, vma.size,
|
vma.base, vma.base + vma.size, vma.size,
|
||||||
(u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-',
|
(u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-',
|
||||||
(u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-',
|
(u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-',
|
||||||
(u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-',
|
(u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-',
|
||||||
GetMemoryStateName(vma.meminfo_state));
|
GetMemoryStateName(vma.meminfo_state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void Module::Interface::CreateDefaultConfig(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::ConnectAsync(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::ConnectAsync(Kernel::HLERequestContext& ctx) {
|
||||||
@ -45,7 +45,7 @@ void Module::Interface::ConnectAsync(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
|
||||||
@ -84,7 +84,7 @@ void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
|
||||||
@ -97,7 +97,7 @@ void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<u32>(0); // Connection type set to none
|
rb.Push<u32>(0); // Connection type set to none
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {
|
||||||
@ -108,7 +108,7 @@ void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<u32>(0); // Infra Priority, default 0
|
rb.Push<u32>(0); // Infra Priority, default 0
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetRequestEulaVersion(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetRequestEulaVersion(Kernel::HLERequestContext& ctx) {
|
||||||
@ -125,7 +125,7 @@ void Module::Interface::SetRequestEulaVersion(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushStaticBuffer(std::move(ac_config), 0);
|
rb.PushStaticBuffer(std::move(ac_config), 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called, major={}, minor={}", major, minor);
|
LOG_WARNING(Service_AC, "(STUBBED) called, major={}, minor={}", major, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::RegisterDisconnectEvent(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::RegisterDisconnectEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -140,7 +140,7 @@ void Module::Interface::RegisterDisconnectEvent(Kernel::HLERequestContext& ctx)
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::IsConnected(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::IsConnected(Kernel::HLERequestContext& ctx) {
|
||||||
@ -153,8 +153,8 @@ void Module::Interface::IsConnected(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(ac->ac_connected);
|
rb.Push(ac->ac_connected);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called unk=0x{:08X} descriptor=0x{:08X} param=0x{:08X}",
|
LOG_WARNING(Service_AC, "(STUBBED) called unk=0x{:08X} descriptor=0x{:08X} param=0x{:08X}", unk,
|
||||||
unk, unk_descriptor, unk_param);
|
unk_descriptor, unk_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetClientVersion(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetClientVersion(Kernel::HLERequestContext& ctx) {
|
||||||
@ -163,7 +163,7 @@ void Module::Interface::SetClientVersion(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 version = rp.Pop<u32>();
|
u32 version = rp.Pop<u32>();
|
||||||
rp.Skip(2, false); // ProcessId descriptor
|
rp.Skip(2, false); // ProcessId descriptor
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AC, "(STUBBED) called, version: 0x{:08X}", version);
|
LOG_WARNING(Service_AC, "(STUBBED) called, version: 0x{:08X}", version);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -143,8 +143,8 @@ ResultVal<size_t> CIAFile::WriteContentData(u64 offset, size_t length, const u8*
|
|||||||
// Keep tabs on how much of this content ID has been written so new range_min
|
// Keep tabs on how much of this content ID has been written so new range_min
|
||||||
// values can be calculated.
|
// values can be calculated.
|
||||||
content_written[i] += available_to_write;
|
content_written[i] += available_to_write;
|
||||||
NGLOG_DEBUG(Service_AM, "Wrote {:x} to content {}, total {:x}", available_to_write, i,
|
LOG_DEBUG(Service_AM, "Wrote {:x} to content {}, total {:x}", available_to_write, i,
|
||||||
content_written[i]);
|
content_written[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ bool CIAFile::Close() const {
|
|||||||
|
|
||||||
// Install aborted
|
// Install aborted
|
||||||
if (!complete) {
|
if (!complete) {
|
||||||
NGLOG_ERROR(Service_AM, "CIAFile closed prematurely, aborting install...");
|
LOG_ERROR(Service_AM, "CIAFile closed prematurely, aborting install...");
|
||||||
FileUtil::DeleteDir(GetTitlePath(media_type, container.GetTitleMetadata().GetTitleID()));
|
FileUtil::DeleteDir(GetTitlePath(media_type, container.GetTitleMetadata().GetTitleID()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -277,10 +277,10 @@ void CIAFile::Flush() const {}
|
|||||||
|
|
||||||
InstallStatus InstallCIA(const std::string& path,
|
InstallStatus InstallCIA(const std::string& path,
|
||||||
std::function<ProgressCallback>&& update_callback) {
|
std::function<ProgressCallback>&& update_callback) {
|
||||||
NGLOG_INFO(Service_AM, "Installing {}...", path);
|
LOG_INFO(Service_AM, "Installing {}...", path);
|
||||||
|
|
||||||
if (!FileUtil::Exists(path)) {
|
if (!FileUtil::Exists(path)) {
|
||||||
NGLOG_ERROR(Service_AM, "File {} does not exist!", path);
|
LOG_ERROR(Service_AM, "File {} does not exist!", path);
|
||||||
return InstallStatus::ErrorFileNotFound;
|
return InstallStatus::ErrorFileNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ InstallStatus InstallCIA(const std::string& path,
|
|||||||
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
||||||
if (container.GetTitleMetadata().GetContentTypeByIndex(i) &
|
if (container.GetTitleMetadata().GetContentTypeByIndex(i) &
|
||||||
FileSys::TMDContentTypeFlag::Encrypted) {
|
FileSys::TMDContentTypeFlag::Encrypted) {
|
||||||
NGLOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path);
|
LOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path);
|
||||||
return InstallStatus::ErrorEncrypted;
|
return InstallStatus::ErrorEncrypted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,19 +311,19 @@ InstallStatus InstallCIA(const std::string& path,
|
|||||||
if (update_callback)
|
if (update_callback)
|
||||||
update_callback(total_bytes_read, file.GetSize());
|
update_callback(total_bytes_read, file.GetSize());
|
||||||
if (result.Failed()) {
|
if (result.Failed()) {
|
||||||
NGLOG_ERROR(Service_AM, "CIA file installation aborted with error code {:08x}",
|
LOG_ERROR(Service_AM, "CIA file installation aborted with error code {:08x}",
|
||||||
result.Code().raw);
|
result.Code().raw);
|
||||||
return InstallStatus::ErrorAborted;
|
return InstallStatus::ErrorAborted;
|
||||||
}
|
}
|
||||||
total_bytes_read += bytes_read;
|
total_bytes_read += bytes_read;
|
||||||
}
|
}
|
||||||
installFile.Close();
|
installFile.Close();
|
||||||
|
|
||||||
NGLOG_INFO(Service_AM, "Installed {} successfully.", path);
|
LOG_INFO(Service_AM, "Installed {} successfully.", path);
|
||||||
return InstallStatus::Success;
|
return InstallStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_ERROR(Service_AM, "CIA file {} is invalid!", path);
|
LOG_ERROR(Service_AM, "CIA file {} is invalid!", path);
|
||||||
return InstallStatus::ErrorInvalid;
|
return InstallStatus::ErrorInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ std::string GetTitleMetadataPath(Service::FS::MediaType media_type, u64 tid, boo
|
|||||||
std::string content_path = GetTitlePath(media_type, tid) + "content/";
|
std::string content_path = GetTitlePath(media_type, tid) + "content/";
|
||||||
|
|
||||||
if (media_type == Service::FS::MediaType::GameCard) {
|
if (media_type == Service::FS::MediaType::GameCard) {
|
||||||
NGLOG_ERROR(Service_AM, "Invalid request for nonexistent gamecard title metadata!");
|
LOG_ERROR(Service_AM, "Invalid request for nonexistent gamecard title metadata!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,8 +385,8 @@ std::string GetTitleContentPath(Service::FS::MediaType media_type, u64 tid, u16
|
|||||||
|
|
||||||
if (media_type == Service::FS::MediaType::GameCard) {
|
if (media_type == Service::FS::MediaType::GameCard) {
|
||||||
// TODO(shinyquagsire23): get current app file if TID matches?
|
// TODO(shinyquagsire23): get current app file if TID matches?
|
||||||
NGLOG_ERROR(Service_AM, "Request for gamecard partition {} content path unimplemented!",
|
LOG_ERROR(Service_AM, "Request for gamecard partition {} content path unimplemented!",
|
||||||
static_cast<u32>(index));
|
static_cast<u32>(index));
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ std::string GetTitlePath(Service::FS::MediaType media_type, u64 tid) {
|
|||||||
|
|
||||||
if (media_type == Service::FS::MediaType::GameCard) {
|
if (media_type == Service::FS::MediaType::GameCard) {
|
||||||
// TODO(shinyquagsire23): get current app path if TID matches?
|
// TODO(shinyquagsire23): get current app path if TID matches?
|
||||||
NGLOG_ERROR(Service_AM, "Request for gamecard title path unimplemented!");
|
LOG_ERROR(Service_AM, "Request for gamecard title path unimplemented!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ std::string GetMediaTitlePath(Service::FS::MediaType media_type) {
|
|||||||
|
|
||||||
if (media_type == Service::FS::MediaType::GameCard) {
|
if (media_type == Service::FS::MediaType::GameCard) {
|
||||||
// TODO(shinyquagsire23): get current app parent folder if TID matches?
|
// TODO(shinyquagsire23): get current app parent folder if TID matches?
|
||||||
NGLOG_ERROR(Service_AM, "Request for gamecard parent path unimplemented!");
|
LOG_ERROR(Service_AM, "Request for gamecard parent path unimplemented!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,8 +607,8 @@ void Module::Interface::DeleteContents(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushMappedBuffer(content_ids_in);
|
rb.PushMappedBuffer(content_ids_in);
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) media_type={}, title_id=0x{:016x}, content_count={}",
|
LOG_WARNING(Service_AM, "(STUBBED) media_type={}, title_id=0x{:016x}, content_count={}",
|
||||||
media_type, title_id, content_count);
|
media_type, title_id, content_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetProgramList(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetProgramList(Kernel::HLERequestContext& ctx) {
|
||||||
@ -692,24 +692,24 @@ void Module::Interface::DeleteUserProgram(Kernel::HLERequestContext& ctx) {
|
|||||||
u16 category = static_cast<u16>((title_id >> 32) & 0xFFFF);
|
u16 category = static_cast<u16>((title_id >> 32) & 0xFFFF);
|
||||||
u8 variation = static_cast<u8>(title_id & 0xFF);
|
u8 variation = static_cast<u8>(title_id & 0xFF);
|
||||||
if (category & CATEGORY_SYSTEM || category & CATEGORY_DLP || variation & VARIATION_SYSTEM) {
|
if (category & CATEGORY_SYSTEM || category & CATEGORY_DLP || variation & VARIATION_SYSTEM) {
|
||||||
NGLOG_ERROR(Service_AM, "Trying to uninstall system app");
|
LOG_ERROR(Service_AM, "Trying to uninstall system app");
|
||||||
rb.Push(ResultCode(ErrCodes::TryingToUninstallSystemApp, ErrorModule::AM,
|
rb.Push(ResultCode(ErrCodes::TryingToUninstallSystemApp, ErrorModule::AM,
|
||||||
ErrorSummary::InvalidArgument, ErrorLevel::Usage));
|
ErrorSummary::InvalidArgument, ErrorLevel::Usage));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NGLOG_INFO(Service_AM, "Deleting title 0x{:016x}", title_id);
|
LOG_INFO(Service_AM, "Deleting title 0x{:016x}", title_id);
|
||||||
std::string path = GetTitlePath(media_type, title_id);
|
std::string path = GetTitlePath(media_type, title_id);
|
||||||
if (!FileUtil::Exists(path)) {
|
if (!FileUtil::Exists(path)) {
|
||||||
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
|
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
|
||||||
ErrorLevel::Permanent));
|
ErrorLevel::Permanent));
|
||||||
NGLOG_ERROR(Service_AM, "Title not found");
|
LOG_ERROR(Service_AM, "Title not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool success = FileUtil::DeleteDirRecursively(path);
|
bool success = FileUtil::DeleteDirRecursively(path);
|
||||||
am->ScanForAllTitles();
|
am->ScanForAllTitles();
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
if (!success)
|
if (!success)
|
||||||
NGLOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
|
LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetProductCode(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetProductCode(Kernel::HLERequestContext& ctx) {
|
||||||
@ -827,9 +827,9 @@ void Module::Interface::ListDataTitleTicketInfos(Kernel::HLERequestContext& ctx)
|
|||||||
rb.Push(ticket_count);
|
rb.Push(ticket_count);
|
||||||
rb.PushMappedBuffer(ticket_info_out);
|
rb.PushMappedBuffer(ticket_info_out);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AM,
|
LOG_WARNING(Service_AM,
|
||||||
"(STUBBED) ticket_count=0x{:08X}, title_id=0x{:016x}, start_index=0x{:08X}",
|
"(STUBBED) ticket_count=0x{:08X}, title_id=0x{:016x}, start_index=0x{:08X}",
|
||||||
ticket_count, title_id, start_index);
|
ticket_count, title_id, start_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) {
|
||||||
@ -857,8 +857,8 @@ void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(tmd.GetContentCount());
|
rb.Push<u32>(tmd.GetContentCount());
|
||||||
} else {
|
} else {
|
||||||
rb.Push<u32>(1); // Number of content infos plus one
|
rb.Push<u32>(1); // Number of content infos plus one
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) called media_type={}, title_id=0x{:016x}",
|
LOG_WARNING(Service_AM, "(STUBBED) called media_type={}, title_id=0x{:016x}",
|
||||||
static_cast<u32>(media_type), title_id);
|
static_cast<u32>(media_type), title_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -868,7 +868,7 @@ void Module::Interface::DeleteTicket(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) called title_id=0x{:016x}", title_id);
|
LOG_WARNING(Service_AM, "(STUBBED) called title_id=0x{:016x}", title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetNumTickets(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetNumTickets(Kernel::HLERequestContext& ctx) {
|
||||||
@ -878,7 +878,7 @@ void Module::Interface::GetNumTickets(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(ticket_count);
|
rb.Push(ticket_count);
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) called ticket_count=0x{:08x}", ticket_count);
|
LOG_WARNING(Service_AM, "(STUBBED) called ticket_count=0x{:08x}", ticket_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetTicketList(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetTicketList(Kernel::HLERequestContext& ctx) {
|
||||||
@ -891,8 +891,8 @@ void Module::Interface::GetTicketList(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(ticket_list_count);
|
rb.Push(ticket_list_count);
|
||||||
rb.PushMappedBuffer(ticket_tids_out);
|
rb.PushMappedBuffer(ticket_tids_out);
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) ticket_list_count=0x{:08x}, ticket_index=0x{:08x}",
|
LOG_WARNING(Service_AM, "(STUBBED) ticket_list_count=0x{:08x}, ticket_index=0x{:08x}",
|
||||||
ticket_list_count, ticket_index);
|
ticket_list_count, ticket_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& ctx) {
|
||||||
@ -903,7 +903,7 @@ void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& c
|
|||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.Push(true);
|
rb.Push(true);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type);
|
LOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::CheckContentRights(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CheckContentRights(Kernel::HLERequestContext& ctx) {
|
||||||
@ -919,7 +919,7 @@ void Module::Interface::CheckContentRights(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.Push(has_rights);
|
rb.Push(has_rights);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
|
LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::CheckContentRightsIgnorePlatform(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CheckContentRightsIgnorePlatform(Kernel::HLERequestContext& ctx) {
|
||||||
@ -935,7 +935,7 @@ void Module::Interface::CheckContentRightsIgnorePlatform(Kernel::HLERequestConte
|
|||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.Push(has_rights);
|
rb.Push(has_rights);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
|
LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::BeginImportProgram(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::BeginImportProgram(Kernel::HLERequestContext& ctx) {
|
||||||
@ -961,7 +961,7 @@ void Module::Interface::BeginImportProgram(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.PushCopyObjects(file->Connect());
|
rb.PushCopyObjects(file->Connect());
|
||||||
|
|
||||||
NGLOG_WARNING(Service_AM, "(STUBBED) media_type={}", static_cast<u32>(media_type));
|
LOG_WARNING(Service_AM, "(STUBBED) media_type={}", static_cast<u32>(media_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) {
|
||||||
@ -981,13 +981,13 @@ ResultVal<std::shared_ptr<Service::FS::File>> GetFileFromSession(
|
|||||||
// cast to File. For AM on 3DS, invalid handles actually hang the system.
|
// cast to File. For AM on 3DS, invalid handles actually hang the system.
|
||||||
|
|
||||||
if (file_session->parent == nullptr) {
|
if (file_session->parent == nullptr) {
|
||||||
NGLOG_WARNING(Service_AM, "Invalid file handle!");
|
LOG_WARNING(Service_AM, "Invalid file handle!");
|
||||||
return Kernel::ERR_INVALID_HANDLE;
|
return Kernel::ERR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel::SharedPtr<Kernel::ServerSession> server = file_session->parent->server;
|
Kernel::SharedPtr<Kernel::ServerSession> server = file_session->parent->server;
|
||||||
if (server == nullptr) {
|
if (server == nullptr) {
|
||||||
NGLOG_WARNING(Service_AM, "File handle ServerSession disconnected!");
|
LOG_WARNING(Service_AM, "File handle ServerSession disconnected!");
|
||||||
return Kernel::ERR_SESSION_CLOSED_BY_REMOTE;
|
return Kernel::ERR_SESSION_CLOSED_BY_REMOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,13 +998,13 @@ ResultVal<std::shared_ptr<Service::FS::File>> GetFileFromSession(
|
|||||||
if (file != nullptr)
|
if (file != nullptr)
|
||||||
return MakeResult<std::shared_ptr<Service::FS::File>>(file);
|
return MakeResult<std::shared_ptr<Service::FS::File>>(file);
|
||||||
|
|
||||||
NGLOG_ERROR(Service_AM, "Failed to cast handle to FSFile!");
|
LOG_ERROR(Service_AM, "Failed to cast handle to FSFile!");
|
||||||
return Kernel::ERR_INVALID_HANDLE;
|
return Kernel::ERR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Probably the best bet if someone is LLEing the fs service is to just have them LLE AM
|
// Probably the best bet if someone is LLEing the fs service is to just have them LLE AM
|
||||||
// while they're at it, so not implemented.
|
// while they're at it, so not implemented.
|
||||||
NGLOG_ERROR(Service_AM, "Given file handle does not have an HLE handler!");
|
LOG_ERROR(Service_AM, "Given file handle does not have an HLE handler!");
|
||||||
return Kernel::ERR_NOT_IMPLEMENTED;
|
return Kernel::ERR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,20 +1201,20 @@ void Module::Interface::DeleteProgram(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestParser rp(ctx, 0x0410, 3, 0);
|
IPC::RequestParser rp(ctx, 0x0410, 3, 0);
|
||||||
auto media_type = rp.PopEnum<FS::MediaType>();
|
auto media_type = rp.PopEnum<FS::MediaType>();
|
||||||
u64 title_id = rp.Pop<u64>();
|
u64 title_id = rp.Pop<u64>();
|
||||||
NGLOG_INFO(Service_AM, "Deleting title 0x{:016x}", title_id);
|
LOG_INFO(Service_AM, "Deleting title 0x{:016x}", title_id);
|
||||||
std::string path = GetTitlePath(media_type, title_id);
|
std::string path = GetTitlePath(media_type, title_id);
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
if (!FileUtil::Exists(path)) {
|
if (!FileUtil::Exists(path)) {
|
||||||
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
|
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
|
||||||
ErrorLevel::Permanent));
|
ErrorLevel::Permanent));
|
||||||
NGLOG_ERROR(Service_AM, "Title not found");
|
LOG_ERROR(Service_AM, "Title not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool success = FileUtil::DeleteDirRecursively(path);
|
bool success = FileUtil::DeleteDirRecursively(path);
|
||||||
am->ScanForAllTitles();
|
am->ScanForAllTitles();
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
if (!success)
|
if (!success)
|
||||||
NGLOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
|
LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetMetaSizeFromCia(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetMetaSizeFromCia(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -170,8 +170,8 @@ void AppletManager::CancelAndSendParameter(const MessageParameter& parameter) {
|
|||||||
// Signal the event to let the receiver know that a new parameter is ready to be read
|
// Signal the event to let the receiver know that a new parameter is ready to be read
|
||||||
auto* const slot_data = GetAppletSlotData(static_cast<AppletId>(parameter.destination_id));
|
auto* const slot_data = GetAppletSlotData(static_cast<AppletId>(parameter.destination_id));
|
||||||
if (slot_data == nullptr) {
|
if (slot_data == nullptr) {
|
||||||
NGLOG_DEBUG(Service_APT, "No applet was registered with the id {:03X}",
|
LOG_DEBUG(Service_APT, "No applet was registered with the id {:03X}",
|
||||||
static_cast<u32>(parameter.destination_id));
|
static_cast<u32>(parameter.destination_id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,8 +329,8 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
|||||||
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
||||||
auto applet = HLE::Applets::Applet::Get(applet_id);
|
auto applet = HLE::Applets::Applet::Get(applet_id);
|
||||||
if (applet) {
|
if (applet) {
|
||||||
NGLOG_WARNING(Service_APT, "applet has already been started id={:08X}",
|
LOG_WARNING(Service_APT, "applet has already been started id={:08X}",
|
||||||
static_cast<u32>(applet_id));
|
static_cast<u32>(applet_id));
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
return HLE::Applets::Applet::Create(applet_id, shared_from_this());
|
return HLE::Applets::Applet::Create(applet_id, shared_from_this());
|
||||||
@ -353,8 +353,8 @@ ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
|||||||
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
||||||
auto applet = HLE::Applets::Applet::Get(applet_id);
|
auto applet = HLE::Applets::Applet::Get(applet_id);
|
||||||
if (applet) {
|
if (applet) {
|
||||||
NGLOG_WARNING(Service_APT, "applet has already been started id={:08X}",
|
LOG_WARNING(Service_APT, "applet has already been started id={:08X}",
|
||||||
static_cast<u32>(applet_id));
|
static_cast<u32>(applet_id));
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
return HLE::Applets::Applet::Create(applet_id, shared_from_this());
|
return HLE::Applets::Applet::Create(applet_id, shared_from_this());
|
||||||
@ -400,15 +400,15 @@ ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_i
|
|||||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet,
|
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet,
|
||||||
ErrorSummary::NotFound, ErrorLevel::Status);
|
ErrorSummary::NotFound, ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
NGLOG_WARNING(Service_APT, "Using HLE applet info for applet {:03X}",
|
LOG_WARNING(Service_APT, "Using HLE applet info for applet {:03X}",
|
||||||
static_cast<u32>(app_id));
|
static_cast<u32>(app_id));
|
||||||
// TODO(Subv): Get the title id for the current applet and write it in the response[2-3]
|
// TODO(Subv): Get the title id for the current applet and write it in the response[2-3]
|
||||||
return MakeResult<AppletInfo>({0, Service::FS::MediaType::NAND, true, true, 0});
|
return MakeResult<AppletInfo>({0, Service::FS::MediaType::NAND, true, true, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app_id == AppletId::Application) {
|
if (app_id == AppletId::Application) {
|
||||||
// TODO(Subv): Implement this once Application launching is implemented
|
// TODO(Subv): Implement this once Application launching is implemented
|
||||||
NGLOG_ERROR(Service_APT, "Unimplemented GetAppletInfo(Application)");
|
LOG_ERROR(Service_APT, "Unimplemented GetAppletInfo(Application)");
|
||||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||||
ErrorLevel::Status);
|
ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
AppletId app_id = rp.PopEnum<AppletId>();
|
AppletId app_id = rp.PopEnum<AppletId>();
|
||||||
u32 attributes = rp.Pop<u32>();
|
u32 attributes = rp.Pop<u32>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}, attributes={:#010X}",
|
LOG_DEBUG(Service_APT, "called app_id={:#010X}, attributes={:#010X}", static_cast<u32>(app_id),
|
||||||
static_cast<u32>(app_id), attributes);
|
attributes);
|
||||||
|
|
||||||
auto result = apt->applet_manager->Initialize(app_id, attributes);
|
auto result = apt->applet_manager->Initialize(app_id, attributes);
|
||||||
if (result.Failed()) {
|
if (result.Failed()) {
|
||||||
@ -197,10 +197,10 @@ void Module::Interface::GetSharedFont(Kernel::HLERequestContext& ctx) {
|
|||||||
if (apt->LoadSharedFont()) {
|
if (apt->LoadSharedFont()) {
|
||||||
apt->shared_font_loaded = true;
|
apt->shared_font_loaded = true;
|
||||||
} else if (apt->LoadLegacySharedFont()) {
|
} else if (apt->LoadLegacySharedFont()) {
|
||||||
NGLOG_WARNING(Service_APT, "Loaded shared font by legacy method");
|
LOG_WARNING(Service_APT, "Loaded shared font by legacy method");
|
||||||
apt->shared_font_loaded = true;
|
apt->shared_font_loaded = true;
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds");
|
LOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds");
|
||||||
rb.Push<u32>(-1); // TODO: Find the right error code
|
rb.Push<u32>(-1); // TODO: Find the right error code
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
||||||
@ -231,7 +231,7 @@ void Module::Interface::NotifyToWait(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 app_id = rp.Pop<u32>();
|
u32 app_id = rp.Pop<u32>();
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id);
|
LOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) {
|
||||||
@ -252,14 +252,14 @@ void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(0); // Least significant bit = power button state
|
rb.Push<u32>(0); // Least significant bit = power button state
|
||||||
rb.PushCopyObjects(apt->lock);
|
rb.PushCopyObjects(apt->lock);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called applet_attributes={:#010X}", applet_attributes);
|
LOG_WARNING(Service_APT, "(STUBBED) called applet_attributes={:#010X}", applet_attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::Enable(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Enable(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x3, 1, 0); // 0x30040
|
IPC::RequestParser rp(ctx, 0x3, 1, 0); // 0x30040
|
||||||
u32 attributes = rp.Pop<u32>();
|
u32 attributes = rp.Pop<u32>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called attributes={:#010X}", attributes);
|
LOG_DEBUG(Service_APT, "called attributes={:#010X}", attributes);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(apt->applet_manager->Enable(attributes));
|
rb.Push(apt->applet_manager->Enable(attributes));
|
||||||
@ -275,7 +275,7 @@ void Module::Interface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(static_cast<u32>(AppletId::HomeMenu)); // Home menu AppID
|
rb.Push(static_cast<u32>(AppletId::HomeMenu)); // Home menu AppID
|
||||||
rb.Push(static_cast<u32>(AppletId::Application)); // TODO(purpasmart96): Do this correctly
|
rb.Push(static_cast<u32>(AppletId::Application)); // TODO(purpasmart96): Do this correctly
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called unk={:#010X}", unk);
|
LOG_WARNING(Service_APT, "(STUBBED) called unk={:#010X}", unk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) {
|
||||||
@ -285,7 +285,7 @@ void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.Push(apt->applet_manager->IsRegistered(app_id));
|
rb.Push(apt->applet_manager->IsRegistered(app_id));
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}", static_cast<u32>(app_id));
|
LOG_DEBUG(Service_APT, "called app_id={:#010X}", static_cast<u32>(app_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) {
|
||||||
@ -294,7 +294,7 @@ void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.Push(static_cast<u32>(SignalType::None)); // Signal type
|
rb.Push(static_cast<u32>(SignalType::None)); // Signal type
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called app_id={:#010X}", app_id);
|
LOG_WARNING(Service_APT, "(STUBBED) called app_id={:#010X}", app_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) {
|
||||||
@ -306,11 +306,11 @@ void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) {
|
|||||||
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
||||||
std::vector<u8> buffer = rp.PopStaticBuffer();
|
std::vector<u8> buffer = rp.PopStaticBuffer();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT,
|
LOG_DEBUG(Service_APT,
|
||||||
"called src_app_id={:#010X}, dst_app_id={:#010X}, signal_type={:#010X},"
|
"called src_app_id={:#010X}, dst_app_id={:#010X}, signal_type={:#010X},"
|
||||||
"buffer_size={:#010X}",
|
"buffer_size={:#010X}",
|
||||||
static_cast<u32>(src_app_id), static_cast<u32>(dst_app_id),
|
static_cast<u32>(src_app_id), static_cast<u32>(dst_app_id),
|
||||||
static_cast<u32>(signal_type), buffer_size);
|
static_cast<u32>(signal_type), buffer_size);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
|
||||||
@ -329,8 +329,8 @@ void Module::Interface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
|
|||||||
AppletId app_id = rp.PopEnum<AppletId>();
|
AppletId app_id = rp.PopEnum<AppletId>();
|
||||||
u32 buffer_size = rp.Pop<u32>();
|
u32 buffer_size = rp.Pop<u32>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}, buffer_size={:#010X}",
|
LOG_DEBUG(Service_APT, "called app_id={:#010X}, buffer_size={:#010X}", static_cast<u32>(app_id),
|
||||||
static_cast<u32>(app_id), buffer_size);
|
buffer_size);
|
||||||
|
|
||||||
auto next_parameter = apt->applet_manager->ReceiveParameter(app_id);
|
auto next_parameter = apt->applet_manager->ReceiveParameter(app_id);
|
||||||
|
|
||||||
@ -357,8 +357,8 @@ void Module::Interface::GlanceParameter(Kernel::HLERequestContext& ctx) {
|
|||||||
AppletId app_id = rp.PopEnum<AppletId>();
|
AppletId app_id = rp.PopEnum<AppletId>();
|
||||||
u32 buffer_size = rp.Pop<u32>();
|
u32 buffer_size = rp.Pop<u32>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}, buffer_size={:#010X}",
|
LOG_DEBUG(Service_APT, "called app_id={:#010X}, buffer_size={:#010X}", static_cast<u32>(app_id),
|
||||||
static_cast<u32>(app_id), buffer_size);
|
buffer_size);
|
||||||
|
|
||||||
auto next_parameter = apt->applet_manager->GlanceParameter(app_id);
|
auto next_parameter = apt->applet_manager->GlanceParameter(app_id);
|
||||||
|
|
||||||
@ -393,11 +393,11 @@ void Module::Interface::CancelParameter(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(apt->applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
|
rb.Push(apt->applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
|
||||||
receiver_appid));
|
receiver_appid));
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT,
|
LOG_DEBUG(Service_APT,
|
||||||
"called check_sender={}, sender_appid={:#010X}, "
|
"called check_sender={}, sender_appid={:#010X}, "
|
||||||
"check_receiver={}, receiver_appid={:#010X}",
|
"check_receiver={}, receiver_appid={:#010X}",
|
||||||
check_sender, static_cast<u32>(sender_appid), check_receiver,
|
check_sender, static_cast<u32>(sender_appid), check_receiver,
|
||||||
static_cast<u32>(receiver_appid));
|
static_cast<u32>(receiver_appid));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::PrepareToStartApplication(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::PrepareToStartApplication(Kernel::HLERequestContext& ctx) {
|
||||||
@ -415,11 +415,10 @@ void Module::Interface::PrepareToStartApplication(Kernel::HLERequestContext& ctx
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
|
|
||||||
NGLOG_WARNING(
|
LOG_WARNING(Service_APT,
|
||||||
Service_APT,
|
"(STUBBED) called title_info1={:#010X}, title_info2={:#010X}, title_info3={:#010X},"
|
||||||
"(STUBBED) called title_info1={:#010X}, title_info2={:#010X}, title_info3={:#010X},"
|
"title_info4={:#010X}, flags={:#010X}",
|
||||||
"title_info4={:#010X}, flags={:#010X}",
|
title_info1, title_info2, title_info3, title_info4, flags);
|
||||||
title_info1, title_info2, title_info3, title_info4, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::StartApplication(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::StartApplication(Kernel::HLERequestContext& ctx) {
|
||||||
@ -433,9 +432,9 @@ void Module::Interface::StartApplication(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT,
|
LOG_WARNING(Service_APT,
|
||||||
"(STUBBED) called buffer1_size={:#010X}, buffer2_size={:#010X}, flag={:#010X}",
|
"(STUBBED) called buffer1_size={:#010X}, buffer2_size={:#010X}, flag={:#010X}",
|
||||||
buffer1_size, buffer2_size, flag);
|
buffer1_size, buffer2_size, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::AppletUtility(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::AppletUtility(Kernel::HLERequestContext& ctx) {
|
||||||
@ -450,9 +449,9 @@ void Module::Interface::AppletUtility(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT,
|
LOG_WARNING(Service_APT,
|
||||||
"(STUBBED) called command={:#010X}, input_size={:#010X}, output_size={:#010X}",
|
"(STUBBED) called command={:#010X}, input_size={:#010X}, output_size={:#010X}",
|
||||||
utility_command, input_size, output_size);
|
utility_command, input_size, output_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||||
@ -461,14 +460,13 @@ void Module::Interface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
|||||||
apt->cpu_percent = rp.Pop<u32>();
|
apt->cpu_percent = rp.Pop<u32>();
|
||||||
|
|
||||||
if (value != 1) {
|
if (value != 1) {
|
||||||
NGLOG_ERROR(Service_APT, "This value should be one, but is actually {}!", value);
|
LOG_ERROR(Service_APT, "This value should be one, but is actually {}!", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called, cpu_percent={}, value={}", apt->cpu_percent,
|
LOG_WARNING(Service_APT, "(STUBBED) called, cpu_percent={}, value={}", apt->cpu_percent, value);
|
||||||
value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||||
@ -476,21 +474,21 @@ void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 value = rp.Pop<u32>();
|
u32 value = rp.Pop<u32>();
|
||||||
|
|
||||||
if (value != 1) {
|
if (value != 1) {
|
||||||
NGLOG_ERROR(Service_APT, "This value should be one, but is actually {}!", value);
|
LOG_ERROR(Service_APT, "This value should be one, but is actually {}!", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.Push(apt->cpu_percent);
|
rb.Push(apt->cpu_percent);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called, value={}", value);
|
LOG_WARNING(Service_APT, "(STUBBED) called, value={}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::PrepareToStartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::PrepareToStartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x18, 1, 0); // 0x180040
|
IPC::RequestParser rp(ctx, 0x18, 1, 0); // 0x180040
|
||||||
AppletId applet_id = rp.PopEnum<AppletId>();
|
AppletId applet_id = rp.PopEnum<AppletId>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
|
LOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(apt->applet_manager->PrepareToStartLibraryApplet(applet_id));
|
rb.Push(apt->applet_manager->PrepareToStartLibraryApplet(applet_id));
|
||||||
@ -507,14 +505,14 @@ void Module::Interface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContext&
|
|||||||
rb.Push(ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
|
rb.Push(ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status));
|
ErrorSummary::InvalidState, ErrorLevel::Status));
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called");
|
LOG_DEBUG(Service_APT, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x16, 1, 0); // 0x160040
|
IPC::RequestParser rp(ctx, 0x16, 1, 0); // 0x160040
|
||||||
AppletId applet_id = rp.PopEnum<AppletId>();
|
AppletId applet_id = rp.PopEnum<AppletId>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
|
LOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(apt->applet_manager->PreloadLibraryApplet(applet_id));
|
rb.Push(apt->applet_manager->PreloadLibraryApplet(applet_id));
|
||||||
@ -527,7 +525,7 @@ void Module::Interface::FinishPreloadingLibraryApplet(Kernel::HLERequestContext&
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(apt->applet_manager->FinishPreloadingLibraryApplet(applet_id));
|
rb.Push(apt->applet_manager->FinishPreloadingLibraryApplet(applet_id));
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called, applet_id={:#05X}", static_cast<u32>(applet_id));
|
LOG_WARNING(Service_APT, "(STUBBED) called, applet_id={:#05X}", static_cast<u32>(applet_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
||||||
@ -538,7 +536,7 @@ void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|||||||
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
||||||
std::vector<u8> buffer = rp.PopStaticBuffer();
|
std::vector<u8> buffer = rp.PopStaticBuffer();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
|
LOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer));
|
rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer));
|
||||||
@ -551,7 +549,7 @@ void Module::Interface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push<u32>(1); // TODO: Find the return code meaning
|
rb.Push<u32>(1); // TODO: Find the return code meaning
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called exiting={}", exiting);
|
LOG_WARNING(Service_APT, "(STUBBED) called exiting={}", exiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
||||||
@ -582,8 +580,8 @@ void Module::Interface::SetScreenCapPostPermission(Kernel::HLERequestContext& ct
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called, screen_capture_post_permission={}",
|
LOG_WARNING(Service_APT, "(STUBBED) called, screen_capture_post_permission={}",
|
||||||
static_cast<u32>(apt->screen_capture_post_permission));
|
static_cast<u32>(apt->screen_capture_post_permission));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetScreenCapPostPermission(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetScreenCapPostPermission(Kernel::HLERequestContext& ctx) {
|
||||||
@ -592,15 +590,15 @@ void Module::Interface::GetScreenCapPostPermission(Kernel::HLERequestContext& ct
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS); // No error
|
rb.Push(RESULT_SUCCESS); // No error
|
||||||
rb.Push(static_cast<u32>(apt->screen_capture_post_permission));
|
rb.Push(static_cast<u32>(apt->screen_capture_post_permission));
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called, screen_capture_post_permission={}",
|
LOG_WARNING(Service_APT, "(STUBBED) called, screen_capture_post_permission={}",
|
||||||
static_cast<u32>(apt->screen_capture_post_permission));
|
static_cast<u32>(apt->screen_capture_post_permission));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x6, 1, 0); // 0x60040
|
IPC::RequestParser rp(ctx, 0x6, 1, 0); // 0x60040
|
||||||
auto app_id = rp.PopEnum<AppletId>();
|
auto app_id = rp.PopEnum<AppletId>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT, "called, app_id={}", static_cast<u32>(app_id));
|
LOG_DEBUG(Service_APT, "called, app_id={}", static_cast<u32>(app_id));
|
||||||
|
|
||||||
auto info = apt->applet_manager->GetAppletInfo(app_id);
|
auto info = apt->applet_manager->GetAppletInfo(app_id);
|
||||||
if (info.Failed()) {
|
if (info.Failed()) {
|
||||||
@ -623,7 +621,7 @@ void Module::Interface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
|
|||||||
StartupArgumentType startup_argument_type = static_cast<StartupArgumentType>(rp.Pop<u8>());
|
StartupArgumentType startup_argument_type = static_cast<StartupArgumentType>(rp.Pop<u8>());
|
||||||
|
|
||||||
if (parameter_size >= 0x300) {
|
if (parameter_size >= 0x300) {
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(
|
||||||
Service_APT,
|
Service_APT,
|
||||||
"Parameter size is outside the valid range (capped to 0x300): parameter_size={:#010X}",
|
"Parameter size is outside the valid range (capped to 0x300): parameter_size={:#010X}",
|
||||||
parameter_size);
|
parameter_size);
|
||||||
@ -632,9 +630,8 @@ void Module::Interface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
std::vector<u8> parameter(parameter_size, 0);
|
std::vector<u8> parameter(parameter_size, 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT,
|
LOG_WARNING(Service_APT, "(STUBBED) called, startup_argument_type={}, parameter_size={:#010X}",
|
||||||
"(STUBBED) called, startup_argument_type={}, parameter_size={:#010X}",
|
static_cast<u32>(startup_argument_type), parameter_size);
|
||||||
static_cast<u32>(startup_argument_type), parameter_size);
|
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
@ -658,9 +655,8 @@ void Module::Interface::Wrap(Kernel::HLERequestContext& ctx) {
|
|||||||
ASSERT_MSG(output_size == input_size + HW::AES::CCM_MAC_SIZE,
|
ASSERT_MSG(output_size == input_size + HW::AES::CCM_MAC_SIZE,
|
||||||
"input_size ({}) doesn't match to output_size ({})", input_size, output_size);
|
"input_size ({}) doesn't match to output_size ({})", input_size, output_size);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT,
|
LOG_DEBUG(Service_APT, "called, output_size={}, input_size={}, nonce_offset={}, nonce_size={}",
|
||||||
"called, output_size={}, input_size={}, nonce_offset={}, nonce_size={}",
|
output_size, input_size, nonce_offset, nonce_size);
|
||||||
output_size, input_size, nonce_offset, nonce_size);
|
|
||||||
|
|
||||||
// Note: This weird nonce size modification is verified against real 3DS
|
// Note: This weird nonce size modification is verified against real 3DS
|
||||||
nonce_size = std::min<u32>(nonce_size & ~3, HW::AES::CCM_NONCE_SIZE);
|
nonce_size = std::min<u32>(nonce_size & ~3, HW::AES::CCM_NONCE_SIZE);
|
||||||
@ -704,9 +700,8 @@ void Module::Interface::Unwrap(Kernel::HLERequestContext& ctx) {
|
|||||||
ASSERT_MSG(output_size == input_size - HW::AES::CCM_MAC_SIZE,
|
ASSERT_MSG(output_size == input_size - HW::AES::CCM_MAC_SIZE,
|
||||||
"input_size ({}) doesn't match to output_size ({})", input_size, output_size);
|
"input_size ({}) doesn't match to output_size ({})", input_size, output_size);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_APT,
|
LOG_DEBUG(Service_APT, "called, output_size={}, input_size={}, nonce_offset={}, nonce_size={}",
|
||||||
"called, output_size={}, input_size={}, nonce_offset={}, nonce_size={}",
|
output_size, input_size, nonce_offset, nonce_size);
|
||||||
output_size, input_size, nonce_offset, nonce_size);
|
|
||||||
|
|
||||||
// Note: This weird nonce size modification is verified against real 3DS
|
// Note: This weird nonce size modification is verified against real 3DS
|
||||||
nonce_size = std::min<u32>(nonce_size & ~3, HW::AES::CCM_NONCE_SIZE);
|
nonce_size = std::min<u32>(nonce_size & ~3, HW::AES::CCM_NONCE_SIZE);
|
||||||
@ -730,7 +725,7 @@ void Module::Interface::Unwrap(Kernel::HLERequestContext& ctx) {
|
|||||||
pdata.size() - nonce_offset);
|
pdata.size() - nonce_offset);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_APT, "Failed to decrypt data");
|
LOG_ERROR(Service_APT, "Failed to decrypt data");
|
||||||
rb.Push(ResultCode(static_cast<ErrorDescription>(1), ErrorModule::PS,
|
rb.Push(ResultCode(static_cast<ErrorDescription>(1), ErrorModule::PS,
|
||||||
ErrorSummary::WrongArgument, ErrorLevel::Status));
|
ErrorSummary::WrongArgument, ErrorLevel::Status));
|
||||||
}
|
}
|
||||||
@ -751,7 +746,7 @@ void Module::Interface::CheckNew3DSApp(Kernel::HLERequestContext& ctx) {
|
|||||||
PTM::CheckNew3DS(rb);
|
PTM::CheckNew3DS(rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called");
|
LOG_WARNING(Service_APT, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
|
||||||
@ -760,7 +755,7 @@ void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
PTM::CheckNew3DS(rb);
|
PTM::CheckNew3DS(rb);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_APT, "(STUBBED) called");
|
LOG_WARNING(Service_APT, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::Interface::Interface(std::shared_ptr<Module> apt, const char* name, u32 max_session)
|
Module::Interface::Interface(std::shared_ptr<Module> apt, const char* name, u32 max_session)
|
||||||
|
@ -28,16 +28,16 @@ void InitializeSession(Service::Interface* self) {
|
|||||||
if (translation != IPC::CallingPidDesc()) {
|
if (translation != IPC::CallingPidDesc()) {
|
||||||
cmd_buff[0] = IPC::MakeHeader(0, 0x1, 0); // 0x40
|
cmd_buff[0] = IPC::MakeHeader(0, 0x1, 0); // 0x40
|
||||||
cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
|
cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
|
||||||
NGLOG_ERROR(Service_BOSS, "The translation was invalid, translation={:#010X}", translation);
|
LOG_ERROR(Service_BOSS, "The translation was invalid, translation={:#010X}", translation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_buff[0] = IPC::MakeHeader(0x1, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x1, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param={:#018X}, translation={:#010X}, unk_param4={:#010X}",
|
"(STUBBED) unk_param={:#018X}, translation={:#010X}, unk_param4={:#010X}",
|
||||||
unk_param, translation, unk_param4);
|
unk_param, translation, unk_param4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterStorage(Service::Interface* self) {
|
void RegisterStorage(Service::Interface* self) {
|
||||||
@ -51,10 +51,10 @@ void RegisterStorage(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x2, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x2, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"unk_flag={:#010X}",
|
"unk_flag={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_flag);
|
unk_param1, unk_param2, unk_param3, unk_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterStorage(Service::Interface* self) {
|
void UnregisterStorage(Service::Interface* self) {
|
||||||
@ -63,7 +63,7 @@ void UnregisterStorage(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x3, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x3, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) called");
|
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStorageInfo(Service::Interface* self) {
|
void GetStorageInfo(Service::Interface* self) {
|
||||||
@ -73,7 +73,7 @@ void GetStorageInfo(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = 0; // stub 0
|
cmd_buff[2] = 0; // stub 0
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) called");
|
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterPrivateRootCa(Service::Interface* self) {
|
void RegisterPrivateRootCa(Service::Interface* self) {
|
||||||
@ -88,9 +88,9 @@ void RegisterPrivateRootCa(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) translation={:#010X}, buff_addr{:#010X}, buff_size={:#010X}",
|
"(STUBBED) translation={:#010X}, buff_addr{:#010X}, buff_size={:#010X}",
|
||||||
translation, buff_addr, buff_size);
|
translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterPrivateClientCert(Service::Interface* self) {
|
void RegisterPrivateClientCert(Service::Interface* self) {
|
||||||
@ -112,12 +112,12 @@ void RegisterPrivateClientCert(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff2_size << 4 | 0xA);
|
cmd_buff[2] = (buff2_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff2_addr;
|
cmd_buff[3] = buff2_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, "
|
"translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, "
|
||||||
"translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}",
|
"translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2,
|
unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2,
|
||||||
buff2_addr, buff2_size);
|
buff2_addr, buff2_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetNewArrivalFlag(Service::Interface* self) {
|
void GetNewArrivalFlag(Service::Interface* self) {
|
||||||
@ -127,7 +127,7 @@ void GetNewArrivalFlag(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = new_arrival_flag;
|
cmd_buff[2] = new_arrival_flag;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) new_arrival_flag={}", new_arrival_flag);
|
LOG_WARNING(Service_BOSS, "(STUBBED) new_arrival_flag={}", new_arrival_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterNewArrivalEvent(Service::Interface* self) {
|
void RegisterNewArrivalEvent(Service::Interface* self) {
|
||||||
@ -139,8 +139,8 @@ void RegisterNewArrivalEvent(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x8, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x8, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}", unk_param1,
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}", unk_param1,
|
||||||
unk_param2);
|
unk_param2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetOptoutFlag(Service::Interface* self) {
|
void SetOptoutFlag(Service::Interface* self) {
|
||||||
@ -151,7 +151,7 @@ void SetOptoutFlag(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x9, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x9, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "output_flag={}", output_flag);
|
LOG_WARNING(Service_BOSS, "output_flag={}", output_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetOptoutFlag(Service::Interface* self) {
|
void GetOptoutFlag(Service::Interface* self) {
|
||||||
@ -161,7 +161,7 @@ void GetOptoutFlag(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = output_flag;
|
cmd_buff[2] = output_flag;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "output_flag={}", output_flag);
|
LOG_WARNING(Service_BOSS, "output_flag={}", output_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterTask(Service::Interface* self) {
|
void RegisterTask(Service::Interface* self) {
|
||||||
@ -179,10 +179,10 @@ void RegisterTask(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterTask(Service::Interface* self) {
|
void UnregisterTask(Service::Interface* self) {
|
||||||
@ -199,10 +199,10 @@ void UnregisterTask(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReconfigureTask(Service::Interface* self) {
|
void ReconfigureTask(Service::Interface* self) {
|
||||||
@ -219,10 +219,10 @@ void ReconfigureTask(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskIdList(Service::Interface* self) {
|
void GetTaskIdList(Service::Interface* self) {
|
||||||
@ -231,7 +231,7 @@ void GetTaskIdList(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0xE, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0xE, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) called");
|
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStepIdList(Service::Interface* self) {
|
void GetStepIdList(Service::Interface* self) {
|
||||||
@ -246,9 +246,9 @@ void GetStepIdList(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
"(STUBBED) translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
translation, buff_addr, buff_size);
|
translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetNsDataIdList(Service::Interface* self) {
|
void GetNsDataIdList(Service::Interface* self) {
|
||||||
@ -269,12 +269,11 @@ void GetNsDataIdList(Service::Interface* self) {
|
|||||||
cmd_buff[4] = (buff_size << 4 | 0xC);
|
cmd_buff[4] = (buff_size << 4 | 0xC);
|
||||||
cmd_buff[5] = buff_addr;
|
cmd_buff[5] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"unk_param4={:#010X}, translation={:#010X}, "
|
"unk_param4={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr,
|
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size);
|
||||||
buff_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetOwnNsDataIdList(Service::Interface* self) {
|
void GetOwnNsDataIdList(Service::Interface* self) {
|
||||||
@ -295,12 +294,11 @@ void GetOwnNsDataIdList(Service::Interface* self) {
|
|||||||
cmd_buff[4] = (buff_size << 4 | 0xC);
|
cmd_buff[4] = (buff_size << 4 | 0xC);
|
||||||
cmd_buff[5] = buff_addr;
|
cmd_buff[5] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"unk_param4={:#010X}, translation={:#010X}, "
|
"unk_param4={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr,
|
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size);
|
||||||
buff_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetNewDataNsDataIdList(Service::Interface* self) {
|
void GetNewDataNsDataIdList(Service::Interface* self) {
|
||||||
@ -321,12 +319,11 @@ void GetNewDataNsDataIdList(Service::Interface* self) {
|
|||||||
cmd_buff[4] = (buff_size << 4 | 0xC);
|
cmd_buff[4] = (buff_size << 4 | 0xC);
|
||||||
cmd_buff[5] = buff_addr;
|
cmd_buff[5] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"unk_param4={:#010X}, translation={:#010X}, "
|
"unk_param4={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr,
|
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size);
|
||||||
buff_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetOwnNewDataNsDataIdList(Service::Interface* self) {
|
void GetOwnNewDataNsDataIdList(Service::Interface* self) {
|
||||||
@ -347,12 +344,11 @@ void GetOwnNewDataNsDataIdList(Service::Interface* self) {
|
|||||||
cmd_buff[4] = (buff_size << 4 | 0xC);
|
cmd_buff[4] = (buff_size << 4 | 0xC);
|
||||||
cmd_buff[5] = buff_addr;
|
cmd_buff[5] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"unk_param4={:#010X}, translation={:#010X}, "
|
"unk_param4={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr,
|
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size);
|
||||||
buff_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendProperty(Service::Interface* self) {
|
void SendProperty(Service::Interface* self) {
|
||||||
@ -369,10 +365,10 @@ void SendProperty(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendPropertyHandle(Service::Interface* self) {
|
void SendPropertyHandle(Service::Interface* self) {
|
||||||
@ -388,10 +384,10 @@ void SendPropertyHandle(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReceiveProperty(Service::Interface* self) {
|
void ReceiveProperty(Service::Interface* self) {
|
||||||
@ -408,10 +404,10 @@ void ReceiveProperty(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xC);
|
cmd_buff[3] = (buff_size << 4 | 0xC);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, buff_size={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, buff_size={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}",
|
||||||
unk_param1, buff_size, translation, buff_addr);
|
unk_param1, buff_size, translation, buff_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTaskInterval(Service::Interface* self) {
|
void UpdateTaskInterval(Service::Interface* self) {
|
||||||
@ -428,10 +424,10 @@ void UpdateTaskInterval(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTaskCount(Service::Interface* self) {
|
void UpdateTaskCount(Service::Interface* self) {
|
||||||
@ -447,10 +443,10 @@ void UpdateTaskCount(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}",
|
||||||
buff_size, unk_param2, translation, buff_addr);
|
buff_size, unk_param2, translation, buff_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskInterval(Service::Interface* self) {
|
void GetTaskInterval(Service::Interface* self) {
|
||||||
@ -467,10 +463,10 @@ void GetTaskInterval(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xA);
|
cmd_buff[3] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskCount(Service::Interface* self) {
|
void GetTaskCount(Service::Interface* self) {
|
||||||
@ -487,10 +483,10 @@ void GetTaskCount(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xA);
|
cmd_buff[3] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskServiceStatus(Service::Interface* self) {
|
void GetTaskServiceStatus(Service::Interface* self) {
|
||||||
@ -507,10 +503,10 @@ void GetTaskServiceStatus(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xA);
|
cmd_buff[3] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartTask(Service::Interface* self) {
|
void StartTask(Service::Interface* self) {
|
||||||
@ -526,10 +522,10 @@ void StartTask(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartTaskImmediate(Service::Interface* self) {
|
void StartTaskImmediate(Service::Interface* self) {
|
||||||
@ -545,10 +541,10 @@ void StartTaskImmediate(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CancelTask(Service::Interface* self) {
|
void CancelTask(Service::Interface* self) {
|
||||||
@ -564,10 +560,10 @@ void CancelTask(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskFinishHandle(Service::Interface* self) {
|
void GetTaskFinishHandle(Service::Interface* self) {
|
||||||
@ -578,7 +574,7 @@ void GetTaskFinishHandle(Service::Interface* self) {
|
|||||||
cmd_buff[2] = 0;
|
cmd_buff[2] = 0;
|
||||||
cmd_buff[3] = 0; // stub 0(This should be a handle of task_finish ?)
|
cmd_buff[3] = 0; // stub 0(This should be a handle of task_finish ?)
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) called");
|
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskState(Service::Interface* self) {
|
void GetTaskState(Service::Interface* self) {
|
||||||
@ -597,10 +593,10 @@ void GetTaskState(Service::Interface* self) {
|
|||||||
cmd_buff[5] = (buff_size << 4 | 0xA);
|
cmd_buff[5] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[6] = buff_addr;
|
cmd_buff[6] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}",
|
||||||
buff_size, unk_param2, translation, buff_addr);
|
buff_size, unk_param2, translation, buff_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskResult(Service::Interface* self) {
|
void GetTaskResult(Service::Interface* self) {
|
||||||
@ -619,10 +615,10 @@ void GetTaskResult(Service::Interface* self) {
|
|||||||
cmd_buff[5] = (buff_size << 4 | 0xA);
|
cmd_buff[5] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[6] = buff_addr;
|
cmd_buff[6] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskCommErrorCode(Service::Interface* self) {
|
void GetTaskCommErrorCode(Service::Interface* self) {
|
||||||
@ -641,10 +637,10 @@ void GetTaskCommErrorCode(Service::Interface* self) {
|
|||||||
cmd_buff[5] = (buff_size << 4 | 0xA);
|
cmd_buff[5] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[6] = buff_addr;
|
cmd_buff[6] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskStatus(Service::Interface* self) {
|
void GetTaskStatus(Service::Interface* self) {
|
||||||
@ -663,10 +659,10 @@ void GetTaskStatus(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xA);
|
cmd_buff[3] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskError(Service::Interface* self) {
|
void GetTaskError(Service::Interface* self) {
|
||||||
@ -684,10 +680,10 @@ void GetTaskError(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xA);
|
cmd_buff[3] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskInfo(Service::Interface* self) {
|
void GetTaskInfo(Service::Interface* self) {
|
||||||
@ -704,10 +700,10 @@ void GetTaskInfo(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteNsData(Service::Interface* self) {
|
void DeleteNsData(Service::Interface* self) {
|
||||||
@ -718,7 +714,7 @@ void DeleteNsData(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x26, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x26, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetNsDataHeaderInfo(Service::Interface* self) {
|
void GetNsDataHeaderInfo(Service::Interface* self) {
|
||||||
@ -736,10 +732,10 @@ void GetNsDataHeaderInfo(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xC);
|
cmd_buff[2] = (buff_size << 4 | 0xC);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadNsData(Service::Interface* self) {
|
void ReadNsData(Service::Interface* self) {
|
||||||
@ -760,12 +756,11 @@ void ReadNsData(Service::Interface* self) {
|
|||||||
cmd_buff[4] = (buff_size << 4 | 0xC);
|
cmd_buff[4] = (buff_size << 4 | 0xC);
|
||||||
cmd_buff[5] = buff_addr;
|
cmd_buff[5] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"unk_param4={:#010X}, translation={:#010X}, "
|
"unk_param4={:#010X}, translation={:#010X}, "
|
||||||
"buff_addr={:#010X}, buff_size={:#010X}",
|
"buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr,
|
unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size);
|
||||||
buff_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetNsDataAdditionalInfo(Service::Interface* self) {
|
void SetNsDataAdditionalInfo(Service::Interface* self) {
|
||||||
@ -777,8 +772,8 @@ void SetNsDataAdditionalInfo(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x29, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x29, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}", unk_param1,
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}", unk_param1,
|
||||||
unk_param2);
|
unk_param2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetNsDataAdditionalInfo(Service::Interface* self) {
|
void GetNsDataAdditionalInfo(Service::Interface* self) {
|
||||||
@ -790,7 +785,7 @@ void GetNsDataAdditionalInfo(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = 0; // stub 0 (32bit value)
|
cmd_buff[2] = 0; // stub 0 (32bit value)
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetNsDataNewFlag(Service::Interface* self) {
|
void SetNsDataNewFlag(Service::Interface* self) {
|
||||||
@ -802,8 +797,8 @@ void SetNsDataNewFlag(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x2B, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x2B, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#010X}",
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#010X}",
|
||||||
unk_param1, ns_data_new_flag);
|
unk_param1, ns_data_new_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetNsDataNewFlag(Service::Interface* self) {
|
void GetNsDataNewFlag(Service::Interface* self) {
|
||||||
@ -815,8 +810,8 @@ void GetNsDataNewFlag(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = ns_data_new_flag;
|
cmd_buff[2] = ns_data_new_flag;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#010X}",
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#010X}",
|
||||||
unk_param1, ns_data_new_flag);
|
unk_param1, ns_data_new_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetNsDataLastUpdate(Service::Interface* self) {
|
void GetNsDataLastUpdate(Service::Interface* self) {
|
||||||
@ -829,7 +824,7 @@ void GetNsDataLastUpdate(Service::Interface* self) {
|
|||||||
cmd_buff[2] = 0; // stub 0 (32bit value)
|
cmd_buff[2] = 0; // stub 0 (32bit value)
|
||||||
cmd_buff[3] = 0; // stub 0 (32bit value)
|
cmd_buff[3] = 0; // stub 0 (32bit value)
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetErrorCode(Service::Interface* self) {
|
void GetErrorCode(Service::Interface* self) {
|
||||||
@ -841,7 +836,7 @@ void GetErrorCode(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = 0; // stub 0 (32bit value)
|
cmd_buff[2] = 0; // stub 0 (32bit value)
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterStorageEntry(Service::Interface* self) {
|
void RegisterStorageEntry(Service::Interface* self) {
|
||||||
@ -856,10 +851,10 @@ void RegisterStorageEntry(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x2F, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x2F, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"unk_param4={:#010X}, unk_param5={:#010X}",
|
"unk_param4={:#010X}, unk_param5={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_param4, unk_param5);
|
unk_param1, unk_param2, unk_param3, unk_param4, unk_param5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStorageEntryInfo(Service::Interface* self) {
|
void GetStorageEntryInfo(Service::Interface* self) {
|
||||||
@ -870,7 +865,7 @@ void GetStorageEntryInfo(Service::Interface* self) {
|
|||||||
cmd_buff[2] = 0; // stub 0 (32bit value)
|
cmd_buff[2] = 0; // stub 0 (32bit value)
|
||||||
cmd_buff[3] = 0; // stub 0 (16bit value)
|
cmd_buff[3] = 0; // stub 0 (16bit value)
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) called");
|
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetStorageOption(Service::Interface* self) {
|
void SetStorageOption(Service::Interface* self) {
|
||||||
@ -884,10 +879,10 @@ void SetStorageOption(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x31, 0x1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x31, 0x1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
||||||
"unk_param3={:#010X}, unk_param4={:#010X}",
|
"unk_param3={:#010X}, unk_param4={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, unk_param4);
|
unk_param1, unk_param2, unk_param3, unk_param4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStorageOption(Service::Interface* self) {
|
void GetStorageOption(Service::Interface* self) {
|
||||||
@ -900,7 +895,7 @@ void GetStorageOption(Service::Interface* self) {
|
|||||||
cmd_buff[4] = 0; // stub 0 (16bit value)
|
cmd_buff[4] = 0; // stub 0 (16bit value)
|
||||||
cmd_buff[5] = 0; // stub 0 (16bit value)
|
cmd_buff[5] = 0; // stub 0 (16bit value)
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS, "(STUBBED) called");
|
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartBgImmediate(Service::Interface* self) {
|
void StartBgImmediate(Service::Interface* self) {
|
||||||
@ -916,10 +911,10 @@ void StartBgImmediate(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff_size << 4 | 0xA);
|
cmd_buff[2] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff_addr;
|
cmd_buff[3] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskActivePriority(Service::Interface* self) {
|
void GetTaskActivePriority(Service::Interface* self) {
|
||||||
@ -936,10 +931,10 @@ void GetTaskActivePriority(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xA);
|
cmd_buff[3] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}",
|
||||||
unk_param1, translation, buff_addr, buff_size);
|
unk_param1, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterImmediateTask(Service::Interface* self) {
|
void RegisterImmediateTask(Service::Interface* self) {
|
||||||
@ -957,10 +952,10 @@ void RegisterImmediateTask(Service::Interface* self) {
|
|||||||
cmd_buff[3] = (buff_size << 4 | 0xA);
|
cmd_buff[3] = (buff_size << 4 | 0xA);
|
||||||
cmd_buff[4] = buff_addr;
|
cmd_buff[4] = buff_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, "
|
||||||
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
"translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}",
|
||||||
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTaskQuery(Service::Interface* self) {
|
void SetTaskQuery(Service::Interface* self) {
|
||||||
@ -982,12 +977,12 @@ void SetTaskQuery(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff2_size << 4 | 0xA);
|
cmd_buff[2] = (buff2_size << 4 | 0xA);
|
||||||
cmd_buff[3] = buff2_addr;
|
cmd_buff[3] = buff2_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, "
|
"translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, "
|
||||||
"translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}",
|
"translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2,
|
unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2,
|
||||||
buff2_addr, buff2_size);
|
buff2_addr, buff2_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTaskQuery(Service::Interface* self) {
|
void GetTaskQuery(Service::Interface* self) {
|
||||||
@ -1009,12 +1004,12 @@ void GetTaskQuery(Service::Interface* self) {
|
|||||||
cmd_buff[2] = (buff2_size << 4 | 0xC);
|
cmd_buff[2] = (buff2_size << 4 | 0xC);
|
||||||
cmd_buff[3] = buff2_addr;
|
cmd_buff[3] = buff2_addr;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_BOSS,
|
LOG_WARNING(Service_BOSS,
|
||||||
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
"(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, "
|
||||||
"translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, "
|
"translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, "
|
||||||
"translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}",
|
"translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}",
|
||||||
unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2,
|
unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2,
|
||||||
buff2_addr, buff2_size);
|
buff2_addr, buff2_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
|
@ -86,8 +86,8 @@ void Module::CompletionEventCallBack(u64 port_id, int) {
|
|||||||
const int original_height = camera.contexts[camera.current_context].resolution.height;
|
const int original_height = camera.contexts[camera.current_context].resolution.height;
|
||||||
if (port.x1 <= port.x0 || port.y1 <= port.y0 || port.x1 > original_width ||
|
if (port.x1 <= port.x0 || port.y1 <= port.y0 || port.x1 > original_width ||
|
||||||
port.y1 > original_height) {
|
port.y1 > original_height) {
|
||||||
NGLOG_ERROR(Service_CAM, "Invalid trimming coordinates x0={}, y0={}, x1={}, y1={}",
|
LOG_ERROR(Service_CAM, "Invalid trimming coordinates x0={}, y0={}, x1={}, y1={}",
|
||||||
port.x0, port.y0, port.x1, port.y1);
|
port.x0, port.y0, port.x1, port.y1);
|
||||||
trim_width = 0;
|
trim_width = 0;
|
||||||
trim_height = 0;
|
trim_height = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -97,8 +97,8 @@ void Module::CompletionEventCallBack(u64 port_id, int) {
|
|||||||
|
|
||||||
u32 trim_size = (port.x1 - port.x0) * (port.y1 - port.y0) * 2;
|
u32 trim_size = (port.x1 - port.x0) * (port.y1 - port.y0) * 2;
|
||||||
if (port.dest_size != trim_size) {
|
if (port.dest_size != trim_size) {
|
||||||
NGLOG_ERROR(Service_CAM, "The destination size ({}) doesn't match the source ({})!",
|
LOG_ERROR(Service_CAM, "The destination size ({}) doesn't match the source ({})!",
|
||||||
port.dest_size, trim_size);
|
port.dest_size, trim_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 src_offset = port.y0 * original_width + port.x0;
|
const u32 src_offset = port.y0 * original_width + port.x0;
|
||||||
@ -124,8 +124,8 @@ void Module::CompletionEventCallBack(u64 port_id, int) {
|
|||||||
} else {
|
} else {
|
||||||
std::size_t buffer_size = buffer.size() * sizeof(u16);
|
std::size_t buffer_size = buffer.size() * sizeof(u16);
|
||||||
if (port.dest_size != buffer_size) {
|
if (port.dest_size != buffer_size) {
|
||||||
NGLOG_ERROR(Service_CAM, "The destination size ({}) doesn't match the source ({})!",
|
LOG_ERROR(Service_CAM, "The destination size ({}) doesn't match the source ({})!",
|
||||||
port.dest_size, buffer_size);
|
port.dest_size, buffer_size);
|
||||||
}
|
}
|
||||||
Memory::WriteBlock(*port.dest_process, port.dest, buffer.data(),
|
Memory::WriteBlock(*port.dest_process, port.dest, buffer.data(),
|
||||||
std::min<size_t>(port.dest_size, buffer_size));
|
std::min<size_t>(port.dest_size, buffer_size));
|
||||||
@ -161,7 +161,7 @@ void Module::StartReceiving(int port_id) {
|
|||||||
void Module::CancelReceiving(int port_id) {
|
void Module::CancelReceiving(int port_id) {
|
||||||
if (!ports[port_id].is_receiving)
|
if (!ports[port_id].is_receiving)
|
||||||
return;
|
return;
|
||||||
NGLOG_WARNING(Service_CAM, "tries to cancel an ongoing receiving process.");
|
LOG_WARNING(Service_CAM, "tries to cancel an ongoing receiving process.");
|
||||||
CoreTiming::UnscheduleEvent(completion_event_callback, port_id);
|
CoreTiming::UnscheduleEvent(completion_event_callback, port_id);
|
||||||
ports[port_id].capture_result.wait();
|
ports[port_id].capture_result.wait();
|
||||||
ports[port_id].is_receiving = false;
|
ports[port_id].is_receiving = false;
|
||||||
@ -212,7 +212,7 @@ void Module::Interface::StartCapture(Kernel::HLERequestContext& ctx) {
|
|||||||
if (!cam->ports[i].is_active) {
|
if (!cam->ports[i].is_active) {
|
||||||
// This doesn't return an error, but seems to put the camera in an undefined
|
// This doesn't return an error, but seems to put the camera in an undefined
|
||||||
// state
|
// state
|
||||||
NGLOG_ERROR(Service_CAM, "port {} hasn't been activated", i);
|
LOG_ERROR(Service_CAM, "port {} hasn't been activated", i);
|
||||||
} else {
|
} else {
|
||||||
cam->cameras[cam->ports[i].camera_id].impl->StartCapture();
|
cam->cameras[cam->ports[i].camera_id].impl->StartCapture();
|
||||||
cam->ports[i].is_busy = true;
|
cam->ports[i].is_busy = true;
|
||||||
@ -222,16 +222,16 @@ void Module::Interface::StartCapture(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NGLOG_WARNING(Service_CAM, "port {} already started", i);
|
LOG_WARNING(Service_CAM, "port {} already started", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
LOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::StopCapture(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::StopCapture(Kernel::HLERequestContext& ctx) {
|
||||||
@ -247,16 +247,16 @@ void Module::Interface::StopCapture(Kernel::HLERequestContext& ctx) {
|
|||||||
cam->cameras[cam->ports[i].camera_id].impl->StopCapture();
|
cam->cameras[cam->ports[i].camera_id].impl->StopCapture();
|
||||||
cam->ports[i].is_busy = false;
|
cam->ports[i].is_busy = false;
|
||||||
} else {
|
} else {
|
||||||
NGLOG_WARNING(Service_CAM, "port {} already stopped", i);
|
LOG_WARNING(Service_CAM, "port {} already stopped", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
LOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::IsBusy(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::IsBusy(Kernel::HLERequestContext& ctx) {
|
||||||
@ -274,12 +274,12 @@ void Module::Interface::IsBusy(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(is_busy);
|
rb.Push(is_busy);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.Skip(1, false);
|
rb.Skip(1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
LOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::ClearBuffer(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::ClearBuffer(Kernel::HLERequestContext& ctx) {
|
||||||
@ -289,7 +289,7 @@ void Module::Interface::ClearBuffer(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}", port_select.m_val);
|
LOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetVsyncInterruptEvent(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetVsyncInterruptEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -302,12 +302,12 @@ void Module::Interface::GetVsyncInterruptEvent(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(cam->ports[port].vsync_interrupt_event);
|
rb.PushCopyObjects(cam->ports[port].vsync_interrupt_event);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}", port_select.m_val);
|
LOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetBufferErrorInterruptEvent(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetBufferErrorInterruptEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -320,12 +320,12 @@ void Module::Interface::GetBufferErrorInterruptEvent(Kernel::HLERequestContext&
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(cam->ports[port].buffer_error_interrupt_event);
|
rb.PushCopyObjects(cam->ports[port].buffer_error_interrupt_event);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}", port_select.m_val);
|
LOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetReceiving(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetReceiving(Kernel::HLERequestContext& ctx) {
|
||||||
@ -355,13 +355,13 @@ void Module::Interface::SetReceiving(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(port.completion_event);
|
rb.PushCopyObjects(port.completion_event);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
rb.PushCopyObjects<Kernel::Object>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, addr=0x{:X}, port_select={}, image_size={}, trans_unit={}",
|
LOG_DEBUG(Service_CAM, "called, addr=0x{:X}, port_select={}, image_size={}, trans_unit={}",
|
||||||
dest, port_select.m_val, image_size, trans_unit);
|
dest, port_select.m_val, image_size, trans_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::IsFinishedReceiving(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::IsFinishedReceiving(Kernel::HLERequestContext& ctx) {
|
||||||
@ -375,12 +375,12 @@ void Module::Interface::IsFinishedReceiving(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(!is_busy);
|
rb.Push(!is_busy);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.Skip(1, false);
|
rb.Skip(1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
LOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetTransferLines(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetTransferLines(Kernel::HLERequestContext& ctx) {
|
||||||
@ -397,12 +397,12 @@ void Module::Interface::SetTransferLines(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}, lines={}, width={}, height={}",
|
LOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}, lines={}, width={}, height={}",
|
||||||
port_select.m_val, transfer_lines, width, height);
|
port_select.m_val, transfer_lines, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetMaxLines(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetMaxLines(Kernel::HLERequestContext& ctx) {
|
||||||
@ -435,7 +435,7 @@ void Module::Interface::GetMaxLines(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(lines);
|
rb.Push(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, width={}, height={}", width, height);
|
LOG_DEBUG(Service_CAM, "called, width={}, height={}", width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetTransferBytes(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetTransferBytes(Kernel::HLERequestContext& ctx) {
|
||||||
@ -452,12 +452,12 @@ void Module::Interface::SetTransferBytes(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED)called, port_select={}, bytes={}, width={}, height={}",
|
LOG_WARNING(Service_CAM, "(STUBBED)called, port_select={}, bytes={}, width={}, height={}",
|
||||||
port_select.m_val, transfer_bytes, width, height);
|
port_select.m_val, transfer_bytes, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetTransferBytes(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetTransferBytes(Kernel::HLERequestContext& ctx) {
|
||||||
@ -470,12 +470,12 @@ void Module::Interface::GetTransferBytes(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(cam->ports[port].transfer_bytes);
|
rb.Push(cam->ports[port].transfer_bytes);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.Skip(1, false);
|
rb.Skip(1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED)called, port_select={}", port_select.m_val);
|
LOG_WARNING(Service_CAM, "(STUBBED)called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetMaxBytes(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetMaxBytes(Kernel::HLERequestContext& ctx) {
|
||||||
@ -502,7 +502,7 @@ void Module::Interface::GetMaxBytes(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(bytes);
|
rb.Push(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, width={}, height={}", width, height);
|
LOG_DEBUG(Service_CAM, "called, width={}, height={}", width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetTrimming(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetTrimming(Kernel::HLERequestContext& ctx) {
|
||||||
@ -517,11 +517,11 @@ void Module::Interface::SetTrimming(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}, trim={}", port_select.m_val, trim);
|
LOG_DEBUG(Service_CAM, "called, port_select={}, trim={}", port_select.m_val, trim);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::IsTrimming(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::IsTrimming(Kernel::HLERequestContext& ctx) {
|
||||||
@ -534,12 +534,12 @@ void Module::Interface::IsTrimming(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(cam->ports[port].is_trimming);
|
rb.Push(cam->ports[port].is_trimming);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.Skip(1, false);
|
rb.Skip(1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
LOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
||||||
@ -560,12 +560,12 @@ void Module::Interface::SetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}, x0={}, y0={}, x1={}, y1={}",
|
LOG_DEBUG(Service_CAM, "called, port_select={}, x0={}, y0={}, x1={}, y1={}", port_select.m_val,
|
||||||
port_select.m_val, x0, y0, x1, y1);
|
x0, y0, x1, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
||||||
@ -581,12 +581,12 @@ void Module::Interface::GetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(cam->ports[port].x1);
|
rb.Push(cam->ports[port].x1);
|
||||||
rb.Push(cam->ports[port].y1);
|
rb.Push(cam->ports[port].y1);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
rb.Skip(4, false);
|
rb.Skip(4, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
LOG_DEBUG(Service_CAM, "called, port_select={}", port_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetTrimmingParamsCenter(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetTrimmingParamsCenter(Kernel::HLERequestContext& ctx) {
|
||||||
@ -607,12 +607,12 @@ void Module::Interface::SetTrimmingParamsCenter(Kernel::HLERequestContext& ctx)
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, port_select={}, trim_w={}, trim_h={}, cam_w={}, cam_h={}",
|
LOG_DEBUG(Service_CAM, "called, port_select={}, trim_w={}, trim_h={}, cam_w={}, cam_h={}",
|
||||||
port_select.m_val, trim_w, trim_h, cam_w, cam_h);
|
port_select.m_val, trim_w, trim_h, cam_w, cam_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
|
||||||
@ -632,7 +632,7 @@ void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else if (camera_select[0] && camera_select[1]) {
|
} else if (camera_select[0] && camera_select[1]) {
|
||||||
NGLOG_ERROR(Service_CAM, "camera 0 and 1 can't be both activated");
|
LOG_ERROR(Service_CAM, "camera 0 and 1 can't be both activated");
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
} else {
|
} else {
|
||||||
if (camera_select[0]) {
|
if (camera_select[0]) {
|
||||||
@ -647,11 +647,11 @@ void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, camera_select={}", camera_select.m_val);
|
LOG_DEBUG(Service_CAM, "called, camera_select={}", camera_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SwitchContext(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SwitchContext(Kernel::HLERequestContext& ctx) {
|
||||||
@ -672,13 +672,13 @@ void Module::Interface::SwitchContext(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||||
context_select.m_val);
|
context_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, camera_select={}, context_select={}", camera_select.m_val,
|
LOG_DEBUG(Service_CAM, "called, camera_select={}, context_select={}", camera_select.m_val,
|
||||||
context_select.m_val);
|
context_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::FlipImage(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::FlipImage(Kernel::HLERequestContext& ctx) {
|
||||||
@ -699,13 +699,13 @@ void Module::Interface::FlipImage(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||||
context_select.m_val);
|
context_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, camera_select={}, flip={}, context_select={}",
|
LOG_DEBUG(Service_CAM, "called, camera_select={}, flip={}, context_select={}",
|
||||||
camera_select.m_val, static_cast<int>(flip), context_select.m_val);
|
camera_select.m_val, static_cast<int>(flip), context_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetDetailSize(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetDetailSize(Kernel::HLERequestContext& ctx) {
|
||||||
@ -732,16 +732,16 @@ void Module::Interface::SetDetailSize(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||||
context_select.m_val);
|
context_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM,
|
LOG_DEBUG(Service_CAM,
|
||||||
"called, camera_select={}, width={}, height={}, crop_x0={}, crop_y0={}, "
|
"called, camera_select={}, width={}, height={}, crop_x0={}, crop_y0={}, "
|
||||||
"crop_x1={}, crop_y1={}, context_select={}",
|
"crop_x1={}, crop_y1={}, context_select={}",
|
||||||
camera_select.m_val, resolution.width, resolution.height, resolution.crop_x0,
|
camera_select.m_val, resolution.width, resolution.height, resolution.crop_x0,
|
||||||
resolution.crop_y0, resolution.crop_x1, resolution.crop_y1, context_select.m_val);
|
resolution.crop_y0, resolution.crop_x1, resolution.crop_y1, context_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetSize(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetSize(Kernel::HLERequestContext& ctx) {
|
||||||
@ -762,13 +762,13 @@ void Module::Interface::SetSize(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||||
context_select.m_val);
|
context_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, camera_select={}, size={}, context_select={}",
|
LOG_DEBUG(Service_CAM, "called, camera_select={}, size={}, context_select={}",
|
||||||
camera_select.m_val, size, context_select.m_val);
|
camera_select.m_val, size, context_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetFrameRate(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetFrameRate(Kernel::HLERequestContext& ctx) {
|
||||||
@ -784,12 +784,12 @@ void Module::Interface::SetFrameRate(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val);
|
LOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called, camera_select={}, frame_rate={}",
|
LOG_WARNING(Service_CAM, "(STUBBED) called, camera_select={}, frame_rate={}",
|
||||||
camera_select.m_val, static_cast<int>(frame_rate));
|
camera_select.m_val, static_cast<int>(frame_rate));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetEffect(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetEffect(Kernel::HLERequestContext& ctx) {
|
||||||
@ -810,13 +810,13 @@ void Module::Interface::SetEffect(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||||
context_select.m_val);
|
context_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, camera_select={}, effect={}, context_select={}",
|
LOG_DEBUG(Service_CAM, "called, camera_select={}, effect={}, context_select={}",
|
||||||
camera_select.m_val, static_cast<int>(effect), context_select.m_val);
|
camera_select.m_val, static_cast<int>(effect), context_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetOutputFormat(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetOutputFormat(Kernel::HLERequestContext& ctx) {
|
||||||
@ -837,13 +837,13 @@ void Module::Interface::SetOutputFormat(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||||
context_select.m_val);
|
context_select.m_val);
|
||||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called, camera_select={}, format={}, context_select={}",
|
LOG_DEBUG(Service_CAM, "called, camera_select={}, format={}, context_select={}",
|
||||||
camera_select.m_val, static_cast<int>(format), context_select.m_val);
|
camera_select.m_val, static_cast<int>(format), context_select.m_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SynchronizeVsyncTiming(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SynchronizeVsyncTiming(Kernel::HLERequestContext& ctx) {
|
||||||
@ -854,8 +854,8 @@ void Module::Interface::SynchronizeVsyncTiming(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called, camera_select1={}, camera_select2={}",
|
LOG_WARNING(Service_CAM, "(STUBBED) called, camera_select1={}, camera_select2={}",
|
||||||
camera_select1, camera_select2);
|
camera_select1, camera_select2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetStereoCameraCalibrationData(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetStereoCameraCalibrationData(Kernel::HLERequestContext& ctx) {
|
||||||
@ -881,7 +881,7 @@ void Module::Interface::GetStereoCameraCalibrationData(Kernel::HLERequestContext
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushRaw(data);
|
rb.PushRaw(data);
|
||||||
|
|
||||||
NGLOG_TRACE(Service_CAM, "called");
|
LOG_TRACE(Service_CAM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetPackageParameterWithoutContext(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetPackageParameterWithoutContext(Kernel::HLERequestContext& ctx) {
|
||||||
@ -893,7 +893,7 @@ void Module::Interface::SetPackageParameterWithoutContext(Kernel::HLERequestCont
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called");
|
LOG_WARNING(Service_CAM, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PackageParameterType>
|
template <typename PackageParameterType>
|
||||||
@ -918,8 +918,8 @@ ResultCode Module::SetPackageParameter(const PackageParameterType& package) {
|
|||||||
}
|
}
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}",
|
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", package.camera_select,
|
||||||
package.camera_select, package.context_select);
|
package.context_select);
|
||||||
return ERROR_INVALID_ENUM_VALUE;
|
return ERROR_INVALID_ENUM_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -938,7 +938,7 @@ void Module::Interface::SetPackageParameterWithContext(Kernel::HLERequestContext
|
|||||||
ResultCode result = cam->SetPackageParameter(package);
|
ResultCode result = cam->SetPackageParameter(package);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called");
|
LOG_DEBUG(Service_CAM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::SetPackageParameterWithContextDetail(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::SetPackageParameterWithContextDetail(Kernel::HLERequestContext& ctx) {
|
||||||
@ -951,7 +951,7 @@ void Module::Interface::SetPackageParameterWithContextDetail(Kernel::HLERequestC
|
|||||||
ResultCode result = cam->SetPackageParameter(package);
|
ResultCode result = cam->SetPackageParameter(package);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called");
|
LOG_DEBUG(Service_CAM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetSuitableY2rStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetSuitableY2rStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
||||||
@ -960,7 +960,7 @@ void Module::Interface::GetSuitableY2rStandardCoefficient(Kernel::HLERequestCont
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called");
|
LOG_WARNING(Service_CAM, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::PlayShutterSound(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::PlayShutterSound(Kernel::HLERequestContext& ctx) {
|
||||||
@ -970,7 +970,7 @@ void Module::Interface::PlayShutterSound(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CAM, "(STUBBED) called, sound_id={}", sound_id);
|
LOG_WARNING(Service_CAM, "(STUBBED) called, sound_id={}", sound_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::DriverInitialize(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::DriverInitialize(Kernel::HLERequestContext& ctx) {
|
||||||
@ -998,7 +998,7 @@ void Module::Interface::DriverInitialize(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called");
|
LOG_DEBUG(Service_CAM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::DriverFinalize(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::DriverFinalize(Kernel::HLERequestContext& ctx) {
|
||||||
@ -1014,7 +1014,7 @@ void Module::Interface::DriverFinalize(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CAM, "called");
|
LOG_DEBUG(Service_CAM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::Module() {
|
Module::Module() {
|
||||||
|
@ -25,7 +25,7 @@ void GetCecStateAbbreviated(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
cmd_buff[2] = static_cast<u32>(CecStateAbbreviated::CEC_STATE_ABBREV_IDLE);
|
cmd_buff[2] = static_cast<u32>(CecStateAbbreviated::CEC_STATE_ABBREV_IDLE);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CECD, "(STUBBED) called");
|
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetCecInfoEventHandle(Service::Interface* self) {
|
void GetCecInfoEventHandle(Service::Interface* self) {
|
||||||
@ -34,7 +34,7 @@ void GetCecInfoEventHandle(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
cmd_buff[3] = Kernel::g_handle_table.Create(cecinfo_event).Unwrap(); // Event handle
|
cmd_buff[3] = Kernel::g_handle_table.Create(cecinfo_event).Unwrap(); // Event handle
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CECD, "(STUBBED) called");
|
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetChangeStateEventHandle(Service::Interface* self) {
|
void GetChangeStateEventHandle(Service::Interface* self) {
|
||||||
@ -43,7 +43,7 @@ void GetChangeStateEventHandle(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
cmd_buff[3] = Kernel::g_handle_table.Create(change_state_event).Unwrap(); // Event handle
|
cmd_buff[3] = Kernel::g_handle_table.Create(change_state_event).Unwrap(); // Event handle
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CECD, "(STUBBED) called");
|
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
|
@ -131,7 +131,7 @@ void Module::Interface::GetCountryCodeString(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) {
|
if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) {
|
||||||
NGLOG_ERROR(Service_CFG, "requested country code id={} is invalid", country_code_id);
|
LOG_ERROR(Service_CFG, "requested country code id={} is invalid", country_code_id);
|
||||||
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
|
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
|
||||||
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
|
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
|
||||||
rb.Skip(1, false);
|
rb.Skip(1, false);
|
||||||
@ -160,8 +160,8 @@ void Module::Interface::GetCountryCodeID(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
if (0 == country_code_id) {
|
if (0 == country_code_id) {
|
||||||
NGLOG_ERROR(Service_CFG, "requested country code name={}{} is invalid",
|
LOG_ERROR(Service_CFG, "requested country code name={}{} is invalid",
|
||||||
static_cast<char>(country_code & 0xff), static_cast<char>(country_code >> 8));
|
static_cast<char>(country_code & 0xff), static_cast<char>(country_code >> 8));
|
||||||
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
|
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
|
||||||
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
|
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
|
||||||
rb.Push<u16>(0x00FF);
|
rb.Push<u16>(0x00FF);
|
||||||
@ -210,7 +210,7 @@ void Module::Interface::GenHashConsoleUnique(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_CFG, "called app_id_salt=0x{:X}", app_id_salt);
|
LOG_DEBUG(Service_CFG, "called app_id_salt=0x{:X}", app_id_salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetRegionCanadaUSA(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetRegionCanadaUSA(Kernel::HLERequestContext& ctx) {
|
||||||
@ -309,22 +309,22 @@ ResultVal<void*> Module::GetConfigInfoBlockPointer(u32 block_id, u32 size, u32 f
|
|||||||
[&](const SaveConfigBlockEntry& entry) { return entry.block_id == block_id; });
|
[&](const SaveConfigBlockEntry& entry) { return entry.block_id == block_id; });
|
||||||
|
|
||||||
if (itr == std::end(config->block_entries)) {
|
if (itr == std::end(config->block_entries)) {
|
||||||
NGLOG_ERROR(Service_CFG, "Config block 0x{:X} with flags {} and size {} was not found",
|
LOG_ERROR(Service_CFG, "Config block 0x{:X} with flags {} and size {} was not found",
|
||||||
block_id, flag, size);
|
block_id, flag, size);
|
||||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
|
return ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
|
||||||
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((itr->flags & flag) == 0) {
|
if ((itr->flags & flag) == 0) {
|
||||||
NGLOG_ERROR(Service_CFG, "Invalid flag {} for config block 0x{:X} with size {}", flag,
|
LOG_ERROR(Service_CFG, "Invalid flag {} for config block 0x{:X} with size {}", flag,
|
||||||
block_id, size);
|
block_id, size);
|
||||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::Config,
|
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::Config,
|
||||||
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itr->size != size) {
|
if (itr->size != size) {
|
||||||
NGLOG_ERROR(Service_CFG, "Invalid size {} for config block 0x{:X} with flags {}", size,
|
LOG_ERROR(Service_CFG, "Invalid size {} for config block 0x{:X} with flags {}", size,
|
||||||
block_id, flag);
|
block_id, flag);
|
||||||
return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config,
|
return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config,
|
||||||
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
||||||
}
|
}
|
||||||
@ -599,15 +599,15 @@ static SystemLanguage AdjustLanguageInfoBlock(u32 region, SystemLanguage languag
|
|||||||
|
|
||||||
void Module::SetPreferredRegionCode(u32 region_code) {
|
void Module::SetPreferredRegionCode(u32 region_code) {
|
||||||
preferred_region_code = region_code;
|
preferred_region_code = region_code;
|
||||||
NGLOG_INFO(Service_CFG, "Preferred region code set to {}", preferred_region_code);
|
LOG_INFO(Service_CFG, "Preferred region code set to {}", preferred_region_code);
|
||||||
|
|
||||||
if (Settings::values.region_value == Settings::REGION_VALUE_AUTO_SELECT) {
|
if (Settings::values.region_value == Settings::REGION_VALUE_AUTO_SELECT) {
|
||||||
const SystemLanguage current_language = GetSystemLanguage();
|
const SystemLanguage current_language = GetSystemLanguage();
|
||||||
const SystemLanguage adjusted_language =
|
const SystemLanguage adjusted_language =
|
||||||
AdjustLanguageInfoBlock(region_code, current_language);
|
AdjustLanguageInfoBlock(region_code, current_language);
|
||||||
if (current_language != adjusted_language) {
|
if (current_language != adjusted_language) {
|
||||||
NGLOG_WARNING(Service_CFG, "System language {} does not fit the region. Adjusted to {}",
|
LOG_WARNING(Service_CFG, "System language {} does not fit the region. Adjusted to {}",
|
||||||
static_cast<int>(current_language), static_cast<int>(adjusted_language));
|
static_cast<int>(current_language), static_cast<int>(adjusted_language));
|
||||||
SetSystemLanguage(adjusted_language);
|
SetSystemLanguage(adjusted_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ static void Initialize(Interface* self) {
|
|||||||
cmd_buff[3] = Kernel::g_handle_table.Create(mutex).Unwrap();
|
cmd_buff[3] = Kernel::g_handle_table.Create(mutex).Unwrap();
|
||||||
cmd_buff[4] = Kernel::g_handle_table.Create(shared_memory).Unwrap();
|
cmd_buff[4] = Kernel::g_handle_table.Create(shared_memory).Unwrap();
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CSND, "(STUBBED) called");
|
LOG_WARNING(Service_CSND, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,7 +71,7 @@ static void Shutdown(Interface* self) {
|
|||||||
mutex = nullptr;
|
mutex = nullptr;
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
NGLOG_WARNING(Service_CSND, "(STUBBED) called");
|
LOG_WARNING(Service_CSND, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +88,7 @@ static void ExecuteCommands(Interface* self) {
|
|||||||
|
|
||||||
if (shared_memory == nullptr) {
|
if (shared_memory == nullptr) {
|
||||||
cmd_buff[1] = 1;
|
cmd_buff[1] = 1;
|
||||||
NGLOG_ERROR(Service_CSND, "called, shared memory not allocated");
|
LOG_ERROR(Service_CSND, "called, shared memory not allocated");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ static void ExecuteCommands(Interface* self) {
|
|||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
|
|
||||||
NGLOG_WARNING(Service_CSND, "(STUBBED) called, addr=0x{:08X}", addr);
|
LOG_WARNING(Service_CSND, "(STUBBED) called, addr=0x{:08X}", addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,7 +117,7 @@ static void AcquireSoundChannels(Interface* self) {
|
|||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = 0xFFFFFF00;
|
cmd_buff[2] = 0xFFFFFF00;
|
||||||
NGLOG_WARNING(Service_CSND, "(STUBBED) called");
|
LOG_WARNING(Service_CSND, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
const Interface::FunctionInfo FunctionTable[] = {
|
const Interface::FunctionInfo FunctionTable[] = {
|
||||||
|
@ -19,7 +19,7 @@ void DLP_SRVR::IsChild(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(false);
|
rb.Push(false);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_DLP, "(STUBBED) called");
|
LOG_WARNING(Service_DLP, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
DLP_SRVR::DLP_SRVR() : ServiceFramework("dlp:SRVR", 1) {
|
DLP_SRVR::DLP_SRVR() : ServiceFramework("dlp:SRVR", 1) {
|
||||||
|
@ -109,7 +109,7 @@ static void ConvertProcessAddressFromDspDram(Service::Interface* self) {
|
|||||||
// always zero).
|
// always zero).
|
||||||
cmd_buff[2] = (addr << 1) + (Memory::DSP_RAM_VADDR + 0x40000);
|
cmd_buff[2] = (addr << 1) + (Memory::DSP_RAM_VADDR + 0x40000);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_DSP, "addr=0x{:08X}", addr);
|
LOG_DEBUG(Service_DSP, "addr=0x{:08X}", addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,14 +146,14 @@ static void LoadComponent(Service::Interface* self) {
|
|||||||
std::vector<u8> component_data(size);
|
std::vector<u8> component_data(size);
|
||||||
Memory::ReadBlock(buffer, component_data.data(), component_data.size());
|
Memory::ReadBlock(buffer, component_data.data(), component_data.size());
|
||||||
|
|
||||||
NGLOG_INFO(Service_DSP, "Firmware hash: {:#018x}",
|
LOG_INFO(Service_DSP, "Firmware hash: {:#018x}",
|
||||||
Common::ComputeHash64(component_data.data(), component_data.size()));
|
Common::ComputeHash64(component_data.data(), component_data.size()));
|
||||||
// Some versions of the firmware have the location of DSP structures listed here.
|
// Some versions of the firmware have the location of DSP structures listed here.
|
||||||
if (size > 0x37C) {
|
if (size > 0x37C) {
|
||||||
NGLOG_INFO(Service_DSP, "Structures hash: {:#018x}",
|
LOG_INFO(Service_DSP, "Structures hash: {:#018x}",
|
||||||
Common::ComputeHash64(component_data.data() + 0x340, 60));
|
Common::ComputeHash64(component_data.data() + 0x340, 60));
|
||||||
}
|
}
|
||||||
NGLOG_WARNING(
|
LOG_WARNING(
|
||||||
Service_DSP,
|
Service_DSP,
|
||||||
"(STUBBED) called size=0x{:X}, prog_mask=0x{:08X}, data_mask=0x{:08X}, buffer=0x{:08X}",
|
"(STUBBED) called size=0x{:X}, prog_mask=0x{:08X}, data_mask=0x{:08X}, buffer=0x{:08X}",
|
||||||
size, prog_mask, data_mask, buffer);
|
size, prog_mask, data_mask, buffer);
|
||||||
@ -173,7 +173,7 @@ static void GetSemaphoreEventHandle(Service::Interface* self) {
|
|||||||
// cmd_buff[2] not set
|
// cmd_buff[2] not set
|
||||||
cmd_buff[3] = Kernel::g_handle_table.Create(semaphore_event).Unwrap(); // Event handle
|
cmd_buff[3] = Kernel::g_handle_table.Create(semaphore_event).Unwrap(); // Event handle
|
||||||
|
|
||||||
NGLOG_WARNING(Service_DSP, "(STUBBED) called");
|
LOG_WARNING(Service_DSP, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,8 +198,8 @@ static void FlushDataCache(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x13, 1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x13, 1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
|
|
||||||
NGLOG_TRACE(Service_DSP, "called address=0x{:08X}, size=0x{:X}, process=0x{:08X}", address,
|
LOG_TRACE(Service_DSP, "called address=0x{:08X}, size=0x{:X}, process=0x{:08X}", address, size,
|
||||||
size, process);
|
process);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -230,16 +230,16 @@ static void RegisterInterruptEvents(Service::Interface* self) {
|
|||||||
auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
|
auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
|
||||||
|
|
||||||
if (!evt) {
|
if (!evt) {
|
||||||
NGLOG_INFO(Service_DSP, "Invalid event handle! type={}, pipe={}, event_handle=0x{:08X}",
|
LOG_INFO(Service_DSP, "Invalid event handle! type={}, pipe={}, event_handle=0x{:08X}",
|
||||||
type_index, pipe_index, event_handle);
|
type_index, pipe_index, event_handle);
|
||||||
ASSERT(false); // TODO: This should really be handled at an IPC translation layer.
|
ASSERT(false); // TODO: This should really be handled at an IPC translation layer.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interrupt_events.HasTooManyEventsRegistered()) {
|
if (interrupt_events.HasTooManyEventsRegistered()) {
|
||||||
NGLOG_INFO(Service_DSP,
|
LOG_INFO(Service_DSP,
|
||||||
"Ran out of space to register interrupts (Attempted to register "
|
"Ran out of space to register interrupts (Attempted to register "
|
||||||
"type={}, pipe={}, event_handle=0x{:08X})",
|
"type={}, pipe={}, event_handle=0x{:08X})",
|
||||||
type_index, pipe_index, event_handle);
|
type_index, pipe_index, event_handle);
|
||||||
cmd_buff[1] = ResultCode(ErrorDescription::InvalidResultValue, ErrorModule::DSP,
|
cmd_buff[1] = ResultCode(ErrorDescription::InvalidResultValue, ErrorModule::DSP,
|
||||||
ErrorSummary::OutOfResource, ErrorLevel::Status)
|
ErrorSummary::OutOfResource, ErrorLevel::Status)
|
||||||
.raw;
|
.raw;
|
||||||
@ -247,13 +247,13 @@ static void RegisterInterruptEvents(Service::Interface* self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interrupt_events.Get(type, pipe) = evt;
|
interrupt_events.Get(type, pipe) = evt;
|
||||||
NGLOG_INFO(Service_DSP, "Registered type={}, pipe={}, event_handle=0x{:08X}", type_index,
|
LOG_INFO(Service_DSP, "Registered type={}, pipe={}, event_handle=0x{:08X}", type_index,
|
||||||
pipe_index, event_handle);
|
pipe_index, event_handle);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
} else {
|
} else {
|
||||||
interrupt_events.Get(type, pipe) = nullptr;
|
interrupt_events.Get(type, pipe) = nullptr;
|
||||||
NGLOG_INFO(Service_DSP, "Unregistered interrupt={}, channel={}, event_handle=0x{:08X}",
|
LOG_INFO(Service_DSP, "Unregistered interrupt={}, channel={}, event_handle=0x{:08X}",
|
||||||
type_index, pipe_index, event_handle);
|
type_index, pipe_index, event_handle);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ static void SetSemaphore(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x7, 1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x7, 1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
|
|
||||||
NGLOG_WARNING(Service_DSP, "(STUBBED) called");
|
LOG_WARNING(Service_DSP, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,10 +295,10 @@ static void WriteProcessPipe(Service::Interface* self) {
|
|||||||
AudioCore::DspPipe pipe = static_cast<AudioCore::DspPipe>(pipe_index);
|
AudioCore::DspPipe pipe = static_cast<AudioCore::DspPipe>(pipe_index);
|
||||||
|
|
||||||
if (IPC::StaticBufferDesc(size, 1) != cmd_buff[3]) {
|
if (IPC::StaticBufferDesc(size, 1) != cmd_buff[3]) {
|
||||||
NGLOG_ERROR(Service_DSP,
|
LOG_ERROR(Service_DSP,
|
||||||
"IPC static buffer descriptor failed validation (0x{:X}). pipe={}, "
|
"IPC static buffer descriptor failed validation (0x{:X}). pipe={}, "
|
||||||
"size=0x{:X}, buffer=0x{:08X}",
|
"size=0x{:X}, buffer=0x{:08X}",
|
||||||
cmd_buff[3], pipe_index, size, buffer);
|
cmd_buff[3], pipe_index, size, buffer);
|
||||||
cmd_buff[0] = IPC::MakeHeader(0, 1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0, 1, 0);
|
||||||
cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
|
cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
|
||||||
return;
|
return;
|
||||||
@ -335,7 +335,7 @@ static void WriteProcessPipe(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0xD, 1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0xD, 1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_DSP, "pipe={}, size=0x{:X}, buffer=0x{:08X}", pipe_index, size, buffer);
|
LOG_DEBUG(Service_DSP, "pipe={}, size=0x{:X}, buffer=0x{:08X}", pipe_index, size, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -380,7 +380,7 @@ static void ReadPipeIfPossible(Service::Interface* self) {
|
|||||||
cmd_buff[3] = IPC::StaticBufferDesc(size, 0);
|
cmd_buff[3] = IPC::StaticBufferDesc(size, 0);
|
||||||
cmd_buff[4] = addr;
|
cmd_buff[4] = addr;
|
||||||
|
|
||||||
NGLOG_DEBUG(
|
LOG_DEBUG(
|
||||||
Service_DSP,
|
Service_DSP,
|
||||||
"pipe={}, unknown=0x{:08X}, size=0x{:X}, buffer=0x{:08X}, return cmd_buff[2]=0x{:08X}",
|
"pipe={}, unknown=0x{:08X}, size=0x{:X}, buffer=0x{:08X}, return cmd_buff[2]=0x{:08X}",
|
||||||
pipe_index, unknown, size, addr, cmd_buff[2]);
|
pipe_index, unknown, size, addr, cmd_buff[2]);
|
||||||
@ -426,7 +426,7 @@ static void ReadPipe(Service::Interface* self) {
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(
|
LOG_DEBUG(
|
||||||
Service_DSP,
|
Service_DSP,
|
||||||
"pipe={}, unknown=0x{:08X}, size=0x{:X}, buffer=0x{:08X}, return cmd_buff[2]=0x{:08X}",
|
"pipe={}, unknown=0x{:08X}, size=0x{:X}, buffer=0x{:08X}, return cmd_buff[2]=0x{:08X}",
|
||||||
pipe_index, unknown, size, addr, cmd_buff[2]);
|
pipe_index, unknown, size, addr, cmd_buff[2]);
|
||||||
@ -453,8 +453,8 @@ static void GetPipeReadableSize(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
cmd_buff[2] = static_cast<u32>(Core::DSP().GetPipeReadableSize(pipe));
|
cmd_buff[2] = static_cast<u32>(Core::DSP().GetPipeReadableSize(pipe));
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_DSP, "pipe={}, unknown=0x{:08X}, return cmd_buff[2]=0x{:08X}", pipe_index,
|
LOG_DEBUG(Service_DSP, "pipe={}, unknown=0x{:08X}, return cmd_buff[2]=0x{:08X}", pipe_index,
|
||||||
unknown, cmd_buff[2]);
|
unknown, cmd_buff[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -472,7 +472,7 @@ static void SetSemaphoreMask(Service::Interface* self) {
|
|||||||
cmd_buff[0] = IPC::MakeHeader(0x17, 1, 0);
|
cmd_buff[0] = IPC::MakeHeader(0x17, 1, 0);
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
|
|
||||||
NGLOG_WARNING(Service_DSP, "(STUBBED) called mask=0x{:08X}", mask);
|
LOG_WARNING(Service_DSP, "(STUBBED) called mask=0x{:08X}", mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -491,7 +491,7 @@ static void GetHeadphoneStatus(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
||||||
cmd_buff[2] = 0; // Not using headphones
|
cmd_buff[2] = 0; // Not using headphones
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_DSP, "called");
|
LOG_DEBUG(Service_DSP, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -530,7 +530,7 @@ static void RecvData(Service::Interface* self) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_DSP, "register_number={}", register_number);
|
LOG_DEBUG(Service_DSP, "register_number={}", register_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -555,7 +555,7 @@ static void RecvDataIsReady(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||||
cmd_buff[2] = 1; // Ready to read
|
cmd_buff[2] = 1; // Ready to read
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_DSP, "register_number={}", register_number);
|
LOG_DEBUG(Service_DSP, "register_number={}", register_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Interface::FunctionInfo FunctionTable[] = {
|
const Interface::FunctionInfo FunctionTable[] = {
|
||||||
|
@ -132,30 +132,29 @@ static std::string GetCurrentSystemTime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void LogGenericInfo(const ErrInfo::ErrInfoCommon& errinfo_common) {
|
static void LogGenericInfo(const ErrInfo::ErrInfoCommon& errinfo_common) {
|
||||||
NGLOG_CRITICAL(Service_ERR, "PID: 0x{:08X}", errinfo_common.pid);
|
LOG_CRITICAL(Service_ERR, "PID: 0x{:08X}", errinfo_common.pid);
|
||||||
NGLOG_CRITICAL(Service_ERR, "REV: 0x{:08X}_0x{:08X}", errinfo_common.rev_high,
|
LOG_CRITICAL(Service_ERR, "REV: 0x{:08X}_0x{:08X}", errinfo_common.rev_high,
|
||||||
errinfo_common.rev_low);
|
errinfo_common.rev_low);
|
||||||
NGLOG_CRITICAL(Service_ERR, "TID: 0x{:08X}_0x{:08X}", errinfo_common.title_id_high,
|
LOG_CRITICAL(Service_ERR, "TID: 0x{:08X}_0x{:08X}", errinfo_common.title_id_high,
|
||||||
errinfo_common.title_id_low);
|
errinfo_common.title_id_low);
|
||||||
NGLOG_CRITICAL(Service_ERR, "AID: 0x{:08X}_0x{:08X}", errinfo_common.app_title_id_high,
|
LOG_CRITICAL(Service_ERR, "AID: 0x{:08X}_0x{:08X}", errinfo_common.app_title_id_high,
|
||||||
errinfo_common.app_title_id_low);
|
errinfo_common.app_title_id_low);
|
||||||
NGLOG_CRITICAL(Service_ERR, "ADR: 0x{:08X}", errinfo_common.pc_address);
|
LOG_CRITICAL(Service_ERR, "ADR: 0x{:08X}", errinfo_common.pc_address);
|
||||||
|
|
||||||
ResultCode result_code{errinfo_common.result_code};
|
ResultCode result_code{errinfo_common.result_code};
|
||||||
NGLOG_CRITICAL(Service_ERR, "RSL: 0x{:08X}", result_code.raw);
|
LOG_CRITICAL(Service_ERR, "RSL: 0x{:08X}", result_code.raw);
|
||||||
NGLOG_CRITICAL(Service_ERR, " Level: {}", static_cast<u32>(result_code.level.Value()));
|
LOG_CRITICAL(Service_ERR, " Level: {}", static_cast<u32>(result_code.level.Value()));
|
||||||
NGLOG_CRITICAL(Service_ERR, " Summary: {}", static_cast<u32>(result_code.summary.Value()));
|
LOG_CRITICAL(Service_ERR, " Summary: {}", static_cast<u32>(result_code.summary.Value()));
|
||||||
NGLOG_CRITICAL(Service_ERR, " Module: {}", static_cast<u32>(result_code.module.Value()));
|
LOG_CRITICAL(Service_ERR, " Module: {}", static_cast<u32>(result_code.module.Value()));
|
||||||
NGLOG_CRITICAL(Service_ERR, " Desc: {}", static_cast<u32>(result_code.description.Value()));
|
LOG_CRITICAL(Service_ERR, " Desc: {}", static_cast<u32>(result_code.description.Value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) {
|
void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 1, 32, 0);
|
IPC::RequestParser rp(ctx, 1, 32, 0);
|
||||||
|
|
||||||
NGLOG_CRITICAL(Service_ERR, "Fatal error");
|
LOG_CRITICAL(Service_ERR, "Fatal error");
|
||||||
const ErrInfo errinfo = rp.PopRaw<ErrInfo>();
|
const ErrInfo errinfo = rp.PopRaw<ErrInfo>();
|
||||||
NGLOG_CRITICAL(Service_ERR, "Fatal error type: {}",
|
LOG_CRITICAL(Service_ERR, "Fatal error type: {}", GetErrType(errinfo.errinfo_common.specifier));
|
||||||
GetErrType(errinfo.errinfo_common.specifier));
|
|
||||||
Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorUnknown);
|
Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorUnknown);
|
||||||
|
|
||||||
// Generic Info
|
// Generic Info
|
||||||
@ -166,56 +165,56 @@ void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) {
|
|||||||
case FatalErrType::Corrupted:
|
case FatalErrType::Corrupted:
|
||||||
case FatalErrType::CardRemoved:
|
case FatalErrType::CardRemoved:
|
||||||
case FatalErrType::Logged: {
|
case FatalErrType::Logged: {
|
||||||
NGLOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime());
|
LOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FatalErrType::Exception: {
|
case FatalErrType::Exception: {
|
||||||
const auto& errtype = errinfo.exception;
|
const auto& errtype = errinfo.exception;
|
||||||
|
|
||||||
// Register Info
|
// Register Info
|
||||||
NGLOG_CRITICAL(Service_ERR, "ARM Registers:");
|
LOG_CRITICAL(Service_ERR, "ARM Registers:");
|
||||||
for (u32 index = 0; index < errtype.exception_data.exception_context.arm_regs.size();
|
for (u32 index = 0; index < errtype.exception_data.exception_context.arm_regs.size();
|
||||||
++index) {
|
++index) {
|
||||||
if (index < 13) {
|
if (index < 13) {
|
||||||
NGLOG_DEBUG(Service_ERR, "r{}=0x{:08X}", index,
|
LOG_DEBUG(Service_ERR, "r{}=0x{:08X}", index,
|
||||||
errtype.exception_data.exception_context.arm_regs.at(index));
|
errtype.exception_data.exception_context.arm_regs.at(index));
|
||||||
} else if (index == 13) {
|
} else if (index == 13) {
|
||||||
NGLOG_CRITICAL(Service_ERR, "SP=0x{:08X}",
|
LOG_CRITICAL(Service_ERR, "SP=0x{:08X}",
|
||||||
errtype.exception_data.exception_context.arm_regs.at(index));
|
errtype.exception_data.exception_context.arm_regs.at(index));
|
||||||
} else if (index == 14) {
|
} else if (index == 14) {
|
||||||
NGLOG_CRITICAL(Service_ERR, "LR=0x{:08X}",
|
LOG_CRITICAL(Service_ERR, "LR=0x{:08X}",
|
||||||
errtype.exception_data.exception_context.arm_regs.at(index));
|
errtype.exception_data.exception_context.arm_regs.at(index));
|
||||||
} else if (index == 15) {
|
} else if (index == 15) {
|
||||||
NGLOG_CRITICAL(Service_ERR, "PC=0x{:08X}",
|
LOG_CRITICAL(Service_ERR, "PC=0x{:08X}",
|
||||||
errtype.exception_data.exception_context.arm_regs.at(index));
|
errtype.exception_data.exception_context.arm_regs.at(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NGLOG_CRITICAL(Service_ERR, "CPSR=0x{:08X}", errtype.exception_data.exception_context.cpsr);
|
LOG_CRITICAL(Service_ERR, "CPSR=0x{:08X}", errtype.exception_data.exception_context.cpsr);
|
||||||
|
|
||||||
// Exception Info
|
// Exception Info
|
||||||
NGLOG_CRITICAL(Service_ERR, "EXCEPTION TYPE: {}",
|
LOG_CRITICAL(Service_ERR, "EXCEPTION TYPE: {}",
|
||||||
GetExceptionType(errtype.exception_data.exception_info.exception_type));
|
GetExceptionType(errtype.exception_data.exception_info.exception_type));
|
||||||
switch (static_cast<ExceptionType>(errtype.exception_data.exception_info.exception_type)) {
|
switch (static_cast<ExceptionType>(errtype.exception_data.exception_info.exception_type)) {
|
||||||
case ExceptionType::PrefetchAbort:
|
case ExceptionType::PrefetchAbort:
|
||||||
NGLOG_CRITICAL(Service_ERR, "IFSR: 0x{:08X}", errtype.exception_data.exception_info.sr);
|
LOG_CRITICAL(Service_ERR, "IFSR: 0x{:08X}", errtype.exception_data.exception_info.sr);
|
||||||
NGLOG_CRITICAL(Service_ERR, "r15: 0x{:08X}", errtype.exception_data.exception_info.ar);
|
LOG_CRITICAL(Service_ERR, "r15: 0x{:08X}", errtype.exception_data.exception_info.ar);
|
||||||
break;
|
break;
|
||||||
case ExceptionType::DataAbort:
|
case ExceptionType::DataAbort:
|
||||||
NGLOG_CRITICAL(Service_ERR, "DFSR: 0x{:08X}", errtype.exception_data.exception_info.sr);
|
LOG_CRITICAL(Service_ERR, "DFSR: 0x{:08X}", errtype.exception_data.exception_info.sr);
|
||||||
NGLOG_CRITICAL(Service_ERR, "DFAR: 0x{:08X}", errtype.exception_data.exception_info.ar);
|
LOG_CRITICAL(Service_ERR, "DFAR: 0x{:08X}", errtype.exception_data.exception_info.ar);
|
||||||
break;
|
break;
|
||||||
case ExceptionType::VectorFP:
|
case ExceptionType::VectorFP:
|
||||||
NGLOG_CRITICAL(Service_ERR, "FPEXC: 0x{:08X}",
|
LOG_CRITICAL(Service_ERR, "FPEXC: 0x{:08X}",
|
||||||
errtype.exception_data.exception_info.fpinst);
|
errtype.exception_data.exception_info.fpinst);
|
||||||
NGLOG_CRITICAL(Service_ERR, "FINST: 0x{:08X}",
|
LOG_CRITICAL(Service_ERR, "FINST: 0x{:08X}",
|
||||||
errtype.exception_data.exception_info.fpinst);
|
errtype.exception_data.exception_info.fpinst);
|
||||||
NGLOG_CRITICAL(Service_ERR, "FINST2: 0x{:08X}",
|
LOG_CRITICAL(Service_ERR, "FINST2: 0x{:08X}",
|
||||||
errtype.exception_data.exception_info.fpinst2);
|
errtype.exception_data.exception_info.fpinst2);
|
||||||
break;
|
break;
|
||||||
case ExceptionType::Undefined:
|
case ExceptionType::Undefined:
|
||||||
break; // Not logging exception_info for this case
|
break; // Not logging exception_info for this case
|
||||||
}
|
}
|
||||||
NGLOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime());
|
LOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,8 +222,8 @@ void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) {
|
|||||||
const auto& errtype = errinfo.result_failure;
|
const auto& errtype = errinfo.result_failure;
|
||||||
|
|
||||||
// Failure Message
|
// Failure Message
|
||||||
NGLOG_CRITICAL(Service_ERR, "Failure Message: {}", errtype.message);
|
LOG_CRITICAL(Service_ERR, "Failure Message: {}", errtype.message);
|
||||||
NGLOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime());
|
LOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ void Module::Interface::GetMyPresence(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushStaticBuffer(buffer, 0);
|
rb.PushStaticBuffer(buffer, 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called");
|
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetFriendKeyList(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetFriendKeyList(Kernel::HLERequestContext& ctx) {
|
||||||
@ -46,7 +46,7 @@ void Module::Interface::GetFriendKeyList(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(0); // 0 friends
|
rb.Push<u32>(0); // 0 friends
|
||||||
rb.PushStaticBuffer(buffer, 0);
|
rb.PushStaticBuffer(buffer, 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called, unknown={}, frd_count={}", unknown, frd_count);
|
LOG_WARNING(Service_FRD, "(STUBBED) called, unknown={}, frd_count={}", unknown, frd_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetFriendProfile(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetFriendProfile(Kernel::HLERequestContext& ctx) {
|
||||||
@ -61,7 +61,7 @@ void Module::Interface::GetFriendProfile(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushStaticBuffer(buffer, 0);
|
rb.PushStaticBuffer(buffer, 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count);
|
LOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetFriendAttributeFlags(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetFriendAttributeFlags(Kernel::HLERequestContext& ctx) {
|
||||||
@ -76,7 +76,7 @@ void Module::Interface::GetFriendAttributeFlags(Kernel::HLERequestContext& ctx)
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushStaticBuffer(buffer, 0);
|
rb.PushStaticBuffer(buffer, 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count);
|
LOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetMyFriendKey(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetMyFriendKey(Kernel::HLERequestContext& ctx) {
|
||||||
@ -85,7 +85,7 @@ void Module::Interface::GetMyFriendKey(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushRaw(frd->my_friend_key);
|
rb.PushRaw(frd->my_friend_key);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called");
|
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
|
||||||
@ -102,7 +102,7 @@ void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushRaw(screen_name);
|
rb.PushRaw(screen_name);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called");
|
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx) {
|
||||||
@ -130,7 +130,7 @@ void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx
|
|||||||
// scambled_friend_code[5]; unscrambled_friend_code[3] = scambled_friend_code[3] ^
|
// scambled_friend_code[5]; unscrambled_friend_code[3] = scambled_friend_code[3] ^
|
||||||
// scambled_friend_code[5];
|
// scambled_friend_code[5];
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called");
|
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushStaticBuffer(unscrambled_friend_codes, 0);
|
rb.PushStaticBuffer(unscrambled_friend_codes, 0);
|
||||||
@ -144,7 +144,7 @@ void Module::Interface::SetClientSdkVersion(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FRD, "(STUBBED) called, version: 0x{:08X}", version);
|
LOG_WARNING(Service_FRD, "(STUBBED) called, version: 0x{:08X}", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::Module() = default;
|
Module::Module() = default;
|
||||||
|
@ -73,12 +73,12 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
|||||||
u64 offset = rp.Pop<u64>();
|
u64 offset = rp.Pop<u64>();
|
||||||
u32 length = rp.Pop<u32>();
|
u32 length = rp.Pop<u32>();
|
||||||
auto& buffer = rp.PopMappedBuffer();
|
auto& buffer = rp.PopMappedBuffer();
|
||||||
NGLOG_TRACE(Service_FS, "Read {}: offset=0x{:x} length=0x{:08X}", GetName(), offset, length);
|
LOG_TRACE(Service_FS, "Read {}: offset=0x{:x} length=0x{:08X}", GetName(), offset, length);
|
||||||
|
|
||||||
const FileSessionSlot* file = GetSessionData(ctx.Session());
|
const FileSessionSlot* file = GetSessionData(ctx.Session());
|
||||||
|
|
||||||
if (file->subfile && length > file->size) {
|
if (file->subfile && length > file->size) {
|
||||||
NGLOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating");
|
LOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating");
|
||||||
length = file->size;
|
length = file->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,9 +86,9 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
|||||||
offset += file->offset;
|
offset += file->offset;
|
||||||
|
|
||||||
if (offset + length > backend->GetSize()) {
|
if (offset + length > backend->GetSize()) {
|
||||||
NGLOG_ERROR(Service_FS,
|
LOG_ERROR(Service_FS,
|
||||||
"Reading from out of bounds offset=0x{:x} length=0x{:08X} file_size=0x{:x}",
|
"Reading from out of bounds offset=0x{:x} length=0x{:08X} file_size=0x{:x}",
|
||||||
offset, length, backend->GetSize());
|
offset, length, backend->GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||||
@ -119,8 +119,8 @@ void File::Write(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 length = rp.Pop<u32>();
|
u32 length = rp.Pop<u32>();
|
||||||
u32 flush = rp.Pop<u32>();
|
u32 flush = rp.Pop<u32>();
|
||||||
auto& buffer = rp.PopMappedBuffer();
|
auto& buffer = rp.PopMappedBuffer();
|
||||||
NGLOG_TRACE(Service_FS, "Write {}: offset=0x{:x} length={}, flush=0x{:x}", GetName(), offset,
|
LOG_TRACE(Service_FS, "Write {}: offset=0x{:x} length={}, flush=0x{:x}", GetName(), offset,
|
||||||
length, flush);
|
length, flush);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||||
|
|
||||||
@ -181,8 +181,8 @@ void File::Close(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
// TODO(Subv): Only close the backend if this client is the only one left.
|
// TODO(Subv): Only close the backend if this client is the only one left.
|
||||||
if (connected_sessions.size() > 1)
|
if (connected_sessions.size() > 1)
|
||||||
NGLOG_WARNING(Service_FS, "Closing File backend but {} clients still connected",
|
LOG_WARNING(Service_FS, "Closing File backend but {} clients still connected",
|
||||||
connected_sessions.size());
|
connected_sessions.size());
|
||||||
|
|
||||||
backend->Close();
|
backend->Close();
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
@ -226,7 +226,7 @@ void File::GetPriority(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void File::OpenLinkFile(Kernel::HLERequestContext& ctx) {
|
void File::OpenLinkFile(Kernel::HLERequestContext& ctx) {
|
||||||
NGLOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile {}", GetName());
|
LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile {}", GetName());
|
||||||
using Kernel::ClientSession;
|
using Kernel::ClientSession;
|
||||||
using Kernel::ServerSession;
|
using Kernel::ServerSession;
|
||||||
using Kernel::SharedPtr;
|
using Kernel::SharedPtr;
|
||||||
@ -327,7 +327,7 @@ void Directory::Read(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 count = rp.Pop<u32>();
|
u32 count = rp.Pop<u32>();
|
||||||
auto& buffer = rp.PopMappedBuffer();
|
auto& buffer = rp.PopMappedBuffer();
|
||||||
std::vector<FileSys::Entry> entries(count);
|
std::vector<FileSys::Entry> entries(count);
|
||||||
NGLOG_TRACE(Service_FS, "Read {}: count={}", GetName(), count);
|
LOG_TRACE(Service_FS, "Read {}: count={}", GetName(), count);
|
||||||
// Number of entries actually read
|
// Number of entries actually read
|
||||||
u32 read = backend->Read(static_cast<u32>(entries.size()), entries.data());
|
u32 read = backend->Read(static_cast<u32>(entries.size()), entries.data());
|
||||||
buffer.Write(entries.data(), 0, read * sizeof(FileSys::Entry));
|
buffer.Write(entries.data(), 0, read * sizeof(FileSys::Entry));
|
||||||
@ -340,7 +340,7 @@ void Directory::Read(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
void Directory::Close(Kernel::HLERequestContext& ctx) {
|
void Directory::Close(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x0802, 0, 0);
|
IPC::RequestParser rp(ctx, 0x0802, 0, 0);
|
||||||
NGLOG_TRACE(Service_FS, "Close {}", GetName());
|
LOG_TRACE(Service_FS, "Close {}", GetName());
|
||||||
backend->Close();
|
backend->Close();
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
@ -370,7 +370,7 @@ static ArchiveBackend* GetArchive(ArchiveHandle handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archive_path) {
|
ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archive_path) {
|
||||||
NGLOG_TRACE(Service_FS, "Opening archive with id code 0x{:08X}", static_cast<u32>(id_code));
|
LOG_TRACE(Service_FS, "Opening archive with id code 0x{:08X}", static_cast<u32>(id_code));
|
||||||
|
|
||||||
auto itr = id_code_map.find(id_code);
|
auto itr = id_code_map.find(id_code);
|
||||||
if (itr == id_code_map.end()) {
|
if (itr == id_code_map.end()) {
|
||||||
@ -404,8 +404,8 @@ ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factor
|
|||||||
ASSERT_MSG(inserted, "Tried to register more than one archive with same id code");
|
ASSERT_MSG(inserted, "Tried to register more than one archive with same id code");
|
||||||
|
|
||||||
auto& archive = result.first->second;
|
auto& archive = result.first->second;
|
||||||
NGLOG_DEBUG(Service_FS, "Registered archive {} with id code 0x{:08X}", archive->GetName(),
|
LOG_DEBUG(Service_FS, "Registered archive {} with id code 0x{:08X}", archive->GetName(),
|
||||||
static_cast<u32>(id_code));
|
static_cast<u32>(id_code));
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ ResultCode DeleteExtSaveData(MediaType media_type, u32 high, u32 low) {
|
|||||||
} else if (media_type == MediaType::SDMC) {
|
} else if (media_type == MediaType::SDMC) {
|
||||||
media_type_directory = FileUtil::GetUserPath(D_SDMC_IDX);
|
media_type_directory = FileUtil::GetUserPath(D_SDMC_IDX);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_FS, "Unsupported media type {}", static_cast<u32>(media_type));
|
LOG_ERROR(Service_FS, "Unsupported media type {}", static_cast<u32>(media_type));
|
||||||
return ResultCode(-1); // TODO(Subv): Find the right error code
|
return ResultCode(-1); // TODO(Subv): Find the right error code
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,14 +623,14 @@ void RegisterArchiveTypes() {
|
|||||||
if (sdmc_factory->Initialize())
|
if (sdmc_factory->Initialize())
|
||||||
RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC);
|
RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC);
|
||||||
else
|
else
|
||||||
NGLOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path {}", sdmc_directory);
|
LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path {}", sdmc_directory);
|
||||||
|
|
||||||
auto sdmcwo_factory = std::make_unique<FileSys::ArchiveFactory_SDMCWriteOnly>(sdmc_directory);
|
auto sdmcwo_factory = std::make_unique<FileSys::ArchiveFactory_SDMCWriteOnly>(sdmc_directory);
|
||||||
if (sdmcwo_factory->Initialize())
|
if (sdmcwo_factory->Initialize())
|
||||||
RegisterArchiveType(std::move(sdmcwo_factory), ArchiveIdCode::SDMCWriteOnly);
|
RegisterArchiveType(std::move(sdmcwo_factory), ArchiveIdCode::SDMCWriteOnly);
|
||||||
else
|
else
|
||||||
NGLOG_ERROR(Service_FS, "Can't instantiate SDMCWriteOnly archive with path {}",
|
LOG_ERROR(Service_FS, "Can't instantiate SDMCWriteOnly archive with path {}",
|
||||||
sdmc_directory);
|
sdmc_directory);
|
||||||
|
|
||||||
// Create the SaveData archive
|
// Create the SaveData archive
|
||||||
auto sd_savedata_source = std::make_shared<FileSys::ArchiveSource_SDSaveData>(sdmc_directory);
|
auto sd_savedata_source = std::make_shared<FileSys::ArchiveSource_SDSaveData>(sdmc_directory);
|
||||||
@ -650,16 +650,16 @@ void RegisterArchiveTypes() {
|
|||||||
if (extsavedata_factory->Initialize())
|
if (extsavedata_factory->Initialize())
|
||||||
RegisterArchiveType(std::move(extsavedata_factory), ArchiveIdCode::ExtSaveData);
|
RegisterArchiveType(std::move(extsavedata_factory), ArchiveIdCode::ExtSaveData);
|
||||||
else
|
else
|
||||||
NGLOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path {}",
|
LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path {}",
|
||||||
extsavedata_factory->GetMountPoint());
|
extsavedata_factory->GetMountPoint());
|
||||||
|
|
||||||
auto sharedextsavedata_factory =
|
auto sharedextsavedata_factory =
|
||||||
std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true);
|
std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true);
|
||||||
if (sharedextsavedata_factory->Initialize())
|
if (sharedextsavedata_factory->Initialize())
|
||||||
RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData);
|
RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData);
|
||||||
else
|
else
|
||||||
NGLOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path {}",
|
LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path {}",
|
||||||
sharedextsavedata_factory->GetMountPoint());
|
sharedextsavedata_factory->GetMountPoint());
|
||||||
|
|
||||||
// Create the NCCH archive, basically a small variation of the RomFS archive
|
// Create the NCCH archive, basically a small variation of the RomFS archive
|
||||||
auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_NCCH>();
|
auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_NCCH>();
|
||||||
@ -676,9 +676,8 @@ void RegisterArchiveTypes() {
|
|||||||
void RegisterSelfNCCH(Loader::AppLoader& app_loader) {
|
void RegisterSelfNCCH(Loader::AppLoader& app_loader) {
|
||||||
auto itr = id_code_map.find(ArchiveIdCode::SelfNCCH);
|
auto itr = id_code_map.find(ArchiveIdCode::SelfNCCH);
|
||||||
if (itr == id_code_map.end()) {
|
if (itr == id_code_map.end()) {
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(Service_FS,
|
||||||
Service_FS,
|
"Could not register a new NCCH because the SelfNCCH archive hasn't been created");
|
||||||
"Could not register a new NCCH because the SelfNCCH archive hasn't been created");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,8 +54,7 @@ void FS_USER::OpenFile(Kernel::HLERequestContext& ctx) {
|
|||||||
ASSERT(filename.size() == filename_size);
|
ASSERT(filename.size() == filename_size);
|
||||||
FileSys::Path file_path(filename_type, filename);
|
FileSys::Path file_path(filename_type, filename);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "path={}, mode={} attrs={}", file_path.DebugStr(), mode.hex,
|
LOG_DEBUG(Service_FS, "path={}, mode={} attrs={}", file_path.DebugStr(), mode.hex, attributes);
|
||||||
attributes);
|
|
||||||
|
|
||||||
ResultVal<std::shared_ptr<File>> file_res =
|
ResultVal<std::shared_ptr<File>> file_res =
|
||||||
OpenFileFromArchive(archive_handle, file_path, mode);
|
OpenFileFromArchive(archive_handle, file_path, mode);
|
||||||
@ -66,7 +65,7 @@ void FS_USER::OpenFile(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.PushMoveObjects(file->Connect());
|
rb.PushMoveObjects(file->Connect());
|
||||||
} else {
|
} else {
|
||||||
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
||||||
NGLOG_ERROR(Service_FS, "failed to get a handle for file {}", file_path.DebugStr());
|
LOG_ERROR(Service_FS, "failed to get a handle for file {}", file_path.DebugStr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,18 +87,17 @@ void FS_USER::OpenFileDirectly(Kernel::HLERequestContext& ctx) {
|
|||||||
FileSys::Path archive_path(archivename_type, archivename);
|
FileSys::Path archive_path(archivename_type, archivename);
|
||||||
FileSys::Path file_path(filename_type, filename);
|
FileSys::Path file_path(filename_type, filename);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS,
|
LOG_DEBUG(Service_FS, "archive_id=0x{:08X} archive_path={} file_path={}, mode={} attributes={}",
|
||||||
"archive_id=0x{:08X} archive_path={} file_path={}, mode={} attributes={}",
|
static_cast<u32>(archive_id), archive_path.DebugStr(), file_path.DebugStr(), mode.hex,
|
||||||
static_cast<u32>(archive_id), archive_path.DebugStr(), file_path.DebugStr(),
|
attributes);
|
||||||
mode.hex, attributes);
|
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
|
|
||||||
ResultVal<ArchiveHandle> archive_handle = Service::FS::OpenArchive(archive_id, archive_path);
|
ResultVal<ArchiveHandle> archive_handle = Service::FS::OpenArchive(archive_id, archive_path);
|
||||||
if (archive_handle.Failed()) {
|
if (archive_handle.Failed()) {
|
||||||
NGLOG_ERROR(Service_FS,
|
LOG_ERROR(Service_FS,
|
||||||
"Failed to get a handle for archive archive_id=0x{:08X} archive_path={}",
|
"Failed to get a handle for archive archive_id=0x{:08X} archive_path={}",
|
||||||
static_cast<u32>(archive_id), archive_path.DebugStr());
|
static_cast<u32>(archive_id), archive_path.DebugStr());
|
||||||
rb.Push(archive_handle.Code());
|
rb.Push(archive_handle.Code());
|
||||||
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
||||||
return;
|
return;
|
||||||
@ -114,8 +112,8 @@ void FS_USER::OpenFileDirectly(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.PushMoveObjects(file->Connect());
|
rb.PushMoveObjects(file->Connect());
|
||||||
} else {
|
} else {
|
||||||
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
||||||
NGLOG_ERROR(Service_FS, "failed to get a handle for file {} mode={} attributes={}",
|
LOG_ERROR(Service_FS, "failed to get a handle for file {} mode={} attributes={}",
|
||||||
file_path.DebugStr(), mode.hex, attributes);
|
file_path.DebugStr(), mode.hex, attributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,8 +128,8 @@ void FS_USER::DeleteFile(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
FileSys::Path file_path(filename_type, filename);
|
FileSys::Path file_path(filename_type, filename);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(filename_type),
|
LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(filename_type), filename_size,
|
||||||
filename_size, file_path.DebugStr());
|
file_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(DeleteFileFromArchive(archive_handle, file_path));
|
rb.Push(DeleteFileFromArchive(archive_handle, file_path));
|
||||||
@ -155,10 +153,10 @@ void FS_USER::RenameFile(Kernel::HLERequestContext& ctx) {
|
|||||||
FileSys::Path src_file_path(src_filename_type, src_filename);
|
FileSys::Path src_file_path(src_filename_type, src_filename);
|
||||||
FileSys::Path dest_file_path(dest_filename_type, dest_filename);
|
FileSys::Path dest_file_path(dest_filename_type, dest_filename);
|
||||||
|
|
||||||
NGLOG_DEBUG(
|
LOG_DEBUG(Service_FS,
|
||||||
Service_FS, "src_type={} src_size={} src_data={} dest_type={} dest_size={} dest_data={}",
|
"src_type={} src_size={} src_data={} dest_type={} dest_size={} dest_data={}",
|
||||||
static_cast<u32>(src_filename_type), src_filename_size, src_file_path.DebugStr(),
|
static_cast<u32>(src_filename_type), src_filename_size, src_file_path.DebugStr(),
|
||||||
static_cast<u32>(dest_filename_type), dest_filename_size, dest_file_path.DebugStr());
|
static_cast<u32>(dest_filename_type), dest_filename_size, dest_file_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle,
|
rb.Push(RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle,
|
||||||
@ -177,8 +175,8 @@ void FS_USER::DeleteDirectory(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
FileSys::Path dir_path(dirname_type, dirname);
|
FileSys::Path dir_path(dirname_type, dirname);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
||||||
dir_path.DebugStr());
|
dir_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(DeleteDirectoryFromArchive(archive_handle, dir_path));
|
rb.Push(DeleteDirectoryFromArchive(archive_handle, dir_path));
|
||||||
@ -196,8 +194,8 @@ void FS_USER::DeleteDirectoryRecursively(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
FileSys::Path dir_path(dirname_type, dirname);
|
FileSys::Path dir_path(dirname_type, dirname);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
||||||
dir_path.DebugStr());
|
dir_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(DeleteDirectoryRecursivelyFromArchive(archive_handle, dir_path));
|
rb.Push(DeleteDirectoryRecursivelyFromArchive(archive_handle, dir_path));
|
||||||
@ -217,8 +215,8 @@ void FS_USER::CreateFile(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
FileSys::Path file_path(filename_type, filename);
|
FileSys::Path file_path(filename_type, filename);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "type={} attributes={} size={:x} data={}",
|
LOG_DEBUG(Service_FS, "type={} attributes={} size={:x} data={}",
|
||||||
static_cast<u32>(filename_type), attributes, file_size, file_path.DebugStr());
|
static_cast<u32>(filename_type), attributes, file_size, file_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(CreateFileInArchive(archive_handle, file_path, file_size));
|
rb.Push(CreateFileInArchive(archive_handle, file_path, file_size));
|
||||||
@ -235,8 +233,8 @@ void FS_USER::CreateDirectory(Kernel::HLERequestContext& ctx) {
|
|||||||
ASSERT(dirname.size() == dirname_size);
|
ASSERT(dirname.size() == dirname_size);
|
||||||
FileSys::Path dir_path(dirname_type, dirname);
|
FileSys::Path dir_path(dirname_type, dirname);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
||||||
dir_path.DebugStr());
|
dir_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(CreateDirectoryFromArchive(archive_handle, dir_path));
|
rb.Push(CreateDirectoryFromArchive(archive_handle, dir_path));
|
||||||
@ -259,10 +257,10 @@ void FS_USER::RenameDirectory(Kernel::HLERequestContext& ctx) {
|
|||||||
FileSys::Path src_dir_path(src_dirname_type, src_dirname);
|
FileSys::Path src_dir_path(src_dirname_type, src_dirname);
|
||||||
FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname);
|
FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS,
|
LOG_DEBUG(Service_FS,
|
||||||
"src_type={} src_size={} src_data={} dest_type={} dest_size={} dest_data={}",
|
"src_type={} src_size={} src_data={} dest_type={} dest_size={} dest_data={}",
|
||||||
static_cast<u32>(src_dirname_type), src_dirname_size, src_dir_path.DebugStr(),
|
static_cast<u32>(src_dirname_type), src_dirname_size, src_dir_path.DebugStr(),
|
||||||
static_cast<u32>(dest_dirname_type), dest_dirname_size, dest_dir_path.DebugStr());
|
static_cast<u32>(dest_dirname_type), dest_dirname_size, dest_dir_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle,
|
rb.Push(RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle,
|
||||||
@ -279,8 +277,8 @@ void FS_USER::OpenDirectory(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
FileSys::Path dir_path(dirname_type, dirname);
|
FileSys::Path dir_path(dirname_type, dirname);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
|
||||||
dir_path.DebugStr());
|
dir_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
ResultVal<std::shared_ptr<Directory>> dir_res =
|
ResultVal<std::shared_ptr<Directory>> dir_res =
|
||||||
@ -292,8 +290,8 @@ void FS_USER::OpenDirectory(Kernel::HLERequestContext& ctx) {
|
|||||||
directory->ClientConnected(std::get<SharedPtr<ServerSession>>(sessions));
|
directory->ClientConnected(std::get<SharedPtr<ServerSession>>(sessions));
|
||||||
rb.PushMoveObjects(std::get<SharedPtr<ClientSession>>(sessions));
|
rb.PushMoveObjects(std::get<SharedPtr<ClientSession>>(sessions));
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_FS, "failed to get a handle for directory type={} size={} data={}",
|
LOG_ERROR(Service_FS, "failed to get a handle for directory type={} size={} data={}",
|
||||||
static_cast<u32>(dirname_type), dirname_size, dir_path.DebugStr());
|
static_cast<u32>(dirname_type), dirname_size, dir_path.DebugStr());
|
||||||
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,8 +305,8 @@ void FS_USER::OpenArchive(Kernel::HLERequestContext& ctx) {
|
|||||||
ASSERT(archivename.size() == archivename_size);
|
ASSERT(archivename.size() == archivename_size);
|
||||||
FileSys::Path archive_path(archivename_type, archivename);
|
FileSys::Path archive_path(archivename_type, archivename);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "archive_id=0x{:08X} archive_path={}", static_cast<u32>(archive_id),
|
LOG_DEBUG(Service_FS, "archive_id=0x{:08X} archive_path={}", static_cast<u32>(archive_id),
|
||||||
archive_path.DebugStr());
|
archive_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||||
ResultVal<ArchiveHandle> handle = Service::FS::OpenArchive(archive_id, archive_path);
|
ResultVal<ArchiveHandle> handle = Service::FS::OpenArchive(archive_id, archive_path);
|
||||||
@ -317,9 +315,9 @@ void FS_USER::OpenArchive(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.PushRaw(*handle);
|
rb.PushRaw(*handle);
|
||||||
} else {
|
} else {
|
||||||
rb.Push<u64>(0);
|
rb.Push<u64>(0);
|
||||||
NGLOG_ERROR(Service_FS,
|
LOG_ERROR(Service_FS,
|
||||||
"failed to get a handle for archive archive_id=0x{:08X} archive_path={}",
|
"failed to get a handle for archive archive_id=0x{:08X} archive_path={}",
|
||||||
static_cast<u32>(archive_id), archive_path.DebugStr());
|
static_cast<u32>(archive_id), archive_path.DebugStr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,11 +342,11 @@ void FS_USER::IsSdmcWriteable(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
// If the SD isn't enabled, it can't be writeable...else, stubbed true
|
// If the SD isn't enabled, it can't be writeable...else, stubbed true
|
||||||
rb.Push(Settings::values.use_virtual_sd);
|
rb.Push(Settings::values.use_virtual_sd);
|
||||||
NGLOG_DEBUG(Service_FS, " (STUBBED)");
|
LOG_DEBUG(Service_FS, " (STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
|
void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
|
||||||
NGLOG_WARNING(Service_FS, "(STUBBED)");
|
LOG_WARNING(Service_FS, "(STUBBED)");
|
||||||
|
|
||||||
IPC::RequestParser rp(ctx, 0x84C, 9, 2);
|
IPC::RequestParser rp(ctx, 0x84C, 9, 2);
|
||||||
auto archive_id = rp.PopEnum<FS::ArchiveIdCode>();
|
auto archive_id = rp.PopEnum<FS::ArchiveIdCode>();
|
||||||
@ -364,19 +362,19 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
|
|||||||
ASSERT(archivename.size() == archivename_size);
|
ASSERT(archivename.size() == archivename_size);
|
||||||
FileSys::Path archive_path(archivename_type, archivename);
|
FileSys::Path archive_path(archivename_type, archivename);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr());
|
LOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
if (archive_id != FS::ArchiveIdCode::SaveData) {
|
if (archive_id != FS::ArchiveIdCode::SaveData) {
|
||||||
NGLOG_ERROR(Service_FS, "tried to format an archive different than SaveData, {}",
|
LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, {}",
|
||||||
static_cast<u32>(archive_id));
|
static_cast<u32>(archive_id));
|
||||||
rb.Push(FileSys::ERROR_INVALID_PATH);
|
rb.Push(FileSys::ERROR_INVALID_PATH);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (archive_path.GetType() != FileSys::LowPathType::Empty) {
|
if (archive_path.GetType() != FileSys::LowPathType::Empty) {
|
||||||
// TODO(Subv): Implement formatting the SaveData of other games
|
// TODO(Subv): Implement formatting the SaveData of other games
|
||||||
NGLOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
|
LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
|
||||||
rb.Push(UnimplementedFunction(ErrorModule::FS));
|
rb.Push(UnimplementedFunction(ErrorModule::FS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -408,7 +406,7 @@ void FS_USER::FormatThisUserSaveData(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(FormatArchive(ArchiveIdCode::SaveData, format_info));
|
rb.Push(FormatArchive(ArchiveIdCode::SaveData, format_info));
|
||||||
|
|
||||||
NGLOG_TRACE(Service_FS, "called");
|
LOG_TRACE(Service_FS, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FS_USER::GetFreeBytes(Kernel::HLERequestContext& ctx) {
|
void FS_USER::GetFreeBytes(Kernel::HLERequestContext& ctx) {
|
||||||
@ -438,10 +436,10 @@ void FS_USER::CreateExtSaveData(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 icon_size = rp.Pop<u32>();
|
u32 icon_size = rp.Pop<u32>();
|
||||||
auto icon_buffer = rp.PopMappedBuffer();
|
auto icon_buffer = rp.PopMappedBuffer();
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS,
|
LOG_WARNING(Service_FS,
|
||||||
"(STUBBED) savedata_high={:08X} savedata_low={:08X} unknown={:08X} "
|
"(STUBBED) savedata_high={:08X} savedata_low={:08X} unknown={:08X} "
|
||||||
"files={:08X} directories={:08X} size_limit={:016x} icon_size={:08X}",
|
"files={:08X} directories={:08X} size_limit={:016x} icon_size={:08X}",
|
||||||
save_high, save_low, unknown, directories, files, size_limit, icon_size);
|
save_high, save_low, unknown, directories, files, size_limit, icon_size);
|
||||||
|
|
||||||
std::vector<u8> icon(icon_size);
|
std::vector<u8> icon(icon_size);
|
||||||
icon_buffer.Read(icon.data(), 0, icon_size);
|
icon_buffer.Read(icon.data(), 0, icon_size);
|
||||||
@ -464,9 +462,9 @@ void FS_USER::DeleteExtSaveData(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 save_high = rp.Pop<u32>();
|
u32 save_high = rp.Pop<u32>();
|
||||||
u32 unknown = rp.Pop<u32>(); // TODO(Subv): Figure out what this is
|
u32 unknown = rp.Pop<u32>(); // TODO(Subv): Figure out what this is
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS,
|
LOG_WARNING(Service_FS,
|
||||||
"(STUBBED) save_low={:08X} save_high={:08X} media_type={:08X} unknown={:08X}",
|
"(STUBBED) save_low={:08X} save_high={:08X} media_type={:08X} unknown={:08X}",
|
||||||
save_low, save_high, static_cast<u32>(media_type), unknown);
|
save_low, save_high, static_cast<u32>(media_type), unknown);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(Service::FS::DeleteExtSaveData(media_type, save_high, save_low));
|
rb.Push(Service::FS::DeleteExtSaveData(media_type, save_high, save_low));
|
||||||
@ -477,7 +475,7 @@ void FS_USER::CardSlotIsInserted(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(false);
|
rb.Push(false);
|
||||||
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FS_USER::DeleteSystemSaveData(Kernel::HLERequestContext& ctx) {
|
void FS_USER::DeleteSystemSaveData(Kernel::HLERequestContext& ctx) {
|
||||||
@ -501,7 +499,7 @@ void FS_USER::CreateSystemSaveData(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 file_buckets = rp.Pop<u32>();
|
u32 file_buckets = rp.Pop<u32>();
|
||||||
bool duplicate = rp.Pop<bool>();
|
bool duplicate = rp.Pop<bool>();
|
||||||
|
|
||||||
NGLOG_WARNING(
|
LOG_WARNING(
|
||||||
Service_FS,
|
Service_FS,
|
||||||
"(STUBBED) savedata_high={:08X} savedata_low={:08X} total_size={:08X} block_size={:08X} "
|
"(STUBBED) savedata_high={:08X} savedata_low={:08X} total_size={:08X} block_size={:08X} "
|
||||||
"directories={} files={} directory_buckets={} file_buckets={} duplicate={}",
|
"directories={} files={} directory_buckets={} file_buckets={} duplicate={}",
|
||||||
@ -523,11 +521,11 @@ void FS_USER::CreateLegacySystemSaveData(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 file_buckets = rp.Pop<u32>();
|
u32 file_buckets = rp.Pop<u32>();
|
||||||
bool duplicate = rp.Pop<bool>();
|
bool duplicate = rp.Pop<bool>();
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS,
|
LOG_WARNING(Service_FS,
|
||||||
"(STUBBED) savedata_id={:08X} total_size={:08X} block_size={:08X} directories={} "
|
"(STUBBED) savedata_id={:08X} total_size={:08X} block_size={:08X} directories={} "
|
||||||
"files={} directory_buckets={} file_buckets={} duplicate={}",
|
"files={} directory_buckets={} file_buckets={} duplicate={}",
|
||||||
savedata_id, total_size, block_size, directories, files, directory_buckets,
|
savedata_id, total_size, block_size, directories, files, directory_buckets,
|
||||||
file_buckets, duplicate);
|
file_buckets, duplicate);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
// With this command, the SystemSaveData always has save_high = 0 (Always created in the NAND)
|
// With this command, the SystemSaveData always has save_high = 0 (Always created in the NAND)
|
||||||
@ -539,7 +537,7 @@ void FS_USER::InitializeWithSdkVersion(Kernel::HLERequestContext& ctx) {
|
|||||||
const u32 version = rp.Pop<u32>();
|
const u32 version = rp.Pop<u32>();
|
||||||
rp.PopPID();
|
rp.PopPID();
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS, "(STUBBED) called, version: 0x{:08X}", version);
|
LOG_WARNING(Service_FS, "(STUBBED) called, version: 0x{:08X}", version);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
@ -553,28 +551,28 @@ void FS_USER::SetPriority(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
|
LOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FS_USER::GetPriority(Kernel::HLERequestContext& ctx) {
|
void FS_USER::GetPriority(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x863, 0, 0);
|
IPC::RequestParser rp(ctx, 0x863, 0, 0);
|
||||||
|
|
||||||
if (priority == -1) {
|
if (priority == -1) {
|
||||||
NGLOG_INFO(Service_FS, "priority was not set, priority=0x{:X}", priority);
|
LOG_INFO(Service_FS, "priority was not set, priority=0x{:X}", priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(priority);
|
rb.Push(priority);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
|
LOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FS_USER::GetArchiveResource(Kernel::HLERequestContext& ctx) {
|
void FS_USER::GetArchiveResource(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x849, 1, 0);
|
IPC::RequestParser rp(ctx, 0x849, 1, 0);
|
||||||
u32 system_media_type = rp.Pop<u32>();
|
u32 system_media_type = rp.Pop<u32>();
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS, "(STUBBED) called Media type=0x{:08X}", system_media_type);
|
LOG_WARNING(Service_FS, "(STUBBED) called Media type=0x{:08X}", system_media_type);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
@ -594,14 +592,14 @@ void FS_USER::GetFormatInfo(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
FileSys::Path archive_path(archivename_type, archivename);
|
FileSys::Path archive_path(archivename_type, archivename);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr());
|
LOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr());
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||||
|
|
||||||
auto format_info = GetArchiveFormatInfo(archive_id, archive_path);
|
auto format_info = GetArchiveFormatInfo(archive_id, archive_path);
|
||||||
rb.Push(format_info.Code());
|
rb.Push(format_info.Code());
|
||||||
if (format_info.Failed()) {
|
if (format_info.Failed()) {
|
||||||
NGLOG_ERROR(Service_FS, "Failed to retrieve the format info");
|
LOG_ERROR(Service_FS, "Failed to retrieve the format info");
|
||||||
rb.Skip(4, true);
|
rb.Skip(4, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -617,7 +615,7 @@ void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
u32 process_id = rp.Pop<u32>();
|
u32 process_id = rp.Pop<u32>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_FS, "process_id={}", process_id);
|
LOG_DEBUG(Service_FS, "process_id={}", process_id);
|
||||||
|
|
||||||
// TODO(Subv): The real FS service manages its own process list and only checks the processes
|
// TODO(Subv): The real FS service manages its own process list and only checks the processes
|
||||||
// that were registered with the 'fs:REG' service.
|
// that were registered with the 'fs:REG' service.
|
||||||
@ -649,7 +647,7 @@ void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
|
|||||||
void FS_USER::GetNumSeeds(Kernel::HLERequestContext& ctx) {
|
void FS_USER::GetNumSeeds(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x87D, 0, 0);
|
IPC::RequestParser rp(ctx, 0x87D, 0, 0);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
|
|
||||||
@ -666,10 +664,10 @@ void FS_USER::SetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
// TODO: Generate and Save the Secure Value
|
// TODO: Generate and Save the Secure Value
|
||||||
|
|
||||||
NGLOG_WARNING(Service_FS,
|
LOG_WARNING(Service_FS,
|
||||||
"(STUBBED) called, value=0x{:016x} secure_value_slot=0x{:08X} "
|
"(STUBBED) called, value=0x{:016x} secure_value_slot=0x{:08X} "
|
||||||
"unqiue_id=0x{:08X} title_variation=0x{:02X}",
|
"unqiue_id=0x{:08X} title_variation=0x{:02X}",
|
||||||
value, secure_value_slot, unique_id, title_variation);
|
value, secure_value_slot, unique_id, title_variation);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
|
||||||
@ -683,7 +681,7 @@ void FS_USER::GetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
|||||||
u32 unique_id = rp.Pop<u32>();
|
u32 unique_id = rp.Pop<u32>();
|
||||||
u8 title_variation = rp.Pop<u8>();
|
u8 title_variation = rp.Pop<u8>();
|
||||||
|
|
||||||
NGLOG_WARNING(
|
LOG_WARNING(
|
||||||
Service_FS,
|
Service_FS,
|
||||||
"(STUBBED) called secure_value_slot=0x{:08X} unqiue_id=0x{:08X} title_variation=0x{:02X}",
|
"(STUBBED) called secure_value_slot=0x{:08X} unqiue_id=0x{:08X} title_variation=0x{:02X}",
|
||||||
secure_value_slot, unique_id, title_variation);
|
secure_value_slot, unique_id, title_variation);
|
||||||
|
@ -120,14 +120,13 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, const std::ve
|
|||||||
const u32 max_size_in_bytes = 0x80;
|
const u32 max_size_in_bytes = 0x80;
|
||||||
|
|
||||||
if (base_address & 3 || base_address >= 0x420000) {
|
if (base_address & 3 || base_address >= 0x420000) {
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(Service_GSP,
|
||||||
Service_GSP,
|
"Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
|
||||||
"Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
|
base_address, size_in_bytes);
|
||||||
base_address, size_in_bytes);
|
|
||||||
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
|
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
|
||||||
} else if (size_in_bytes <= max_size_in_bytes) {
|
} else if (size_in_bytes <= max_size_in_bytes) {
|
||||||
if (size_in_bytes & 3) {
|
if (size_in_bytes & 3) {
|
||||||
NGLOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
|
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
|
||||||
return ERR_REGS_MISALIGNED;
|
return ERR_REGS_MISALIGNED;
|
||||||
} else {
|
} else {
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
@ -144,7 +143,7 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, const std::ve
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
|
LOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
|
||||||
return ERR_REGS_INVALID_SIZE;
|
return ERR_REGS_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,14 +164,13 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes,
|
|||||||
const u32 max_size_in_bytes = 0x80;
|
const u32 max_size_in_bytes = 0x80;
|
||||||
|
|
||||||
if (base_address & 3 || base_address >= 0x420000) {
|
if (base_address & 3 || base_address >= 0x420000) {
|
||||||
NGLOG_ERROR(
|
LOG_ERROR(Service_GSP,
|
||||||
Service_GSP,
|
"Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
|
||||||
"Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
|
base_address, size_in_bytes);
|
||||||
base_address, size_in_bytes);
|
|
||||||
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
|
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
|
||||||
} else if (size_in_bytes <= max_size_in_bytes) {
|
} else if (size_in_bytes <= max_size_in_bytes) {
|
||||||
if (size_in_bytes & 3) {
|
if (size_in_bytes & 3) {
|
||||||
NGLOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
|
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
|
||||||
return ERR_REGS_MISALIGNED;
|
return ERR_REGS_MISALIGNED;
|
||||||
} else {
|
} else {
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
@ -199,7 +197,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
|
LOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
|
||||||
return ERR_REGS_INVALID_SIZE;
|
return ERR_REGS_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,7 +235,7 @@ void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) {
|
|||||||
if ((reg_addr % 4) != 0 || reg_addr >= 0x420000) {
|
if ((reg_addr % 4) != 0 || reg_addr >= 0x420000) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ERR_REGS_OUTOFRANGE_OR_MISALIGNED);
|
rb.Push(ERR_REGS_OUTOFRANGE_OR_MISALIGNED);
|
||||||
NGLOG_ERROR(Service_GSP, "Invalid address 0x{:08x}", reg_addr);
|
LOG_ERROR(Service_GSP, "Invalid address 0x{:08x}", reg_addr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +243,7 @@ void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) {
|
|||||||
if ((size % 4) != 0) {
|
if ((size % 4) != 0) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ERR_REGS_MISALIGNED);
|
rb.Push(ERR_REGS_MISALIGNED);
|
||||||
NGLOG_ERROR(Service_GSP, "Invalid size 0x{:08x}", size);
|
LOG_ERROR(Service_GSP, "Invalid size 0x{:08x}", size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,8 +317,8 @@ void GSP_GPU::FlushDataCache(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}",
|
LOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
|
||||||
address, size, process->process_id);
|
size, process->process_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
|
void GSP_GPU::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
|
||||||
@ -334,8 +332,8 @@ void GSP_GPU::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}",
|
LOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
|
||||||
address, size, process->process_id);
|
size, process->process_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) {
|
void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) {
|
||||||
@ -345,7 +343,7 @@ void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_GSP, "(STUBBED) called mode=0x{:08X}", mode);
|
LOG_DEBUG(Service_GSP, "(STUBBED) called mode=0x{:08X}", mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
|
void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
|
||||||
@ -375,7 +373,7 @@ void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(session_data->thread_id);
|
rb.Push(session_data->thread_id);
|
||||||
rb.PushCopyObjects(shared_memory);
|
rb.PushCopyObjects(shared_memory);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_GSP, "called, flags=0x{:08X}", flags);
|
LOG_DEBUG(Service_GSP, "called, flags=0x{:08X}", flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
|
void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
|
||||||
@ -388,7 +386,7 @@ void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_GSP, "called");
|
LOG_DEBUG(Service_GSP, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id) {
|
void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id) {
|
||||||
@ -398,7 +396,7 @@ void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id)
|
|||||||
|
|
||||||
auto interrupt_event = session_data->interrupt_event;
|
auto interrupt_event = session_data->interrupt_event;
|
||||||
if (interrupt_event == nullptr) {
|
if (interrupt_event == nullptr) {
|
||||||
NGLOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!");
|
LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(shared_memory, thread_id);
|
InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(shared_memory, thread_id);
|
||||||
@ -436,7 +434,7 @@ void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id)
|
|||||||
*/
|
*/
|
||||||
void GSP_GPU::SignalInterrupt(InterruptId interrupt_id) {
|
void GSP_GPU::SignalInterrupt(InterruptId interrupt_id) {
|
||||||
if (nullptr == shared_memory) {
|
if (nullptr == shared_memory) {
|
||||||
NGLOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!");
|
LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +581,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Service_GSP, "unknown command 0x{:08X}", (int)command.id.Value());
|
LOG_ERROR(Service_GSP, "unknown command 0x{:08X}", (int)command.id.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pica::g_debug_context)
|
if (Pica::g_debug_context)
|
||||||
@ -668,7 +666,7 @@ void GSP_GPU::ImportDisplayCaptureInfo(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.PushRaw(top_entry);
|
rb.PushRaw(top_entry);
|
||||||
rb.PushRaw(bottom_entry);
|
rb.PushRaw(bottom_entry);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_GSP, "called");
|
LOG_WARNING(Service_GSP, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::AcquireRight(Kernel::HLERequestContext& ctx) {
|
void GSP_GPU::AcquireRight(Kernel::HLERequestContext& ctx) {
|
||||||
@ -679,8 +677,8 @@ void GSP_GPU::AcquireRight(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
SessionData* session_data = GetSessionData(ctx.Session());
|
SessionData* session_data = GetSessionData(ctx.Session());
|
||||||
|
|
||||||
NGLOG_WARNING(Service_GSP, "called flag={:08X} process={} thread_id={}", flag,
|
LOG_WARNING(Service_GSP, "called flag={:08X} process={} thread_id={}", flag,
|
||||||
process->process_id, session_data->thread_id);
|
process->process_id, session_data->thread_id);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
|
||||||
@ -713,7 +711,7 @@ void GSP_GPU::ReleaseRight(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_GSP, "called");
|
LOG_WARNING(Service_GSP, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) {
|
void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) {
|
||||||
@ -726,8 +724,8 @@ void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}",
|
LOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
|
||||||
address, size, process->process_id);
|
size, process->process_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) {
|
void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) {
|
||||||
@ -738,7 +736,7 @@ void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_DEBUG(Service_GSP, "(STUBBED) called");
|
LOG_DEBUG(Service_GSP, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionData* GSP_GPU::FindRegisteredThreadData(u32 thread_id) {
|
SessionData* GSP_GPU::FindRegisteredThreadData(u32 thread_id) {
|
||||||
|
@ -266,7 +266,7 @@ void Module::Interface::EnableAccelerometer(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_HID, "called");
|
LOG_DEBUG(Service_HID, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::DisableAccelerometer(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::DisableAccelerometer(Kernel::HLERequestContext& ctx) {
|
||||||
@ -282,7 +282,7 @@ void Module::Interface::DisableAccelerometer(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_HID, "called");
|
LOG_DEBUG(Service_HID, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::EnableGyroscopeLow(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::EnableGyroscopeLow(Kernel::HLERequestContext& ctx) {
|
||||||
@ -298,7 +298,7 @@ void Module::Interface::EnableGyroscopeLow(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_HID, "called");
|
LOG_DEBUG(Service_HID, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::DisableGyroscopeLow(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::DisableGyroscopeLow(Kernel::HLERequestContext& ctx) {
|
||||||
@ -314,7 +314,7 @@ void Module::Interface::DisableGyroscopeLow(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_HID, "called");
|
LOG_DEBUG(Service_HID, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetGyroscopeLowRawToDpsCoefficient(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetGyroscopeLowRawToDpsCoefficient(Kernel::HLERequestContext& ctx) {
|
||||||
@ -339,7 +339,7 @@ void Module::Interface::GetGyroscopeLowCalibrateParam(Kernel::HLERequestContext&
|
|||||||
};
|
};
|
||||||
rb.PushRaw(param);
|
rb.PushRaw(param);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_HID, "(STUBBED) called");
|
LOG_WARNING(Service_HID, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetSoundVolume(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetSoundVolume(Kernel::HLERequestContext& ctx) {
|
||||||
@ -351,7 +351,7 @@ void Module::Interface::GetSoundVolume(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(volume);
|
rb.Push(volume);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_HID, "(STUBBED) called");
|
LOG_WARNING(Service_HID, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::Interface::Interface(std::shared_ptr<Module> hid, const char* name, u32 max_session)
|
Module::Interface::Interface(std::shared_ptr<Module> hid, const char* name, u32 max_session)
|
||||||
|
@ -165,8 +165,8 @@ void ExtraHID::OnDisconnect() {
|
|||||||
|
|
||||||
void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) {
|
void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) {
|
||||||
if (request.size() != 3) {
|
if (request.size() != 3) {
|
||||||
NGLOG_ERROR(Service_IR, "Wrong request size ({}): {}", request.size(),
|
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request.size(),
|
||||||
Common::ArrayToString(request.data(), request.size()));
|
Common::ArrayToString(request.data(), request.size()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,8 +187,8 @@ void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_b
|
|||||||
"ReadCalibrationDataRequest has wrong size");
|
"ReadCalibrationDataRequest has wrong size");
|
||||||
|
|
||||||
if (request_buf.size() != sizeof(ReadCalibrationDataRequest)) {
|
if (request_buf.size() != sizeof(ReadCalibrationDataRequest)) {
|
||||||
NGLOG_ERROR(Service_IR, "Wrong request size ({}): {}", request_buf.size(),
|
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request_buf.size(),
|
||||||
Common::ArrayToString(request_buf.data(), request_buf.size()));
|
Common::ArrayToString(request_buf.data(), request_buf.size()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_b
|
|||||||
const u16 size = Common::AlignDown(request.size, 16);
|
const u16 size = Common::AlignDown(request.size, 16);
|
||||||
|
|
||||||
if (offset + size > calibration_data.size()) {
|
if (offset + size > calibration_data.size()) {
|
||||||
NGLOG_ERROR(Service_IR, "Read beyond the end of calibration data! (offset={}, size={})",
|
LOG_ERROR(Service_IR, "Read beyond the end of calibration data! (offset={}, size={})",
|
||||||
offset, size);
|
offset, size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +222,8 @@ void ExtraHID::OnReceive(const std::vector<u8>& data) {
|
|||||||
HandleReadCalibrationDataRequest(data);
|
HandleReadCalibrationDataRequest(data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NGLOG_ERROR(Service_IR, "Unknown request: {}",
|
LOG_ERROR(Service_IR, "Unknown request: {}",
|
||||||
Common::ArrayToString(data.data(), data.size()));
|
Common::ArrayToString(data.data(), data.size()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ void IR_RST::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
raw_c_stick = rp.Pop<bool>();
|
raw_c_stick = rp.Pop<bool>();
|
||||||
|
|
||||||
if (raw_c_stick)
|
if (raw_c_stick)
|
||||||
NGLOG_ERROR(Service_IR, "raw C-stick data is not implemented!");
|
LOG_ERROR(Service_IR, "raw C-stick data is not implemented!");
|
||||||
|
|
||||||
next_pad_index = 0;
|
next_pad_index = 0;
|
||||||
is_device_reload_pending.store(true);
|
is_device_reload_pending.store(true);
|
||||||
@ -131,7 +131,7 @@ void IR_RST::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_IR, "called. update_period={}, raw_c_stick={}", update_period, raw_c_stick);
|
LOG_DEBUG(Service_IR, "called. update_period={}, raw_c_stick={}", update_period, raw_c_stick);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) {
|
void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) {
|
||||||
@ -142,7 +142,7 @@ void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_DEBUG(Service_IR, "called");
|
LOG_DEBUG(Service_IR, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
IR_RST::IR_RST() : ServiceFramework("ir:rst", 1) {
|
IR_RST::IR_RST() : ServiceFramework("ir:rst", 1) {
|
||||||
|
@ -183,8 +183,7 @@ private:
|
|||||||
|
|
||||||
/// Wraps the payload into packet and puts it to the receive buffer
|
/// Wraps the payload into packet and puts it to the receive buffer
|
||||||
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
||||||
NGLOG_TRACE(Service_IR, "called, data={}",
|
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(payload.data(), payload.size()));
|
||||||
Common::ArrayToString(payload.data(), payload.size()));
|
|
||||||
size_t size = payload.size();
|
size_t size = payload.size();
|
||||||
|
|
||||||
std::vector<u8> packet;
|
std::vector<u8> packet;
|
||||||
@ -225,7 +224,7 @@ void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
|||||||
if (receive_buffer->Put(packet)) {
|
if (receive_buffer->Put(packet)) {
|
||||||
receive_event->Signal();
|
receive_event->Signal();
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_IR, "receive buffer is full!");
|
LOG_ERROR(Service_IR, "receive buffer is full!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,12 +250,12 @@ void IR_USER::InitializeIrNopShared(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_INFO(Service_IR,
|
LOG_INFO(Service_IR,
|
||||||
"called, shared_buff_size={}, recv_buff_size={}, "
|
"called, shared_buff_size={}, recv_buff_size={}, "
|
||||||
"recv_buff_packet_count={}, send_buff_size={}, "
|
"recv_buff_packet_count={}, send_buff_size={}, "
|
||||||
"send_buff_packet_count={}, baud_rate={}",
|
"send_buff_packet_count={}, baud_rate={}",
|
||||||
shared_buff_size, recv_buff_size, recv_buff_packet_count, send_buff_size,
|
shared_buff_size, recv_buff_size, recv_buff_packet_count, send_buff_size,
|
||||||
send_buff_packet_count, baud_rate);
|
send_buff_packet_count, baud_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
|
void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
|
||||||
@ -275,7 +274,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
|
|||||||
connected_device->OnConnect();
|
connected_device->OnConnect();
|
||||||
conn_status_event->Signal();
|
conn_status_event->Signal();
|
||||||
} else {
|
} else {
|
||||||
NGLOG_WARNING(Service_IR, "unknown device id {}. Won't connect.", device_id);
|
LOG_WARNING(Service_IR, "unknown device id {}. Won't connect.", device_id);
|
||||||
shared_memory_ptr[offsetof(SharedMemoryHeader, connection_status)] = 1;
|
shared_memory_ptr[offsetof(SharedMemoryHeader, connection_status)] = 1;
|
||||||
shared_memory_ptr[offsetof(SharedMemoryHeader, trying_to_connect_status)] = 2;
|
shared_memory_ptr[offsetof(SharedMemoryHeader, trying_to_connect_status)] = 2;
|
||||||
}
|
}
|
||||||
@ -283,7 +282,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_INFO(Service_IR, "called, device_id = {}", device_id);
|
LOG_INFO(Service_IR, "called, device_id = {}", device_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
|
void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -292,7 +291,7 @@ void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(receive_event);
|
rb.PushCopyObjects(receive_event);
|
||||||
|
|
||||||
NGLOG_INFO(Service_IR, "called");
|
LOG_INFO(Service_IR, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) {
|
void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -301,7 +300,7 @@ void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(send_event);
|
rb.PushCopyObjects(send_event);
|
||||||
|
|
||||||
NGLOG_INFO(Service_IR, "called");
|
LOG_INFO(Service_IR, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
|
void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
|
||||||
@ -318,7 +317,7 @@ void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb(ctx, 0x09, 1, 0);
|
IPC::RequestBuilder rb(ctx, 0x09, 1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_INFO(Service_IR, "called");
|
LOG_INFO(Service_IR, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) {
|
void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -327,7 +326,7 @@ void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(conn_status_event);
|
rb.PushCopyObjects(conn_status_event);
|
||||||
|
|
||||||
NGLOG_INFO(Service_IR, "called");
|
LOG_INFO(Service_IR, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) {
|
void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) {
|
||||||
@ -342,7 +341,7 @@ void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb(ctx, 0x02, 1, 0);
|
IPC::RequestBuilder rb(ctx, 0x02, 1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_INFO(Service_IR, "called");
|
LOG_INFO(Service_IR, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
|
void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
|
||||||
@ -357,12 +356,12 @@ void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
|
|||||||
send_event->Signal();
|
send_event->Signal();
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_IR, "not connected");
|
LOG_ERROR(Service_IR, "not connected");
|
||||||
rb.Push(ResultCode(static_cast<ErrorDescription>(13), ErrorModule::IR,
|
rb.Push(ResultCode(static_cast<ErrorDescription>(13), ErrorModule::IR,
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status));
|
ErrorSummary::InvalidState, ErrorLevel::Status));
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(buffer.data(), size));
|
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(buffer.data(), size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
||||||
@ -374,12 +373,12 @@ void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
|||||||
if (receive_buffer->Release(count)) {
|
if (receive_buffer->Release(count)) {
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
NGLOG_ERROR(Service_IR, "failed to release {} packets", count);
|
LOG_ERROR(Service_IR, "failed to release {} packets", count);
|
||||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound,
|
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound,
|
||||||
ErrorLevel::Status));
|
ErrorLevel::Status));
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_TRACE(Service_IR, "called, count={}", count);
|
LOG_TRACE(Service_IR, "called, count={}", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
IR_USER::IR_USER() : ServiceFramework("ir:USER", 1) {
|
IR_USER::IR_USER() : ServiceFramework("ir:USER", 1) {
|
||||||
|
@ -131,7 +131,7 @@ ResultCode CROHelper::ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool
|
|||||||
ResultCode result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
|
ResultCode result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
|
||||||
symbol_address, relocation_target);
|
symbol_address, relocation_target);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ ResultCode CROHelper::ResetExternalRelocations() {
|
|||||||
ResultCode result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
|
ResultCode result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
|
||||||
unresolved_symbol, relocation_target);
|
unresolved_symbol, relocation_target);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ ResultCode CROHelper::ClearExternalRelocations() {
|
|||||||
|
|
||||||
ResultCode result = ClearRelocation(relocation_target, relocation.type);
|
ResultCode result = ClearRelocation(relocation_target, relocation.type);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error clearing relocation {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error clearing relocation {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,8 +550,8 @@ ResultCode CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
|
|||||||
|
|
||||||
CROHelper crs(crs_address);
|
CROHelper crs(crs_address);
|
||||||
u32 offset_export_num = GetField(StaticAnonymousSymbolNum);
|
u32 offset_export_num = GetField(StaticAnonymousSymbolNum);
|
||||||
NGLOG_INFO(Service_LDR, "CRO \"{}\" exports {} static anonymous symbols", ModuleName(),
|
LOG_INFO(Service_LDR, "CRO \"{}\" exports {} static anonymous symbols", ModuleName(),
|
||||||
offset_export_num);
|
offset_export_num);
|
||||||
for (u32 i = 0; i < offset_export_num; ++i) {
|
for (u32 i = 0; i < offset_export_num; ++i) {
|
||||||
StaticAnonymousSymbolEntry entry;
|
StaticAnonymousSymbolEntry entry;
|
||||||
GetEntry(i, entry);
|
GetEntry(i, entry);
|
||||||
@ -563,11 +563,11 @@ ResultCode CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 symbol_address = SegmentTagToAddress(entry.symbol_position);
|
u32 symbol_address = SegmentTagToAddress(entry.symbol_position);
|
||||||
NGLOG_TRACE(Service_LDR, "CRO \"{}\" exports 0x{:08X} to the static module", ModuleName(),
|
LOG_TRACE(Service_LDR, "CRO \"{}\" exports 0x{:08X} to the static module", ModuleName(),
|
||||||
symbol_address);
|
symbol_address);
|
||||||
ResultCode result = crs.ApplyRelocationBatch(batch_address, symbol_address);
|
ResultCode result = crs.ApplyRelocationBatch(batch_address, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -603,12 +603,12 @@ ResultCode CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) {
|
|||||||
|
|
||||||
SegmentEntry symbol_segment;
|
SegmentEntry symbol_segment;
|
||||||
GetEntry(relocation.symbol_segment, symbol_segment);
|
GetEntry(relocation.symbol_segment, symbol_segment);
|
||||||
NGLOG_TRACE(Service_LDR, "Internally relocates 0x{:08X} with 0x{:08X}", target_address,
|
LOG_TRACE(Service_LDR, "Internally relocates 0x{:08X} with 0x{:08X}", target_address,
|
||||||
symbol_segment.offset);
|
symbol_segment.offset);
|
||||||
ResultCode result = ApplyRelocation(target_address, relocation.type, relocation.addend,
|
ResultCode result = ApplyRelocation(target_address, relocation.type, relocation.addend,
|
||||||
symbol_segment.offset, target_addressB);
|
symbol_segment.offset, target_addressB);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -628,7 +628,7 @@ ResultCode CROHelper::ClearInternalRelocations() {
|
|||||||
|
|
||||||
ResultCode result = ClearRelocation(target_address, relocation.type);
|
ResultCode result = ClearRelocation(target_address, relocation.type);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error clearing relocation {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error clearing relocation {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -764,13 +764,13 @@ ResultCode CROHelper::ApplyImportNamedSymbol(VAddr crs_address) {
|
|||||||
u32 symbol_address = source.FindExportNamedSymbol(symbol_name);
|
u32 symbol_address = source.FindExportNamedSymbol(symbol_name);
|
||||||
|
|
||||||
if (symbol_address != 0) {
|
if (symbol_address != 0) {
|
||||||
NGLOG_TRACE(Service_LDR, "CRO \"{}\" imports \"{}\" from \"{}\"",
|
LOG_TRACE(Service_LDR, "CRO \"{}\" imports \"{}\" from \"{}\"",
|
||||||
ModuleName(), symbol_name, source.ModuleName());
|
ModuleName(), symbol_name, source.ModuleName());
|
||||||
|
|
||||||
ResultCode result = ApplyRelocationBatch(relocation_addr, symbol_address);
|
ResultCode result = ApplyRelocationBatch(relocation_addr, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
||||||
result.raw);
|
result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,7 +800,7 @@ ResultCode CROHelper::ResetImportNamedSymbol() {
|
|||||||
|
|
||||||
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -820,7 +820,7 @@ ResultCode CROHelper::ResetImportIndexedSymbol() {
|
|||||||
|
|
||||||
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -840,7 +840,7 @@ ResultCode CROHelper::ResetImportAnonymousSymbol() {
|
|||||||
|
|
||||||
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -859,36 +859,35 @@ ResultCode CROHelper::ApplyModuleImport(VAddr crs_address) {
|
|||||||
ResultCode result =
|
ResultCode result =
|
||||||
ForEachAutoLinkCRO(crs_address, [&](CROHelper source) -> ResultVal<bool> {
|
ForEachAutoLinkCRO(crs_address, [&](CROHelper source) -> ResultVal<bool> {
|
||||||
if (want_cro_name == source.ModuleName()) {
|
if (want_cro_name == source.ModuleName()) {
|
||||||
NGLOG_INFO(Service_LDR, "CRO \"{}\" imports {} indexed symbols from \"{}\"",
|
LOG_INFO(Service_LDR, "CRO \"{}\" imports {} indexed symbols from \"{}\"",
|
||||||
ModuleName(), entry.import_indexed_symbol_num, source.ModuleName());
|
ModuleName(), entry.import_indexed_symbol_num, source.ModuleName());
|
||||||
for (u32 j = 0; j < entry.import_indexed_symbol_num; ++j) {
|
for (u32 j = 0; j < entry.import_indexed_symbol_num; ++j) {
|
||||||
ImportIndexedSymbolEntry im;
|
ImportIndexedSymbolEntry im;
|
||||||
entry.GetImportIndexedSymbolEntry(j, im);
|
entry.GetImportIndexedSymbolEntry(j, im);
|
||||||
ExportIndexedSymbolEntry ex;
|
ExportIndexedSymbolEntry ex;
|
||||||
source.GetEntry(im.index, ex);
|
source.GetEntry(im.index, ex);
|
||||||
u32 symbol_address = source.SegmentTagToAddress(ex.symbol_position);
|
u32 symbol_address = source.SegmentTagToAddress(ex.symbol_position);
|
||||||
NGLOG_TRACE(Service_LDR, " Imports 0x{:08X}", symbol_address);
|
LOG_TRACE(Service_LDR, " Imports 0x{:08X}", symbol_address);
|
||||||
ResultCode result =
|
ResultCode result =
|
||||||
ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
||||||
result.raw);
|
result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NGLOG_INFO(Service_LDR, "CRO \"{}\" imports {} anonymous symbols from \"{}\"",
|
LOG_INFO(Service_LDR, "CRO \"{}\" imports {} anonymous symbols from \"{}\"",
|
||||||
ModuleName(), entry.import_anonymous_symbol_num,
|
ModuleName(), entry.import_anonymous_symbol_num, source.ModuleName());
|
||||||
source.ModuleName());
|
|
||||||
for (u32 j = 0; j < entry.import_anonymous_symbol_num; ++j) {
|
for (u32 j = 0; j < entry.import_anonymous_symbol_num; ++j) {
|
||||||
ImportAnonymousSymbolEntry im;
|
ImportAnonymousSymbolEntry im;
|
||||||
entry.GetImportAnonymousSymbolEntry(j, im);
|
entry.GetImportAnonymousSymbolEntry(j, im);
|
||||||
u32 symbol_address = source.SegmentTagToAddress(im.symbol_position);
|
u32 symbol_address = source.SegmentTagToAddress(im.symbol_position);
|
||||||
NGLOG_TRACE(Service_LDR, " Imports 0x{:08X}", symbol_address);
|
LOG_TRACE(Service_LDR, " Imports 0x{:08X}", symbol_address);
|
||||||
ResultCode result =
|
ResultCode result =
|
||||||
ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
||||||
result.raw);
|
result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -904,8 +903,8 @@ ResultCode CROHelper::ApplyModuleImport(VAddr crs_address) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultCode CROHelper::ApplyExportNamedSymbol(CROHelper target) {
|
ResultCode CROHelper::ApplyExportNamedSymbol(CROHelper target) {
|
||||||
NGLOG_DEBUG(Service_LDR, "CRO \"{}\" exports named symbols to \"{}\"", ModuleName(),
|
LOG_DEBUG(Service_LDR, "CRO \"{}\" exports named symbols to \"{}\"", ModuleName(),
|
||||||
target.ModuleName());
|
target.ModuleName());
|
||||||
u32 target_import_strings_size = target.GetField(ImportStringsSize);
|
u32 target_import_strings_size = target.GetField(ImportStringsSize);
|
||||||
u32 target_symbol_import_num = target.GetField(ImportNamedSymbolNum);
|
u32 target_symbol_import_num = target.GetField(ImportNamedSymbolNum);
|
||||||
for (u32 i = 0; i < target_symbol_import_num; ++i) {
|
for (u32 i = 0; i < target_symbol_import_num; ++i) {
|
||||||
@ -920,10 +919,10 @@ ResultCode CROHelper::ApplyExportNamedSymbol(CROHelper target) {
|
|||||||
Memory::ReadCString(entry.name_offset, target_import_strings_size);
|
Memory::ReadCString(entry.name_offset, target_import_strings_size);
|
||||||
u32 symbol_address = FindExportNamedSymbol(symbol_name);
|
u32 symbol_address = FindExportNamedSymbol(symbol_name);
|
||||||
if (symbol_address != 0) {
|
if (symbol_address != 0) {
|
||||||
NGLOG_TRACE(Service_LDR, " exports symbol \"{}\"", symbol_name);
|
LOG_TRACE(Service_LDR, " exports symbol \"{}\"", symbol_name);
|
||||||
ResultCode result = target.ApplyRelocationBatch(relocation_addr, symbol_address);
|
ResultCode result = target.ApplyRelocationBatch(relocation_addr, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -933,8 +932,8 @@ ResultCode CROHelper::ApplyExportNamedSymbol(CROHelper target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultCode CROHelper::ResetExportNamedSymbol(CROHelper target) {
|
ResultCode CROHelper::ResetExportNamedSymbol(CROHelper target) {
|
||||||
NGLOG_DEBUG(Service_LDR, "CRO \"{}\" unexports named symbols to \"{}\"", ModuleName(),
|
LOG_DEBUG(Service_LDR, "CRO \"{}\" unexports named symbols to \"{}\"", ModuleName(),
|
||||||
target.ModuleName());
|
target.ModuleName());
|
||||||
u32 unresolved_symbol = target.GetOnUnresolvedAddress();
|
u32 unresolved_symbol = target.GetOnUnresolvedAddress();
|
||||||
u32 target_import_strings_size = target.GetField(ImportStringsSize);
|
u32 target_import_strings_size = target.GetField(ImportStringsSize);
|
||||||
u32 target_symbol_import_num = target.GetField(ImportNamedSymbolNum);
|
u32 target_symbol_import_num = target.GetField(ImportNamedSymbolNum);
|
||||||
@ -950,11 +949,11 @@ ResultCode CROHelper::ResetExportNamedSymbol(CROHelper target) {
|
|||||||
Memory::ReadCString(entry.name_offset, target_import_strings_size);
|
Memory::ReadCString(entry.name_offset, target_import_strings_size);
|
||||||
u32 symbol_address = FindExportNamedSymbol(symbol_name);
|
u32 symbol_address = FindExportNamedSymbol(symbol_name);
|
||||||
if (symbol_address != 0) {
|
if (symbol_address != 0) {
|
||||||
NGLOG_TRACE(Service_LDR, " unexports symbol \"{}\"", symbol_name);
|
LOG_TRACE(Service_LDR, " unexports symbol \"{}\"", symbol_name);
|
||||||
ResultCode result =
|
ResultCode result =
|
||||||
target.ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
target.ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -974,34 +973,34 @@ ResultCode CROHelper::ApplyModuleExport(CROHelper target) {
|
|||||||
if (Memory::ReadCString(entry.name_offset, target_import_string_size) != module_name)
|
if (Memory::ReadCString(entry.name_offset, target_import_string_size) != module_name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NGLOG_INFO(Service_LDR, "CRO \"{}\" exports {} indexed symbols to \"{}\"", module_name,
|
LOG_INFO(Service_LDR, "CRO \"{}\" exports {} indexed symbols to \"{}\"", module_name,
|
||||||
entry.import_indexed_symbol_num, target.ModuleName());
|
entry.import_indexed_symbol_num, target.ModuleName());
|
||||||
for (u32 j = 0; j < entry.import_indexed_symbol_num; ++j) {
|
for (u32 j = 0; j < entry.import_indexed_symbol_num; ++j) {
|
||||||
ImportIndexedSymbolEntry im;
|
ImportIndexedSymbolEntry im;
|
||||||
entry.GetImportIndexedSymbolEntry(j, im);
|
entry.GetImportIndexedSymbolEntry(j, im);
|
||||||
ExportIndexedSymbolEntry ex;
|
ExportIndexedSymbolEntry ex;
|
||||||
GetEntry(im.index, ex);
|
GetEntry(im.index, ex);
|
||||||
u32 symbol_address = SegmentTagToAddress(ex.symbol_position);
|
u32 symbol_address = SegmentTagToAddress(ex.symbol_position);
|
||||||
NGLOG_TRACE(Service_LDR, " exports symbol 0x{:08X}", symbol_address);
|
LOG_TRACE(Service_LDR, " exports symbol 0x{:08X}", symbol_address);
|
||||||
ResultCode result =
|
ResultCode result =
|
||||||
target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_INFO(Service_LDR, "CRO \"{}\" exports {} anonymous symbols to \"{}\"", module_name,
|
LOG_INFO(Service_LDR, "CRO \"{}\" exports {} anonymous symbols to \"{}\"", module_name,
|
||||||
entry.import_anonymous_symbol_num, target.ModuleName());
|
entry.import_anonymous_symbol_num, target.ModuleName());
|
||||||
for (u32 j = 0; j < entry.import_anonymous_symbol_num; ++j) {
|
for (u32 j = 0; j < entry.import_anonymous_symbol_num; ++j) {
|
||||||
ImportAnonymousSymbolEntry im;
|
ImportAnonymousSymbolEntry im;
|
||||||
entry.GetImportAnonymousSymbolEntry(j, im);
|
entry.GetImportAnonymousSymbolEntry(j, im);
|
||||||
u32 symbol_address = SegmentTagToAddress(im.symbol_position);
|
u32 symbol_address = SegmentTagToAddress(im.symbol_position);
|
||||||
NGLOG_TRACE(Service_LDR, " exports symbol 0x{:08X}", symbol_address);
|
LOG_TRACE(Service_LDR, " exports symbol 0x{:08X}", symbol_address);
|
||||||
ResultCode result =
|
ResultCode result =
|
||||||
target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1023,28 +1022,28 @@ ResultCode CROHelper::ResetModuleExport(CROHelper target) {
|
|||||||
if (Memory::ReadCString(entry.name_offset, target_import_string_size) != module_name)
|
if (Memory::ReadCString(entry.name_offset, target_import_string_size) != module_name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR, "CRO \"{}\" unexports indexed symbols to \"{}\"", module_name,
|
LOG_DEBUG(Service_LDR, "CRO \"{}\" unexports indexed symbols to \"{}\"", module_name,
|
||||||
target.ModuleName());
|
target.ModuleName());
|
||||||
for (u32 j = 0; j < entry.import_indexed_symbol_num; ++j) {
|
for (u32 j = 0; j < entry.import_indexed_symbol_num; ++j) {
|
||||||
ImportIndexedSymbolEntry im;
|
ImportIndexedSymbolEntry im;
|
||||||
entry.GetImportIndexedSymbolEntry(j, im);
|
entry.GetImportIndexedSymbolEntry(j, im);
|
||||||
ResultCode result =
|
ResultCode result =
|
||||||
target.ApplyRelocationBatch(im.relocation_batch_offset, unresolved_symbol, true);
|
target.ApplyRelocationBatch(im.relocation_batch_offset, unresolved_symbol, true);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR, "CRO \"{}\" unexports anonymous symbols to \"{}\"", module_name,
|
LOG_DEBUG(Service_LDR, "CRO \"{}\" unexports anonymous symbols to \"{}\"", module_name,
|
||||||
target.ModuleName());
|
target.ModuleName());
|
||||||
for (u32 j = 0; j < entry.import_anonymous_symbol_num; ++j) {
|
for (u32 j = 0; j < entry.import_anonymous_symbol_num; ++j) {
|
||||||
ImportAnonymousSymbolEntry im;
|
ImportAnonymousSymbolEntry im;
|
||||||
entry.GetImportAnonymousSymbolEntry(j, im);
|
entry.GetImportAnonymousSymbolEntry(j, im);
|
||||||
ResultCode result =
|
ResultCode result =
|
||||||
target.ApplyRelocationBatch(im.relocation_batch_offset, unresolved_symbol, true);
|
target.ApplyRelocationBatch(im.relocation_batch_offset, unresolved_symbol, true);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1069,13 +1068,13 @@ ResultCode CROHelper::ApplyExitRelocations(VAddr crs_address) {
|
|||||||
u32 symbol_address = source.FindExportNamedSymbol("nnroAeabiAtexit_");
|
u32 symbol_address = source.FindExportNamedSymbol("nnroAeabiAtexit_");
|
||||||
|
|
||||||
if (symbol_address != 0) {
|
if (symbol_address != 0) {
|
||||||
NGLOG_DEBUG(Service_LDR, "CRO \"{}\" import exit function from \"{}\"",
|
LOG_DEBUG(Service_LDR, "CRO \"{}\" import exit function from \"{}\"",
|
||||||
ModuleName(), source.ModuleName());
|
ModuleName(), source.ModuleName());
|
||||||
|
|
||||||
ResultCode result = ApplyRelocationBatch(relocation_addr, symbol_address);
|
ResultCode result = ApplyRelocationBatch(relocation_addr, symbol_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
|
||||||
result.raw);
|
result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1085,7 +1084,7 @@ ResultCode CROHelper::ApplyExitRelocations(VAddr crs_address) {
|
|||||||
return MakeResult<bool>(true);
|
return MakeResult<bool>(true);
|
||||||
});
|
});
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying exit relocation {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying exit relocation {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1116,13 +1115,13 @@ ResultCode CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment
|
|||||||
|
|
||||||
ResultCode result = RebaseHeader(cro_size);
|
ResultCode result = RebaseHeader(cro_size);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing header {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing header {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = VerifyStringTableLength(GetField(ModuleNameOffset), GetField(ModuleNameSize));
|
result = VerifyStringTableLength(GetField(ModuleNameOffset), GetField(ModuleNameSize));
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error verifying module name {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error verifying module name {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,7 +1130,7 @@ ResultCode CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment
|
|||||||
auto result_val = RebaseSegmentTable(cro_size, data_segment_addresss, data_segment_size,
|
auto result_val = RebaseSegmentTable(cro_size, data_segment_addresss, data_segment_size,
|
||||||
bss_segment_address, bss_segment_size);
|
bss_segment_address, bss_segment_size);
|
||||||
if (result_val.Failed()) {
|
if (result_val.Failed()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing segment table {:08X}", result_val.Code().raw);
|
LOG_ERROR(Service_LDR, "Error rebasing segment table {:08X}", result_val.Code().raw);
|
||||||
return result_val.Code();
|
return result_val.Code();
|
||||||
}
|
}
|
||||||
prev_data_segment_address = *result_val;
|
prev_data_segment_address = *result_val;
|
||||||
@ -1139,76 +1138,76 @@ ResultCode CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment
|
|||||||
|
|
||||||
result = RebaseExportNamedSymbolTable();
|
result = RebaseExportNamedSymbolTable();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing symbol export table {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing symbol export table {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = VerifyExportTreeTable();
|
result = VerifyExportTreeTable();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error verifying export tree {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error verifying export tree {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = VerifyStringTableLength(GetField(ExportStringsOffset), GetField(ExportStringsSize));
|
result = VerifyStringTableLength(GetField(ExportStringsOffset), GetField(ExportStringsSize));
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error verifying export strings {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error verifying export strings {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = RebaseImportModuleTable();
|
result = RebaseImportModuleTable();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing object table {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing object table {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ResetExternalRelocations();
|
result = ResetExternalRelocations();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error resetting all external relocations {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error resetting all external relocations {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = RebaseImportNamedSymbolTable();
|
result = RebaseImportNamedSymbolTable();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing symbol import table {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing symbol import table {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = RebaseImportIndexedSymbolTable();
|
result = RebaseImportIndexedSymbolTable();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing index import table {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing index import table {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = RebaseImportAnonymousSymbolTable();
|
result = RebaseImportAnonymousSymbolTable();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing offset import table {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing offset import table {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = VerifyStringTableLength(GetField(ImportStringsOffset), GetField(ImportStringsSize));
|
result = VerifyStringTableLength(GetField(ImportStringsOffset), GetField(ImportStringsSize));
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error verifying import strings {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error verifying import strings {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_crs) {
|
if (!is_crs) {
|
||||||
result = ApplyStaticAnonymousSymbolToCRS(crs_address);
|
result = ApplyStaticAnonymousSymbolToCRS(crs_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying offset export to CRS {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying offset export to CRS {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ApplyInternalRelocations(prev_data_segment_address);
|
result = ApplyInternalRelocations(prev_data_segment_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying internal relocations {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying internal relocations {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_crs) {
|
if (!is_crs) {
|
||||||
result = ApplyExitRelocations(crs_address);
|
result = ApplyExitRelocations(crs_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying exit relocations {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying exit relocations {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1280,14 +1279,14 @@ ResultCode CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
|
|||||||
// Imports named symbols from other modules
|
// Imports named symbols from other modules
|
||||||
result = ApplyImportNamedSymbol(crs_address);
|
result = ApplyImportNamedSymbol(crs_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying symbol import {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying symbol import {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Imports indexed and anonymous symbols from other modules
|
// Imports indexed and anonymous symbols from other modules
|
||||||
result = ApplyModuleImport(crs_address);
|
result = ApplyModuleImport(crs_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying module import {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying module import {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1305,7 +1304,7 @@ ResultCode CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
|
|||||||
return MakeResult<bool>(true);
|
return MakeResult<bool>(true);
|
||||||
});
|
});
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error applying export {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error applying export {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1317,21 +1316,21 @@ ResultCode CROHelper::Unlink(VAddr crs_address) {
|
|||||||
// Resets all imported named symbols
|
// Resets all imported named symbols
|
||||||
ResultCode result = ResetImportNamedSymbol();
|
ResultCode result = ResetImportNamedSymbol();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error resetting symbol import {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error resetting symbol import {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets all imported indexed symbols
|
// Resets all imported indexed symbols
|
||||||
result = ResetImportIndexedSymbol();
|
result = ResetImportIndexedSymbol();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error resetting indexed import {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error resetting indexed import {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets all imported anonymous symbols
|
// Resets all imported anonymous symbols
|
||||||
result = ResetImportAnonymousSymbol();
|
result = ResetImportAnonymousSymbol();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error resetting anonymous import {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error resetting anonymous import {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1349,7 +1348,7 @@ ResultCode CROHelper::Unlink(VAddr crs_address) {
|
|||||||
return MakeResult<bool>(true);
|
return MakeResult<bool>(true);
|
||||||
});
|
});
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error resetting export {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error resetting export {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1359,13 +1358,13 @@ ResultCode CROHelper::Unlink(VAddr crs_address) {
|
|||||||
ResultCode CROHelper::ClearRelocations() {
|
ResultCode CROHelper::ClearRelocations() {
|
||||||
ResultCode result = ClearExternalRelocations();
|
ResultCode result = ClearExternalRelocations();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error clearing external relocations {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error clearing external relocations {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ClearInternalRelocations();
|
result = ClearInternalRelocations();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error clearing internal relocations {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error clearing internal relocations {:08X}", result.raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
@ -58,52 +58,51 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
// All other service functions below have the same issue.
|
// All other service functions below have the same issue.
|
||||||
auto process = rp.PopObject<Kernel::Process>();
|
auto process = rp.PopObject<Kernel::Process>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR,
|
LOG_DEBUG(Service_LDR, "called, crs_buffer_ptr=0x{:08X}, crs_address=0x{:08X}, crs_size=0x{:X}",
|
||||||
"called, crs_buffer_ptr=0x{:08X}, crs_address=0x{:08X}, crs_size=0x{:X}",
|
crs_buffer_ptr, crs_address, crs_size);
|
||||||
crs_buffer_ptr, crs_address, crs_size);
|
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
|
||||||
ClientSlot* slot = GetSessionData(ctx.Session());
|
ClientSlot* slot = GetSessionData(ctx.Session());
|
||||||
if (slot->loaded_crs != 0) {
|
if (slot->loaded_crs != 0) {
|
||||||
NGLOG_ERROR(Service_LDR, "Already initialized");
|
LOG_ERROR(Service_LDR, "Already initialized");
|
||||||
rb.Push(ERROR_ALREADY_INITIALIZED);
|
rb.Push(ERROR_ALREADY_INITIALIZED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crs_size < CRO_HEADER_SIZE) {
|
if (crs_size < CRO_HEADER_SIZE) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRS is too small");
|
LOG_ERROR(Service_LDR, "CRS is too small");
|
||||||
rb.Push(ERROR_BUFFER_TOO_SMALL);
|
rb.Push(ERROR_BUFFER_TOO_SMALL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crs_buffer_ptr & Memory::PAGE_MASK) {
|
if (crs_buffer_ptr & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRS original address is not aligned");
|
LOG_ERROR(Service_LDR, "CRS original address is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crs_address & Memory::PAGE_MASK) {
|
if (crs_address & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRS mapping address is not aligned");
|
LOG_ERROR(Service_LDR, "CRS mapping address is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crs_size & Memory::PAGE_MASK) {
|
if (crs_size & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRS size is not aligned");
|
LOG_ERROR(Service_LDR, "CRS size is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_SIZE);
|
rb.Push(ERROR_MISALIGNED_SIZE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!VerifyBufferState(*process, crs_buffer_ptr, crs_size)) {
|
if (!VerifyBufferState(*process, crs_buffer_ptr, crs_size)) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRS original buffer is in invalid state");
|
LOG_ERROR(Service_LDR, "CRS original buffer is in invalid state");
|
||||||
rb.Push(ERROR_INVALID_MEMORY_STATE);
|
rb.Push(ERROR_INVALID_MEMORY_STATE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crs_address < Memory::PROCESS_IMAGE_VADDR ||
|
if (crs_address < Memory::PROCESS_IMAGE_VADDR ||
|
||||||
crs_address + crs_size > Memory::PROCESS_IMAGE_VADDR_END) {
|
crs_address + crs_size > Memory::PROCESS_IMAGE_VADDR_END) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRS mapping address is not in the process image region");
|
LOG_ERROR(Service_LDR, "CRS mapping address is not in the process image region");
|
||||||
rb.Push(ERROR_ILLEGAL_ADDRESS);
|
rb.Push(ERROR_ILLEGAL_ADDRESS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -118,7 +117,7 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
.MapMemoryBlock(crs_address, crs_mem, 0, crs_size, Kernel::MemoryState::Code)
|
.MapMemoryBlock(crs_address, crs_mem, 0, crs_size, Kernel::MemoryState::Code)
|
||||||
.Code();
|
.Code();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error mapping memory block {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error mapping memory block {:08X}", result.raw);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -126,7 +125,7 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
result =
|
result =
|
||||||
process->vm_manager.ReprotectRange(crs_address, crs_size, Kernel::VMAPermission::Read);
|
process->vm_manager.ReprotectRange(crs_address, crs_size, Kernel::VMAPermission::Read);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error reprotecting memory block {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error reprotecting memory block {:08X}", result.raw);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -137,7 +136,7 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
// TODO(wwylele): verify this behaviour. This is only seen in the web browser app,
|
// TODO(wwylele): verify this behaviour. This is only seen in the web browser app,
|
||||||
// and the actual behaviour is unclear. "Do nothing" is probably an incorrect implement.
|
// and the actual behaviour is unclear. "Do nothing" is probably an incorrect implement.
|
||||||
// There is also a chance that another issue causes the app passing wrong arguments.
|
// There is also a chance that another issue causes the app passing wrong arguments.
|
||||||
NGLOG_WARNING(Service_LDR, "crs_buffer_ptr == crs_address (0x{:08X})", crs_address);
|
LOG_WARNING(Service_LDR, "crs_buffer_ptr == crs_address (0x{:08X})", crs_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
CROHelper crs(crs_address);
|
CROHelper crs(crs_address);
|
||||||
@ -145,7 +144,7 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
result = crs.Rebase(0, crs_size, 0, 0, 0, 0, true);
|
result = crs.Rebase(0, crs_size, 0, 0, 0, 0, true);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing CRS 0x{:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing CRS 0x{:08X}", result.raw);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -166,8 +165,8 @@ void RO::LoadCRR(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}, crr_size=0x{:08X}",
|
LOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}, crr_size=0x{:08X}",
|
||||||
crr_buffer_ptr, crr_size);
|
crr_buffer_ptr, crr_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RO::UnloadCRR(Kernel::HLERequestContext& ctx) {
|
void RO::UnloadCRR(Kernel::HLERequestContext& ctx) {
|
||||||
@ -178,7 +177,7 @@ void RO::UnloadCRR(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}", crr_buffer_ptr);
|
LOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}", crr_buffer_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
||||||
@ -196,55 +195,55 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
VAddr crr_address = rp.Pop<u32>();
|
VAddr crr_address = rp.Pop<u32>();
|
||||||
auto process = rp.PopObject<Kernel::Process>();
|
auto process = rp.PopObject<Kernel::Process>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR,
|
LOG_DEBUG(Service_LDR,
|
||||||
"called ({}), cro_buffer_ptr=0x{:08X}, cro_address=0x{:08X}, cro_size=0x{:X}, "
|
"called ({}), cro_buffer_ptr=0x{:08X}, cro_address=0x{:08X}, cro_size=0x{:X}, "
|
||||||
"data_segment_address=0x{:08X}, zero={}, data_segment_size=0x{:X}, "
|
"data_segment_address=0x{:08X}, zero={}, data_segment_size=0x{:X}, "
|
||||||
"bss_segment_address=0x{:08X}, bss_segment_size=0x{:X}, auto_link={}, "
|
"bss_segment_address=0x{:08X}, bss_segment_size=0x{:X}, auto_link={}, "
|
||||||
"fix_level={}, crr_address=0x{:08X}",
|
"fix_level={}, crr_address=0x{:08X}",
|
||||||
link_on_load_bug_fix ? "new" : "old", cro_buffer_ptr, cro_address, cro_size,
|
link_on_load_bug_fix ? "new" : "old", cro_buffer_ptr, cro_address, cro_size,
|
||||||
data_segment_address, zero, data_segment_size, bss_segment_address,
|
data_segment_address, zero, data_segment_size, bss_segment_address, bss_segment_size,
|
||||||
bss_segment_size, auto_link ? "true" : "false", fix_level, crr_address);
|
auto_link ? "true" : "false", fix_level, crr_address);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
|
|
||||||
ClientSlot* slot = GetSessionData(ctx.Session());
|
ClientSlot* slot = GetSessionData(ctx.Session());
|
||||||
if (slot->loaded_crs == 0) {
|
if (slot->loaded_crs == 0) {
|
||||||
NGLOG_ERROR(Service_LDR, "Not initialized");
|
LOG_ERROR(Service_LDR, "Not initialized");
|
||||||
rb.Push(ERROR_NOT_INITIALIZED);
|
rb.Push(ERROR_NOT_INITIALIZED);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cro_size < CRO_HEADER_SIZE) {
|
if (cro_size < CRO_HEADER_SIZE) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO too small");
|
LOG_ERROR(Service_LDR, "CRO too small");
|
||||||
rb.Push(ERROR_BUFFER_TOO_SMALL);
|
rb.Push(ERROR_BUFFER_TOO_SMALL);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cro_buffer_ptr & Memory::PAGE_MASK) {
|
if (cro_buffer_ptr & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO original address is not aligned");
|
LOG_ERROR(Service_LDR, "CRO original address is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cro_address & Memory::PAGE_MASK) {
|
if (cro_address & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO mapping address is not aligned");
|
LOG_ERROR(Service_LDR, "CRO mapping address is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cro_size & Memory::PAGE_MASK) {
|
if (cro_size & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO size is not aligned");
|
LOG_ERROR(Service_LDR, "CRO size is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_SIZE);
|
rb.Push(ERROR_MISALIGNED_SIZE);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!VerifyBufferState(*process, cro_buffer_ptr, cro_size)) {
|
if (!VerifyBufferState(*process, cro_buffer_ptr, cro_size)) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO original buffer is in invalid state");
|
LOG_ERROR(Service_LDR, "CRO original buffer is in invalid state");
|
||||||
rb.Push(ERROR_INVALID_MEMORY_STATE);
|
rb.Push(ERROR_INVALID_MEMORY_STATE);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
@ -252,14 +251,14 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
|
|
||||||
if (cro_address < Memory::PROCESS_IMAGE_VADDR ||
|
if (cro_address < Memory::PROCESS_IMAGE_VADDR ||
|
||||||
cro_address + cro_size > Memory::PROCESS_IMAGE_VADDR_END) {
|
cro_address + cro_size > Memory::PROCESS_IMAGE_VADDR_END) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO mapping address is not in the process image region");
|
LOG_ERROR(Service_LDR, "CRO mapping address is not in the process image region");
|
||||||
rb.Push(ERROR_ILLEGAL_ADDRESS);
|
rb.Push(ERROR_ILLEGAL_ADDRESS);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zero) {
|
if (zero) {
|
||||||
NGLOG_ERROR(Service_LDR, "Zero is not zero {}", zero);
|
LOG_ERROR(Service_LDR, "Zero is not zero {}", zero);
|
||||||
rb.Push(ResultCode(static_cast<ErrorDescription>(29), ErrorModule::RO,
|
rb.Push(ResultCode(static_cast<ErrorDescription>(29), ErrorModule::RO,
|
||||||
ErrorSummary::Internal, ErrorLevel::Usage));
|
ErrorSummary::Internal, ErrorLevel::Usage));
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
@ -276,7 +275,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
.MapMemoryBlock(cro_address, cro_mem, 0, cro_size, Kernel::MemoryState::Code)
|
.MapMemoryBlock(cro_address, cro_mem, 0, cro_size, Kernel::MemoryState::Code)
|
||||||
.Code();
|
.Code();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error mapping memory block {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error mapping memory block {:08X}", result.raw);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
return;
|
return;
|
||||||
@ -285,7 +284,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
result =
|
result =
|
||||||
process->vm_manager.ReprotectRange(cro_address, cro_size, Kernel::VMAPermission::Read);
|
process->vm_manager.ReprotectRange(cro_address, cro_size, Kernel::VMAPermission::Read);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error reprotecting memory block {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error reprotecting memory block {:08X}", result.raw);
|
||||||
process->vm_manager.UnmapRange(cro_address, cro_size);
|
process->vm_manager.UnmapRange(cro_address, cro_size);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
@ -299,14 +298,14 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
// This is derived from the case of LoadCRS with buffer_ptr==address,
|
// This is derived from the case of LoadCRS with buffer_ptr==address,
|
||||||
// and is never seen in any game. "Do nothing" is probably an incorrect implement.
|
// and is never seen in any game. "Do nothing" is probably an incorrect implement.
|
||||||
// There is also a chance that this case is just prohibited.
|
// There is also a chance that this case is just prohibited.
|
||||||
NGLOG_WARNING(Service_LDR, "cro_buffer_ptr == cro_address (0x{:08X})", cro_address);
|
LOG_WARNING(Service_LDR, "cro_buffer_ptr == cro_address (0x{:08X})", cro_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
CROHelper cro(cro_address);
|
CROHelper cro(cro_address);
|
||||||
|
|
||||||
result = cro.VerifyHash(cro_size, crr_address);
|
result = cro.VerifyHash(cro_size, crr_address);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error verifying CRO in CRR {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error verifying CRO in CRR {:08X}", result.raw);
|
||||||
process->vm_manager.UnmapRange(cro_address, cro_size);
|
process->vm_manager.UnmapRange(cro_address, cro_size);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
@ -316,7 +315,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
result = cro.Rebase(slot->loaded_crs, cro_size, data_segment_address, data_segment_size,
|
result = cro.Rebase(slot->loaded_crs, cro_size, data_segment_address, data_segment_size,
|
||||||
bss_segment_address, bss_segment_size, false);
|
bss_segment_address, bss_segment_size, false);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error rebasing CRO {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error rebasing CRO {:08X}", result.raw);
|
||||||
process->vm_manager.UnmapRange(cro_address, cro_size);
|
process->vm_manager.UnmapRange(cro_address, cro_size);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
@ -325,7 +324,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
|
|
||||||
result = cro.Link(slot->loaded_crs, link_on_load_bug_fix);
|
result = cro.Link(slot->loaded_crs, link_on_load_bug_fix);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error linking CRO {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error linking CRO {:08X}", result.raw);
|
||||||
process->vm_manager.UnmapRange(cro_address, cro_size);
|
process->vm_manager.UnmapRange(cro_address, cro_size);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
@ -343,7 +342,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
if (fix_size != cro_size) {
|
if (fix_size != cro_size) {
|
||||||
result = process->vm_manager.UnmapRange(cro_address + fix_size, cro_size - fix_size);
|
result = process->vm_manager.UnmapRange(cro_address + fix_size, cro_size - fix_size);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error unmapping memory block {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error unmapping memory block {:08X}", result.raw);
|
||||||
process->vm_manager.UnmapRange(cro_address, cro_size);
|
process->vm_manager.UnmapRange(cro_address, cro_size);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
@ -362,7 +361,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
result = process->vm_manager.ReprotectRange(exe_begin, exe_size,
|
result = process->vm_manager.ReprotectRange(exe_begin, exe_size,
|
||||||
Kernel::VMAPermission::ReadExecute);
|
Kernel::VMAPermission::ReadExecute);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error reprotecting memory block {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error reprotecting memory block {:08X}", result.raw);
|
||||||
process->vm_manager.UnmapRange(cro_address, fix_size);
|
process->vm_manager.UnmapRange(cro_address, fix_size);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
@ -372,8 +371,8 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
|
|||||||
|
|
||||||
Core::CPU().InvalidateCacheRange(cro_address, cro_size);
|
Core::CPU().InvalidateCacheRange(cro_address, cro_size);
|
||||||
|
|
||||||
NGLOG_INFO(Service_LDR, "CRO \"{}\" loaded at 0x{:08X}, fixed_end=0x{:08X}", cro.ModuleName(),
|
LOG_INFO(Service_LDR, "CRO \"{}\" loaded at 0x{:08X}, fixed_end=0x{:08X}", cro.ModuleName(),
|
||||||
cro_address, cro_address + fix_size);
|
cro_address, cro_address + fix_size);
|
||||||
|
|
||||||
rb.Push(RESULT_SUCCESS, fix_size);
|
rb.Push(RESULT_SUCCESS, fix_size);
|
||||||
}
|
}
|
||||||
@ -385,8 +384,8 @@ void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
VAddr cro_buffer_ptr = rp.Pop<u32>();
|
VAddr cro_buffer_ptr = rp.Pop<u32>();
|
||||||
auto process = rp.PopObject<Kernel::Process>();
|
auto process = rp.PopObject<Kernel::Process>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR, "called, cro_address=0x{:08X}, zero={}, cro_buffer_ptr=0x{:08X}",
|
LOG_DEBUG(Service_LDR, "called, cro_address=0x{:08X}, zero={}, cro_buffer_ptr=0x{:08X}",
|
||||||
cro_address, zero, cro_buffer_ptr);
|
cro_address, zero, cro_buffer_ptr);
|
||||||
|
|
||||||
CROHelper cro(cro_address);
|
CROHelper cro(cro_address);
|
||||||
|
|
||||||
@ -394,24 +393,24 @@ void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
ClientSlot* slot = GetSessionData(ctx.Session());
|
ClientSlot* slot = GetSessionData(ctx.Session());
|
||||||
if (slot->loaded_crs == 0) {
|
if (slot->loaded_crs == 0) {
|
||||||
NGLOG_ERROR(Service_LDR, "Not initialized");
|
LOG_ERROR(Service_LDR, "Not initialized");
|
||||||
rb.Push(ERROR_NOT_INITIALIZED);
|
rb.Push(ERROR_NOT_INITIALIZED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cro_address & Memory::PAGE_MASK) {
|
if (cro_address & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO address is not aligned");
|
LOG_ERROR(Service_LDR, "CRO address is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cro.IsLoaded()) {
|
if (!cro.IsLoaded()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Invalid or not loaded CRO");
|
LOG_ERROR(Service_LDR, "Invalid or not loaded CRO");
|
||||||
rb.Push(ERROR_NOT_LOADED);
|
rb.Push(ERROR_NOT_LOADED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_INFO(Service_LDR, "Unloading CRO \"{}\"", cro.ModuleName());
|
LOG_INFO(Service_LDR, "Unloading CRO \"{}\"", cro.ModuleName());
|
||||||
|
|
||||||
u32 fixed_size = cro.GetFixedSize();
|
u32 fixed_size = cro.GetFixedSize();
|
||||||
|
|
||||||
@ -419,7 +418,7 @@ void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
ResultCode result = cro.Unlink(slot->loaded_crs);
|
ResultCode result = cro.Unlink(slot->loaded_crs);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error unlinking CRO {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error unlinking CRO {:08X}", result.raw);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -429,7 +428,7 @@ void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
if (!cro.IsFixed()) {
|
if (!cro.IsFixed()) {
|
||||||
result = cro.ClearRelocations();
|
result = cro.ClearRelocations();
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error clearing relocations {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error clearing relocations {:08X}", result.raw);
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -443,7 +442,7 @@ void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
if (cro_address != cro_buffer_ptr) {
|
if (cro_address != cro_buffer_ptr) {
|
||||||
result = process->vm_manager.UnmapRange(cro_address, fixed_size);
|
result = process->vm_manager.UnmapRange(cro_address, fixed_size);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error unmapping CRO {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error unmapping CRO {:08X}", result.raw);
|
||||||
}
|
}
|
||||||
slot->memory_synchronizer.RemoveMemoryBlock(cro_address, cro_buffer_ptr);
|
slot->memory_synchronizer.RemoveMemoryBlock(cro_address, cro_buffer_ptr);
|
||||||
}
|
}
|
||||||
@ -458,7 +457,7 @@ void RO::LinkCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
VAddr cro_address = rp.Pop<u32>();
|
VAddr cro_address = rp.Pop<u32>();
|
||||||
auto process = rp.PopObject<Kernel::Process>();
|
auto process = rp.PopObject<Kernel::Process>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR, "called, cro_address=0x{:08X}", cro_address);
|
LOG_DEBUG(Service_LDR, "called, cro_address=0x{:08X}", cro_address);
|
||||||
|
|
||||||
CROHelper cro(cro_address);
|
CROHelper cro(cro_address);
|
||||||
|
|
||||||
@ -466,28 +465,28 @@ void RO::LinkCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
ClientSlot* slot = GetSessionData(ctx.Session());
|
ClientSlot* slot = GetSessionData(ctx.Session());
|
||||||
if (slot->loaded_crs == 0) {
|
if (slot->loaded_crs == 0) {
|
||||||
NGLOG_ERROR(Service_LDR, "Not initialized");
|
LOG_ERROR(Service_LDR, "Not initialized");
|
||||||
rb.Push(ERROR_NOT_INITIALIZED);
|
rb.Push(ERROR_NOT_INITIALIZED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cro_address & Memory::PAGE_MASK) {
|
if (cro_address & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO address is not aligned");
|
LOG_ERROR(Service_LDR, "CRO address is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cro.IsLoaded()) {
|
if (!cro.IsLoaded()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Invalid or not loaded CRO");
|
LOG_ERROR(Service_LDR, "Invalid or not loaded CRO");
|
||||||
rb.Push(ERROR_NOT_LOADED);
|
rb.Push(ERROR_NOT_LOADED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_INFO(Service_LDR, "Linking CRO \"{}\"", cro.ModuleName());
|
LOG_INFO(Service_LDR, "Linking CRO \"{}\"", cro.ModuleName());
|
||||||
|
|
||||||
ResultCode result = cro.Link(slot->loaded_crs, false);
|
ResultCode result = cro.Link(slot->loaded_crs, false);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error linking CRO {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error linking CRO {:08X}", result.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
slot->memory_synchronizer.SynchronizeOriginalMemory(*process);
|
slot->memory_synchronizer.SynchronizeOriginalMemory(*process);
|
||||||
@ -500,7 +499,7 @@ void RO::UnlinkCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
VAddr cro_address = rp.Pop<u32>();
|
VAddr cro_address = rp.Pop<u32>();
|
||||||
auto process = rp.PopObject<Kernel::Process>();
|
auto process = rp.PopObject<Kernel::Process>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR, "called, cro_address=0x{:08X}", cro_address);
|
LOG_DEBUG(Service_LDR, "called, cro_address=0x{:08X}", cro_address);
|
||||||
|
|
||||||
CROHelper cro(cro_address);
|
CROHelper cro(cro_address);
|
||||||
|
|
||||||
@ -508,28 +507,28 @@ void RO::UnlinkCRO(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
ClientSlot* slot = GetSessionData(ctx.Session());
|
ClientSlot* slot = GetSessionData(ctx.Session());
|
||||||
if (slot->loaded_crs == 0) {
|
if (slot->loaded_crs == 0) {
|
||||||
NGLOG_ERROR(Service_LDR, "Not initialized");
|
LOG_ERROR(Service_LDR, "Not initialized");
|
||||||
rb.Push(ERROR_NOT_INITIALIZED);
|
rb.Push(ERROR_NOT_INITIALIZED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cro_address & Memory::PAGE_MASK) {
|
if (cro_address & Memory::PAGE_MASK) {
|
||||||
NGLOG_ERROR(Service_LDR, "CRO address is not aligned");
|
LOG_ERROR(Service_LDR, "CRO address is not aligned");
|
||||||
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
rb.Push(ERROR_MISALIGNED_ADDRESS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cro.IsLoaded()) {
|
if (!cro.IsLoaded()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Invalid or not loaded CRO");
|
LOG_ERROR(Service_LDR, "Invalid or not loaded CRO");
|
||||||
rb.Push(ERROR_NOT_LOADED);
|
rb.Push(ERROR_NOT_LOADED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NGLOG_INFO(Service_LDR, "Unlinking CRO \"{}\"", cro.ModuleName());
|
LOG_INFO(Service_LDR, "Unlinking CRO \"{}\"", cro.ModuleName());
|
||||||
|
|
||||||
ResultCode result = cro.Unlink(slot->loaded_crs);
|
ResultCode result = cro.Unlink(slot->loaded_crs);
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error unlinking CRO {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error unlinking CRO {:08X}", result.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
slot->memory_synchronizer.SynchronizeOriginalMemory(*process);
|
slot->memory_synchronizer.SynchronizeOriginalMemory(*process);
|
||||||
@ -542,13 +541,13 @@ void RO::Shutdown(Kernel::HLERequestContext& ctx) {
|
|||||||
VAddr crs_buffer_ptr = rp.Pop<u32>();
|
VAddr crs_buffer_ptr = rp.Pop<u32>();
|
||||||
auto process = rp.PopObject<Kernel::Process>();
|
auto process = rp.PopObject<Kernel::Process>();
|
||||||
|
|
||||||
NGLOG_DEBUG(Service_LDR, "called, crs_buffer_ptr=0x{:08X}", crs_buffer_ptr);
|
LOG_DEBUG(Service_LDR, "called, crs_buffer_ptr=0x{:08X}", crs_buffer_ptr);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
|
||||||
ClientSlot* slot = GetSessionData(ctx.Session());
|
ClientSlot* slot = GetSessionData(ctx.Session());
|
||||||
if (slot->loaded_crs == 0) {
|
if (slot->loaded_crs == 0) {
|
||||||
NGLOG_ERROR(Service_LDR, "Not initialized");
|
LOG_ERROR(Service_LDR, "Not initialized");
|
||||||
rb.Push(ERROR_NOT_INITIALIZED);
|
rb.Push(ERROR_NOT_INITIALIZED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -564,7 +563,7 @@ void RO::Shutdown(Kernel::HLERequestContext& ctx) {
|
|||||||
if (slot->loaded_crs != crs_buffer_ptr) {
|
if (slot->loaded_crs != crs_buffer_ptr) {
|
||||||
result = process->vm_manager.UnmapRange(slot->loaded_crs, crs.GetFileSize());
|
result = process->vm_manager.UnmapRange(slot->loaded_crs, crs.GetFileSize());
|
||||||
if (result.IsError()) {
|
if (result.IsError()) {
|
||||||
NGLOG_ERROR(Service_LDR, "Error unmapping CRS {:08X}", result.raw);
|
LOG_ERROR(Service_LDR, "Error unmapping CRS {:08X}", result.raw);
|
||||||
}
|
}
|
||||||
slot->memory_synchronizer.RemoveMemoryBlock(slot->loaded_crs, crs_buffer_ptr);
|
slot->memory_synchronizer.RemoveMemoryBlock(slot->loaded_crs, crs_buffer_ptr);
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,14 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
NGLOG_WARNING(Service_MIC, "called, size=0x{:X}", size);
|
LOG_WARNING(Service_MIC, "called, size=0x{:X}", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnmapSharedMem(Kernel::HLERequestContext& ctx) {
|
void UnmapSharedMem(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx, 0x02, 0, 0};
|
IPC::RequestParser rp{ctx, 0x02, 0, 0};
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_MIC, "called");
|
LOG_WARNING(Service_MIC, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartSampling(Kernel::HLERequestContext& ctx) {
|
void StartSampling(Kernel::HLERequestContext& ctx) {
|
||||||
@ -63,11 +63,11 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
is_sampling = true;
|
is_sampling = true;
|
||||||
NGLOG_WARNING(Service_MIC,
|
LOG_WARNING(Service_MIC,
|
||||||
"(STUBBED) called, encoding={}, sample_rate={}, "
|
"(STUBBED) called, encoding={}, sample_rate={}, "
|
||||||
"audio_buffer_offset={}, audio_buffer_size={}, audio_buffer_loop={}",
|
"audio_buffer_offset={}, audio_buffer_size={}, audio_buffer_loop={}",
|
||||||
static_cast<u32>(encoding), static_cast<u32>(sample_rate),
|
static_cast<u32>(encoding), static_cast<u32>(sample_rate), audio_buffer_offset,
|
||||||
audio_buffer_offset, audio_buffer_size, audio_buffer_loop);
|
audio_buffer_size, audio_buffer_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdjustSampling(Kernel::HLERequestContext& ctx) {
|
void AdjustSampling(Kernel::HLERequestContext& ctx) {
|
||||||
@ -76,8 +76,7 @@ struct MIC_U::Impl {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called, sample_rate={}",
|
LOG_WARNING(Service_MIC, "(STUBBED) called, sample_rate={}", static_cast<u32>(sample_rate));
|
||||||
static_cast<u32>(sample_rate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopSampling(Kernel::HLERequestContext& ctx) {
|
void StopSampling(Kernel::HLERequestContext& ctx) {
|
||||||
@ -85,7 +84,7 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
is_sampling = false;
|
is_sampling = false;
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called");
|
LOG_WARNING(Service_MIC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsSampling(Kernel::HLERequestContext& ctx) {
|
void IsSampling(Kernel::HLERequestContext& ctx) {
|
||||||
@ -93,7 +92,7 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<bool>(is_sampling);
|
rb.Push<bool>(is_sampling);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called");
|
LOG_WARNING(Service_MIC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetBufferFullEvent(Kernel::HLERequestContext& ctx) {
|
void GetBufferFullEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -101,7 +100,7 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(buffer_full_event);
|
rb.PushCopyObjects(buffer_full_event);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called");
|
LOG_WARNING(Service_MIC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGain(Kernel::HLERequestContext& ctx) {
|
void SetGain(Kernel::HLERequestContext& ctx) {
|
||||||
@ -110,7 +109,7 @@ struct MIC_U::Impl {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called, mic_gain={}", mic_gain);
|
LOG_WARNING(Service_MIC, "(STUBBED) called, mic_gain={}", mic_gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetGain(Kernel::HLERequestContext& ctx) {
|
void GetGain(Kernel::HLERequestContext& ctx) {
|
||||||
@ -119,7 +118,7 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<u8>(mic_gain);
|
rb.Push<u8>(mic_gain);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called");
|
LOG_WARNING(Service_MIC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPower(Kernel::HLERequestContext& ctx) {
|
void SetPower(Kernel::HLERequestContext& ctx) {
|
||||||
@ -128,7 +127,7 @@ struct MIC_U::Impl {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called, mic_power={}", mic_power);
|
LOG_WARNING(Service_MIC, "(STUBBED) called, mic_power={}", mic_power);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetPower(Kernel::HLERequestContext& ctx) {
|
void GetPower(Kernel::HLERequestContext& ctx) {
|
||||||
@ -136,7 +135,7 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<u8>(mic_power);
|
rb.Push<u8>(mic_power);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called");
|
LOG_WARNING(Service_MIC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetIirFilterMic(Kernel::HLERequestContext& ctx) {
|
void SetIirFilterMic(Kernel::HLERequestContext& ctx) {
|
||||||
@ -147,8 +146,8 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushMappedBuffer(buffer);
|
rb.PushMappedBuffer(buffer);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called, size=0x{:X}, buffer=0x{:08X}", size,
|
LOG_WARNING(Service_MIC, "(STUBBED) called, size=0x{:X}, buffer=0x{:08X}", size,
|
||||||
buffer.GetId());
|
buffer.GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetClamp(Kernel::HLERequestContext& ctx) {
|
void SetClamp(Kernel::HLERequestContext& ctx) {
|
||||||
@ -157,7 +156,7 @@ struct MIC_U::Impl {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called, clamp={}", clamp);
|
LOG_WARNING(Service_MIC, "(STUBBED) called, clamp={}", clamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetClamp(Kernel::HLERequestContext& ctx) {
|
void GetClamp(Kernel::HLERequestContext& ctx) {
|
||||||
@ -165,7 +164,7 @@ struct MIC_U::Impl {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<bool>(clamp);
|
rb.Push<bool>(clamp);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called");
|
LOG_WARNING(Service_MIC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAllowShellClosed(Kernel::HLERequestContext& ctx) {
|
void SetAllowShellClosed(Kernel::HLERequestContext& ctx) {
|
||||||
@ -174,14 +173,14 @@ struct MIC_U::Impl {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called, allow_shell_closed={}", allow_shell_closed);
|
LOG_WARNING(Service_MIC, "(STUBBED) called, allow_shell_closed={}", allow_shell_closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetClientVersion(Kernel::HLERequestContext& ctx) {
|
void SetClientVersion(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx, 0x10, 1, 0};
|
IPC::RequestParser rp{ctx, 0x10, 1, 0};
|
||||||
|
|
||||||
const u32 version = rp.Pop<u32>();
|
const u32 version = rp.Pop<u32>();
|
||||||
NGLOG_WARNING(Service_MIC, "(STUBBED) called, version: 0x{:08X}", version);
|
LOG_WARNING(Service_MIC, "(STUBBED) called, version: 0x{:08X}", version);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -15,8 +15,8 @@ void NDM_U::EnterExclusiveState(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) exclusive_state=0x{:08X}",
|
LOG_WARNING(Service_NDM, "(STUBBED) exclusive_state=0x{:08X}",
|
||||||
static_cast<u32>(exclusive_state));
|
static_cast<u32>(exclusive_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::LeaveExclusiveState(Kernel::HLERequestContext& ctx) {
|
void NDM_U::LeaveExclusiveState(Kernel::HLERequestContext& ctx) {
|
||||||
@ -25,7 +25,7 @@ void NDM_U::LeaveExclusiveState(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::QueryExclusiveMode(Kernel::HLERequestContext& ctx) {
|
void NDM_U::QueryExclusiveMode(Kernel::HLERequestContext& ctx) {
|
||||||
@ -33,7 +33,7 @@ void NDM_U::QueryExclusiveMode(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushEnum(exclusive_state);
|
rb.PushEnum(exclusive_state);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::LockState(Kernel::HLERequestContext& ctx) {
|
void NDM_U::LockState(Kernel::HLERequestContext& ctx) {
|
||||||
@ -43,7 +43,7 @@ void NDM_U::LockState(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::UnlockState(Kernel::HLERequestContext& ctx) {
|
void NDM_U::UnlockState(Kernel::HLERequestContext& ctx) {
|
||||||
@ -53,7 +53,7 @@ void NDM_U::UnlockState(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::SuspendDaemons(Kernel::HLERequestContext& ctx) {
|
void NDM_U::SuspendDaemons(Kernel::HLERequestContext& ctx) {
|
||||||
@ -69,7 +69,7 @@ void NDM_U::SuspendDaemons(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
|
LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::ResumeDaemons(Kernel::HLERequestContext& ctx) {
|
void NDM_U::ResumeDaemons(Kernel::HLERequestContext& ctx) {
|
||||||
@ -84,7 +84,7 @@ void NDM_U::ResumeDaemons(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
|
LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::SuspendScheduler(Kernel::HLERequestContext& ctx) {
|
void NDM_U::SuspendScheduler(Kernel::HLERequestContext& ctx) {
|
||||||
@ -93,14 +93,14 @@ void NDM_U::SuspendScheduler(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) perform_in_background={}", perform_in_background);
|
LOG_WARNING(Service_NDM, "(STUBBED) perform_in_background={}", perform_in_background);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::ResumeScheduler(Kernel::HLERequestContext& ctx) {
|
void NDM_U::ResumeScheduler(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x09, 0, 0);
|
IPC::RequestParser rp(ctx, 0x09, 0, 0);
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::QueryStatus(Kernel::HLERequestContext& ctx) {
|
void NDM_U::QueryStatus(Kernel::HLERequestContext& ctx) {
|
||||||
@ -110,7 +110,7 @@ void NDM_U::QueryStatus(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushEnum(daemon_status.at(daemon));
|
rb.PushEnum(daemon_status.at(daemon));
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon);
|
LOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::GetDaemonDisableCount(Kernel::HLERequestContext& ctx) {
|
void NDM_U::GetDaemonDisableCount(Kernel::HLERequestContext& ctx) {
|
||||||
@ -121,7 +121,7 @@ void NDM_U::GetDaemonDisableCount(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<u32>(0); // current process disable count
|
rb.Push<u32>(0); // current process disable count
|
||||||
rb.Push<u32>(0); // total disable count
|
rb.Push<u32>(0); // total disable count
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon);
|
LOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::GetSchedulerDisableCount(Kernel::HLERequestContext& ctx) {
|
void NDM_U::GetSchedulerDisableCount(Kernel::HLERequestContext& ctx) {
|
||||||
@ -131,7 +131,7 @@ void NDM_U::GetSchedulerDisableCount(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push<u32>(0); // current process disable count
|
rb.Push<u32>(0); // current process disable count
|
||||||
rb.Push<u32>(0); // total disable count
|
rb.Push<u32>(0); // total disable count
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::SetScanInterval(Kernel::HLERequestContext& ctx) {
|
void NDM_U::SetScanInterval(Kernel::HLERequestContext& ctx) {
|
||||||
@ -140,7 +140,7 @@ void NDM_U::SetScanInterval(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) scan_interval=0x{:08X}", scan_interval);
|
LOG_WARNING(Service_NDM, "(STUBBED) scan_interval=0x{:08X}", scan_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::GetScanInterval(Kernel::HLERequestContext& ctx) {
|
void NDM_U::GetScanInterval(Kernel::HLERequestContext& ctx) {
|
||||||
@ -148,7 +148,7 @@ void NDM_U::GetScanInterval(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(scan_interval);
|
rb.Push(scan_interval);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::SetRetryInterval(Kernel::HLERequestContext& ctx) {
|
void NDM_U::SetRetryInterval(Kernel::HLERequestContext& ctx) {
|
||||||
@ -157,7 +157,7 @@ void NDM_U::SetRetryInterval(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) retry_interval=0x{:08X}", retry_interval);
|
LOG_WARNING(Service_NDM, "(STUBBED) retry_interval=0x{:08X}", retry_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::GetRetryInterval(Kernel::HLERequestContext& ctx) {
|
void NDM_U::GetRetryInterval(Kernel::HLERequestContext& ctx) {
|
||||||
@ -165,7 +165,7 @@ void NDM_U::GetRetryInterval(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(retry_interval);
|
rb.Push(retry_interval);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::OverrideDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
void NDM_U::OverrideDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
||||||
@ -181,7 +181,7 @@ void NDM_U::OverrideDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
|
LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::ResetDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
void NDM_U::ResetDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
||||||
@ -190,7 +190,7 @@ void NDM_U::ResetDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::GetDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
void NDM_U::GetDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
||||||
@ -198,14 +198,14 @@ void NDM_U::GetDefaultDaemons(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushEnum(default_daemon_bit_mask);
|
rb.PushEnum(default_daemon_bit_mask);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDM_U::ClearHalfAwakeMacFilter(Kernel::HLERequestContext& ctx) {
|
void NDM_U::ClearHalfAwakeMacFilter(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x17, 0, 0);
|
IPC::RequestParser rp(ctx, 0x17, 0, 0);
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
NGLOG_WARNING(Service_NDM, "(STUBBED)");
|
LOG_WARNING(Service_NDM, "(STUBBED)");
|
||||||
}
|
}
|
||||||
|
|
||||||
NDM_U::NDM_U() : ServiceFramework("ndm:u", 6) {
|
NDM_U::NDM_U() : ServiceFramework("ndm:u", 6) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user