Skip to content

Allow to define and modify custom names for saved states - #21909

Open
ArthurBELLOC wants to merge 1 commit into
hrydgard:masterfrom
ArthurBELLOC:21598_state_management
Open

Allow to define and modify custom names for saved states#21909
ArthurBELLOC wants to merge 1 commit into
hrydgard:masterfrom
ArthurBELLOC:21598_state_management

Conversation

@ArthurBELLOC

Copy link
Copy Markdown

Feature requested in issue #21598.

Now saving a state creates a .txt file with the same name in the same location.
A new button has been added in the grid when you right click on the screenshot of the save state, allowing to type any custom name that will then be displayed in the pause menu next to the save state date.
The name is written and retrieved in that same .txt file so there is no issue with special characters.

This is my first commit, so I might have forgotten some things.

Thank you for taking the time to review that feature.

@hrydgard

Copy link
Copy Markdown
Owner

"fatal error: 'bits/stdc++.h' file not found" ??

What needs that include?

@Nemoumbra Nemoumbra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some questions and/or suggestions. There are 2 things I haven't addressed though:

  1. Does the change from GetScreenshotTitle to GetCustomName hide any potentially notable (for the user) info?
  2. Does this code really generate empty .txt files for savestates without custom names?

Comment thread Common/File/FileUtil.cpp Outdated
Comment thread Core/SaveState.cpp Outdated
Comment thread UI/PauseScreen.cpp Outdated
Comment thread Core/SaveState.h
Comment thread Core/SaveState.cpp Outdated
Comment thread Core/SaveState.cpp Outdated
Comment thread UI/PauseScreen.cpp Outdated
Comment thread Core/SaveState.cpp Outdated
@ArthurBELLOC

Copy link
Copy Markdown
Author

Hello,

Thank you for your response.

I'll try to get everything fixed.

To answer the questions :

1. Does the change from `GetScreenshotTitle` to `GetCustomName` hide any potentially notable (for the user) info?

No, it does not. It just show the custom name if there is one otherwise it is the same previous layout with the date and time of the save state.

2. Does this code really generate empty .txt files for savestates without custom names?

Yes. Every save state has no custom name by default, but the empty .txt is created.

@ArthurBELLOC
ArthurBELLOC force-pushed the 21598_state_management branch 2 times, most recently from 83f3d5f to 8d10559 Compare July 16, 2026 09:53
@ArthurBELLOC

Copy link
Copy Markdown
Author

Thank you for the feedbacks.
Everything should be corrected.
It runs fine on my computer and I ran some tests available in the repository that did not pointed errors.

@Nemoumbra

Copy link
Copy Markdown
Collaborator

Nice! I've looked it over again.
So... Now we can see that std::string customName in SaveSlot has exactly one purpose much later in the code... and that is SetSlotCustomName(gamePrefix, slot, customName);.

If we mentally eliminate the variable, we'll get SetSlotCustomName(gamePrefix, slot, GetSlotCustomName(gamePrefix, slot));
Now then, if there's already a name, the only thing we achieve by this is nothing. Because it reads the file and writes the same data back. And if there isn't a name, we create an empty .txt file. Which means that all this code is used for one thing - writing empty .txt files. Why exactly do we need them?

@ArthurBELLOC
ArthurBELLOC force-pushed the 21598_state_management branch from 8d10559 to 5e8ecd9 Compare July 17, 2026 07:09
@ArthurBELLOC

Copy link
Copy Markdown
Author

@Nemoumbra You are absolutely right.
There is indeed no need to create the .txt file if it is empty in SaveSlot.
I was just scared that GetSlotCustomName used in PauseScreen could break if there is no file to read.
But ReadBinaryFileToStringhandle the case where there is no .txt file and do not break.
And as the result has been defined as an empty string everything works if those lines are removed.

@ArthurBELLOC
ArthurBELLOC requested a review from Nemoumbra July 20, 2026 07:20
@Nemoumbra

Nemoumbra commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Well, I can approve it, but we still need hrydgard's opinion.

@hrydgard

Copy link
Copy Markdown
Owner

It's starting to look pretty good. I'll look into it in more detail soon.

@hrydgard hrydgard added the User Interface PPSSPP's own user interface / UX label Jul 20, 2026
@hrydgard hrydgard added this to the v1.21 milestone Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

User Interface PPSSPP's own user interface / UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants