ptitSeb / box86

Box86 - Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices
https://box86.org
MIT License
3.36k stars 233 forks source link

VCMI x86 - not working #266

Closed nru1979 closed 2 years ago

nru1979 commented 3 years ago

Segmentation fault. Might be a decent plan B if HoMM3 is impossible to make work. Configuration: Debian stretch 386 package installed vcmi and deps PI 3B+ Raspbian Buster 256mb /var/swap Box86 0.1.7

2020-12-09-213448_1920x1080_scrot

ptitSeb commented 3 years ago

Symbol mpg123_scan is missing and is probably not helping, I need to add it.

Can you do a addr2line -e /usr/local/bin/box86 -a 0x6281515c also.

nru1979 commented 3 years ago

0x6281515c /home/pi/box86/src/box86context.c:168

ptitSeb commented 3 years ago

Oh, that's odd.

Does BOX86_JITGDB=1 works for you (I mean, it launch gdb and it's usable on that Segfault)? I would like to the result of that command: thread apply all bt then (from the gdb, then use k to kill the program and quit). I don't understand why context would be NULL in addDBFromAddressRange(...)

ptitSeb commented 3 years ago

Nevermind, I can reproduce it on my side.

nru1979 commented 3 years ago

runs the intro then crashes 2020-12-10-175013_1920x1080_scrot

ptitSeb commented 3 years ago

well, it goes farther. So that's technically another issue.

Your addr2line command is not good, you forget the -e for the exe and -a for the address. Anyway, that's not much interresting here; as the crash seems to be inside libvcmi.so, in a precise C++ function, accessing some strucutr behind a null pointer probably.

ptitSeb commented 3 years ago

Well, what is strange is that you may be in the interpretor instead of the dynarec... So the addr2line result might still be interresting.

nru1979 commented 3 years ago

pi@raspberrypi:~/games $ addr2line -e /usr/local/bin/box86 -a 0x62865c64 0x62865c64 /home/pi/box86/src/emu/x86run.c:1572

nru1979 commented 3 years ago

last fix made heroes 4 so slow that it became unplayable. vcmi intro plays very slow too. seems to be a cpu or gpu overload problem. moving mouse pointer on menu screen works fine

ptitSeb commented 3 years ago

the "Improve PltResolver" one? Can you check what function consume CPU the most? (using things like sudo perf top but "perf" is not always here for the right kernel, you may need to use perf_* like perf_4.18 or some like that.

nru1979 commented 3 years ago

This fix seems to have fixed Heroes 3 though. No more segmentation faults there so far. However, it hurts performance extremely bad. Heroes 3 became as slow as Heroes 4 (before the patch). So now, VCMI --> very slow intro then crashes H3: very slow intro then slow but stable game H4: extremely slow, I think it is stable though. but it is so slow that it is unplayable.

nru1979 commented 3 years ago

no perf_5.4 availlable for my buster :-( Perf 4.9 does not provide perf top seemingly

ptitSeb commented 3 years ago

The slowiness is with the windows version? That's very strange. It's not a sideeffect I can explain.

Can you downgrade to previous commit -git checkout dcbb8b29de55062945de34111edbda088d5a93d6 to make sure that commit have this effect?

nru1979 commented 3 years ago

slowness seems to happen with everything. Not very familiar with git... Does not seem to give results that way: 2020-12-10-220737_1920x1080_scrot

ptitSeb commented 3 years ago

That's fine. You are now on the previous commit. Just make -j3 && sudo make install to install that version and test. After that, to go back to latest version, do git checkout master than make -j3 && sudo make install...

nru1979 commented 3 years ago

vcmi still shows intro. im still on the newest commit... git pull didnt refresh my files.

ptitSeb commented 3 years ago

Yes it does. It just that I pushed 3 or 4 comits at the same time... Look with the github web interface, click the "3006 commits" zone to have the list of all commits. The one that fixed the issue is named "Initialize context as soon as possible in library (should help #265 and …" You can see there are a few more after that... So it may no be the "last" one.

nru1979 commented 3 years ago

OK just noticed. Ill try 4e7e0f6aab2ccc060e19d815907d37db2138c26d and 9805ad7f3a8e5fb8cf67d8a3323af965acd0e095 I have a feeling the speed issue on windows might be linked to these 2. might happen tomorrow though... Not sure to be awake enough to do it today.

nru1979 commented 3 years ago

I feel im missing something: no matter the checkout I take, box86 still behaves the same. Only the signature of the build change. Is there a command to manually sync my directory with the checkout? I even tried a yesterday's checkout and vcmi still works there.

nru1979 commented 3 years ago

ok git checkout works. I get older behaviors. Looks like performance issue is not in the last commits. Ill try to back to the future and look for the commit which changed everything. I keep you informed

ptitSeb commented 3 years ago

Maybe you have a parasite process slowy things down (check with htop or reboot)? Or maybe you rebuilt without Dynarec enabled (or without the PI4 profile). Check that "with Dynarec" is mentionned when you type box86 --version

nru1979 commented 3 years ago

The problem was the user: I forgot DRPI3=1 in cmake. Now works well. No more performance issue. I will go forward with stability tests in H3 windows and hopefully come back with a positive outcome. Sorry for loss of time