[Lint] Added InsertBraces to linter to unify codebase to one standard

This commit is contained in:
Gliniak
2026-05-08 18:47:25 +02:00
parent 2c68a2fc4b
commit 74f34818e7
39 changed files with 426 additions and 170 deletions

View File

@@ -1446,15 +1446,18 @@ void KernelState::SetProcessTLSVars(X_KPROCESS* process, int num_slots,
}
// set remainder of bitset
if (((num_slots + 3) & 0x1C) != 0)
if (((num_slots + 3) & 0x1C) != 0) {
process->tls_slot_bitmap[count_div32] = -1
<< (32 - ((num_slots + 3) & 0x1C));
}
}
void AllocateThread(PPCContext* context) {
uint32_t thread_mem_size = static_cast<uint32_t>(context->r[3]);
uint32_t a2 = static_cast<uint32_t>(context->r[4]);
uint32_t a3 = static_cast<uint32_t>(context->r[5]);
if (thread_mem_size <= 0xFD8) thread_mem_size += 8;
if (thread_mem_size <= 0xFD8) {
thread_mem_size += 8;
}
uint32_t result =
xboxkrnl::xeAllocatePoolTypeWithTag(context, thread_mem_size, a2, a3);
if (((unsigned short)result & 0xFFF) != 0) {

View File

@@ -589,8 +589,9 @@ void GamercardUI::OnDraw(ImGuiIO& io) {
dialog_open = false;
}
if (!is_valid_gamertag) {
if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip))
if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip)) {
ImGui::SetTooltip("Saving disabled! Invalid gamertag provided.");
}
}
ImGui::EndDisabled();

View File

