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

关于蓝叠5国际版adb端口获取错误的问题 #109

Closed
5 of 6 tasks
Gedminer opened this issue Jul 14, 2023 · 3 comments
Closed
5 of 6 tasks

关于蓝叠5国际版adb端口获取错误的问题 #109

Gedminer opened this issue Jul 14, 2023 · 3 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@Gedminer
Copy link

Gedminer commented Jul 14, 2023

在提问之前...

  • 我已经搜索了现有的 issues 和 discussions
  • 我已经阅读了 readme 中除版本记录以外的所有内容
  • 我在提问题之前至少花费了 5 分钟来思考和准备
  • 这个问题出现在最新版的 FGO-py 上
  • 这个问题出现了至少3次
  • 我使用过旧版的 FGO-py 并且没有出现过这个问题

描述你的问题

使用/bs5获取端口号提示错误

蓝叠的bluestacks.conf中的文本会根据模拟器的安卓版本而变化。比如Nougat64、Pie64和Rvc64。其他的版本会导致error。将Nougat64替换为Rvc64后能正常运行。

如何复现

使用/bs5获取非Nougat64版本蓝叠5adb端口

预期行为

我不懂python,不过也许可以用其他方法获取文本来获得版本号。如果不能实现或许可以偷鸡把这段复制三个,分别弄个/bs5 7 /bs5 9 /bs5 11

相关 Logs

'NoneType' object has no attribute 'group'
Traceback (most recent call last):
  File "C:\FGO-py.portable\FGO-py\FGO-py\fgoDevice.py", line 16, in convert
    try:return(lambda args:helpers[args[0][1:]](*args[1:]))(text.split('_'))
  File "C:\FGO-py.portable\FGO-py\FGO-py\fgoDevice.py", line 16, in <lambda>
    try:return(lambda args:helpers[args[0][1:]](*args[1:]))(text.split('_'))
  File "C:\FGO-py.portable\FGO-py\FGO-py\fgoDevice.py", line 31, in bs5
    with open(os.path.join(dir,'bluestacks.conf'),encoding='utf-8')as f:return'127.0.0.1:'+re.search(rf'bst\.instance\.Nougat64{f"_{args[0]}"if args else""}\.status\.adb_port="(\d*)"',f.read()).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

截图

屏幕截图 2023-07-14 134054

还有别的吗?

模拟器版本:Android 11 的 BlueStacks 5
BlueStacksFullInstaller_5.12.102.1001_amd64_native.exe --defaultImageName Rvc64 --imageToLaunch Rvc64

来点色图

不可以色色

@hgjazhgj hgjazhgj added bug Something isn't working enhancement New feature or request labels Jul 14, 2023
@hgjazhgj
Copy link
Owner

hgjazhgj commented Jul 14, 2023

我确实查到今年年初bluestacks hyper-v 5.10.150支持了一些nougat以外的版本,在此之前bluestacks hyper-v只有nougat可用,其他Android版本可见但是无法选择
我会将在使用/bs5时附加的多开id更改为具体的instance

@DoyoDia
Copy link

DoyoDia commented Jul 21, 2023

可以直接搞成/bs5 Pie64_1 这种格式的?
代码可以这样搞(复制自MAA
`def get_hyperv_port(conf_path=r"C:\ProgramData\BlueStacks_nxt\bluestacks.conf", instance_name="Pie64", read_imageinfo_from_config=False) -> int:
""" 获取Hyper-v版蓝叠的adb port

    :param conf_path: bluestacks.conf 的路径+文件名
    :param instance_name: 多开的名称,在bluestacks.conf中以类似bst.instance.<instance_name>.status.adb_port的形式出现,如Nougat64,Pie64,Pie64_1等
    :return: adb端口
    """
    with open(conf_path, encoding="UTF-8") as f:
        configs = {
            line.split('=')[0].strip(): line.split('=')[1].strip().strip('"\n')
            for line in f
        }
        if read_imageinfo_from_config:
            instances = [i.strip('"') for i in configs['bst.installed_images'].split(',')]
            instance_name = instances[0]
    return int(configs[f'bst.instance.{instance_name}.status.adb_port'].replace('"', ""))`

@hgjazhgj
Copy link
Owner

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants