Skip to content

Commit 0558283

Browse files
committed
so now i cant iteratebackwards?
1 parent 9fee414 commit 0558283

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/FMODAudioEngine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class $modify(MenuLoopFMODHook, FMODAudioEngine) {
3737

3838
unsigned int position = 0;
3939
menuLoopChannelProbably->getPosition(&position, FMOD_TIMEUNIT_MS);
40-
songManager.setLastMenuLoopPosition(position); // so the problem with trying to move this logic to GJBGL::init() is that by the time GJBGL::init() is called, FMOD's menu loop track has already been stopped and its position resets to 0. hence why we are here instead.
40+
if (position > songManager.getLastMenuLoopPosition() && !songManager.getComingFromGJBGL()) songManager.setLastMenuLoopPosition(position); // so the problem with trying to move this logic to GJBGL::init() is that by the time GJBGL::init() is called, FMOD's menu loop track has already been stopped and its position resets to 0. hence why we are here instead.
4141

4242
if (!songManager.getConstantShuffleMode() || songManager.isOverride()) return;
4343
if (GJBaseGameLayer::get() || songManager.isOriginalMenuLoop() || songManager.getSongsSize() < 2) return;

src/ui/SongControlMenu.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ void SongControlMenu::onSkipBkwdButton(CCObject*) {
353353
const std::string& currSong = songManager.getCurrentSong();
354354
if (fmod->getActiveMusic(0) != currSong || !songManager.getSongToSongDataEntries().contains(currSong)) return;
355355

356+
songManager.setComingFromGJBGL(true);
356357
const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength;
357358
const int lastPosition = songManager.getLastMenuLoopPosition();
358359

@@ -365,6 +366,7 @@ void SongControlMenu::onSkipBkwdButton(CCObject*) {
365366
} else {
366367
fmod->getActiveMusicChannel(0)->setPosition(lastPosition - 5000, FMOD_TIMEUNIT_MS);
367368
}
369+
songManager.setComingFromGJBGL(false);
368370
}
369371

370372
void SongControlMenu::onSkipFwrdButton(CCObject*) {
@@ -378,6 +380,7 @@ void SongControlMenu::onSkipFwrdButton(CCObject*) {
378380
const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength;
379381
const int lastPosition = songManager.getLastMenuLoopPosition();
380382

383+
songManager.setComingFromGJBGL(true);
381384
if ((lastPosition + 5000) > fullLength) {
382385
if (songManager.getConstantShuffleMode()) {
383386
SongControl::shuffleSong();
@@ -388,6 +391,7 @@ void SongControlMenu::onSkipFwrdButton(CCObject*) {
388391
} else {
389392
fmod->getActiveMusicChannel(0)->setPosition(lastPosition + 5000, FMOD_TIMEUNIT_MS);
390393
}
394+
songManager.setComingFromGJBGL(false);
391395
}
392396

393397
void SongControlMenu::updateCurrentLabel() {

0 commit comments

Comments
 (0)