Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/Adding a game.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
- An array of different executable names (for all platforms). For `StorePlatform` types such as `OTHER` and `STEAM_DIRECT` then the first found executable is used and called when the game is launched.
- **DataFolderName**
- Required for Unreal games relying on unreal-shimloader.
- Relevant for Mono (C#) Unity games, which use it for the `Preloader Fix` in the manager settings.
- **TsUrl**
- The Thunderstore API endpoint for the listing.
- **ExclusionsUrl**
Expand Down
16 changes: 8 additions & 8 deletions src/components/settings-components/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,6 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider';
'fa-exchange-alt',
() => this.emitInvoke('ToggleDownloadCache')
),
new SettingsRow(
'Debugging',
'Run preloader fix',
'Run this to fix most errors mentioning the preloader, or about duplicate assemblies.',
async () => `This will delete the ${this.activeGame.dataFolderName}/Managed folder, and verify the files through Steam`,
'fa-wrench',
() => this.emitInvoke('RunPreloaderFix')
),
new SettingsRow(
'Debugging',
'Set launch parameters',
Expand Down Expand Up @@ -388,6 +380,14 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider';
},
'fa-folder-open',
() => this.emitInvoke('ChangeSteamDirectory')
),
new SettingsRow(
'Debugging',
`Reset ${this.activeGame.displayName} installation`,
'Fix problems caused by corrupted files or files left over from manual modding attempts.',
async () => `This will delete all contents of the ${this.activeGame.steamFolderName} folder, and verify the files through Steam`,
'fa-wrench',
() => this.emitInvoke('ValidateSteamInstallation')
)
)
}
Expand Down
5 changes: 0 additions & 5 deletions src/model/enums/DependencyListDisplayType.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/Help.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<p>That's because you don't legally own the game. The manager only supports legal copies.</p>
<hr/>
<h2 class='title is-5'>A text window appears and closes immediately.</h2>
<p>Try running the preloader fix on the Settings screen.</p>
<p>Try running "Reset {{$store.state.activeGame.displayName}} installation" on the Settings screen.</p>
<p>If it persists, force exit Steam and start modded with Steam closed.</p>
</div>
<div ref="Mods not appearing" v-if="activeTab === 'Mods not appearing'">
Expand Down
44 changes: 23 additions & 21 deletions src/pages/Manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,29 @@
<button class="modal-close is-large" aria-label="close"
@click="showRor2IncorrectDirectoryModal = false"></button>
</div>
<ModalCard :is-active="fixingPreloader" @close-modal="closePreloaderFixModal" :can-close="true">
<ModalCard :is-active="isValidatingSteamInstallation" @close-modal="closeSteamInstallationValidationModal" :can-close="true">
<template v-slot:header>
<h2 class='modal-title'>Attempting to fix preloader issues</h2>
<h2 class='modal-title'>Clearing the {{activeGame.displayName}} installation directory</h2>
</template>
<template v-slot:body>
<div class='notification is-warning'>
<p>You will not not be able to launch the game until Steam has verified the integrity of the
game.
<p>
You will not not be able to launch the game until
Steam has verified the integrity of the game files.
</p>
</div>
<p>Steam will be started, and will attempt to verify the integrity of {{ activeGame.displayName }}.</p>
<p>
Steam will be started and will attempt to verify the
integrity of {{ activeGame.displayName }}.
</p>
<br/>
<p>Please check the Steam window for validation progress. If the window has not yet appeared, please be
patient.
<p>
Please check the Steam window for validation progress.
If the window has not yet appeared, please be patient.
</p>
</template>
<template v-slot:footer>
<button v-if="dependencyListDisplayType === 'view'" class="button is-info"
@click="closePreloaderFixModal()">
<button class="button is-info" @click="closeSteamInstallationValidationModal()">
I understand
</button>
</template>
Expand Down Expand Up @@ -121,7 +125,7 @@
</p>
</template>
<template v-slot:footer>
<button v-if="dependencyListDisplayType === 'view'" class="button is-info" @click="exportCode = ''">
<button class="button is-info" @click="exportCode = ''">
Done
</button>
</template>
Expand All @@ -144,13 +148,12 @@ import { Hero, Link, Modal, Progress } from '../components/all';
import ThunderstoreCombo from '../model/ThunderstoreCombo';
import ProfileModList from '../r2mm/mods/ProfileModList';
import PathResolver from '../r2mm/manager/PathResolver';
import PreloaderFixer from '../r2mm/manager/PreloaderFixer';
import { SteamInstallationValidator} from '../r2mm/manager/SteamInstallationValidator';

