DarioSamo / sm64rt

Fork of https://github.com/sm64pc/sm64ex with raytracing support.
282 stars 13 forks source link

Game crashes on launch. #17

Closed rufus8383 closed 3 years ago

rufus8383 commented 3 years ago

Describe the bug Game crashes nearly every time it's launched.

To Reproduce Launch game EXE file Watch it hang It crashes.

Expected behavior Game runs normally.

Screenshots I got a 7 minute video of me launching it over and over. Unfortunately I wasn't lucky enough to capture that elusive launch where it actually shows the logo and it runs at 1 FPS and then crashes. https://streamable.com/kfl2ky

Desktop (please complete the following information): DXDiag Attached

Smartphone (please complete the following information): N/A

Additional context I spoke with Dario on the Discord earlier about this issue and he wanted to look into it. I wish I had captured the partial load of the game where it was running so slowly before it crashed, but this is what I was able to reproduce. I think I remember this being an Issue since the release of the RT version, but it may have even been an issue with the normal R96 version.

DxDiag.txt

DarioSamo commented 3 years ago

So couple of questions:

  1. Do you have any sort of texture packs installed? It is possible the system is running out of VRAM due to an excessive amount of HD textures? You could monitor this information with something like MSI Afterburner or such. Raytracing needs a heavy amount of VRAM for acceleration structures and rendering buffers, so the requirements are higher than the regular game. Textures have a large effect because it just preloads everything at the start.
  2. You can get some more useful information about the crash by using gdb included in MSYS2 like this:
    • Open MSYS 64-bit (the same one you used for make)
    • Go to the build/us_pc directory using cd.
    • Type gbd sm64.us.f3dex2e.exe and press Enter.
    • While inside gdb, type run and press Enter.
    • Wait for the game to crash.
    • Type backtrace and press Enter. Copy the output from gdb here so I can see if it has any useful information.
rufus8383 commented 3 years ago

(gdb) run Starting program: /home/rufus/render96ex/build/us_pc/sm64.us.f3dex2e.exe [New Thread 7836.0x1f90] [New Thread 7836.0x46ac] [New Thread 7836.0xadc] fs: writepath set to C:/Users/rufus/AppData/Roaming/sm64ex fs: gamedir set to res fs: mounting './res' fs: mounting 'C:/msys64/home/rufus/Render96ex/build/us_pc/res' fs: mounting 'C:/Users/rufus/AppData/Roaming/sm64ex' Loading configuration from 'sm64config.txt' option: 'fullscreen', value: 'true' option: 'window_x', value: '4294967295' option: 'window_y', value: '4294967295' option: 'window_w', value: '2560' option: 'window_h', value: '1377' option: 'vsync', value: 'false' option: '60fps', value: 'true' option: 'internal_bool', value: 'true' option: 'internal_swap', value: '1' option: 'internal_w', value: '0' option: 'internal_h', value: '0' option: 'force4by3', value: 'false' option: 'texture_filtering', value: '1' option: 'drawing_distance', value: '100' option: 'master_volume', value: '127' option: 'music_volume', value: '127' option: 'sfx_volume', value: '127' option: 'env_volume', value: '127' option: 'key_a', value: '0026' '1000' '1103' option: 'key_b', value: '0033' '1002' '1101' option: 'key_start', value: '0039' '1006' 'ffff' option: 'key_l', value: '002a' '1009' '1104' option: 'key_r', value: '0036' '100a' '101b' option: 'key_z', value: '0025' '1007' '101a' option: 'key_cup', value: '0148' 'ffff' 'ffff' option: 'key_cdown', value: '0150' 'ffff' 'ffff' option: 'key_cleft', value: '014b' 'ffff' 'ffff' option: 'key_cright', value: '014d' 'ffff' 'ffff' option: 'key_stickup', value: '0011' 'ffff' 'ffff' option: 'key_stickdown', value: '001f' 'ffff' 'ffff' option: 'key_stickleft', value: '001e' 'ffff' 'ffff' option: 'key_stickright', value: '0020' 'ffff' 'ffff' option: 'stick_deadzone', value: '16' option: 'rumble_strength', value: '50' option: 'precache', value: 'true' option: 'language', value: '0' option: 'disable_billboard', value: 'false' option: 'bettercam_enable', value: 'false' option: 'bettercam_analog', value: 'true' option: 'bettercam_mouse_look', value: 'false' option: 'bettercam_invertx', value: 'true' option: 'bettercam_inverty', value: 'false' option: 'bettercam_xsens', value: '50' option: 'bettercam_ysens', value: '50' option: 'bettercam_aggression', value: '0' option: 'bettercam_pan_level', value: '0' option: 'bettercam_degrade', value: '10' option: 'skip_intro', value: 'false' option: 'enable_cheats', value: 'false' option: 'moonjump', value: 'false' option: 'invincible', value: 'false' option: 'infintie_lives', value: 'false' option: 'super_speed', value: 'false' option: 'controls', value: 'false' option: 'exit_anywhere', value: 'false' option: 'huge_mario', value: 'false' option: 'tiny_mario', value: 'false' option: 'coin', value: '0' option: 'hover_mode', value: 'false' option: 'moon_gravity', value: 'false' option: 'run_speed', value: '0' option: 'no_death_barrier', value: 'false' option: 'jumps_higher', value: 'false' option: 'speed_display', value: 'false' option: 't_pose_float', value: 'false' option: 'cannon_anywhere', value: 'false' option: 'auto_wk', value: 'false' option: 'get_shell', value: 'false' option: 'get_bobomb', value: 'false' option: 'swift_swim', value: 'false' option: 'blj_anywhere', value: '0' option: 'play_as', value: '0' option: 'flyer', value: 'false' option: 'rt64_res_scale', value: '100' option: 'rt64_sphere_lights', value: 'false' option: 'rt64_gi', value: 'false' option: 'rt64_gi_strength', value: '80' option: 'rt64_denoiser', value: 'false' Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/AM_us.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/AM_us.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/DE_de.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/DE_de.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/EL_gr.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/EL_gr.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/ES_es.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/ES_es.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/ES_la.dynos.[New Thread 7836.0x4288] [New Thread 7836.0x16d8] [New Thread 7836.0x221c] [New Thread 7836.0x43a0] [Thread 7836.0x43a0 exited with code 0] [New Thread 7836.0x1ee8] [New Thread 7836.0xaf0] [New Thread 7836.0x4634] [New Thread 7836.0x1a88] json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/ES_la.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/FR_fr.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/FR_fr.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/IT_it.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/IT_it.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/PL_pl.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/PL_pl.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/PT_br.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/PT_br.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/SV_se.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/SV_se.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/TR_tr.dynos.json Loading File: C:\msys64\home\rufus\render96ex\build\us_pc/res/texts/TR_tr.json Loading savefile from 'C:/Users/rufus/AppData/Roaming/sm64ex/render96_save_file_0.sav' precaching data [New Thread 7836.0x13b0] [New Thread 7836.0x2bf4] warning: HEAP[sm64.us.f3dex2e.exe]: warning: HEAP: Free Heap block 000002E33A77E880 modified at 000002E33A77E9C8 after it was freed

Thread 1 received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffb00faa263 in ntdll!RtlRegisterSecureMemoryCacheCallback () from /c/WINDOWS/SYSTEM32/ntdll.dll (gdb) backtrace

0 0x00007ffb00faa263 in ntdll!RtlRegisterSecureMemoryCacheCallback ()

from /c/WINDOWS/SYSTEM32/ntdll.dll

1 0x00007ffb00ed657d in ntdll!RtlGetCurrentServiceSessionId ()

from /c/WINDOWS/SYSTEM32/ntdll.dll

2 0x00007ffb00ed5b74 in ntdll!RtlGetCurrentServiceSessionId ()

from /c/WINDOWS/SYSTEM32/ntdll.dll

3 0x00007ffb00ed47b1 in ntdll!RtlFreeHeap () from /c/WINDOWS/SYSTEM32/ntdll.dll

4 0x00007ffb00fa928a in ntdll!RtlRegisterSecureMemoryCacheCallback ()

from /c/WINDOWS/SYSTEM32/ntdll.dll

5 0x00007ffb00ed5cc1 in ntdll!RtlGetCurrentServiceSessionId ()

from /c/WINDOWS/SYSTEM32/ntdll.dll

6 0x00007ffb00ed5b74 in ntdll!RtlGetCurrentServiceSessionId ()

from /c/WINDOWS/SYSTEM32/ntdll.dll

7 0x00007ffb00ed47b1 in ntdll!RtlFreeHeap () from /c/WINDOWS/SYSTEM32/ntdll.dll

8 0x00007ffb00309c9c in msvcrt!free () from /c/WINDOWS/System32/msvcrt.dll

9 0x00007ff6df7e11cf in SDL_free_REAL ()

10 0x00007ff6df816af6 in SDL_JoystickOpen_REAL ()

11 0x00007ff6df8145f7 in SDL_GameControllerOpen_REAL ()

12 0x00007ff6df7671e8 in DynOS_Opt_ControllerIsKeyDown(int, int) ()

13 0x00007ff6df767266 in DynOS_Opt_ControllerUpdate(DynosOption, void) ()

14 0x00007ff6df764694 in DynOS_Opt_Loop(DynosOption, bool ()(DynosOption, void), void*) ()

15 0x00007ff6df7646b3 in DynOS_Opt_Loop(DynosOption, bool ()(DynosOption, void), void*) ()

16 0x00007ff6df764a77 in DynOS_Opt_Update(OSContPad*) ()

17 0x00007ff6df761d9a in DynOS_UpdateOpt(void*) ()

18 0x00007ff6df699661 in read_controller_inputs ()

19 0x00007ff6df699939 in game_loop_one_iteration ()

20 0x00007ff6df727672 in produce_one_frame ()

21 0x00007ff6df774e48 in gfx_rt64_wnd_proc(HWND__*, unsigned int, unsigned long long, long long) ()

22 0x00007ffb0013e858 in USER32!CallWindowProcW () from /c/WINDOWS/System32/USER32.dll

--Type for more, q to quit, c to continue without paging--

23 0x00007ffb0013e3dc in USER32!DispatchMessageW () from /c/WINDOWS/System32/USER32.dll

24 0x00007ffb00150bc3 in USER32!SendMessageTimeoutW () from /c/WINDOWS/System32/USER32.dll

25 0x00007ffb00f50c54 in ntdll!KiUserCallbackDispatcher () from /c/WINDOWS/SYSTEM32/ntdll.dll

26 0x00007ffafe921704 in win32u!NtUserDispatchMessage () from /c/WINDOWS/System32/win32u.dll

27 0x00007ffb0013e2ea in USER32!DispatchMessageW () from /c/WINDOWS/System32/USER32.dll

28 0x00007ff6df76acaa in gfx_rt64_wapi_main_loop(void (*)()) ()

29 0x00007ff6df727a9d in main_func ()

30 0x00007ff6df727b56 in SDL_main ()

31 0x00007ff6df79acea in main_getcmdline ()

32 0x00007ff6df6513c1 in _tmainCRTStartup () at C://M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:321

33 0x00007ff6df6514d6 in WinMainCRTStartup () at C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:176

rufus8383 commented 3 years ago

I was kinda wondering the same thing if it was a memory issue. I do have the Render96 model pack and the HD texture pack installed.

DarioSamo commented 3 years ago

Do you have some sort of game controller connected? The backtrace indicates the error is related to some game controller polling functionality which is odd.

Would be good if you can verify if it runs properly without the texture pack as well.

rufus8383 commented 3 years ago

It was totally related to the controller I had plugged in. I have no Idea why, but the PDP Afterglow Nintendo Switch controller causes the crash. It works fine with my PS4 controller, but as soon as I connect this Switch controller either via USB or Bluetooth it causes this crash.

EDIT: Tested just now with default textures and the problem persists. It's still the controller causing the issue. As long as it isn't connected the game launches and runs great.

DarioSamo commented 3 years ago

Well, it would be interesting if you could test if this happens in sm64rt if you have the time or just on Render96ex. If it's a Render96ex problem you'll need to report the problem to their team then.

Since I haven't modified a single thing or know how the controller polling works in this port, I'm gonna guess it's not really related to the renderer at all.

rufus8383 commented 3 years ago

I already did that. Both sm64rt and Render96ex run great now and both also crash with the controller plugged in. I only just recently started using this controller at the same time I started having issues with this Mario 64 port. I just never put it together or assumed the controller would be the issue. Thanks for helping me figure it out. I should probably report this to whoever started the sm64 port as they're probably the ones who need to know.

DarioSamo commented 3 years ago

Yeah, I guess you can just go backwards to sm64ex (which both projects are forked from) and even sm64pc to see if you can track down from where the problem starts from.

rufus8383 commented 3 years ago

Just finished testing back and the problem first appears with the Render96ex fork. sm64ex works fine with the Switch controller connected. The original sm64-port doesn't seem to have any issues either.

DarioSamo commented 3 years ago

What about sm64ex nightly branch? That's the one sm64rt was forked from.

rufus8383 commented 3 years ago

I didn't think to test that, but I will and report back.

I'm not incredibly savvy with this type of thing so I may just be suspicious for no reason, but I did find it a bit strange that your version says it's forked from sm64ex and the Render96ex project says it's forked from sm64-port. Unless their project just says that on the git page and it's actually borrowing features from sm64ex, otherwise I don't see how this issue could exist in both projects especially since you've changed nothing but the rendering.

DarioSamo commented 3 years ago

I think that's just due to what GitHub's Fork button does, but you can merge from any other branch or fork that you want using the commandline. I have no history with their project so I wouldn't know how to answer that to be honest.

rufus8383 commented 3 years ago

Right on. Like I said, I'm not very familiar with this so I might not understand it fully. I am on a mission now to nail this down though as it's really got me curious.

rufus8383 commented 3 years ago

Well, I feel good now knowing what the issue was, but it kinda bugs me to say this. I'm almost %100 certain now that whatever my issue was had to be user error. I had been building this with the msys2 command prompt myself and never had any issues before, but started to for whatever reason. Maybe I didn't have it properly set up, I'm not sure, but after building several versions of this game with and without models and textures, every version including your ray traced version works perfect with the controller using sm64pcBuilder2 to build the projects.

EDIT: Well, now unfortunately I have to take that back. It seemed like it was all working OK, but after about 15 minutes of gameplay it froze and now it's back to crashing when that controller is plugged in. I'm not so sure this really has anything to do with the game or not now. Maybe that controller just has issues in general. I'm not sure what to say at this point.

DarioSamo commented 3 years ago

If I had to guess: maybe it has something to do with the controller connecting or disconnecting while the game is running.

rufus8383 commented 3 years ago

I'm downloading the ex nightly build and I'm gonna play it for a while instead of just briefly testing it. It seems it doesn't cause issue immediately. I was able to launch the Render96 rt build several times and played it for about 15 minutes before it went haywire.

I should probably mention that it didn't just randomly freeze. It happened when I increased the draw distance. As soon as I hit apply is when it froze.

OK, I just finished building sm64ex nightly and it fails to launch. It's definitely not related to your build or Render96.