Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into kivutar/fixmsi
Browse files Browse the repository at this point in the history
  • Loading branch information
kivutar committed Feb 7, 2019
2 parents 09c19f3 + 02236dc commit 66d33c4
Show file tree
Hide file tree
Showing 25 changed files with 235 additions and 229 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ludo
ludo.exe
settings.json
Ludo.app
Ludo.dmg
*.app
*.dmg
cores
*.dll
*.msi
20 changes: 8 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ env:
before_script:
- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/)
- go get github.com/golang/lint/golint
- go get honnef.co/go/tools/cmd/megacheck
- go get honnef.co/go/tools/cmd/staticcheck
- go get github.com/fzipp/gocyclo
- export PATH=$GOPATH/bin:$PATH

matrix:
include:
Expand All @@ -27,11 +28,10 @@ matrix:
- go get -v ./...
- go test -v -race ./...
- go vet ./...
- megacheck ./...
- staticcheck ./...
- gocyclo -over 19 $GO_FILES
- golint -set_exit_status $(go list ./...)
- go build -v
before_deploy:
- if [[ -n "$TRAVIS_TAG" ]]; then OS="Linux" ARCH=x86_64 VERSION=${TRAVIS_TAG:1} make tar; fi
- name: Linux arm
os: linux
Expand All @@ -51,11 +51,10 @@ matrix:
- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go get -t -v ./...
#- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go test -v -race ./...
- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go vet ./...
- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc megacheck ./...
- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc staticcheck ./...
- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc gocyclo -over 19 $GO_FILES
- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc golint -set_exit_status $(go list ./...)
- GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go build -v
before_deploy:
- if [[ -n "$TRAVIS_TAG" ]]; then OS="Linux" ARCH=arm VERSION=${TRAVIS_TAG:1} make tar; fi
- name: OSX
os: osx
Expand All @@ -66,11 +65,10 @@ matrix:
- go get -v ./...
- go test -v -race ./...
- go vet ./...
- megacheck ./...
- staticcheck ./...
- gocyclo -over 19 $GO_FILES
- golint -set_exit_status $(go list ./...)
- go build -v
before_deploy:
- if [[ -n "$TRAVIS_TAG" ]]; then OS="OSX" ARCH=x86_64 VERSION=${TRAVIS_TAG:1} make dmg; fi
- name: Windows
os: windows
Expand All @@ -79,7 +77,7 @@ matrix:
- choco install nuget.commandline
- nuget install WiX
- choco install go-msi
- export PATH="$PATH;$WIX/bin"
- export PATH="$PATH;/c/Program Files (x86)/WiX Toolset v3.11/bin"
- wget http://static.kivutar.me/openal-soft-1.19.0-bin.zip
- 7z x openal-soft-1.19.0-bin.zip -o/c/Users/travis/openal-soft-1.19.0-bin
- export CGO_CFLAGS="-I/c/Users/travis/openal-soft-1.19.0-bin/include/"
Expand All @@ -90,13 +88,11 @@ matrix:
- go get -v ./...
#- go test -v ./...
#- go vet ./...
- megacheck ./...
- staticcheck ./...
- gocyclo -over 19 $GO_FILES
- golint -set_exit_status $(go list ./...)
- go build -v -ldflags '-H=windowsgui'
- ls -la
- OS="Windows" ARCH=x86_64 VERSION=0.3.2 make msi
before_deploy:
- if [[ -n "$TRAVIS_TAG" ]]; then choco install go-msi; fi
- if [[ -n "$TRAVIS_TAG" ]]; then export PATH="$PATH;$WIX/bin"; fi
- if [[ -n "$TRAVIS_TAG" ]]; then OS="Windows" ARCH=x86_64 VERSION=${TRAVIS_TAG:1} make msi; fi
Expand All @@ -110,7 +106,7 @@ deploy:
- Ludo-Linux-x86_64-${TRAVIS_TAG:1}.tar.gz
- Ludo-Linux-arm-${TRAVIS_TAG:1}.tar.gz
- Ludo-OSX-x86_64-${TRAVIS_TAG:1}.dmg
- Ludo-Windows-x86_64-${TRAVIS_TAG:1}.msi
- Ludo-Windows-x86_64-${TRAVIS_TAG:1}.zip
on:
repo: libretro/ludo
tags: true
Expand Down
38 changes: 21 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
APP = Ludo
BUNDLENAME = $(APP)-$(OS)-$(ARCH)-$(VERSION)

