melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
3.16k stars 518 forks source link

Nitro Engine example .nds file hangs on loading and gets "bad transfer direction" error. #1669

Open awmc000 opened 1 year ago

awmc000 commented 1 year ago

Very similar to this issue:

https://github.com/melonDS-emu/melonDS/issues/1116

I run the .nds file generated by this template, having also added a "nds_nflib" folder (Night Fox Lib), in which I built before building the Nitro Engine template:

https://github.com/AntonioND/nitro-engine/tree/master/examples/templates/using_nflib

When I run it in MelonDS, it loads, but never progresses past the message "Starting nitroFS..." printed to console.

Here is my shell output.

melonDS 0.9.4
https://melonds.kuribo64.net/
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

(process:75401): Gtk-WARNING **: 22:34:02.501: Locale not supported by C library.
    Using the fallback 'C' locale.
Gtk-Message: 22:34:02.532: Failed to load module "canberra-gtk-module"
Gtk-Message: 22:34:02.533: Failed to load module "canberra-gtk-module"
Qt: Session management error: Could not open network socket
libpng warning: iCCP: known incorrect sRGB profile
Audio output frequency: 48000 Hz
Resetting JIT block cache...
done resetting jit mem
done resetting jit mem
MAC: 00:09:BF:11:22:33
FW: WIFI CRC16 = GOOD
FW: AP1 CRC16 = GOOD
FW: AP2 CRC16 = GOOD
FW: AP3 CRC16 = GOOD
FW: USER0 CRC16 = GOOD
FW: USER1 CRC16 = BAD
Game code: ####
ROM entry not found
!! bad ROM size 703488 (expected 1048576) rounded to 1048576
Cart ID: 400000C2
remapping SWRAM
Secure area decryption failed
remapping DTCM 0 1000 ffffffff ffffffff
PU: region 0 = 04000033 : enabled, 04000000-08000000
PU: region 0 = 04000033 : enabled, 04000000-08000000
PU: region 1 = 0200002B : enabled, 02000000-02400000
PU: region 1 = 0200002B : enabled, 02000000-02400000
PU: region 2 = 00000000 : disabled, 00000000-00000002
PU: region 2 = 00000000 : disabled, 00000000-00000002
PU: region 3 = 08000035 : enabled, 08000000-10000000
PU: region 3 = 08000035 : enabled, 08000000-10000000
PU: region 4 = 0300001B : enabled, 03000000-03004000
PU: region 4 = 0300001B : enabled, 03000000-03004000
PU: region 5 = 00000000 : disabled, 00000000-00000002
PU: region 5 = 00000000 : disabled, 00000000-00000002
PU: region 6 = FFFF001D : enabled, FFFF0000-FFFF8000
PU: region 6 = FFFF001D : enabled, FFFF0000-FFFF8000
PU: region 7 = 027FF017 : enabled, 027FF000-02800000
PU: region 7 = 027FF017 : enabled, 027FF000-02800000
remapping DTCM 3000000 3004000 0 fffff000
Game is now booting
Mic init failed: Could not connect PulseAudio stream
remapping DTCM ffffffff ffffffff 3000000 2ffc000
PU: region 0 = 04000033 : enabled, 04000000-08000000
PU: region 1 = FFFF001F : enabled, FFFF0000-00000000
PU: region 2 = 00000017 : enabled, 00000000-00001000
PU: region 5 = 02FF001B : enabled, 02FF0000-02FF4000
PU: region 4 = 0100001D : enabled, 01000000-01008000
unknown ARM9 IO read32 04004008 02017794
PU: region 3 = 08000035 : enabled, 08000000-10000000
PU: region 6 = 0200002F : enabled, 02000000-03000000
PU: region 7 = 0200002B : enabled, 02000000-02400000
remapping DTCM 2ff0000 2ff4000 ffffffff ffffffff
PU region 0: 04000000-08000000, user=07 priv=07
33333363/33333363
PU region 1: FFFF0000-00000000, user=55 priv=55
33333363/33333363
PU region 2: 00000000-00001000, user=07 priv=07
33333363/33333363
PU region 3: 08000000-10000000, user=07 priv=07
33333363/33333363
PU region 4: 01000000-01008000, user=07 priv=07
33333363/33333363
PU region 5: 02FF0000-02FF4000, user=07 priv=07
33333363/33333363
PU region 6: 02000000-03000000, user=07 priv=07
33333363/33333363
PU region 7: 02000000-02400000, user=77 priv=77
33333363/33333363
unknown ARM9 IO read8 04004000 02000864
RTC INTERRUPT ON: 41
NDSCART: !! BAD TRANSFER DIRECTION FOR CMD B7, DIR=0, ROMCNT=E97F3FFF
AntonioND commented 1 year ago

This doesn't have to do with Nitro Engine, but with the implementation of nitroFS and the card commands used to read from nitroFS in emulators. In case it helps:

devkitPro: https://github.com/devkitPro/libfilesystem/blob/88c191cece4fa17daa0ddd2c76eb92165161481d/source/nitrofs.c#L163-L176

BlocksDS: https://github.com/blocksds/libnds/blob/afd5996ca6a5cf5b8ee69cfe85240ddf4b462372/source/common/card.c#L131-L142

The implementation in BlocksDS has the fix to remove CARD_WR, so it doesn't cause that error, and it works in melonDS.