Skip to content

Commit

Permalink
Add new preference: DefaultGroupOffsetSeconds to dictate the default …
Browse files Browse the repository at this point in the history
…sync bias on the machine when no group.ini is present (or if there is no SyncOffset field in said file).

- Generally Supports either ITG (9ms) or NULL (0ms).
- Alternatively, one could edit the preference manually to put a different value
- Name/Description probably worth ironing out
  • Loading branch information
CrashCringle12 committed Nov 18, 2024
1 parent 28515c6 commit d27eb8c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ Transfer Edits to USB=Transfer Edits to USB
Transfer Edits from USB=Transfer Edits from USB
UseUnlockSystem=Enable or disable the unlock system.
VisualDelaySeconds=Calibrate display lag.
DefaultGroupOffsetSeconds=Change the Default Sync Bias
Vsync=Cap your frame rate your display's refresh rate. This option only has an effect when the Display Mode is set to &oq;Full Screen&cq;.
WideScreen16_9=Enable widescreen display.
WideScreen16_10=Enable widescreen display.
Expand Down Expand Up @@ -1308,6 +1309,7 @@ Undo=Undo
UseUnlockSystem=Unlock System
View steps data=View Steps Data
VisualDelaySeconds=Visual Delay
DefaultGroupOffsetSeconds=Default Group Offset
Voltage=Voltage
Vsync=Wait For Vsync
Warps=Warps
Expand Down
5 changes: 3 additions & 2 deletions Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3067,7 +3067,7 @@ Line22="conf,EventMode"
Fallback="ScreenOptionsServiceChild"
NextScreen="ScreenOptionsService"
PrevScreen="ScreenOptionsService"
LineNames="1,2,3,RefreshRate,FSType,4,5,6,7,8,9,10,11,13,FNR,14,17,18,19,20,21"
LineNames="1,2,3,RefreshRate,FSType,4,5,6,7,8,9,10,11,13,FNR,14,17,18,19,20,21,22"
Line1="lua,ConfDisplayMode()"
Line2="lua,ConfAspectRatio()"
Line3="lua,ConfDisplayResolution()"
Expand All @@ -3092,7 +3092,8 @@ Line17="conf,SoundVolume"
Line18="conf,EnableAttackSounds"
Line19="conf,EnableMineHitSound"
Line20="conf,VisualDelaySeconds"
Line21="conf,RateModPreservesPitch"
Line21="conf,DefaultGroupOffsetSeconds"
Line22="conf,RateModPreservesPitch",

[ScreenOptionsAdvanced]
Fallback="ScreenOptionsServiceChild"
Expand Down
16 changes: 9 additions & 7 deletions src/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Group::Group(const RString sDir, const RString &sGroupDirName) {
RString Series = "";
RString bannerPath = "";
RString authorsNotes = "";
float fOffset = 0;
float fOffset = PREFSMAN->m_fDefaultGroupOffsetSeconds;

if (FILEMAN->DoesFileExist(sGroupIniPath)) {
IniFile ini;
Expand All @@ -65,12 +65,14 @@ Group::Group(const RString sDir, const RString &sGroupDirName) {
RString sValue = "";

ini.GetValue("Group", "SyncOffset", sValue);
if (sValue.CompareNoCase("null") == 0) {
fOffset = 0;
} else if (sValue.CompareNoCase("itg") == 0) {
fOffset = 0.009f;
} else {
fOffset = StringToFloat(sValue);
if (!sValue.empty()) {
if (sValue.CompareNoCase("null") == 0) {
fOffset = 0.0f;
} else if (sValue.CompareNoCase("itg") == 0) {
fOffset = 0.009f;
} else {
fOffset = StringToFloat(sValue);
}
}
ini.GetValue("Group", "Year", m_iYearReleased);
ini.GetValue( "Group", "Credits", credits );
Expand Down
1 change: 1 addition & 0 deletions src/PrefsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ PrefsManager::PrefsManager() :
m_ShowDancingCharacters ( "ShowDancingCharacters", SDC_Random ),
m_bUseUnlockSystem ( "UseUnlockSystem", false ),
m_fGlobalOffsetSeconds ( "GlobalOffsetSeconds", -0.008f ),
m_fDefaultGroupOffsetSeconds ( "DefaultGroupOffsetSeconds", 0.0f ),
m_iProgressiveLifebar ( "ProgressiveLifebar", 0 ),
m_iProgressiveStageLifebar ( "ProgressiveStageLifebar", 0 ),
m_iProgressiveNonstopLifebar ( "ProgressiveNonstopLifebar", 0 ),
Expand Down
1 change: 1 addition & 0 deletions src/PrefsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class PrefsManager
Preference<ShowDancingCharacters> m_ShowDancingCharacters;
Preference<bool> m_bUseUnlockSystem;
Preference<float> m_fGlobalOffsetSeconds;
Preference<float> m_fDefaultGroupOffsetSeconds;
Preference<int> m_iProgressiveLifebar;
Preference<int> m_iProgressiveStageLifebar;
Preference<int> m_iProgressiveNonstopLifebar;
Expand Down
7 changes: 7 additions & 0 deletions src/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,12 @@ static void GlobalOffsetSeconds( int &sel, bool ToSel, const ConfOption *pConfOp
MoveMap( sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping) );
}

static void DefaultGroupOffsetSeconds( int &sel, bool ToSel, const ConfOption *pConfOption )
{
const float mapping[] = { 0.0f, 0.009f };
MoveMap( sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping) );
}

static void EditRecordModeLeadIn(int &sel, bool to_sel, const ConfOption* conf_option)
{
float mapping[32];
Expand Down Expand Up @@ -941,6 +947,7 @@ static void InitializeConfOptions()
c.AddOption( ssprintf("%+i ms", i) );
ADD( c );
}
ADD( ConfOption( "DefaultGroupOffsetSeconds", DefaultGroupOffsetSeconds, "Null","|ITG" ) );
ADD( ConfOption( "EnableAttackSounds", MovePref<bool>, "No","Yes" ) );
ADD( ConfOption( "EnableMineHitSound", MovePref<bool>, "No","Yes" ) );
ADD( ConfOption( "RateModPreservesPitch", MovePref<bool>, "No","Yes") );
Expand Down
2 changes: 0 additions & 2 deletions src/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,6 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio
const std::vector<Steps*>& vpSteps = pNewSong->GetAllSteps();
for (Steps* s : vpSteps)
{
// Empty TimingData means it's inherited
// from the song and is already changed.
if( s->m_Timing.empty() )
continue;
s->m_Timing.m_fBeat0GroupOffsetInSeconds = group->GetSyncOffset();
Expand Down

0 comments on commit d27eb8c

Please sign in to comment.