@@ -524,7 +524,9 @@ dword_result_t XamShowDeviceSelectorUI_entry(
// Default to the first storage device (HDD) if headless.
return xeXamDispatchHeadless(
[device_id_ptr, devices]() -> X_RESULT {
if (devices.empty()) return X_ERROR_CANCELLED;
if (devices.empty()) {
return X_ERROR_CANCELLED;
}
const DummyDeviceInfo* device_info = devices.front();
*device_id_ptr = static_cast<uint32_t>(device_info->device_id);
@@ -535,7 +537,9 @@ dword_result_t XamShowDeviceSelectorUI_entry(
auto close = [device_id_ptr, devices](MessageBoxDialog* dialog) -> X_RESULT {
uint32_t button = dialog->chosen_button();
if (button >= devices.size()) return X_ERROR_CANCELLED;
if (button >= devices.size()) {
return X_ERROR_CANCELLED;
}
const DummyDeviceInfo* device_info = devices.at(button);
*device_id_ptr = static_cast<uint32_t>(device_info->device_id);
@@ -911,7 +915,9 @@ X_RESULT xeXamShowSigninUI(uint32_t user_index, uint32_t users_needed,
UserProfile* profile = kernel_state()->xam_state()->GetUserProfile(i);
if (profile) {
xuids[i] = profile->xuid();
if (xuids.size() >= users_needed) break;
if (xuids.size() >= users_needed) {
break;
}
}
}

View File

@@ -388,9 +388,10 @@ DECLARE_XBOXKRNL_EXPORT1(KeSetDisableBoostThread, kThreading, kImplemented);
uint32_t xeKeGetCurrentProcessType(cpu::ppc::PPCContext* context) {
auto pcr = context->TranslateVirtualGPR<X_KPCR*>(context->r[13]);
if (!pcr->prcb_data.dpc_active)
if (!pcr->prcb_data.dpc_active) {
return context->TranslateVirtual(pcr->prcb_data.current_thread)
->process_type;
}
return pcr->processtype_value_in_dpc;
}
void xeKeSetCurrentProcessType(uint32_t type, cpu::ppc::PPCContext* context) {

View File

@@ -32,14 +32,22 @@ static inline u128 u128_sub(u128 a, uint64_t b) {
}
static inline u128 u128_shl(u128 v, int s) {
if (s == 0) return v;
if (s >= 64) return {0, v.lo << (s - 64)};
if (s == 0) {
return v;
}
if (s >= 64) {
return {0, v.lo << (s - 64)};
}
return {v.lo << s, (v.hi << s) | (v.lo >> (64 - s))};
}
static inline u128 u128_shr(u128 v, int s) {
if (s == 0) return v;
if (s >= 64) return {v.hi >> (s - 64), 0};
if (s == 0) {
return v;
}
if (s >= 64) {
return {v.hi >> (s - 64), 0};
}
return {(v.lo >> s) | (v.hi << (64 - s)), v.hi >> s};
}
@@ -60,8 +68,12 @@ static inline u128 u128_mul64(uint64_t a, uint64_t b) {
uint64_t mid = p1 + (p0 >> 32);
uint64_t mid_carry = 0;
uint64_t mid2 = mid + p2;
if (mid < p1) mid_carry++;
if (mid2 < mid) mid_carry++;
if (mid < p1) {
mid_carry++;
}
if (mid2 < mid) {
mid_carry++;
}
u128 r;
r.lo = (mid2 << 32) | (p0 & 0xFFFFFFFF);
@@ -98,7 +110,9 @@ static inline uint64_t u128_div64(u128 num, uint64_t den, uint64_t* rem) {
// Count leading zeros - portable
static inline int clz64(uint64_t v) {
if (v == 0) return 64;
if (v == 0) {
return 64;
}
int n = 0;
if ((v & 0xFFFFFFFF00000000ULL) == 0) {
n += 32;
@@ -127,7 +141,9 @@ static inline int clz64(uint64_t v) {
}
static inline int clz32(uint32_t v) {
if (v == 0) return 32;
if (v == 0) {
return 32;
}
int n = 0;
if ((v & 0xFFFF0000U) == 0) {
n += 16;
@@ -193,8 +209,12 @@ class BigNum {
for (size_t i = n; i > 0; i--) {
uint64_t al = (i - 1 < an) ? a.limbs[i - 1] : 0;
uint64_t bl = (i - 1 < bn) ? b.limbs[i - 1] : 0;
if (al < bl) return -1;
if (al > bl) return 1;
if (al < bl) {
return -1;
}
if (al > bl) {
return 1;
}
}
return 0;
}
@@ -234,7 +254,9 @@ class BigNum {
}
static BigNum mod(const BigNum& a, const BigNum& m) {
if (compare(a, m) < 0) return a;
if (compare(a, m) < 0) {
return a;
}
size_t n = m.limbs.size();
size_t total = a.limbs.size();
@@ -273,7 +295,9 @@ class BigNum {
}
u.limbs[total] = carry;
} else {
for (size_t i = 0; i < total; i++) u.limbs[i] = a.limbs[i];
for (size_t i = 0; i < total; i++) {
u.limbs[i] = a.limbs[i];
}
u.limbs[total] = 0;
}
@@ -302,11 +326,15 @@ class BigNum {
u128 qv2 = u128_mul64(qhat_val, vn_2);
u128 rhs = u128_or64(u128_shl(u128_from(rhat_val), 64), u.limbs[j - 2]);
bool gt = (qv2.hi > rhs.hi) || (qv2.hi == rhs.hi && qv2.lo > rhs.lo);
if (!gt) break;
if (!gt) {
break;
}
qhat_val--;
uint64_t old_rhat = rhat_val;
rhat_val += vn_1;
if (rhat_val < old_rhat) break;
if (rhat_val < old_rhat) {
break;
}
}
uint64_t carry = 0;
@@ -317,7 +345,9 @@ class BigNum {
carry = prod.hi;
uint64_t u_val = u.limbs[j - n + i];
u.limbs[j - n + i] = u_val - prod_lo;
if (u_val < prod_lo) carry++;
if (u_val < prod_lo) {
carry++;
}
}
int64_t final_diff =
static_cast<int64_t>(u.limbs[j]) - static_cast<int64_t>(carry);
@@ -345,7 +375,9 @@ class BigNum {
carry = u.limbs[i - 1] & ((1ULL << shift) - 1);
}
} else {
for (size_t i = 0; i < n; i++) r.limbs[i] = u.limbs[i];
for (size_t i = 0; i < n; i++) {
r.limbs[i] = u.limbs[i];
}
}
r.trim();

View File

@@ -293,13 +293,17 @@ class object_ref {
}
explicit object_ref(const object_ref& right) noexcept {
reset(right.get());
if (value_) value_->Retain();
if (value_) {
value_->Retain();
}
}
template <class V>
requires std::is_convertible_v<V*, T*>
object_ref(const object_ref<V>& right) noexcept {
reset(right.get());
if (value_) value_->Retain();
if (value_) {
value_->Retain();
}
}
object_ref(object_ref&& right) noexcept : value_(right.release()) {}
@@ -395,7 +399,9 @@ object_ref<T> make_object(Args&&... args) {
template <typename T>
object_ref<T> retain_object(T* ptr) {
if (ptr) ptr->Retain();
if (ptr) {
ptr->Retain();
}
return object_ref<T>(ptr);
}

View File

@@ -719,9 +719,13 @@ void XThread::SetPriority(int32_t increment) {
}
void XThread::CheckQuantumAndDecay() {
if (cvars::ignore_thread_priorities) return;
if (cvars::ignore_thread_priorities) {
return;
}
// Real-time threads (current priority >= 0x12) don't decay on Xenon.
if (priority_ >= 18) return;
if (priority_ >= 18) {
return;
}
uint64_t now = Clock::QueryHostUptimeMillis();
uint64_t elapsed = now - quantum_start_ms_;
@@ -731,7 +735,9 @@ void XThread::CheckQuantumAndDecay() {
// effective priority by exactly 1 and resets quantum. We approximate
// this by decaying 1 priority level per 20ms of elapsed wall-clock time.
constexpr uint64_t kQuantumPeriodMs = 20;
if (elapsed < kQuantumPeriodMs) return;
if (elapsed < kQuantumPeriodMs) {
return;
}
int32_t decay_steps = static_cast<int32_t>(elapsed / kQuantumPeriodMs);
// On the first decay step, drain the accumulated priority boost as well.
@@ -756,7 +762,9 @@ void XThread::CheckQuantumAndDecay() {
}
void XThread::BoostOnWake(int32_t increment) {
if (cvars::ignore_thread_priorities) return;
if (cvars::ignore_thread_priorities) {
return;
}
// Real-time threads (priority >= 0x12) just get their quantum reset.
if (priority_ >= 18) {