Skip to content

Commit ad635fb

Browse files
bagelbyheartStephen Ancona
and
Stephen Ancona
authored
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 <stephen@bagelbyheart.com>
1 parent 85dfd86 commit ad635fb

File tree

10 files changed

+59
-37
lines changed

10 files changed

+59
-37
lines changed

.github/workflows/cd.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CD
22

33
on:
4+
workflow_dispatch:
5+
types: [created]
46
release:
57
types: [created]
68

@@ -12,10 +14,10 @@ jobs:
1214
build_linux_wayland_x86_64:
1315
runs-on: ubuntu-latest
1416
steps:
15-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1618
with:
1719
submodules: true
18-
- uses: actions/setup-go@v3
20+
- uses: actions/setup-go@v4
1921
with:
2022
go-version: '1.19.5'
2123
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV
@@ -36,10 +38,10 @@ jobs:
3638
build_linux_wayland_arm:
3739
runs-on: ubuntu-22.04
3840
steps:
39-
- uses: actions/checkout@v2
41+
- uses: actions/checkout@v4
4042
with:
4143
submodules: true
42-
- uses: actions/setup-go@v3
44+
- uses: actions/setup-go@v4
4345
with:
4446
go-version: '1.19.5'
4547
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV
@@ -72,10 +74,10 @@ jobs:
7274
build_linux_x11_x86_64:
7375
runs-on: ubuntu-latest
7476
steps:
75-
- uses: actions/checkout@v2
77+
- uses: actions/checkout@v4
7678
with:
7779
submodules: true
78-
- uses: actions/setup-go@v3
80+
- uses: actions/setup-go@v4
7981
with:
8082
go-version: '1.19.5'
8183
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV
@@ -96,10 +98,10 @@ jobs:
9698
build_linux_x11_arm:
9799
runs-on: ubuntu-20.04
98100
steps:
99-
- uses: actions/checkout@v2
101+
- uses: actions/checkout@v4
100102
with:
101103
submodules: true
102-
- uses: actions/setup-go@v3
104+
- uses: actions/setup-go@v4
103105
with:
104106
go-version: '1.19.5'
105107
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV
@@ -132,10 +134,10 @@ jobs:
132134
build_osx:
133135
runs-on: macos-latest
134136
steps:
135-
- uses: actions/checkout@v2
137+
- uses: actions/checkout@v4
136138
with:
137139
submodules: true
138-
- uses: actions/setup-go@v3
140+
- uses: actions/setup-go@v4
139141
with:
140142
go-version: '1.19.5'
141143
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV
@@ -166,22 +168,25 @@ jobs:
166168
build_windows:
167169
runs-on: windows-latest
168170
steps:
169-
- uses: actions/checkout@v2
171+
- uses: actions/checkout@v4
170172
with:
171173
submodules: true
172-
- uses: actions/setup-go@v3
174+
- uses: actions/setup-go@v4
173175
with:
174176
go-version: '1.19.5'
175177
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV
176178
- run: choco install wget make hashdeep --ignore-checksums
177179
- run: wget --no-check-certificate http://www.openal-soft.org/openal-binaries/openal-soft-1.21.0-bin.zip
178180
- run: wget https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe
181+
- 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
182+
- run: unzip mingw64.zip
179183
- run: 7z x openal-soft-1.21.0-bin.zip -o/c/
180184
- run: echo "CGO_CFLAGS=-I/c/openal-soft-1.21.0-bin/include/" >> $GITHUB_ENV
181185
- run: echo "CGO_LDFLAGS=-L/c/openal-soft-1.21.0-bin/libs/Win64/" >> $GITHUB_ENV
182-
- run: cp /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/libwinpthread-1.dll .
186+
- run: cp "mingw64/bin/libwinpthread-1.dll" .
183187
- run: cp /c/openal-soft-1.21.0-bin/bin/Win64/soft_oal.dll OpenAL32.dll
184188
- run: cp /c/Windows/System32/VCRUNTIME140.dll .
189+
- run: PATH="/c/mingw64/bin:$PATH"
185190
- run: mkdir -p ./Ludo-Windows-x86_64-${VERSION}/
186191
- run: cp *.dll ./Ludo-Windows-x86_64-${VERSION}/
187192
- run: OS=Windows ARCH=x86_64 VERSION=$VERSION make zip

.github/workflows/ci.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CI
22

