diff --git a/NetRedirect.dll b/NetRedirect.dll index 4139fedfab..193bbebc11 100644 Binary files a/NetRedirect.dll and b/NetRedirect.dll differ diff --git a/XSTools.dll b/XSTools.dll index 1052402ba7..fddeeb66b7 100644 Binary files a/XSTools.dll and b/XSTools.dll differ diff --git a/control/sys.txt b/control/sys.txt index c9e3ee91de..8fe2762726 100644 --- a/control/sys.txt +++ b/control/sys.txt @@ -1,6 +1,10 @@ ###### Localization settings ###### locale +###### Interface settings ###### +# Available interface list: Console, Tk, Vx, Win32, Wx +interface + ###### Localization compatibility ###### # Enable to make Kore compatible with old 2.0 configs. locale_compat 0 diff --git a/makedist.sh b/makedist.sh index 68ce67e5e3..99c34b4327 100755 --- a/makedist.sh +++ b/makedist.sh @@ -135,7 +135,7 @@ else fi if [[ "$BINDIST" == "1" ]]; then - for F in start.exe wxstart.exe NetRedirect.dll XSTools.dll start-poseidon.exe; do + for F in openkore.exe NetRedirect.dll XSTools.dll start-poseidon.exe; do if [[ ! -f "$F" ]]; then echo "Please put $F in the current folder." exit 1 @@ -218,16 +218,10 @@ if [[ "$BINDIST" == "1" ]]; then cp -v XSTools.dll NetRedirect.dll start-poseidon.exe "$PACKAGEDIR/" || err # Win32 binary - cp -v start.exe "$PACKAGEDIR/" || err + cp -v openkore.exe "$PACKAGEDIR/" || err zip -9r "$PACKAGE-$VERSION-win32.zip" "$PACKAGEDIR" || err echo "$PACKAGE-$VERSION-win32.zip created" - # Win32 Wx binary - cp -v wxstart.exe "$PACKAGEDIR/" || err - rm -vf "$PACKAGEDIR/start.exe" - zip -9r "$PACKAGE-$VERSION-win32_WX.zip" "$PACKAGEDIR" || err - echo "$PACKAGE-$VERSION-win32_wx.zip created" - elif [[ "$SEMIBINDIST" == "1" ]]; then # Create tarball echo "Creating distribution archive..." diff --git a/openkore.exe b/openkore.exe new file mode 100644 index 0000000000..eaf85cf8f4 Binary files /dev/null and b/openkore.exe differ diff --git a/openkore.pl b/openkore.pl index ffeec6adb7..53ea336e0b 100755 --- a/openkore.pl +++ b/openkore.pl @@ -41,6 +41,7 @@ sub __start { use Globals; use Interface; + Settings::parseInterfaceName(); $interface = Interface->loadInterface($Settings::interface); $interface->title($Settings::NAME); selfCheck(); diff --git a/src/Poseidon/start.pl b/src/Poseidon/start.pl new file mode 100644 index 0000000000..8c31767c27 --- /dev/null +++ b/src/Poseidon/start.pl @@ -0,0 +1,130 @@ +#!/usr/bin/env perl +# Win32 Perl script launcher +# This file is meant to be compiled by PerlApp. It acts like a mini-Perl interpreter. +# +# Your script's initialization and main loop code should be placed in a function +# called __start() in the main package. That function will be called by this +# launcher. The reason for this is that otherwise, the perl interpreter will be +# in "eval" all the time while running your script. It will break __DIE__ signal +# handlers that check for the value of $^S. +# +# If your script is run by this launcher, the environment variable INTERPRETER is +# set. Your script should call __start() manually if this environment variable is not +# set. +# +# example script: +# our $quit = 0; +# +# sub __start { +# print "Hello world initialized.\n"; +# while (!$quit) { +# ... +# } +# } +# +# __start() unless defined $ENV{INTERPRETER}; +package StarterScript; +use FindBin; + +if ($^O ne 'MSWin32') { + # We are not on Windows, so tell the user about it + print "\nThis file is meant to be compiled by PerlApp or PAR.\n"; + print "To run kore, execute openkore.pl instead.\n\n"; + exit 1; +} + + +# PerlApp 6's @INC doesn't contain '.', so add it +my $hasCurrentDir; +foreach (@INC) { + if ($_ eq ".") { + $hasCurrentDir = 1; + last; + } +} +push @INC, "." if (!$hasCurrentDir); + +if (0) { + # Force PerlApp to include the following modules + require base; + require bytes; + require lib; + require integer; + require warnings; + require UNIVERSAL; + require Exporter; + require Fcntl; + require Carp; + require Math::Trig; + require Text::Wrap; + require Text::ParseWords; + require Text::Balanced; + require Time::HiRes; + require IO::Socket::INET; + require Getopt::Long; + require Digest::MD5; + require SelfLoader; + require Data::Dumper; + require Win32; + require Win32::Console; + require Win32::Process; + require XSTools; + require Encode; + require Encode::KR; + require Encode::TW; + require Encode::JP; + require Encode::CN; + require encoding; + require Storable; + require Compress::Zlib; + require List::Util; + require File::Path; + require Math::BigInt; + require Math::BigInt::Calc; + require Math::BigInt::CalcEmu; + require Math::BigInt::FastCalc; + require Math::BigInt::Trace; + require Math::BigFloat; + require Math::BigFloat::Trace; + require Math::BigRat; + require Math::Complex; + require Math::Trig; + # new Perl 5.12 and more + require "unicore/lib/Perl/SpacePer.pl"; + require "unicore/lib/Perl/Word.pl"; + require "unicore/lib/Nt/De.pl"; + require "unicore/lib/Gc/Cc.pl"; + require "unicore/lib/Blk/ASCII.pl"; + # Old Perl 5.10 and less + # require "unicore/lib/gc_sc/SpacePer.pl"; + # require "unicore/lib/gc_sc/Word.pl"; + # require "unicore/lib/gc_sc/Digit.pl"; + # require "unicore/lib/gc_sc/Cntrl.pl"; + # require "unicore/lib/gc_sc/ASCII.pl"; +} + + +if ($PerlApp::TOOL eq "PerlApp" || $ENV{PAR_PROGNAME}) { + # ok +} else { + print "Do not run start.pl directly! If you're using Perl then run openkore.pl instead!\n"; + ; + exit 1; +} + +my $file = "./src/Poseidon/poseidon.pl"; +$0 = $file; +FindBin::again(); + +{ + package main; + do $file; +} +if ($@) { + print $@; + print "\nPress ENTER to exit.\n"; + ; + exit 1; +} elsif (defined $ENV{INTERPRETER}) { + main::__start() if defined(&main::__start); +} diff --git a/src/Settings.pm b/src/Settings.pm index 1781e109e3..0bd7a13f6f 100644 --- a/src/Settings.pm +++ b/src/Settings.pm @@ -235,13 +235,7 @@ sub parseArguments { $base_dead_log_file = File::Spec->catfile($logs_folder, "dead_log.txt"); update_log_filenames(); - if (!defined $interface) { - if ($ENV{OPENKORE_DEFAULT_INTERFACE} && $ENV{OPENKORE_DEFAULT_INTERFACE} ne "") { - $interface = $ENV{OPENKORE_DEFAULT_INTERFACE}; - } else { - $interface = "Console" - } - } + if ($starting_ai) { $AI::AI = AI::AUTO() if $starting_ai =~ /^(on|auto)$/; $AI::AI = AI::MANUAL() if $starting_ai =~ /^manual$/; @@ -259,6 +253,18 @@ sub parseArguments { return 1; } +sub parseInterfaceName { + if (!defined $interface) { + if($sys{interface} && $sys{interface} ne "") { + $interface = $sys{interface}; + } elsif ($ENV{OPENKORE_DEFAULT_INTERFACE} && $ENV{OPENKORE_DEFAULT_INTERFACE} ne "") { + $interface = $ENV{OPENKORE_DEFAULT_INTERFACE}; + } else { + $interface = "Console"; + } + } +} + sub update_log_filenames { my @logAppend; push @logAppend, "_$config{username}_$config{char}" if $config{logAppendUsername} && $config{username}; diff --git a/src/build/PAR_compile_openkore.bat b/src/build/PAR_compile_openkore.bat new file mode 100644 index 0000000000..e3578a2ac4 --- /dev/null +++ b/src/build/PAR_compile_openkore.bat @@ -0,0 +1,6 @@ +Rem this script generate a .exe with support to all interfaces +cd ..\.. +wxpar -lib src -o openkore.exe start.pl --module Wx::Perl::Packager --module Wx --module Wx:: --module Win32::GUI --module Win32::GUI::Constants --module Tk --module Tk:: --module Win32::API +pause + +Rem --icon src\build\openkore.ico \ No newline at end of file diff --git a/src/build/PAR_compile_poseidon.bat b/src/build/PAR_compile_poseidon.bat new file mode 100644 index 0000000000..79a00f2db7 --- /dev/null +++ b/src/build/PAR_compile_poseidon.bat @@ -0,0 +1,3 @@ +cd ..\Poseidon +pp -lib src -o start-poseidon.exe start.pl +pause \ No newline at end of file diff --git a/src/build/PAR_compile_start.bat b/src/build/PAR_compile_start.bat new file mode 100644 index 0000000000..693bc14714 --- /dev/null +++ b/src/build/PAR_compile_start.bat @@ -0,0 +1,5 @@ +cd ..\.. +pp -lib src -o start.exe start.pl +pause + +Rem --icon src\build\openkore.ico \ No newline at end of file diff --git a/src/build/PAR_compile_tk.bat b/src/build/PAR_compile_tk.bat new file mode 100644 index 0000000000..4fa3ad07e0 --- /dev/null +++ b/src/build/PAR_compile_tk.bat @@ -0,0 +1,5 @@ +cd ..\.. +pp -lib src -o tkstart.exe start.pl -g --module Tk --module Tk:: --module Win32::API +pause + +Rem --icon src\build\openkore.ico \ No newline at end of file diff --git a/src/build/PAR_compile_vx.bat b/src/build/PAR_compile_vx.bat new file mode 100644 index 0000000000..06a6c66687 --- /dev/null +++ b/src/build/PAR_compile_vx.bat @@ -0,0 +1,5 @@ +cd ..\.. +pp -lib src -o vxstart.exe start.pl -g --module Tk --module Tk:: +pause + +Rem --icon src\build\openkore.ico \ No newline at end of file diff --git a/src/build/PAR_compile_wingui.bat b/src/build/PAR_compile_wingui.bat new file mode 100644 index 0000000000..b827bf5120 --- /dev/null +++ b/src/build/PAR_compile_wingui.bat @@ -0,0 +1,5 @@ +cd ..\.. +pp -lib src -o winguistart.exe start.pl -g --module Win32::GUI --module Win32::GUI::Constants +pause + +Rem --icon src\build\openkore.ico \ No newline at end of file diff --git a/src/build/PAR_compile_wx.bat b/src/build/PAR_compile_wx.bat new file mode 100644 index 0000000000..a46fcf4b03 --- /dev/null +++ b/src/build/PAR_compile_wx.bat @@ -0,0 +1,5 @@ +cd ..\.. +wxpar -lib src -o wxstart.exe start.pl --module Wx::Perl::Packager --module Wx --module Wx:: +pause + +Rem --icon src\build\openkore.ico \ No newline at end of file diff --git a/start.exe b/start.exe deleted file mode 100644 index e979e2690f..0000000000 Binary files a/start.exe and /dev/null differ diff --git a/start.pl b/start.pl index 75bad846d7..a5effed4df 100644 --- a/start.pl +++ b/start.pl @@ -40,7 +40,7 @@ BEGIN if ($^O ne 'MSWin32') { # We are not on Windows, so tell the user about it - print "\nThis file is meant to be compiled by PerlApp.\n"; + print "\nThis file is meant to be compiled by PerlApp or PAR.\n"; print "To run kore, execute openkore.pl instead.\n\n"; exit 1; } @@ -71,6 +71,7 @@ BEGIN require Math::Trig; require Text::Wrap; require Text::ParseWords; + require Text::Balanced; require Time::HiRes; require IO::Socket::INET; require Getopt::Long; @@ -89,6 +90,24 @@ BEGIN require encoding; require Storable; require Compress::Zlib; + require List::Util; + require File::Path; + require Math::BigInt; + require Math::BigInt::Calc; + require Math::BigInt::CalcEmu; + require Math::BigInt::FastCalc; + require Math::BigInt::Trace; + require Math::BigFloat; + require Math::BigFloat::Trace; + require Math::BigRat; + require Math::Complex; + require Math::Trig; + # include http request libs - https://github.com/rathena/rathena/pull/5731 + require LWP::UserAgent; + require HTTP::Request; + require HTTP::Request::Common; + require HTTP::Cookies; + require HTTP::Headers; # new Perl 5.12 and more require "unicore/lib/Perl/SpacePer.pl"; require "unicore/lib/Perl/Word.pl"; @@ -122,8 +141,22 @@ BEGIN if (PerlApp::exe() =~ /tkstart\.exe$/i) { $ENV{OPENKORE_DEFAULT_INTERFACE} = 'Tk'; } +} elsif($ENV{PAR_PROGNAME}) { + if ($ENV{PAR_PROGNAME} =~ /wxstart\.exe$/i) { + $ENV{OPENKORE_DEFAULT_INTERFACE} = 'Wx'; + } + + if ($ENV{PAR_PROGNAME} =~ /vxstart\.exe$/i) { + $ENV{OPENKORE_DEFAULT_INTERFACE} = 'Vx'; + } + if ($ENV{PAR_PROGNAME} =~ /winguistart\.exe$/i) { + $ENV{OPENKORE_DEFAULT_INTERFACE} = 'Win32'; + } + if ($ENV{PAR_PROGNAME} =~ /tkstart\.exe$/i) { + $ENV{OPENKORE_DEFAULT_INTERFACE} = 'Tk'; + } } else { print "Do not run start.pl directly! If you're using Perl then run openkore.pl instead!\n"; ; diff --git a/tkstart.exe b/tkstart.exe deleted file mode 100644 index 2cc419eeb3..0000000000 Binary files a/tkstart.exe and /dev/null differ diff --git a/vxstart.exe b/vxstart.exe deleted file mode 100644 index 6c04096a6e..0000000000 Binary files a/vxstart.exe and /dev/null differ diff --git a/winguistart.exe b/winguistart.exe deleted file mode 100644 index f7aa8b4701..0000000000 Binary files a/winguistart.exe and /dev/null differ diff --git a/wxstart.exe b/wxstart.exe deleted file mode 100644 index 00764c94e8..0000000000 Binary files a/wxstart.exe and /dev/null differ