Repository navigation
模拟器退出后放掉截图共享内存,下一台起来时自己重新映射 - #22
Merged
Merged
Conversation
截图共享内存的名字只按控制台端口取。句柄一直映射着旧的那块,模拟器退出了也不放; 同一端口的下一台模拟器(比如改成 1080p 后)再建这块共享内存时,拿回来的还是旧的、 更小的那块,映射失败,截图共享就开不起来(模拟器那边还会因此卡死,另修)。 Windows 上: - 打开时找出监听控制台端口的进程(就是模拟器),等它退出时(线程池等待)关掉映射。 抓图时如果映射已经没了,最多每秒试一次映射当前这台模拟器的共享内存,没有就返回 MODAVD_E_NOT_FOUND。抓图和关映射之间用读写锁隔开。 - 普通打开时,共享内存在、控制台端口却没人监听,说明是别的程序留着的旧的:不映射, 返回 MODAVD_E_NOT_FOUND。带 MODAVD_OPEN_NO_START 的照旧信任现有映射。 - MuMu 形状的外壳也走同一条抓图路径。 测试:test_core 加两条(另起一个进程当模拟器,杀掉后句柄放掉映射、名字随之消失, 换更大的帧重新起来后抓到新尺寸;没人监听的旧共享内存不映射);test_shim 的假帧配上 假的控制台监听,再加一条旧共享内存连不上。去掉退出时关映射的那一行,新测试失败 2 处。 Refs ModAVD/ModAVD#210
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs ModAVD/ModAVD#210
问题
截图共享内存
SHM_videmulator<控制台端口>的名字只按端口取。句柄打开后一直映射着,模拟器退出了也不放。同一端口的下一台模拟器(比如改成 1080p 以后)再建这块共享内存时,Windows 交回的是旧的、更小的那块,映射失败,截图共享开不起来;0.41.0 以前的模拟器还会因此卡死、崩溃。改法(Windows)
MODAVD_E_NOT_FOUND。所以用户换分辨率重开实例以后,MAA 之类的工具不用重连,自己就会拿到新尺寸。MODAVD_OPEN_NO_START)时,共享内存在、控制台端口却没人监听,说明是别的程序留着的旧共享内存:不映射,返回MODAVD_E_NOT_FOUND。带MODAVD_OPEN_NO_START的照旧信任现有映射。测试
build.ps1:test_core、test_input、test_shim 全过。test_core 新增两条:另起一个进程当模拟器,杀掉以后句柄放掉映射、共享内存的名字随之消失,换成更大的帧再起来后抓到新尺寸;没人监听的旧共享内存不映射。test_shim 的假帧都配上了假的控制台监听,另加一条「旧共享内存连不上」。