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

OptionsList for Flags doesn't show pretty values, but rather raw values #4940

Closed
stonerl opened this issue Jan 13, 2023 · 1 comment
Closed
Milestone

Comments

@stonerl
Copy link

stonerl commented Jan 13, 2023

I was toying around with UTM and wanted to change some prettyValue in the Flag list. But I noticed that these are never used and the raw values are shown instead.

let allFlags = config.architecture.cpuFlagType.allRawValues
if config.cpu.rawValue != "default" && allFlags.count > 0 {
Section(header: Text(title)) {
if showAllFlags || flags.count > 0 {
OptionsList {
ForEach(allFlags) { flagStr in
let flag = AnyQEMUConstant(rawValue: flagStr)!
let isFlagOn = Binding<Bool> { () -> Bool in
flags.contains(where: { $0.rawValue == flag.rawValue })
} set: { isOn in
if isOn {
flags.append(flag)
} else {
flags.removeAll(where: { $0.rawValue == flag.rawValue })
}
}
if showAllFlags || isFlagOn.wrappedValue {
Toggle(isOn: isFlagOn, label: {
Text(flag.prettyValue)

E.g. change line 4938 from 3dnow to 3dyesterday

var prettyValue: String {
switch self {
case ._3dnow: return "3dnow"

It should now show 3dyesterday in the UI but it uses the raw value from line 4616 instead.

enum QEMUCPUFlag_x86_64: String, CaseIterable, QEMUCPUFlag {
case _3dnow = "3dnow"

Version/Platform: git-master on macOS

stonerl added a commit to stonerl/UTM that referenced this issue Jan 17, 2023
I added some Hyper-V Enlightenments [1] to the UI. Non of them are active by
default.

Enlightenments that require 'hv-vpindex' are omitted, since this enlightenment
is currently not available on macOS.

Also, Enlightenments that are used for nesting e.g. 'hv-evmcs', or only change
the Hyper-V Version ID 'hv_version-id-*' are omitted, as well.

Enlightenment 'hv-spinlocks' requires a parameter, currently 0x1fff is hardcoded
since this seems to be a sane value. [2]

This commit partially addresses utmapp#4914 but also suffers from issue utmapp#4940.

Currently this only works for newly created VMs.

[1] https://www.qemu.org/docs/master/system/i386/hyperv.html
[2] https://leduccc.medium.com/improving-the-performance-of-a-windows-10-guest-on-qemu-a5b3f54d9cf5#c5b9
@osy osy added this to the v4.2 milestone Feb 26, 2023
@osy
Copy link
Contributor

osy commented Mar 4, 2023

While you are technically right, there is not a single flag which doesn't have the same text for rawValue and prettyValue.

@osy osy closed this as completed in a536424 Mar 4, 2023
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

No branches or pull requests

2 participants