Skip to content

Commit 260952e

Browse files
committed
refactor
1 parent f145366 commit 260952e

File tree

14 files changed

+96
-50
lines changed

14 files changed

+96
-50
lines changed

src/Cafe/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ add_library(CemuCafe
8383
HW/Espresso/Recompiler/PPCRecompilerImlGenFPU.cpp
8484
HW/Espresso/Recompiler/PPCRecompilerIml.h
8585
HW/Espresso/Recompiler/PPCRecompilerIntermediate.cpp
86-
HW/Espresso/Recompiler/RecompilerTests.cpp
8786
HW/Latte/Common/RegisterSerializer.cpp
8887
HW/Latte/Common/RegisterSerializer.h
8988
HW/Latte/Common/ShaderSerializer.cpp

src/Cafe/HW/Espresso/Recompiler/BackendAArch64/BackendAArch64.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class AArch64Allocator : public Allocator
6868
#else
6969
inline static Allocator s_allocator;
7070
#endif
71+
inline static std::mutex s_allocatorMutex;
7172
Allocator* m_allocatorImpl;
7273
bool m_freeDisabled = false;
7374

@@ -77,6 +78,7 @@ class AArch64Allocator : public Allocator
7778

7879
uint32* alloc(size_t size) override
7980
{
81+
std::lock_guard lock{s_allocatorMutex};
8082
return m_allocatorImpl->alloc(size);
8183
}
8284

@@ -87,8 +89,11 @@ class AArch64Allocator : public Allocator
8789

8890
void free(uint32* p) override
8991
{
90-
if (!m_freeDisabled)
91-
m_allocatorImpl->free(p);
92+
if (m_freeDisabled)
93+
return;
94+
95+
std::lock_guard lock{s_allocatorMutex};
96+
m_allocatorImpl->free(p);
9297
}
9398

9499
[[nodiscard]] bool useProtect() const override

src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,10 +2097,10 @@ void VulkanRenderer::SubmitCommandBuffer(VkSemaphore signalSemaphore, VkSemaphor
20972097
const VkPipelineStageFlags semWaitStageMask[2] = { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT };
20982098
VkSemaphore waitSemArray[2];
20992099
submitInfo.waitSemaphoreCount = 0;
2100-
if (m_numSubmittedCmdBuffers > 0)
2101-
waitSemArray[submitInfo.waitSemaphoreCount++] = prevSem; // wait on semaphore from previous submit
21022100
if (waitSemaphore != VK_NULL_HANDLE)
21032101
waitSemArray[submitInfo.waitSemaphoreCount++] = waitSemaphore;
2102+
if (m_numSubmittedCmdBuffers > 0)
2103+
waitSemArray[submitInfo.waitSemaphoreCount++] = prevSem; // wait on semaphore from previous submit
21042104
submitInfo.pWaitDstStageMask = semWaitStageMask;
21052105
submitInfo.pWaitSemaphores = waitSemArray;
21062106

src/Common/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define _XSTRINGFY(s) _STRINGFY(s)
88
#define _STRINGFY(s) #s
99

10-
#if EMULATOR_VERSION_MAJOR != 0
10+
#if EMULATOR_VERSION_MAJOR != 0 || EMULATOR_VERSION_MINOR != 0
1111
#define BUILD_VERSION_WITH_NAME_STRING (EMULATOR_NAME " " _XSTRINGFY(EMULATOR_VERSION_MAJOR) "." _XSTRINGFY(EMULATOR_VERSION_MINOR) EMULATOR_VERSION_SUFFIX)
1212
#define BUILD_VERSION_STRING (_XSTRINGFY(EMULATOR_VERSION_MAJOR) "." _XSTRINGFY(EMULATOR_VERSION_MINOR) EMULATOR_VERSION_SUFFIX)
1313
#else

src/android/app/build.gradle.kts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ android {
9090
debug {
9191
applicationIdSuffix = ".debug"
9292
}
93-
create("githubRelease") {
93+
create("github") {
9494
if (keystoreFilePath != null) {
9595
initWith(getByName("release"))
9696
isMinifyEnabled = true
@@ -177,16 +177,16 @@ abstract class ComputeCemuDataFilesHashTask : DefaultTask() {
177177
assetDir.mkdirs()
178178
}
179179

180-
val cemuDataFilesFile = File(project.projectDir, cemuDataFolder.get())
180+
val cemuDataFilesDir = File(project.projectDir, cemuDataFolder.get())
181181
val hashFile = File(assetDir, "hash.txt")
182182
val md = MessageDigest.getInstance("SHA-256")
183183

184-
if (!cemuDataFilesFile.isDirectory) {
184+
if (!cemuDataFilesDir.isDirectory) {
185185
hashFile.writeText("invalid")
186186
return
187187
}
188188

189-
val fileHashes = cemuDataFilesFile.walkTopDown()
189+
val fileHashes = cemuDataFilesDir.walkTopDown()
190190
.filter { it.isFile && !isFileIgnored(it) }
191191
.sortedBy { it.path }
192192
.map {
@@ -204,10 +204,10 @@ abstract class ComputeCemuDataFilesHashTask : DefaultTask() {
204204
}
205205
}
206206

207-
tasks.register<ComputeCemuDataFilesHashTask>("computeCemuDataFilesHash") {
207+
val computeCemuDataFilesHashTask =tasks.register<ComputeCemuDataFilesHashTask>("computeCemuDataFilesHash") {
208208
cemuDataFolder = cemuDataFilesFolder
209209
}
210-
tasks.preBuild.dependsOn("computeCemuDataFilesHash")
210+
tasks.preBuild.dependsOn(computeCemuDataFilesHashTask)
211211

212212
dependencies {
213213
implementation(libs.androidx.lifecycle.runtime.ktx)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<application tools:remove="android:icon,android:roundIcon" />
6+
</manifest>

src/android/app/src/main/cpp/JNIUtils.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,3 @@ jobject JNIUtils::createJavaStringArrayList(JNIEnv* env, const std::vector<std::
8787
}
8888
return arrayListObject;
8989
}
90-
91-
void JNIUtils::fiberSafeJNICall(const std::function<void(JNIEnv*)>& func)
92-
{
93-
std::thread([&]() {
94-
ScopedJNIENV env;
95-
func(*env);
96-
}).join();
97-
}

src/android/app/src/main/cpp/JNIUtils.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,5 +191,11 @@ namespace JNIUtils
191191
return obj;
192192
}
193193

194-
void fiberSafeJNICall(const std::function<void(JNIEnv*)>& func);
194+
inline void fiberSafeJNICall(const std::function<void(JNIEnv*)>& func)
195+
{
196+
std::thread([&]() {
197+
ScopedJNIENV env;
198+
func(*env);
199+
}).join();
200+
}
195201
} // namespace JNIUtils

src/android/app/src/main/cpp/NativeSettings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ Java_info_cemu_cemu_nativeinterface_NativeSettings_getCustomDriverPath(JNIEnv* e
348348
extern "C" [[maybe_unused]] JNIEXPORT void JNICALL
349349
Java_info_cemu_cemu_nativeinterface_NativeSettings_setCustomDriverPath(JNIEnv* env, [[maybe_unused]] jclass clazz, jstring custom_driver_path)
350350
{
351-
throw std::runtime_error("todo");
352351
g_config.data().custom_driver_path = JNIUtils::toString(env, custom_driver_path);
353352
}
354353

src/android/app/src/main/cpp/WuaConverter.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@ void WuaConverter::startConversion(int fd, std::unique_ptr<CompressTitleCallback
2121
callbacks->onError();
2222
return;
2323
}
24-
25-
struct ScopedFd
26-
{
27-
int fd;
28-
~ScopedFd()
29-
{
30-
close(fd);
31-
}
32-
} scopedFd{.fd = fd};
24+
stdx::scope_exit fdCleanup([fd](){ close(fd); });
3325

3426
if (m_started)
3527
return;

0 commit comments

Comments
 (0)