mirror of
https://github.com/WorldObservationLog/AppleMusicDecrypt.git
synced 2026-01-15 14:22:54 -03:00
feat: add hardwareAccelerator setting
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# DO NOT EDIT IT
|
||||
version = "0.0.4"
|
||||
version = "0.0.5"
|
||||
|
||||
[instance]
|
||||
url = "127.0.0.1:8080"
|
||||
@@ -13,6 +13,8 @@ enable = false
|
||||
# For Windows users, run `Get-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform` to check if WHPX enabled
|
||||
# For Linux users, run `sudo kvm-ok` to check if KVM supported
|
||||
enableHardwareAcceleration = false
|
||||
# For Windows WHPX, you may have to set hardwareAccelerator to `whpx,kernel-irqchip=off` and cpuModel to `qemu64-v1`
|
||||
hardwareAccelerator = ""
|
||||
memorySize = "512M"
|
||||
cpuModel = "Cascadelake-Server-v5"
|
||||
# Waiting time for wrapper-manager to start
|
||||
|
||||
@@ -5,7 +5,7 @@ from creart import exists_module
|
||||
from creart.creator import AbstractCreator, CreateTargetInfo
|
||||
from pydantic import BaseModel
|
||||
|
||||
CONFIG_VERSION = "0.0.4"
|
||||
CONFIG_VERSION = "0.0.5"
|
||||
|
||||
|
||||
class Instance(BaseModel):
|
||||
@@ -15,7 +15,8 @@ class Instance(BaseModel):
|
||||
|
||||
class LocalInstance(BaseModel):
|
||||
enable: bool = False
|
||||
enableHardwareAcceleration: bool = True
|
||||
enableHardwareAcceleration: bool = False
|
||||
hardwareAccelerator: str = ""
|
||||
memorySize: str = "512M"
|
||||
cpuModel: str = "Cascadelake-Server-v5"
|
||||
timeout: int = 30
|
||||
|
||||
12
src/qemu.py
12
src/qemu.py
@@ -13,8 +13,7 @@ from src.logger import GlobalLogger
|
||||
ARGUMENTS = ["qemu-system-x86_64", "-machine q35", f"-cpu {it(Config).localInstance.cpuModel}",
|
||||
f"-m {it(Config).localInstance.memorySize}", "-display none", "-hda assets/wrapper-manager.qcow2",
|
||||
"-device virtio-net-pci,netdev=net0", "-netdev user,id=net0,hostfwd=tcp:127.0.0.1:32767-:32767"]
|
||||
HWACCEL_WIN = "-accel whpx"
|
||||
HWACCEL_LINUX = "-accel kvm"
|
||||
HWACCEL = f"-accel {it(Config).localInstance.hardwareAccelerator}"
|
||||
|
||||
|
||||
class QemuInstance:
|
||||
@@ -24,11 +23,10 @@ class QemuInstance:
|
||||
if not self.image_available():
|
||||
await self.get_instance_image()
|
||||
if it(Config).localInstance.enableHardwareAcceleration:
|
||||
if sys.platform == "win32":
|
||||
ARGUMENTS.insert(3, HWACCEL_WIN)
|
||||
elif sys.platform == "linux":
|
||||
ARGUMENTS.insert(3, HWACCEL_LINUX)
|
||||
self.proc = loop.create_task(asyncio.create_subprocess_shell(" ".join(ARGUMENTS), stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE))
|
||||
ARGUMENTS.insert(3, HWACCEL)
|
||||
self.proc = loop.create_task(
|
||||
asyncio.create_subprocess_shell(" ".join(ARGUMENTS), stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE))
|
||||
|
||||
def terminate(self):
|
||||
self.proc.result().kill()
|
||||
|
||||
Reference in New Issue
Block a user