summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/app/build.gradle.kts2
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt35
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp4
-rw-r--r--src/core/hle/service/service.h4
-rw-r--r--src/core/hle/service/sockets/bsd.cpp5
-rw-r--r--src/core/hle/service/sockets/bsd.h3
-rw-r--r--src/yuzu/game_list_worker.cpp23
7 files changed, 54 insertions, 22 deletions
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts
index a8db70511..fe79a701c 100644
--- a/src/android/app/build.gradle.kts
+++ b/src/android/app/build.gradle.kts
@@ -95,6 +95,7 @@ android {
95 // builds a release build that doesn't need signing 95 // builds a release build that doesn't need signing
96 // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build. 96 // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
97 register("relWithDebInfo") { 97 register("relWithDebInfo") {
98 isDefault = true
98 resValue("string", "app_name_suffixed", "yuzu Debug Release") 99 resValue("string", "app_name_suffixed", "yuzu Debug Release")
99 signingConfig = signingConfigs.getByName("debug") 100 signingConfig = signingConfigs.getByName("debug")
100 isMinifyEnabled = true 101 isMinifyEnabled = true
@@ -122,6 +123,7 @@ android {
122 flavorDimensions.add("version") 123 flavorDimensions.add("version")
123 productFlavors { 124 productFlavors {
124 create("mainline") { 125 create("mainline") {
126 isDefault = true
125 dimension = "version" 127 dimension = "version"
126 buildConfigField("Boolean", "PREMIUM", "false") 128 buildConfigField("Boolean", "PREMIUM", "false")
127 } 129 }
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt
index f8e7eeca7..f71d0a098 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt
@@ -11,6 +11,7 @@ import kotlinx.serialization.json.Json
11import org.yuzu.yuzu_emu.NativeLibrary 11import org.yuzu.yuzu_emu.NativeLibrary
12import org.yuzu.yuzu_emu.YuzuApplication 12import org.yuzu.yuzu_emu.YuzuApplication
13import org.yuzu.yuzu_emu.model.Game 13import org.yuzu.yuzu_emu.model.Game
14import org.yuzu.yuzu_emu.model.MinimalDocumentFile
14 15
15object GameHelper { 16object GameHelper {
16 const val KEY_GAME_PATH = "game_path" 17 const val KEY_GAME_PATH = "game_path"
@@ -29,15 +30,7 @@ object GameHelper {
29 // Ensure keys are loaded so that ROM metadata can be decrypted. 30 // Ensure keys are loaded so that ROM metadata can be decrypted.
30 NativeLibrary.reloadKeys() 31 NativeLibrary.reloadKeys()
31 32
32 val children = FileUtil.listFiles(context, gamesUri) 33 addGamesRecursive(games, FileUtil.listFiles(context, gamesUri), 3)
33 for (file in children) {
34 if (!file.isDirectory) {
35 // Check that the file has an extension we care about before trying to read out of it.
36 if (Game.extensions.contains(FileUtil.getExtension(file.uri))) {
37 games.add(getGame(file.uri))
38 }
39 }
40 }
41 34
42 // Cache list of games found on disk 35 // Cache list of games found on disk
43 val serializedGames = mutableSetOf<String>() 36 val serializedGames = mutableSetOf<String>()
@@ -52,6 +45,30 @@ object GameHelper {
52 return games.toList() 45 return games.toList()
53 } 46 }
54 47
48 private fun addGamesRecursive(
49 games: MutableList<Game>,
50 files: Array<MinimalDocumentFile>,
51 depth: Int
52 ) {
53 if (depth <= 0) {
54 return
55 }
56
57 files.forEach {
58 if (it.isDirectory) {
59 addGamesRecursive(
60 games,
61 FileUtil.listFiles(YuzuApplication.appContext, it.uri),
62 depth - 1
63 )
64 } else {
65 if (Game.extensions.contains(FileUtil.getExtension(it.uri))) {
66 games.add(getGame(it.uri))
67 }
68 }
69 }
70 }
71
55 private fun getGame(uri: Uri): Game { 72 private fun getGame(uri: Uri): Game {
56 val filePath = uri.toString() 73 val filePath = uri.toString()
57 var name = NativeLibrary.getTitle(filePath) 74 var name = NativeLibrary.getTitle(filePath)
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 07e570a9f..7d7bb8687 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -204,9 +204,11 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) {
204 if (!mapping->fixed) { 204 if (!mapping->fixed) {
205 auto& allocator{mapping->big_page ? *vm.big_page_allocator : *vm.small_page_allocator}; 205 auto& allocator{mapping->big_page ? *vm.big_page_allocator : *vm.small_page_allocator};
206 u32 page_size_bits{mapping->big_page ? vm.big_page_size_bits : VM::PAGE_SIZE_BITS}; 206 u32 page_size_bits{mapping->big_page ? vm.big_page_size_bits : VM::PAGE_SIZE_BITS};
207 u32 page_size{mapping->big_page ? vm.big_page_size : VM::YUZU_PAGESIZE};
208 u64 aligned_size{Common::AlignUp(mapping->size, page_size)};
207 209
208 allocator.Free(static_cast<u32>(mapping->offset >> page_size_bits), 210 allocator.Free(static_cast<u32>(mapping->offset >> page_size_bits),
209 static_cast<u32>(mapping->size >> page_size_bits)); 211 static_cast<u32>(aligned_size >> page_size_bits));
210 } 212 }
211 213
212 // Sparse mappings shouldn't be fully unmapped, just returned to their sparse state 214 // Sparse mappings shouldn't be fully unmapped, just returned to their sparse state
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 45b2c43b7..d539ed0f4 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -79,8 +79,8 @@ protected:
79 using HandlerFnP = void (Self::*)(HLERequestContext&); 79 using HandlerFnP = void (Self::*)(HLERequestContext&);
80 80
81 /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread. 81 /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
82 [[nodiscard]] std::scoped_lock<std::mutex> LockService() { 82 [[nodiscard]] virtual std::unique_lock<std::mutex> LockService() {
83 return std::scoped_lock{lock_service}; 83 return std::unique_lock{lock_service};
84 } 84 }
85 85
86 /// System context that the service operates under. 86 /// System context that the service operates under.
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index 11f8efbac..d8509c1dd 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -1029,6 +1029,11 @@ BSD::~BSD() {
1029 } 1029 }
1030} 1030}
1031 1031
1032std::unique_lock<std::mutex> BSD::LockService() {
1033 // Do not lock socket IClient instances.
1034 return {};
1035}
1036
1032BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} { 1037BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
1033 // clang-format off 1038 // clang-format off
1034 static const FunctionInfo functions[] = { 1039 static const FunctionInfo functions[] = {
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h
index 430edb97c..161f22b9b 100644
--- a/src/core/hle/service/sockets/bsd.h
+++ b/src/core/hle/service/sockets/bsd.h
@@ -186,6 +186,9 @@ private:
186 186
187 // Callback identifier for the OnProxyPacketReceived event. 187 // Callback identifier for the OnProxyPacketReceived event.
188 Network::RoomMember::CallbackHandle<Network::ProxyPacket> proxy_packet_received; 188 Network::RoomMember::CallbackHandle<Network::ProxyPacket> proxy_packet_received;
189
190protected:
191 virtual std::unique_lock<std::mutex> LockService() override;
189}; 192};
190 193
191class BSDCFG final : public ServiceFramework<BSDCFG> { 194class BSDCFG final : public ServiceFramework<BSDCFG> {
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 9404365b4..e7fb8a282 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -191,8 +191,9 @@ QString FormatPatchNameVersions(const FileSys::PatchManager& patch_manager,
191} 191}
192 192
193QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::string& name, 193QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::string& name,
194 const std::vector<u8>& icon, Loader::AppLoader& loader, 194 const std::size_t size, const std::vector<u8>& icon,
195 u64 program_id, const CompatibilityList& compatibility_list, 195 Loader::AppLoader& loader, u64 program_id,
196 const CompatibilityList& compatibility_list,
196 const FileSys::PatchManager& patch) { 197 const FileSys::PatchManager& patch) {
197 const auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id); 198 const auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
198 199
@@ -210,7 +211,7 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
210 file_type_string, program_id), 211 file_type_string, program_id),
211 new GameListItemCompat(compatibility), 212 new GameListItemCompat(compatibility),
212 new GameListItem(file_type_string), 213 new GameListItem(file_type_string),
213 new GameListItemSize(Common::FS::GetSize(path)), 214 new GameListItemSize(size),
214 }; 215 };
215 216
216 const auto patch_versions = GetGameListCachedObject( 217 const auto patch_versions = GetGameListCachedObject(
@@ -278,8 +279,8 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
278 GetMetadataFromControlNCA(patch, *control, icon, name); 279 GetMetadataFromControlNCA(patch, *control, icon, name);
279 } 280 }
280 281
281 emit EntryReady(MakeGameListEntry(file->GetFullPath(), name, icon, *loader, program_id, 282 emit EntryReady(MakeGameListEntry(file->GetFullPath(), name, file->GetSize(), icon, *loader,
282 compatibility_list, patch), 283 program_id, compatibility_list, patch),
283 parent_dir); 284 parent_dir);
284 } 285 }
285} 286}
@@ -354,8 +355,9 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa
354 const FileSys::PatchManager patch{id, system.GetFileSystemController(), 355 const FileSys::PatchManager patch{id, system.GetFileSystemController(),
355 system.GetContentProvider()}; 356 system.GetContentProvider()};
356 357
357 emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, id, 358 emit EntryReady(MakeGameListEntry(physical_name, name,
358 compatibility_list, patch), 359 Common::FS::GetSize(physical_name), icon,
360 *loader, id, compatibility_list, patch),
359 parent_dir); 361 parent_dir);
360 } 362 }
361 } else { 363 } else {
@@ -368,9 +370,10 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa
368 const FileSys::PatchManager patch{program_id, system.GetFileSystemController(), 370 const FileSys::PatchManager patch{program_id, system.GetFileSystemController(),
369 system.GetContentProvider()}; 371 system.GetContentProvider()};
370 372
371 emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, 373 emit EntryReady(
372 program_id, compatibility_list, patch), 374 MakeGameListEntry(physical_name, name, Common::FS::GetSize(physical_name),
373 parent_dir); 375 icon, *loader, program_id, compatibility_list, patch),
376 parent_dir);
374 } 377 }
375 } 378 }
376 } else if (is_dir) { 379 } else if (is_dir) {