From 49d65ad14a418c0409fbb4f87484ddc3b8e17b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Fri, 1 Jan 2021 15:24:53 +0100 Subject: [PATCH] Minor Style Fixes --- gui/src/avopenglwidget.cpp | 3 +- gui/src/controllermanager.cpp | 1 - gui/src/main.cpp | 2 +- gui/src/mainwindow.cpp | 4 +- gui/src/settings.cpp | 12 +- gui/src/settingsdialog.cpp | 12 +- gui/src/settingskeycapturedialog.cpp | 4 +- lib/src/audioreceiver.c | 8 +- lib/src/base64.c | 57 ++++--- lib/src/common.c | 6 +- lib/src/congestioncontrol.c | 2 +- lib/src/controller.c | 14 +- lib/src/ctrl.c | 7 +- lib/src/ecdh.c | 16 +- lib/src/frameprocessor.c | 4 +- lib/src/gkcrypt.c | 43 ++--- lib/src/http.c | 1 - lib/src/packetstats.c | 1 - lib/src/random.c | 6 +- lib/src/regist.c | 1 - lib/src/rpcrypt.c | 4 +- lib/src/senkusha.c | 2 - lib/src/session.c | 7 +- lib/src/stoppipe.c | 3 +- lib/src/streamconnection.c | 10 +- lib/src/takion.c | 26 +-- lib/src/thread.c | 20 +-- switch/src/discoverymanager.cpp | 18 +-- switch/src/gui.cpp | 16 +- switch/src/io.cpp | 4 +- switch/src/main.cpp | 6 +- switch/src/settings.cpp | 232 +++++++++++++-------------- 32 files changed, 248 insertions(+), 304 deletions(-) diff --git a/gui/src/avopenglwidget.cpp b/gui/src/avopenglwidget.cpp index 3d1d8eb..857af09 100644 --- a/gui/src/avopenglwidget.cpp +++ b/gui/src/avopenglwidget.cpp @@ -109,7 +109,6 @@ static const float vert_pos[] = { 1.0f, 1.0f }; - QSurfaceFormat AVOpenGLWidget::CreateSurfaceFormat() { QSurfaceFormat format; @@ -129,7 +128,7 @@ AVOpenGLWidget::AVOpenGLWidget(StreamSession *session, QWidget *parent) { enum AVPixelFormat pixel_format = chiaki_ffmpeg_decoder_get_pixel_format(session->GetFfmpegDecoder()); conversion_config = nullptr; - for(auto &cc: conversion_configs) + for(auto &cc : conversion_configs) { if(pixel_format == cc.pixel_format) { diff --git a/gui/src/controllermanager.cpp b/gui/src/controllermanager.cpp index 16804af..a78fd44 100644 --- a/gui/src/controllermanager.cpp +++ b/gui/src/controllermanager.cpp @@ -68,7 +68,6 @@ static QSet chiaki_motion_controller_guids({ "030000008f0e00001431000000000000", }); - static ControllerManager *instance = nullptr; #define UPDATE_INTERVAL_MS 4 diff --git a/gui/src/main.cpp b/gui/src/main.cpp index b6731c8..010e744 100644 --- a/gui/src/main.cpp +++ b/gui/src/main.cpp @@ -111,7 +111,7 @@ int real_main(int argc, char *argv[]) if(args[0] == "list") { for(const auto &host : settings.GetRegisteredHosts()) - printf("Host: %s \n", host.GetServerNickname().toLocal8Bit().constData()); + printf("Host: %s \n", host.GetServerNickname().toLocal8Bit().constData()); return 0; } if(args[0] == "stream") diff --git a/gui/src/mainwindow.cpp b/gui/src/mainwindow.cpp index 296626d..aa76ab3 100644 --- a/gui/src/mainwindow.cpp +++ b/gui/src/mainwindow.cpp @@ -167,7 +167,7 @@ MainWindow::MainWindow(Settings *settings, QWidget *parent) grid_widget->setContentsMargins(0, 0, 0, 0); resize(800, 600); - + connect(&discovery_manager, &DiscoveryManager::HostsUpdated, this, &MainWindow::UpdateDisplayServers); connect(settings, &Settings::RegisteredHostsUpdated, this, &MainWindow::UpdateDisplayServers); connect(settings, &Settings::ManualHostsUpdated, this, &MainWindow::UpdateDisplayServers); @@ -330,7 +330,7 @@ void MainWindow::UpdateDisplayServers() display_servers.append(server); } - + UpdateServerWidgets(); } diff --git a/gui/src/settings.cpp b/gui/src/settings.cpp index 17f7d83..6d296d1 100644 --- a/gui/src/settings.cpp +++ b/gui/src/settings.cpp @@ -88,10 +88,10 @@ uint32_t Settings::GetLogLevelMask() } static const QMap resolutions = { - { CHIAKI_VIDEO_RESOLUTION_PRESET_360p, "360p"}, - { CHIAKI_VIDEO_RESOLUTION_PRESET_540p, "540p"}, - { CHIAKI_VIDEO_RESOLUTION_PRESET_720p, "720p"}, - { CHIAKI_VIDEO_RESOLUTION_PRESET_1080p, "1080p"} + { CHIAKI_VIDEO_RESOLUTION_PRESET_360p, "360p" }, + { CHIAKI_VIDEO_RESOLUTION_PRESET_540p, "540p" }, + { CHIAKI_VIDEO_RESOLUTION_PRESET_720p, "720p" }, + { CHIAKI_VIDEO_RESOLUTION_PRESET_1080p, "1080p" } }; static const ChiakiVideoResolutionPreset resolution_default = CHIAKI_VIDEO_RESOLUTION_PRESET_720p; @@ -136,8 +136,8 @@ void Settings::SetBitrate(unsigned int bitrate) } static const QMap codecs = { - { CHIAKI_CODEC_H264, "h264"}, - { CHIAKI_CODEC_H265, "h265"} + { CHIAKI_CODEC_H264, "h264" }, + { CHIAKI_CODEC_H265, "h265" } }; static const ChiakiCodec codec_default = CHIAKI_CODEC_H265; diff --git a/gui/src/settingsdialog.cpp b/gui/src/settingsdialog.cpp index b8bd412..3f8856f 100644 --- a/gui/src/settingsdialog.cpp +++ b/gui/src/settingsdialog.cpp @@ -89,7 +89,7 @@ SettingsDialog::SettingsDialog(Settings *settings, QWidget *parent) : QDialog(pa connect(disconnect_action_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(DisconnectActionSelected())); general_layout->addRow(tr("Action on Disconnect:"), disconnect_action_combo_box); - + audio_device_combo_box = new QComboBox(this); audio_device_combo_box->addItem(tr("Auto")); auto current_audio_device = settings->GetAudioOutDevice(); @@ -112,7 +112,7 @@ SettingsDialog::SettingsDialog(Settings *settings, QWidget *parent) : QDialog(pa auto available_devices = audio_devices_future_watcher->result(); while(audio_device_combo_box->count() > 1) // remove all but "Auto" audio_device_combo_box->removeItem(1); - for (QAudioDeviceInfo di : available_devices) + for(QAudioDeviceInfo di : available_devices) audio_device_combo_box->addItem(di.deviceName(), di.deviceName()); int audio_out_device_index = audio_device_combo_box->findData(settings->GetAudioOutDevice()); audio_device_combo_box->setCurrentIndex(audio_out_device_index < 0 ? 0 : audio_out_device_index); @@ -136,10 +136,10 @@ SettingsDialog::SettingsDialog(Settings *settings, QWidget *parent) : QDialog(pa resolution_combo_box = new QComboBox(this); static const QList> resolution_strings = { - { CHIAKI_VIDEO_RESOLUTION_PRESET_360p, "360p"}, - { CHIAKI_VIDEO_RESOLUTION_PRESET_540p, "540p"}, - { CHIAKI_VIDEO_RESOLUTION_PRESET_720p, "720p"}, - { CHIAKI_VIDEO_RESOLUTION_PRESET_1080p, "1080p (PS5 and PS4 Pro only)"} + { CHIAKI_VIDEO_RESOLUTION_PRESET_360p, "360p" }, + { CHIAKI_VIDEO_RESOLUTION_PRESET_540p, "540p" }, + { CHIAKI_VIDEO_RESOLUTION_PRESET_720p, "720p" }, + { CHIAKI_VIDEO_RESOLUTION_PRESET_1080p, "1080p (PS5 and PS4 Pro only)" } }; auto current_res = settings->GetResolution(); for(const auto &p : resolution_strings) diff --git a/gui/src/settingskeycapturedialog.cpp b/gui/src/settingskeycapturedialog.cpp index 3339813..a631444 100644 --- a/gui/src/settingskeycapturedialog.cpp +++ b/gui/src/settingskeycapturedialog.cpp @@ -7,7 +7,7 @@ #include #include -SettingsKeyCaptureDialog::SettingsKeyCaptureDialog(QWidget* parent) +SettingsKeyCaptureDialog::SettingsKeyCaptureDialog(QWidget *parent) { setWindowTitle(tr("Key Capture")); @@ -23,7 +23,7 @@ SettingsKeyCaptureDialog::SettingsKeyCaptureDialog(QWidget* parent) connect(button, &QPushButton::clicked, this, &QDialog::accept); } -void SettingsKeyCaptureDialog::keyReleaseEvent(QKeyEvent* event) +void SettingsKeyCaptureDialog::keyReleaseEvent(QKeyEvent *event) { KeyCaptured(Qt::Key(event->key())); accept(); diff --git a/lib/src/audioreceiver.c b/lib/src/audioreceiver.c index 5808e4c..9fec69d 100644 --- a/lib/src/audioreceiver.c +++ b/lib/src/audioreceiver.c @@ -23,7 +23,6 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_audio_receiver_init(ChiakiAudioReceiver *au return CHIAKI_ERR_SUCCESS; } - CHIAKI_EXPORT void chiaki_audio_receiver_fini(ChiakiAudioReceiver *audio_receiver) { #ifdef CHIAKI_LIB_ENABLE_OPUS @@ -32,7 +31,6 @@ CHIAKI_EXPORT void chiaki_audio_receiver_fini(ChiakiAudioReceiver *audio_receive chiaki_mutex_fini(&audio_receiver->mutex); } - CHIAKI_EXPORT void chiaki_audio_receiver_stream_info(ChiakiAudioReceiver *audio_receiver, ChiakiAudioHeader *audio_header) { chiaki_mutex_lock(&audio_receiver->mutex); @@ -79,15 +77,15 @@ CHIAKI_EXPORT void chiaki_audio_receiver_av_packet(ChiakiAudioReceiver *audio_re if(packet->data_size != (size_t)unit_size * (size_t)packet->units_in_frame_total) { CHIAKI_LOGE(audio_receiver->log, "Audio AV Packet size mismatch %#llx vs %#llx", - (unsigned long long)packet->data_size, - (unsigned long long)(unit_size * packet->units_in_frame_total)); + (unsigned long long)packet->data_size, + (unsigned long long)(unit_size * packet->units_in_frame_total)); return; } if(packet->frame_index > (1 << 15)) audio_receiver->frame_index_startup = false; - for(size_t i=0; i> 18) & 63; @@ -46,7 +45,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_encode(const uint8_t *in, size_t in_ // if we have only two bytes available, then their encoding is // spread out over three chars - if((x+1) < in_size) + if((x + 1) < in_size) { if(result_index >= out_size) return CHIAKI_ERR_BUF_TOO_SMALL; @@ -55,7 +54,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_encode(const uint8_t *in, size_t in_ // if we have all three bytes available, then their encoding is spread // out over four characters - if((x+2) < in_size) + if((x + 2) < in_size) { if(result_index >= out_size) return CHIAKI_ERR_BUF_TOO_SMALL; @@ -65,9 +64,9 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_encode(const uint8_t *in, size_t in_ // create and add padding that is required if we did not have a multiple of 3 // number of characters available - if (pad_count > 0) + if(pad_count > 0) { - for (; pad_count < 3; pad_count++) + for(; pad_count < 3; pad_count++) { if(result_index >= out_size) return CHIAKI_ERR_BUF_TOO_SMALL; @@ -80,25 +79,22 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_encode(const uint8_t *in, size_t in_ return CHIAKI_ERR_SUCCESS; } - - - #define WHITESPACE 64 -#define EQUALS 65 -#define INVALID 66 +#define EQUALS 65 +#define INVALID 66 static const unsigned char d[] = { - 66,66,66,66,66,66,66,66,66,66,64,66,66,66,66,66,66,66,66,66,66,66,66,66,66, - 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,62,66,66,66,63,52,53, - 54,55,56,57,58,59,60,61,66,66,66,65,66,66,66, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,66,66,66,66,66,66,26,27,28, - 29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,66,66, - 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, - 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, - 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, - 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, - 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, - 66,66,66,66,66,66 + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 64, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 62, 66, 66, 66, 63, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 66, 66, 66, 65, 66, 66, 66, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 66, 66, 66, 66, 66, 66, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66 }; CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_decode(const char *in, size_t in_size, uint8_t *out, size_t *out_size) @@ -108,17 +104,17 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_decode(const char *in, size_t in_siz uint32_t buf = 0; size_t len = 0; - while (in < end) + while(in < end) { unsigned char c = d[(size_t)(*in++)]; switch(c) { case WHITESPACE: - continue; // skip whitespace + continue; // skip whitespace case INVALID: - return CHIAKI_ERR_INVALID_DATA; // invalid input - case EQUALS: // pad character, end of data + return CHIAKI_ERR_INVALID_DATA; // invalid input + case EQUALS: // pad character, end of data in = end; continue; default: @@ -132,7 +128,8 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_decode(const char *in, size_t in_siz *(out++) = (unsigned char)((buf >> 16) & 0xff); *(out++) = (unsigned char)((buf >> 8) & 0xff); *(out++) = (unsigned char)(buf & 0xff); - buf = 0; iter = 0; + buf = 0; + iter = 0; } } } diff --git a/lib/src/common.c b/lib/src/common.c index 0dd2006..adb0fc6 100644 --- a/lib/src/common.c +++ b/lib/src/common.c @@ -1,14 +1,14 @@ // SPDX-License-Identifier: LicenseRef-AGPL-3.0-only-OpenSSL #include -#include #include +#include #include +#include #include #include -#include #ifdef _WIN32 #include @@ -98,7 +98,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_lib_init() WORD wsa_version = MAKEWORD(2, 2); WSADATA wsa_data; int err = WSAStartup(wsa_version, &wsa_data); - if (err != 0) + if(err != 0) return CHIAKI_ERR_NETWORK; } #endif diff --git a/lib/src/congestioncontrol.c b/lib/src/congestioncontrol.c index e478410..8fb912b 100644 --- a/lib/src/congestioncontrol.c +++ b/lib/src/congestioncontrol.c @@ -25,7 +25,7 @@ static void *congestion_control_thread_func(void *user) packet.received = (uint16_t)received; packet.lost = (uint16_t)lost; CHIAKI_LOGV(control->takion->log, "Sending Congestion Control Packet, received: %u, lost: %u", - (unsigned int)packet.received, (unsigned int)packet.lost); + (unsigned int)packet.received, (unsigned int)packet.lost); chiaki_takion_send_congestion(control->takion, &packet); } diff --git a/lib/src/controller.c b/lib/src/controller.c index b347bb7..0e3a522 100644 --- a/lib/src/controller.c +++ b/lib/src/controller.c @@ -14,7 +14,7 @@ CHIAKI_EXPORT void chiaki_controller_state_set_idle(ChiakiControllerState *state state->right_x = 0; state->right_y = 0; state->touch_id_next = 0; - for(size_t i=0; itouches[i].id = -1; state->touches[i].x = 0; @@ -24,7 +24,7 @@ CHIAKI_EXPORT void chiaki_controller_state_set_idle(ChiakiControllerState *state CHIAKI_EXPORT int8_t chiaki_controller_state_start_touch(ChiakiControllerState *state, uint16_t x, uint16_t y) { - for(size_t i=0; itouches[i].id < 0) { @@ -40,7 +40,7 @@ CHIAKI_EXPORT int8_t chiaki_controller_state_start_touch(ChiakiControllerState * CHIAKI_EXPORT void chiaki_controller_state_stop_touch(ChiakiControllerState *state, uint8_t id) { - for(size_t i=0; itouches[i].id == id) { @@ -53,7 +53,7 @@ CHIAKI_EXPORT void chiaki_controller_state_stop_touch(ChiakiControllerState *sta CHIAKI_EXPORT void chiaki_controller_state_set_touch_pos(ChiakiControllerState *state, uint8_t id, uint16_t x, uint16_t y) { id &= TOUCH_ID_MASK; - for(size_t i=0; itouches[i].id == id) { @@ -64,8 +64,8 @@ CHIAKI_EXPORT void chiaki_controller_state_set_touch_pos(ChiakiControllerState * } } -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define ABS(a) ((a) > 0 ? (a) : -(a)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define ABS(a) ((a) > 0 ? (a) : -(a)) #define MAX_ABS(a, b) (ABS(a) > ABS(b) ? (a) : (b)) CHIAKI_EXPORT void chiaki_controller_state_or(ChiakiControllerState *out, ChiakiControllerState *a, ChiakiControllerState *b) @@ -79,7 +79,7 @@ CHIAKI_EXPORT void chiaki_controller_state_or(ChiakiControllerState *out, Chiaki out->right_y = MAX_ABS(a->right_y, b->right_y); out->touch_id_next = 0; - for(size_t i=0; itouches[i].id >= 0 ? &a->touches[i] : (b->touches[i].id >= 0 ? &b->touches[i] : NULL); if(!touch) diff --git a/lib/src/ctrl.c b/lib/src/ctrl.c index f92d12b..9dfc277 100644 --- a/lib/src/ctrl.c +++ b/lib/src/ctrl.c @@ -501,7 +501,6 @@ static void ctrl_enable_optional_features(ChiakiCtrl *ctrl) ctrl_message_send(ctrl, 0x36, pre_enable, 4); } - static void ctrl_message_received_session_id(ChiakiCtrl *ctrl, uint8_t *payload, size_t payload_size) { if(ctrl->session->ctrl_session_id_received) @@ -652,7 +651,7 @@ static void ctrl_message_received_keyboard_close(ChiakiCtrl *ctrl, uint8_t *payl chiaki_session_send_event(ctrl->session, &keyboard_event); } -static void ctrl_message_received_keyboard_text_change(ChiakiCtrl* ctrl, uint8_t* payload, size_t payload_size) +static void ctrl_message_received_keyboard_text_change(ChiakiCtrl *ctrl, uint8_t *payload, size_t payload_size) { assert(payload_size >= sizeof(CtrlKeyboardTextResponseMessage)); @@ -676,7 +675,8 @@ static void ctrl_message_received_keyboard_text_change(ChiakiCtrl* ctrl, uint8_t free(buffer); } -typedef struct ctrl_response_t { +typedef struct ctrl_response_t +{ bool server_type_valid; uint8_t rp_server_type[0x10]; bool success; @@ -742,7 +742,6 @@ static ChiakiErrorCode ctrl_connect(ChiakiCtrl *ctrl) if(err != CHIAKI_ERR_SUCCESS) CHIAKI_LOGE(session->log, "Failed to set ctrl socket to non-blocking: %s", chiaki_error_string(err)); - chiaki_mutex_unlock(&ctrl->notif_mutex); err = chiaki_stop_pipe_connect(&ctrl->notif_pipe, sock, sa, addr->ai_addrlen); chiaki_mutex_lock(&ctrl->notif_mutex); diff --git a/lib/src/ecdh.c b/lib/src/ecdh.c index 1a48b54..3277b60 100644 --- a/lib/src/ecdh.c +++ b/lib/src/ecdh.c @@ -79,7 +79,6 @@ CHIAKI_EXPORT void chiaki_ecdh_fini(ChiakiECDH *ecdh) #endif } - CHIAKI_EXPORT ChiakiErrorCode chiaki_ecdh_set_local_key(ChiakiECDH *ecdh, const uint8_t *private_key, size_t private_key_size, const uint8_t *public_key, size_t public_key_size) { #ifdef CHIAKI_LIB_ENABLE_MBEDTLS @@ -89,24 +88,19 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_ecdh_set_local_key(ChiakiECDH *ecdh, const // public int r = 0; - r = mbedtls_ecp_point_read_binary(&ecdh->ctx.grp, &ecdh->ctx.Q, - public_key, public_key_size); - if(r != 0 ){ + r = mbedtls_ecp_point_read_binary(&ecdh->ctx.grp, &ecdh->ctx.Q, public_key, public_key_size); + if(r != 0) return CHIAKI_ERR_UNKNOWN; - } // secret r = mbedtls_mpi_read_binary(&ecdh->ctx.d, private_key, private_key_size); - if(r != 0 ){ + if(r != 0) return CHIAKI_ERR_UNKNOWN; - } // regen key - r = mbedtls_ecdh_gen_public(&ecdh->ctx.grp, &ecdh->ctx.d, - &ecdh->ctx.Q, mbedtls_ctr_drbg_random, &ecdh->drbg); - if(r != 0 ){ + r = mbedtls_ecdh_gen_public(&ecdh->ctx.grp, &ecdh->ctx.d, &ecdh->ctx.Q, mbedtls_ctr_drbg_random, &ecdh->drbg); + if(r != 0) return CHIAKI_ERR_UNKNOWN; - } return CHIAKI_ERR_SUCCESS; #else diff --git a/lib/src/frameprocessor.c b/lib/src/frameprocessor.c index 058f6ac..c072a98 100644 --- a/lib/src/frameprocessor.c +++ b/lib/src/frameprocessor.c @@ -150,7 +150,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_frame_processor_put_unit(ChiakiFrameProcess CHIAKI_LOGE(frame_processor->log, "Packet's unit index is too high"); return CHIAKI_ERR_INVALID_DATA; } - + if(!packet->data_size) { CHIAKI_LOGW(frame_processor->log, "Unit is empty"); @@ -162,7 +162,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_frame_processor_put_unit(ChiakiFrameProcess CHIAKI_LOGW(frame_processor->log, "Unit is bigger than pre-calculated size!"); return CHIAKI_ERR_INVALID_DATA; } - + ChiakiFrameUnit *unit = frame_processor->unit_slots + packet->unit_index; if(unit->data_size) { diff --git a/lib/src/gkcrypt.c b/lib/src/gkcrypt.c index c99c5c2..e8dcb12 100644 --- a/lib/src/gkcrypt.c +++ b/lib/src/gkcrypt.c @@ -19,10 +19,8 @@ #include "utils.h" - #define KEY_BUF_CHUNK_SIZE 0x1000 - static ChiakiErrorCode gkcrypt_gen_key_iv(ChiakiGKCrypt *gkcrypt, uint8_t index, const uint8_t *handshake_key, const uint8_t *ecdh_secret); static void *gkcrypt_thread_func(void *user); @@ -110,7 +108,6 @@ CHIAKI_EXPORT void chiaki_gkcrypt_fini(ChiakiGKCrypt *gkcrypt) } } - static ChiakiErrorCode gkcrypt_gen_key_iv(ChiakiGKCrypt *gkcrypt, uint8_t index, const uint8_t *handshake_key, const uint8_t *ecdh_secret) { uint8_t data[3 + CHIAKI_HANDSHAKE_KEY_SIZE + 2]; @@ -123,37 +120,41 @@ static ChiakiErrorCode gkcrypt_gen_key_iv(ChiakiGKCrypt *gkcrypt, uint8_t index, uint8_t hmac[CHIAKI_GKCRYPT_BLOCK_SIZE*2]; size_t hmac_size = sizeof(hmac); - #ifdef CHIAKI_LIB_ENABLE_MBEDTLS +#ifdef CHIAKI_LIB_ENABLE_MBEDTLS mbedtls_md_context_t ctx; mbedtls_md_init(&ctx); - if(mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(MBEDTLS_MD_SHA256) , 1) != 0){ + if(mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), 1) != 0) + { mbedtls_md_free(&ctx); return CHIAKI_ERR_UNKNOWN; } - if(mbedtls_md_hmac_starts(&ctx, ecdh_secret, CHIAKI_ECDH_SECRET_SIZE) != 0){ + if(mbedtls_md_hmac_starts(&ctx, ecdh_secret, CHIAKI_ECDH_SECRET_SIZE) != 0) + { mbedtls_md_free(&ctx); return CHIAKI_ERR_UNKNOWN; } - if(mbedtls_md_hmac_update(&ctx, data, sizeof(data)) != 0){ + if(mbedtls_md_hmac_update(&ctx, data, sizeof(data)) != 0) + { mbedtls_md_free(&ctx); return CHIAKI_ERR_UNKNOWN; } - if(mbedtls_md_hmac_finish(&ctx, hmac) != 0){ + if(mbedtls_md_hmac_finish(&ctx, hmac) != 0) + { mbedtls_md_free(&ctx); return CHIAKI_ERR_UNKNOWN; } mbedtls_md_free(&ctx); - #else +#else if(!HMAC(EVP_sha256(), ecdh_secret, CHIAKI_ECDH_SECRET_SIZE, data, sizeof(data), hmac, (unsigned int *)&hmac_size)) return CHIAKI_ERR_UNKNOWN; - #endif +#endif assert(hmac_size == sizeof(hmac)); memcpy(gkcrypt->key_base, hmac, CHIAKI_GKCRYPT_BLOCK_SIZE); @@ -220,7 +221,8 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_gkcrypt_gen_key_stream(ChiakiGKCrypt *gkcry mbedtls_aes_context ctx; mbedtls_aes_init(&ctx); - if(mbedtls_aes_setkey_enc(&ctx, gkcrypt->key_base, 128) != 0){ + if(mbedtls_aes_setkey_enc(&ctx, gkcrypt->key_base, 128) != 0) + { mbedtls_aes_free(&ctx); return CHIAKI_ERR_UNKNOWN; } @@ -248,9 +250,11 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_gkcrypt_gen_key_stream(ChiakiGKCrypt *gkcry counter_add(cur, gkcrypt->iv, counter_offset++); #ifdef CHIAKI_LIB_ENABLE_MBEDTLS - for(int i=0; i #endif - CHIAKI_EXPORT void chiaki_http_header_free(ChiakiHttpHeader *header) { while(header) diff --git a/lib/src/packetstats.c b/lib/src/packetstats.c index c04adc8..c7da9d6 100644 --- a/lib/src/packetstats.c +++ b/lib/src/packetstats.c @@ -74,4 +74,3 @@ CHIAKI_EXPORT void chiaki_packet_stats_get(ChiakiPacketStats *stats, bool reset, reset_stats(stats); chiaki_mutex_unlock(&stats->mutex); } - diff --git a/lib/src/random.c b/lib/src/random.c index 974db60..158ce4d 100644 --- a/lib/src/random.c +++ b/lib/src/random.c @@ -28,10 +28,12 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_random_bytes_crypt(uint8_t *buf, size_t buf mbedtls_entropy_init(&entropy); mbedtls_ctr_drbg_set_prediction_resistance(&ctr_drbg, MBEDTLS_CTR_DRBG_PR_OFF); - if(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, (const unsigned char *) "RANDOM_GEN", 10 ) != 0 ){ + if(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, (const unsigned char *)"RANDOM_GEN", 10) != 0) + { return CHIAKI_ERR_UNKNOWN; } - if(mbedtls_ctr_drbg_random(&ctr_drbg, buf, buf_size) != 0){ + if(mbedtls_ctr_drbg_random(&ctr_drbg, buf, buf_size) != 0) + { return CHIAKI_ERR_UNKNOWN; } diff --git a/lib/src/regist.c b/lib/src/regist.c index 47c6ab1..af17942 100644 --- a/lib/src/regist.c +++ b/lib/src/regist.c @@ -160,7 +160,6 @@ static int request_header_format(char *buf, size_t buf_size, size_t payload_size return cur; } - CHIAKI_EXPORT ChiakiErrorCode chiaki_regist_request_payload_format(ChiakiTarget target, const uint8_t *ambassador, uint8_t *buf, size_t *buf_size, ChiakiRPCrypt *crypt, const char *psn_online_id, const uint8_t *psn_account_id, uint32_t pin) { size_t buf_size_val = *buf_size; diff --git a/lib/src/rpcrypt.c b/lib/src/rpcrypt.c index 197580e..30225c0 100644 --- a/lib/src/rpcrypt.c +++ b/lib/src/rpcrypt.c @@ -1488,7 +1488,7 @@ static ChiakiErrorCode bright_ambassador(ChiakiTarget target, uint8_t *bright, u 0x20, 0x98, 0xfd, 0x34, 0xca, 0x7a, 0x66, 0x20, 0x58, 0xd2, 0x36, 0x7f, 0x2b, 0xa7, 0xd1, 0xde, 0x6f, 0x36, 0xb4, 0xf2, 0x3b, 0x20, 0x5d, 0x02 - }; + }; if(target < CHIAKI_TARGET_PS4_10) return CHIAKI_ERR_INVALID_DATA; @@ -1865,7 +1865,6 @@ static const uint8_t *rpcrypt_hmac_key(ChiakiRPCrypt *rpcrypt) } } - #ifdef CHIAKI_LIB_ENABLE_MBEDTLS CHIAKI_EXPORT ChiakiErrorCode chiaki_rpcrypt_generate_iv(ChiakiRPCrypt *rpcrypt, uint8_t *iv, uint64_t counter) { @@ -1968,7 +1967,6 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_rpcrypt_generate_iv(ChiakiRPCrypt *rpcrypt, buf[CHIAKI_RPCRYPT_KEY_SIZE + 6] = (uint8_t)((counter >> 0x08) & 0xff); buf[CHIAKI_RPCRYPT_KEY_SIZE + 7] = (uint8_t)((counter >> 0x00) & 0xff); - uint8_t hmac[32]; unsigned int hmac_len = 0; if(!HMAC(EVP_sha256(), hmac_key, CHIAKI_RPCRYPT_KEY_SIZE, buf, sizeof(buf), hmac, &hmac_len)) diff --git a/lib/src/senkusha.c b/lib/src/senkusha.c index 1fa33d4..ebab5d7 100644 --- a/lib/src/senkusha.c +++ b/lib/src/senkusha.c @@ -645,7 +645,6 @@ static void senkusha_takion_data(ChiakiSenkusha *senkusha, ChiakiTakionMessageDa senkusha->state_finished = true; chiaki_cond_signal(&senkusha->state_cond); } - } chiaki_mutex_unlock(&senkusha->state_mutex); } @@ -878,4 +877,3 @@ static ChiakiErrorCode senkusha_send_data_wait_for_ack(ChiakiSenkusha *senkusha, return err; } - diff --git a/lib/src/session.c b/lib/src/session.c index a57ea1d..32cb646 100644 --- a/lib/src/session.c +++ b/lib/src/session.c @@ -540,10 +540,8 @@ quit: #undef QUIT } - - - -typedef struct session_response_t { +typedef struct session_response_t +{ uint32_t error_code; const char *nonce; const char *rp_version; @@ -652,7 +650,6 @@ static ChiakiErrorCode session_thread_request_session(ChiakiSession *session, Ch break; } - if(CHIAKI_SOCKET_IS_INVALID(session_sock)) { CHIAKI_LOGE(session->log, "Session request connect failed eventually."); diff --git a/lib/src/stoppipe.c b/lib/src/stoppipe.c index dd069ef..7ad2d2a 100644 --- a/lib/src/stoppipe.c +++ b/lib/src/stoppipe.c @@ -27,9 +27,8 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_stop_pipe_init(ChiakiStopPipe *stop_pipe) int addr_size = sizeof(stop_pipe->addr); stop_pipe->fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if(stop_pipe->fd < 0){ + if(stop_pipe->fd < 0) return CHIAKI_ERR_UNKNOWN; - } stop_pipe->addr.sin_family = AF_INET; // bind to localhost stop_pipe->addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); diff --git a/lib/src/streamconnection.c b/lib/src/streamconnection.c index 28b22dc..2a7bb6f 100644 --- a/lib/src/streamconnection.c +++ b/lib/src/streamconnection.c @@ -56,7 +56,6 @@ static ChiakiErrorCode stream_connection_send_streaminfo_ack(ChiakiStreamConnect static void stream_connection_takion_av(ChiakiStreamConnection *stream_connection, ChiakiTakionAVPacket *packet); static ChiakiErrorCode stream_connection_send_heartbeat(ChiakiStreamConnection *stream_connection); - CHIAKI_EXPORT ChiakiErrorCode chiaki_stream_connection_init(ChiakiStreamConnection *stream_connection, ChiakiSession *session) { stream_connection->session = session; @@ -121,7 +120,6 @@ CHIAKI_EXPORT void chiaki_stream_connection_fini(ChiakiStreamConnection *stream_ chiaki_mutex_fini(&stream_connection->state_mutex); } - static bool state_finished_cond_check(void *user) { ChiakiStreamConnection *stream_connection = user; @@ -399,7 +397,6 @@ static void stream_connection_takion_data_protobuf(ChiakiStreamConnection *strea break; } chiaki_mutex_unlock(&stream_connection->state_mutex); - } static void stream_connection_takion_data_rumble(ChiakiStreamConnection *stream_connection, uint8_t *buf, size_t buf_size) @@ -640,7 +637,6 @@ static bool pb_decode_resolution(pb_istream_t *stream, const pb_field_t *field, return true; } - static void stream_connection_takion_data_expect_streaminfo(ChiakiStreamConnection *stream_connection, uint8_t *buf, size_t buf_size) { tkproto_TakionMessage msg; @@ -709,11 +705,9 @@ error: chiaki_cond_signal(&stream_connection->state_cond); } - - static bool chiaki_pb_encode_zero_encrypted_key(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) { - if (!pb_encode_tag_for_field(stream, field)) + if(!pb_encode_tag_for_field(stream, field)) return false; uint8_t data[] = { 0, 0, 0, 0 }; return pb_encode_string(stream, data, sizeof(data)); @@ -867,7 +861,6 @@ static ChiakiErrorCode stream_connection_send_disconnect(ChiakiStreamConnection return err; } - static void stream_connection_takion_av(ChiakiStreamConnection *stream_connection, ChiakiTakionAVPacket *packet) { chiaki_gkcrypt_decrypt(stream_connection->gkcrypt_remote, packet->key_pos + CHIAKI_GKCRYPT_BLOCK_SIZE, packet->data, packet->data_size); @@ -878,7 +871,6 @@ static void stream_connection_takion_av(ChiakiStreamConnection *stream_connectio chiaki_audio_receiver_av_packet(stream_connection->audio_receiver, packet); } - static ChiakiErrorCode stream_connection_send_heartbeat(ChiakiStreamConnection *stream_connection) { tkproto_TakionMessage msg = { 0 }; diff --git a/lib/src/takion.c b/lib/src/takion.c index fe3e95b..c433977 100644 --- a/lib/src/takion.c +++ b/lib/src/takion.c @@ -107,7 +107,6 @@ typedef enum takion_chunk_type_t { TAKION_CHUNK_TYPE_COOKIE_ACK = 0xb, } TakionChunkType; - typedef struct takion_message_t { uint32_t tag; @@ -120,7 +119,6 @@ typedef struct takion_message_t uint8_t *payload; } TakionMessage; - typedef struct takion_message_payload_init_t { uint32_t tag; @@ -152,14 +150,12 @@ typedef struct uint16_t channel; } TakionDataPacketEntry; - typedef struct chiaki_takion_postponed_packet_t { uint8_t *buf; size_t buf_size; } ChiakiTakionPostponedPacket; - static void *takion_thread_func(void *user); static void takion_handle_packet(ChiakiTakion *takion, uint8_t *buf, size_t buf_size); static ChiakiErrorCode takion_handle_packet_mac(ChiakiTakion *takion, uint8_t base_type, uint8_t *buf, size_t buf_size); @@ -507,7 +503,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_send_congestion(ChiakiTakion *takion return err; uint8_t buf[CHIAKI_TAKION_CONGESTION_PACKET_SIZE]; - chiaki_takion_format_congestion(buf, packet, key_pos); + chiaki_takion_format_congestion(buf, packet, key_pos); return chiaki_takion_send(takion, buf, sizeof(buf), key_pos); } @@ -603,7 +599,6 @@ static ChiakiErrorCode takion_handshake(ChiakiTakion *takion, uint32_t *seq_num_ CHIAKI_LOGI(takion->log, "Takion sent init"); - // INIT_ACK <- TakionMessagePayloadInitAck init_ack_payload; @@ -621,20 +616,17 @@ static ChiakiErrorCode takion_handshake(ChiakiTakion *takion, uint32_t *seq_num_ } CHIAKI_LOGI(takion->log, "Takion received init ack with remote tag %#x, outbound streams: %#x, inbound streams: %#x", - init_ack_payload.tag, init_ack_payload.outbound_streams, init_ack_payload.inbound_streams); + init_ack_payload.tag, init_ack_payload.outbound_streams, init_ack_payload.inbound_streams); takion->tag_remote = init_ack_payload.tag; *seq_num_remote_initial = takion->tag_remote; //init_ack_payload.initial_seq_num; - if(init_ack_payload.outbound_streams == 0 || init_ack_payload.inbound_streams == 0 - || init_ack_payload.outbound_streams > TAKION_INBOUND_STREAMS - || init_ack_payload.inbound_streams < TAKION_OUTBOUND_STREAMS) + if(init_ack_payload.outbound_streams == 0 || init_ack_payload.inbound_streams == 0 || init_ack_payload.outbound_streams > TAKION_INBOUND_STREAMS || init_ack_payload.inbound_streams < TAKION_OUTBOUND_STREAMS) { CHIAKI_LOGE(takion->log, "Takion min/max check failed"); return CHIAKI_ERR_INVALID_RESPONSE; } - // COOKIE -> err = takion_send_message_cookie(takion, init_ack_payload.cookie); @@ -780,7 +772,6 @@ beach: return NULL; } - static ChiakiErrorCode takion_recv(ChiakiTakion *takion, uint8_t *buf, size_t *buf_size, uint64_t timeout_ms) { ChiakiErrorCode err = chiaki_stop_pipe_select_single(&takion->stop_pipe, takion->sock, false, timeout_ms); @@ -805,7 +796,6 @@ static ChiakiErrorCode takion_recv(ChiakiTakion *takion, uint8_t *buf, size_t *b return CHIAKI_ERR_SUCCESS; } - static ChiakiErrorCode takion_handle_packet_mac(ChiakiTakion *takion, uint8_t base_type, uint8_t *buf, size_t buf_size) { if(!takion->gkcrypt_remote) @@ -866,7 +856,6 @@ static void takion_postpone_packet(ChiakiTakion *takion, uint8_t *buf, size_t bu packet->buf_size = buf_size; } - /** * @param buf ownership of this buf is taken. */ @@ -934,7 +923,6 @@ static void takion_handle_packet_message(ChiakiTakion *takion, uint8_t *buf, siz } } - static void takion_flush_data_queue(ChiakiTakion *takion) { uint64_t seq_num = 0; @@ -1104,7 +1092,6 @@ static ChiakiErrorCode takion_parse_message(ChiakiTakion *takion, uint8_t *buf, return CHIAKI_ERR_SUCCESS; } - static ChiakiErrorCode takion_send_message_init(ChiakiTakion *takion, TakionMessagePayloadInit *payload) { uint8_t message[1 + TAKION_MESSAGE_HEADER_SIZE + 0x10]; @@ -1121,8 +1108,6 @@ static ChiakiErrorCode takion_send_message_init(ChiakiTakion *takion, TakionMess return chiaki_takion_send_raw(takion, message, sizeof(message)); } - - static ChiakiErrorCode takion_send_message_cookie(ChiakiTakion *takion, uint8_t *cookie) { uint8_t message[1 + TAKION_MESSAGE_HEADER_SIZE + TAKION_COOKIE_SIZE]; @@ -1132,8 +1117,6 @@ static ChiakiErrorCode takion_send_message_cookie(ChiakiTakion *takion, uint8_t return chiaki_takion_send_raw(takion, message, sizeof(message)); } - - static ChiakiErrorCode takion_recv_message_init_ack(ChiakiTakion *takion, TakionMessagePayloadInitAck *payload) { uint8_t message[1 + TAKION_MESSAGE_HEADER_SIZE + 0x10 + TAKION_COOKIE_SIZE]; @@ -1181,7 +1164,6 @@ static ChiakiErrorCode takion_recv_message_init_ack(ChiakiTakion *takion, Takion return CHIAKI_ERR_SUCCESS; } - static ChiakiErrorCode takion_recv_message_cookie_ack(ChiakiTakion *takion) { uint8_t message[1 + TAKION_MESSAGE_HEADER_SIZE]; @@ -1221,7 +1203,6 @@ static ChiakiErrorCode takion_recv_message_cookie_ack(ChiakiTakion *takion) return CHIAKI_ERR_SUCCESS; } - static void takion_handle_packet_av(ChiakiTakion *takion, uint8_t base_type, uint8_t *buf, size_t buf_size) { // HHIxIIx @@ -1453,5 +1434,4 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_v7_av_packet_parse(ChiakiTakionAVPac packet->data_size = buf_size; return CHIAKI_ERR_SUCCESS; - } diff --git a/lib/src/thread.c b/lib/src/thread.c index 1948311..0539e16 100644 --- a/lib/src/thread.c +++ b/lib/src/thread.c @@ -23,7 +23,8 @@ static DWORD WINAPI win32_thread_func(LPVOID param) #endif #ifdef __SWITCH__ -int64_t get_thread_limit(){ +int64_t get_thread_limit() +{ uint64_t resource_limit_handle_value = INVALID_HANDLE; svcGetInfo(&resource_limit_handle_value, InfoType_ResourceLimit, INVALID_HANDLE, 0); int64_t thread_cur_value = 0, thread_lim_value = 0; @@ -45,9 +46,8 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_thread_create(ChiakiThread *thread, ChiakiT return CHIAKI_ERR_THREAD; #else #ifdef __SWITCH__ - if(get_thread_limit() <= 1){ + if(get_thread_limit() <= 1) return CHIAKI_ERR_THREAD; - } #endif int r = pthread_create(&thread->thread, NULL, func, arg); if(r != 0) @@ -90,13 +90,13 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_thread_set_name(ChiakiThread *thread, const if(r != 0) return CHIAKI_ERR_THREAD; #else - (void)thread; (void)name; + (void)thread; + (void)name; #endif #endif return CHIAKI_ERR_SUCCESS; } - CHIAKI_EXPORT ChiakiErrorCode chiaki_mutex_init(ChiakiMutex *mutex, bool rec) { #if _WIN32 @@ -172,9 +172,6 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_mutex_unlock(ChiakiMutex *mutex) return CHIAKI_ERR_SUCCESS; } - - - CHIAKI_EXPORT ChiakiErrorCode chiaki_cond_init(ChiakiCond *cond) { #if _WIN32 @@ -214,8 +211,6 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_cond_fini(ChiakiCond *cond) return CHIAKI_ERR_SUCCESS; } - - CHIAKI_EXPORT ChiakiErrorCode chiaki_cond_wait(ChiakiCond *cond, ChiakiMutex *mutex) { #if _WIN32 @@ -323,7 +318,6 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_cond_timedwait_pred(ChiakiCond *cond, Chiak #endif } return CHIAKI_ERR_SUCCESS; - } CHIAKI_EXPORT ChiakiErrorCode chiaki_cond_signal(ChiakiCond *cond) @@ -350,9 +344,6 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_cond_broadcast(ChiakiCond *cond) return CHIAKI_ERR_SUCCESS; } - - - CHIAKI_EXPORT ChiakiErrorCode chiaki_bool_pred_cond_init(ChiakiBoolPredCond *cond) { cond->pred = false; @@ -384,7 +375,6 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_bool_pred_cond_fini(ChiakiBoolPredCond *con return CHIAKI_ERR_SUCCESS; } - CHIAKI_EXPORT ChiakiErrorCode chiaki_bool_pred_cond_lock(ChiakiBoolPredCond *cond) { return chiaki_mutex_lock(&cond->mutex); diff --git a/switch/src/discoverymanager.cpp b/switch/src/discoverymanager.cpp index 7f71578..e9abe5f 100644 --- a/switch/src/discoverymanager.cpp +++ b/switch/src/discoverymanager.cpp @@ -16,9 +16,9 @@ #define HOSTS_MAX 16 #define DROP_PINGS 3 -static void Discovery(ChiakiDiscoveryHost * discovered_hosts, size_t hosts_count, void * user) +static void Discovery(ChiakiDiscoveryHost *discovered_hosts, size_t hosts_count, void *user) { - DiscoveryManager * dm = (DiscoveryManager *)user; + DiscoveryManager *dm = (DiscoveryManager *)user; for(size_t i = 0; i < hosts_count; i++) { dm->DiscoveryCB(discovered_hosts + i); @@ -105,7 +105,7 @@ uint32_t DiscoveryManager::GetIPv4BroadcastAddr() #endif } -int DiscoveryManager::Send(struct sockaddr * host_addr, size_t host_addr_len) +int DiscoveryManager::Send(struct sockaddr *host_addr, size_t host_addr_len) { if(!host_addr) { @@ -120,9 +120,9 @@ int DiscoveryManager::Send(struct sockaddr * host_addr, size_t host_addr_len) return 0; } -int DiscoveryManager::Send(const char * discover_ip_dest) +int DiscoveryManager::Send(const char *discover_ip_dest) { - struct addrinfo * host_addrinfos; + struct addrinfo *host_addrinfos; int r = getaddrinfo(discover_ip_dest, NULL, NULL, &host_addrinfos); if(r != 0) { @@ -130,10 +130,10 @@ int DiscoveryManager::Send(const char * discover_ip_dest) return 1; } - struct sockaddr * host_addr = nullptr; + struct sockaddr *host_addr = nullptr; socklen_t host_addr_len = 0; - for(struct addrinfo * ai = host_addrinfos; ai; ai = ai->ai_next) + for(struct addrinfo *ai = host_addrinfos; ai; ai = ai->ai_next) { if(ai->ai_protocol != IPPROTO_UDP) continue; @@ -170,13 +170,13 @@ int DiscoveryManager::Send() return DiscoveryManager::Send(this->host_addr, this->host_addr_len); } -void DiscoveryManager::DiscoveryCB(ChiakiDiscoveryHost * discovered_host) +void DiscoveryManager::DiscoveryCB(ChiakiDiscoveryHost *discovered_host) { // the user ptr is passed as // chiaki_discovery_thread_start arg std::string key = discovered_host->host_name; - Host * host = this->settings->GetOrCreateHost(&key); + Host *host = this->settings->GetOrCreateHost(&key); CHIAKI_LOGI(this->log, "--"); CHIAKI_LOGI(this->log, "Discovered Host:"); diff --git a/switch/src/gui.cpp b/switch/src/gui.cpp index e49852b..d784026 100644 --- a/switch/src/gui.cpp +++ b/switch/src/gui.cpp @@ -100,7 +100,7 @@ void HostInterface::Register(Host *host, std::function success_cb) brls::Dialog *peprpc = new brls::Dialog("Please enter your PlayStation registration PIN code"); brls::GenericEvent::Callback cb_peprpc = [host, io, peprpc](brls::View *view) { bool pin_provided = false; - char pin_input[9] = {0}; + char pin_input[9] = { 0 }; std::string error_message; // use callback to ensure that the message is showed on screen @@ -330,7 +330,7 @@ bool MainApplication::BuildConfigurationMenu(brls::List *ls, Host *host) brls::ListItem *psn_account_id = new brls::ListItem("PSN Account ID", "PS5 or PS4 v7.0 and greater (base64 account_id)"); psn_account_id->setValue(psn_account_id_string.c_str()); auto psn_account_id_cb = [this, host, psn_account_id](brls::View *view) { - char account_id[CHIAKI_PSN_ACCOUNT_ID_SIZE * 2] = {0}; + char account_id[CHIAKI_PSN_ACCOUNT_ID_SIZE * 2] = { 0 }; bool input = this->io->ReadUserKeyboard(account_id, sizeof(account_id)); if(input) { @@ -349,7 +349,7 @@ bool MainApplication::BuildConfigurationMenu(brls::List *ls, Host *host) brls::ListItem *psn_online_id = new brls::ListItem("PSN Online ID"); psn_online_id->setValue(psn_online_id_string.c_str()); auto psn_online_id_cb = [this, host, psn_online_id](brls::View *view) { - char online_id[256] = {0}; + char online_id[256] = { 0 }; bool input = this->io->ReadUserKeyboard(online_id, sizeof(online_id)); if(input) { @@ -380,7 +380,7 @@ bool MainApplication::BuildConfigurationMenu(brls::List *ls, Host *host) } brls::SelectListItem *resolution = new brls::SelectListItem( - "Resolution", {"720p", "540p", "360p"}, value); + "Resolution", { "720p", "540p", "360p" }, value); auto resolution_cb = [this, host](int result) { ChiakiVideoResolutionPreset value = CHIAKI_VIDEO_RESOLUTION_PRESET_720p; @@ -414,7 +414,7 @@ bool MainApplication::BuildConfigurationMenu(brls::List *ls, Host *host) } brls::SelectListItem *fps = new brls::SelectListItem( - "FPS", {"60", "30"}, value); + "FPS", { "60", "30" }, value); auto fps_cb = [this, host](int result) { ChiakiVideoFPSPreset value = CHIAKI_VIDEO_FPS_PRESET_60; @@ -467,7 +467,7 @@ void MainApplication::BuildAddHostConfigurationMenu(brls::List *add_host) brls::ListItem *display_name = new brls::ListItem("Display name"); auto display_name_cb = [this, display_name](brls::View *view) { - char name[16] = {0}; + char name[16] = { 0 }; bool input = this->io->ReadUserKeyboard(name, sizeof(name)); if(input) { @@ -482,7 +482,7 @@ void MainApplication::BuildAddHostConfigurationMenu(brls::List *add_host) brls::ListItem *address = new brls::ListItem("Remote IP/name"); auto address_cb = [this, address](brls::View *view) { - char addr[256] = {0}; + char addr[256] = { 0 }; bool input = this->io->ReadUserKeyboard(addr, sizeof(addr)); if(input) { @@ -500,7 +500,7 @@ void MainApplication::BuildAddHostConfigurationMenu(brls::List *add_host) // brls::ListItem* port = new brls::ListItem("Remote stream port", "udp 9296"); // brls::ListItem* port = new brls::ListItem("Remote Senkusha port", "udp 9297"); brls::SelectListItem *ps_version = new brls::SelectListItem("PlayStation Version", - {"PS5", "PS4 > 8", "7 < PS4 < 8", "PS4 < 7"}); + { "PS5", "PS4 > 8", "7 < PS4 < 8", "PS4 < 7" }); auto ps_version_cb = [this, ps_version](int result) { switch(result) { diff --git a/switch/src/io.cpp b/switch/src/io.cpp index d7c28f7..9f6ab56 100644 --- a/switch/src/io.cpp +++ b/switch/src/io.cpp @@ -646,7 +646,7 @@ bool IO::InitOpenGlTextures() D(glGenTextures(PLANES_COUNT, this->tex)); D(glGenBuffers(PLANES_COUNT, this->pbo)); - uint8_t uv_default[] = {0x7f, 0x7f}; + uint8_t uv_default[] = { 0x7f, 0x7f }; for(int i = 0; i < PLANES_COUNT; i++) { D(glBindTexture(GL_TEXTURE_2D, this->tex[i])); @@ -659,7 +659,7 @@ bool IO::InitOpenGlTextures() D(glUseProgram(this->prog)); // bind only as many planes as we need - const char *plane_names[] = {"plane1", "plane2", "plane3"}; + const char *plane_names[] = { "plane1", "plane2", "plane3" }; for(int i = 0; i < PLANES_COUNT; i++) D(glUniform1i(glGetUniformLocation(this->prog, plane_names[i]), i)); diff --git a/switch/src/main.cpp b/switch/src/main.cpp index c12d413..84f9210 100644 --- a/switch/src/main.cpp +++ b/switch/src/main.cpp @@ -111,11 +111,11 @@ extern "C" void userAppExit() } #endif // __SWITCH__ -int main(int argc, char * argv[]) +int main(int argc, char *argv[]) { // load chiaki lib - Settings * settings = Settings::GetInstance(); - ChiakiLog * log = settings->GetLogger(); + Settings *settings = Settings::GetInstance(); + ChiakiLog *log = settings->GetLogger(); CHIAKI_LOGI(log, "Loading chaki lib"); diff --git a/switch/src/settings.cpp b/switch/src/settings.cpp index f0eb3e3..f5edf1f 100644 --- a/switch/src/settings.cpp +++ b/switch/src/settings.cpp @@ -13,7 +13,7 @@ Settings::Settings() #endif } -Settings::ConfigurationItem Settings::ParseLine(std::string * line, std::string * value) +Settings::ConfigurationItem Settings::ParseLine(std::string *line, std::string *value) { Settings::ConfigurationItem ci; std::smatch m; @@ -35,9 +35,9 @@ size_t Settings::GetB64encodeSize(size_t in) return ((4 * in / 3) + 3) & ~3; } -Settings * Settings::instance = nullptr; +Settings *Settings::instance = nullptr; -Settings * Settings::GetInstance() +Settings *Settings::GetInstance() { if(instance == nullptr) { @@ -47,17 +47,17 @@ Settings * Settings::GetInstance() return instance; } -ChiakiLog * Settings::GetLogger() +ChiakiLog *Settings::GetLogger() { return &this->log; } -std::map * Settings::GetHostsMap() +std::map *Settings::GetHostsMap() { return &this->hosts; } -Host * Settings::GetOrCreateHost(std::string * host_name) +Host *Settings::GetOrCreateHost(std::string *host_name) { bool created = false; // update of create Host instance @@ -69,7 +69,7 @@ Host * Settings::GetOrCreateHost(std::string * host_name) created = true; } - Host * host = &(this->hosts.at(*host_name)); + Host *host = &(this->hosts.at(*host_name)); if(created) { // copy default settings @@ -90,7 +90,7 @@ void Settings::ParseFile() std::string line; std::string value; bool rp_key_b = false, rp_regist_key_b = false, rp_key_type_b = false; - Host * current_host = nullptr; + Host *current_host = nullptr; if(config_file.is_open()) { CHIAKI_LOGV(&this->log, "Config file opened"); @@ -102,63 +102,63 @@ void Settings::ParseFile() ci = this->ParseLine(&line, &value); switch(ci) { - // got to next line - case UNKNOWN: - CHIAKI_LOGV(&this->log, "UNKNOWN config"); - break; - case HOST_NAME: - CHIAKI_LOGV(&this->log, "HOST_NAME %s", value.c_str()); - // current host is in context - current_host = this->GetOrCreateHost(&value); - // all following case will edit the current_host config + // got to next line + case UNKNOWN: + CHIAKI_LOGV(&this->log, "UNKNOWN config"); + break; + case HOST_NAME: + CHIAKI_LOGV(&this->log, "HOST_NAME %s", value.c_str()); + // current host is in context + current_host = this->GetOrCreateHost(&value); + // all following case will edit the current_host config - rp_key_b = false; - rp_regist_key_b = false; - rp_key_type_b = false; - break; - case HOST_ADDR: - CHIAKI_LOGV(&this->log, "HOST_ADDR %s", value.c_str()); - if(current_host != nullptr) - current_host->host_addr = value; - break; - case PSN_ONLINE_ID: - CHIAKI_LOGV(&this->log, "PSN_ONLINE_ID %s", value.c_str()); - // current_host == nullptr - // means we are in global ini section - // update default setting - this->SetPSNOnlineID(current_host, value); - break; - case PSN_ACCOUNT_ID: - CHIAKI_LOGV(&this->log, "PSN_ACCOUNT_ID %s", value.c_str()); - this->SetPSNAccountID(current_host, value); - break; - case RP_KEY: - CHIAKI_LOGV(&this->log, "RP_KEY %s", value.c_str()); - if(current_host != nullptr) - rp_key_b = this->SetHostRPKey(current_host, value); - break; - case RP_KEY_TYPE: - CHIAKI_LOGV(&this->log, "RP_KEY_TYPE %s", value.c_str()); - if(current_host != nullptr) - // TODO Check possible rp_type values - rp_key_type_b = this->SetHostRPKeyType(current_host, value); - break; - case RP_REGIST_KEY: - CHIAKI_LOGV(&this->log, "RP_REGIST_KEY %s", value.c_str()); - if(current_host != nullptr) - rp_regist_key_b = this->SetHostRPRegistKey(current_host, value); - break; - case VIDEO_RESOLUTION: - this->SetVideoResolution(current_host, value); - break; - case VIDEO_FPS: - this->SetVideoFPS(current_host, value); - break; - case TARGET: - CHIAKI_LOGV(&this->log, "TARGET %s", value.c_str()); - if(current_host != nullptr) - this->SetChiakiTarget(current_host, value); - break; + rp_key_b = false; + rp_regist_key_b = false; + rp_key_type_b = false; + break; + case HOST_ADDR: + CHIAKI_LOGV(&this->log, "HOST_ADDR %s", value.c_str()); + if(current_host != nullptr) + current_host->host_addr = value; + break; + case PSN_ONLINE_ID: + CHIAKI_LOGV(&this->log, "PSN_ONLINE_ID %s", value.c_str()); + // current_host == nullptr + // means we are in global ini section + // update default setting + this->SetPSNOnlineID(current_host, value); + break; + case PSN_ACCOUNT_ID: + CHIAKI_LOGV(&this->log, "PSN_ACCOUNT_ID %s", value.c_str()); + this->SetPSNAccountID(current_host, value); + break; + case RP_KEY: + CHIAKI_LOGV(&this->log, "RP_KEY %s", value.c_str()); + if(current_host != nullptr) + rp_key_b = this->SetHostRPKey(current_host, value); + break; + case RP_KEY_TYPE: + CHIAKI_LOGV(&this->log, "RP_KEY_TYPE %s", value.c_str()); + if(current_host != nullptr) + // TODO Check possible rp_type values + rp_key_type_b = this->SetHostRPKeyType(current_host, value); + break; + case RP_REGIST_KEY: + CHIAKI_LOGV(&this->log, "RP_REGIST_KEY %s", value.c_str()); + if(current_host != nullptr) + rp_regist_key_b = this->SetHostRPRegistKey(current_host, value); + break; + case VIDEO_RESOLUTION: + this->SetVideoResolution(current_host, value); + break; + case VIDEO_FPS: + this->SetVideoFPS(current_host, value); + break; + case TARGET: + CHIAKI_LOGV(&this->log, "TARGET %s", value.c_str()); + if(current_host != nullptr) + this->SetChiakiTarget(current_host, value); + break; } // ci switch if(rp_key_b && rp_regist_key_b && rp_key_type_b) // the current host contains rp key data @@ -231,7 +231,7 @@ int Settings::WriteFile() if(it->second.rp_key_data || it->second.registered) { - char rp_key_type[33] = {0}; + char rp_key_type[33] = { 0 }; snprintf(rp_key_type, sizeof(rp_key_type), "%d", it->second.rp_key_type); // save registered rp key for auto login config_file << "rp_key = \"" << this->GetHostRPKey(&it->second) << "\"\n" @@ -250,14 +250,14 @@ std::string Settings::ResolutionPresetToString(ChiakiVideoResolutionPreset resol { switch(resolution) { - case CHIAKI_VIDEO_RESOLUTION_PRESET_360p: - return "360p"; - case CHIAKI_VIDEO_RESOLUTION_PRESET_540p: - return "540p"; - case CHIAKI_VIDEO_RESOLUTION_PRESET_720p: - return "720p"; - case CHIAKI_VIDEO_RESOLUTION_PRESET_1080p: - return "1080p"; + case CHIAKI_VIDEO_RESOLUTION_PRESET_360p: + return "360p"; + case CHIAKI_VIDEO_RESOLUTION_PRESET_540p: + return "540p"; + case CHIAKI_VIDEO_RESOLUTION_PRESET_720p: + return "720p"; + case CHIAKI_VIDEO_RESOLUTION_PRESET_1080p: + return "1080p"; } return "UNKNOWN"; } @@ -266,14 +266,14 @@ int Settings::ResolutionPresetToInt(ChiakiVideoResolutionPreset resolution) { switch(resolution) { - case CHIAKI_VIDEO_RESOLUTION_PRESET_360p: - return 360; - case CHIAKI_VIDEO_RESOLUTION_PRESET_540p: - return 540; - case CHIAKI_VIDEO_RESOLUTION_PRESET_720p: - return 720; - case CHIAKI_VIDEO_RESOLUTION_PRESET_1080p: - return 1080; + case CHIAKI_VIDEO_RESOLUTION_PRESET_360p: + return 360; + case CHIAKI_VIDEO_RESOLUTION_PRESET_540p: + return 540; + case CHIAKI_VIDEO_RESOLUTION_PRESET_720p: + return 720; + case CHIAKI_VIDEO_RESOLUTION_PRESET_1080p: + return 1080; } return 0; } @@ -300,10 +300,10 @@ std::string Settings::FPSPresetToString(ChiakiVideoFPSPreset fps) { switch(fps) { - case CHIAKI_VIDEO_FPS_PRESET_30: - return "30"; - case CHIAKI_VIDEO_FPS_PRESET_60: - return "60"; + case CHIAKI_VIDEO_FPS_PRESET_30: + return "30"; + case CHIAKI_VIDEO_FPS_PRESET_60: + return "60"; } return "UNKNOWN"; } @@ -312,10 +312,10 @@ int Settings::FPSPresetToInt(ChiakiVideoFPSPreset fps) { switch(fps) { - case CHIAKI_VIDEO_FPS_PRESET_30: - return 30; - case CHIAKI_VIDEO_FPS_PRESET_60: - return 60; + case CHIAKI_VIDEO_FPS_PRESET_30: + return 30; + case CHIAKI_VIDEO_FPS_PRESET_60: + return 60; } return 0; } @@ -334,7 +334,7 @@ ChiakiVideoFPSPreset Settings::StringToFPSPreset(std::string value) return CHIAKI_VIDEO_FPS_PRESET_30; } -std::string Settings::GetHostName(Host * host) +std::string Settings::GetHostName(Host *host) { if(host != nullptr) return host->GetHostName(); @@ -343,7 +343,7 @@ std::string Settings::GetHostName(Host * host) return ""; } -std::string Settings::GetHostAddr(Host * host) +std::string Settings::GetHostAddr(Host *host) { if(host != nullptr) return host->GetHostAddr(); @@ -352,7 +352,7 @@ std::string Settings::GetHostAddr(Host * host) return ""; } -std::string Settings::GetPSNOnlineID(Host * host) +std::string Settings::GetPSNOnlineID(Host *host) { if(host == nullptr || host->psn_online_id.length() == 0) return this->global_psn_online_id; @@ -360,7 +360,7 @@ std::string Settings::GetPSNOnlineID(Host * host) return host->psn_online_id; } -void Settings::SetPSNOnlineID(Host * host, std::string psn_online_id) +void Settings::SetPSNOnlineID(Host *host, std::string psn_online_id) { if(host == nullptr) this->global_psn_online_id = psn_online_id; @@ -368,7 +368,7 @@ void Settings::SetPSNOnlineID(Host * host, std::string psn_online_id) host->psn_online_id = psn_online_id; } -std::string Settings::GetPSNAccountID(Host * host) +std::string Settings::GetPSNAccountID(Host *host) { if(host == nullptr || host->psn_account_id.length() == 0) return this->global_psn_account_id; @@ -376,7 +376,7 @@ std::string Settings::GetPSNAccountID(Host * host) return host->psn_account_id; } -void Settings::SetPSNAccountID(Host * host, std::string psn_account_id) +void Settings::SetPSNAccountID(Host *host, std::string psn_account_id) { if(host == nullptr) this->global_psn_account_id = psn_account_id; @@ -384,7 +384,7 @@ void Settings::SetPSNAccountID(Host * host, std::string psn_account_id) host->psn_account_id = psn_account_id; } -ChiakiVideoResolutionPreset Settings::GetVideoResolution(Host * host) +ChiakiVideoResolutionPreset Settings::GetVideoResolution(Host *host) { if(host == nullptr) return this->global_video_resolution; @@ -392,7 +392,7 @@ ChiakiVideoResolutionPreset Settings::GetVideoResolution(Host * host) return host->video_resolution; } -void Settings::SetVideoResolution(Host * host, ChiakiVideoResolutionPreset value) +void Settings::SetVideoResolution(Host *host, ChiakiVideoResolutionPreset value) { if(host == nullptr) this->global_video_resolution = value; @@ -400,13 +400,13 @@ void Settings::SetVideoResolution(Host * host, ChiakiVideoResolutionPreset value host->video_resolution = value; } -void Settings::SetVideoResolution(Host * host, std::string value) +void Settings::SetVideoResolution(Host *host, std::string value) { ChiakiVideoResolutionPreset p = StringToResolutionPreset(value); this->SetVideoResolution(host, p); } -ChiakiVideoFPSPreset Settings::GetVideoFPS(Host * host) +ChiakiVideoFPSPreset Settings::GetVideoFPS(Host *host) { if(host == nullptr) return this->global_video_fps; @@ -414,7 +414,7 @@ ChiakiVideoFPSPreset Settings::GetVideoFPS(Host * host) return host->video_fps; } -void Settings::SetVideoFPS(Host * host, ChiakiVideoFPSPreset value) +void Settings::SetVideoFPS(Host *host, ChiakiVideoFPSPreset value) { if(host == nullptr) this->global_video_fps = value; @@ -422,18 +422,18 @@ void Settings::SetVideoFPS(Host * host, ChiakiVideoFPSPreset value) host->video_fps = value; } -void Settings::SetVideoFPS(Host * host, std::string value) +void Settings::SetVideoFPS(Host *host, std::string value) { ChiakiVideoFPSPreset p = StringToFPSPreset(value); this->SetVideoFPS(host, p); } -ChiakiTarget Settings::GetChiakiTarget(Host * host) +ChiakiTarget Settings::GetChiakiTarget(Host *host) { return host->GetChiakiTarget(); } -bool Settings::SetChiakiTarget(Host * host, ChiakiTarget target) +bool Settings::SetChiakiTarget(Host *host, ChiakiTarget target) { if(host != nullptr) { @@ -447,20 +447,20 @@ bool Settings::SetChiakiTarget(Host * host, ChiakiTarget target) } } -bool Settings::SetChiakiTarget(Host * host, std::string value) +bool Settings::SetChiakiTarget(Host *host, std::string value) { // TODO Check possible target values return this->SetChiakiTarget(host, static_cast(std::atoi(value.c_str()))); } -std::string Settings::GetHostRPKey(Host * host) +std::string Settings::GetHostRPKey(Host *host) { if(host != nullptr) { if(host->rp_key_data || host->registered) { size_t rp_key_b64_sz = this->GetB64encodeSize(0x10); - char rp_key_b64[rp_key_b64_sz + 1] = {0}; + char rp_key_b64[rp_key_b64_sz + 1] = { 0 }; ChiakiErrorCode err; err = chiaki_base64_encode( host->rp_key, 0x10, @@ -478,7 +478,7 @@ std::string Settings::GetHostRPKey(Host * host) return ""; } -bool Settings::SetHostRPKey(Host * host, std::string rp_key_b64) +bool Settings::SetHostRPKey(Host *host, std::string rp_key_b64) { if(host != nullptr) { @@ -497,14 +497,14 @@ bool Settings::SetHostRPKey(Host * host, std::string rp_key_b64) return false; } -std::string Settings::GetHostRPRegistKey(Host * host) +std::string Settings::GetHostRPRegistKey(Host *host) { if(host != nullptr) { if(host->rp_key_data || host->registered) { size_t rp_regist_key_b64_sz = this->GetB64encodeSize(CHIAKI_SESSION_AUTH_SIZE); - char rp_regist_key_b64[rp_regist_key_b64_sz + 1] = {0}; + char rp_regist_key_b64[rp_regist_key_b64_sz + 1] = { 0 }; ChiakiErrorCode err; err = chiaki_base64_encode( (uint8_t *)host->rp_regist_key, CHIAKI_SESSION_AUTH_SIZE, @@ -522,7 +522,7 @@ std::string Settings::GetHostRPRegistKey(Host * host) return ""; } -bool Settings::SetHostRPRegistKey(Host * host, std::string rp_regist_key_b64) +bool Settings::SetHostRPRegistKey(Host *host, std::string rp_regist_key_b64) { if(host != nullptr) { @@ -541,7 +541,7 @@ bool Settings::SetHostRPRegistKey(Host * host, std::string rp_regist_key_b64) return false; } -int Settings::GetHostRPKeyType(Host * host) +int Settings::GetHostRPKeyType(Host *host) { if(host != nullptr) return host->rp_key_type; @@ -550,7 +550,7 @@ int Settings::GetHostRPKeyType(Host * host) return 0; } -bool Settings::SetHostRPKeyType(Host * host, std::string value) +bool Settings::SetHostRPKeyType(Host *host, std::string value) { if(host != nullptr) { @@ -562,7 +562,7 @@ bool Settings::SetHostRPKeyType(Host * host, std::string value) } #ifdef CHIAKI_ENABLE_SWITCH_OVERCLOCK -int Settings::GetCPUOverclock(Host * host) +int Settings::GetCPUOverclock(Host *host) { if(host == nullptr) return this->global_cpu_overclock; @@ -570,7 +570,7 @@ int Settings::GetCPUOverclock(Host * host) return host->cpu_overclock; } -void Settings::SetCPUOverclock(Host * host, int value) +void Settings::SetCPUOverclock(Host *host, int value) { int oc = OC_1326; if(value > OC_1580) @@ -592,11 +592,9 @@ void Settings::SetCPUOverclock(Host * host, int value) host->cpu_overclock = oc; } -void Settings::SetCPUOverclock(Host * host, std::string value) +void Settings::SetCPUOverclock(Host *host, std::string value) { int v = atoi(value.c_str()); this->SetCPUOverclock(host, v); } #endif - -