Fichiers
vercora/tools/launch_interactive.ps1
T
Théo GastineletClaude Opus 5.5 eec89677c2 Publication : chemins relatifs dans tools, journaux de build hors du depot, mention IGN
- tools/*.ps1 : plus de chemin absolu vers le profil Windows
- build_log.txt retire du suivi, *.log et build-*/ ignores
- README : section Donnees et licence (IGN - Programme LiDAR HD, Etalab 2.0 ; code tous droits reserves)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 16:17:47 +01:00

98 lignes
2.8 KiB
PowerShell

param(
[string]$GameArgs = "assets\terrain\vercora_zone_1m.vchm"
)
$code = @"
using System;
using System.Runtime.InteropServices;
public class DesktopLauncher {
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STARTUPINFO {
public int cb;
public string lpReserved;
public string lpDesktop;
public string lpTitle;
public int dwX;
public int dwY;
public int dwXSize;
public int dwYSize;
public int dwXCountChars;
public int dwYCountChars;
public int dwFillAttribute;
public int dwFlags;
public short wShowWindow;
public short cbReserved2;
public IntPtr lpReserved2;
public IntPtr hStdInput;
public IntPtr hStdOutput;
public IntPtr hStdError;
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION {
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool CreateProcess(
string lpApplicationName,
string lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
string lpCurrentDirectory,
ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation
);
public const uint CREATE_NEW_CONSOLE = 0x00000010;
public static int Launch(string appPath, string cmdLine, string workDir, string desktop) {
STARTUPINFO si = new STARTUPINFO();
si.cb = Marshal.SizeOf(si);
si.lpDesktop = desktop;
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
bool ok = CreateProcess(
appPath,
cmdLine,
IntPtr.Zero,
IntPtr.Zero,
false,
CREATE_NEW_CONSOLE,
IntPtr.Zero,
workDir,
ref si,
out pi
);
if (!ok) {
int err = Marshal.GetLastWin32Error();
Console.WriteLine("CreateProcess failed with error: " + err);
return -1;
}
Console.WriteLine("Process launched successfully! PID: " + pi.dwProcessId);
return pi.dwProcessId;
}
}
"@
Add-Type -TypeDefinition $code
$root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$exe = Join-Path $root "build\vercora.exe"
$cmd = "`"$exe`" $GameArgs"
Write-Host "Lancement avec console sur le bureau interactif utilisateur (WinSta0\default)..."
$pidResult = [DesktopLauncher]::Launch($exe, $cmd, $root, "WinSta0\default")
if ($pidResult -gt 0) {
Write-Host "Vercora est demarre sur l'ecran utilisateur avec le PID $pidResult."
}