mirror of
https://github.com/Vita3K/Vita3K.git
synced 2026-07-11 01:34:23 +02:00
ci: use clang-format action for format checks
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
|
||||
git fetch origin $GITHUB_BASE_REF:refs/remotes/origin/$GITHUB_BASE_REF
|
||||
for f in $(git diff --diff-filter=AM --name-only origin/$GITHUB_BASE_REF 'vita3k/**.cpp' 'vita3k/**.h' 'tools/**.cpp' 'tools/**.h'); do
|
||||
if [ "$(diff -u <(cat $f) <(clang-format $f))" != "" ]
|
||||
then
|
||||
echo "run format"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -15,13 +15,23 @@ env:
|
||||
|
||||
jobs:
|
||||
format-check:
|
||||
name: Format Check (${{ matrix.path }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
path:
|
||||
- vita3k
|
||||
- tools
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Format check
|
||||
run: .github/format-check.sh
|
||||
uses: jidicula/clang-format-action@v4.18.0
|
||||
with:
|
||||
clang-format-version: '22'
|
||||
check-path: ${{ matrix.path }}
|
||||
|
||||
build:
|
||||
name: Build (${{ matrix.os }})
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
@echo off
|
||||
if "%CLANG_FORMAT_BIN%"=="" set "CLANG_FORMAT_BIN=clang-format"
|
||||
cd vita3k
|
||||
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
|
||||
for /f %%f in ('dir *.cpp *.h /b/s') do "%CLANG_FORMAT_BIN%" -i "%%f"
|
||||
cd ..\tools
|
||||
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
|
||||
for /f %%f in ('dir *.cpp *.h /b/s') do "%CLANG_FORMAT_BIN%" -i "%%f"
|
||||
cd ..
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
set -euo pipefail
|
||||
|
||||
find vita3k tools/gen-modules tools/native-tool \( -name *.cpp -o -name *.h \) | xargs clang-format -i
|
||||
CLANG_FORMAT_BIN="${CLANG_FORMAT_BIN:-clang-format}"
|
||||
|
||||
find vita3k tools/gen-modules tools/native-tool \( -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 "$CLANG_FORMAT_BIN" -i
|
||||
|
||||
@@ -148,7 +148,7 @@ void style_mode_button(QToolButton *button) {
|
||||
" }"
|
||||
"QToolButton:hover { background-color: %1; }"
|
||||
"QToolButton:checked { background-color: %2; }")
|
||||
.arg(hover.name(QColor::HexArgb), checked.name(QColor::HexArgb)));
|
||||
.arg(hover.name(QColor::HexArgb), checked.name(QColor::HexArgb)));
|
||||
}
|
||||
|
||||
void style_binding_button(QPushButton *button, bool capturing = false) {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
CtrlKeyboardFilter::CtrlKeyboardFilter(EmuEnvState &emuenv, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_emuenv(emuenv){};
|
||||
, m_emuenv(emuenv) {};
|
||||
|
||||
bool CtrlKeyboardFilter::eventFilter(QObject *watched, QEvent *event) {
|
||||
switch (event->type()) {
|
||||
|
||||
@@ -375,8 +375,8 @@ void DebugWidget::on_thread_double_clicked(QTreeWidgetItem *item, int /*column*/
|
||||
|
||||
auto *dlg = new QDialog(this);
|
||||
dlg->setWindowTitle(tr("Thread: %1 (0x%2)")
|
||||
.arg(QString::fromStdString(thread->name))
|
||||
.arg(thread_id, 8, 16, QLatin1Char('0')));
|
||||
.arg(QString::fromStdString(thread->name))
|
||||
.arg(thread_id, 8, 16, QLatin1Char('0')));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->setMinimumSize(420, 480);
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ void LicenseInstallDialog::install_from_file() {
|
||||
info.setWindowTitle(tr("License Installed"));
|
||||
info.setIcon(QMessageBox::Information);
|
||||
info.setText(tr("License installed successfully!\n\nContent ID: %1\nTitle ID: %2")
|
||||
.arg(QString::fromStdString(m_emuenv.license_content_id),
|
||||
QString::fromStdString(m_emuenv.license_title_id)));
|
||||
.arg(QString::fromStdString(m_emuenv.license_content_id),
|
||||
QString::fromStdString(m_emuenv.license_title_id)));
|
||||
info.exec();
|
||||
accept();
|
||||
}
|
||||
@@ -104,8 +104,8 @@ void LicenseInstallDialog::install_from_zrif() {
|
||||
info.setWindowTitle(tr("License Installed"));
|
||||
info.setIcon(QMessageBox::Information);
|
||||
info.setText(tr("License installed successfully!\n\nContent ID: %1\nTitle ID: %2")
|
||||
.arg(QString::fromStdString(m_emuenv.license_content_id),
|
||||
QString::fromStdString(m_emuenv.license_title_id)));
|
||||
.arg(QString::fromStdString(m_emuenv.license_content_id),
|
||||
QString::fromStdString(m_emuenv.license_title_id)));
|
||||
info.exec();
|
||||
accept();
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ static std::vector<FrameItemData::TextEntry> parse_text_entries(const pugi::xml_
|
||||
static uint64_t current_time_secs() {
|
||||
return static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch())
|
||||
.count());
|
||||
.count());
|
||||
}
|
||||
|
||||
static std::string strip_whitespace(const std::string &s) {
|
||||
|
||||
@@ -912,9 +912,9 @@ std::optional<AppLaunchRequest> MainWindow::boot_game_once(const AppLaunchReques
|
||||
|
||||
m_game_window = new GameWindow(emuenv, m_gui_settings, emuenv.backend_renderer, screen());
|
||||
m_game_window->setTitle(tr("%1 | %2 (%3) | Loading...")
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
m_game_window->setIcon(windowIcon());
|
||||
if (m_live_area_widget)
|
||||
m_game_window->setGeometry(m_live_area_widget->geometry());
|
||||
@@ -1068,9 +1068,9 @@ std::optional<AppLaunchRequest> MainWindow::boot_game_once(const AppLaunchReques
|
||||
}
|
||||
|
||||
m_game_window->setTitle(tr("%1 | %2 (%3) | Initializing...")
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
|
||||
if (!m_app_session.initialize_runtime()) {
|
||||
abort_boot(tr("Failed to initialize emulator state."));
|
||||
@@ -1078,9 +1078,9 @@ std::optional<AppLaunchRequest> MainWindow::boot_game_once(const AppLaunchReques
|
||||
}
|
||||
|
||||
m_game_window->setTitle(tr("%1 | %2 (%3) | Loading modules...")
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
|
||||
if (!m_app_session.load_and_run()) {
|
||||
abort_boot(tr("Failed to start game threads."));
|
||||
@@ -1114,9 +1114,9 @@ std::optional<AppLaunchRequest> MainWindow::boot_game_once(const AppLaunchReques
|
||||
m_game_window->start_ui_updates();
|
||||
|
||||
m_game_window->setTitle(tr("%1 | %2 (%3) | Please wait, loading...")
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
|
||||
LOG_INFO("Game started: {} ({})", emuenv.current_app_title, launch_request.app_path);
|
||||
|
||||
@@ -1272,9 +1272,9 @@ void MainWindow::show_live_area(const std::string &title_id) {
|
||||
m_game_container = m_live_area_widget;
|
||||
|
||||
m_live_area_widget->setTitle(tr("%1 | %2 (%3)")
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
.arg(QString::fromStdString(window_title),
|
||||
QString::fromStdString(emuenv.current_app_title),
|
||||
QString::fromStdString(emuenv.io.title_id)));
|
||||
m_live_area_widget->setIcon(windowIcon());
|
||||
m_live_area_widget->installEventFilter(this);
|
||||
m_live_area_widget->show();
|
||||
|
||||
@@ -568,10 +568,10 @@ void TrophyCollectionDialog::update_summary_progress() {
|
||||
}
|
||||
const int pct = total_trophies > 0 ? (total_unlocked * 100 / total_trophies) : 0;
|
||||
m_progress_label->setText(tr("Total: %1% (%2/%3 trophies across %4 apps)")
|
||||
.arg(pct)
|
||||
.arg(total_unlocked)
|
||||
.arg(total_trophies)
|
||||
.arg(m_db.size()));
|
||||
.arg(pct)
|
||||
.arg(total_unlocked)
|
||||
.arg(total_trophies)
|
||||
.arg(m_db.size()));
|
||||
}
|
||||
|
||||
void TrophyCollectionDialog::update_page_controls() {
|
||||
|
||||
@@ -9,7 +9,7 @@ class ByteRingBuffer {
|
||||
public:
|
||||
ByteRingBuffer(std::size_t size)
|
||||
: buffer(new char[size])
|
||||
, capacity(size){
|
||||
, capacity(size) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ constexpr auto make_obfuscator(const char (&data)[N]) {
|
||||
// functions for decrypting the string and is also implicitly convertable to a
|
||||
// char*
|
||||
#define AY_OBFUSCATE_KEY(data, key) \
|
||||
[]() -> ay::obfuscated_data<sizeof(data) / sizeof(data[0]), key> & { \
|
||||
[]()->ay::obfuscated_data<sizeof(data) / sizeof(data[0]), key> & { \
|
||||
static_assert(sizeof(decltype(key)) == sizeof(ay::key_type), "key must be a 64 bit unsigned integer"); \
|
||||
static_assert((key) >= (1ull << 56), "key must span all 8 bytes"); \
|
||||
constexpr auto n = sizeof(data) / sizeof(data[0]); \
|
||||
|
||||
@@ -20,16 +20,16 @@ public:
|
||||
return { -xyz, w };
|
||||
}
|
||||
|
||||
[[nodiscard]] Quaternion<decltype(T{} + T{})> operator+(const Quaternion &other) const {
|
||||
[[nodiscard]] Quaternion<decltype(T{} + T{})> operator+(const Quaternion & other) const {
|
||||
return { xyz + other.xyz, w + other.w };
|
||||
}
|
||||
|
||||
[[nodiscard]] Quaternion<decltype(T{} - T{})> operator-(const Quaternion &other) const {
|
||||
[[nodiscard]] Quaternion<decltype(T{} - T{})> operator-(const Quaternion & other) const {
|
||||
return { xyz - other.xyz, w - other.w };
|
||||
}
|
||||
|
||||
[[nodiscard]] Quaternion<decltype(T{} * T{} - T{} * T{})> operator*(
|
||||
const Quaternion &other) const {
|
||||
const Quaternion & other) const {
|
||||
return { xyz * other.w + other.xyz * w + Cross(xyz, other.xyz),
|
||||
w * other.w - Dot(xyz, other.xyz) };
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
return Vec3(f, f, f);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} + T{})> operator+(const Vec3 &other) const {
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} + T{})> operator+(const Vec3 & other) const {
|
||||
return { x + other.x, y + other.y, z + other.z };
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} - T{})> operator-(const Vec3 &other) const {
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} - T{})> operator-(const Vec3 & other) const {
|
||||
return { x - other.x, y - other.y, z - other.z };
|
||||
}
|
||||
|
||||
@@ -88,12 +88,12 @@ public:
|
||||
return { -x, -y, -z };
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} * T{})> operator*(const Vec3 &other) const {
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} * T{})> operator*(const Vec3 & other) const {
|
||||
return { x * other.x, y * other.y, z * other.z };
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} * V{})> operator*(const V &f) const {
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} * V{})> operator*(const V & f) const {
|
||||
using TV = decltype(T{} * V{});
|
||||
using C = std::common_type_t<T, V>;
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
template <typename V>
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} / V{})> operator/(const V &f) const {
|
||||
[[nodiscard]] constexpr Vec3<decltype(T{} / V{})> operator/(const V & f) const {
|
||||
using TV = decltype(T{} / V{});
|
||||
using C = std::common_type_t<T, V>;
|
||||
|
||||
@@ -254,7 +254,7 @@ template <typename T>
|
||||
// linear interpolation via SceFloat: 0.0=begin, 1.0=end
|
||||
template <typename X>
|
||||
[[nodiscard]] constexpr decltype(X{} * SceFloat{} + X{} * SceFloat{})
|
||||
Lerp(const X &begin, const X &end, const SceFloat t) {
|
||||
Lerp(const X &begin, const X &end, const SceFloat t) {
|
||||
return begin * (1.f - t) + end * t;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
#elif defined(_MSC_VER)
|
||||
#define DISABLE_WARNING_PUSH __pragma(warning(push))
|
||||
#define DISABLE_WARNING_POP __pragma(warning(pop))
|
||||
#define DISABLE_WARNING_NO_PUSH(warningNumber, warningName) __pragma(warning(disable \
|
||||
: warningNumber))
|
||||
#define DISABLE_WARNING_NO_PUSH(warningNumber, warningName) __pragma(warning(disable : warningNumber))
|
||||
#else
|
||||
#define DISABLE_WARNING_PUSH
|
||||
#define DISABLE_WARNING_POP
|
||||
|
||||
@@ -34,9 +34,9 @@ static inline void cpuid(int output[4], int functionnumber, int ecxleaf) {
|
||||
#elif defined(__GNUC__) || defined(__clang__) // use inline assembly, Gnu/AT&T syntax
|
||||
int a, b, c, d;
|
||||
__asm("cpuid"
|
||||
: "=a"(a), "=b"(b), "=c"(c), "=d"(d)
|
||||
: "a"(functionnumber), "c"(ecxleaf)
|
||||
:);
|
||||
: "=a"(a), "=b"(b), "=c"(c), "=d"(d)
|
||||
: "a"(functionnumber), "c"(ecxleaf)
|
||||
:);
|
||||
output[0] = a;
|
||||
output[1] = b;
|
||||
output[2] = c;
|
||||
@@ -72,9 +72,9 @@ static inline uint64_t xgetbv(int ctr) {
|
||||
|
||||
uint32_t a, d;
|
||||
__asm("xgetbv"
|
||||
: "=a"(a), "=d"(d)
|
||||
: "c"(ctr)
|
||||
:);
|
||||
: "=a"(a), "=d"(d)
|
||||
: "c"(ctr)
|
||||
:);
|
||||
return a | (uint64_t(d) << 32);
|
||||
|
||||
#else // #elif defined (_WIN32) // other compiler. try inline assembly with masm/intel/MS syntax
|
||||
|
||||
Reference in New Issue
Block a user