diff --git a/actions/steps/steps.go b/actions/steps/steps.go index 2cbfe4f..f75589b 100644 --- a/actions/steps/steps.go +++ b/actions/steps/steps.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "github.com/kiamev/moogle-mod-manager/config" + "github.com/kiamev/moogle-mod-manager/discover" "github.com/kiamev/moogle-mod-manager/downloads" "github.com/kiamev/moogle-mod-manager/files" "github.com/kiamev/moogle-mod-manager/files/archive" @@ -57,11 +58,20 @@ func VerifyEnable(state *State) (mods.Result, error) { } if len(c.Requires) > 0 { for _, mc = range c.Requires { + var name string mod, found, enabled = managed.IsModEnabled(state.Game, mc.ModID()) - if !found { - return mods.Error, fmt.Errorf("[%s] cannot be enabled because [%s] is not enabled", tm.DisplayName(), mc.ModID()) - } else if !enabled { - return mods.Error, fmt.Errorf("[%s] cannot be enabled because [%s] is not enabled", tm.DisplayName(), mod.DisplayName()) + if !enabled { + if !found || mod == nil { + name, _ = discover.GetDisplayName(state.Game, mc.ModID()) + } + if name == "" { + if mod != nil { + name = mod.DisplayName() + } else { + name = string(mc.ModID()) + } + } + return mods.Error, fmt.Errorf("[%s] cannot be enabled because [%s] is not enabled", tm.DisplayName(), name) } } } diff --git a/browser/update.go b/browser/update.go index 951be80..569edec 100644 --- a/browser/update.go +++ b/browser/update.go @@ -12,7 +12,7 @@ import ( ) const ( - Version = "v0.7.2" + Version = "v0.7.3" tagUrl = `https://api.github.com/repos/KiameV/ffprModManager/tags` relUrl = `https://github.com/KiameV/ffprModManager/releases/%s` diff --git a/mods/mod.go b/mods/mod.go index 252085b..af18726 100644 --- a/mods/mod.go +++ b/mods/mod.go @@ -59,6 +59,7 @@ var Categories = []string{ string(EnemySprite), string(GameOverhauls), string(Gameplay), + string(Fonts), string(PlayerNpcSprites), string(ScriptText), string(Soundtrack), diff --git a/scripts/findSupportedMods.go b/scripts/findSupportedMods.go index bd86a6a..eb59102 100644 --- a/scripts/findSupportedMods.go +++ b/scripts/findSupportedMods.go @@ -103,7 +103,7 @@ func getGameFiles(apiKey string, i int, g game) error { } } } - if len(fs.Files) == 0 { + if len(fs.Files) == 1 { if easy { sfo.WriteString(fullSb.String()) } else { diff --git a/ui/config-installer/configInstaller.go b/ui/config-installer/configInstaller.go index 8cb73d7..c7e339d 100644 --- a/ui/config-installer/configInstaller.go +++ b/ui/config-installer/configInstaller.go @@ -84,7 +84,7 @@ func (ui *configInstallerUI) Draw(w fyne.Window) { ui.prevConfigs = append(ui.prevConfigs, ui.currentConfig) ui.toInstall = append(ui.toInstall, ui.currentChoice.DownloadFiles) if ui.currentChoice.NextConfigurationName == nil { - tis, err := mods.NewToInstallForMod(ui.mod.ModKind.Kind, ui.mod, ui.toInstall) + tis, err := mods.NewToInstallForMod(ui.mod.ModKind.Kind, ui.mod, ui.uniqueToInstall()) if err != nil { util.ShowErrorLong(err) state.ShowPreviousScreen() @@ -178,3 +178,17 @@ func (ui *configInstallerUI) popChoice() (c *mods.Configuration) { ui.prevConfigs = ui.prevConfigs[:l] return } + +func (ui *configInstallerUI) uniqueToInstall() []*mods.DownloadFiles { + l := make(map[string]*mods.DownloadFiles) + for _, df := range ui.toInstall { + if df.DownloadName != "" { + l[df.DownloadName] = df + } + } + result := make([]*mods.DownloadFiles, 0, len(l)) + for _, df := range l { + result = append(result, df) + } + return result +} diff --git a/ui/local/localUI.go b/ui/local/localUI.go index f4a483e..211f3ba 100644 --- a/ui/local/localUI.go +++ b/ui/local/localUI.go @@ -214,6 +214,7 @@ func (ui *localUI) removeSelectedMod() { util.ShowErrorLong(err) return } + _ = managed.Save() for i, m := range ui.mods { if m == ui.selectedMod { ui.mods = append(ui.mods[:i], ui.mods[i+1:]...) diff --git a/ui/mod-author/author.go b/ui/mod-author/author.go index 5e43853..621fe5a 100644 --- a/ui/mod-author/author.go +++ b/ui/mod-author/author.go @@ -294,8 +294,10 @@ func (a *ModAuthorer) Draw(w fyne.Window) { if len(a.configsDef.list.Items) == 0 { util.DisplayDownloadsAndFiles(tis) } else { - if err = state.GetScreen(state.ConfigInstaller).(config_installer.ConfigInstaller).Setup(mod, state.GetBaseDir(), func(_ mods.Result, tis []*mods.ToInstall) error { - util.DisplayDownloadsAndFiles(tis) + if err = state.GetScreen(state.ConfigInstaller).(config_installer.ConfigInstaller).Setup(mod, state.GetBaseDir(), func(r mods.Result, tis []*mods.ToInstall) error { + if r == mods.Ok && len(tis) > 0 { + util.DisplayDownloadsAndFiles(tis) + } return nil }); err != nil { util.ShowErrorLong(err) diff --git a/ui/util/sandbox.go b/ui/util/sandbox.go index 03bf834..2aead80 100644 --- a/ui/util/sandbox.go +++ b/ui/util/sandbox.go @@ -19,6 +19,9 @@ func DisplayDownloadsAndFiles(toInstall []*mods.ToInstall) { }() sb := strings.Builder{} for _, ti := range toInstall { + if ti.Download == nil { + continue + } sb.WriteString(fmt.Sprintf("## %s\n\n", ti.Download.Name)) sb.WriteString("### Sources:\n\n") if ti.Download.Hosted != nil {