Skip to content

Commit 8331b0f

Browse files
authored
Merge pull request #403 from Wieku/dev
0.11.0 #2
2 parents 77ada2a + e494d26 commit 8331b0f

File tree

20 files changed

+198
-73
lines changed

20 files changed

+198
-73
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Install golang
3636
uses: actions/setup-go@v3
3737
with:
38-
go-version: '1.22.4'
38+
go-version: '1.24.1'
3939
cache: true
4040

4141
- name: Build danser
@@ -69,6 +69,7 @@ jobs:
6969
id: build
7070

7171
- name: Sign files with Trusted Signing
72+
if: ${{ inputs.sign == true || inputs.sign == 'true' }}
7273
uses: azure/trusted-signing-action@v0
7374
with:
7475
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -107,7 +108,7 @@ jobs:
107108

108109
build_linux:
109110
name: Building linux version
110-
runs-on: ubuntu-20.04
111+
runs-on: ubuntu-22.04
111112
steps:
112113
- name: Checkout branch
113114
uses: actions/checkout@v3
@@ -120,7 +121,7 @@ jobs:
120121
- name: Install golang
121122
uses: actions/setup-go@v3
122123
with:
123-
go-version: '1.22.4'
124+
go-version: '1.24.1'
124125
cache: true
125126

126127
- name: Build danser

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ You need to clone it or download as a .zip (and unpack it to desired directory)
107107

108108
#### Prerequisites
109109

