Skip to content

Commit

Permalink
add a bool to configure randomizer init
Browse files Browse the repository at this point in the history
  • Loading branch information
xan1242 committed Nov 26, 2022
1 parent 54d1803 commit 3a36ca5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions NFSPS_CustomJukebox/NFSPS_CustomJukebox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ PlaylistFolder = CustomPlaylist
; VolumeBoost default = 0
VolumeBoost = 0
RandomizedPlayback = 0
InitializeRandomly = 0
5 changes: 4 additions & 1 deletion NFSPS_CustomJukebox/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void(__thiscall* sub_4ED910)(unsigned int dis, int unk) = (void(__thiscall*)(uns

bool bInHub = false;
bool bRandomizedPlayback = false;
bool bInitializeRandomly = false;
int IGMusicSequencer = 0;
int FEMusicSequencer = 0;

Expand Down Expand Up @@ -847,6 +848,8 @@ void InitConfig()
VolumeBoost = 0;
if (ini["MAIN"].has("RandomizedPlayback"))
bRandomizedPlayback = (stoi(ini["MAIN"]["RandomizedPlayback"].c_str()) != 0);
if (ini["MAIN"].has("InitializeRandomly"))
bInitializeRandomly = (stoi(ini["MAIN"]["InitializeRandomly"].c_str()) != 0);
}
else
strcpy(PlaylistFolderName, DEFAULT_PLAYLIST_FOLDER);
Expand Down Expand Up @@ -976,7 +979,7 @@ void Init()
injector::WriteMemory<uint32_t>(0x0097AA7C, (uint32_t)&FEHubRootStateManager_StartAutoSaveOnHubEnter_Hook, true);
injector::WriteMemory<uint32_t>(0x0097A934, (uint32_t)&FEHubRootStateManager_Destructor_Hook, true);

if (!bRandomizedPlayback)
if (!bRandomizedPlayback && bInitializeRandomly)
{
// randomize the initial sequencer
// set the seed
Expand Down

0 comments on commit 3a36ca5

Please sign in to comment.