Repository navigation
拷贝途中次次来新帧时,modavd_capture 返回未就绪 - #6
Merged
Merged
Conversation
- 模拟器写共享内存不加锁,库拷前后比帧号,变了就重拷,最多 3 次。原来 3 次都撞上新帧也返回 MODAVD_OK,交出去的图可能是两帧拼起来的。现在 modavd_capture 返回 MODAVD_E_NOT_READY(并记一条 警告),调用方再截一次就行。出错码和接口版本不变,头文件里写明 NOT_READY 也包括这种情况。 - 兼容外壳照旧把最后一次拷贝交出去,和它替换的那个 DLL 一样:MaaCore 的 MuMu 那条路截图一失败就会 重新测速。所以外壳改为直接调 mx_copy_frame,认内部返回值 MX_TORN。 - 测试:加了只在测试里设置的钩子 mx_test_after_copy,在每次拷完、重读帧号之前发一帧,确定地造出 「拷贝途中来了新帧」,不靠多线程。 Refs ModAVD#1
Merged
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.
#1 计划里的一条:库重拷 3 次还撞上新帧时,不再返回成功。
Refs #1
改了什么
MODAVD_OK,交出去的图可能是两帧拼起来的。现在modavd_capture返回MODAVD_E_NOT_READY,并记一条警告,调用方再截一次就行。出错码和MODAVD_API_VERSION不变;头文件里写明MODAVD_E_NOT_READY也包括这种情况。mx_copy_frame,认内部返回值MX_TORN(正数,不会从公开接口出去)。mx_test_after_copy:只在测试里设置,在每次拷完、重读帧号之前调用,用来确定地造出「拷贝途中来了新帧」,不靠多线程。其他时候是 NULL。跑过什么
改动和测试由 AI 编码助手完成,下面的都由它自己跑过。
build.ps1,/W4 /WX无警告,test_core、test_shim都过。Linux、macOS 看本 PR 的 CI。test_capture_new_frame_mid_copy:拷贝途中来一帧,第二次拷贝成功,帧号是新帧的;每次拷贝途中都来新帧,modavd_capture返回MODAVD_E_NOT_READY,正好拷 3 次;外壳用的mx_copy_frame这时返回MX_TORN。mx_copy_frame3 次都撞上时改回返回MODAVD_OK,两条断言红;modavd_capture不把MX_TORN换成MODAVD_E_NOT_READY,一条断言红。都已还原。