Merge pull request #4683 from wwylele/misc-global-clean
Misc global instance reference cleaup
This commit is contained in:
commit
9b07ff9681
12 changed files with 59 additions and 38 deletions
|
@ -103,7 +103,7 @@ static u32 DecompressLZ11(const u8* in, u8* out) {
|
|||
|
||||
bool Module::LoadSharedFont() {
|
||||
u8 font_region_code;
|
||||
auto cfg = Service::CFG::GetModule(Core::System::GetInstance());
|
||||
auto cfg = Service::CFG::GetModule(system);
|
||||
ASSERT_MSG(cfg, "CFG Module missing!");
|
||||
switch (cfg->GetRegionValue()) {
|
||||
case 4: // CHN
|
||||
|
|
|
@ -394,7 +394,7 @@ void InstallInterfaces(Core::System& system) {
|
|||
auto& service_manager = system.ServiceManager();
|
||||
auto dsp = std::make_shared<DSP_DSP>(system);
|
||||
dsp->InstallAsService(service_manager);
|
||||
Core::DSP().SetServiceToInterrupt(std::move(dsp));
|
||||
system.DSP().SetServiceToInterrupt(std::move(dsp));
|
||||
}
|
||||
|
||||
} // namespace Service::DSP
|
||||
|
|
|
@ -64,7 +64,7 @@ enum class ResponseID : u8 {
|
|||
ReadCalibrationData = 0x11,
|
||||
};
|
||||
|
||||
ExtraHID::ExtraHID(SendFunc send_func) : IRDevice(send_func) {
|
||||
ExtraHID::ExtraHID(SendFunc send_func, Core::Timing& timing) : IRDevice(send_func), timing(timing) {
|
||||
LoadInputDevices();
|
||||
|
||||
// The data below was retrieved from a New 3DS
|
||||
|
@ -145,11 +145,11 @@ ExtraHID::ExtraHID(SendFunc send_func) : IRDevice(send_func) {
|
|||
0x65,
|
||||
}};
|
||||
|
||||
hid_polling_callback_id = Core::System::GetInstance().CoreTiming().RegisterEvent(
|
||||
"ExtraHID::SendHIDStatus", [this](u64, s64 cycles_late) {
|
||||
hid_polling_callback_id =
|
||||
timing.RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, s64 cycles_late) {
|
||||
SendHIDStatus();
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(
|
||||
msToCycles(hid_period) - cycles_late, hid_polling_callback_id);
|
||||
this->timing.ScheduleEvent(msToCycles(hid_period) - cycles_late,
|
||||
hid_polling_callback_id);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ ExtraHID::~ExtraHID() {
|
|||
void ExtraHID::OnConnect() {}
|
||||
|
||||
void ExtraHID::OnDisconnect() {
|
||||
Core::System::GetInstance().CoreTiming().UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
timing.UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
}
|
||||
|
||||
void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) {
|
||||
|
@ -171,10 +171,9 @@ void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request)
|
|||
}
|
||||
|
||||
// Change HID input polling interval
|
||||
Core::System::GetInstance().CoreTiming().UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
timing.UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
hid_period = request[1];
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(msToCycles(hid_period),
|
||||
hid_polling_callback_id);
|
||||
timing.ScheduleEvent(msToCycles(hid_period), hid_polling_callback_id);
|
||||
}
|
||||
|
||||
void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_buf) {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
namespace Core {
|
||||
struct TimingEventType;
|
||||
class Timing;
|
||||
} // namespace Core
|
||||
|
||||
namespace Service::IR {
|
||||
|
@ -40,7 +41,7 @@ static_assert(sizeof(ExtraHIDResponse) == 6, "HID status response has wrong size
|
|||
*/
|
||||
class ExtraHID final : public IRDevice {
|
||||
public:
|
||||
explicit ExtraHID(SendFunc send_func);
|
||||
explicit ExtraHID(SendFunc send_func, Core::Timing& timing);
|
||||
~ExtraHID();
|
||||
|
||||
void OnConnect() override;
|
||||
|
@ -56,6 +57,7 @@ private:
|
|||
void HandleReadCalibrationDataRequest(const std::vector<u8>& request);
|
||||
void LoadInputDevices();
|
||||
|
||||
Core::Timing& timing;
|
||||
u8 hid_period;
|
||||
Core::TimingEventType* hid_polling_callback_id;
|
||||
std::array<u8, 0x40> calibration_data;
|
||||
|
|
|
@ -418,8 +418,8 @@ IR_USER::IR_USER(Core::System& system) : ServiceFramework("ir:USER", 1) {
|
|||
send_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:SendEvent");
|
||||
receive_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:ReceiveEvent");
|
||||
|
||||
extra_hid =
|
||||
std::make_unique<ExtraHID>([this](const std::vector<u8>& data) { PutToReceive(data); });
|
||||
extra_hid = std::make_unique<ExtraHID>(
|
||||
[this](const std::vector<u8>& data) { PutToReceive(data); }, system.CoreTiming());
|
||||
}
|
||||
|
||||
IR_USER::~IR_USER() {
|
||||
|
|
|
@ -507,7 +507,7 @@ void Y2R_U::StartConversion(Kernel::HLERequestContext& ctx) {
|
|||
Memory::RasterizerFlushVirtualRegion(conversion.dst.address, total_output_size,
|
||||
Memory::FlushMode::FlushAndInvalidate);
|
||||
|
||||
HW::Y2R::PerformConversion(conversion);
|
||||
HW::Y2R::PerformConversion(system.Memory(), conversion);
|
||||
|
||||
completion_event->Signal();
|
||||
|
||||
|
@ -632,7 +632,7 @@ void Y2R_U::GetPackageParameter(Kernel::HLERequestContext& ctx) {
|
|||
LOG_DEBUG(Service_Y2R, "called");
|
||||
}
|
||||
|
||||
Y2R_U::Y2R_U(Core::System& system) : ServiceFramework("y2r:u", 1) {
|
||||
Y2R_U::Y2R_U(Core::System& system) : ServiceFramework("y2r:u", 1), system(system) {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0x00010040, &Y2R_U::SetInputFormat, "SetInputFormat"},
|
||||
{0x00020000, &Y2R_U::GetInputFormat, "GetInputFormat"},
|
||||
|
|
|
@ -294,6 +294,8 @@ private:
|
|||
void DriverFinalize(Kernel::HLERequestContext& ctx);
|
||||
void GetPackageParameter(Kernel::HLERequestContext& ctx);
|
||||
|
||||
Core::System& system;
|
||||
|
||||
Kernel::SharedPtr<Kernel::Event> completion_event;
|
||||
ConversionConfiguration conversion{};
|
||||
DitheringWeightParams dithering_weight_params{};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue