Compare commits

...

2 Commits
2.0.1 ... 2.0.3

Author SHA1 Message Date
zznty
ba75b1583a do not copy dlls in service mode as it can mess up with runtimes 2023-04-22 18:30:02 +07:00
zznty
45068ea932 remove requirement o sta thread in no gui scenarios 2023-04-22 02:51:29 +07:00
3 changed files with 19 additions and 18 deletions

View File

@@ -102,25 +102,26 @@ namespace Torch.Server
} }
#endif #endif
var gameThread = new Thread(() => var uiThread = new Thread(() =>
{ {
_server.Init(); var ui = new TorchUI(_server);
if (Config.Autostart || Config.TempAutostart) SynchronizationContext.SetSynchronizationContext(
{ new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
Config.TempAutostart = false;
_server.Start(); ui.ShowDialog();
}
}); });
gameThread.Start(); uiThread.SetApartmentState(ApartmentState.STA);
uiThread.Start();
var ui = new TorchUI(_server); _server.Init();
SynchronizationContext.SetSynchronizationContext( if (Config.Autostart || Config.TempAutostart)
new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)); {
Config.TempAutostart = false;
ui.ShowDialog(); _server.Start();
}
} }
} }

View File

@@ -12,7 +12,7 @@ namespace Torch.Server
{ {
internal static class Program internal static class Program
{ {
[STAThread] [MTAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
var configurationBuilder = new ConfigurationBuilder() var configurationBuilder = new ConfigurationBuilder()

View File

@@ -47,7 +47,7 @@ namespace Torch.Utils
private static void CopyNative() private static void CopyNative()
{ {
if (ApplicationContext.Current.GameFilesDirectory.Attributes.HasFlag(FileAttributes.ReadOnly)) if (ApplicationContext.Current.IsService || ApplicationContext.Current.GameFilesDirectory.Attributes.HasFlag(FileAttributes.ReadOnly))
{ {
Log.Warn("Torch directory is readonly. You should copy steam_api64.dll, Havok.dll from bin manually"); Log.Warn("Torch directory is readonly. You should copy steam_api64.dll, Havok.dll from bin manually");
return; return;