CORES = atari800 fbalpha fceumm gambatte genesis_plus_gx handy mednafen_ngp mednafen_pce_fast mednafen_psx mednafen_saturn mednafen_supergrafx mednafen_vb mednafen_wswan mgba pcsx_rearmed picodrive prosystem snes9x stella vecx virtualjaguar
CORES = fbalpha fceumm gambatte genesis_plus_gx handy mednafen_ngp mednafen_pce_fast mednafen_psx mednafen_saturn mednafen_supergrafx mednafen_vb mednafen_wswan mgba pcsx_rearmed picodrive prosystem snes9x stella vecx virtualjaguar

ifeq ($(ARCH), arm)
CORES := $(filter-out mednafen_saturn,$(CORES))
endif

DYLIBS = $(addprefix cores/, $(addsuffix _libretro.dylib,$(CORES)))
DLLS = $(addprefix cores/, $(addsuffix _libretro.dll,$(CORES)))
SOBJS = $(addprefix cores/, $(addsuffix _libretro.so,$(CORES)))

ifeq ($(OS), OSX)
BUILDBOTURL=http://buildbot.libretro.com/nightly/apple/osx/$(ARCH)/latest
Expand All @@ -23,18 +31,13 @@ endif
ludo:
go build

ludo.exe:
go build -ldflags '-H=windowsgui'

cores:
cores/%_libretro.dylib cores/%_libretro.dll cores/%_libretro.so:
mkdir -p cores
for CORE in ${CORES} ; do \
wget $(BUILDBOTURL)/$${CORE}_libretro.$(EXT).zip -O cores/$${CORE}_libretro.$(EXT).zip; \
unzip cores/$${CORE}_libretro.$(EXT).zip -d cores; \
rm cores/$${CORE}_libretro.$(EXT).zip; \
done
wget $(BUILDBOTURL)/$(@F).zip -O $@.zip
unzip $@.zip -d cores
rm $@.zip

$(APP).app: ludo cores
$(APP).app: ludo $(DYLIBS)
mkdir -p $(APP).app/Contents/MacOS
mkdir -p $(APP).app/Contents/Resources/$(APP).iconset
cp pkg/Info.plist $(APP).app/Contents/
Expand All @@ -60,6 +63,7 @@ empty.dmg:
hdiutil create -fs HFSX -layout SPUD -size 200m empty.dmg -srcfolder template -format UDRW -volname $(BUNDLENAME) -quiet
rmdir template

# For OSX
dmg: empty.dmg $(APP).app
mkdir -p wc
hdiutil attach empty.dmg -noautoopen -quiet -mountpoint wc
Expand All @@ -70,24 +74,24 @@ dmg: empty.dmg $(APP).app
rm -f $(BUNDLENAME)-*.dmg
hdiutil convert empty.dmg -quiet -format UDZO -imagekey zlib-level=9 -o $(BUNDLENAME).dmg

zip: ludo cores
# For Windows
zip: ludo $(DLLS)
mkdir -p $(BUNDLENAME)/
./rcedit-x64 ludo.exe --set-icon assets/icon.ico
cp ludo $(BUNDLENAME)/
cp -r database $(BUNDLENAME)/
cp -r assets $(BUNDLENAME)/
cp -r cores $(BUNDLENAME)/
7z a $(BUNDLENAME).zip $(BUNDLENAME)\

tar: ludo cores
# For Linux
tar: ludo $(SOBJS)
mkdir -p $(BUNDLENAME)/
cp ludo $(BUNDLENAME)/
cp -r database $(BUNDLENAME)/
cp -r assets $(BUNDLENAME)/
cp -r cores $(BUNDLENAME)/
tar -zcf $(BUNDLENAME).tar.gz $(BUNDLENAME)\

msi: ludo.exe cores
go-msi.exe make --msi $(BUNDLENAME).msi --version=$(VERSION) --arch=x64

clean:
rm -rf *.app ludo ludo.exe wc *.dmg $(BUNDLENAME)-* *.msi cores/
rm -rf $(BUNDLENAME).app ludo wc empty.dmg $(BUNDLENAME).dmg $(BUNDLENAME)-* cores/
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 6 files
+ icon.ico
+ icon.png
+7 −36 icon.svg
+ illustration.png
+ main.png
+22 −13 main.svg
2 changes: 0 additions & 2 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ func Load(sofile string) error {
}
}