import { LogSeverity } from '../providers/ror2/logging/LoggerProvider';

import Profile from '../model/Profile';
import VersionNumber from '../model/VersionNumber';
import DependencyListDisplayType from '../model/enums/DependencyListDisplayType';
import R2Error from '../model/errors/R2Error';
import ManifestV2 from '../model/ManifestV2';
import ManagerSettings from '../r2mm/manager/ManagerSettings';
Expand Down Expand Up @@ -187,10 +190,9 @@ import ModalCard from '../components/ModalCard.vue';
}
})
export default class Manager extends Vue {
dependencyListDisplayType: string = DependencyListDisplayType.DISABLE;
portableUpdateAvailable: boolean = false;
updateTagName: string = '';
fixingPreloader: boolean = false;
isValidatingSteamInstallation: boolean = false;
exportCode: string = '';
showSteamIncorrectDirectoryModal: boolean = false;
showRor2IncorrectDirectoryModal: boolean = false;
Expand All @@ -217,16 +219,16 @@ import ModalCard from '../components/ModalCard.vue';
return this.$store.state.profile.modList;
}

closePreloaderFixModal() {
this.fixingPreloader = false;
closeSteamInstallationValidationModal() {
this.isValidatingSteamInstallation = false;
}

async fixPreloader() {
const res = await PreloaderFixer.fix(this.activeGame);
async validateSteamInstallation() {
const res = await SteamInstallationValidator.validateInstallation(this.activeGame);
if (res instanceof R2Error) {
this.$store.commit('error/handleError', res);
} else {
this.fixingPreloader = true;
this.isValidatingSteamInstallation = true;
}
}

Expand Down Expand Up @@ -546,8 +548,8 @@ import ModalCard from '../components/ModalCard.vue';
case "ToggleDownloadCache":
this.toggleIgnoreCache();
break;
case "RunPreloaderFix":
this.fixPreloader();
case "ValidateSteamInstallation":
this.validateSteamInstallation();
break;
case "SetLaunchParameters":
this.showLaunchParameters();
Expand Down
53 changes: 0 additions & 53 deletions src/r2mm/manager/PreloaderFixer.ts

This file was deleted.

64 changes: 64 additions & 0 deletions src/r2mm/manager/SteamInstallationValidator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import GameDirectoryResolverProvider from '../../providers/ror2/game/GameDirectoryResolverProvider';
import R2Error from '../../model/errors/R2Error';
import * as path from 'path';
import FsProvider from '../../providers/generic/file/FsProvider';
import ManagerInformation from '../../_managerinf/ManagerInformation';
import LinkProvider from '../../providers/components/LinkProvider';
import FileUtils from '../../utils/FileUtils';
import Game from '../../model/game/Game';
import { StorePlatform } from '../../model/game/StorePlatform';


export class SteamInstallationValidator {

public static async validateInstallation(game: Game): Promise<R2Error | void> {
if (![StorePlatform.STEAM, StorePlatform.STEAM_DIRECT].includes(game.activePlatform.storePlatform)) {
return new R2Error(
"This feature is not available on non-Steam platforms.",
"The feature deletes the contents of the game folder and verifies files. You can do the same manually."
);
}

const gameFolder = await GameDirectoryResolverProvider.instance.getDirectory(game);
if (gameFolder instanceof R2Error) {
return gameFolder;
}

// Sanity check we're about to delete something resembling a valid game folder.
let exeFound = false;
for (let exeName of game.exeName) {
if (await FsProvider.instance.exists(path.join(gameFolder, exeName))) {
exeFound = true;
break;
}
}

if (!exeFound) {
const message = game.exeName.length > 1 ?
`Could not find any of "${game.exeName.join('", "')}"` :
`Could not find "${game.exeName[0]}"`;

return new R2Error(
`${game.displayName} folder is invalid`,
message,
`Set the ${game.displayName} folder in the settings section`
);
}

try {
await FileUtils.emptyDirectory(gameFolder);
} catch(e) {
return R2Error.fromThrownValue(
e,
'Failed to empty the game folder',
`Try launching ${ManagerInformation.APP_NAME} as an administrator`
);
}

try {
LinkProvider.instance.openLink(`steam://validate/${game.activePlatform.storeIdentifier}`);
} catch(e) {
return R2Error.fromThrownValue(e, 'Failed to start steam://validate');
}
}
}