diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e2e5e8ea..9b095182 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,6 +1,8 @@ name: CD on: + workflow_dispatch: + types: [created] release: types: [created] @@ -12,10 +14,10 @@ jobs: build_linux_wayland_x86_64: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV @@ -36,10 +38,10 @@ jobs: build_linux_wayland_arm: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV @@ -72,10 +74,10 @@ jobs: build_linux_x11_x86_64: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV @@ -96,10 +98,10 @@ jobs: build_linux_x11_arm: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV @@ -132,10 +134,10 @@ jobs: build_osx: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV @@ -166,22 +168,25 @@ jobs: build_windows: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV - run: choco install wget make hashdeep --ignore-checksums - run: wget --no-check-certificate http://www.openal-soft.org/openal-binaries/openal-soft-1.21.0-bin.zip - run: wget https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe + - run: curl -L -o mingw64.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0posix-17.0.6-11.0.1-ucrt-r5/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r5.zip + - run: unzip mingw64.zip - run: 7z x openal-soft-1.21.0-bin.zip -o/c/ - run: echo "CGO_CFLAGS=-I/c/openal-soft-1.21.0-bin/include/" >> $GITHUB_ENV - run: echo "CGO_LDFLAGS=-L/c/openal-soft-1.21.0-bin/libs/Win64/" >> $GITHUB_ENV - - run: cp /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/libwinpthread-1.dll . + - run: cp "mingw64/bin/libwinpthread-1.dll" . - run: cp /c/openal-soft-1.21.0-bin/bin/Win64/soft_oal.dll OpenAL32.dll - run: cp /c/Windows/System32/VCRUNTIME140.dll . + - run: PATH="/c/mingw64/bin:$PATH" - run: mkdir -p ./Ludo-Windows-x86_64-${VERSION}/ - run: cp *.dll ./Ludo-Windows-x86_64-${VERSION}/ - run: OS=Windows ARCH=x86_64 VERSION=$VERSION make zip diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 430e8529..870f9d10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,8 @@ name: CI on: + workflow_dispatch: + branches: [master] push: branches: [master] pull_request: @@ -14,10 +16,10 @@ jobs: build_linux_wayland_x86_64: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "/home/runner/go/bin" >> $GITHUB_PATH @@ -33,10 +35,10 @@ jobs: build_linux_wayland_arm: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: sudo apt update -q @@ -58,10 +60,10 @@ jobs: build_linux_x11_x86_64: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "/home/runner/go/bin" >> $GITHUB_PATH @@ -77,10 +79,10 @@ jobs: build_linux_x11_arm: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: sudo apt update -q @@ -102,10 +104,10 @@ jobs: build_osx: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "/Users/runner/go/bin" >> $GITHUB_PATH @@ -120,20 +122,23 @@ jobs: build_windows: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.19.5' - run: echo "/c/Users/runneradmin/go/bin" >> $GITHUB_PATH - run: go install honnef.co/go/tools/cmd/staticcheck@latest - run: choco install wget --ignore-checksums + - run: curl -L -o mingw64.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0posix-17.0.6-11.0.1-ucrt-r5/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r5.zip + - run: unzip mingw64.zip - run: wget --no-check-certificate http://www.openal-soft.org/openal-binaries/openal-soft-1.21.0-bin.zip - run: 7z x openal-soft-1.21.0-bin.zip -o/c/ - run: echo "CGO_CFLAGS=-I/c/openal-soft-1.21.0-bin/include/" >> $GITHUB_ENV - run: echo "CGO_LDFLAGS=-L/c/openal-soft-1.21.0-bin/libs/Win64/" >> $GITHUB_ENV - - run: cp /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/libwinpthread-1.dll . + - run: cp "mingw64/bin/libwinpthread-1.dll" . + - run: PATH="/c/mingw64/bin:$PATH" - run: go get . #- run: go test -v -race ./... #- run: go vet ./... diff --git a/core/core.go b/core/core.go index e3aea607..79f04b39 100644 --- a/core/core.go +++ b/core/core.go @@ -111,6 +111,7 @@ func unarchiveGame(filename string) (string, int64, error) { extPrefered := make(map[string]int) extPrefered[".cue"] = 1 extPrefered[".m3u"] = 2 + extPrefered[".pbp"] = 3 err = archiver.Walk(filename, func(f archiver.File) error { fname := f.Name() diff --git a/dat/dat.go b/dat/dat.go index 210641ea..5d0b5cc0 100644 --- a/dat/dat.go +++ b/dat/dat.go @@ -101,10 +101,13 @@ func (db *DB) FindByROMName(romPath string, romName string, crc uint32, games ch continue } // If the checksums match - if romName == game.ROMs[0].Name { - game.Path = romPath - game.System = system - games <- game + for _, ROM := range game.ROMs { + if romName == ROM.Name { + game.Path = romPath + game.System = system + games <- game + } + // element is the element from someSlice for where we are } } wg.Done() diff --git a/database b/database index aad97888..c31e8f12 160000 --- a/database +++ b/database @@ -1 +1 @@ -Subproject commit aad97888edaccdb9a37491ccd84453436b9e2e46 +Subproject commit c31e8f126d8c6975ea8ed12b22a3d718a11ee853 diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index 705cf18a..c140f192 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -26,6 +26,11 @@ func buildPlaylist(path string) Scene { for _, game := range playlists.Playlists[path] { game := game // needed for callbackOK strippedName, tags := extractTags(game.Name) + if strings.Contains(game.Name, "Disc") { + re := regexp.MustCompile(`\((Disc [1-9]?)\)`) + match := re.FindStringSubmatch(game.Name) + strippedName = strippedName + " (" + match[1] + ")" + } list.children = append(list.children, entry{ label: strippedName, gameName: game.Name, diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 630d4a1a..b46401e1 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -3,7 +3,7 @@ package menu import ( "fmt" "os" - "os/user" + //"os/user" "sort" "github.com/libretro/ludo/audio" @@ -15,6 +15,7 @@ import ( "github.com/libretro/ludo/state" "github.com/libretro/ludo/utils" "github.com/libretro/ludo/video" + "github.com/libretro/ludo/settings" colorful "github.com/lucasb-eyer/go-colorful" "github.com/tanema/gween" @@ -63,8 +64,8 @@ func buildTabs() Scene { subLabel: "Scan your collection", icon: "add", callbackOK: func() { - usr, _ := user.Current() - menu.Push(buildExplorer(usr.HomeDir, nil, + //usr, _ := user.Current() + menu.Push(buildExplorer(settings.Current.FileDirectory, nil, func(path string) { scanner.ScanDir(path, refreshTabs) }, diff --git a/scanner/scanner.go b/scanner/scanner.go index ecd3cc29..cf98a972 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -11,7 +11,6 @@ import ( "path/filepath" "strconv" "strings" - "github.com/libretro/ludo/dat" ntf "github.com/libretro/ludo/notifications" "github.com/libretro/ludo/playlists" @@ -131,7 +130,7 @@ func Scan(dir string, roms []string, games chan (dat.Game), n *ntf.Notification) } } z.Close() - case ".cue": + case ".cue", ".pbp", ".m3u": // Look for a matching game entry in the database state.DB.FindByROMName(f, filepath.Base(f), 0, games) n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f) diff --git a/settings/defaults.go b/settings/defaults.go index 072615ec..c7a3a65f 100644 --- a/settings/defaults.go +++ b/settings/defaults.go @@ -2,11 +2,12 @@ package settings import ( "path/filepath" - + "os/user" "github.com/adrg/xdg" ) func defaultSettings() Settings { + usr, _ := user.Current() return Settings{ VideoFullscreen: false, VideoMonitorIndex: 0, @@ -58,6 +59,7 @@ func defaultSettings() Settings { "SNK - Neo Geo Pocket": "mednafen_ngp_libretro", "Sony - PlayStation": playstationCore, }, + FileDirectory: usr.HomeDir, CoresDirectory: "./cores", AssetsDirectory: "./assets", DatabaseDirectory: "./database", diff --git a/settings/settings.go b/settings/settings.go index b3d6fb87..b03db8ac 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -36,6 +36,7 @@ type Settings struct { CoreForPlaylist map[string]string `hide:"always" toml:"core_for_playlist"` + FileDirectory string `hide:"ludos" toml:"files_dir" label:"Files Directory" fmt:"%s" widget:"dir"` CoresDirectory string `hide:"ludos" toml:"cores_dir" label:"Cores Directory" fmt:"%s" widget:"dir"` AssetsDirectory string `hide:"ludos" toml:"assets_dir" label:"Assets Directory" fmt:"%s" widget:"dir"` DatabaseDirectory string `hide:"ludos" toml:"database_dir" label:"Database Directory" fmt:"%s" widget:"dir"`