DEV Community

Matheus
Matheus

Posted on

sm64coopdx ported to FreeBSD

sm64coopdx
I managed to port sm64coopdx to FreeBSD. I made some small adjustments in the Makefile and Python scripts. The hard parts were Lua and optimization level. Optimization level 2 rendered SIGSEGV at times. Optimization level Z (for aggressive size optimization) solved the issue. As for Lua, the release 5.3.5 rendered SIGABRT. Updating to 5.4.7 solved the issue.

There also are input issues regarding external inputs. I couldn't get my Microntek gamepad working. Haven't managed to investigate.

I'm not confident SIGSEGV shall be fixed changing the optimization level. There might be some wrong code somewhere I couldn't find. Had no luck tracing with LLDB.

(lldb) bt
* thread #1, name = 'sm64coopdx', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0xffffffff02b5cdb0)
  * frame #0: 0x000000000274e369 sm64coopdx`vec3f_get_dist_and_angle [inlined] atan2s(y=0, x=<unavailable>) at math_util.c:856:41
    frame #1: 0x000000000274e337 sm64coopdx`vec3f_get_dist_and_angle(from=0x000034ba8cbb2f44, to=0x0000000822eba9ec, dist=<unavailable>, pitch=<unavailable>, yaw=0x000000000346af2a) at math_util.c:765:12
    frame #2: 0x0000000002781a74 sm64coopdx`next_lakitu_state(newPos=0x0000000822ebaa68, newFoc=0x0000000822ebaa78, curPos=0x000034ba8cbb2f50, curFoc=0x000034ba8cbb2f44, oldPos=0x000000000346b4d8, oldFoc=0x000000000346b4e4, yaw=0) at camera.c:5656:9
    frame #3: 0x00000000027814b2 sm64coopdx`update_lakitu(c=0x000034ba8cbb2f40) at camera.c:3024:22
    frame #4: 0x0000000002782f34 sm64coopdx`update_camera(c=0x000034ba8cbb2f40) at camera.c:3352:5
    frame #5: 0x00000000027b315f sm64coopdx`play_mode_normal at level_update.c:1305:9
    frame #6: 0x00000000027b392e sm64coopdx`update_level at level_update.c:0
    frame #7: 0x000000000274a728 sm64coopdx`level_cmd_call_loop at level_script.c:287:17
    frame #8: 0x000000000274a040 sm64coopdx`level_script_execute(cmd=<unavailable>) at level_script.c:1146:13
    frame #9: 0x000000000279f2d6 sm64coopdx`game_loop_one_iteration at game_init.c:603:24
    frame #10: 0x000000000287c077 sm64coopdx`produce_one_frame at pc_main.c:312:5
    frame #11: 0x000000000287c76a sm64coopdx`main(argc=<unavailable>, argv=<unavailable>) at pc_main.c:538:9
    frame #12: 0x0000000828634c3a libc.so.7`__libc_start1 + 298
    frame #13: 0x0000000002745240 sm64coopdx`_start at crt1_s.S:83
Enter fullscreen mode Exit fullscreen mode

Top comments (0)