@@ -5,13 +5,9 @@ import (
55 "encoding/json"
66 "flag"
77 "fmt"
8- "github.com/dustin/go-humanize"
98 "github.com/faiface/mainthread"
109 "github.com/go-gl/gl/v3.3-core/gl"
1110 "github.com/go-gl/glfw/v3.3/glfw"
12- "github.com/shirou/gopsutil/cpu"
13- "github.com/shirou/gopsutil/host"
14- "github.com/shirou/gopsutil/mem"
1511 "github.com/wieku/danser-go/app/audio"
1612 "github.com/wieku/danser-go/app/beatmap"
1713 difficulty2 "github.com/wieku/danser-go/app/beatmap/difficulty"
@@ -34,19 +30,16 @@ import (
3430 "github.com/wieku/danser-go/framework/graphics/buffer"
3531 "github.com/wieku/danser-go/framework/graphics/font"
3632 "github.com/wieku/danser-go/framework/graphics/viewport"
37- "github.com/wieku/danser-go/framework/math/mutils"
3833 "github.com/wieku/danser-go/framework/math/vector"
3934 "github.com/wieku/danser-go/framework/platform"
4035 "github.com/wieku/danser-go/framework/qpc"
4136 "github.com/wieku/danser-go/framework/statistic"
4237 "github.com/wieku/danser-go/framework/util"
4338 "github.com/wieku/rplpa"
44- "io"
4539 "io/ioutil"
4640 "log"
4741 "math"
4842 "os"
49- "path/filepath"
5043 "runtime"
5144 "strings"
5245 "time"
@@ -253,6 +246,8 @@ func run() {
253246
254247 newSettings := settings .LoadSettings (* settingsVersion )
255248
249+ log .Println ("Current config:" , settings .GetCompressedString ())
250+
256251 if ! newSettings && len (os .Args ) == 1 {
257252 platform .OpenURL ("https://youtu.be/dQw4w9WgXcQ" )
258253 closeAfterSettingsLoad = true
@@ -334,6 +329,10 @@ func run() {
334329 panic ("Failed to initialize GLFW: " + err .Error ())
335330 }
336331
332+ if ! closeAfterSettingsLoad {
333+ log .Println ("GLFW Initialized!" )
334+ }
335+
337336 platform .SetupContext ()
338337
339338 glfw .WindowHint (glfw .Resizable , glfw .False )
@@ -393,6 +392,8 @@ func run() {
393392 settings .SKIP = false
394393 }
395394
395+ log .Println ("Creating window..." )
396+
396397 if settings .Graphics .Fullscreen {
397398 glfw .WindowHint (glfw .RedBits , monitor .GetVideoMode ().RedBits )
398399 glfw .WindowHint (glfw .GreenBits , monitor .GetVideoMode ().GreenBits )
@@ -426,7 +427,7 @@ func run() {
426427
427428 win .MakeContextCurrent ()
428429
429- log .Println ("GLFW initialized !" )
430+ log .Println ("Window created !" )
430431
431432 err = platform .GLInit (* gldebug )
432433 if err != nil {
@@ -538,7 +539,7 @@ func mainLoopRecord() {
538539
539540 ffmpeg .StartFFmpeg (int (fps ), w , h , audioFPS , output )
540541
541- updateFPS := math . Max (fps , 1000 )
542+ updateFPS := max (fps , 1000 )
542543 updateDelta := 1000 / updateFPS
543544 fpsDelta := 1000 / fps
544545 audioDelta := 1000.0 / audioFPS
@@ -653,7 +654,7 @@ func mainLoopNormal() {
653654 case glfw .KeyEscape :
654655 win .SetShouldClose (true )
655656 case glfw .KeyMinus :
656- settings .DIVIDES = mutils . Max (1 , settings .DIVIDES - 1 )
657+ settings .DIVIDES = max (1 , settings .DIVIDES - 1 )
657658 case glfw .KeyEqual :
658659 settings .DIVIDES += 1
659660 case glfw .KeyO :
@@ -773,35 +774,6 @@ func checkForUpdates() {
773774 }
774775}
775776
776- func printPlatformInfo () {
777- const unknown = "Unknown"
778-
779- osName , cpuName , ramAmount := unknown , unknown , unknown
780-
781- hStat , err := host .Info ()
782- if err == nil {
783- osName = hStat .Platform + " " + hStat .PlatformVersion
784- }
785-
786- cStats , err := cpu .Info ()
787- if err == nil && len (cStats ) > 0 {
788- cpuName = fmt .Sprintf ("%s, %d cores" , strings .TrimSpace (cStats [0 ].ModelName ), cStats [0 ].Cores )
789- }
790-
791- mStat , err := mem .VirtualMemory ()
792- if err == nil {
793- ramAmount = humanize .IBytes (mStat .Total )
794- }
795-
796- log .Println ("-------------------------------------------------------------------" )
797- log .Println ("danser-go version:" , build .VERSION )
798- log .Println ("Ran using:" , os .Args )
799- log .Println ("OS: " , osName )
800- log .Println ("CPU:" , cpuName )
801- log .Println ("RAM:" , ramAmount )
802- log .Println ("-------------------------------------------------------------------" )
803- }
804-
805777func Run () {
806778 defer func () {
807779 var err any
@@ -816,18 +788,7 @@ func Run() {
816788
817789 goroutines .SetCrashHandler (closeHandler )
818790
819- log .Println ("danser-go version:" , build .VERSION )
820-
821- file , err := os .Create (filepath .Join (env .DataDir (), "danser.log" ))
822- if err != nil {
823- panic (err )
824- }
825-
826- log .SetOutput (file )
827-
828- printPlatformInfo ()
829-
830- log .SetOutput (io .MultiWriter (os .Stdout , file ))
791+ platform .StartLogging ("danser" )
831792
832793 platform .DisableQuickEdit ()
833794
0 commit comments