Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Madoka Magica Portable - saving in-game works, but loading can't find it #19939

Closed
hrydgard opened this issue Feb 2, 2025 · 26 comments
Closed
Labels
Saving issue Prevents or obstructs saving game (not save states.)
Milestone

Comments

@hrydgard
Copy link
Owner

hrydgard commented Feb 2, 2025

As it says in the title.

Reported by Mint on Discord.

@hrydgard hrydgard added the Saving issue Prevents or obstructs saving game (not save states.) label Feb 2, 2025
@hrydgard hrydgard added this to the v1.19.0 milestone Feb 2, 2025
@ste11iferous
Copy link

ste11iferous commented Feb 2, 2025

Adding details:
PPSSPP v1.18.1. Tested on .zip (portable) Windows PC version and on Android
Puella Magi Madoka Magica Portable - ULJS00430
Game is the original Japanese version, not the unofficial WIP fan English translation patch

  1. The game reports that it successfully saved the data (screenshot 1)
  2. The files in the memstick folder appear to be successfully updated (screenshot 2)
  3. But upon attempting to load the data, the game reports that there is no data (screenshot 3)

I tried saving and loading on another game without issue - the problem seems to only occur with this game for me.

Attempted unsuccessful troubleshooting:
-Deleted the game's save data folder entirely; attempting to save/load from a clean slate, with no use of PPSSPP's save states involved
-Tried both with game data installed and without
-Tried with PPSSPP's system language set to Japanese and English
-Tried with the Fast Memory (Unstable) setting checked and unchecked
-Tried resetting all of PPSSPP's settings to default
-Tested saving and loading with all four data I/O timing methods, with identical results for all

Image
Image
Image

@anr2me
Copy link
Collaborator

anr2me commented Feb 3, 2025

Have you tried changing the I/O Timing method?

@ste11iferous
Copy link

Have you tried changing the I/O Timing method?

Just tried saving and loading with all four - the result is the same with all of them. The game successfully saves, but cannot find the save when loading.

@sum2012
Copy link
Collaborator

sum2012 commented Feb 3, 2025

The game is hardcode ForceUMDDelay in compat.ini , see detail #6557.I didn't test much.
edit: I try to save other shot of game. It produce ULJS00430-001 which can be loaded

@sum2012
Copy link
Collaborator

sum2012 commented Feb 3, 2025

First system save, second game save
I remove spam of wrong dialog log:
v1.18.1-993-ge80941403a log:
https://gist.github.com/sum2012/907e8e212fcb3b257d9abf5ba86b4b04
edit:JPCSP produce ULJS00430-001 when saving
log:
https://gist.github.com/sum2012/984e9c6afb1aa784f12c3f0fce1f2905
(last log test loading)
edit2:add jpcsp save debug log

JPCSPsavedebuglog.zip

@sum2012
Copy link
Collaborator

sum2012 commented Feb 4, 2025

@sum2012
Copy link
Collaborator

sum2012 commented Feb 5, 2025

The problem is
std::string SavedataParam::GetSaveDirName(const SceUtilitySavedataParam *param, int saveId) const
{
if (!param) {
return "";
}
if (saveId >= 0 && saveNameListDataCount > 0) // if user selection, use it
return GetFilename(saveId);
else
return GetSaveName(param);
}
It should output "-001"

@anr2me
Copy link
Collaborator

anr2me commented Feb 5, 2025

