Add new Libretro core manager module (#249)

* Add initial external configuration files support.

These external configuration files allow changing app params at the runtime without recompilation.

* Find config files with specified directory in the tests

* Add aspect ratio recalculation config

* Clean code

* Add new configuration files into the Docker container image

* Add shared core and config paths into the Libretro cores config

* Split ROM <-> Emulator mapping between workers and coordinators

* Extract coordinator config

* Add shared worker/coordinator server config

* Add explicit embedded shared worker/coordinator struct for auto-config reflection fill

* Remove default stun/turn servers from the config

* Extract and add new ice servers config structures

* Update coordinator config params

* Add auto emulation lib loader based on the runtime OS/arch

* Update configuration structures

* Remove shared config embedding

* Add missing network config params

* Add game library external config

* Remove unused config parameters

* Add WebRTC encoder external options

* Add user dir for config search

* Update config loader

* Update config

* Add generic downloader with Grab lib implementation

* Add a simple file downloader backed by the grab lib

* Add initial Libretro core repos abstractions

* Expose compression info for Libretro cores repository records

* Add pipe-based abstract file downloader

* Refactor downloader

* Refactor Libretro repos

* Add worker coresync stubs

* Add multiprocess-safe HTTP-based core manager implementation

* Remove Libretro cores from the repo

* Keep custom N64 cores in te repo for now

* Add Libretro cores repo select in the config

* Fix http manager repo switch

* Cleanup code

* Add greedy Libretro lib loader

* Don't crash when arch map is not set

* Disable dynamic recompiler for pcsx core by default since it's could cause a crash

* Use global Libretro dynalib handler

* Shorten the default Libretro cores store path

* Update zip extractor implementation

* Remove explicit fig lib field markings

* Add config note to the README file

* Add GitHub repo backend for the core downloader

* Fix GitHub repo param list in the manager factory

* Add env variables reader with CLOUD_GAME prefix

* Re-optimize ice server info struct custom marshaler
This commit is contained in:
sergystepanov 2020-12-31 13:24:27 +03:00 committed by Sergey Stepanov
parent 7299ecc6d1
commit 1fcf34ee02
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B
95 changed files with 1984 additions and 866 deletions

View file

@ -2,22 +2,25 @@ package main
import (
"context"
goflag "flag"
"math/rand"
"os"
"os/signal"
"time"
config "github.com/giongto35/cloud-game/v2/pkg/config/coordinator"
"github.com/giongto35/cloud-game/v2/pkg/coordinator"
"github.com/giongto35/cloud-game/v2/pkg/util/logging"
"github.com/golang/glog"
"github.com/spf13/pflag"
flag "github.com/spf13/pflag"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
cfg := coordinator.NewDefaultConfig()
cfg.AddFlags(pflag.CommandLine)
conf := config.NewConfig()
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
conf.ParseFlags()
logging.Init()
defer logging.Flush()
@ -25,8 +28,8 @@ func main() {
ctx, cancelCtx := context.WithCancel(context.Background())
glog.Infof("Initializing coordinator server")
glog.V(4).Infof("Coordinator configs %v", cfg)
o := coordinator.New(ctx, cfg)
glog.V(4).Infof("Coordinator configs %v", conf)
o := coordinator.New(ctx, conf)
if err := o.Run(); err != nil {
glog.Errorf("Failed to run coordinator server, reason %v", err)
os.Exit(1)

View file

@ -2,6 +2,7 @@ package main
import (
"context"
goflag "flag"
"math/rand"
"os"
"os/signal"
@ -12,14 +13,15 @@ import (
"github.com/giongto35/cloud-game/v2/pkg/util/logging"
"github.com/giongto35/cloud-game/v2/pkg/worker"
"github.com/golang/glog"
"github.com/spf13/pflag"
flag "github.com/spf13/pflag"
)
func run() {
rand.Seed(time.Now().UTC().UnixNano())
cfg := config.NewDefaultConfig()
cfg.AddFlags(pflag.CommandLine)
conf := config.NewConfig()
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
conf.ParseFlags()
logging.Init()
defer logging.Flush()
@ -27,8 +29,8 @@ func run() {
ctx, cancelCtx := context.WithCancel(context.Background())
glog.Infof("Initializing worker server")
glog.V(4).Infof("Worker configs %v", cfg)
o := worker.New(ctx, cfg)
glog.V(4).Infof("Worker configs %v", conf)
o := worker.New(ctx, conf)
if err := o.Run(); err != nil {
glog.Errorf("Failed to run worker, reason %v", err)
os.Exit(1)