Skip to content

Commit

Permalink
Configure PPSSPP RetroAchievements (#865)
Browse files Browse the repository at this point in the history
* Configure PPSSPP RetroAchievements
* Added configuration for PPSSPP RetroAchievements
* Added toggle for Hardcore Mode
* Tidied up emuDeckPPSSPP.sh by using iniFieldUpdate when possible
* Updated ppsspp.ini to 1.16.1, any additional configuration changes are PPSSPP defaults

* Remove extraneous PPSSPP configs

* Remove VR section

---------

Co-authored-by: Dragoon Dorise <[email protected]>
  • Loading branch information
rawdatafeel and dragoonDorise authored Dec 29, 2023
1 parent 94efced commit f48061f
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 4 deletions.
22 changes: 22 additions & 0 deletions configs/org.ppsspp.PPSSPP/config/ppsspp/PSP/SYSTEM/ppsspp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,12 @@ SCEUTILEnabled = True
SCEUTILLevel = 2
SCEMISCEnabled = True
SCEMISCLevel = 2
ACHIEVEMENTSEnabled = True
ACHIEVEMENTSLevel = 2
HTTPEnabled = True
HTTPLevel = 2
PRINTFEnabled = True
PRINTFLevel = 2
[PostShaderSetting]
BloomSettingValue1 = 0.600000
BloomSettingValue2 = 0.500000
Expand All @@ -455,3 +461,19 @@ ColorCorrectionSettingValue4 = 1.000000
ScanlinesSettingValue1 = 1.000000
ScanlinesSettingValue2 = 0.500000
SharpenSettingValue1 = 1.500000
[Achievements]
AchievementsEnable = False
AchievementsChallengeMode = False
AchievementsEncoreMode = False
AchievementsUnofficial = False
AchievementsLogBadMemReads = False
AchievementsUserName =
AchievementsSoundEffects = True
AchievementsUnlockAudioFile =
AchievementsLeaderboardSubmitAudioFile =
AchievementsLeaderboardTrackerPos = 3
AchievementsLeaderboardStartedOrFailedPos = 3
AchievementsLeaderboardSubmittedPos = 3
AchievementsProgressPos = 3
AchievementsChallengePos = 3
AchievementsUnlockedPos = 4
65 changes: 61 additions & 4 deletions functions/EmuScripts/emuDeckPPSSPP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PPSSPP_emuName="PPSSPP"
PPSSPP_emuType="$emuDeckEmuTypeFlatpak"
PPSSPP_emuPath="org.ppsspp.PPSSPP"
PPSSPP_releaseURL=""
PPSSPP_configFile="$HOME/.var/app/${PPSSPP_emuPath}/config/ppsspp/PSP/SYSTEM/ppsspp.ini"

#cleanupOlderThings
PPSSPP_cleanup(){
Expand All @@ -24,6 +25,7 @@ PPSSPP_init(){
PPSSPP_setEmulationFolder
PPSSPP_setupSaves
PPSSPP_addSteamInputProfile
PPSSPP_setRetroAchievements
}

#update
Expand All @@ -37,10 +39,7 @@ PPSSPP_update(){

#ConfigurePaths
PPSSPP_setEmulationFolder(){
configFile="$HOME/.var/app/${PPSSPP_emuPath}/config/ppsspp/PSP/SYSTEM/ppsspp.ini"
gameDirOpt='CurrentDirectory = '
newGameDirOpt='CurrentDirectory = '"${romsPath}/psp"
sed -i "/${gameDirOpt}/c\\${newGameDirOpt}" "$configFile"
iniFieldUpdate "$PPSSPP_configFile" "General" "CurrentDirectory" "${romsPath}/psp"
}

#SetupSaves
Expand Down Expand Up @@ -110,6 +109,64 @@ PPSSPP_finalize(){
echo "NYI"
}

PPSSPP_retroAchievementsOn() {
iniFieldUpdate "$PPSSPP_configFile" "Achievements" "AchievementsEnable" "True"
}
PPSSPP_retroAchievementsOff() {
iniFieldUpdate "$PPSSPP_configFile" "Achievements" "AchievementsEnable" "False"
}

PPSSPP_retroAchievementsHardCoreOn() {
iniFieldUpdate "$PPSSPP_configFile" "Achievements" "AchievementsChallengeMode" "True"

}
PPSSPP_retroAchievementsHardCoreOff() {
iniFieldUpdate "$PPSSPP_configFile" "Achievements" "AchievementsChallengeMode" "False"
}

PPSSPP_retroAchievementsSetLogin() {

# EmuDeck username and token files
rau=$(cat "$HOME/.config/EmuDeck/.rau")
rat=$(cat "$HOME/.config/EmuDeck/.rat")

# Create PPSSPP token file
PPSSPP_token="$HOME/.var/app/${PPSSPP_emuPath}/config/ppsspp/PSP/SYSTEM/ppsspp_retroachievements.dat"
touch $PPSSPP_token

echo "Evaluate RetroAchievements Login."
if [ ${#rat} -lt 1 ]; then
echo "--No token."
elif [ ${#rau} -lt 1 ]; then
echo "--No username."
else
echo "Valid Retroachievements Username and Password length"

# Insert username into PPSSPP config file
iniFieldUpdate "$PPSSPP_configFile" "Achievements" "AchievementsUserName" "${rau}"

# Insert token into PPSSPP token file if file is empty. RetroAchievements login does not work if there are multiple tokens in the file.
if [ -s $PPSSPP_token ]; then
echo "File is not empty"
else
echo "File is empty"
echo "${rat}" >> "${PPSSPP_token}"
fi

# Enable RetroAchievements
PPSSPP_retroAchievementsOn
fi
}

PPSSPP_setRetroAchievements(){
PPSSPP_retroAchievementsSetLogin
if [ "$achievementsHardcore" == "true" ]; then
PPSSPP_retroAchievementsHardCoreOn
else
PPSSPP_retroAchievementsHardCoreOff
fi
}

PPSSPP_addSteamInputProfile(){
addSteamInputCustomIcons
#setMSG "Adding $PPSSPP_emuName Steam Input Profile."
Expand Down

0 comments on commit f48061f

Please sign in to comment.