eternallands:MERGED-DEPRECIATED-android

Last commit made on 2022-04-01
Get this branch:
git clone -b MERGED-DEPRECIATED-android https://git.launchpad.net/eternallands

Branch merges

Branch information

Name:
MERGED-DEPRECIATED-android
Repository:
lp:eternallands

Recent commits

727e3c6... by Paul Broadhead

Merge branch 'master' into android

49a75f9... by Paul Broadhead

Android client branch merge into main (#186)

* Use last release for stable snap.

* Initial merge of ANDROID changes.

* Lastest Radu changes and enabled context menus.
Fix and enable context menu and user menu.
Enabled context meny for user and itle bar.
Added inv options to title menu.
Fix tab that were causing corruption.

* Enabled Hud Indicators and start of simpler context menus.
Fixed compiler warnings.
Fixed Hud Indictors crash if add_var set to zero.
Fixed Item Info - needed asset write.

* Rewrote touch handling.
Full window control of the camera.
Long press for right-click, restoring all context menus.
Removed various hacks that are no longer needed.
Adjusted buddy window spacing.
Add keyboard activation for pop up input windows.
Added the Android.mk file.

* Fixes and improvements for ANDROID after last merge.
Fix initial mini-map scaling.
Fix book reading crash/issue - initialise fonts used.
Exclude managing window positions with proportional move.
Remove title-bar special left click help.
Improve getting keyboard at login window.
Close the keyboard for all methods of login.
Improve positioning and keyboard activation for pop-up input window.
Better line spacing for storage and config windows.
Close more windows with BACK key.

* More Android fixes and clean up.
* Comments, space and clean up of changes pushed to main client.
* Restore use of language select window.
* Restore rules are login screen when needed.
* Fixes for view only storage, prevent attempts to access storage.
* Do a full client exit(0) if exiting normally - otherwise can restart.

* Long touch, login window and spells Android improvements.
Long press for right-click actions after configurable delay.
Login controls shift to top of screen if on-screen keyboard active.
Removed "clear button" as now controllable as long touch.

* More android updates.
* Use android-external storage for user files, readable on pre android 11.
* Restored ability to use the hud timer.
* Made the transparent hud a config option.
* Correctly label info, warning, error etc SDL messages.
* Adjust user menus so can read from user file space.
* Enabled JSON files.

* Enable item_extra_info.txt and item_knowledge_info.txt.

* Added opton to disbale GL_POINT_SMOOTH with does not work on some systems.

* Re-enable quickspell and quickbar relocation.

* Android updates for console window scrolling.
* Added momentum to finger motion scroll.
* Restored use of console scrollbar.

* Added android mini-map zoom.
Swipe right to zoom in, left to zoom out.

* Android touch help messages.

* Android input and file IO fixes.
* Removed block on input in windows other than console.
* Restored all the file IO input functions including xml by
fixing asset extraction to only datadir files. This fixes
the notepad which is usable again.
* Added long-touch to add a mark to the map editor.
* Added touch enable/disable for the mark filter.

* Shorter notepad on Android

* Android fixes for asset files.
The data files are included in the .apk file but are not available
until read from the asset file and written to accessible storage.
The original port did this but if the file changed, the new version
would not get read from the asset file. This meant the user
have to clear application storage after updates that included
changes to data files.
Instead, include a asset list file with a timestamp. When
packaging new data files, a new asset list and timestamp
must be created. If the client spots a change to the timestamp
then it deletes all the file listed in the asset list causing them to
be re-read from the asset pack. If the timestamp is the same
in the asset file and our last save local copy, we do not need to
delete the local files.
With this approach, there should be no need to clear application
storage when data files change.
* Updated user manu code as we no longer reed to remove the
files to get fresh.
* Added a client_state.json file to set a few options.

* Android fixes for language select, encyclopedia and use of iconv.
    * Build and use a local iconv library.
    * Use the new main client encyclopedia click that works with
    touch. Only needing one click and not following the wrong link.
    * Fixed the language select window to only require one click to
    select the desired language.

* Make use of the new centre window funciton.

* Android fixes for mini-map and context menu.
* Fixed the ability to move the mini-map, broken when we added the
finger swipe to scale code.
* Further line separation for the context menus and fix the active
height of each line.

* Allow external setting of version for Android.

* Restored more file open functions and GLU usage to Android.
* Added GLU library to build and restore original code.
* Restore use of more original file opening function like el_open_custom().

* Restore some original config settings on Android.
* Moved some hardwired options to config files.
* Re-enable chat window options, added on-screen keyboard activation.
* Fixed opening on-screen keyboard for "old behaviour" chat mode.

* Enable item list for Android with touch interface.
Re-enable the items list but included a simple touch
interface that mimics the one-touch action of the inventory ,
trade and storage windows.

* Re-enable trade log on Android.

* More checking for onscreen keyboard at login screen.

* Fix SPACE not working for hardware keyboard on Android.

* Removed files that are removed from master.

* Restore most of the options window on Android.

* Updated Android.mk after inital build tidy.

* Fix moving the minimap in Android.

* Add extra spacing for dialogue options on Android.

* Removed versions from Android lib paths.

* Add extra y space for emotes on Android.

* Back action on Android clears input after other possibilities.

* Android elconfig window touch improvements.
* Spin buttons are bigger.
* Added a gap between scrollbar and Spin buttons.
* Added keyboard entry for spin buttons.
* Added keyboard entry for string options.

* Android can now open URLs.
* SDL 2.0.14 includes SDL_OpenURL() that works on android.
* URL window is more touch friendly.

* Updated library paths for Android make

* On android when returning to foreground, reconnect to server if needed.

* More Android build clean up.

* Added TTF fonts to Android client, improve options scaling.
* Build with TTF enabled and use bundled TTF fonts.
* Allow bigger scaling for name and chat fonts.
* Clean up right margin for options.

* Revert cast for std::sqrt() on Android.
The newer compiler no used supports the overloaded function.

* Scale the minimap cross on Android.

* Revert "Scale the minimap cross on Android."
Even when we restore the size (previously missing) the
size leaks onto the hud on some devices. I can't work out
why so for now, revert.

This reverts commit 16b8c2647eaf3cc553268b51426d32a27aab6211.

* Restore logo link control on Android.

* Revert Android changes to load_gl_extensions.c
We can use all the standard code but substitute glXGetProcAddress() for
SDL_GL_GetProcAddress(). The man page says about use of
glXGetProcAddress(): This is necessary in environments where
the OpenGL link library exports a different set of functions than the
runtime library. With this change, there are more supported
extensions available on the devices

* On Andoid, limit options window height.

* Open onscreen keyboard if click on or above top based input widget.

* Added #kbd command for android.
Keyboard debug is displayed showing keycodes etc.
The #kbd toggles the debug on/off.

* Use static version of GL library.
Its the default to limits changes to gl4es.

* Fix chat and name font sizes for fresh install.
The fixes for OSX changed the way these fonts are set
and the way android scales them was missed.

* Restored use of CUSTOM_UPDATE.
Fixed update process on android, cleaned up -Defs.

* Android fonts are in /system/fonts.

* Updated default version stringi for android.

* Implement our own network code

If we want to encrypt the traffic with the server, we need to be able to work with the socket. SDL_net provides
a nice interface, but in the process abstracts away most of the details we need to be able to use SSL. So implement
our own socket type. Furthermore, split off the networking part of the message handling from multiplayer.c,
into a separate file, and use the new TCPSocket.

In time we may get rid of other uses of SDL_net in the code too. This is early code.

* Initial version of encrypted connections

Encrypt connection using TLS (or the highest encryption scheme both client and server support). This
requires server support to function, so it does not yet work. Lightly tested with a toy server.

* Move IPAddress struct to separate file

* If encryption is used, encrypt directly from the start, don't wait for invitation from the server

* Add peek() method to socket, to check incoming network data without removing it.

* Verify server certificates

* Add function to set blocking mode of sockets, make client sockets blocking by default

* Add (optiona;) encryption field to servers.lst

Add an optional Encryption column to the servers.lst file between the Port and Description fields that
determines whether the connection should be encrypted. If the columns contains "crypt", "encrypt", or "encrypted",
the connection should be encrypted, if it contains "plain" or "clear", or is left empty, the connection is
not encrypted. The match is case-insensitive. Please note that the field is optional, so any other value
than the 5 listed above will be parsed as part of the description. Conversely, server descriptions should
not start with any of the five reserved words unless the encryption column is explicitly set.

Since the field is optional, existing servers,lst files should still work. Note that the new field is only
parsed when the client is compiled with USE_SSL defined. Otherwise, any contents of the encryption
column will be added to the description.

* Fix parsing over servers.lst when USE_SSL is off.

* Fix for parsing servers.lst

The field width for strings in a sscanf() format string does not include the terminating NULL byte. Leave
room for that. Found by address sanitizer.

* Encrypted connection fixes:
*) Make connecting and setting up encryption a single operation. Otherwise, on reconnect, the reader thread
   will start reading after the connection is made, butbefore encryption is set up, wreaking havoc on the
   TLS handshake.
