Date: Saturday, September 1, 2018 @ 22:33:26 Author: bgyorgy Revision: 375994
archrelease: copy trunk to community-any Added: openbve/repos/community-any/PKGBUILD (from rev 375993, openbve/trunk/PKGBUILD) openbve/repos/community-any/force-close.patch (from rev 375993, openbve/trunk/force-close.patch) openbve/repos/community-any/openbve.desktop (from rev 375993, openbve/trunk/openbve.desktop) openbve/repos/community-any/openbve.sh (from rev 375993, openbve/trunk/openbve.sh) Deleted: openbve/repos/community-any/PKGBUILD openbve/repos/community-any/force-close.patch openbve/repos/community-any/openbve.desktop openbve/repos/community-any/openbve.sh -------------------+ PKGBUILD | 114 +++++----- force-close.patch | 586 ++++++++++++++++++++++++++-------------------------- openbve.desktop | 18 - openbve.sh | 4 4 files changed, 361 insertions(+), 361 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2018-09-01 22:33:14 UTC (rev 375993) +++ PKGBUILD 2018-09-01 22:33:26 UTC (rev 375994) @@ -1,57 +0,0 @@ -# Maintainer: Balló György <ballogyor+arch at gmail dot com> - -pkgname=openbve -_pkgname=OpenBVE -pkgver=1.5.3.7 -pkgrel=1 -pkgdesc="Free-as-in-freedom train simulator placed in the public domain" -arch=('any') -url="http://openbve-project.net/" -license=('MIT' 'custom:public domain') -depends=('libxi' 'mono' 'openal') -source=($_pkgname-$pkgver.tar.gz::https://github.com/leezer3/$_pkgname/archive/$pkgver.tar.gz - $pkgname.sh - $pkgname.desktop - force-close.patch) -sha256sums=('cd8e038809a8b43762e5ebdf90d3fc0280ef9f42ef89296f7c8a3b894cb6f5e1' - 'cf0f2a28e65248f742d6bb80f3101e36f24097e699c4e5acdf3fd4dbb965d3c3' - '8190945fa834ecdcf8a3f271264e5be2e288933ecde943060346e16537611c0f' - 'b24f828f63fd0017afc49b266ea198725fd6fe3e68d1c86d40257047b6f7edfa') - -prepare() { - cd $_pkgname-$pkgver - # Attempt to force close the window - # https://github.com/leezer3/OpenBVE/pull/214 - patch -Np1 -i ../force-close.patch -} - -build() { - cd $_pkgname-$pkgver - xbuild /p:Configuration=Release OpenBVE.sln -} - -package() { - cd $_pkgname-$pkgver - - # Binaries - install -dm755 "$pkgdir/usr/lib/$pkgname/" - cp -r bin_release/* "$pkgdir/usr/lib/$pkgname/" - - # Data - install -dm755 "$pkgdir/usr/share/games/$pkgname/" - mv "$pkgdir/usr/lib/$pkgname/Data" "$pkgdir/usr/share/games/$pkgname/" - ln -s ../../share/games/$pkgname/Data "$pkgdir/usr/lib/$pkgname/Data" - - # Executable - install -Dm755 ../$pkgname.sh "$pkgdir/usr/bin/$pkgname" - - # Desktop file and icon - install -Dm644 ../$pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop - mkdir -p "$pkgdir/usr/share/pixmaps" - ln -s ../games/$pkgname/Data/Menu/logo.png "$pkgdir/usr/share/pixmaps/$pkgname.png" - - # License - install -dm755 "$pkgdir/usr/share/licenses/$pkgname/" - install -m644 licenses/* Readme.md \ - "$pkgdir/usr/share/licenses/$pkgname/" -} Copied: openbve/repos/community-any/PKGBUILD (from rev 375993, openbve/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2018-09-01 22:33:26 UTC (rev 375994) @@ -0,0 +1,57 @@ +# Maintainer: Balló György <ballogyor+arch at gmail dot com> + +pkgname=openbve +_pkgname=OpenBVE +pkgver=1.5.3.8 +pkgrel=1 +pkgdesc="Free-as-in-freedom train simulator placed in the public domain" +arch=('any') +url="http://openbve-project.net/" +license=('MIT' 'custom:public domain') +depends=('libxi' 'mono' 'openal') +source=($_pkgname-$pkgver.tar.gz::https://github.com/leezer3/$_pkgname/archive/$pkgver.tar.gz + $pkgname.sh + $pkgname.desktop + force-close.patch) +sha256sums=('b7eaf59d26c2400c81fd9568fab141a23a0d536844164c9aa42d52ffd7a03338' + 'cf0f2a28e65248f742d6bb80f3101e36f24097e699c4e5acdf3fd4dbb965d3c3' + '8190945fa834ecdcf8a3f271264e5be2e288933ecde943060346e16537611c0f' + 'b24f828f63fd0017afc49b266ea198725fd6fe3e68d1c86d40257047b6f7edfa') + +prepare() { + cd $_pkgname-$pkgver + # Attempt to force close the window + # https://github.com/leezer3/OpenBVE/pull/214 + patch -Np1 -i ../force-close.patch +} + +build() { + cd $_pkgname-$pkgver + xbuild /p:Configuration=Release OpenBVE.sln +} + +package() { + cd $_pkgname-$pkgver + + # Binaries + install -dm755 "$pkgdir/usr/lib/$pkgname/" + cp -r bin_release/* "$pkgdir/usr/lib/$pkgname/" + + # Data + install -dm755 "$pkgdir/usr/share/games/$pkgname/" + mv "$pkgdir/usr/lib/$pkgname/Data" "$pkgdir/usr/share/games/$pkgname/" + ln -s ../../share/games/$pkgname/Data "$pkgdir/usr/lib/$pkgname/Data" + + # Executable + install -Dm755 ../$pkgname.sh "$pkgdir/usr/bin/$pkgname" + + # Desktop file and icon + install -Dm644 ../$pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop + mkdir -p "$pkgdir/usr/share/pixmaps" + ln -s ../games/$pkgname/Data/Menu/logo.png "$pkgdir/usr/share/pixmaps/$pkgname.png" + + # License + install -dm755 "$pkgdir/usr/share/licenses/$pkgname/" + install -m644 licenses/* Readme.md \ + "$pkgdir/usr/share/licenses/$pkgname/" +} Deleted: force-close.patch =================================================================== --- force-close.patch 2018-09-01 22:33:14 UTC (rev 375993) +++ force-close.patch 2018-09-01 22:33:26 UTC (rev 375994) @@ -1,293 +0,0 @@ -From bf1c0db61bc11a6fc64db6529941d80a0eeff449 Mon Sep 17 00:00:00 2001 -From: Christopher Lees <leez...@gmail.com> -Date: Fri, 12 Jan 2018 14:06:38 +0000 -Subject: [PATCH 1/4] Change: Attempt to force close the window under Mono - ---- - source/OpenBVE/System/GameWindow.cs | 8 ++++++++ - source/OpenBVE/UserInterface/formMain.cs | 14 +++++++++++++- - 2 files changed, 21 insertions(+), 1 deletion(-) - -diff --git a/source/OpenBVE/System/GameWindow.cs b/source/OpenBVE/System/GameWindow.cs -index 6c71204a..7e963408 100644 ---- a/source/OpenBVE/System/GameWindow.cs -+++ b/source/OpenBVE/System/GameWindow.cs -@@ -66,6 +66,10 @@ protected override void OnRenderFrame(FrameEventArgs e) - if (MainLoop.Quit) - { - Close(); -+ if (Program.CurrentlyRunningOnMono) -+ { -+ Environment.Exit(0); -+ } - } - //If the menu state has not changed, don't update the rendered simulation - return; -@@ -133,6 +137,10 @@ protected override void OnRenderFrame(FrameEventArgs e) - if (MainLoop.Quit) - { - Program.currentGameWindow.Exit(); -+ if (Program.CurrentlyRunningOnMono) -+ { -+ Environment.Exit(0); -+ } - } - Renderer.UpdateLighting(); - Renderer.RenderScene(TimeElapsed); -diff --git a/source/OpenBVE/UserInterface/formMain.cs b/source/OpenBVE/UserInterface/formMain.cs -index 6ab37ff0..97592106 100644 ---- a/source/OpenBVE/UserInterface/formMain.cs -+++ b/source/OpenBVE/UserInterface/formMain.cs -@@ -1,5 +1,6 @@ - using System; - using System.ComponentModel; -+using System.Diagnostics; - using System.Drawing; - using System.Net; - using System.Windows.Forms; -@@ -1353,8 +1354,19 @@ private void buttonClose_Click(object sender, EventArgs e) - //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes - //This fixes the main form failing to close on Linux - Application.DoEvents(); -+ if (Program.CurrentlyRunningOnMono) -+ { -+ //On some systems, the process *still* seems to hang around, so explicity issue the Environment.Exit() call -+ //https://github.com/leezer3/OpenBVE/issues/213 -+ Environment.Exit(0); -+ } - } - -+ protected override void OnFormClosing(FormClosingEventArgs e) -+ { -+ //Call the explicit closing method -+ buttonClose_Click(this, e); -+ } - - - // ====== -From 0c37c8c2cbb59b765aff0fa6f0ef3e198fceda87 Mon Sep 17 00:00:00 2001 -From: Christopher Lees <leez...@gmail.com> -Date: Sat, 13 Jan 2018 12:20:01 +0000 -Subject: [PATCH 2/4] Change: Fiddle some more with window closing... - ---- - source/OpenBVE/Game/Menu.cs | 4 ++-- - source/OpenBVE/System/GameWindow.cs | 8 ++++---- - source/OpenBVE/System/MainLoop.cs | 11 ++++++++--- - source/OpenBVE/UserInterface/formMain.Start.cs | 6 ++++-- - source/OpenBVE/UserInterface/formMain.cs | 18 +++++++++++++----- - 5 files changed, 31 insertions(+), 16 deletions(-) - -diff --git a/source/OpenBVE/Game/Menu.cs b/source/OpenBVE/Game/Menu.cs -index 0108a6da..f27d4439 100644 ---- a/source/OpenBVE/Game/Menu.cs -+++ b/source/OpenBVE/Game/Menu.cs -@@ -667,7 +667,7 @@ internal void ProcessCommand(Interface.Command cmd, double timeElapsed) - Reset(); - Program.RestartArguments = - Interface.CurrentOptions.GameMode == Interface.GameMode.Arcade ? "/review" : ""; -- MainLoop.Quit = true; -+ MainLoop.Quit = MainLoop.QuitMode.ExitToMenu; - break; - case MenuTag.Control: // CONTROL CUSTOMIZATION - PushMenu(MenuType.Control, ((MenuCommand)menu.Items[menu.Selection]).Data); -@@ -676,7 +676,7 @@ internal void ProcessCommand(Interface.Command cmd, double timeElapsed) - break; - case MenuTag.Quit: // QUIT PROGRAMME - Reset(); -- MainLoop.Quit = true; -+ MainLoop.Quit = MainLoop.QuitMode.QuitProgram; - break; - } - } -diff --git a/source/OpenBVE/System/GameWindow.cs b/source/OpenBVE/System/GameWindow.cs -index 7e963408..1235817a 100644 ---- a/source/OpenBVE/System/GameWindow.cs -+++ b/source/OpenBVE/System/GameWindow.cs -@@ -63,10 +63,10 @@ protected override void OnRenderFrame(FrameEventArgs e) - //Renderer.UpdateLighting(); - Renderer.RenderScene(TimeElapsed); - Program.currentGameWindow.SwapBuffers(); -- if (MainLoop.Quit) -+ if (MainLoop.Quit != MainLoop.QuitMode.ContinueGame) - { - Close(); -- if (Program.CurrentlyRunningOnMono) -+ if (Program.CurrentlyRunningOnMono && MainLoop.Quit == MainLoop.QuitMode.QuitProgram) - { - Environment.Exit(0); - } -@@ -134,10 +134,10 @@ protected override void OnRenderFrame(FrameEventArgs e) - } - - World.CameraAlignmentDirection = new World.CameraAlignment(); -- if (MainLoop.Quit) -+ if (MainLoop.Quit != MainLoop.QuitMode.ContinueGame) - { - Program.currentGameWindow.Exit(); -- if (Program.CurrentlyRunningOnMono) -+ if (Program.CurrentlyRunningOnMono && MainLoop.Quit == MainLoop.QuitMode.QuitProgram) - { - Environment.Exit(0); - } -diff --git a/source/OpenBVE/System/MainLoop.cs b/source/OpenBVE/System/MainLoop.cs -index 3633c4ed..16c6c435 100644 ---- a/source/OpenBVE/System/MainLoop.cs -+++ b/source/OpenBVE/System/MainLoop.cs -@@ -10,10 +10,15 @@ namespace OpenBve - { - internal static partial class MainLoop - { -- -+ internal enum QuitMode -+ { -+ ContinueGame = 0, -+ QuitProgram = 1, -+ ExitToMenu = 2 -+ } - // declarations - internal static bool LimitFramerate = false; -- internal static bool Quit = false; -+ internal static QuitMode Quit = QuitMode.ContinueGame; - /// <summary>BlockKeyRepeat should be set to 'true' whilst processing a KeyUp or KeyDown event.</summary> - internal static bool BlockKeyRepeat; - /// <summary>The current simulation time-factor</summary> -@@ -87,7 +92,7 @@ internal static void StartLoopEx(formMain.MainDialogResult result) - - private static void OpenTKQuit(object sender, CancelEventArgs e) - { -- Quit = true; -+ Quit = QuitMode.QuitProgram; - } - - /******************** -diff --git a/source/OpenBVE/UserInterface/formMain.Start.cs b/source/OpenBVE/UserInterface/formMain.Start.cs -index 11a2051c..cd3c1088 100644 ---- a/source/OpenBVE/UserInterface/formMain.Start.cs -+++ b/source/OpenBVE/UserInterface/formMain.Start.cs -@@ -705,11 +705,13 @@ private void listviewTrainFolders_SelectedIndexChanged(object sender, EventArgs - // ===== - - // start -+ private readonly object StartGame = new Object(); -+ - private void buttonStart_Click(object sender, EventArgs e) { - if (Result.RouteFile != null & Result.TrainFolder != null) { - if (System.IO.File.Exists(Result.RouteFile) & System.IO.Directory.Exists(Result.TrainFolder)) { - Result.Start = true; -- this.Close(); -+ buttonClose_Click(StartGame, e); - //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes - //This fixes the main form failing to close on Linux - Application.DoEvents(); -@@ -1171,4 +1173,4 @@ private void routeWorkerThread_completed(object sender, RunWorkerCompletedEventA - } - - } --} -\ No newline at end of file -+} -diff --git a/source/OpenBVE/UserInterface/formMain.cs b/source/OpenBVE/UserInterface/formMain.cs -index 97592106..e461c7e7 100644 ---- a/source/OpenBVE/UserInterface/formMain.cs -+++ b/source/OpenBVE/UserInterface/formMain.cs -@@ -1346,15 +1346,19 @@ private void linkHomepage_LinkClicked(object sender, LinkLabelLinkClickedEventAr - } - } - -- -- // close -+ private bool Closing = false; - private void buttonClose_Click(object sender, EventArgs e) - { -- this.Close(); -+ Closing = true; -+ if (sender != null) -+ { -+ //Don't cause an infinite loop -+ this.Close(); -+ } - //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes - //This fixes the main form failing to close on Linux - Application.DoEvents(); -- if (Program.CurrentlyRunningOnMono) -+ if (Program.CurrentlyRunningOnMono && sender != StartGame) - { - //On some systems, the process *still* seems to hang around, so explicity issue the Environment.Exit() call - //https://github.com/leezer3/OpenBVE/issues/213 -@@ -1364,8 +1368,12 @@ private void buttonClose_Click(object sender, EventArgs e) - - protected override void OnFormClosing(FormClosingEventArgs e) - { -+ if (Closing) -+ { -+ return; -+ } - //Call the explicit closing method -- buttonClose_Click(this, e); -+ buttonClose_Click(null, e); - } - - - -From 11bb646bc252f642e7f3afff7d2c398ca0cd5709 Mon Sep 17 00:00:00 2001 -From: Christopher Lees <leez...@gmail.com> -Date: Wed, 17 Jan 2018 17:32:09 +0000 -Subject: [PATCH 3/4] Change: Another force-quit case - ---- - source/OpenBVE/System/GameWindow.cs | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/source/OpenBVE/System/GameWindow.cs b/source/OpenBVE/System/GameWindow.cs -index 1235817a..77fdcb05 100644 ---- a/source/OpenBVE/System/GameWindow.cs -+++ b/source/OpenBVE/System/GameWindow.cs -@@ -316,6 +316,12 @@ protected override void OnClosing(CancelEventArgs e) - e.Cancel = true; - Loading.Cancel = true; - } -+ -+ if (MainLoop.Quit == MainLoop.QuitMode.ContinueGame && Program.CurrentlyRunningOnMono) -+ { -+ //More forcefully close under Mono, stuff *still* hanging around.... -+ Environment.Exit(0); -+ } - } - /// <summary>This method is called once the route and train data have been preprocessed, in order to physically setup the simulation</summary> - private void SetupSimulation() - -From 4589fcb4500e04d13ccee5a14f64d771ce448a53 Mon Sep 17 00:00:00 2001 -From: Christopher Lees <leez...@gmail.com> -Date: Wed, 17 Jan 2018 17:59:39 +0000 -Subject: [PATCH 4/4] Fix: Options save & cleanup not triggered correctly - ---- - source/OpenBVE/UserInterface/formMain.Designer.cs | 1 - - source/OpenBVE/UserInterface/formMain.cs | 1 + - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/source/OpenBVE/UserInterface/formMain.Designer.cs b/source/OpenBVE/UserInterface/formMain.Designer.cs -index 805f55a2..46a14d82 100644 ---- a/source/OpenBVE/UserInterface/formMain.Designer.cs -+++ b/source/OpenBVE/UserInterface/formMain.Designer.cs -@@ -5289,7 +5289,6 @@ partial class formMain { - this.Name = "formMain"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "openBVE"; -- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formMain_FormClosing); - this.Load += new System.EventHandler(this.formMain_Load); - this.Shown += new System.EventHandler(this.formMain_Shown); - this.Resize += new System.EventHandler(this.formMain_Resize); -diff --git a/source/OpenBVE/UserInterface/formMain.cs b/source/OpenBVE/UserInterface/formMain.cs -index e461c7e7..ee8476cf 100644 ---- a/source/OpenBVE/UserInterface/formMain.cs -+++ b/source/OpenBVE/UserInterface/formMain.cs -@@ -1357,6 +1357,7 @@ private void buttonClose_Click(object sender, EventArgs e) - } - //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes - //This fixes the main form failing to close on Linux -+ formMain_FormClosing(sender, new FormClosingEventArgs(CloseReason.UserClosing, false)); - Application.DoEvents(); - if (Program.CurrentlyRunningOnMono && sender != StartGame) - { Copied: openbve/repos/community-any/force-close.patch (from rev 375993, openbve/trunk/force-close.patch) =================================================================== --- force-close.patch (rev 0) +++ force-close.patch 2018-09-01 22:33:26 UTC (rev 375994) @@ -0,0 +1,293 @@ +From bf1c0db61bc11a6fc64db6529941d80a0eeff449 Mon Sep 17 00:00:00 2001 +From: Christopher Lees <leez...@gmail.com> +Date: Fri, 12 Jan 2018 14:06:38 +0000 +Subject: [PATCH 1/4] Change: Attempt to force close the window under Mono + +--- + source/OpenBVE/System/GameWindow.cs | 8 ++++++++ + source/OpenBVE/UserInterface/formMain.cs | 14 +++++++++++++- + 2 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/source/OpenBVE/System/GameWindow.cs b/source/OpenBVE/System/GameWindow.cs +index 6c71204a..7e963408 100644 +--- a/source/OpenBVE/System/GameWindow.cs ++++ b/source/OpenBVE/System/GameWindow.cs +@@ -66,6 +66,10 @@ protected override void OnRenderFrame(FrameEventArgs e) + if (MainLoop.Quit) + { + Close(); ++ if (Program.CurrentlyRunningOnMono) ++ { ++ Environment.Exit(0); ++ } + } + //If the menu state has not changed, don't update the rendered simulation + return; +@@ -133,6 +137,10 @@ protected override void OnRenderFrame(FrameEventArgs e) + if (MainLoop.Quit) + { + Program.currentGameWindow.Exit(); ++ if (Program.CurrentlyRunningOnMono) ++ { ++ Environment.Exit(0); ++ } + } + Renderer.UpdateLighting(); + Renderer.RenderScene(TimeElapsed); +diff --git a/source/OpenBVE/UserInterface/formMain.cs b/source/OpenBVE/UserInterface/formMain.cs +index 6ab37ff0..97592106 100644 +--- a/source/OpenBVE/UserInterface/formMain.cs ++++ b/source/OpenBVE/UserInterface/formMain.cs +@@ -1,5 +1,6 @@ + using System; + using System.ComponentModel; ++using System.Diagnostics; + using System.Drawing; + using System.Net; + using System.Windows.Forms; +@@ -1353,8 +1354,19 @@ private void buttonClose_Click(object sender, EventArgs e) + //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes + //This fixes the main form failing to close on Linux + Application.DoEvents(); ++ if (Program.CurrentlyRunningOnMono) ++ { ++ //On some systems, the process *still* seems to hang around, so explicity issue the Environment.Exit() call ++ //https://github.com/leezer3/OpenBVE/issues/213 ++ Environment.Exit(0); ++ } + } + ++ protected override void OnFormClosing(FormClosingEventArgs e) ++ { ++ //Call the explicit closing method ++ buttonClose_Click(this, e); ++ } + + + // ====== +From 0c37c8c2cbb59b765aff0fa6f0ef3e198fceda87 Mon Sep 17 00:00:00 2001 +From: Christopher Lees <leez...@gmail.com> +Date: Sat, 13 Jan 2018 12:20:01 +0000 +Subject: [PATCH 2/4] Change: Fiddle some more with window closing... + +--- + source/OpenBVE/Game/Menu.cs | 4 ++-- + source/OpenBVE/System/GameWindow.cs | 8 ++++---- + source/OpenBVE/System/MainLoop.cs | 11 ++++++++--- + source/OpenBVE/UserInterface/formMain.Start.cs | 6 ++++-- + source/OpenBVE/UserInterface/formMain.cs | 18 +++++++++++++----- + 5 files changed, 31 insertions(+), 16 deletions(-) + +diff --git a/source/OpenBVE/Game/Menu.cs b/source/OpenBVE/Game/Menu.cs +index 0108a6da..f27d4439 100644 +--- a/source/OpenBVE/Game/Menu.cs ++++ b/source/OpenBVE/Game/Menu.cs +@@ -667,7 +667,7 @@ internal void ProcessCommand(Interface.Command cmd, double timeElapsed) + Reset(); + Program.RestartArguments = + Interface.CurrentOptions.GameMode == Interface.GameMode.Arcade ? "/review" : ""; +- MainLoop.Quit = true; ++ MainLoop.Quit = MainLoop.QuitMode.ExitToMenu; + break; + case MenuTag.Control: // CONTROL CUSTOMIZATION + PushMenu(MenuType.Control, ((MenuCommand)menu.Items[menu.Selection]).Data); +@@ -676,7 +676,7 @@ internal void ProcessCommand(Interface.Command cmd, double timeElapsed) + break; + case MenuTag.Quit: // QUIT PROGRAMME + Reset(); +- MainLoop.Quit = true; ++ MainLoop.Quit = MainLoop.QuitMode.QuitProgram; + break; + } + } +diff --git a/source/OpenBVE/System/GameWindow.cs b/source/OpenBVE/System/GameWindow.cs +index 7e963408..1235817a 100644 +--- a/source/OpenBVE/System/GameWindow.cs ++++ b/source/OpenBVE/System/GameWindow.cs +@@ -63,10 +63,10 @@ protected override void OnRenderFrame(FrameEventArgs e) + //Renderer.UpdateLighting(); + Renderer.RenderScene(TimeElapsed); + Program.currentGameWindow.SwapBuffers(); +- if (MainLoop.Quit) ++ if (MainLoop.Quit != MainLoop.QuitMode.ContinueGame) + { + Close(); +- if (Program.CurrentlyRunningOnMono) ++ if (Program.CurrentlyRunningOnMono && MainLoop.Quit == MainLoop.QuitMode.QuitProgram) + { + Environment.Exit(0); + } +@@ -134,10 +134,10 @@ protected override void OnRenderFrame(FrameEventArgs e) + } + + World.CameraAlignmentDirection = new World.CameraAlignment(); +- if (MainLoop.Quit) ++ if (MainLoop.Quit != MainLoop.QuitMode.ContinueGame) + { + Program.currentGameWindow.Exit(); +- if (Program.CurrentlyRunningOnMono) ++ if (Program.CurrentlyRunningOnMono && MainLoop.Quit == MainLoop.QuitMode.QuitProgram) + { + Environment.Exit(0); + } +diff --git a/source/OpenBVE/System/MainLoop.cs b/source/OpenBVE/System/MainLoop.cs +index 3633c4ed..16c6c435 100644 +--- a/source/OpenBVE/System/MainLoop.cs ++++ b/source/OpenBVE/System/MainLoop.cs +@@ -10,10 +10,15 @@ namespace OpenBve + { + internal static partial class MainLoop + { +- ++ internal enum QuitMode ++ { ++ ContinueGame = 0, ++ QuitProgram = 1, ++ ExitToMenu = 2 ++ } + // declarations + internal static bool LimitFramerate = false; +- internal static bool Quit = false; ++ internal static QuitMode Quit = QuitMode.ContinueGame; + /// <summary>BlockKeyRepeat should be set to 'true' whilst processing a KeyUp or KeyDown event.</summary> + internal static bool BlockKeyRepeat; + /// <summary>The current simulation time-factor</summary> +@@ -87,7 +92,7 @@ internal static void StartLoopEx(formMain.MainDialogResult result) + + private static void OpenTKQuit(object sender, CancelEventArgs e) + { +- Quit = true; ++ Quit = QuitMode.QuitProgram; + } + + /******************** +diff --git a/source/OpenBVE/UserInterface/formMain.Start.cs b/source/OpenBVE/UserInterface/formMain.Start.cs +index 11a2051c..cd3c1088 100644 +--- a/source/OpenBVE/UserInterface/formMain.Start.cs ++++ b/source/OpenBVE/UserInterface/formMain.Start.cs +@@ -705,11 +705,13 @@ private void listviewTrainFolders_SelectedIndexChanged(object sender, EventArgs + // ===== + + // start ++ private readonly object StartGame = new Object(); ++ + private void buttonStart_Click(object sender, EventArgs e) { + if (Result.RouteFile != null & Result.TrainFolder != null) { + if (System.IO.File.Exists(Result.RouteFile) & System.IO.Directory.Exists(Result.TrainFolder)) { + Result.Start = true; +- this.Close(); ++ buttonClose_Click(StartGame, e); + //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes + //This fixes the main form failing to close on Linux + Application.DoEvents(); +@@ -1171,4 +1173,4 @@ private void routeWorkerThread_completed(object sender, RunWorkerCompletedEventA + } + + } +-} +\ No newline at end of file ++} +diff --git a/source/OpenBVE/UserInterface/formMain.cs b/source/OpenBVE/UserInterface/formMain.cs +index 97592106..e461c7e7 100644 +--- a/source/OpenBVE/UserInterface/formMain.cs ++++ b/source/OpenBVE/UserInterface/formMain.cs +@@ -1346,15 +1346,19 @@ private void linkHomepage_LinkClicked(object sender, LinkLabelLinkClickedEventAr + } + } + +- +- // close ++ private bool Closing = false; + private void buttonClose_Click(object sender, EventArgs e) + { +- this.Close(); ++ Closing = true; ++ if (sender != null) ++ { ++ //Don't cause an infinite loop ++ this.Close(); ++ } + //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes + //This fixes the main form failing to close on Linux + Application.DoEvents(); +- if (Program.CurrentlyRunningOnMono) ++ if (Program.CurrentlyRunningOnMono && sender != StartGame) + { + //On some systems, the process *still* seems to hang around, so explicity issue the Environment.Exit() call + //https://github.com/leezer3/OpenBVE/issues/213 +@@ -1364,8 +1368,12 @@ private void buttonClose_Click(object sender, EventArgs e) + + protected override void OnFormClosing(FormClosingEventArgs e) + { ++ if (Closing) ++ { ++ return; ++ } + //Call the explicit closing method +- buttonClose_Click(this, e); ++ buttonClose_Click(null, e); + } + + + +From 11bb646bc252f642e7f3afff7d2c398ca0cd5709 Mon Sep 17 00:00:00 2001 +From: Christopher Lees <leez...@gmail.com> +Date: Wed, 17 Jan 2018 17:32:09 +0000 +Subject: [PATCH 3/4] Change: Another force-quit case + +--- + source/OpenBVE/System/GameWindow.cs | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/source/OpenBVE/System/GameWindow.cs b/source/OpenBVE/System/GameWindow.cs +index 1235817a..77fdcb05 100644 +--- a/source/OpenBVE/System/GameWindow.cs ++++ b/source/OpenBVE/System/GameWindow.cs +@@ -316,6 +316,12 @@ protected override void OnClosing(CancelEventArgs e) + e.Cancel = true; + Loading.Cancel = true; + } ++ ++ if (MainLoop.Quit == MainLoop.QuitMode.ContinueGame && Program.CurrentlyRunningOnMono) ++ { ++ //More forcefully close under Mono, stuff *still* hanging around.... ++ Environment.Exit(0); ++ } + } + /// <summary>This method is called once the route and train data have been preprocessed, in order to physically setup the simulation</summary> + private void SetupSimulation() + +From 4589fcb4500e04d13ccee5a14f64d771ce448a53 Mon Sep 17 00:00:00 2001 +From: Christopher Lees <leez...@gmail.com> +Date: Wed, 17 Jan 2018 17:59:39 +0000 +Subject: [PATCH 4/4] Fix: Options save & cleanup not triggered correctly + +--- + source/OpenBVE/UserInterface/formMain.Designer.cs | 1 - + source/OpenBVE/UserInterface/formMain.cs | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source/OpenBVE/UserInterface/formMain.Designer.cs b/source/OpenBVE/UserInterface/formMain.Designer.cs +index 805f55a2..46a14d82 100644 +--- a/source/OpenBVE/UserInterface/formMain.Designer.cs ++++ b/source/OpenBVE/UserInterface/formMain.Designer.cs +@@ -5289,7 +5289,6 @@ partial class formMain { + this.Name = "formMain"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "openBVE"; +- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formMain_FormClosing); + this.Load += new System.EventHandler(this.formMain_Load); + this.Shown += new System.EventHandler(this.formMain_Shown); + this.Resize += new System.EventHandler(this.formMain_Resize); +diff --git a/source/OpenBVE/UserInterface/formMain.cs b/source/OpenBVE/UserInterface/formMain.cs +index e461c7e7..ee8476cf 100644 +--- a/source/OpenBVE/UserInterface/formMain.cs ++++ b/source/OpenBVE/UserInterface/formMain.cs +@@ -1357,6 +1357,7 @@ private void buttonClose_Click(object sender, EventArgs e) + } + //HACK: Call Application.DoEvents() to force the message pump to process all pending messages when the form closes + //This fixes the main form failing to close on Linux ++ formMain_FormClosing(sender, new FormClosingEventArgs(CloseReason.UserClosing, false)); + Application.DoEvents(); + if (Program.CurrentlyRunningOnMono && sender != StartGame) + { Deleted: openbve.desktop =================================================================== --- openbve.desktop 2018-09-01 22:33:14 UTC (rev 375993) +++ openbve.desktop 2018-09-01 22:33:26 UTC (rev 375994) @@ -1,9 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=OpenBVE -Comment=Train/railway simulator compatible with 'BVE Trainsim' routes -Comment[hu]=A „BVE Trainsim” útvonalaival kompatibilis vonatszimulátor -Exec=openbve -Icon=openbve -Categories=Game;Simulation; Copied: openbve/repos/community-any/openbve.desktop (from rev 375993, openbve/trunk/openbve.desktop) =================================================================== --- openbve.desktop (rev 0) +++ openbve.desktop 2018-09-01 22:33:26 UTC (rev 375994) @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=OpenBVE +Comment=Train/railway simulator compatible with 'BVE Trainsim' routes +Comment[hu]=A „BVE Trainsim” útvonalaival kompatibilis vonatszimulátor +Exec=openbve +Icon=openbve +Categories=Game;Simulation; Deleted: openbve.sh =================================================================== --- openbve.sh 2018-09-01 22:33:14 UTC (rev 375993) +++ openbve.sh 2018-09-01 22:33:26 UTC (rev 375994) @@ -1,2 +0,0 @@ -#!/bin/sh -mono /usr/lib/openbve/OpenBve.exe "$@" Copied: openbve/repos/community-any/openbve.sh (from rev 375993, openbve/trunk/openbve.sh) =================================================================== --- openbve.sh (rev 0) +++ openbve.sh 2018-09-01 22:33:26 UTC (rev 375994) @@ -0,0 +1,2 @@ +#!/bin/sh +mono /usr/lib/openbve/OpenBve.exe "$@"