0 of 0

File information

Last updated

Original upload

Created by

SGurjar

Uploaded by

SGurjar

Virus scan

Safe to use

Tags for this mod

About this mod

Free up 8+ GB in Mafia: Definitive Edition with this script.

Permissions and credits
Changelogs
Credit: MCC on Steam guides.
(https://steamcommunity.com/sharedfiles/filedetails/?id=2238635990)

How It Works:

1. Extract the downloaded zip archive to a convenient location on your computer.
2. Navigate to your game's root installation directory.
 `Go to the Steam library, right-click on Mafia: Definitive Edition, go to "Manage", then click on "Browse local files"`
3. Copy the extracted file into your game's root directory.
4. Run the script (00 Reduce Game Size.bat).
5. Follow the on-screen instructions to select the language you wish to keep.
6. Enjoy!!

Source Code:
00 Reduce Game Size.bat
Spoiler:  
Show
@echo off
setlocal enabledelayedexpansion
title Mafia: Definitive Edition Reduce Game Size
echo.
echo Welcome %USERNAME%!
echo.
set "audioFolderPath=%~dp0\edit\audio\packages"
echo Validating language audio packs...
echo.
rem Check if the audio folder exists
if not exist "%audioFolderPath%" (
    echo.
    echo Error: The audio folder "%audioFolderPath%" does not exist.
    timeout /nobreak /t 3 >nul
    exit /b 1
)
REM Dynamic folder enumeration and numbering
set "count=0"
echo Language folders available:
for /d %%i in ("%audioFolderPath%\*") do (
    set /a count+=1
    set "folder[!count!]=%%~nxi"
    rem Calculate folder size using PowerShell
    for /f %%S in ('powershell "(Get-ChildItem '%%i' -Recurse | Measure-Object -Property Length -Sum).Sum"') do set "size=%%S"
    
    rem Convert size to MB and GB
    set /a sizeMB=size / 1024 / 1024
    set /a sizeGB=size / 1024 / 1024 / 1024
    if !sizeGB! gtr 0 (
        set "sizeFormatted=!sizeGB!.!sizeMB:~0,2! GB"
    ) else if !sizeMB! gtr 0 (
        set "sizeFormatted=!sizeMB!.!sizeKB:~0,2! MB"
    ) else (
        set "sizeFormatted=!size! bytes"
    )
    echo [!count!] - %%~nxi       Size - !sizeFormatted!
)
echo.
echo Validation complete.
echo.
REM Read user input and delete all language folders except the selected one
:inputLoop
set /p selectedNumber="Enter the number corresponding to the desired language folder: "
if not defined folder[%selectedNumber%] (
    echo Invalid input! Please enter a valid number.
    goto inputLoop
)
echo Deleting language folders...
for /d %%a in ("%audioFolderPath%\*") do (
    if /i "%%~nxa" neq "!folder[%selectedNumber%]!" (
        if exist "%%a\*" (
            echo Deleting folder and its contents: %%~nxa
            rd /s /q "%%a" >nul 2>&1
            if errorlevel 1 (
                echo Failed to delete folder: %%~nxa
            ) else (
                echo Deleted folder and its contents: %%~nxa
            )
        ) else (
            echo Folder is empty, skipping deletion: %%~nxa
        )
    ) else (
        echo Preserving selected language folder: %%~nxa
    )
)
echo.
echo Selected language folder "!folder[%selectedNumber%]!" is preserved and others deleted.
echo.
pause
endlocal