*) Get rid of the mutex on incoming data. It does not protect anything, as only the reader thread accesses
   the incoming data buffer.
*) Set a flag on login, so that on reconnect the login information is automatically sent again
*) Properly close the SSL session before closing the socket, if possible
*) Protect the SSL object by a mutex to prevent simultaneous reads and writes which OpenSSL cannot handle

* Documentation updates

* Add C++ abstraction for windows

Add a C++ Window class that wraps the C window_info struct, and can automatically register event handlers
and handle capturing lambdas as callbacks. This class does not yet expose the full set of window and
widget capabilties, and will probably evolve further. But it is a base to start from.

* Add text popup

Add a new class for text popups that can display a text message and a set of buttons with various callbacks
underneath. This is heavily inspired by the serverpopup window, but adds the ability to add multiple buttons.
The server popup could be trivially reimplemented in terms of this class.

* Show a warning popup when certificate check fails

If the certificate sent by the server over an encrypted connection cannot be verified, show a popup
dialog to the user with a warning emssage, and options to either disconnect, or continue accepting the risks.

* Clean up connection before exit.

Welcome to the wonderful world of global statics. The destructor of the Connection singleton may be called
after the context menu container singleton. This is a problem since the Connection can contain a (popup) window,
that will try to clean up its (non-existant) context menu upon destruction, and tries to look itself up
in the destroyed container. Ensure the popup is destroyed before the program finsihes.

