Page 1 of 1

[raiguard][2.0.7] Importing large strings is broken on Linux

Posted: Mon Oct 21, 2024 7:43 pm
by PALKOVNIK
Steps to reproduce:
- grab the KoS book from https://drive.google.com/drive/folders/ ... MjGkoRkOAg
- try to import it in game

Result:
- nothing happens at all

Breaking down the string into smaller chunks allows me to paste the chunks one by one in the import window in game, but import still fails in the end with error saying "decompression failed".

Re: [2.0.7] Importing large strings is broken on Linux

Posted: Mon Oct 21, 2024 10:07 pm
by raiguard
Please try switching to Wayland in the graphics settings.

Re: [2.0.7] Importing large strings is broken on Linux

Posted: Mon Oct 21, 2024 11:17 pm
by raiguard
A bit of background on this:

This is a known issue. In the past, we worked around this by implementing custom X11 clipboard code. However, for 2.0, I have removed our dependency on X11 and switched to using SDL's clipboard functions. SDL2 does not support the mechanism required to transfer large clipboard contents on X11, but this has been fixed for SDL3.

In other words, the only way to fix it is to switch to Wayland, or wait for us to update to SDL3 at some unknown point in the future.

I'm sorry!

Re: [2.0.7] Importing large strings is broken on Linux

Posted: Tue Oct 22, 2024 1:23 am
by PALKOVNIK
I can't switch to wayland :/ To be frank I'm quite sad you are using SDL, it sucks enormously

Re: [2.0.7] Importing large strings is broken on Linux

Posted: Tue Oct 22, 2024 8:07 pm
by raiguard
SDL is far better than what we were using before. :)

In any case, I just ran into this when I was copying a not-even-that-large blueprint for a different bug report (I run the game under xwayland while debugging for a few reasons) so I'll look into seeing how difficult it would be to backport the fix from SDL3 into SDL2.

Re: [2.0.7] Importing large strings is broken on Linux

Posted: Tue Oct 22, 2024 8:11 pm
by credomane
Same. Wayland is still a pain to use when you just want everything to work. I'm super excited for the changes that frog-protocols has already kicked up in wayland so hopefully that will start changing in the next couple years. That and Nvidia quit being difficult too.


I remember reading the FFF that talked about X11/wayland where this breakage was mentioned. Reasoning being to massively reduce dependencies (a good thing!) but I was hopeful something would have been put in place to resolve that by release.

Would it be possible to have the ability to open a file dialog window to open a txt file with the blueprint string in it instead? Just make the factorio client process the file like it was actually a normal clipboard import so it doesn't break the lock-step/syncronization in multiplayer? Probably not, since SDL2 doesn't have native file dialogs....but SDL3 does. lol. Hopefully a port to SDL3 isn't prohibitively difficult and will happen at some point.

Would it at least be possible to detect the BP string was incomplete/corrupt and that you are on Linux running X11 then provide feedback of some sort instead of silently failing?

Re: [2.0.7] Importing large strings is broken on Linux

Posted: Tue Oct 22, 2024 8:17 pm
by raiguard
credomane wrote: Tue Oct 22, 2024 8:11 pm Same. Wayland is still a pain to use when you just want everything to work. I'm super excited for the changes that frog-protocols has already kicked up in wayland so hopefully that will start changing in the next couple years. That and Nvidia quit being difficult too.
I've been running wayland for years, but I have an AMD GPU. Sometimes I forget that wayland is still a PITA for those with NVIDIA cards.

credomane wrote: Tue Oct 22, 2024 8:11 pm I remember reading the FFF that talked about X11/wayland where this breakage was mentioned. Reasoning being to massively reduce dependencies (a good thing!) but I was hopeful something would have been put in place to resolve that by release.
I had intended on adding the capability to SDL2, but the changes were too invasive so it was put into SDL3. SDL2 is in "maintenance mode".
credomane wrote: Tue Oct 22, 2024 8:11 pm Would it be possible to have the ability to open a file dialog window to open a txt file with the blueprint string in it instead? Just make the factorio client process the file like it was actually a normal clipboard import so it doesn't break the lock-step/syncronization in multiplayer? Probably not, since SDL2 doesn't have native file dialogs....but SDL3 does. lol. Hopefully a port to SDL3 isn't prohibitively difficult and will happen at some point.
Yeah, SDL3 will have convenient open-file dialogs, but that is SDL3, not SDL2. And upgrading to SDL3 will be a pretty involved process.,
credomane wrote: Tue Oct 22, 2024 8:11 pm Would it at least be possible to detect the BP string was incomplete/corrupt and that you are on Linux running X11 then provide feedback of some sort instead of silently failing?
Unfortunately not. When you try to paste a large blueprint, the game receives nothing because X11 tries to send it over INCR, but the game doesn't support it so it doesn't see anything.


There are two paths forward: either I try to backport the SDL3 fix into SDL2, or I re-introduce our custom clipboard code and try to figure out how to link against X11 at runtime (to avoid requiring X11 to be installed for the game to run at all). Both solutions sound like royal pains. I promise I will look into it, but it may take a little while.

Re: [raiguard][2.0.7] Importing large strings is broken on Linux

Posted: Tue Oct 22, 2024 8:21 pm
by credomane
If it isn't possible then it isn't possible. Just sucks is all.

Yeah my next GPU is definitely gonna be team AMD just because of the headaches with nvidia and linux.

Re: [raiguard][2.0.7] Importing large strings is broken on Linux

Posted: Wed Nov 13, 2024 9:27 am
by Nebulorum
This worked for me. I assumed because I was using Wayland the game would be in Wayland. After changing the setting and restarting Factorio it works perfectly. Being new to desktop Linux still struggling with these things. Thank a lot for this post.

Re: [2.0.7] Importing large strings is broken on Linux

Posted: Mon Nov 18, 2024 12:00 am
by steveyh25
raiguard wrote: Tue Oct 22, 2024 8:17 pm There are two paths forward: either I try to backport the SDL3 fix into SDL2, or I re-introduce our custom clipboard code and try to figure out how to link against X11 at runtime (to avoid requiring X11 to be installed for the game to run at all). Both solutions sound like royal pains. I promise I will look into it, but it may take a little while.
Sorry for bumping the post but I have this issue also and I can't use wayland because issues with nvidia gpu. Is there not an "easier" way of fixing this by just allowing us to enter a path to the file containing the blueprint string? then it can just be read from disk directly instead of via clipboard

I have a 6million character blueprint that I'm trying to import

Re: [raiguard][2.0.7] Importing large strings is broken on Linux

Posted: Wed Nov 20, 2024 9:23 am
by Dadoo
It's a line length thing. Use:

xclip -selection clipboard -o | fold -80 > blueprint

Then, open "blueprint" in a GUI text editor, select all, copy to clipboard, go to Factorio, paste.

I haven't tried it with a 6M blueprint, but it works with a 650K blueprint.

Re: [raiguard][2.0.7] Importing large strings is broken on Linux

Posted: Thu Nov 21, 2024 5:21 pm
by morsk
I once helped someone edit blueprint text into Lua inside of a map, and load the map to get the blueprint. It is very silly but if there is no other way you can try this. Any other solution would be better if you can find one!

https://www.reddit.com/r/factorio/comme ... blueprint/