Closed hrydgard closed 1 month ago
Hm, this is probably a setting then? What I recall happening on a PSP is that the latest save is highlighted by default (see SceUtilitySavedataFocus) but that it's sorted in 0, 1, 2, 3 order - at least in the games I played. You could even have gaps. Maybe GTA sends a different flag?
Also, this says "loaded" - is it really the "iteration order" or is there some issue with one of the focus methods (maybe SCE_UTILITY_SAVEDATA_FOCUS_FIRSTDATA should be by date rather than order, etc.)?
-[Unknown]
Hm, this is probably a setting then? What I recall happening on a PSP is that the latest save is highlighted by default (see SceUtilitySavedataFocus) but that it's sorted in 0, 1, 2, 3 order - at least in the games I played. You could even have gaps. Maybe GTA sends a different flag?
Also, this says "loaded" - is it really the "iteration order" or is there some issue with one of the focus methods (maybe SCE_UTILITY_SAVEDATA_FOCUS_FIRSTDATA should be by date rather than order, etc.)?
-[Unknown]
There are two different things here:
Bump, this is actually a really annoying problem in GTA, in hopes it can be fixed up for 1.16..
I'm not sure how to debug this properly, but I tried to follow where the code goes wrong and managed to make a workaround for gtavcs: https://github.com/hrydgard/ppsspp/compare/master...ThirteenAG:ppsspp:master
What's going on is:
Startup:
1) call to SavedataParam::SetPspParam
with param->mode == SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD && param->focus == SCE_UTILITY_SAVEDATA_FOCUS_LATEST
.
param->saveNameList
is not nullptr.
2) call to SavedataParam::SetPspParam
with param->mode == SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD && param->focus == SCE_UTILITY_SAVEDATA_FOCUS_LATEST
.
At this point, ppsspp can't construct a list of available saves, so it defaults to slot 0 here.
Ingame:
1) Only one call to SavedataParam::SetPspParam
with param->mode == SCE_UTILITY_SAVEDATA_TYPE_LISTLOAD && param->focus == SCE_UTILITY_SAVEDATA_FOCUS_LATEST
.
param->saveNameList
is not nullptr.
The key difference here, UI is gonna show up, which doesn't happen on startup and ppsspp handles these calls in PSPSaveDialog::ExecuteNotVisibleIOAction. Could be related to the underlying issue.
So, to workaround:
1) On startup, on first call of SetPspParam
, I cached param->saveNameList
, then inserted cached value during second call.
2) In order to get latest save path, I had to comment case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD:
in two functions:
PSPSaveDialog::GetSelectedSaveDirName()
SavedataParam::WouldHaveMultiSaveName(const SceUtilitySavedataParam *param)
Hope this helps to get to the root of the problem somehow.
The VCS bug is not related to the savedata iteration. The game does its own by calling sceIoGetstat on directories in "ms0:PSP/SAVEDATA" and picking up the one with the lowest m_time. On Linux at least, this always seems to return year=1900, month=1, day=0, so the game ends up picking the first one it finds in the directory.
I don't know how @ThirteenAG 's workaround works, but the game does not set saveNameList on autoloads, only the saveName.
Oh, that's good information!
I'll look into the mtime issue, we should not be returning 1900..
We've been looking at the wrong thing, good to see this finally figured out.
NABN00B on Discord:
Sergey confirms that the order is different.
Should be looked into.