log.Println("[Core]: Core loaded: " + si.LibraryName)

return nil
}

Expand Down
1 change: 0 additions & 1 deletion core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func Test_coreLoad(t *testing.T) {
[Core]: Valid extensions: bin|vec
[Core]: Need fullpath: false
[Core]: Block extract: false
[Core]: Core loaded: VecX
`
if got != want {
t.Errorf("got = %v, want %v", got, want)
Expand Down
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"log"
"runtime"
"time"

"github.com/go-gl/glfw/v3.2/glfw"
"github.com/libretro/ludo/core"
Expand All @@ -23,9 +24,12 @@ func init() {
}

func runLoop(vid *video.Video) {
var currTime, prevTime time.Time
for !vid.Window.ShouldClose() {
currTime = time.Now()
dt := float32(currTime.Sub(prevTime)) / 1000000000
glfw.PollEvents()
ntf.Process()
ntf.Process(dt)
if !state.Global.MenuActive {
if state.Global.CoreRunning {
state.Global.Core.Run()
Expand All @@ -39,14 +43,15 @@ func runLoop(vid *video.Video) {
vid.Render()
} else {
input.Poll()
menu.Update()
menu.Update(dt)
vid.Render()
menu.Render()
menu.Render(dt)
}
input.ProcessActions()
menu.RenderNotifications()
glfw.SwapInterval(1)
vid.Window.SwapBuffers()
prevTime = currTime
}
}

Expand Down Expand Up @@ -84,7 +89,7 @@ func main() {
log.Println("Can't load game database:", err)
}

playlists.LoadPlaylists()
playlists.Load()

vid := video.Init(settings.Current.VideoFullscreen, settings.Current.GLVersion)

Expand Down
61 changes: 44 additions & 17 deletions menu/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,60 @@ import (

// Update takes care of calling the update method of the current scene.
// Each scene has it's own input logic to allow a variety of navigation systems.
func Update() {
func Update(dt float32) {
currentScene := menu.stack[len(menu.stack)-1]
currentScene.update()
currentScene.update(dt)
}

func genericInput(list *entry) {
if menu.inputCooldown > 0 {
menu.inputCooldown--
var downPressed, upPressed, downDelay, upDelay float32

// Used to speed up the scrolling when up or down are hold by reducing the
// input cooldown delay accordingly
func scrollSpeed(pressedSeconds float32) float32 {
delay := 0.15 - pressedSeconds/50
if delay < 0.001 {
return 0.01
}
return delay
}

func genericInput(list *entry, dt float32) {
menu.inputCooldown -= dt
if menu.inputCooldown < 0 {
menu.inputCooldown = 0
}

if input.NewState[0][libretro.DeviceIDJoypadDown] && menu.inputCooldown == 0 {
list.ptr++
if list.ptr >= len(list.children) {
list.ptr = 0
// Down
if input.NewState[0][libretro.DeviceIDJoypadDown] {
if menu.inputCooldown == 0 {
list.ptr++
if list.ptr >= len(list.children) {
list.ptr = 0
}
genericAnimate(list)
menu.inputCooldown = downDelay
}
genericAnimate(list)
menu.inputCooldown = 10
downPressed += dt
} else {
downPressed = 0
}
downDelay = scrollSpeed(downPressed)

if input.NewState[0][libretro.DeviceIDJoypadUp] && menu.inputCooldown == 0 {
list.ptr--
if list.ptr < 0 {
list.ptr = len(list.children) - 1
// Up
if input.NewState[0][libretro.DeviceIDJoypadUp] {
if menu.inputCooldown == 0 {
list.ptr--
if list.ptr < 0 {
list.ptr = len(list.children) - 1
}
genericAnimate(list)
menu.inputCooldown = upDelay
}
genericAnimate(list)
menu.inputCooldown = 10
upPressed += dt
} else {
upPressed = 0
}
upDelay = scrollSpeed(upPressed)

// OK
if input.Released[0][libretro.DeviceIDJoypadA] {
Expand Down
Loading

0 comments on commit 66d33c4

Please sign in to comment.