Fix update script on linux not restarting launcher.

This commit is contained in:
UnknownShadow200 2016-02-14 10:26:39 +11:00
parent 869b4132be
commit 357b20619a
8 changed files with 15 additions and 28 deletions

View File

@ -106,13 +106,12 @@ namespace ClassicalSharp {
} }
public override void MoveTo( int newX, int newY ) { public override void MoveTo( int newX, int newY ) {
int deltaX = newX - X; int dx = newX - X, dy = newY - Y;
int deltaY = newY - Y;
X = newX; Y = newY; X = newX; Y = newY;
chatCaretTexture.X1 += deltaX; chatCaretTexture.X1 += dx;
chatCaretTexture.Y1 += deltaY; chatCaretTexture.Y1 += dy;
chatInputTexture.X1 += deltaX; chatInputTexture.X1 += dx;
chatInputTexture.Y1 += deltaY; chatInputTexture.Y1 += dy;
} }
static bool IsInvalidChar( char c ) { static bool IsInvalidChar( char c ) {

View File

@ -58,7 +58,6 @@ namespace ClassicalSharp {
api.AlphaTest = true; api.AlphaTest = true;
LocalPlayer localP = game.LocalPlayer; LocalPlayer localP = game.LocalPlayer;
Vector3 eyePos = localP.EyePosition; Vector3 eyePos = localP.EyePosition;
Vector3 dir = Utils.GetDirVector( localP.HeadYawRadians, localP.PitchRadians );
closestId = 255; closestId = 255;
if( NamesMode != NameMode.AllNames ) if( NamesMode != NameMode.AllNames )

View File

@ -38,8 +38,6 @@ namespace ClassicalSharp.Particles {
rec.V1 = baseRec.V1 + rnd.Next( minV, maxUsedV ) * vScale; rec.V1 = baseRec.V1 + rnd.Next( minV, maxUsedV ) * vScale;
rec.U2 = Math.Min( baseRec.U1 + maxU * uScale, rec.U1 + 4 * uScale ) - 0.01f * uScale; rec.U2 = Math.Min( baseRec.U1 + maxU * uScale, rec.U1 + 4 * uScale ) - 0.01f * uScale;
rec.V2 = Math.Min( baseRec.V1 + maxV * vScale, rec.V1 + 4 * vScale ) - 0.01f * vScale; rec.V2 = Math.Min( baseRec.V1 + maxV * vScale, rec.V1 + 4 * vScale ) - 0.01f * vScale;
int pixU1 = (int)(rec.U1 / uScale), pixU2 = (int)(rec.U2 / uScale);
int pixV1 = (int)(rec.V1 / vScale), pixV2 = (int)(rec.V2 / vScale);
double life = 0.3 + rnd.NextDouble() * 0.7; double life = 0.3 + rnd.NextDouble() * 0.7;
TerrainParticle p = AddParticle( terrainParticles, ref terrainCount, false ); TerrainParticle p = AddParticle( terrainParticles, ref terrainCount, false );

View File

@ -28,7 +28,7 @@ namespace ClassicalSharp {
Game game; Game game;
IGraphicsApi api; IGraphicsApi api;
int _1Dcount = 1, _1DUsed = 1; int _1DUsed = 1;
ChunkMeshBuilder builder; ChunkMeshBuilder builder;
BlockInfo info; BlockInfo info;
@ -41,7 +41,6 @@ namespace ClassicalSharp {
public MapRenderer( Game game ) { public MapRenderer( Game game ) {
this.game = game; this.game = game;
_1Dcount = game.TerrainAtlas1D.TexIds.Length;
_1DUsed = game.TerrainAtlas1D.CalcMaxUsedRow( game.TerrainAtlas, game.BlockInfo ); _1DUsed = game.TerrainAtlas1D.CalcMaxUsedRow( game.TerrainAtlas, game.BlockInfo );
RecalcBooleans( true ); RecalcBooleans( true );
@ -89,9 +88,8 @@ namespace ClassicalSharp {
} }
void TerrainAtlasChanged( object sender, EventArgs e ) { void TerrainAtlasChanged( object sender, EventArgs e ) {
_1Dcount = game.TerrainAtlas1D.TexIds.Length; bool refreshRequired = elementsPerBitmap != game.TerrainAtlas1D.elementsPerBitmap;
bool fullResetRequired = elementsPerBitmap != game.TerrainAtlas1D.elementsPerBitmap; if( refreshRequired )
if( fullResetRequired )
Refresh(); Refresh();
elementsPerBitmap = game.TerrainAtlas1D.elementsPerBitmap; elementsPerBitmap = game.TerrainAtlas1D.elementsPerBitmap;

View File

@ -3,6 +3,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading;
using ClassicalSharp.TexturePack; using ClassicalSharp.TexturePack;
namespace Launcher2.Updater { namespace Launcher2.Updater {
@ -14,8 +15,8 @@ namespace Launcher2.Updater {
byte[] zipData = client.DownloadData( UpdateCheckTask.UpdatesUri + dir ); byte[] zipData = client.DownloadData( UpdateCheckTask.UpdatesUri + dir );
MakeUpdatesFolder( zipData ); MakeUpdatesFolder( zipData );
} }
if( !OpenTK.Configuration.RunningOnWindows ) return;
LaunchUpdateScript(); LaunchUpdateScript();
Thread.Sleep( 200 );
Process.GetCurrentProcess().Kill(); Process.GetCurrentProcess().Kill();
} }
@ -32,10 +33,8 @@ namespace Launcher2.Updater {
int code = chmod( path, (flags << 6) | (flags << 3) | 4 ); int code = chmod( path, (flags << 6) | (flags << 3) | 4 );
if( code != 0 ) if( code != 0 )
throw new InvalidOperationException( "chmod returned : " + code ); throw new InvalidOperationException( "chmod returned : " + code );
info = new ProcessStartInfo( "/bin/bash", "-c " + path ); info = new ProcessStartInfo( "xterm", '"' + path + '"');
} }
// TODO: delete directory
// TODO: why no start new window?
info.CreateNoWindow = false; info.CreateNoWindow = false;
info.UseShellExecute = false; info.UseShellExecute = false;
Process.Start( info ); Process.Start( info );

View File

@ -49,16 +49,14 @@ echo Extracting files from CS_Update folder
UPDATEDIR=""`pwd`/CS_Update/"" UPDATEDIR=""`pwd`/CS_Update/""
find ""$UPDATEDIR"" -name '*.*' | xargs cp -t `pwd` find ""$UPDATEDIR"" -name '*.*' | xargs cp -t `pwd`
rm -r ""$UPDATEDIR""
echo Starting launcher again echo Starting launcher again
if [ -f ""Launcher.exe"" ]; if [ -f ""Launcher.exe"" ];
then then
mono Launcher.exe & mono Launcher.exe
else else
mono Launcher2.exe & mono Launcher2.exe
fi fi
disown
echo Waiting
sleep 10
"; ";
} }
} }

View File

@ -213,9 +213,7 @@ namespace OpenTK.Platform.X11 {
public static IntPtr CreatePixmapFromImage(Display display, System.Drawing.Bitmap image) public static IntPtr CreatePixmapFromImage(Display display, System.Drawing.Bitmap image)
{ {
int width = image.Width; int width = image.Width, height = image.Height;
int height = image.Height;
int size = width * height;
System.Drawing.Imaging.BitmapData data = image.LockBits(new System.Drawing.Rectangle(0, 0, width, height), System.Drawing.Imaging.BitmapData data = image.LockBits(new System.Drawing.Rectangle(0, 0, width, height),
System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.ImageLockMode.ReadOnly,

View File

@ -56,7 +56,6 @@ namespace OpenTK.Platform.X11 {
IntPtr net_wm_icon; IntPtr net_wm_icon;
IntPtr net_frame_extents; IntPtr net_frame_extents;
IntPtr motif_wm_hints;
static readonly IntPtr xa_cardinal = (IntPtr)6; static readonly IntPtr xa_cardinal = (IntPtr)6;
static readonly IntPtr _remove = (IntPtr)0; static readonly IntPtr _remove = (IntPtr)0;
@ -190,7 +189,6 @@ namespace OpenTK.Platform.X11 {
net_wm_state_maximized_vertical = API.XInternAtom(window.Display, "_NET_WM_STATE_MAXIMIZED_VERT", false); net_wm_state_maximized_vertical = API.XInternAtom(window.Display, "_NET_WM_STATE_MAXIMIZED_VERT", false);
net_wm_icon = API.XInternAtom(window.Display, "_NEW_WM_ICON", false); net_wm_icon = API.XInternAtom(window.Display, "_NEW_WM_ICON", false);
net_frame_extents = API.XInternAtom(window.Display, "_NET_FRAME_EXTENTS", false); net_frame_extents = API.XInternAtom(window.Display, "_NET_FRAME_EXTENTS", false);
motif_wm_hints = API.XInternAtom(window.Display, "_MOTIF_WM_HINTS", true);
} }
void SetWindowMinMax(short min_width, short min_height, short max_width, short max_height) { void SetWindowMinMax(short min_width, short min_height, short max_width, short max_height) {