33
on:
4+
workflow_dispatch:
5+
branches: [master]
46
push:
57
branches: [master]
68
pull_request:
@@ -14,10 +16,10 @@ jobs:
1416
build_linux_wayland_x86_64:
1517
runs-on: ubuntu-latest
1618
steps:
17-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
1820
with:
1921
submodules: true
20-
- uses: actions/setup-go@v3
22+
- uses: actions/setup-go@v4
2123
with:
2224
go-version: '1.19.5'
2325
- run: echo "/home/runner/go/bin" >> $GITHUB_PATH
@@ -33,10 +35,10 @@ jobs:
3335
build_linux_wayland_arm:
3436
runs-on: ubuntu-20.04
3537
steps:
36-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
3739
with:
3840
submodules: true
39-
- uses: actions/setup-go@v3
41+
- uses: actions/setup-go@v4
4042
with:
4143
go-version: '1.19.5'
4244
- run: sudo apt update -q
@@ -58,10 +60,10 @@ jobs:
5860
build_linux_x11_x86_64:
5961
runs-on: ubuntu-latest
6062
steps:
61-
- uses: actions/checkout@v2
63+
- uses: actions/checkout@v4
6264
with:
6365
submodules: true
64-
- uses: actions/setup-go@v3
66+
- uses: actions/setup-go@v4
6567
with:
6668
go-version: '1.19.5'
6769
- run: echo "/home/runner/go/bin" >> $GITHUB_PATH
@@ -77,10 +79,10 @@ jobs:
7779
build_linux_x11_arm:
7880
runs-on: ubuntu-22.04
7981
steps:
80-
- uses: actions/checkout@v2
82+
- uses: actions/checkout@v4
8183
with:
8284
submodules: true
83-
- uses: actions/setup-go@v3
85+
- uses: actions/setup-go@v4
8486
with:
8587
go-version: '1.19.5'
8688
- run: sudo apt update -q
@@ -102,10 +104,10 @@ jobs:
102104
build_osx:
103105
runs-on: macos-latest
104106
steps:
105-
- uses: actions/checkout@v2
107+
- uses: actions/checkout@v4
106108
with:
107109
submodules: true
108-
- uses: actions/setup-go@v3
110+
- uses: actions/setup-go@v4
109111
with:
110112
go-version: '1.19.5'
111113
- run: echo "/Users/runner/go/bin" >> $GITHUB_PATH
@@ -120,20 +122,23 @@ jobs:
120122
build_windows:
121123
runs-on: windows-latest
122124
steps:
123-
- uses: actions/checkout@v2
125+
- uses: actions/checkout@v4
124126
with:
125127
submodules: true
126-
- uses: actions/setup-go@v3
128+
- uses: actions/setup-go@v4
127129
with:
128130
go-version: '1.19.5'
129131
- run: echo "/c/Users/runneradmin/go/bin" >> $GITHUB_PATH
130132
- run: go install honnef.co/go/tools/cmd/staticcheck@latest
131133
- run: choco install wget --ignore-checksums
134+
- 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
135+
- run: unzip mingw64.zip
132136
- run: wget --no-check-certificate http://www.openal-soft.org/openal-binaries/openal-soft-1.21.0-bin.zip
133137
- run: 7z x openal-soft-1.21.0-bin.zip -o/c/
134138
- run: echo "CGO_CFLAGS=-I/c/openal-soft-1.21.0-bin/include/" >> $GITHUB_ENV
135139
- run: echo "CGO_LDFLAGS=-L/c/openal-soft-1.21.0-bin/libs/Win64/" >> $GITHUB_ENV
136-
- run: cp /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/libwinpthread-1.dll .
140+
- run: cp "mingw64/bin/libwinpthread-1.dll" .
141+
- run: PATH="/c/mingw64/bin:$PATH"
137142
- run: go get .
138143
#- run: go test -v -race ./...
139144
#- run: go vet ./...

