|
|
@@ -209,7 +209,29 @@ class NemuIpcImpl:
|
|
|
self.instance_id: int = instance_id
|
|
|
self.display_id: int = display_id
|
|
|
|
|
|
- ipc_dll = os.path.abspath(os.path.join(nemu_folder, './shell/sdk/external_renderer_ipc.dll'))
|
|
|
+ list_dll = [
|
|
|
+ # MuMuPlayer12
|
|
|
+ os.path.abspath(os.path.join(nemu_folder, './shell/sdk/external_renderer_ipc.dll')),
|
|
|
+ # MuMuPlayer12 5.0
|
|
|
+ os.path.abspath(os.path.join(nemu_folder, './nx_device/12.0/shell/sdk/external_renderer_ipc.dll')),
|
|
|
+ ]
|
|
|
+ self.lib = None
|
|
|
+ for ipc_dll in list_dll:
|
|
|
+ if not os.path.exists(ipc_dll):
|
|
|
+ continue
|
|
|
+ try:
|
|
|
+ self.lib = ctypes.CDLL(ipc_dll)
|
|
|
+ break
|
|
|
+ except OSError as e:
|
|
|
+ logger.error(e)
|
|
|
+ logger.error(f'ipc_dll={ipc_dll} exists, but cannot be loaded')
|
|
|
+ continue
|
|
|
+ if self.lib is None:
|
|
|
+ # not found
|
|
|
+ raise NemuIpcIncompatible(
|
|
|
+ f'NemuIpc requires MuMu12 version >= 3.8.13, please check your version. '
|
|
|
+ f'None of the following path exists: {list_dll}')
|
|
|
+ # success
|
|
|
logger.info(
|
|
|
f'NemuIpcImpl init, '
|
|
|
f'nemu_folder={nemu_folder}, '
|
|
|
@@ -218,18 +240,6 @@ class NemuIpcImpl:
|
|
|
f'display_id={display_id}'
|
|
|
)
|
|
|
|
|
|
- try:
|
|
|
- self.lib = ctypes.CDLL(ipc_dll)
|
|
|
- except OSError as e:
|
|
|
- logger.error(e)
|
|
|
- # OSError: [WinError 126] 找不到指定的模块。
|
|
|
- if not os.path.exists(ipc_dll):
|
|
|
- raise NemuIpcIncompatible(
|
|
|
- f'ipc_dll={ipc_dll} does not exist, '
|
|
|
- f'NemuIpc requires MuMu12 version >= 3.8.13, please check your version')
|
|
|
- else:
|
|
|
- raise NemuIpcIncompatible(
|
|
|
- f'ipc_dll={ipc_dll} exists, but cannot be loaded')
|
|
|
self.connect_id: int = 0
|
|
|
self.width = 0
|
|
|
self.height = 0
|