remove GetCurrentModule() functions in HLE Services

This commit is contained in:
B3n30
2018-10-11 11:12:07 +02:00
parent 4ee914c7a8
commit 9d53136f20
14 changed files with 99 additions and 69 deletions

View File

@@ -22,8 +22,6 @@
namespace Service::CAM {
static std::weak_ptr<Module> current_cam;
// built-in resolution parameters
constexpr std::array<Resolution, 8> PRESET_RESOLUTION{{
{640, 480, 0, 0, 639, 479}, // VGA
@@ -200,6 +198,10 @@ Module::Interface::Interface(std::shared_ptr<Module> cam, const char* name, u32
Module::Interface::~Interface() = default;
std::shared_ptr<Module> Module::Interface::GetModule() const {
return cam;
}
void Module::Interface::StartCapture(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x01, 1, 0);
const PortSet port_select(rp.Pop<u8>());
@@ -1050,15 +1052,9 @@ void Module::LoadCameraImplementation(CameraConfig& camera, int camera_id) {
camera.impl->SetResolution(camera.contexts[0].resolution);
}
void ReloadCameraDevices() {
if (auto cam = current_cam.lock())
cam->ReloadCameraDevices();
}
void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager();
auto cam = std::make_shared<Module>();
current_cam = cam;
std::make_shared<CAM_U>(cam)->InstallAsService(service_manager);
std::make_shared<CAM_S>(cam)->InstallAsService(service_manager);

View File

@@ -250,6 +250,8 @@ public:
Interface(std::shared_ptr<Module> cam, const char* name, u32 max_session);
~Interface();
std::shared_ptr<Module> GetModule() const;
protected:
/**
* Starts capturing at the selected port.
@@ -783,9 +785,6 @@ private:
std::atomic<bool> is_camera_reload_pending{false};
};
/// Reload camera devices. Used when input configuration changed
void ReloadCameraDevices();
void InstallInterfaces(Core::System& system);
} // namespace Service::CAM