The problem is std::string SavedataParam::GetSaveDirName(const SceUtilitySavedataParam *param, int saveId) const { if (!param) { return ""; } if (saveId >= 0 && saveNameListDataCount > 0) // if user selection, use it return GetFilename(saveId); else return GetSaveName(param); } It should output "-001"

I don't think it's a constant "-001" most likely from an id/index, based on the searched names:

20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -001 = ms0:/PSP/SAVEDATA/ULJS00430-001
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -002 = ms0:/PSP/SAVEDATA/ULJS00430-002
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -003 = ms0:/PSP/SAVEDATA/ULJS00430-003
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -004 = ms0:/PSP/SAVEDATA/ULJS00430-004
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -005 = ms0:/PSP/SAVEDATA/ULJS00430-005
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -006 = ms0:/PSP/SAVEDATA/ULJS00430-006
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -007 = ms0:/PSP/SAVEDATA/ULJS00430-007
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -008 = ms0:/PSP/SAVEDATA/ULJS00430-008
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -009 = ms0:/PSP/SAVEDATA/ULJS00430-009
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -010 = ms0:/PSP/SAVEDATA/ULJS00430-010
20:36:075 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -011 = ms0:/PSP/SAVEDATA/ULJS00430-011
...
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -086 = ms0:/PSP/SAVEDATA/ULJS00430-086
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -087 = ms0:/PSP/SAVEDATA/ULJS00430-087
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -088 = ms0:/PSP/SAVEDATA/ULJS00430-088
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -089 = ms0:/PSP/SAVEDATA/ULJS00430-089
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -090 = ms0:/PSP/SAVEDATA/ULJS00430-090
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -091 = ms0:/PSP/SAVEDATA/ULJS00430-091
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -092 = ms0:/PSP/SAVEDATA/ULJS00430-092
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -093 = ms0:/PSP/SAVEDATA/ULJS00430-093
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -094 = ms0:/PSP/SAVEDATA/ULJS00430-094
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -095 = ms0:/PSP/SAVEDATA/ULJS00430-095
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -096 = ms0:/PSP/SAVEDATA/ULJS00430-096
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -097 = ms0:/PSP/SAVEDATA/ULJS00430-097
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -098 = ms0:/PSP/SAVEDATA/ULJS00430-098
20:36:076 user_main    I[SCEUTIL]: Dialog\SavedataParam.cpp:1626 Listing missing save data: -099 = ms0:/PSP/SAVEDATA/ULJS00430-099

@sum2012
Copy link
Collaborator

sum2012 commented Feb 5, 2025

Yes, I just take a example for hack to fix
edit: For AUTOSAVE Mode , the SaveFile 's name should be saveNameList[0].saveName;

@anr2me
Copy link
Collaborator

anr2me commented Feb 5, 2025

Btw, could you try this game using the artifacts at https://github.com/ANR2MERefork/ppsspp/actions/runs/12265058234?pr=18
and see whether that artifact can generate the -001 save data properly.
Just curious whether this issue is just another timing issue like #15068 where it failed to generate one of the file.

@sum2012
Copy link
Collaborator

sum2012 commented Feb 5, 2025

@anr2me Fail, I forget to tell you saveId = -1 at that time.

@sum2012
Copy link
Collaborator

sum2012 commented Feb 5, 2025

saveDataList[0].saveName do not return "-001" , I think that hard to fix

@anr2me
Copy link
Collaborator

anr2me commented Feb 5, 2025

So the main issue is that the game use an invalid id (-1) during SavedataParam::GetSaveDirName which fallback to param.saveName (ie. GetSaveName(param)) which is an empty string on PPSSPP

if (saveId >= 0 && saveNameListDataCount > 0) // if user selection, use it
		return GetFilename(saveId);
	else
		return GetSaveName(param);

INFO hle.sceUtility - user_main - sceUtilitySavedataInitStart 0x08E0D63C-0x08E0DC3C: Address 0x08E0D63C, mode=5(LISTSAVE), gameName=ULJS00430, saveName=, fileName=SAVEDAT1.DAT, secureVersion=0, saveNameList=[-001, -002, -003, -004, -005, -006, -007, -008, -009, -010, -011, -012, -013, -014, -015, -016, -017, -018, -019, -020, -021, -022, -023, -024, -025, -026, -027, -028, -029, -030, -031, -032, -033, -034, -035, -036, -037, -038, -039, -040, -041, -042, -043, -044, -045, -046, -047, -048, -049, -050, -051, -052, -053, -054, -055, -056, -057, -058, -059, -060, -061, -062, -063, -064, -065, -066, -067, -068, -069, -070, -071, -072, -073, -074, -075, -076, -077, -078, -079, -080, -081, -082, -083, -084, -085, -086, -087, -088, -089, -090, -091, -092, -093, -094, -095, -096, -097, -098, -099]
20:59:56 DEBUG hle.sceUtility - user_main - sceUtilitySavedataInitStart returning 0x0

while on JPCSP, if it's AUTO_SAVE/MODE_SAVE/AUTO_LOAD/MODE_LOAD/MODE_READ/MODE_READSECURE and the param.saveName is null/empty and the list is not empty, the param.saveName will be set to the first element of the list (which is "-001"):

protected boolean executeUpdateVisible() {
            Memory mem = Processor.memory;

            switch (savedataParams.mode) {
               ...
               case SceUtilitySavedataParam.MODE_LOAD: {
                    switch (dialogState) {
                        case init: {
                            if (savedataParams.saveName == null || savedataParams.saveName.length() == 0) {
                                if (savedataParams.saveNameList != null && savedataParams.saveNameList.length > 0) {
                                    savedataParams.saveName = savedataParams.saveNameList[0];
                                }
                            }

                            GuSavedataDialogLoad gu = new GuSavedataDialogLoad(savedataParams, this);
                            openDialog(gu);
                            dialogState = DialogState.confirmation;
                            break;
                        }
   ...

@hrydgard
Copy link
Owner Author

hrydgard commented Feb 5, 2025

Good digging. Wanna make the PR? Otherwise I'll code it up next week.

@anr2me
Copy link
Collaborator

anr2me commented Feb 6, 2025

I don't have the game, not even have ppsspp source code on my local storage.

@sum2012 probably have tried to fix it

saveDataList[0].saveName do not return "-001" , I think that hard to fix

was the saveDataList array empty?
may be we should update the param.saveName somewhere in PSPSaveDialog.cpp instead of at SavedataParam::GetSaveDirName

sum2012 added a commit to sum2012/ppsspp that referenced this issue Feb 6, 2025
90% from kimi A.I. But still not fix hrydgard#19939
@sum2012
Copy link
Collaborator

sum2012 commented Feb 6, 2025

I am trying using https://kimi.moonshot.cn/ to fix from JPCSP. But don't work,
3240400

@sum2012
Copy link
Collaborator

sum2012 commented Feb 6, 2025

@anr2me param->saveName, saveDataList[0].saveName.c_str()); also return System

@anr2me
Copy link
Collaborator

anr2me commented Feb 7, 2025

May be we should fix the saveName at SavedataParam::GetList instead of at SavedataParam::Save, since the game tried to get the list first before saving.

@sum2012
Copy link
Collaborator

sum2012 commented Feb 7, 2025

@anr2me No change , I try to change jpcsp source to find out when the string change to "-000".

@sum2012
Copy link
Collaborator

sum2012 commented Feb 7, 2025

In the latest JPCSP version , the save not work , f562cfb version work.
edit: need 20 minutes to test once .............

@anr2me
Copy link
Collaborator

anr2me commented Feb 7, 2025

So even jpcsp have regression, any changes related to save data since f562cfb?

btw, where did you get jpcsp version f562cfb ? the latest version often crashed and generating a very large dump file :(

Edit: the only changes related to save data since f562cfb is this KIRK-related PR based on https://github.com/jpcsp/jpcsp/activity
There is also your PR which related to I/O timing.

@sum2012
Copy link
Collaborator

sum2012 commented Feb 7, 2025

I downloaded from f562cfb from jpcsp forum. It doesn't crash to me , it only cannot reproduce ULJS00430-001 folder - same with PPSSPP

@sum2012
Copy link
Collaborator

sum2012 commented Feb 7, 2025

The range:
https://github.com/jpcsp/jpcsp/compare/f562cfb..e78956b46da84ade46fe3de1063419a1e8bfd9f8

Yes , most likely my pull request jpcsp/jpcsp#510
edit: revert that don't fix , I clear savedata to test again f562cfb
edit2:confirm work in f562cfb
edit3: I am going to test revert jpcsp/jpcsp#512
edit4: Do not fix that revert in master
edit5: I try to compile f562cfb myself
edit6:Fail , maybe jpcsp forum compiler cache problem
EDIT7: So the version of JPCSP is modified , but title doesn't have that warning

@sum2012
Copy link
Collaborator

sum2012 commented Feb 8, 2025

The game save is no problem , it is just Press "X" and "O" correctly.
@ste11iferous in the screen , You need press "X" rather than "O"

Image

@anr2me
Copy link
Collaborator

anr2me commented Feb 9, 2025

I see, no wonder i saw a commit related to the confirmation button on the range you were trying to bisect on JPCSP earlier.
And from your screenshot, the X button is the OK one when i read it through Google Translate app on my phone's camera.
Nice works on finding out the real issue (which is not an issue after all?)

@ste11iferous
Copy link

It looks like that was indeed the issue. I think I got confused because the confirm/back buttons on the save screen are the opposite from the rest of the game (plus even when reading the on-screen prompts, I'm not thinking in terms of X and O since the actual controller I'm using has different buttons). The game acting like it successfully saved afterwards was tripping me up, too.

Sorry for the mistaken report!

@sum2012 sum2012 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Saving issue Prevents or obstructs saving game (not save states.)
Projects
None yet
Development

No branches or pull requests

4 participants