Closed LeLobster closed 5 years ago
Hello, Thanks for the feedback! How can I reproduce this issue? Does it do that at launch? What distro are you using? What is your gcc version? Thanks
uname -a
: Linux leptop 4.19.0-2-amd64 SMP Debian 4.19.16-1 (2019-01-17) x86_64 GNU/Linux
gcc --version
: gcc (Debian 8.2.0-20) 8.2.0
I had to install libgtk-3-dev
and libcurl4-gnutls-dev
first
Ran make.sh
The make script, when done installing, tries to run launch.sh
which immediately produces this seg fault.
Manually cd
ing into the bin dir and running launch.sh
does the same. Manually exporting the env vars and running the samrewritten
executable segfaults as well.
Hhm weird, have you installed yajl as well as described in the readme? If this still doesn't work, can you tell me which debian desktop you picked, and how you installed your OS (netinst, full image..), so I can try to reproduce the issue?
libyajl-dev/testing,now 2.1.0-3 amd64 [installed]
libyajl2/testing,now 2.1.0-3 amd64 [installed,automatic]
No desktop, using i3-gaps
as WM via Debian netinst img
Ok, I have 0 experience debugging C/C++ but I managed to get some output from gdb
which is probably helpful
Starting program: /home/lelobster/.local/src/SamRewritten/bin/samrewritten
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff3785700 (LWP 22319)]
[New Thread 0x7ffff2f84700 (LWP 22320)]
Thread 1 "samrewritten" received signal SIGSEGV, Segmentation fault.
0x00005555555908c5 in SteamAppDAO::parse_app_names_v2 () at SAM.Picker/SteamAppDAO.cpp:131
131 unsigned array_length = v->u.array.len;
Nice! Good thing I left the '-g' flag in make.sh!
0x00005555555908c5 in SteamAppDAO::parse_app_names_v2 () at SAM.Picker/SteamAppDAO.cpp:131
131 unsigned array_length = v->u.array.len;
I'll look into this and come back to you if I find something new
hm okay can you tell me if your ~/.SamRewritten folder exists, if yes what is inside, and if you find a file called 'app_names' attach it to your answer please?
The folder and file exists. Seems like it contains a list of every game in the Steam database? I tried to quickly parse the JSON with Python and found no errors, if that's what you were looking for.
When attaching the file to this comment Github complains about file type, so I've echo'd the contents to an empty txt file and attached that.
Alright try to git pull and ./make again, I just commited. It shouldn't fix the issue but at least give you a nice error message if this is what I think it is.
app_names contains valid JSON, but it's format is not supported
That's really weird, there's no way I can reproduce the issue.. I have the same version of yajl installed, I tried using your app_names file and everything worked OK.. You didn't use sudo before ./make, right?
I'd really like to figure out what goes wrong on your machine, but I don't have much to work with, I'll try to setup a debian with i3 in a vm when I have time and try to repproduce..
In the meantime, you can use more graphical debuggers like Kdbg and set a breakpoint right before it breaks, and tell me if you find anything interesting.
I did not use sudo, no.
Have removed the app_names
file and used the .txt file I uploaded instead, same error.
Permissions seem fine as well
drwxr-xr-- 2 lelobster user 4.0K Feb 24 16:11 .SamRewritten
-rw-r--r-- 1 lelobster user 4.0M Feb 24 16:11 app_names
I'll try to poke around some with Kdbg
~No sure if I'm doing it correctly because I've never used kdbg before, but I've loaded the samrewritten
executable in kdbg and when trying to run it I see this message~
~An error occurred opening the main window.. Make sure "glade/main_window.glade" exists and is a valid file.
coming from MainPickerWindow.cpp
~
~It's right there ../glade/main_window.glade: XML 1.0 document, ASCII text
~
edit - Solved it by setting the working directory in kdbg, I'll continue
another edit - I'll just post some things which catch my eye because it's a little hard to figure out what you're looking at with no experience in C++
<error reading variable fileData (value requires 5000000 bytes, which is more than max-value-size)>
errbuf '\000' <repeats 1023 times>
And in SteamAppDAO.cpp I've added std::cerr << v << std::endl;
above line 132 std::cerr << "app_names contains valid JSON, but it's format is not supported" << std::endl;
which prints 0
in the console and tells me Cannot access memory at address 0x0
another edit 2 - Before running line 130 yajl_val v = yajl_tree_get(node, path, yajl_t_array);
the contents of v
are
0x5555555845ee <std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::~_Alloc_hider()+24>
Alright, I'm almost giving up, this is some X-Files kind of bug you've stumbled upon.
I could reproduce the issue with a standalone cpp (extension .txt because Github)
file, here main.cpp.txt. You can compile with g++ -g main.cpp -lyajl
As you can see, in the node
object, the keys "applist" and "apps" are parsed correctly, it seems that the "yajl_tree_get" function fails when asked to get the corresponding object, and returns NULL when it should not.
However, it works like a charm when I'm running the code from the SamRewritten project. I'm going to ask this question elsewhere because I have no idea why tree_parse fails in my test program.
Aaalright nevermind I think I've got it I'm just a huge moron who forgot to null terminate the array (what an idiot). Can you please git pull and try again, see if that works?
Yep, you indeed figured it out! Starting the app took a little while on first run but then suddenly a nice GUI popped up. Very nice.
I think it's having some trouble getting all of my games in the list because there are some that I can not find.
And I just relocked 3 achievements of a shit game I have no intention of playing anymore but the stats on my profile don't update, I'm assuming this is because Steam has them cached and I just need to wait a bit for it to update.
Yes, game detection is a bit sketchy, because I could not find how to use the Steam API to get all the owned apps, so instead I "retro-engineered" Steam to find out what games you own based on some cache files or whatever, so make sure to mess around a bit in steam at first, click on the games on your library or whatever just to generate the files. Note that apps without achievements won't show up in SamRewritten.
And yes, relocking achievements isn't registered for the Steam stats API, that's unfortunate, but sometimes it do be like that
Can you not just use the web API for that?
https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29
That stinks because that was actually the only reason I wanted to try out SAM. I have a couple games who I have no intention of playing anymore but they mess up my % completed stats so I wanted to relock them and throw the game in the trash where it belongs.
That's interesting, I have to admit I didn't think about using the web API. Maybe I will implement it someday, but if I do I think I will redo all of this from scratch, probably as an electron app or whatever.
And yeah about relocking, I think there's no way of getting your completion rate back to original. What I sometimes to is idle a bit, by leaving the game panel open, and unlocking as many achievements to match your average completion rate. Not ideal but it doesn't look like I have a choice
I'm personally not a fan of Electron, but I understand it's super convenient
and unlocking as many achievements to match your average completion rate
Thing is I also use astats so cheating in achievements with SAM will not be a good idea haha
It's not very verbose so I don't know how to share other information about this error.
Also cannot find the core dump in any of the folders.