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

Port some fixes/improvements from the retroachievements branch #17594

Merged
merged 6 commits into from
Jun 17, 2023

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Jun 17, 2023

Picked out some changes from #17589, nice to get stuff in separately for testing.

And will reduce the size of the retroachievements PR.

@hrydgard hrydgard added this to the v1.16.0 milestone Jun 17, 2023
@hrydgard hrydgard marked this pull request as ready for review June 17, 2023 20:44
@hrydgard hrydgard added the Code Cleanup Cleanup to make future work easier. Needs to be done sometimes. label Jun 17, 2023
@@ -202,6 +202,7 @@ class Downloader {
std::shared_ptr<Download> AsyncPostWithCallback(
const std::string &url,
const std::string &postData,
const std::string &postMime, // Use postMime = "application/x-www-form-urlencoded" for standard form-style posts, such as used by retroachievements.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: we already have UrlEncoder which has a getMimeType() that uses this method. Probably multipart/form-data (i.e. from MultipartFormDataEncoder) is supported as well (and would be required for certain types of data, like file uploads with screenshots; some achievement/trophy systems collect these, no idea about that one.)

Feels like this comment isn't needed on both Downloader and Download.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

This one only seems to only need simple text data (so far), and it's already being encoded for us by the rcheevos library - so I don't think bringing in MultipartFormDataEncoder here makes sense, since we're just forwarding already-encoded data. Simply adding the postMime parameter here was the easy way to go.

But yes, as you state in the other comment we're approaching DownloadDesc territory.

I'll clean up the comment.

@@ -458,8 +458,8 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
return 0;
}

Download::Download(const std::string &url, const Path &outfile)
: progress_(&cancelled_), url_(url), outfile_(outfile) {
Download::Download(RequestMethod method, const std::string &url, const std::string &postData, const std::string &postMime, const Path &outfile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably a case where a DownloadDesc would make more sense, given several of the args now are relevant only to a certain type.

-[Unknown]

@@ -87,3 +87,6 @@ void NativeShutdownGraphics();
void NativeShutdown();

void PostLoadConfig();

// The lambda runs on the next update.
void NativeRunOnMainThread(std::function<void()> func);
Copy link
Collaborator

Choose a reason for hiding this comment

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

How have we defined main thread, given Vulkan/OpenGL/etc.? I guess this would be the UI thread (the CPU thread basically) snice it's called from NativeUpdate?

-[Unknown]

Copy link
Owner Author

@hrydgard hrydgard Jun 17, 2023

Choose a reason for hiding this comment

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

It's the NativeUpdate thread, basically.

I thought I would use this for something that I didn't end up using it for, so I'm just gonna take it out from the PR for now.

@unknownbrackets unknownbrackets merged commit 0fb7d6f into master Jun 17, 2023
@unknownbrackets unknownbrackets deleted the backport-fixes branch June 17, 2023 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup Cleanup to make future work easier. Needs to be done sometimes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants