# Platform Specifics

# 7. Platform Specifics

Some platforms require some extra steps to run properly.

## 7.1 Android

To deploy on Android, make sure FMODStudio is in your game's directory, not in the Engine plugins directory. When FMODStudio is in your game's plugin directory, the engine will rebuild the plugin for Android and deploy all the files properly.

### 7.1.1 Deployment of Android plugins

FMOD supports DSP plugins, which will be stand-alone .so files that will need to be packaged into the build. Add the .so file into the `FMODStudio/Binaries/Android/{Architecture}` directory. Unreal will also need an APL file so it knows to package the .so file. To do this, you will need to write an APL file and drop it into the `FMODStudio/Binaries/Android` directory. The FMODStudio.build.cs file looks for any file ending with "_APL.xml" and will pass that along to the unreal build tool for packaging.

The APL is a custom xml file format which is documented in the engine file AndroidPluginLanguage.cs. Here is a sample APL file for libovrfmod.so:

    <?xml version="1.0" encoding="utf-8"?>
    <!--Plugin additions-->
    <root xmlns:android="http://schemas.android.com/apk/res/android">
        <!-- init section is always evaluated once per architecture -->
        <init>
            <log text="ovrfmod APL init"/>
        </init>

        <!-- optional files or directories to copy to Intermediate/Android/APK -->
        <resourceCopies>
            <log text="ovrfmod APL copying files for $S(Architecture)/"/>
            <copyFile src="$S(PluginDir)/$S(Architecture)/libovrfmod.so"
                        dst="$S(BuildDir)/libs/$S(Architecture)/libovrfmod.so" />
        </resourceCopies>

        <!-- optional libraries to load in GameActivity.java before libUE4.so -->
        <soLoadLibrary>
            <log text="ovrfmod APL adding loadLibrary references"/>
            <loadLibrary name="ovrfmod" failmsg="ovrfmod not loaded and required!" />
        </soLoadLibrary>
    </root>

You only need to write this if you want to load a DSP plugin on Android.

### 7.1.2 Packaging

Banks for Android are expected to be located in the `Mobile` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the Android banks add these lines to `Platforms\Android\Config\AndroidGame.ini`:

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Mobile")

4.24
The location of `AndroidGame.ini` is `Config\Android\AndroidGame.ini`

### 7.1.3 Android-based VR devices

Any platform specific requirements for Android also apply to Android-based VR devices, such as Oculus Quest.

## 7.2 Game Core

### 7.2.1 Xbox Series X|S

#### Enabling Live Update

To enable Live Update the Unreal XSX project settings must be modified to allow FMOD to open the Live Update port from the running game. Access the settings by opening the Project Settings editor from the Edit menu, then navigate to Xbox Series X|S platform settings. Under the Development category, add the following entry to the Debug Network Ports setting:

#### Packaging

Banks for the Xbox Series X|S are expected to be located in the `Scarlett` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the Xbox Series X|S specific banks add the following lines to the appropriate Unreal config file from the table below e.g. `Platforms\XSX\Config\XSXGame.ini`:

Unreal version | FMOD Studio bank folder | Unreal platform | Unreal config file
--- | --- | --- | ---
4.25 | Scarlett | MPX | Platforms\MPX\Config\MPXGame.ini
4.25+ onwards | Scarlett | XSX | Platforms\XSX\Config\XSXGame.ini

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Scarlett")

#### Disabling the Unreal Audio Device

FMOD will not work with inbuilt Unreal audio on Xbox Series X|S. You will need to disable the Unreal Audio Device by adding/editing the appropriate Unreal engine config file from the table below e.g. `Config\XSX\XSXEngine.ini` with the following section:

Unreal version | Unreal engine config file
--- | ---
4.25 | Config\MPX\MPXEngine.ini
4.25+ onwards | Config\XSX\XSXEngine.ini

    [Audio]
    AudioDeviceModuleName=
    AudioMixerModuleName=

### 7.2.2 Xbox One

#### Enabling Live Update

To enable Live Update the Unreal Xbox One GDK project settings must be modified to allow FMOD to open the Live Update port from the running game. Access the settings by opening the Project Settings editor from the Edit menu, then navigate to Xbox One GDK platform settings. Under the Development category, add the following entry to the Debug Network Ports setting:

#### Packaging

Banks for the Xbox One are expected to be located in the `XboxOne` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the Xbox One specific banks add the following lines to the appropriate Unreal config file from the table below e.g. `Platforms\XB1\Config\XB1Game.ini`, replacing `MyGame` with your project's name:

Unreal version | FMOD Studio bank folder | Unreal platform | Unreal config file
--- | --- | --- | ---
4.25 | XboxOne | XboxOneAnvil | Platforms\XboxOneAnvil\Config\XboxOneAnvilGame.ini
4.25+, 4.26, 4.27 | XboxOne | XboxOneGDK | Platforms\XboxOneGDK\Config\XboxOneGDKGame.ini
5.0 onwards | XboxOne | XB1 | Platforms\XB1\Config\XB1Game.ini

##### UE4.X & UE5.0

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/XboxOne")

    [Staging]
    +WhitelistDirectories=MyGame/Content/FMOD/XboxOne

##### UE5.1 onwards

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/XboxOne")

    [Staging]
    +AllowedDirectories=MyGame/Content/FMOD/XboxOne

#### Disabling the Unreal Audio Device

FMOD will not work with inbuilt Unreal audio on Xbox One. You will need to disable the Unreal Audio Device by adding/editing the appropriate Unreal engine config file from the table below e.g. `Config\XboxOneGDK\XboxOneGDKEngine.ini` with the following section:

Unreal version | Unreal engine config file
--- | ---
4.25 | Config\XboxOneAnvil\XboxOneAnvilEngine.ini
4.25+, 4.26, 4.27 | Config\XboxOneGDK\XboxOneGDKEngine.ini
5.0 onwards | Config\XB1\XB1Engine.ini

    [Audio]
    AudioDeviceModuleName=
    AudioMixerModuleName=

### 7.2.3 Desktop

#### Packaging

Banks for Game Core Desktop are expected to be located in the `Desktop` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

The Unreal Build Tool will block packaging of the `Desktop` directory unless it is explicitly whitelisted. To whitelist the directory add the following lines to the appropriate Unreal config file from the table below e.g. `Platforms\WinGDK\Config\WinGDKGame.ini`, replacing `MyGame` with your project's name:

Unreal version | FMOD Studio bank folder | Unreal platform | Unreal config file
--- | --- | --- | ---
4.25 | Desktop | WinAnvil | Platforms\WinAnvil\Config\WinAnvilGame.ini
4.25+ onwards | Desktop | WinGDK | Platforms\WinGDK\Config\WinGDKGame.ini

##### UE4.X & UE5.0

    [Staging]
    +WhitelistDirectories=MyGame/Content/FMOD/Desktop

##### UE5.1 onwards

    [Staging]
    +AllowedDirectories=MyGame/Content/FMOD/Desktop

## 7.3 iOS

### 7.3.1 Packaging

Banks for iOS are expected to be located in the `Mobile` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the iOS banks from the `Mobile` sub-directory, add these lines to `Platforms\IOS\Config\IOSGame.ini`:

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Mobile")

If you do insist on modifying the integration source code and using the `Desktop` sub-directory instead of the `Mobile` sub-directory, add these lines to `Platforms\IOS\Config\IOSGame.ini` instead, replacing `mygame` with your project's name:

#### UE4.X & UE5.0

    [Staging]
    +WhitelistDirectories=cookeddata/mygame/content/fmod/desktop

#### UE5.1 onwards

    [Staging]
    +AllowedDirectories=cookeddata/mygame/content/fmod/desktop

### 7.3.2 Disabling the Unreal Audio Device

FMOD will not work with inbuilt Unreal audio on iOS. You will need to disable the Unreal Audio Device by creating a new file `Config\IOS\IOSEngine.ini` with this section:

    [Audio]
    AudioDeviceModuleName=
    AudioMixerModuleName=

4.24
The location of `IOSGame.ini` is `Config\IOS\IOSGame.ini`

### 7.3.3 Building for iOS on Windows

Using remote build to build for iOS on Windows using the FMOD Studio plugin requires some additional files to be copied to the remote Mac. To tell Unreal to copy the additional files add a file named `RsyncProject.txt` to the directory `<ue_project_root>/Build/Rsync` (you may need to create this directory). The `RsyncProject.txt` file needs to contain this line:

    + /Plugins/FMODStudio/Binaries/IOS/**

## 7.4 tvOS

To build for tvOS, make sure FMODStudio is in your game's directory and not in the Engine plugins directory.

### 7.4.1 Packaging

Banks for tvOS are expected to be located in the `Mobile` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the correct banks add these lines to `Platforms\TVOS\Config\TVOSGame.ini`:

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Mobile")

4.24
The location of `TVOSGame.ini` is `Config\TVOS\TVOSGame.ini`

### 7.4.2 Disabling the Unreal Audio Device

FMOD will not work with inbuilt Unreal audio on tvOS. You will need to disable the Unreal Audio Device by creating a new file `Config\TVOS\TVOSEngine.ini` with this section:

    [Audio]
    AudioDeviceModuleName=
    AudioMixerModuleName=

## 7.5 Linux

To deploy on linux, you will need to rebuild the engine from source via github. For compiling linux from windows, see this page for instructions how to get up and running with Unreal. Then, add in both the fmodstudio linux .zip and windows .zip on top of each other into the engine plugins directory.

The last thing you will need to do is to get the FMOD .so libraries into a directory that the executable can read them. The easiest way is to copy them from

    <DeployedDir>\Engine\Plugins\FMODStudio\Binaries\Linux\x86_64

to

    <DeployedDir>\<GameName>\Binaries\Linux

To see what directories the .so files can be located, look at LinuxToolChain.cs. Currently there are only a set of hard coded directories that are supported.

## 7.6 macOS

To make a packaged build runnable on your local machine, execute the following command from the command shell :

    install_name_tool -add_rpath @executable_path/../Unreal/YourGame/Plugins/FMODStudio/Libs/Mac /Path/To/YourGame.app/Contents/MacOS/YourGame

## 7.7 PS4

### 7.7.1 Packaging

Banks for the PS4 are expected to be located in the `PS4` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the PS4 specific banks add these lines to `Platforms\PS4\Config\PS4Game.ini`:

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/PS4")

## 7.8 PS5

### 7.8.1 Packaging

Banks for the PS5 are expected to be located in the `PS5` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the PS5 specific banks add these lines to `Platforms\PS5\Config\PS5Game.ini`:

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/PS5")

### 7.8.2 Using Controller Vibration

To enable vibration for the PS5 controller add these lines to `Config\PS5\PS5Engine.ini`:

#### Unreal Engine 4

    [/Script/Engine.InputSettings]
    AdvancedVibrationMode=true

#### Unreal Engine 5

    [SonyController]
    bAdvancedVibrationMode=true

### 7.8.3 Disabling the Unreal Audio Device

FMOD will not work with built-in Unreal audio on PS5 without some engine modification. In most cases you should disable the Unreal Audio Device by adding/editing `Config\PS5\PS5Engine.ini` with the following section:

    [Audio]
    AudioDeviceModuleName=
    AudioMixerModuleName=

### 7.8.4 Enabling built-in Unreal audio alongside FMOD

See this forum post for details.

## 7.9 Switch

### 7.9.1 Packaging

Banks for the Switch are expected to be located in the `Switch` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the Switch specific banks add these lines to `Platforms\Switch\Config\SwitchGame.ini`:

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Switch")

## 7.10 Xbox One

### 7.10.1 Enabling XboxOne Microphone Input

To enable FMOD Studio the use of any microphone input, including Kinect, on the Xbox One. The Engine ini file specific for the platform, located in '/Config/XboxOne/XboxOneEngine.ini', needs to have the following lines added:

    [AppxManifest]
    Package.Capabilities.mx:Capability[0].Name=kinectAudio
    Package.Capabilities.mx:Capability[1].Name=kinectGamechat

### 7.10.2 Enabling Live Update

To enable Live Update the Unreal Xbox One project settings must be modified to allow FMOD to open the Live Update port from the running game. Access the settings by opening the Project Settings editor from the Edit menu, then navigate to Xbox One platform settings. Under the Network category, add the following entries to the Secure Socket Descriptions and Secure Socket Associations settings:

### 7.10.3 Packaging

Banks for the Xbox One are expected to be located in the `XboxOne` sub-directory of the Studio built banks output directory. This sub-directory name is hardcoded in the integration so if you want to use a different location you would need to modify the integration source code.

To package the Xbox One specific banks add these lines to `Platforms\XboxOne\Config\XboxOneGame.ini`:

    [/Script/UnrealEd.ProjectPackagingSettings]
    -DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/Desktop")
    +DirectoriesToAlwaysStageAsNonUFS=(Path="FMOD/XboxOne")

### 7.10.4 Disabling the Unreal Audio Device

FMOD will not work with inbuilt Unreal audio on Xbox One. You will need to disable the Unreal Audio Device by creating a new file `Config\XboxOne\XboxOneEngine.ini` with this section:

    [Audio]
    AudioDeviceModuleName=
    AudioMixerModuleName=

### 7.10.5 Copying dll's to build

This has been solved in 2.01.07, you only need to follow these steps if you are using an older version.

Add the following to GetFilesToDeployOrStage in XboxOnePlatform.Automation.cs, before the end of the function:

    // FMOD code start
    DirectoryReference FMODDLLPath = null;
    if (Directory.Exists(Path.Combine(SC.ProjectRoot.ToString(), "Plugins/FMODStudio")))
    {
        FMODDLLPath = DirectoryReference.Combine(SC.ProjectRoot, "Plugins/FMODStudio/Binaries/XBoxOne/");
    }
    else if (Directory.Exists(Path.Combine(SC.LocalRoot.ToString(), "Engine/Plugins/FMODStudio")))
    {
        FMODDLLPath = DirectoryReference.Combine(SC.LocalRoot, "Engine/Plugins/FMODStudio/Binaries/XBoxOne/");
    }
    else
    {
        LogError("Failed to find FMODStudio plugin in game or engine directory");
    }
    if (FMODDLLPath != null)
    {
        Log.TraceInformation("Copying FMOD dlls to loose directory: " + RelativeBinPath);
        StagedDirectoryReference RelativeBinPathRef = new StagedDirectoryReference(RelativeBinPath);
        StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmod.dll"), RelativeBinPathRef, SC);
        StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmodL.dll"), RelativeBinPathRef, SC);
        StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmodstudio.dll"), RelativeBinPathRef, SC);
        StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmodstudioL.dll"), RelativeBinPathRef, SC);
    }
    // FMOD code end

Add the following to PrepTargetForDeployment in XboxOneDeploy.cs, in the same scope as 'DestDir':

    // FMOD code start
    string FMODDLLPath = null;
    if (Directory.Exists(Path.Combine(ProjectDirectory.FullName, "Plugins/FMODStudio")))
    {
        FMODDLLPath = Path.Combine(ProjectDirectory.FullName, "Plugins/FMODStudio/Binaries/XBoxOne/");
    }
    else if (Directory.Exists(Path.Combine(RelativeEnginePath, "Plugins/FMODStudio")))
    {
        FMODDLLPath = Path.Combine(RelativeEnginePath, "Plugins/FMODStudio/Binaries/XBoxOne/");
    }
    else
    {
        Log.TraceWarning("Failed to find FMODStudio plugin in game or engine directory");
    }
    if (FMODDLLPath != null)
    {
        Log.TraceInformation("...copying the FMOD dlls...");
        string FMODDLLName = "fmod.dll";
        Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
        CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
        FMODDLLName = "fmodL.dll";
        Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
        CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
        FMODDLLName = "fmodstudio.dll";
        Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
        CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
        FMODDLLName = "fmodstudioL.dll";
        Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
        CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
    }
    // FMOD code end

### 7.10.6 Submission Validator

The XboxOne validaition tool uses `_NT_SYMBOL_PATH` environment variable to know where to look for PDBs.
In 'XboxOnePlatform.Automation.cs' is where Unreal overrides _NT_SYMBOL_PATH:

    EnvironmentVariables.Add("_NT_SYMBOL_PATH", Params.GetProjectBinariesPathForPlatform(UnrealTargetPlatform.XboxOne).ToString());

We want to change this to add to it:

    string SymbolPath = Params.GetProjectBinariesPathForPlatform(UnrealTargetPlatform.XboxOne).ToString() + ";" + CommandUtils.GetEnvVar("_NT_SYMBOL_PATH");
    EnvironmentVariables.Add("_NT_SYMBOL_PATH", SymbolPath);

Now it keeps the original value as well as adding its own path.

Then, on your build machine you need to set the value of `_NT_SYMBOL_PATH` to where the FMOD PDBs will be.
Eg. "[MyGame]\Plugins\FMODStudio\Binaries\XBoxOne" or "[MyGame]\Platforms\XboxOne\Plugins\FMODStudio\Binaries".