Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MW] PlaybackMode & track randomizer not working properly in large playlists #5

Open
AJLethal opened this issue Mar 27, 2022 · 4 comments
Labels
bug Something isn't working mostwanted Bug related to NFSMW

Comments

@AJLethal
Copy link

AJLethal commented Mar 27, 2022

In playlists with more than 32 songs, PlaybackMode settings stop working (they start playing in both menu and in-race as if they were set to AL); this is noticeable in rather large playlists

@xan1242
Copy link
Owner

xan1242 commented Aug 21, 2022

This is an issue with the track randomizer. It seems to be poorly written by the original developers.

Due do some bit-shifting shenanigans going on in the function SFXObj_PFEATrax::GenNextMusicTrackID() it loses bits during some calculations.

So for example: setting the track 38 (0x26) to be the ONLY enabled track will cause the game to play track 38 (0x26) and 6 at certain intervals.

Why? Simple, bit 6 gets lost somewhere during game checks.

(As far as I can see, there are arrays with some counters denoting how many are in which mode (IG, FE, AL, OF) in game memory starting from 008F2080)

This will need some deeper investigation.

@xan1242 xan1242 changed the title PlaybackMode not working properly in large playlists (MW) [MW] PlaybackMode & track randomizer not working properly in large playlists Aug 21, 2022
@xan1242 xan1242 added bug Something isn't working mostwanted Bug related to NFSMW labels Aug 21, 2022
@xan1242
Copy link
Owner

xan1242 commented Nov 4, 2022

Just to note a few things before I forget:

  1. This is a problem caused by bitmasks - the game uses 3 integer bitmasks in order to determine which song to play in which mode
  2. A solution to this would be to rewrite this entirely. It shouldn't be too hard to do because we can easily track the game state via the GameFlowManager.

@xan1242
Copy link
Owner

xan1242 commented Dec 2, 2022

The solution is here:

https://github.com/xan1242/NFS_CustomJukebox/blob/3a36ca50be9d3d7ddc1da60224cfc135537787e0/NFSPS_CustomJukebox/dllmain.cpp#L707

It needs to be backported to this player in order to fully solve these issues (this especially includes Carbon despite it avoiding the issue via recursion).

I will make a CustomJukebox plugin for MW and Carbon, so I'll also try to apply that code here (since it's basically the same part anyways).

@RostovShev03
Copy link

I have the same problem when I tried to make own soundtrack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mostwanted Bug related to NFSMW
Projects
None yet
Development

No branches or pull requests

3 participants