#!/bin/pwsh
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";

function Install-PortValhallaDrivers {
    param(
        [Context] $context
    )

    $driverPath = "$PSScriptRoot/../../../scripts/Windows/Drivers";
    $mbDriverPath = "$driverPath/ROG Zenith Extreme Alpha";
    $context.RegisterReboot();

    . "$mbDriverPath/MarvellEthernet/Install.ps1" $context;
    . "$mbDriverPath/IntelWiFi/Install.ps1" $context;
    . "$mbDriverPath/AMDChipsetX399/Install.ps1" $context;
    . "$driverPath/Predator Z301C/Install.ps1" $context;
    . "$mbDriverPath/IntelBluetooth/Install.ps1" $context;
    . "$driverPath/AMDChipsetX399/Install.ps1" $context;
    . "$driverPath/Tobii EyeX/Install.ps1" $context;

    choco install -y --ignore-checksums `
        amd-ryzen-master;

    choco install -y geforce-game-ready-driver icue wavelink;
    $context.RemoveDesktopIcon("*Wave Link*");
    $context.RemoveDesktopIcon("*GeForce*");

    Write-Information "Set AMD Ryzen power plan as default";
    $ryzenPlan = [regex]::Match(((powercfg /LIST) | Where-Object { $_ -like "*(AMD Ryzen*"; }), "Power Scheme GUID: ([0-9a-f-]+) ").Groups[1];
    powercfg /S $ryzenPlan;
    $context.PreventSleepMode();
}

function Install-PersonalDrivers {
    param(
        [Context] $context
    )

    $softwarePath = "$PSScriptRoot/../../../scripts/Windows/Software";
    . "$softwarePath/TobiiGhost/Install.ps1" $context;
    . "$softwarePath/TobiiGameHub/Install.ps1" $context;
}