Skip to content

Commit

Permalink
Update AddonsHelper.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishan09811 authored Feb 20, 2025
1 parent a62c8f5 commit 5d82ce3
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import kotlinx.serialization.json.Json
import io.github.mandarine3ds.mandarine.MandarineApplication
import io.github.mandarine3ds.mandarine.model.Mod
import io.github.mandarine3ds.mandarine.model.Addon
import io.github.mandarine3ds.mandarine.model.Update
import io.github.mandarine3ds.mandarine.model.DLC
import io.github.mandarine3ds.mandarine.model.Game
import java.io.IOException

Expand Down Expand Up @@ -81,17 +83,17 @@ object AddonsHelper {
}

fun getAddons(game: Game = Game(filename = ""), titleId: Long = 0L): List<Addon> {
val mods = getMods()
val mods = getMods().toMutableList()
val titleID = if (game.titleId != 0L) game.titleId else titleId

if (FileUtil.isUpdateExists(String.format("%016X", game.titleId)))
mods.add(Addon(title = "Update"))
mods.add(Update())
if (FileUtil.isDLCExists(String.format("%016X", game.titleId)))
mods.add(Addon(title = "DLC"))
mods.add(DLC())

return mods.filter { mod ->
mod.titleId.toInt() == titleID.toInt()
}
}.toList()
}

fun Addon.enable(value: Boolean) {
Expand Down

0 comments on commit 5d82ce3

Please sign in to comment.