From 8cd9522526de290865094c7ff102db8e2872b471 Mon Sep 17 00:00:00 2001 From: wwylele Date: Wed, 24 May 2017 12:50:19 +0300 Subject: cam: move u32->u8 trancation to IPCHelper --- src/core/hle/service/cam/cam.cpp | 67 ++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index 957013d5b..342a0edeb 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp @@ -225,8 +225,7 @@ static void ActivatePort(int port_id, int camera_id) { template class CommandParamBitSet : public BitSet8 { public: - explicit CommandParamBitSet(u32 command_param) - : BitSet8(static_cast(command_param & 0xFF)) {} + explicit CommandParamBitSet(u8 command_param) : BitSet8(command_param) {} bool IsValid() const { return m_val < (1 << max_index); @@ -245,7 +244,7 @@ using CameraSet = CommandParamBitSet<3>; void StartCapture(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x01, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); @@ -279,7 +278,7 @@ void StartCapture(Service::Interface* self) { void StopCapture(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x02, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); @@ -304,7 +303,7 @@ void StopCapture(Service::Interface* self) { void IsBusy(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x03, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); @@ -327,7 +326,7 @@ void IsBusy(Service::Interface* self) { void ClearBuffer(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x04, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); @@ -337,7 +336,7 @@ void ClearBuffer(Service::Interface* self) { void GetVsyncInterruptEvent(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x05, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); if (port_select.IsSingle()) { @@ -356,7 +355,7 @@ void GetVsyncInterruptEvent(Service::Interface* self) { void GetBufferErrorInterruptEvent(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x06, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); if (port_select.IsSingle()) { @@ -376,7 +375,7 @@ void GetBufferErrorInterruptEvent(Service::Interface* self) { void SetReceiving(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x07, 4, 2); const VAddr dest = rp.Pop(); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); const u32 image_size = rp.Pop(); const u16 trans_unit = rp.Pop(); rp.PopHandle(); // Handle to destination process. not used @@ -409,7 +408,7 @@ void SetReceiving(Service::Interface* self) { void IsFinishedReceiving(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x08, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); if (port_select.IsSingle()) { @@ -427,7 +426,7 @@ void IsFinishedReceiving(Service::Interface* self) { void SetTransferLines(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x09, 4, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); const u16 transfer_lines = rp.Pop(); const u16 width = rp.Pop(); const u16 height = rp.Pop(); @@ -482,7 +481,7 @@ void GetMaxLines(Service::Interface* self) { void SetTransferBytes(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x0B, 4, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); const u16 transfer_bytes = rp.Pop(); const u16 width = rp.Pop(); const u16 height = rp.Pop(); @@ -504,7 +503,7 @@ void SetTransferBytes(Service::Interface* self) { void GetTransferBytes(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x0C, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); if (port_select.IsSingle()) { @@ -549,7 +548,7 @@ void GetMaxBytes(Service::Interface* self) { void SetTrimming(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x0E, 2, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); const bool trim = rp.Pop(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); @@ -568,7 +567,7 @@ void SetTrimming(Service::Interface* self) { void IsTrimming(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x0F, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); if (port_select.IsSingle()) { @@ -586,7 +585,7 @@ void IsTrimming(Service::Interface* self) { void SetTrimmingParams(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x10, 5, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); const u16 x0 = rp.Pop(); const u16 y0 = rp.Pop(); const u16 x1 = rp.Pop(); @@ -612,7 +611,7 @@ void SetTrimmingParams(Service::Interface* self) { void GetTrimmingParams(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x11, 1, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); if (port_select.IsSingle()) { @@ -633,7 +632,7 @@ void GetTrimmingParams(Service::Interface* self) { void SetTrimmingParamsCenter(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x12, 5, 0); - const PortSet port_select(rp.Pop()); + const PortSet port_select(rp.Pop()); const u16 trim_w = rp.Pop(); const u16 trim_h = rp.Pop(); const u16 cam_w = rp.Pop(); @@ -659,7 +658,7 @@ void SetTrimmingParamsCenter(Service::Interface* self) { void Activate(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x13, 1, 0); - const CameraSet camera_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid()) { @@ -698,8 +697,8 @@ void Activate(Service::Interface* self) { void SwitchContext(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x14, 2, 0); - const CameraSet camera_select(rp.Pop()); - const ContextSet context_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); + const ContextSet context_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid() && context_select.IsSingle()) { @@ -725,9 +724,9 @@ void SwitchContext(Service::Interface* self) { void FlipImage(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1D, 3, 0); - const CameraSet camera_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); const Flip flip = static_cast(rp.Pop()); - const ContextSet context_select(rp.Pop()); + const ContextSet context_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid() && context_select.IsValid()) { @@ -752,7 +751,7 @@ void FlipImage(Service::Interface* self) { void SetDetailSize(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1E, 8, 0); - const CameraSet camera_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); Resolution resolution; resolution.width = rp.Pop(); resolution.height = rp.Pop(); @@ -760,7 +759,7 @@ void SetDetailSize(Service::Interface* self) { resolution.crop_y0 = rp.Pop(); resolution.crop_x1 = rp.Pop(); resolution.crop_y1 = rp.Pop(); - const ContextSet context_select(rp.Pop()); + const ContextSet context_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid() && context_select.IsValid()) { @@ -787,9 +786,9 @@ void SetDetailSize(Service::Interface* self) { void SetSize(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1F, 3, 0); - const CameraSet camera_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); const u8 size = rp.Pop(); - const ContextSet context_select(rp.Pop()); + const ContextSet context_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid() && context_select.IsValid()) { @@ -814,7 +813,7 @@ void SetSize(Service::Interface* self) { void SetFrameRate(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x20, 2, 0); - const CameraSet camera_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); const FrameRate frame_rate = static_cast(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); @@ -835,9 +834,9 @@ void SetFrameRate(Service::Interface* self) { void SetEffect(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x22, 3, 0); - const CameraSet camera_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); const Effect effect = static_cast(rp.Pop()); - const ContextSet context_select(rp.Pop()); + const ContextSet context_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid() && context_select.IsValid()) { @@ -862,9 +861,9 @@ void SetEffect(Service::Interface* self) { void SetOutputFormat(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x25, 3, 0); - const CameraSet camera_select(rp.Pop()); + const CameraSet camera_select(rp.Pop()); const OutputFormat format = static_cast(rp.Pop()); - const ContextSet context_select(rp.Pop()); + const ContextSet context_select(rp.Pop()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid() && context_select.IsValid()) { @@ -947,8 +946,8 @@ static void SetPackageParameter() { rp.PopRaw(package); rp.Skip(param_length - (sizeof(PackageParameterType) + 3) / 4, false); - const CameraSet camera_select(static_cast(package.camera_select)); - const ContextSet context_select(static_cast(package.context_select)); + const CameraSet camera_select(package.camera_select); + const ContextSet context_select(package.context_select); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); if (camera_select.IsValid() && context_select.IsValid()) { -- cgit v1.2.3