[win32/core] vs [QT]: NSF player and Region autodetect logic
http://kevtris.org/nes/nsfspec.txt
Here's an overview of the header:
offset # of bytes Function
----------------------------
007a 1 BYTE PAL/NTSC bits:
bit 0: if clear, this is an NTSC tune
bit 0: if set, this is a PAL tune
bit 1: if set, this is a dual PAL/NTSC tune
bits 2-7: not used. they *must* be 0
*****************************************
0000 0000 = 00Н = NTSC
0000 0001 = 01H = PAL
0000 0010 = 02H = NTSC/PAL
win32 autodetect region logic (current behavior, works almost correct, as needed): [NTSC NSF-Header, 00H]: NSF-player can be set only to NTSC or Dendy, if you're set PAL, it will reset to NTSC again. NSF starts in NTSC or Dendy mode at first launch, depending what of them user select last time. [PAL NSF-Header, 01H]: NSF-player can be set only to PAL, if you're set NTSC or Dendy, it will reset to PAL again. NSF starts in PAL mode at first launch. [both NSF-Header, 02H]: NSF-player can be set to all NTSC, PAL, or Dendy modes. All works correct. NSF starts in PAL mode at first launch. (I guess make 00h behavior is more correct, like other emulators does)
QT-version: [NTSC NSF-Header, 00H]: NSF-player can be set to all NTSC, PAL, or Dendy modes. But when set to PAL, sound is completely distorted. if "Region auto detect" enabled: NSF starts in NTSC or Dendy mode at first launch, depending what of them user select last time (correct, like win32). [PAL NSF-Header, 01H]: NSF-player can be set to PAL or NTSC modes. When set to Dendy, gui checkbox jump to NTSC. if "Region auto detect" enabled: NSF starts in PAL mode at first launch (correct, like win32). [both NSF-Header, 02H]: NSF-player can be set to all NTSC, PAL, or Dendy modes. All works correct, like win32 build. if "Region auto detect" enabled: NSF starts in PAL mode at first launch (win32-behavior).
Mesen and other emulators does job right: NSF-player can be set to all 3 modes regardless NSF-header flag with correct sound (no distortion). when user forced favored region (when region autodetect disabled).
Look and listen attentively: https://youtu.be/AccpRdjLcVM nsf_test.zip