Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neverwinter Nights #401

Closed
Serifini opened this issue Jun 23, 2021 · 8 comments
Closed

Neverwinter Nights #401

Serifini opened this issue Jun 23, 2021 · 8 comments

Comments

@Serifini
Copy link

Firstly thanks very much for Box86 and GL4ES!

I'm trying to run the Neverwinter Nights Linux client on the current version of Pi OS (standard 32 bit version) on a Raspberry Pi 4 B. The client is running at version 1.69. I am using the following version of Box86:

Box86 with Dynarec v0.2.3 d5e3bc9 built on Jun 20 2021 00:03:24

Everything appears to work as expected except that characters do not face the direction of travel; walking backwards or sideways and NPCs often have their backs towards characters when talking. In case this was OpenGL related I've downloaded and built version 1.1.5 of GL4ES using the ODROID profile (since I'm using the Mesa VC4 driver).

With GL4ES in place, when I run the game the screen background is black, though the bottom bar and any opened sub windows still show correctly. This means I've no way of knowing if GL4ES has fixed the original problem. I've tried changing the LIBGL_FB variable, but anything other than the default value of 0 makes the entire screen go black.

I believe you mentioned somewhere that you had this game working so I thought I would post here on the off chance that you might recognise the problems and be able to suggest a fix.

@ptitSeb
Copy link
Owner

ptitSeb commented Jun 23, 2021

Oh, indeed, I reproduce the issue on my side. That's a box86 issue, I'll try to fix it...

@ptitSeb
Copy link
Owner

ptitSeb commented Jun 23, 2021

Ok, it should be fixed now.

@Serifini
Copy link
Author

Thanks for the very quick response. I've rebuilt Box86 with the latest commit but unfortunately I'm seeing the same behaviour as before; character movement is still broken when I try without using GL4ES. When I try with GL4ES I still get the black background so I'm unable to see if that makes any difference. I don't know if it could be related but I ran the tests for both projects. The Box86 tests passed all 17, but my build of GL4ES failed 3 out of 8.

$ make test
Running tests...
Test project /home/sh/src/gl4es-master/build
Start 1: GLXgears
1/8 Test #1: GLXgears ......................... Passed 3.27 sec
Start 2: StuntCarRacer
2/8 Test #2: StuntCarRacer .................... Passed 9.00 sec
Start 3: Neverball
3/8 Test #3: Neverball ........................***Failed 4.90 sec
Start 4: FoobillardPlus
4/8 Test #4: FoobillardPlus ...................***Failed 7.10 sec
Start 5: Descent3
5/8 Test #5: Descent3 ......................... Passed 8.84 sec
Start 6: PointSprite
6/8 Test #6: PointSprite ......................***Failed 4.62 sec
Start 7: OpenRA_GLES2
7/8 Test #7: OpenRA_GLES2 ..................... Passed 5.25 sec
Start 8: GLSL_lighting_GLES2
8/8 Test #8: GLSL_lighting_GLES2 .............. Passed 2.49 sec

63% tests passed, 3 tests failed out of 8

Total Test time (real) = 45.50 sec

@ptitSeb
Copy link
Owner

ptitSeb commented Jun 23, 2021

Are you sure about box86? Because it's fixed me. Characters facing their dirrection of moving (it was an issue with the Arc-tangente opcode, that should be fixed now).

@Serifini
Copy link
Author

I believe I'm testing the updated code. Here's the committed change in my source tree:

$ grep -n -A 15 0xF3 /home/sh/src/box86-master/src/dynarec/dynarec_arm_d9.c
230: case 0xF3:
231- INST_NAME("FPATAN");
232- #if 0
233- x87_forget(dyn, ninst, x1, x2, 0);
234- x87_forget(dyn, ninst, x1, x2, 1);
235- CALL(arm_fpatan, -1, 0);
236- #else
237- v1 = x87_get_st(dyn, ninst, x1, x2, 0);
238- v2 = x87_get_st(dyn, ninst, x1, x2, 1);
239- VMOV_64(0, v1); // prepare call to atan2
240- VMOV_64(1, v2);
241- CALL_2D(atan2, 0);
242- VMOV_64(v2, 0); //ST(1).d = atan2(ST1.d, ST0.d);
243- #endif
244- x87_do_pop(dyn, ninst, x3);
245- break;

I followed the build instructions including
$ sudo systemctl restart systemd-binfmt

I tried running Box86 from my fresh install in /usr/local/bin, but just to double check I've also tested running from the binary in the build directory.

$ BOX86_LD_LIBRARY_PATH=./lib:./miles /home/sh/src/box86-master/build/box86 ./nwmain
Box86 with Dynarec v0.2.3 built on Jun 23 2021 16:56:46

I'm right in thinking that Box86 doesn't cache any JIT generated code that could be stale?

@ptitSeb
Copy link
Owner

ptitSeb commented Jun 23, 2021

No JIT-cache indeed.

Ok, it's my bad, I didn't tested enough and there is another issue. The fix I did improved thing, but there is another bug :(

Back to the debugging...

@ptitSeb
Copy link
Owner

ptitSeb commented Jun 23, 2021

Ok, it should be good this time. Second fix on the same opcode...

The black background with gl4es, I don't know: maybe the GLES driver have smaler texture size limit than the GL driver, and so some LIBGL_SHRINK=11 or something like that should be used. If you are really interresting in fixing gl4es issue, please open a new ticket in gl4es repo.

@Serifini
Copy link
Author

Perfect. Thank you very much.

I'm amazed you managed to track the bug down to a problem with arc tan so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants