libretro / LRPS2

GNU General Public License v2.0
165 stars 48 forks source link

Debug core crashes RA on load content #118

Closed bslenul closed 3 years ago

bslenul commented 3 years ago

Hey, any idea why Debug build would crash RA on load content? Looks like at some point it returns an empty value or something (I don't understand why this not an issue on Release build tho...):

retroarch_drmingw.exe caused an Access Violation at location 00007FFD6C53D44B in module pcsx2_libretro.dll Reading from location 0000000000000898.

AddrPC           Params
00007FFD6C53D44B 0000000000000880 00007FFD6C536F89 00000049BC7F1638  pcsx2_libretro.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::size  [G:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\xstring @ 3940]
  3938: 
  3939:     _NODISCARD _CONSTEXPR20_CONTAINER size_type size() const noexcept {
> 3940:         return _Mypair._Myval2._Mysize;
  3941:     }
  3942: 
00007FFD6C53C3A4 0000000000000880 00007FFD6CF421A8 00000049BC7F3640  pcsx2_libretro.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::empty  [G:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\xstring @ 4019]
  4017: 
  4018:     _NODISCARD _CONSTEXPR20_CONTAINER bool empty() const noexcept {
> 4019:         return size() == 0;
  4020:     }
  4021: 
00007FFD6C53C467 0000000000000880 0000000000000000 CCCCCCCCCCCCCCCC  pcsx2_libretro.dll!wxString::empty  [G:\msys64\home\B-S\pcsx2\3rdparty\wxwidgets3.0\include\wx\string.h @ 1393]
  1391:   size_type max_size() const { return npos; }
  1392: 
> 1393:   bool empty() const { return m_impl.empty(); }
  1394: 
  1395:   // NB: these methods don't have a well-defined meaning in UTF-8 case
00007FFD6C6796EB 0000000000000828 CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC  pcsx2_libretro.dll!wxFileName::IsDir  [G:\msys64\home\B-S\pcsx2\3rdparty\wxwidgets3.0\include\wx\filename.h @ 495]
   493: 
   494:     // Is this a file or directory (not necessarily an existing one)
>  495:     bool IsDir() const { return m_name.empty() && m_ext.empty(); }
   496: 
   497:     // various helpers
00007FFD6CD75A0A 0000000000000828 00000049BC7F1940 00000049BC7F1800  pcsx2_libretro.dll!wxDirName::Combine  [G:\msys64\home\B-S\pcsx2\common\src\Utilities\PathUtils.cpp @ 28]
    26: wxFileName wxDirName::Combine(const wxFileName &right) const
    27: {
>   28:     pxAssertMsg(IsDir(), L"Warning: Malformed directory name detected during wxDirName concatenation.");
    29:     if (right.IsAbsolute())
    30:         return right;
00007FFD6C601BFE 0000000000000828 00000049BC7F1940 00000049BC7F2E18  pcsx2_libretro.dll!wxDirName::operator+  [G:\msys64\home\B-S\pcsx2\common\include\Utilities\Path.h @ 188]
   186:     wxFileName operator+(const wxFileName &right) const { return Combine(right); }
   187:     wxDirName operator+(const wxDirName &right) const { return Combine(right); }
>  188:     wxFileName operator+(const wxString &right) const { return Combine(wxFileName(right)); }
   189:     wxFileName operator+(const char *right) const { return Combine(wxFileName(fromUTF8(right))); }
   190: 
00007FFD6C8D82FC 00000049BC7F2E18 00000049BC7F2E68 00000049BC7F2DC0  pcsx2_libretro.dll!IsBIOS  [G:\msys64\home\B-S\pcsx2\pcsx2\ps2\BiosTools.cpp @ 323]
   321: bool IsBIOS(const wxString& filename, wxString& description)
   322: {
>  323: wxFileName Bios( g_Conf->Folders.Bios + filename );
   324: pxInputStream inway( filename, new wxFFileInputStream( filename ) );
   325: 
00007FFD6C52CD8B 0000000000000000 000001C5462B4280 00000000000000FF  pcsx2_libretro.dll!retro_init  [G:\msys64\home\B-S\pcsx2\libretro\main.cpp @ 265]
   263: {
   264: wxString description;
>  265: if (IsBIOS(bios_file, description)) {
   266: std::string log_bios = (std::string)description;
   267: bios_files.push_back((std::string)bios_file);
00007FF7E96BC25C 000001C5462B4280 00007FF7EA662CE0 000001C500000000  retroarch_drmingw.exe!command_event_init_core  [G:/msys64/home/B-S/retroarch/retroarch.c @ 12771]
 12769:    video_driver_set_cached_frame_ptr(NULL);
 12770: 
>12771:    p_rarch->current_core.retro_init();
 12772:    p_rarch->current_core.inited          = true;
 12773: 
00007FF7E96BF436 000001C50000002A 00007FF7EA6B0920 00007FF7EA00B301  retroarch_drmingw.exe!command_event  [G:/msys64/home/B-S/retroarch/retroarch.c @ 14370]
 14368:          {
 14369:             enum rarch_core_type *type    = (enum rarch_core_type*)data;
>14370:             rarch_system_info_t *sys_info = &runloop_state.system;
 14371: 
 14372:             content_reset_savestate_backups();
00007FF7E96EE376 000001C50000000B 00000049BC7F5DF0 00000049BC7F5DF0  retroarch_drmingw.exe!retroarch_main_init  [G:/msys64/home/B-S/retroarch/retroarch.c @ 36072]
 36070:          "audio driver", verbosity_enabled);
 36071:    video_driver_find_driver(p_rarch, settings,
>36072:          "video driver", verbosity_enabled);
 36073:    input_driver_find_driver(p_rarch, settings,
 36074:          "input driver", verbosity_enabled);
00007FF7E970D8B2 00000049BC7F5F70 00007FF7EA683338 00000000000022A8  retroarch_drmingw.exe!content_load  [G:/msys64/home/B-S/retroarch/tasks/task_content.c @ 1475]
  1473:    wrap_args->argv = rarch_argv_ptr;
  1474: 
> 1475:    success         = retroarch_main_init(wrap_args->argc, wrap_args->argv);
  1476: 
  1477:    for (i = 0; i < ARRAY_SIZE(argv_copy); i++)
00007FF7E970DF86 00007FF7EA683338 00000049BC7F81B0 00000049BC7F5FF0  retroarch_drmingw.exe!command_event_cmd_exec  [G:/msys64/home/B-S/retroarch/tasks/task_content.c @ 1701]
  1699: 
  1700:       /* Loads content into currently selected core. */
> 1701:       if (!content_load(&content_info, p_content))
  1702:          return false;
  1703:       task_push_to_history_list(p_content, true, launched_from_cli, false);
00007FF7E970E6DA 00000049BC7F61B0 00000049BC7F81B0 0000000000000000  retroarch_drmingw.exe!task_push_load_content_from_playlist_from_menu  [G:/msys64/home/B-S/retroarch/tasks/task_content.c @ 1961]
  1959:     * > On targets that do not support dynamic core loading,
  1960:     *   command_event_cmd_exec() will fork a new instance */
> 1961:    if (!(ret = command_event_cmd_exec(p_content,
  1962:          fullpath, &content_ctx, false, &error_string)))
  1963:       goto end;
00007FF7E99F7B3C 00000049BC7F61B0 00000049BC7F81B0 0000000000000000  retroarch_drmingw.exe!default_action_ok_load_content_from_playlist_from_menu  [G:/msys64/home/B-S/retroarch/menu/cbs/menu_cbs_ok.c @ 2141]
  2139:    content_info.args                   = NULL;
  2140:    content_info.environ_get            = NULL;
> 2141:    if (!task_push_load_content_from_playlist_from_menu(
  2142:             _path, path, entry_label,
  2143:             &content_info,
00007FF7E99F8CE2 00000049BC7FC278 00000049BC7FC377 000001C500000007  retroarch_drmingw.exe!action_ok_playlist_entry_collection  [G:/msys64/home/B-S/retroarch/menu/cbs/menu_cbs_ok.c @ 2517]
  2515:     * may be free()'d by above playlist_free() - but need
  2516:     * to pass NULL explicitly if label is empty */
> 2517:    return default_action_ok_load_content_from_playlist_from_menu(
  2518:          core_path, content_path, string_is_empty(content_label) ? NULL : content_label);
  2519: 
00007FF7E96A70AC 000001C54F91D6D0 00000049BC7FC260 0000000000000000  retroarch_drmingw.exe!generic_menu_entry_action  [G:/msys64/home/B-S/retroarch/retroarch.c @ 2573]
  2571:       case MENU_ACTION_OK:
  2572:          if (cbs && cbs->action_ok)
> 2573:             ret = cbs->action_ok(entry->path,
  2574:                   entry->label, entry->type, i, entry->entry_idx);
  2575:          break;
00007FF7E998D019 000001C54F91D6D0 00000049BC7FC260 0000000000000000  retroarch_drmingw.exe!ozone_menu_entry_action  [G:/msys64/home/B-S/retroarch/menu/drivers/ozone/ozone.c @ 640]
   638: 
   639:    /* Call standard generic_menu_entry_action() function */
>  640:    return generic_menu_entry_action(userdata, entry_ptr,
   641:          new_selection, new_action);
   642: }
00007FF7E96A7ED6 00000049BC7FC260 0000000000000000 0000000000000005  retroarch_drmingw.exe!menu_entry_action  [G:/msys64/home/B-S/retroarch/retroarch.c @ 2853]
  2851:    if (     p_rarch->menu_driver_ctx
  2852:          && p_rarch->menu_driver_ctx->entry_action)
> 2853:       return p_rarch->menu_driver_ctx->entry_action(
  2854:             p_rarch->menu_userdata, entry, i, action);
  2855:    return -1;
00007FF7E9A07463 00000049BC7FDDE8 00000049BC7FDEE7 0000004900000007  retroarch_drmingw.exe!action_select_default  [G:/msys64/home/B-S/retroarch/menu/cbs/menu_cbs_select.c @ 107]
   105:       menu_entry_get(&entry, 0, idx, NULL, false);
   106: 
>  107:       ret = menu_entry_action(&entry, idx, action);
   108:    }
   109: 
00007FF7E96A72A5 000001C54F91D6D0 00000049BC7FDDD0 0000000000000000  retroarch_drmingw.exe!generic_menu_entry_action  [G:/msys64/home/B-S/retroarch/retroarch.c @ 2595]
  2593:       case MENU_ACTION_SELECT:
  2594:          if (cbs && cbs->action_select)
> 2595:             ret = cbs->action_select(entry->path,
  2596:                   entry->label, entry->type, i, entry->entry_idx);
  2597:          break;
00007FF7E998D019 000001C54F91D6D0 00000049BC7FDDD0 0000000000000000  retroarch_drmingw.exe!ozone_menu_entry_action  [G:/msys64/home/B-S/retroarch/menu/drivers/ozone/ozone.c @ 640]
   638: 
   639:    /* Call standard generic_menu_entry_action() function */
>  640:    return generic_menu_entry_action(userdata, entry_ptr,
   641:          new_selection, new_action);
   642: }
00007FF7E9994DAF 000001C54F91D6D0 00007FF700000160 0000004900000071  retroarch_drmingw.exe!ozone_pointer_up  [G:/msys64/home/B-S/retroarch/menu/drivers/ozone/ozone.c @ 3842]
  3840:                 *   on the correct target entry */
  3841:                if (!ozone->cursor_in_sidebar)
> 3842:                   return ozone_menu_entry_action(ozone, entry,
  3843:                         selection, MENU_ACTION_SELECT);
  3844: 
00007FF7E96ACF0F 0100000000000008 00000049BC7FDCD0 0000000700000033  retroarch_drmingw.exe!menu_driver_ctl  [G:/msys64/home/B-S/retroarch/retroarch.c @ 5452]
  5450:                return false;
  5451:             }
> 5452:             point->retcode = p_rarch->menu_driver_ctx->pointer_up(
  5453:                   p_rarch->menu_userdata,
  5454:                   point->x, point->y, point->ptr,
00007FF7E96D5C82 00007FF7EA662CE0 00007FF7EA685570 0000000459BDEBC6  retroarch_drmingw.exe!menu_input_pointer_post_iterate  [G:/msys64/home/B-S/retroarch/retroarch.c @ 25145]
 25143:                   /* Swipe down */
 25144:                   else if (
>25145:                            (dx_start_right_max  < dpi_threshold_swipe_tangent)
 25146:                         && (dx_start_left_max   < dpi_threshold_swipe_tangent)
 25147:                         && (dy_start_up_max     < dpi_threshold_swipe_tangent)
00007FF7E96D60E4 00007FF7EA662CE0 00007FF7EA685570 00007FF7EA67D330  retroarch_drmingw.exe!menu_input_post_iterate  [G:/msys64/home/B-S/retroarch/retroarch.c @ 25297]
 25295:    menu_file_list_cbs_t *cbs     = selection_buf ?
 25296:       (menu_file_list_cbs_t*)selection_buf->list[selection].actiondata
>25297:       : NULL;
 25298: 
 25299:    MENU_ENTRY_INIT(entry);
00007FF7E96A60F0 00007FF7EA662CE0 00007FF7EA67D330 00007FF7EA685570  retroarch_drmingw.exe!generic_menu_iterate  [G:/msys64/home/B-S/retroarch/retroarch.c @ 2217]
  2215:          ret = 0;
  2216:       else
> 2217:          ret = menu_input_post_iterate(p_rarch, p_disp, menu_st, action,
  2218:                current_time);
  2219:       menu_input_set_pointer_visibility(
00007FF7E96AB377 00007FF7EA662CE0 00007FF7EA67D330 00007FF7EA685570  retroarch_drmingw.exe!menu_driver_iterate  [G:/msys64/home/B-S/retroarch/retroarch.c @ 4650]
  4648: {
  4649:    return (p_rarch->menu_driver_data &&
> 4650:          generic_menu_iterate(
  4651:             p_rarch,
  4652:             menu_st,
00007FF7E96F2A69 00007FF7EA662CE0 000001C5462B4280 0000000459BDEBC6  retroarch_drmingw.exe!runloop_check_state  [G:/msys64/home/B-S/retroarch/retroarch.c @ 38355]
 38353:                }
 38354:             }
>38355:          }
 38356:       }
 38357: 
00007FF7E96F48FC 000001C5462B4280 00007FF7EA662CE0 00000049BC7FF720  retroarch_drmingw.exe!runloop_iterate  [G:/msys64/home/B-S/retroarch/retroarch.c @ 39057]
 39055:       bool audio_buf_active        = false;
 39056:       unsigned audio_buf_occupancy = 0;
>39057:       bool audio_buf_underrun      = false;
 39058: 
 39059:       if (!(runloop_state.paused       ||
00007FF7E96C1B50 0000000000000001 000001C54628EF00 0000000000000000  retroarch_drmingw.exe!rarch_main  [G:/msys64/home/B-S/retroarch/retroarch.c @ 15698]
 15696: 
 15697:    ui_companion_driver_init_first(p_rarch->configuration_settings,
>15698:          p_rarch);
 15699: 
 15700: #if !defined(HAVE_MAIN) || defined(HAVE_QT)
00007FF7E98A718D 0000000000000001 000001C54628EF00 00007FF7EA51522E  retroarch_drmingw.exe!SDL_main  [G:/msys64/home/B-S/retroarch/ui/drivers/ui_qt.cpp @ 4318]
  4316: int main(int argc, char *argv[])
  4317: {
> 4318:    return rarch_main(argc, argv, NULL);
  4319: }
  4320: #endif
00007FF7E9DDC2AA 0000000000000000 000000000000002E 00007FF7EA777318  retroarch_drmingw.exe!main_getcmdline
00007FF7E96A13C1 0000000000000000 0000000000000000 0000000000000000  retroarch_drmingw.exe!__tmainCRTStartup  [C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c @ 321]
00007FF7E96A14D6 0000000000000000 0000000000000000 0000000000000000  retroarch_drmingw.exe!WinMainCRTStartup  [C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c @ 176]
00007FFDFFA77034 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!BaseThreadInitThunk
00007FFE00D82651 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart
SeventySixx commented 3 years ago

Thanks for the feedback, I found the problem, I think - I'm fixing it

SeventySixx commented 3 years ago

done, it fixes also bios/nvm/mec problem raised in PR #119