-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to view achievement list while running a ROM
- Loading branch information
1 parent
d45e1a7
commit a24a99f
Showing
13 changed files
with
335 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/me/magnum/melonds/ui/emulator/EmulatorRetroAchievementsViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package me.magnum.melonds.ui.emulator | ||
|
||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import me.magnum.melonds.domain.model.Rom | ||
import me.magnum.melonds.domain.repositories.RetroAchievementsRepository | ||
import me.magnum.melonds.domain.repositories.SettingsRepository | ||
import me.magnum.melonds.impl.emulator.EmulatorSession | ||
import me.magnum.melonds.ui.common.viewmodel.RetroAchievementsViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class EmulatorRetroAchievementsViewModel @Inject constructor( | ||
retroAchievementsRepository: RetroAchievementsRepository, | ||
settingsRepository: SettingsRepository, | ||
private val emulatorSession: EmulatorSession, | ||
) : RetroAchievementsViewModel(retroAchievementsRepository, settingsRepository) { | ||
|
||
override fun getRom(): Rom { | ||
val romSession = emulatorSession.currentSessionType() as? EmulatorSession.SessionType.RomSession | ||
if (romSession == null) { | ||
error("Emulator must be running a ROM session") | ||
} | ||
|
||
return romSession.rom | ||
} | ||
} |
Oops, something went wrong.