Skip to content

Commit

Permalink
service: Stub mcu::HWC (#7428)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelthegreat authored Feb 9, 2024
1 parent 3c9157b commit de993dc
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ add_library(citra_core STATIC
hle/service/ldr_ro/cro_helper.h
hle/service/ldr_ro/ldr_ro.cpp
hle/service/ldr_ro/ldr_ro.h
hle/service/mcu/mcu_hwc.cpp
hle/service/mcu/mcu_hwc.h
hle/service/mcu/mcu.cpp
hle/service/mcu/mcu.h
hle/service/mic/mic_u.cpp
hle/service/mic/mic_u.h
hle/service/mvd/mvd.cpp
Expand Down
16 changes: 16 additions & 0 deletions src/core/hle/service/mcu/mcu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2024 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#include "core/core.h"
#include "core/hle/service/mcu/mcu.h"
#include "core/hle/service/mcu/mcu_hwc.h"

namespace Service::MCU {

void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager();
std::make_shared<HWC>()->InstallAsService(service_manager);
}

} // namespace Service::MCU
15 changes: 15 additions & 0 deletions src/core/hle/service/mcu/mcu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2024 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

namespace Core {
class System;
}

namespace Service::MCU {

void InstallInterfaces(Core::System& system);

} // namespace Service::MCU
36 changes: 36 additions & 0 deletions src/core/hle/service/mcu/mcu_hwc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2024 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#include "common/archives.h"
#include "core/hle/service/mcu/mcu_hwc.h"

SERIALIZE_EXPORT_IMPL(Service::MCU::HWC)

namespace Service::MCU {

HWC::HWC() : ServiceFramework("mcu::HWC", 1) {
static const FunctionInfo functions[] = {
// clang-format off
{0x0001, nullptr, "ReadRegister"},
{0x0002, nullptr, "WriteRegister"},
{0x0003, nullptr, "GetInfoRegisters"},
{0x0004, nullptr, "GetBatteryVoltage"},
{0x0005, nullptr, "GetBatteryLevel"},
{0x0006, nullptr, "SetPowerLEDPattern"},
{0x0007, nullptr, "SetWifiLEDState"},
{0x0008, nullptr, "SetCameraLEDPattern"},
{0x0009, nullptr, "Set3DLEDState"},
{0x000A, nullptr, "SetInfoLEDPattern"},
{0x000B, nullptr, "GetSoundVolume"},
{0x000C, nullptr, "SetTopScreenFlicker"},
{0x000D, nullptr, "SetBottomScreenFlicker"},
{0x000F, nullptr, "GetRtcTime"},
{0x0010, nullptr, "GetMcuFwVerHigh"},
{0x0011, nullptr, "GetMcuFwVerLow"},
// clang-format on
};
RegisterHandlers(functions);
}

} // namespace Service::MCU
21 changes: 21 additions & 0 deletions src/core/hle/service/mcu/mcu_hwc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include "core/hle/service/service.h"

namespace Service::MCU {

class HWC final : public ServiceFramework<HWC> {
public:
explicit HWC();

private:
SERVICE_SERIALIZATION_SIMPLE
};

} // namespace Service::MCU

BOOST_CLASS_EXPORT_KEY(Service::MCU::HWC)
3 changes: 2 additions & 1 deletion src/core/hle/service/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "core/hle/service/http/http_c.h"
#include "core/hle/service/ir/ir.h"
#include "core/hle/service/ldr_ro/ldr_ro.h"
#include "core/hle/service/mcu/mcu.h"
#include "core/hle/service/mic/mic_u.h"
#include "core/hle/service/mvd/mvd.h"
#include "core/hle/service/ndm/ndm_u.h"
Expand Down Expand Up @@ -101,7 +102,7 @@ const std::array<ServiceModuleInfo, 41> service_module_map{
{"CDC", 0x00040130'00001802, nullptr},
{"GPIO", 0x00040130'00001B02, nullptr},
{"I2C", 0x00040130'00001E02, nullptr},
{"MCU", 0x00040130'00001F02, nullptr},
{"MCU", 0x00040130'00001F02, MCU::InstallInterfaces},
{"MP", 0x00040130'00002A02, nullptr},
{"PDN", 0x00040130'00002102, nullptr},
{"SPI", 0x00040130'00002302, nullptr}}};
Expand Down

0 comments on commit de993dc

Please sign in to comment.