diff --git a/src/app/game/page.tsx b/src/app/game/page.tsx
index ebe4749..e567ed7 100644
--- a/src/app/game/page.tsx
+++ b/src/app/game/page.tsx
@@ -8,7 +8,7 @@ import { useRouter, useSearchParams } from 'next/navigation'
import { platform } from '@tauri-apps/plugin-os'
import { faWarning } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
-import { ask, message } from '@tauri-apps/plugin-dialog'
+import { ask } from '@tauri-apps/plugin-dialog'
import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
import { writeVersionsConfig } from '@/lib/BazookaManager'
import { openFolder } from '@/lib/Util'
@@ -226,10 +226,60 @@ export default function Installs () {
entry
)
) {
- await message(
- "Can't launch game. Need revision update.",
- { title: 'Error launching game', kind: 'error' }
+ const answer = await ask(
+ 'Before proceeding, if you do not want your installation directory wiped just yet, please backup the files to another directory. When you click "Yes", it will be wiped. Click "No" if you want to open the installation folder instead.',
+ {
+ title: 'Revision Update',
+ kind: 'warning'
+ }
)
+ if (answer) {
+ const answer2 = await ask(
+ 'Are you sure you want to update? If you did not read the last popup, please go back and read it.',
+ {
+ title: 'Revision Update',
+ kind: 'warning'
+ }
+ )
+ if (!answer2) return
+
+ //open downloads popup
+ setPopupMode(1)
+ setShowPopup(true)
+ setFadeOut(false)
+
+ //uninstall
+ setDownloadedVersionsConfig(prev => {
+ if (!prev) return prev
+ const updatedList = Object.fromEntries(
+ Object.entries(prev.list).filter(
+ ([k]) => k !== entry
+ )
+ )
+ const updatedConfig = {
+ ...prev,
+ list: updatedList
+ }
+ writeVersionsConfig(updatedConfig)
+ return updatedConfig
+ })
+
+ if (
+ await exists('game/' + entry, {
+ baseDir: BaseDirectory.AppLocalData
+ })
+ )
+ await remove('game/' + entry, {
+ baseDir: BaseDirectory.AppLocalData,
+ recursive: true
+ })
+
+ //reinstall
+ setSelectedVersionList([entry])
+ downloadVersions([entry])
+ } else {
+ openFolder(entry)
+ }
return
}
const verInfo = getVersionInfo(entry)
@@ -306,95 +356,6 @@ export default function Installs () {
Needs revision update!
-
-
-
-
-
))
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index b55e670..56add8e 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -32,11 +32,10 @@ import {
} from '@tauri-apps/plugin-notification'
import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
-import DownloadsPopup from '@/componets/popups/Downloads'
-import VersionInfoPopup from '@/componets/popups/VersionInfo'
-import ManagingVersionPopup from '@/componets/popups/ManageVersion'
-import GamesDownloadPopup from '@/componets/popups/GamesDownload'
import VersionsDownloadPopup from '@/componets/popups/VersionsDownload'
+import GamesDownloadPopup from '@/componets/popups/GamesDownload'
+import DownloadsPopup from '@/componets/popups/Downloads'
+import VersionVersionPopup from '@/componets/popups/VersionVersion'
const roboto = Roboto({
subsets: ['latin']
@@ -172,8 +171,6 @@ export default function RootLayout ({
} else if (viewingInfoFromDownloads) {
setViewingInfoFromDownloads(false)
setPopupMode(0)
- } else if (popupMode == 4) {
- setPopupMode(3)
} else {
setFadeOut(true)
setTimeout(() => setShowPopup(false), 200)
@@ -565,9 +562,7 @@ export default function RootLayout ({
) : popupMode === 1 ? (
) : popupMode === 2 ? (
-
- ) : popupMode === 3 ? (
-
+
) : null}
diff --git a/src/componets/popups/Downloads.tsx b/src/componets/popups/Downloads.tsx
index eb9b040..3bf48aa 100644
--- a/src/componets/popups/Downloads.tsx
+++ b/src/componets/popups/Downloads.tsx
@@ -58,7 +58,7 @@ export default function DownloadsPopup () {
v.hash_checking ? 'text-blue-300' : 'text-green-300'
} inline-block w-full text-center`}
>
- {v.hash_checking ? 'Checking hash' : 'Finishing'}
+ {v.hash_checking ? 'Verifying file integerty' : 'Finishing'}
...
) : (
diff --git a/src/componets/popups/ManageVersion.tsx b/src/componets/popups/ManageVersion.tsx
deleted file mode 100644
index 2316ccf..0000000
--- a/src/componets/popups/ManageVersion.tsx
+++ /dev/null
@@ -1,106 +0,0 @@
-import { useGlobal } from '@/app/GlobalProvider'
-import { writeVersionsConfig } from '@/lib/BazookaManager'
-import { openFolder } from '@/lib/Util'
-import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
-
-export default function ManageVersionPopup () {
- const {
- getVersionInfo,
- managingVersion,
- closePopup,
- setDownloadedVersionsConfig,
- setManagingVersion,
- downloadVersions,
- setSelectedVersionList,
- setPopupMode
- } = useGlobal()
- if (!managingVersion) return <>>
-
- return (
- <>
-
- Manage {getVersionInfo(managingVersion)?.displayName}
-
-
-
-
-
-
- >
- )
-}
diff --git a/src/componets/popups/VersionInfo.tsx b/src/componets/popups/VersionVersion.tsx
similarity index 51%
rename from src/componets/popups/VersionInfo.tsx
rename to src/componets/popups/VersionVersion.tsx
index 0e16643..1cae789 100644
--- a/src/componets/popups/VersionInfo.tsx
+++ b/src/componets/popups/VersionVersion.tsx
@@ -14,24 +14,34 @@ import { invoke } from '@tauri-apps/api/core'
import { useEffect, useState } from 'react'
import prettyBytes from 'pretty-bytes'
import { message } from '@tauri-apps/plugin-dialog'
+import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
+import { writeVersionsConfig } from '@/lib/BazookaManager'
+import { openFolder } from '@/lib/Util'
-export default function VersionInfoPopup () {
+export default function VersionVersionPopup () {
const {
getGameInfo,
getVersionInfo,
managingVersion,
downloadedVersionsConfig,
- viewingInfoFromDownloads
+ viewingInfoFromDownloads,
+ setManagingVersion,
+ closePopup,
+ setDownloadedVersionsConfig,
+ setPopupMode,
+ setSelectedVersionList,
+ downloadVersions
} = useGlobal()
const [versionSize, setVersionSize] = useState(0)
useEffect(() => {
+ if (viewingInfoFromDownloads) return
invoke('folder_size', {
version: managingVersion
}).then(size => {
setVersionSize(Number(size))
})
- }, [managingVersion, setVersionSize])
+ }, [managingVersion, setVersionSize, viewingInfoFromDownloads])
if (!managingVersion || !downloadedVersionsConfig) return <>>
@@ -40,9 +50,7 @@ export default function VersionInfoPopup () {
return (
<>
-
- Viewing info for {versionInfo?.displayName}
-
+ Viewing {versionInfo?.displayName}
Size on disk:{' '}
- {versionSize > 0
+ {versionSize && versionSize > 0
? prettyBytes(versionSize, {
minimumFractionDigits: 2,
maximumFractionDigits: 2
@@ -99,7 +107,10 @@ export default function VersionInfoPopup () {
: 'N/A'}
-
+
Size when downloaded (zipped):{' '}
@@ -125,6 +136,88 @@ export default function VersionInfoPopup () {
View Changelog
+
openFolder(managingVersion)}
+ title="Click to browse the game's files."
+ hidden={viewingInfoFromDownloads}
+ >
+ Open Folder
+
+
+
{
+ closePopup()
+
+ setDownloadedVersionsConfig(prev => {
+ if (!prev) return prev
+ const updatedList = Object.fromEntries(
+ Object.entries(prev.list).filter(([k]) => k !== managingVersion)
+ )
+ const updatedConfig = {
+ ...prev,
+ list: updatedList
+ }
+ writeVersionsConfig(updatedConfig)
+ return updatedConfig
+ })
+
+ if (
+ await exists('game/' + managingVersion, {
+ baseDir: BaseDirectory.AppLocalData
+ })
+ )
+ await remove('game/' + managingVersion, {
+ baseDir: BaseDirectory.AppLocalData,
+ recursive: true
+ })
+ }}
+ title='Click to uninstall this game. This will NOT remove any progress or any save files.'
+ hidden={viewingInfoFromDownloads}
+ >
+ Uninstall
+
+
{
+ //change popup to downloads
+ setManagingVersion(null)
+ setPopupMode(1)
+
+ //uninstall
+ setDownloadedVersionsConfig(prev => {
+ if (!prev) return prev
+ const updatedList = Object.fromEntries(
+ Object.entries(prev.list).filter(([k]) => k !== managingVersion)
+ )
+ const updatedConfig = {
+ ...prev,
+ list: updatedList
+ }
+ writeVersionsConfig(updatedConfig)
+ return updatedConfig
+ })
+
+ if (
+ await exists('game/' + managingVersion, {
+ baseDir: BaseDirectory.AppLocalData
+ })
+ )
+ await remove('game/' + managingVersion, {
+ baseDir: BaseDirectory.AppLocalData,
+ recursive: true
+ })
+
+ //reinstall
+ setSelectedVersionList([managingVersion])
+ downloadVersions([managingVersion])
+ }}
+ title="Click to reinstall this game. This will NOT remove any progress or any save files. This WILL uninstall any modifications to the game's executable files."
+ hidden={viewingInfoFromDownloads}
+ >
+ Reinstall
+
>
)
diff --git a/src/componets/popups/VersionsDownload.tsx b/src/componets/popups/VersionsDownload.tsx
index bca45f2..0a94205 100644
--- a/src/componets/popups/VersionsDownload.tsx
+++ b/src/componets/popups/VersionsDownload.tsx
@@ -66,7 +66,7 @@ export default function VersionsDownloadPopup () {
onClick={() => {
setManagingVersion(v.id)
setViewingInfoFromDownloads(true)
- setPopupMode(3)
+ setPopupMode(2)
}}
title='Click to view version info'
>