TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Fixing stutters in Papers Please on Linux

726 pointsby rdpintqogeogsaaover 3 years ago

19 comments

arghwhatover 3 years ago
The issue has been identified before, but seems like it stalled: <a href="https:&#x2F;&#x2F;gitlab.freedesktop.org&#x2F;libinput&#x2F;libinput&#x2F;-&#x2F;issues&#x2F;509" rel="nofollow">https:&#x2F;&#x2F;gitlab.freedesktop.org&#x2F;libinput&#x2F;libinput&#x2F;-&#x2F;issues&#x2F;50...</a>, <a href="https:&#x2F;&#x2F;patchwork.kernel.org&#x2F;project&#x2F;linux-input&#x2F;patch&#x2F;20201227144302.9419-1-kl@kl.wtf&#x2F;" rel="nofollow">https:&#x2F;&#x2F;patchwork.kernel.org&#x2F;project&#x2F;linux-input&#x2F;patch&#x2F;20201...</a>.
评论 #29769606 未加载
评论 #29772682 未加载
评论 #29768405 未加载
leonjzaover 3 years ago
I really enjoyed the debugging process here, and am glad to have learnt about the -k flag which seems to only be available on systems with strace version 5.5, at least for me.<p>As for the patch (and my love for all things Frida [1]), I think a call to Intercerptor.replace() after locating the symbol with Module.getExportByName() [2] would make for a simpler patch (at the cost of installing Frida). For example:<p><pre><code> const sym = Module.getExportByName(&quot;lime.ndll&quot;, &quot;SDL_SemWait&quot;); Interceptor.replace(sym, { onEnter: function() {}, onLeave: function() {} }); </code></pre> [1] <a href="https:&#x2F;&#x2F;frida.re&#x2F;" rel="nofollow">https:&#x2F;&#x2F;frida.re&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;frida.re&#x2F;docs&#x2F;javascript-api&#x2F;#module" rel="nofollow">https:&#x2F;&#x2F;frida.re&#x2F;docs&#x2F;javascript-api&#x2F;#module</a>
charcircuitover 3 years ago
From the description of the problem (a freeze every 3 seconds) I knew exactly what it was. You can fix it by simply upgrading SDL as they fixed this bug 2 years ago.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;spurious&#x2F;SDL-mirror&#x2F;commit&#x2F;59728f9802c7869a9b47d6176296086dc0d00d45" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;spurious&#x2F;SDL-mirror&#x2F;commit&#x2F;59728f9802c786...</a>
评论 #29768359 未加载
评论 #29768203 未加载
评论 #29768144 未加载
评论 #29768881 未加载
facorreiaover 3 years ago
This reminds me of the recent Linus Tech Tips series on gaming on Linux[1]. Their conclusion is that although many games work out of the box (although usually not at launch), Linux is not ready for mainstream gamers. Not many people would have the expertise or the interest to troubleshoot the problem as OP did.<p>[1] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Rlg4K16ujFw" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Rlg4K16ujFw</a>
评论 #29773656 未加载
评论 #29777771 未加载
评论 #29779039 未加载
Aissenover 3 years ago
strace tip of the day: you don&#x27;t need lsof, strace can keep track of open fds quite well, just use the -y flag.<p><pre><code> -y --decode-fds --decode-fds=path Print paths associated with file descriptor arguments. -yy --decode-fds=all Print all available information associated with file descriptors: protocol-specific information associated with socket file descriptors, block&#x2F;character device number associated with device file descriptors, and PIDs associated with pidfd file descriptors.</code></pre>
评论 #29775750 未加载
salted-fryover 3 years ago
Hey, I know this issue! I ran into it in CK3 when it launched. You can also work around it by running chmod go-rx &#x2F;dev&#x2F;input&#x2F; while playing your game. Whether this is more or less invasive than binary-patching the game is up for debate.
ximengover 3 years ago
Fun write up. Here’s another example of a binary patch to fix a Linux game issue:<p><a href="https:&#x2F;&#x2F;steamcommunity.com&#x2F;app&#x2F;333300&#x2F;discussions&#x2F;0&#x2F;2646360608736518971&#x2F;?ctp=2#c3050608970471835150" rel="nofollow">https:&#x2F;&#x2F;steamcommunity.com&#x2F;app&#x2F;333300&#x2F;discussions&#x2F;0&#x2F;26463606...</a>
评论 #29777174 未加载
评论 #29775612 未加载
japhibover 3 years ago
Interesting tidbit about Papers, Please: it&#x27;s written with Haxe (a programming language), on top of OpenFL (an open-source Flash alternative), which uses Lime as its foundational cross-platform library. The nice stack traces you see in the article, such as:<p>openfl::display::Application_obj::__construct<p>are because Haxe actually compiles down to C++! (That&#x27;s also why it has nice interop with C&#x2F;C++ libraries like SDL.) Haxe boasts an insane amount of compile targets -- just taking a glance at its Github page, it can compile to Javascript, C#, C++, Java, Lua, PHP, Python, and Flash, plus a couple different Haxe-specific interpreters.<p>Not many game developers use Haxe, so it has a small, tight-knit community. Other well-known games written with Haxe include Dead Cells, Northgard, and Dicey Dungeons.
Narretzover 3 years ago
Why is the engine even checking input devices so often? Shouldn&#x27;t the input device be registered via settings and then assumed to exist when the game runs? It seems wasteful to check all input devices every few seconds.
评论 #29768297 未加载
评论 #29769246 未加载
评论 #29768456 未加载
评论 #29768301 未加载
评论 #29768289 未加载
shhhumover 3 years ago
Some time ago I&#x27;ve also stumbled upon this issue and found the workaround that I&#x27;ve posted here: <a href="https:&#x2F;&#x2F;www.gog.com&#x2F;forum&#x2F;papers_please&#x2F;terrible_lags_on_linux_with_nvidia_gpu&#x2F;post3" rel="nofollow">https:&#x2F;&#x2F;www.gog.com&#x2F;forum&#x2F;papers_please&#x2F;terrible_lags_on_lin...</a><p>Thanks for a more proper digging.
CmdrKroolover 3 years ago
This looks very like a problem I encountered some time ago running the closed source 3DO emulator &quot;Phoenix Project&quot;, and similarly the open source &quot;FreeDO&quot; project that it was forked from. I narrowed it down (also using strace, IIRC) to these programs repeatedly opening and closing the &#x2F;dev&#x2F;input&#x2F;event* files, and that being weirdly slow. I made a seperate little test program just to open and close those files to confirm it. It was only slow on my main desktop machine; while on my lesser-powered laptop, running a practically identical Arch Linux setup, those file operations were quick and the programs ran fine. None of these programs use SDL. I couldn&#x27;t&#x2F;didn&#x27;t progress any further then, but it&#x27;s good to find some pointers here for further investigation (ie. the libinput issue).<p>Funnily enough I&#x27;m pretty sure I played Papers Please on this machine at length without problems but I think that was probably the Windows version through Wine.
kaszankaover 3 years ago
Wait, why is `close` in libpthread.so?
评论 #29769997 未加载
评论 #29769845 未加载
Traubenfuchsover 3 years ago
Why would you not let another thread do this nasty kind of polling and let the main loop check for a changed result, if at all?
评论 #29769999 未加载
xzjisover 3 years ago
I wonder if using the Windows version with Wine&#x2F;Proton does work better than using the Linux x64 version.
the_afover 3 years ago
This is interesting. I never noticed these pauses using the native port from GOG on Ubuntu. I&#x27;m very sensitive to this kind of thing (low refresh rates on CRT monitors used to drive me crazy when nobody else noticed).<p>Will have to fire up my copy again. A good excuse to play this marvelous game again.
shmerlover 3 years ago
Interesting investigation. I don&#x27;t remember having this problem when playing the GOG version, but may be I didn&#x27;t have a lot of input devices?
uxover 3 years ago
Great post, learned a bunch of things. Only one blog post, and no RSS (yet?) unfortunately.
nofinatorover 3 years ago
Glory to Arstotzka
pjmlpover 3 years ago
I guess that is the kind of challenge to have Windows games on GNU&#x2F;Linux, fix them instead of playing.
评论 #29772200 未加载
评论 #29768933 未加载
评论 #29772008 未加载