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

Improve Save Manager #2951

Merged
merged 19 commits into from Jul 13, 2017
Merged

Improve Save Manager #2951

merged 19 commits into from Jul 13, 2017

Conversation

flash-fire
Copy link
Contributor

@flash-fire flash-fire commented Jul 4, 2017

  1. Add icons
  2. Have size work even on high dpi screens for window size.
  3. Dialog won't show improperly. It's hard to explain but for example Disgaea 4 will no longer show the dialog at boot.

Ready for merge

@mention-bot
Copy link

@flash-fire, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Nekotekina, @TomiYuga and @Inviuz to be potential reviewers.

@flash-fire
Copy link
Contributor Author

I'm done with this for now. Feel free to squash on merge because I don't trust my rebase squashing abilities.

@Megamouse
Copy link
Contributor

I can do it for you.... we know how it ends

@flash-fire flash-fire changed the title Add the save icons to the SaveDataEntry and Manager [WIP] Improve Save Manager Jul 5, 2017
… I could see on stack overflow.

Also, add an error dialog if you have no entries.

Simplify the logic slightly for the selected since with the no data case handled, I can make more assumptions about the return value.
@flash-fire
Copy link
Contributor Author

I changed my mind. I want to make some other changes while I'm modifying the save manager to fix some things people mentioned.

@flash-fire flash-fire changed the title [WIP] Improve Save Manager Improve Save Manager Jul 7, 2017
@flash-fire flash-fire changed the title Improve Save Manager [WIP] Improve Save Manager Jul 7, 2017
@flash-fire flash-fire changed the title [WIP] Improve Save Manager [Needs Testing] Improve Save Manager Jul 7, 2017
…nothing. Having both isn't needed. Yay merges resulting in doing stupid things.
@flash-fire flash-fire changed the title [Needs Testing] Improve Save Manager Improve Save Manager Jul 8, 2017
@twdarkeh
Copy link
Contributor

twdarkeh commented Jul 8, 2017

This works just fine. No more new games/errors when no save is loaded.

@Zangetsu38
Copy link
Contributor

Good for me now in 4k screen

@raven02
Copy link
Contributor

raven02 commented Jul 9, 2017

For example if i resize the title , next time reopen the game , the save interface will back to default .

untitled

@flash-fire
Copy link
Contributor Author

Save manager doesn't save its dialog state into settings so this is expected behavior.

@raven02
Copy link
Contributor

raven02 commented Jul 9, 2017

I see

{
fs::file icon = fs::file(base_dir + entry.name + "/ICON0.PNG");
u32 iconSize = icon.size();
void* iconData = new uchar[iconSize];
Copy link
Member

Choose a reason for hiding this comment

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

Memory leak

… (tested with disgaea and renaming icon file)
@flash-fire
Copy link
Contributor Author

I'm pretty sure that fixes the leak, but normally I'm not making std::shared_ptr of casted data. :P

A standard pointer didn't work because the vector copies the struct to add it or something (I kept getting double free errors and was feeling too lazy to investigate rigorously).

@Megamouse
Copy link
Contributor

you could remove the header highlighting. I did it with gamelist

fs::file icon = fs::file(base_dir + entry.name + "/ICON0.PNG");
u32 iconSize = icon.size();
uchar* iconData = new uchar[iconSize];
icon.read(iconData, iconSize);
Copy link

@MrSapps MrSapps Jul 10, 2017

Choose a reason for hiding this comment

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

vector<uchar> would probably be nicer..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would you do with the struct? I concede the std::shared_ptr isn't very clean. But, using a vector would mean the vector gets copied when save_entries.push_back is called. To me, it's not ideal copying data and immediately deleting the other copy. I'm welcome to suggestions as I would probably do a std::shared_ptr myself or maybe a std::shared_ptr<std::vector>, but the original comment had a void* pointer, and I tried to respect that.

Copy link
Contributor

@danilaml danilaml Jul 10, 2017

Choose a reason for hiding this comment

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

@flash-fire why it's shared and not unique? Is it really shared anywhere? Also, why not do reset before read? Feels cleaner to me.

Though if it's just a helper struct, there is no need to have a ptr at all. You can just replace pointer + size with a vector (as paulsapps suggested).

Also, if you worry about copying vector, you can just implement move constructor or use emplace_back.

@flash-fire
Copy link
Contributor Author

flash-fire commented Jul 11, 2017

@Megamouse I'll do that later. This PR is a bit of a mess as is tbh.

@Nekotekina Nekotekina merged commit ab595d2 into RPCS3:master Jul 13, 2017
@flash-fire flash-fire deleted the SAVE_IMAGES branch July 13, 2017 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants