mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
Games: revamped add games feature (#492)
Adding and managing your own (non-Steam) games moves out of the Steam settings into the Games tab, and works like Steam's own non-Steam Properties. - A + beside "Games N" opens a compact in-app picker: the storage first, then that storage's root, every folder, .exe files only. Picking an exe adds the game with its name, art, Custom badge and Steam shortcut. - "Add all games in this folder" adds every game folder inside at once. A summary opens immediately and fills in as each game is found, with a "?" where the exe was a close call and a red X to remove a game. - An edit button on each Custom game opens its editor: Name, Target (ranked exes, Other exe…), Start in, Launch options, the four pieces of art with thumbnails, and Remove. Edits go through the same Steam shortcut, so the appid never changes and nothing duplicates. - Art chooser per piece: images in the game folder, Steam's official art, SteamGridDB alternatives, your own image, or back to automatic. - Finding the exe: up to five folders deep, every exe scored (name match, Unreal -Shipping builds, bin folders and size up; launchers, crash reporters, installers, redistributables and depth down). - Real titles from the game's files (Steam manifest, GOG info, the exe's version info), keeping the folder's spacing when both spell the same title, underscores read as spaces. - Art: the exact Steam appid when the game names one, strict name matches otherwise, Steam's hashed asset paths for newer games, SteamGridDB as a fallback (built-in key from the SGDB_API_KEY secret, optional own key in Setup, sealed with the Keystore), and a cover made from the exe's icon when nothing else has one. - Removing a game is instant and keeps its files; adding it again brings it back. Steam's shortcut list is rewritten once, in the background. - The Games section is gone from Steam settings; folders added before keep listing their games. Artwork switch and SteamGridDB key are in Setup.
This commit is contained in:
1 parent
d99ed8e00b
commit
d250b43eb9
45 files changed
+4175
-295
No files matched your search
@@ -0,0 +1,52 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Assume.assumeFalse
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
/** What the in-app picker lists in a folder: every folder A-Z, then only the files asked for. */
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class PickListingTest {
|
||||
@get:Rule val tmp = TemporaryFolder()
|
||||
|
||||
private fun storage(): File {
|
||||
val root = tmp.newFolder("emulated0")
|
||||
for (d in listOf("Download", "Android", "DCIM", "Games", "Documents", "Winlator", ".thumbnails", "alarms")) File(root, d).mkdirs()
|
||||
for (f in listOf("Setup.exe", "game.EXE", "cover.jpg", "notes.txt", "logo.PNG", "icon.ico", "hero.webp", ".hidden.exe")) File(root, f).writeText("x")
|
||||
return root
|
||||
}
|
||||
|
||||
@Test fun everyFolderIsListedAToZAndDotFoldersAreNot() {
|
||||
val listing = pickListing(storage(), PickKind.EXE)
|
||||
assertEquals(listOf("alarms", "Android", "DCIM", "Documents", "Download", "Games", "Winlator"), listing.folders.map { it.dir.name })
|
||||
}
|
||||
|
||||
@Test fun onlyExesForAGameOnlyImagesForArt() {
|
||||
val root = storage()
|
||||
assertEquals(listOf("game.EXE", "Setup.exe"), pickListing(root, PickKind.EXE).files.map { it.name })
|
||||
assertEquals(listOf("cover.jpg", "hero.webp", "icon.ico", "logo.PNG"), pickListing(root, PickKind.IMAGE).files.map { it.name })
|
||||
}
|
||||
|
||||
@Test fun aFolderTheAppCannotReadIsListedButMarked() {
|
||||
val root = storage()
|
||||
val locked = File(root, "Android")
|
||||
locked.setReadable(false, false)
|
||||
try {
|
||||
assumeFalse("running as root reads everything", locked.list() != null)
|
||||
val folders = pickListing(root, PickKind.EXE).folders.associate { it.dir.name to it.readable }
|
||||
assertFalse(folders.getValue("Android"))
|
||||
assertTrue(folders.getValue("Download"))
|
||||
} finally {
|
||||
locked.setReadable(true, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user