* Add CMake support for building with SSL

* Load certificates from game directories

Load SSL certificates from both the game data directory, and the user's configuration directory instead of
the current working directory.

* Open servers.lst in binary mode

Although servers.lst is a text file, open it in binary mode as otherwise the check on the number of bytes
read will fail on Windows (or other platforms that use multiple characters to specify end of line).

* Changes to make the new network code compile on Windows

* Make connection actually work on windows

Fixes to make connections actually work on windows: initialize the
winsock library and fix an invalid check on the file descriptor leading
to the socket not actually calling connect().

* More network initialization/deinitialization

Clean up after the last socket is destroyed. Initialize in the constructor, not on connect, and don't throw
an exception on failure to initialize. We might be able to catch it, but if the initialization fails, we
will refuse to connect anyway.

* Proper cleanup after socket

Actually clean up when the last socket is destroyed, and properly serialize access to the shared network state.

* Make unverified certificate warning translatable

* Don't expand unverified signature popup to full screen width.

The popup window becomes very wide with the current warning message, limit it to ~80 characters of text.

* Let's not destroy the invalid certificate warning window in one of its event handlers. Although it might work
in this case, that's asking for trouble. Simply hide the window when a button is clicked, but keep it alive.

* Include fix for FreeBSD. Apparently these are pulled in somehow on Linux, but not FreeBSD

* The disconnected variable is only used when USE_SSL is not defined, move it inside #ifdef guard

* Android manage extraction of .gz and .xz files. Fix use of custom updates.

* ANDROID updates due to merge.

* Update Android build to compile with OpenSSL support

* Use is_disconnected()

* Android builds with USE_SSL.
Taken from gvissers patch.

* Unpack the certificate files from the android apk.

* Improve ANDROID single click touch responsiveness.
Added configurable threshold to wait before triggering finger motion
rather than using as a click. The default is set slightly higher than the
previously fixed value.

* Improve android keyboard control.
* If not using the logo for a web link, clicking it toggles the keyboard.
* The above and the click near, and long click at top all toggle the keyboard.

* Build SSL libraries statically