110-
* [64-bit go (1.22 at least)](https://go.dev/dl/)
110+
* [64-bit go (1.24 at least)](https://go.dev/dl/)
111111
* gcc/g++ (Linux/Unix), [WinLibs](http://winlibs.com/) MSVCRT+POSIX (Windows, TDM-GCC won't work, mingw-w64 is outdated)
112112
* OpenGL library (shipped with drivers, `libgl1-mesa-dev` when building on Linux servers)
113113
* xorg-dev, libgtk-3 and libgtk-3-dev (Linux)

app/beatmap/objects/slider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ func (slider *Slider) calculateFollowPointsLazer(beatmapVersion int) {
404404
reversed := span%2 == 1
405405

406406
// Skip ticks if timingPoint has NaN beatLength
407-
for d := tickDistance; d <= length && !nanTimingPoint; d += tickDistance {
407+
for d := tickDistance; d <= length && !nanTimingPoint && tickDistance != 0; d += tickDistance {
408408
if d >= length-minDistanceFromEnd {
409409
break
410410
}

app/database/manager.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"fmt"
88
_ "github.com/mattn/go-sqlite3"
99
"github.com/wieku/danser-go/app/beatmap"
10-
"github.com/wieku/danser-go/app/rulesets/osu/performance/pp241007"
10+
"github.com/wieku/danser-go/app/rulesets/osu/performance/pp250306"
1111
"github.com/wieku/danser-go/app/settings"
1212
"github.com/wieku/danser-go/app/utils"
1313
"github.com/wieku/danser-go/framework/env"
@@ -46,7 +46,7 @@ var migrations []Migration
4646

4747
var songsDir string
4848

49-
var difficultyCalc = pp241007.NewDifficultyCalculator()
49+
var difficultyCalc = pp250306.NewDifficultyCalculator()
5050

5151
func Init() error {
5252
log.Println("DatabaseManager: Initializing database...")
@@ -413,7 +413,7 @@ func trySendStatus(listener ImportListener, stage ImportStage, progress, target
413413
}
414414
}
415415

416-
func UpdateStarRating(maps []*beatmap.BeatMap, progressListener func(processed, target int)) {
416+
func UpdateStarRating(maps []*beatmap.BeatMap, progressListener func(processed, target int, message string)) {
417417
const workers = 1 // For now using only one thread because calculating 4 aspire maps at once can OOM since (de)allocation can't keep up with many complex sliders
418418

419419
var toCalculate []*beatmap.BeatMap
@@ -428,14 +428,25 @@ func UpdateStarRating(maps []*beatmap.BeatMap, progressListener func(processed,
428428
return
429429
}
430430

431+
var message string
432+
431433
if progressListener != nil {
432-
progressListener(0, len(toCalculate))
434+
progressListener(0, len(toCalculate), message)
433435
}
434436

435437
receive := make(chan *beatmap.BeatMap, workers)
436438

439+
var progress int
440+
437441
goroutines.Run(func() {
438-
util.BalanceChan(workers, toCalculate, receive, func(bMap *beatmap.BeatMap) (ret *beatmap.BeatMap, ret2 bool) {
442+
util.BalanceChanWatchdog(workers, toCalculate, receive, time.Minute, func(worker int, a *beatmap.BeatMap) {
443+
log.Println("DatabaseManager: It seems like SR calculation for this file got stuck! Please report it to developer(s). File:", a.Dir+"/"+a.File)
444+
message = "Calculation got stuck! Please check logs"
445+
446+
if progressListener != nil {
447+
progressListener(progress, len(toCalculate), message)
448+
}
449+
}, func(bMap *beatmap.BeatMap) (ret *beatmap.BeatMap, ret2 bool) {
439450
ret = bMap // HACK: still return the beatmap even if execution panics: https://golangbyexample.com/return-value-function-panic-recover-go/
440451
ret2 = true
441452

@@ -467,17 +478,17 @@ func UpdateStarRating(maps []*beatmap.BeatMap, progressListener func(processed,
467478
})
468479

469480
var calculated []*beatmap.BeatMap
470-
var progress int
471481

472482
for bMap := range receive {
473483
if progressListener != nil {
484+
message = ""
474485
progress++
475-
progressListener(progress, len(toCalculate))
486+
progressListener(progress, len(toCalculate), message)
476487
}
477488

478489
calculated = append(calculated, bMap)
479490

480-
if len(calculated) >= 1000 { // Commit to database every 1k beatmaps to not lose progress in case of crash/close
491+
if len(calculated) >= 200 { // Commit to database every 1k beatmaps to not lose progress in case of crash/close
481492
pushSRToDB(calculated)
482493

483494
calculated = calculated[:0]

app/rulesets/osu/performance/pp241007/skills/skill.go

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ func (skill *Skill) Process(current *preprocessing.DifficultyObject) {
6868
skill.currentSectionEnd = math.Ceil(current.StartTime/skill.SectionLength) * skill.SectionLength
6969
}
7070

71-
for current.StartTime > skill.currentSectionEnd {
72-
skill.saveCurrentPeak()
73-
skill.startNewSectionFrom(skill.currentSectionEnd, current)
74-
skill.currentSectionEnd += skill.SectionLength
75-
}
71+
skill.processSectionEnd(current)
7672

7773
currentStrain := skill.StrainValueOf(current)
7874

@@ -93,6 +89,26 @@ func (skill *Skill) Process(current *preprocessing.DifficultyObject) {
9389
skill.lastDifficulty = skill.difficulty
9490
}
9591

92+
func (skill *Skill) processSectionEnd(nextObj *preprocessing.DifficultyObject) {
93+
for nextObj.StartTime > skill.currentSectionEnd {
94+
sectionsLeft := math.Floor((nextObj.StartTime - skill.currentSectionEnd) / skill.SectionLength)
95+
96+
if skill.currentSectionPeak == 0 && sectionsLeft > 100 { // skip for maps with huge distances between objects
97+
newPeaks := make([]float64, len(skill.strainPeaks)+int(sectionsLeft))
98+
copy(newPeaks, skill.strainPeaks)
99+
skill.strainPeaks = newPeaks // just add it to temporal list, we don't need to add 0's to sorted one
100+
101+
skill.currentSectionEnd += skill.SectionLength * sectionsLeft
102+
103+
continue
104+
}
105+
106+
skill.saveCurrentPeak()
107+
skill.startNewSectionFrom(skill.currentSectionEnd, nextObj)
108+
skill.currentSectionEnd += skill.SectionLength
109+
}
110+
}
111+
96112
func (skill *Skill) GetCurrentStrainPeaks() []float64 {
97113
peaks := make([]float64, len(skill.strainPeaks)+1)
98114
copy(peaks, skill.strainPeaks)
@@ -185,7 +201,10 @@ func (skill *Skill) CountDifficultStrains() float64 {
185201

186202
func (skill *Skill) saveCurrentPeak() {
187203
skill.strainPeaks = append(skill.strainPeaks, skill.currentSectionPeak)
188-
skill.strainPeaksSorted.Add(skill.currentSectionPeak)
204+
205+
if skill.currentSectionPeak > 0 {
206+
skill.strainPeaksSorted.Add(skill.currentSectionPeak)
207+
}
189208
}
190209

191210
func (skill *Skill) startNewSectionFrom(end float64, current *preprocessing.DifficultyObject) {

app/rulesets/osu/performance/pp250306/skills/skill.go

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ func (skill *Skill) Process(current *preprocessing.DifficultyObject) {
6868
skill.currentSectionEnd = math.Ceil(current.StartTime/skill.SectionLength) * skill.SectionLength
6969
}
7070

71-
for current.StartTime > skill.currentSectionEnd {
72-
skill.saveCurrentPeak()
73-
skill.startNewSectionFrom(skill.currentSectionEnd, current)
74-
skill.currentSectionEnd += skill.SectionLength
75-
}
71+
skill.processSectionEnd(current)
7672

7773
currentStrain := skill.StrainValueOf(current)
7874

@@ -93,6 +89,26 @@ func (skill *Skill) Process(current *preprocessing.DifficultyObject) {
9389
skill.lastDifficulty = skill.difficulty
9490
}
9591

92+
func (skill *Skill) processSectionEnd(nextObj *preprocessing.DifficultyObject) {
93+
for nextObj.StartTime > skill.currentSectionEnd {
94+
sectionsLeft := math.Floor((nextObj.StartTime - skill.currentSectionEnd) / skill.SectionLength)
95+
96+
if skill.currentSectionPeak == 0 && sectionsLeft > 10 { // skip for maps with huge distances between objects
97+
newPeaks := make([]float64, len(skill.strainPeaks)+int(sectionsLeft))
98+
copy(newPeaks, skill.strainPeaks)
99+
skill.strainPeaks = newPeaks // just add it to temporal db, we don't need to add
100+
101+
skill.currentSectionEnd += skill.SectionLength * sectionsLeft
102+
103+
continue
104+
}
105+
106+
skill.saveCurrentPeak()
107+
skill.startNewSectionFrom(skill.currentSectionEnd, nextObj)
108+
skill.currentSectionEnd += skill.SectionLength
109+
}
110+
}
111+
96112
func (skill *Skill) GetCurrentStrainPeaks() []float64 {
97113
peaks := make([]float64, len(skill.strainPeaks)+1)
98114
copy(peaks, skill.strainPeaks)
@@ -187,7 +203,10 @@ func (skill *Skill) CountDifficultStrains() float64 {
187203

188204
func (skill *Skill) saveCurrentPeak() {
189205
skill.strainPeaks = append(skill.strainPeaks, skill.currentSectionPeak)
190-
skill.strainPeaksSorted.Add(skill.currentSectionPeak)
206+
207+
if skill.currentSectionPeak > 0 {
208+
skill.strainPeaksSorted.Add(skill.currentSectionPeak)
209+
}
191210
}
192211

193212
func (skill *Skill) startNewSectionFrom(end float64, current *preprocessing.DifficultyObject) {

app/states/components/overlays/scoreoverlay.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ type ScoreOverlay struct {
131131
customStats *cstats.StatDisplay
132132

133133
lazerScore bool
134+
135+
skipped bool
134136
}
135137

136138
type keyInfo struct {
@@ -538,8 +540,9 @@ func (overlay *ScoreOverlay) Update(time float64) {
538540

539541
if input.Win.GetKey(glfw.KeySpace) == glfw.Press {
540542
if overlay.skip != nil && overlay.music != nil && overlay.music.GetState() == bass.MusicPlaying {
541-
if overlay.audioTime < overlay.skipTo {
543+
if overlay.audioTime < overlay.skipTo && !overlay.skipped {
542544
overlay.music.SetPosition(overlay.skipTo / 1000)
545+
overlay.skipped = true
543546
}
544547
}
545548
}

bass.dll

-90.1 KB
Binary file not shown.

bass_fx.dll

0 Bytes
Binary file not shown.

bassmix.dll

-2.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)