Add .pbp support to ludo (#524)

* Basic functionality within ludo

* cleaned up the pbp file check

* cleaned up trailing whitespace

* Added m3u support and improved multi disc playlist support.

* configurable starting path added.

* Updating CI/CD for manual builds.

* attempting to fix the winpthread import.

* I /looks/ like the chocolatey build of mingw64 is broken. This should grab it directly.

* updated cd.yml as well.

* updated actions/checkout and actions/setup-go to current version to quiet CI warnings.

* correcting default starting directory. Should be users home directory.

---------

Co-authored-by: Stephen Ancona <[email protected]>
This commit is contained in:
Stephen AnconaandStephen Ancona authored and GitHub committed 2024-02-26 12:03:05 +07:00
1 parent 85dfd8672d
commit ad635fbeb1
10 files changed
+59 -37

No files matched your search

+18 -13
View File
@@ -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
+18 -13
View File
@@ -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 ./...
+1
View File
@@ -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()
+7 -4
View File
@@ -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()
Submodule database updated: aad97888ed...c31e8f126d.
+5
View File
@@ -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,
+4 -3
View File
@@ -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)
},
+1 -2
View File
@@ -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)
+3 -1
View File
@@ -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",
+1
View File
@@ -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"`