As posted in the forums (http://www.eternal-lands.com/forum/index.php?/topic/6>
older android versions fail to run the client because it tries to use the
system's OpenSSL library, instead of the one bundled with the client. Build
and link the OpenSSL libraries statically in an attempt to fix this.

* Grmbl, remove shared libs, added by merge, again.

* Tidy up keyboard activation on Android.
  * Show information on start-up
  * Remove multiple -near top of screen- activation
  * If using logo touch, disable near-top-of-screen
  * If enabling / disabling logo show help

* Bump Android version to 1.9.6.0.

* Open android keyboard on logo touch even of hud is transparent.

* Fix user menu selection on Android when opened over menu bar.
If the user menu window opened the menu on top of the menu bar
then an option would be pre-selected and no other could be picked.

* Prevent on-screen keyboard opening during login screen init.

* Added "Keyboard" button for Android to activate the on-screen keyboard.
A button to the left of the input region that toggles the on-screen keyboard.
Removed the long-press-at-top activation because it was inconsistent and
not discoverable. Retained the EL logo activation as I like it :) Removed the
console help text that nobody reads.
The button sizes with the input field so can get big with multiple lines. The
space is not usable anyway. It would be nice if it was an icon so perhaps
that could be done later.

* Add SDL_StopTextInput() for SSL login.

* Add SDL_StopTextInput() for SSL login.

* Enable full screen toggle for Android.

* Enable Android window position handling.

* Fix crash on Adreno

On Android systems with an Adreno GPU, the game crashes when drawing both
the player name and damage updates in the player banner. This is most
commonly seen when fighting. I do not know the exact root cause of the
problem (whether it is in the client code, gl4es, or the Adreno drivers)
but checking the depth buffer also when drawing the damage updates seems
to prevent the crash from happening.

* Fix android trade from storage bug - pass correct item position.
The position sent for PUT_OBJECT_ON_TRADE is 1 bytes for
pos <= 255, but 2 bytes for > 255. The Android touch version was
only sending one byte for all pos values.

* Exit if receive SDL_RENDER_DEVICE_RESET event.

* Use Android update tmp file to tmp directory so we can exclude from backup.
Also remove tmp files more reliably.

* Fix compiler warning for unsigned long types.

* Added more first time configuration for Android.
    * In addition to scale...
    * Set default fonts
    * Set windows to default positions.
    * Set default windows scale.
    * Enable auto scale.
Now can just increment the expected done_initial_config
from the config file to if we want to rerun this for a new build.

* Fix mouse over issues for spells windows on Android.

* Add initial screen orientations option for Android.
This is an initial option to allow either: Full rotation,
landscape only or portrait only. Changing the option
requires a restart to take effect. It appears that SDL
does not honour the device setting and controls are
limited, we may have to drop into the ELC
Activity.java code to make this better.

* Include enable_screensaver option.

* 1.9.6.1 now default Android build version.

* Increase Android window widgets by 50%.
The value for title height and box size are increase. The box
size is used by scroll-bar, close-cross, widow sizer etc.

* Make sure the scroll bar does not extend vertically beyond the arrows.

* Remove more options on Android.

* Pre merge into main, clean up.

* More Pre merge into main, clean up.

Co-authored-by: Gé Vissers <email address hidden>

e891754... by Paul Broadhead

More Pre merge into main, clean up.

8e043ae... by Paul Broadhead

Pre merge into main, clean up.

dc1e3e8... by Paul Broadhead

Merge branch 'master' into android

4dc6058... by Paul Broadhead

Enable https links for encyclopedia.

b5592fe... by =?utf-8?q?G=C3=A9_Vissers?= <email address hidden>

Move UVP debug string under DEBUG #ifdef

Issue #183. When the actor animation program is used, a text message UVP: 1 is printed under the FPS string on the
main screen. In normal gameplay it is distracting, and unnecessary. Remove it for releases, but keep it as a DEBUG
option in case anyone wants to work on modernizing the associated code.

d660d95... by Paul Broadhead

Remove more options on Android.

ef67cc5... by Paul Broadhead

Make sure the scroll bar does not extend vertically beyond the arrows.

fc0a7ae... by Paul Broadhead

Increase Android window widgets by 50%.
The value for title height and box size are increase. The box
size is used by scroll-bar, close-cross, widow sizer etc.