-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1318 from xiaoxiao921/develop
Add Risk of Rain Returns support via ReturnOfModding
- Loading branch information
Showing
15 changed files
with
168 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { InstallArgs, PackageInstaller } from "./PackageInstaller"; | ||
import path from "path"; | ||
import FsProvider from "../providers/generic/file/FsProvider"; | ||
import { MODLOADER_PACKAGES } from "../r2mm/installing/profile_installers/ModLoaderVariantRecord"; | ||
import { PackageLoader } from "../model/installing/PackageLoader"; | ||
|
||
const basePackageFiles = ["manifest.json", "readme.md", "icon.png"]; | ||
|
||
export class ReturnOfModdingInstaller extends PackageInstaller { | ||
/** | ||
* Handles installation of BepInEx | ||
*/ | ||
async install(args: InstallArgs) { | ||
const { | ||
mod, | ||
packagePath, | ||
profile, | ||
} = args; | ||
|
||
const mapping = MODLOADER_PACKAGES.find((entry) => | ||
entry.packageName.toLowerCase() == mod.getName().toLowerCase() && | ||
entry.loaderType == PackageLoader.RETURN_OF_MODDING, | ||
); | ||
const mappingRoot = mapping ? mapping.rootFolder : ""; | ||
|
||
let root: string; | ||
if (mappingRoot.trim().length > 0) { | ||
root = path.join(packagePath, mappingRoot); | ||
} else { | ||
root = path.join(packagePath); | ||
} | ||
for (const item of (await FsProvider.instance.readdir(root))) { | ||
if (!basePackageFiles.includes(item.toLowerCase())) { | ||
if ((await FsProvider.instance.stat(path.join(root, item))).isFile()) { | ||
await FsProvider.instance.copyFile(path.join(root, item), path.join(profile.getPathOfProfile(), item)); | ||
} else { | ||
await FsProvider.instance.copyFolder(path.join(root, item), path.join(profile.getPathOfProfile(), item)); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/r2mm/installing/default_installation_rules/game_rules/InstallRules_ReturnOfModding.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { CoreRuleType } from '../../InstallationRules'; | ||
import * as path from 'path'; | ||
import { GAME_NAME } from '../../profile_installers/ModLoaderVariantRecord'; | ||
import { RuleSubtype } from "../../InstallationRules"; | ||
|
||
export function buildReturnOfModdingRules(gameName: GAME_NAME, extraRules?: RuleSubtype[]): CoreRuleType { | ||
return { | ||
gameName: gameName, | ||
rules: [ | ||
{ | ||
route: path.join("ReturnOfModding", "plugins"), | ||
isDefaultLocation: true, | ||
defaultFileExtensions: [".lua"], | ||
trackingMethod: "SUBDIR", | ||
subRoutes: [] | ||
}, | ||
{ | ||
route: path.join("ReturnOfModding", "plugins_data"), | ||
defaultFileExtensions: [], | ||
trackingMethod: "SUBDIR", | ||
subRoutes: [] | ||
}, | ||
{ | ||
route: path.join("ReturnOfModding", "config"), | ||
defaultFileExtensions: [], | ||
trackingMethod: "SUBDIR", | ||
subRoutes: [] | ||
}, | ||
...(extraRules ? extraRules : []), | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/r2mm/launching/instructions/instructions/loader/ReturnOfModdingGameInstructions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import GameInstructionGenerator from '../GameInstructionGenerator'; | ||
import { GameInstruction } from '../../GameInstructions'; | ||
import Game from '../../../../../model/game/Game'; | ||
import Profile from '../../../../../model/Profile'; | ||
import * as path from 'path'; | ||
|
||
export default class ReturnOfModdingGameInstructions extends GameInstructionGenerator { | ||
|
||
public async generate(game: Game, profile: Profile): Promise<GameInstruction> { | ||
return { | ||
moddedParameters: `--rom_modding_root_folder "${profile.getPathOfProfile()}"`, | ||
vanillaParameters: "--rom_enabled false" | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters