Skip to content

Commit

Permalink
move .cue creation setting to game settings
Browse files Browse the repository at this point in the history
  • Loading branch information
n-at committed Jan 12, 2025
1 parent 34a2e21 commit d697f16
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion assets/l10n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"game.edit.auto-save-enabled.label": "Auto save enabled",
"game.edit.auto-save-interval.label": "Auto save interval (minutes)",
"game.edit.auto-save-capacity": "Auto save capacity",
"game.edit.cue-enabled.label": "Enable creation of .cue file",
"game.edit.tags.undefined": "Choose or enter a tag...",
"game.edit.tags.label": "Tags",
"game.edit.submit": "Save",
Expand Down Expand Up @@ -229,7 +230,6 @@
"settings-platform.emulation.threads.label": "Use threads",
"settings-platform.emulation.disable-vsync.label": "Disable VSync",
"settings-platform.emulation.disable-browser-db.label": "Disable browser DB",
"settings-platform.emulation.cue-enabled.label": "Enable creation of .cue file",
"settings-platform.core.title": "Core",
"settings-platform.core.empty": "No options for selected core",
"settings-platform.play.title": "Play",
Expand Down
2 changes: 1 addition & 1 deletion assets/l10n/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"game.edit.auto-save-enabled.label": "Включить авто сохранение",
"game.edit.auto-save-interval.label": "Интервал авто сохранения (минут)",
"game.edit.auto-save-capacity": "Количество авто сохранений",
"game.edit.cue-enabled.label": "Включить создание файлов .cue",
"game.edit.tags.undefined": "Введите или выберите теги...",
"game.edit.tags.label": "Теги",
"game.edit.submit": "Сохранить",
Expand Down Expand Up @@ -229,7 +230,6 @@
"settings-platform.emulation.threads.label": "Использовать потоки",
"settings-platform.emulation.disable-vsync.label": "Отключить вертикальную синхронизацию",
"settings-platform.emulation.disable-browser-db.label": "Отключить использование БД браузера",
"settings-platform.emulation.cue-enabled.label": "Включить создание файлов .cue",
"settings-platform.core.title": "Ядро",
"settings-platform.core.empty": "Нет настроек для выбранного ядра",
"settings-platform.play.title": "Игра",
Expand Down
1 change: 0 additions & 1 deletion storage/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,6 @@ func DefaultEmulatorSettings(systemType string) EmulatorSettings {
settings.Shader = Shaders[0].Value
settings.Buttons = DefaultButtons
settings.Controls = [4]EmulatorControls{controls}
settings.CueEnabled = true

return settings
}
2 changes: 1 addition & 1 deletion storage/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type Game struct {
AutoSaveEnabled bool
AutoSaveInterval int
AutoSaveCapacity int
CueEnabled bool
OverrideEmulatorSettings bool
EmulatorSettings EmulatorSettings
}
Expand Down Expand Up @@ -91,7 +92,6 @@ type EmulatorSettings struct {
Threads bool
DisableBrowserDB bool
DisableVSync bool
CueEnabled bool
}

type EmulatorControls struct {
Expand Down
7 changes: 7 additions & 0 deletions templates/includes/form_game_settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@
</div>
</div>
</div>

<div class="mb-3">
<div class="form-check form-switch">
<input type="checkbox" id="cue-enabled" name="cue-enabled" class="form-check-input" value="1" {% if game.CueEnabled %}checked{% endif %}>
<label for="cue-enabled">{{ loc("game.edit.cue-enabled.label") }}</label>
</div>
</div>
6 changes: 0 additions & 6 deletions templates/includes/platform_settings/emulation.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,5 @@
<input type="checkbox" id="disable-browser-db" name="disable-browser-db" class="form-check-input" value="1" {% if settings.DisableBrowserDB %}checked{% endif %}>
<label for="disable-browser-db">{{ loc("settings-platform.emulation.disable-browser-db.label") }}</label>
</div>
<div class="mb-3">
<div class="form-check form-switch">
<input type="checkbox" id="cue-enabled" name="cue-enabled" class="form-check-input" value="1" {% if settings.CueEnabled %}checked{% endif %}>
<label for="cue-enabled">{{ loc("settings-platform.emulation.cue-enabled.label") }}</label>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion templates/play.twig
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
window.EJS_disableDatabases = true;
{% endif %}
{% if not emulator_settings.CueEnabled %}
{% if not game.CueEnabled %}
window.EJS_disableCue = true;
{% endif %}
Expand Down
9 changes: 6 additions & 3 deletions web/handlers_game.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package web
import (
"errors"
"fmt"
"github.com/flosch/pongo2/v6"
"github.com/labstack/echo/v4"
log "github.com/sirupsen/logrus"
"net/http"
"playtime/storage"
"strconv"

"github.com/flosch/pongo2/v6"
"github.com/labstack/echo/v4"
log "github.com/sirupsen/logrus"
)

func (s *Server) games(c echo.Context) error {
Expand Down Expand Up @@ -77,6 +78,7 @@ func (s *Server) gameUpload(c echo.Context) error {
AutoSaveEnabled: settings.DefaultGameSettings.AutoSaveEnabled,
AutoSaveInterval: settings.DefaultGameSettings.AutoSaveInterval,
AutoSaveCapacity: settings.DefaultGameSettings.AutoSaveCapacity,
CueEnabled: settings.DefaultGameSettings.CueEnabled,
OverrideEmulatorSettings: false,
EmulatorSettings: storage.DefaultEmulatorSettings(""),
}
Expand Down Expand Up @@ -193,6 +195,7 @@ func (s *Server) gameEditSubmit(c echo.Context) error {
game.AutoSaveEnabled = c.FormValue("auto-save-enabled") == "1"
game.AutoSaveInterval = autoSaveInterval * 60
game.AutoSaveCapacity = autoSaveCapacity
game.CueEnabled = c.FormValue("cue-enabled") == "1"

newPlatform := c.FormValue("platform")
if game.Platform != newPlatform {
Expand Down
2 changes: 1 addition & 1 deletion web/handlers_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (s *Server) settingsGeneralSubmit(c echo.Context) error {
settings.DefaultGameSettings.AutoSaveEnabled = c.FormValue("auto-save-enabled") == "1"
settings.DefaultGameSettings.AutoSaveInterval = autoSaveInterval * 60
settings.DefaultGameSettings.AutoSaveCapacity = autoSaveCapacity
settings.DefaultGameSettings.CueEnabled = c.FormValue("cue-enabled") == "1"

if _, err := s.storage.SettingsSave(*settings); err != nil {
return err
Expand Down Expand Up @@ -243,7 +244,6 @@ func settingsCollectFormData(c echo.Context) storage.EmulatorSettings {
Threads: c.FormValue("threads") == "1",
DisableBrowserDB: c.FormValue("disable-browser-db") == "1",
DisableVSync: c.FormValue("disable-vsync") == "1",
CueEnabled: c.FormValue("cue-enabled") == "1",
VideoRotation: videoRotation,
Buttons: buttons,
Controls: settingsCollectControls(c),
Expand Down

0 comments on commit d697f16

Please sign in to comment.