diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3120cce
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+backup
+lib
+UserData
+Hytale_Launcher.exe
\ No newline at end of file
diff --git a/project1.lps b/project1.lps
index ed16f4e..23aaccc 100644
--- a/project1.lps
+++ b/project1.lps
@@ -10,7 +10,7 @@
-
+
@@ -20,9 +20,9 @@
-
-
-
+
+
+
@@ -35,34 +35,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -155,6 +127,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/unit1.lfm b/unit1.lfm
index 807f4b6..0dfd3a7 100644
--- a/unit1.lfm
+++ b/unit1.lfm
@@ -8,7 +8,6 @@ object Form1: TForm1
ClientHeight = 426
ClientWidth = 758
Position = poScreenCenter
- LCLVersion = '4.2.0.0'
OnShow = FormShow
object Image1: TImage
Left = 0
diff --git a/unit1.pas b/unit1.pas
index 38916e6..e20434a 100644
--- a/unit1.pas
+++ b/unit1.pas
@@ -5,7 +5,8 @@ unit Unit1;
interface
uses
- Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls;
+ Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
+ Process;
type
@@ -31,13 +32,17 @@ type
var
Form1: TForm1;
+ APath: String;
PLAYER_UUID: String;
PLAYER_NAME: String;
PX, PY: Integer;
MouseIsDown: Boolean;
+
const
- Hytale_Dir = '.\package\game\latest\Client\';
- //JAVA_EXE = '.\package\jre\latest\bin\java.exe';
+ Hytale_Dir = 'package\game\latest\Client\';
+ app_dir = 'package\game\latest';
+ java_exec = 'package\jre\latest\bin\java.exe';
+ user_dir = 'UserData';
implementation
@@ -59,11 +64,11 @@ end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
- begin
- MouseIsDown := True;
- PX := X;
- PY := Y;
- end;
+ begin
+ MouseIsDown := True;
+ PX := X;
+ PY := Y;
+ end;
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
@@ -85,23 +90,23 @@ var
FileContent: string;
tmp_uuid: string;
begin
- if not FileExists(Hytale_Dir+'uuid.txt') then
- begin
- tmp_uuid:= GenerateUniqueID();
- AssignFile(f, Hytale_Dir+'uuid.txt');
- Rewrite(f);
- Write(f, AnsiLowerCase(tmp_uuid));
- CloseFile(f);
- PLAYER_UUID:=AnsiLowerCase(tmp_uuid);
- end
- else
- begin
- AssignFile(f, Hytale_Dir+'uuid.txt');
- Reset(f);
- Read(f, FileContent);
- CloseFile(f);
- PLAYER_UUID:=FileContent;
- end;
+ if not FileExists(APath+user_dir+'\uuid.txt') then
+ begin
+ tmp_uuid:= GenerateUniqueID();
+ AssignFile(f, APath+user_dir+'\uuid.txt');
+ Rewrite(f);
+ Write(f, AnsiLowerCase(tmp_uuid));
+ CloseFile(f);
+ PLAYER_UUID:=AnsiLowerCase(tmp_uuid);
+ end
+ else
+ begin
+ AssignFile(f, APath+user_dir+'\uuid.txt');
+ Reset(f);
+ Read(f, FileContent);
+ CloseFile(f);
+ PLAYER_UUID:=FileContent;
+ end;
end;
procedure TForm1.SetPlayerName();
@@ -109,15 +114,15 @@ var
f: TextFile;
FileContent: string;
begin
- if FileExists(Hytale_Dir+'username.txt') then
- begin
- AssignFile(f,Hytale_Dir+'username.txt');
- Reset(f);
- Read(f, FileContent);
- CloseFile(f);
- player_name_edit.Text:=FileContent;
- PLAYER_NAME:=FileContent;
- end
+ if FileExists(APath+user_dir+'\username.txt') then
+ begin
+ AssignFile(f,APath+user_dir+'\username.txt');
+ Reset(f);
+ Read(f, FileContent);
+ CloseFile(f);
+ player_name_edit.Text:=FileContent;
+ PLAYER_NAME:=FileContent;
+ end
end;
{$R *.lfm}
@@ -125,25 +130,38 @@ end;
{ TForm1 }
procedure TForm1.start_btnClick(Sender: TObject);
-
var
f: TextFile;
- Parameters: string;
- APath, JAVA_EXE: String;
-begin
- APath:= ExtractFilePath(Application.ExeName);
- JAVA_EXE:= APath+'package\jre\latest\bin\java.exe';
- APath:= APath+'package\game\latest\';
+ Process: TProcess;
- AssignFile(f, Hytale_Dir+'username.txt');
+ Parameters: string;
+begin
+ AssignFile(f, APath+user_dir+'\username.txt');
Rewrite(f);
Write(f, player_name_edit.Text);
CloseFile(f);
- Parameters:= '--app-dir '+APath+' --java-exec '+JAVA_EXE+' --auth-mode offline --uuid '+PLAYER_UUID+' --name '+PLAYER_NAME;
- //ShowMessage(Parameters);
- ExecuteProcess(APath+'Client\HytaleClient.exe', Parameters);
- Close;
+ Process:= TProcess.Create(nil);
+ Process.Executable:= 'HytaleClient.exe';
+
+ Parameters:= '--app-dir "'+APath+app_dir+'" --java-exec "'+APath+java_exec+'" --user-dir "'+APath+user_dir+'" --auth-mode offline --uuid '+PLAYER_UUID+' --name '+PLAYER_NAME;
+
+ Process.Parameters.Add(Parameters);
+
+ //ShowMessage(APath+Hytale_Dir+'HytaleClient.exe '+Parameters);
+
+ if not FileExists(APath+Hytale_Dir+'HytaleClient.exe') then
+ begin
+ ShowMessage('HytaleClient.exe не найден');
+ Close;
+ end
+ else
+ begin
+ ChDir(APath+Hytale_Dir);
+ //ExecuteProcess('HytaleClient.exe', Parameters);
+ Process.Execute;
+ Close;
+ end
end;
procedure TForm1.exit_btnClick(Sender: TObject);
@@ -152,8 +170,10 @@ begin
end;
procedure TForm1.FormShow(Sender: TObject);
-
begin
+ APath:= ExtractFilePath(Application.ExeName);
+ ForceDirectories(ExtractFilePath(APath+user_dir));
+
SetPlayerName();
GenerateID();
end;