core/core.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func unarchiveGame(filename string) (string, int64, error) {
111111
extPrefered := make(map[string]int)
112112
extPrefered[".cue"] = 1
113113
extPrefered[".m3u"] = 2
114+
extPrefered[".pbp"] = 3
114115

115116
err = archiver.Walk(filename, func(f archiver.File) error {
116117
fname := f.Name()

dat/dat.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,13 @@ func (db *DB) FindByROMName(romPath string, romName string, crc uint32, games ch
101101
continue
102102
}
103103
// If the checksums match
104-
if romName == game.ROMs[0].Name {
105-
game.Path = romPath
106-
game.System = system
107-
games <- game
104+
for _, ROM := range game.ROMs {
105+
if romName == ROM.Name {
106+
game.Path = romPath
107+
game.System = system
108+
games <- game
109+
}
110+
// element is the element from someSlice for where we are
108111
}
109112
}
110113
wg.Done()

menu/scene_playlist.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func buildPlaylist(path string) Scene {
2626
for _, game := range playlists.Playlists[path] {
2727
game := game // needed for callbackOK
2828
strippedName, tags := extractTags(game.Name)
29+
if strings.Contains(game.Name, "Disc") {
30+
re := regexp.MustCompile(`\((Disc [1-9]?)\)`)
31+
match := re.FindStringSubmatch(game.Name)
32+
strippedName = strippedName + " (" + match[1] + ")"
33+
}
2934
list.children = append(list.children, entry{
3035
label: strippedName,
3136
gameName: game.Name,

menu/scene_tabs.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package menu
33
import (
44
"fmt"
55
"os"
6-
"os/user"
6+
//"os/user"
77
"sort"
88

99
"github.com/libretro/ludo/audio"
@@ -15,6 +15,7 @@ import (
1515
"github.com/libretro/ludo/state"
1616
"github.com/libretro/ludo/utils"
1717
"github.com/libretro/ludo/video"
18+
"github.com/libretro/ludo/settings"
1819
colorful "github.com/lucasb-eyer/go-colorful"
1920

2021
"github.com/tanema/gween"
@@ -63,8 +64,8 @@ func buildTabs() Scene {
6364
subLabel: "Scan your collection",
6465
icon: "add",
6566
callbackOK: func() {
66-
usr, _ := user.Current()
67-
menu.Push(buildExplorer(usr.HomeDir, nil,
67+
//usr, _ := user.Current()
68+
menu.Push(buildExplorer(settings.Current.FileDirectory, nil,
6869
func(path string) {
6970
scanner.ScanDir(path, refreshTabs)
7071
},

scanner/scanner.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"path/filepath"
1212
"strconv"
1313
"strings"
14-
1514
"github.com/libretro/ludo/dat"
1615
ntf "github.com/libretro/ludo/notifications"
1716
"github.com/libretro/ludo/playlists"
@@ -131,7 +130,7 @@ func Scan(dir string, roms []string, games chan (dat.Game), n *ntf.Notification)
131130
}
132131
}
133132
z.Close()
134-
case ".cue":
133+
case ".cue", ".pbp", ".m3u":
135134
// Look for a matching game entry in the database
136135
state.DB.FindByROMName(f, filepath.Base(f), 0, games)
137136
n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f)

settings/defaults.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package settings
22

33
import (
44
"path/filepath"
5-
5+
"os/user"
66
"github.com/adrg/xdg"
77
)
88

99
func defaultSettings() Settings {
10+
usr, _ := user.Current()
1011
return Settings{
1112
VideoFullscreen: false,
1213
VideoMonitorIndex: 0,
@@ -58,6 +59,7 @@ func defaultSettings() Settings {
5859
"SNK - Neo Geo Pocket": "mednafen_ngp_libretro",
5960
"Sony - PlayStation": playstationCore,
6061
},
62+
FileDirectory: usr.HomeDir,
6163
CoresDirectory: "./cores",
6264
AssetsDirectory: "./assets",
6365
DatabaseDirectory: "./database",

settings/settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type Settings struct {
3636

3737
CoreForPlaylist map[string]string `hide:"always" toml:"core_for_playlist"`
3838

39+
FileDirectory string `hide:"ludos" toml:"files_dir" label:"Files Directory" fmt:"%s" widget:"dir"`
3940
CoresDirectory string `hide:"ludos" toml:"cores_dir" label:"Cores Directory" fmt:"%s" widget:"dir"`
4041
AssetsDirectory string `hide:"ludos" toml:"assets_dir" label:"Assets Directory" fmt:"%s" widget:"dir"`
4142
DatabaseDirectory string `hide:"ludos" toml:"database_dir" label:"Database Directory" fmt:"%s" widget:"dir"`

0 commit comments

Comments
 (0)