Skip to content

Commit 5a12814

Browse files
committed
[HACK] Disable NexusRevolution threads
These threads thrashing the CPU. Disable them to save battery.
1 parent 642b70c commit 5a12814

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/core/thread.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: GPL-2.0-or-later
33

44
#include "common/alignment.h"
5+
#include "common/elf_info.h"
56
#include "core/libraries/kernel/threads/pthread.h"
67
#include "thread.h"
78

@@ -63,13 +64,25 @@ NativeThread::NativeThread() : native_handle{0} {}
6364

6465
NativeThread::~NativeThread() {}
6566

67+
#ifndef _WIN64
68+
void sleep_forever(void*) {
69+
sleep(INT_MAX);
70+
}
71+
#endif
72+
6673
int NativeThread::Create(ThreadFunc func, void* arg, const ::Libraries::Kernel::PthreadAttr* attr) {
6774
#ifndef _WIN64
6875
pthread_t* pthr = reinterpret_cast<pthread_t*>(&native_handle);
6976
pthread_attr_t pattr;
7077
pthread_attr_init(&pattr);
7178
pthread_attr_setstack(&pattr, attr->stackaddr_attr, attr->stacksize_attr);
72-
return pthread_create(pthr, &pattr, (PthreadFunc)func, arg);
79+
const auto& elf_info = Common::ElfInfo::Instance();
80+
if (elf_info.Title().contains("Bloodborne") &&
81+
((Libraries::Kernel::Pthread*)arg)->name.contains("Nexus")) {
82+
return pthread_create(pthr, &pattr, (PthreadFunc)sleep_forever, arg);
83+
} else {
84+
return pthread_create(pthr, &pattr, (PthreadFunc)func, arg);
85+
}
7386
#else
7487
CLIENT_ID clientId{};
7588
INITIAL_TEB teb{};

0 commit comments

Comments
 (0)