mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 15:15:30 +03:00
Fix occurrence of multiple headers in game list + Make TinyXML2 Static
This commit mainly fixes multiple headers in the game list, which was caused by using the wrong variable for the recursive function. In addition, it makes TinyXML2 statically linked to libskyline which makes it the lone shared objects present in APKs.
This commit is contained in:
parent
72272fa4c2
commit
820bbaede5
@ -3,9 +3,11 @@ project(Skyline LANGUAGES CXX ASM VERSION 0.3)
|
|||||||
|
|
||||||
set(BUILD_TESTS OFF)
|
set(BUILD_TESTS OFF)
|
||||||
set(BUILD_TESTING OFF)
|
set(BUILD_TESTING OFF)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
|
|
||||||
set(source_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp)
|
set(source_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto=full -Wno-unused-command-line-argument")
|
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto=full -Wno-unused-command-line-argument")
|
||||||
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||||
|
@ -38,32 +38,32 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
|
|||||||
Snackbar.make(findViewById(android.R.id.content), text, Snackbar.LENGTH_SHORT).show()
|
Snackbar.make(findViewById(android.R.id.content), text, Snackbar.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findFile(ext: String, loader: BaseLoader, directory: DocumentFile, entries: Int = 0): Int {
|
private fun findFile(ext: String, loader: BaseLoader, directory: DocumentFile, found: Boolean = false): Boolean {
|
||||||
var entryCount = entries
|
var foundCurrent = found
|
||||||
|
|
||||||
directory.listFiles()
|
directory.listFiles()
|
||||||
.forEach { file ->
|
.forEach { file ->
|
||||||
if (file.isDirectory) {
|
if (file.isDirectory) {
|
||||||
entryCount = findFile(ext, loader, file, entries)
|
foundCurrent = findFile(ext, loader, file, foundCurrent)
|
||||||
} else {
|
} else {
|
||||||
if (ext.equals(file.name?.substringAfterLast("."), ignoreCase = true)) {
|
if (ext.equals(file.name?.substringAfterLast("."), ignoreCase = true)) {
|
||||||
val document = RandomAccessDocument(this, file)
|
val document = RandomAccessDocument(this, file)
|
||||||
if (loader.verifyFile(document)) {
|
if (loader.verifyFile(document)) {
|
||||||
val entry = loader.getTitleEntry(document, file.uri)
|
val entry = loader.getTitleEntry(document, file.uri)
|
||||||
val header = (entryCount == 0)
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (header)
|
if (!foundCurrent) {
|
||||||
adapter.addHeader(getString(R.string.nro))
|
adapter.addHeader(getString(R.string.nro))
|
||||||
|
foundCurrent = true
|
||||||
|
}
|
||||||
adapter.addItem(GameItem(entry))
|
adapter.addItem(GameItem(entry))
|
||||||
}
|
}
|
||||||
entryCount++
|
|
||||||
}
|
}
|
||||||
document.close()
|
document.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return entryCount
|
return foundCurrent
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshFiles(tryLoad: Boolean) {
|
private fun refreshFiles(tryLoad: Boolean) {
|
||||||
@ -77,12 +77,12 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
|
|||||||
}
|
}
|
||||||
thread(start = true) {
|
thread(start = true) {
|
||||||
val snackbar = Snackbar.make(findViewById(android.R.id.content), getString(R.string.searching_roms), Snackbar.LENGTH_INDEFINITE)
|
val snackbar = Snackbar.make(findViewById(android.R.id.content), getString(R.string.searching_roms), Snackbar.LENGTH_INDEFINITE)
|
||||||
runOnUiThread {snackbar.show()}
|
runOnUiThread { snackbar.show() }
|
||||||
try {
|
try {
|
||||||
runOnUiThread{adapter.clear()}
|
runOnUiThread { adapter.clear() }
|
||||||
val entries = findFile("nro", NroLoader(this), DocumentFile.fromTreeUri(this, Uri.parse(sharedPreferences.getString("search_location", "")))!!)
|
val foundNros = findFile("nro", NroLoader(this), DocumentFile.fromTreeUri(this, Uri.parse(sharedPreferences.getString("search_location", "")))!!)
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (entries == 0)
|
if (!foundNros)
|
||||||
adapter.addHeader(getString(R.string.no_rom))
|
adapter.addHeader(getString(R.string.no_rom))
|
||||||
try {
|
try {
|
||||||
adapter.save(File("${applicationInfo.dataDir}/roms.bin"))
|
adapter.save(File("${applicationInfo.dataDir}/roms.bin"))
|
||||||
@ -103,7 +103,7 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
|
|||||||
notifyUser(e.message!!)
|
notifyUser(e.message!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
runOnUiThread {snackbar.dismiss()}
|
runOnUiThread { snackbar.dismiss() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user