ResultVal<bool> Interface::SyncRequest() {
    u32* cmd_buff = Kernel::GetCommandBuffer();
    auto itr = m_functions.find(cmd_buff[0]);

    if (itr == m_functions.end() || itr->second.func == nullptr) {
        std::string function_name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name;
        LOG_ERROR(Service, "unknown / unimplemented %s", MakeFunctionString(function_name.c_str(), GetPortName().c_str(), cmd_buff).c_str());

        // TODO(bunnei): Hack - ignore error
        cmd_buff[1] = 0;
        return MakeResult<bool>(false);
    } else {
        LOG_TRACE(Service, "%s", MakeFunctionString(itr->second.name, GetPortName().c_str(), cmd_buff).c_str());
    }

    itr->second.func(this);

    return MakeResult<bool>(false); // TODO: Implement return from actual function
}
Esempio n. 2
0
void ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& context) {
    u32 header_code = context.CommandBuffer()[0];
    auto itr = handlers.find(header_code);
    const FunctionInfoBase* info = itr == handlers.end() ? nullptr : &itr->second;
    if (info == nullptr || info->handler_callback == nullptr) {
        return ReportUnimplementedFunction(context.CommandBuffer(), info);
    }

    LOG_TRACE(Service, "{}",
              MakeFunctionString(info->name, GetServiceName(), context.CommandBuffer()));
    handler_invoker(this, info->handler_callback, context);
}