Skip to content

[Minor] Report filesizes on macOS as decimal multiples#16480

Merged
elad335 merged 4 commits into
RPCS3:masterfrom
schm1dtmac:patch-2
Dec 30, 2024
Merged

[Minor] Report filesizes on macOS as decimal multiples#16480
elad335 merged 4 commits into
RPCS3:masterfrom
schm1dtmac:patch-2

Conversation

@schm1dtmac
Copy link
Copy Markdown
Contributor

@schm1dtmac schm1dtmac commented Dec 29, 2024

macOS uses decimal multiples (i.e. 1KB = 1000B) for filesizes system-wide, prior to this PR it could lead to RPCS3 reporting very different values for, e.g., free disk space than what macOS itself reports elsewhere.
image
With the PR it'll be within a few GBs of what macOS reports in Settings (the rest of the difference is 'purgeable space' nonsense).
( I have a feeling other OSes may also report decimal multiples like macOS, and that Windows may be the odd one out in reporting binary multiples. If so then the include guards could be more broadly adjusted to only use multiples of 1024 on WIN32. )

Comment thread rpcs3/rpcs3qt/qt_utils.cpp Outdated
Comment thread rpcs3/rpcs3qt/qt_utils.cpp Outdated
Comment thread rpcs3/rpcs3qt/qt_utils.cpp
@Megamouse
Copy link
Copy Markdown
Contributor

This actually doesn't make sense at all.
This is a format function.
You should find the function that produces the bytes passed to this and fix it instead.

@schm1dtmac
Copy link
Copy Markdown
Contributor Author

This actually doesn't make sense at all. This is a format function. You should find the function that produces the bytes passed to this and fix it instead.

The function just takes in bytes though, and the raw number of bytes was never the problem, it's purely that RPCS3 currently converts from bytes to KB, KB to MB, etc in that format_bytes function using multiples of 1024. That itself is inconsistent with what macOS (and probably other OSes except Windows) do for reporting said units, hence my above example of having a supposed >10GB free disk space difference.

@Megamouse
Copy link
Copy Markdown
Contributor

What an OS reports is irrelevant.
If the unit is KB, then it's kilobytes.

@Megamouse
Copy link
Copy Markdown
Contributor

sorry, well. actually, it should always be KiB.
But since noone knows what that is, most OS use KB.
Idk. maybe it's correct.
It's probably a hot topic in the first place (why they did this stupid distinction is beyond me)

Comment thread rpcs3/rpcs3qt/qt_utils.cpp
@elad335 elad335 merged commit b16d267 into RPCS3:master Dec 30, 2024
@schm1dtmac schm1dtmac deleted the patch-2 branch December 30, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants