Merge remote-tracking branch 'upstream/master' into feature/savestates-2
This commit is contained in:
commit
7049af744f
77 changed files with 18323 additions and 11473 deletions
|
@ -70,6 +70,7 @@ void Module::PortConfig::Clear() {
|
|||
completion_event->Clear();
|
||||
buffer_error_interrupt_event->Clear();
|
||||
vsync_interrupt_event->Clear();
|
||||
vsync_timings.clear();
|
||||
is_receiving = false;
|
||||
is_active = false;
|
||||
is_pending_receiving = false;
|
||||
|
@ -143,6 +144,27 @@ void Module::CompletionEventCallBack(u64 port_id, s64) {
|
|||
port.completion_event->Signal();
|
||||
}
|
||||
|
||||
static constexpr std::size_t MaxVsyncTimings = 5;
|
||||
|
||||
void Module::VsyncInterruptEventCallBack(u64 port_id, s64 cycles_late) {
|
||||
PortConfig& port = ports[port_id];
|
||||
const CameraConfig& camera = cameras[port.camera_id];
|
||||
|
||||
if (!port.is_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
port.vsync_timings.emplace_front(system.CoreTiming().GetGlobalTimeUs().count());
|
||||
if (port.vsync_timings.size() > MaxVsyncTimings) {
|
||||
port.vsync_timings.pop_back();
|
||||
}
|
||||
port.vsync_interrupt_event->Signal();
|
||||
|
||||
system.CoreTiming().ScheduleEvent(
|
||||
msToCycles(LATENCY_BY_FRAME_RATE[static_cast<int>(camera.frame_rate)]) - cycles_late,
|
||||
vsync_interrupt_event_callback, port_id);
|
||||
}
|
||||
|
||||
void Module::StartReceiving(int port_id) {
|
||||
PortConfig& port = ports[port_id];
|
||||
port.is_receiving = true;
|
||||
|
@ -183,6 +205,9 @@ void Module::ActivatePort(int port_id, int camera_id) {
|
|||
}
|
||||
ports[port_id].is_active = true;
|
||||
ports[port_id].camera_id = camera_id;
|
||||
system.CoreTiming().ScheduleEvent(
|
||||
msToCycles(LATENCY_BY_FRAME_RATE[static_cast<int>(cameras[camera_id].frame_rate)]),
|
||||
vsync_interrupt_event_callback, port_id);
|
||||
}
|
||||
|
||||
template <int max_index>
|
||||
|
@ -641,6 +666,7 @@ void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
|
|||
cam->ports[i].is_busy = false;
|
||||
}
|
||||
cam->ports[i].is_active = false;
|
||||
cam->system.CoreTiming().UnscheduleEvent(cam->vsync_interrupt_event_callback, i);
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
} else if (camera_select[0] && camera_select[1]) {
|
||||
|
@ -870,6 +896,34 @@ void Module::Interface::SynchronizeVsyncTiming(Kernel::HLERequestContext& ctx) {
|
|||
camera_select1, camera_select2);
|
||||
}
|
||||
|
||||
void Module::Interface::GetLatestVsyncTiming(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x2A, 2, 0);
|
||||
const PortSet port_select(rp.Pop<u8>());
|
||||
const u32 count = rp.Pop<u32>();
|
||||
|
||||
if (!port_select.IsSingle() || count > MaxVsyncTimings) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(ERROR_OUT_OF_RANGE);
|
||||
rb.PushStaticBuffer({}, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
||||
const std::size_t port_id = port_select.m_val == 1 ? 0 : 1;
|
||||
std::vector<u8> out(count * sizeof(s64_le));
|
||||
std::size_t offset = 0;
|
||||
for (const s64_le timing : cam->ports[port_id].vsync_timings) {
|
||||
std::memcpy(out.data() + offset * sizeof(timing), &timing, sizeof(timing));
|
||||
offset++;
|
||||
if (offset >= count) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
rb.PushStaticBuffer(out, 0);
|
||||
}
|
||||
|
||||
void Module::Interface::GetStereoCameraCalibrationData(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = IPC::RequestParser(ctx, 0x2B, 0, 0).MakeBuilder(17, 0);
|
||||
|
||||
|
@ -1042,6 +1096,10 @@ Module::Module(Core::System& system) : system(system) {
|
|||
completion_event_callback = system.CoreTiming().RegisterEvent(
|
||||
"CAM::CompletionEventCallBack",
|
||||
[this](u64 userdata, s64 cycles_late) { CompletionEventCallBack(userdata, cycles_late); });
|
||||
vsync_interrupt_event_callback = system.CoreTiming().RegisterEvent(
|
||||
"CAM::VsyncInterruptEventCallBack", [this](u64 userdata, s64 cycles_late) {
|
||||
VsyncInterruptEventCallBack(userdata, cycles_late);
|
||||
});
|
||||
}
|
||||
|
||||
Module::~Module() {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <deque>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
@ -629,6 +630,21 @@ public:
|
|||
*/
|
||||
void SynchronizeVsyncTiming(Kernel::HLERequestContext& ctx);
|
||||
|
||||
/**
|
||||
* Gets the vsync timing record of the specified camera for the specified number of signals.
|
||||
* Inputs:
|
||||
* 0: 0x002A0080
|
||||
* 1: Port
|
||||
* 2: Number of timings to get
|
||||
* 64: ((PastTimings * 8) << 14) | 2
|
||||
* 65: s64* TimingsOutput
|
||||
* Outputs:
|
||||
* 0: 0x002A0042
|
||||
* 1: ResultCode
|
||||
* 2-3: Output static buffer
|
||||
*/
|
||||
void GetLatestVsyncTiming(Kernel::HLERequestContext& ctx);
|
||||
|
||||
/**
|
||||
* Returns calibration data relating the outside cameras to each other, for use in AR
|
||||
* applications.
|
||||
|
@ -729,6 +745,7 @@ public:
|
|||
|
||||
private:
|
||||
void CompletionEventCallBack(u64 port_id, s64);
|
||||
void VsyncInterruptEventCallBack(u64 port_id, s64 cycles_late);
|
||||
|
||||
// Starts a receiving process on the specified port. This can only be called when is_busy = true
|
||||
// and is_receiving = false.
|
||||
|
@ -767,7 +784,7 @@ private:
|
|||
std::unique_ptr<Camera::CameraInterface> impl;
|
||||
std::array<ContextConfig, 2> contexts;
|
||||
int current_context{0};
|
||||
FrameRate frame_rate{FrameRate::Rate_5};
|
||||
FrameRate frame_rate{FrameRate::Rate_15};
|
||||
|
||||
private:
|
||||
template <class Archive>
|
||||
|
@ -806,6 +823,8 @@ private:
|
|||
std::shared_ptr<Kernel::Event> buffer_error_interrupt_event;
|
||||
std::shared_ptr<Kernel::Event> vsync_interrupt_event;
|
||||
|
||||
std::deque<s64> vsync_timings;
|
||||
|
||||
std::future<std::vector<u16>> capture_result; // will hold the received frame.
|
||||
Kernel::Process* dest_process{nullptr};
|
||||
VAddr dest{0}; // the destination address of the receiving process
|
||||
|
@ -843,8 +862,8 @@ private:
|
|||
Core::System& system;
|
||||
std::array<CameraConfig, NumCameras> cameras;
|
||||
std::array<PortConfig, 2> ports;
|
||||
// TODO: Make this *const
|
||||
const Core::TimingEventType* completion_event_callback;
|
||||
Core::TimingEventType* completion_event_callback;
|
||||
Core::TimingEventType* vsync_interrupt_event_callback;
|
||||
std::atomic<bool> is_camera_reload_pending{false};
|
||||
|
||||
template <class Archive>
|
||||
|
|
|
@ -51,7 +51,7 @@ CAM_C::CAM_C(std::shared_ptr<Module> cam) : Module::Interface(std::move(cam), "c
|
|||
{0x00270140, nullptr, "SetAutoWhiteBalanceWindow"},
|
||||
{0x00280080, nullptr, "SetNoiseFilter"},
|
||||
{0x00290080, &CAM_C::SynchronizeVsyncTiming, "SynchronizeVsyncTiming"},
|
||||
{0x002A0080, nullptr, "GetLatestVsyncTiming"},
|
||||
{0x002A0080, &CAM_C::GetLatestVsyncTiming, "GetLatestVsyncTiming"},
|
||||
{0x002B0000, &CAM_C::GetStereoCameraCalibrationData, "GetStereoCameraCalibrationData"},
|
||||
{0x002C0400, nullptr, "SetStereoCameraCalibrationData"},
|
||||
{0x002D00C0, nullptr, "WriteRegisterI2c"},
|
||||
|
|
|
@ -51,7 +51,7 @@ CAM_S::CAM_S(std::shared_ptr<Module> cam) : Module::Interface(std::move(cam), "c
|
|||
{0x00270140, nullptr, "SetAutoWhiteBalanceWindow"},
|
||||
{0x00280080, nullptr, "SetNoiseFilter"},
|
||||
{0x00290080, &CAM_S::SynchronizeVsyncTiming, "SynchronizeVsyncTiming"},
|
||||
{0x002A0080, nullptr, "GetLatestVsyncTiming"},
|
||||
{0x002A0080, &CAM_S::GetLatestVsyncTiming, "GetLatestVsyncTiming"},
|
||||
{0x002B0000, &CAM_S::GetStereoCameraCalibrationData, "GetStereoCameraCalibrationData"},
|
||||
{0x002C0400, nullptr, "SetStereoCameraCalibrationData"},
|
||||
{0x002D00C0, nullptr, "WriteRegisterI2c"},
|
||||
|
|
|
@ -51,7 +51,7 @@ CAM_U::CAM_U(std::shared_ptr<Module> cam) : Module::Interface(std::move(cam), "c
|
|||
{0x00270140, nullptr, "SetAutoWhiteBalanceWindow"},
|
||||
{0x00280080, nullptr, "SetNoiseFilter"},
|
||||
{0x00290080, &CAM_U::SynchronizeVsyncTiming, "SynchronizeVsyncTiming"},
|
||||
{0x002A0080, nullptr, "GetLatestVsyncTiming"},
|
||||
{0x002A0080, &CAM_U::GetLatestVsyncTiming, "GetLatestVsyncTiming"},
|
||||
{0x002B0000, &CAM_U::GetStereoCameraCalibrationData, "GetStereoCameraCalibrationData"},
|
||||
{0x002C0400, nullptr, "SetStereoCameraCalibrationData"},
|
||||
{0x002D00C0, nullptr, "WriteRegisterI2c"},
|
||||
|
|
|
@ -101,7 +101,8 @@ static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exact
|
|||
} // namespace
|
||||
|
||||
static const EULAVersion MAX_EULA_VERSION = {0x7F, 0x7F};
|
||||
static const ConsoleModelInfo CONSOLE_MODEL = {NINTENDO_3DS_XL, {0, 0, 0}};
|
||||
static const ConsoleModelInfo CONSOLE_MODEL_OLD = {NINTENDO_3DS_XL, {0, 0, 0}};
|
||||
static const ConsoleModelInfo CONSOLE_MODEL_NEW = {NEW_NINTENDO_3DS_XL, {0, 0, 0}};
|
||||
static const u8 CONSOLE_LANGUAGE = LANGUAGE_EN;
|
||||
static const UsernameBlock CONSOLE_USERNAME_BLOCK = {u"CITRA", 0, 0};
|
||||
static const BirthdayBlock PROFILE_BIRTHDAY = {3, 25}; // March 25th, 2014
|
||||
|
@ -244,6 +245,18 @@ void Module::Interface::GetSystemModel(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
// TODO(Subv): Find out the correct error codes
|
||||
rb.Push(cfg->GetConfigInfoBlock(ConsoleModelBlockID, 4, 0x8, reinterpret_cast<u8*>(&data)));
|
||||
ConsoleModelInfo model;
|
||||
std::memcpy(&model, &data, 4);
|
||||
if ((model.model == NINTENDO_3DS || model.model == NINTENDO_3DS_XL ||
|
||||
model.model == NINTENDO_2DS) &&
|
||||
Settings::values.is_new_3ds) {
|
||||
model.model = NEW_NINTENDO_3DS_XL;
|
||||
} else if ((model.model == NEW_NINTENDO_3DS || model.model == NEW_NINTENDO_3DS_XL ||
|
||||
model.model == NEW_NINTENDO_2DS_XL) &&
|
||||
!Settings::values.is_new_3ds) {
|
||||
model.model = NINTENDO_3DS_XL;
|
||||
}
|
||||
std::memcpy(&data, &model, 4);
|
||||
rb.Push<u8>(data & 0xFF);
|
||||
}
|
||||
|
||||
|
@ -522,7 +535,8 @@ ResultCode Module::FormatConfig() {
|
|||
if (!res.IsSuccess())
|
||||
return res;
|
||||
|
||||
res = CreateConfigInfoBlk(ConsoleModelBlockID, sizeof(CONSOLE_MODEL), 0xC, &CONSOLE_MODEL);
|
||||
res = CreateConfigInfoBlk(ConsoleModelBlockID, sizeof(CONSOLE_MODEL_OLD), 0xC,
|
||||
&CONSOLE_MODEL_OLD);
|
||||
if (!res.IsSuccess())
|
||||
return res;
|
||||
|
||||
|
@ -536,7 +550,7 @@ ResultCode Module::FormatConfig() {
|
|||
if (!res.IsSuccess())
|
||||
return res;
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
} // namespace Service::CFG
|
||||
|
||||
ResultCode Module::LoadConfigNANDSaveFile() {
|
||||
std::string nand_directory = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
|
||||
|
|
|
@ -104,7 +104,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
|
||||
const FileSessionSlot* file = GetSessionData(ctx.Session());
|
||||
FileSessionSlot* file = GetSessionData(ctx.Session());
|
||||
|
||||
// Subfiles can not be written to
|
||||
if (file->subfile) {
|
||||
|
@ -117,6 +117,10 @@ void File::Write(Kernel::HLERequestContext& ctx) {
|
|||
std::vector<u8> data(length);
|
||||
buffer.Read(data.data(), 0, data.size());
|
||||
ResultVal<std::size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
|
||||
|
||||
// Update file size
|
||||
file->size = backend->GetSize();
|
||||
|
||||
if (written.Failed()) {
|
||||
rb.Push(written.Code());
|
||||
rb.Push<u32>(0);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "core/hle/service/mic_u.h"
|
||||
#include "core/settings.h"
|
||||
#include "video_core/renderer_base.h"
|
||||
#include "video_core/renderer_opengl/texture_filters/texture_filter_manager.h"
|
||||
#include "video_core/video_core.h"
|
||||
|
||||
namespace Settings {
|
||||
|
@ -38,6 +39,9 @@ void Apply() {
|
|||
VideoCore::g_renderer_sampler_update_requested = true;
|
||||
VideoCore::g_renderer_shader_update_requested = true;
|
||||
|
||||
OpenGL::TextureFilterManager::GetInstance().SetTextureFilter(values.texture_filter_name,
|
||||
values.texture_filter_factor);
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (system.IsPoweredOn()) {
|
||||
Core::DSP().SetSink(values.sink_id, values.audio_device_id);
|
||||
|
@ -83,6 +87,8 @@ void LogSettings() {
|
|||
LogSetting("Renderer_FrameLimit", Settings::values.frame_limit);
|
||||
LogSetting("Renderer_PostProcessingShader", Settings::values.pp_shader_name);
|
||||
LogSetting("Renderer_FilterMode", Settings::values.filter_mode);
|
||||
LogSetting("Renderer_TextureFilterFactor", Settings::values.texture_filter_factor);
|
||||
LogSetting("Renderer_TextureFilterName", Settings::values.texture_filter_name);
|
||||
LogSetting("Stereoscopy_Render3d", static_cast<int>(Settings::values.render_3d));
|
||||
LogSetting("Stereoscopy_Factor3d", Settings::values.factor_3d);
|
||||
LogSetting("Layout_LayoutOption", static_cast<int>(Settings::values.layout_option));
|
||||
|
|
|
@ -147,6 +147,8 @@ struct Values {
|
|||
u16 resolution_factor;
|
||||
bool use_frame_limit;
|
||||
u16 frame_limit;
|
||||
u16 texture_filter_factor;
|
||||
std::string texture_filter_name;
|
||||
|
||||
LayoutOption layout_option;
|
||||
bool swap_screen;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue