Skip to content

Commit

Permalink
Merge remote-tracking branch 'STJr/master'
Browse files Browse the repository at this point in the history
Azerty merge with latest 1.5 commit
  • Loading branch information
AlexPoilrouge committed Aug 21, 2022
2 parents 83c0a3c + 2f17fdc commit 5e3ab5d
Show file tree
Hide file tree
Showing 578 changed files with 101,135 additions and 58,108 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
# Version change is fine.
project(SRB2
VERSION 1.3
VERSION 1.4
LANGUAGES C)

if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
Expand Down
1 change: 0 additions & 1 deletion assets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"

set(SRB2_ASSET_HASHED
"srb2.srb;\
patch.kart;\
gfx.kart;\
textures.kart;\
chars.kart;\
Expand Down
34 changes: 34 additions & 0 deletions doc/Holepunch-Protocol.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Bird's Hole Punching Protocol


Hole punch - a mechanism to bypass a firewall
Server - a third party which is not behind a firewall
Client - anything contacting the server
Magic - the four bytes 00 52 EB 11
Address - an IPv4 address


0 1 2 3 4 5 6 7 8 9
+-------+-------+----+
| Magic |Address|Port|
+-------+-------+----+
Relay Packet


A client that expects to be the target of a hole punch
must contact the server frequently, to keep a UDP
"connection" open, so that the server may relay hole
punching requests to them.

A client makes a hole punching request to another client
by sending a Relay Packet to the server. The server then
sends another Relay Packet to the client described by the
first packet. The second packet is filled with the source
address and port of the first packet.

Once a client receives a Relay Packet, this protocol's
purpose is fulfilled and the client is aware that another
client requests a hole punch.


vim: noai
21 changes: 0 additions & 21 deletions libs/FMOD.props

This file was deleted.

8 changes: 4 additions & 4 deletions libs/SDL2/BUGS.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Bugs are now managed in the SDL bug tracker, here:
Bugs are now managed in the SDL issue tracker, here:

https://bugzilla.libsdl.org/
https://github.com/libsdl-org/SDL/issues

You may report bugs there, and search to see if a given issue has already
been reported, discussed, and maybe even fixed.
Expand All @@ -11,6 +11,6 @@ You may also find help at the SDL forums/mailing list:

https://discourse.libsdl.org/

Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
bugs discussed on the mailing list may be forgotten or missed.
Bug reports are welcome here, but we really appreciate if you use the issue
tracker, as bugs discussed on the mailing list may be forgotten or missed.

2 changes: 1 addition & 1 deletion libs/SDL2/COPYING.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
Copyright (C) 1997-2020 Sam Lantinga <[email protected]>

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down
311 changes: 311 additions & 0 deletions libs/SDL2/WhatsNew.txt

Large diffs are not rendered by default.

134 changes: 96 additions & 38 deletions libs/SDL2/docs/README-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ If you are using the older ant build process, it is no longer officially
supported, but you can use the "android-project-ant" directory as a template.


================================================================================
Requirements
Requirements
================================================================================

Android SDK (version 26 or later)
Expand All @@ -20,11 +19,10 @@ https://developer.android.com/sdk/index.html
Android NDK r15c or later
https://developer.android.com/tools/sdk/ndk/index.html

Minimum API level supported by SDL: 14 (Android 4.0.1)
Minimum API level supported by SDL: 16 (Android 4.1)


================================================================================
How the port works
How the port works
================================================================================

- Android applications are Java-based, optionally with parts written in C
Expand All @@ -42,8 +40,7 @@ dispatches to native functions implemented in the SDL library:
src/core/android/SDL_android.c


================================================================================
Building an app
Building an app
================================================================================

For simple projects you can use the script located at build-scripts/androidbuild.sh
Expand Down Expand Up @@ -82,6 +79,23 @@ For more complex projects, follow these instructions:

4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device


If you already have a project that uses CMake, the instructions change somewhat:

1. Do points 1 and 2 from the instruction above.
2. Edit "<project>/app/build.gradle" to comment out or remove sections containing ndk-build
and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
3. Edit "<project>/app/jni/CMakeLists.txt" to include your project (it defaults to
adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
add_executable() for the target containing your "main" function.

If you wish to use Android Studio, you can skip the last step.

4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
connected Android device

Here's an explanation of the files in the Android project, so you can customize them:

android-project/app
Expand All @@ -90,19 +104,20 @@ Here's an explanation of the files in the Android project, so you can customize
jni/ - directory holding native code
jni/Application.mk - Application JNI settings, including target platform and STL library
jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories
jni/CMakeLists.txt - Top-level CMake project that adds SDL as a subproject
jni/SDL/ - (symlink to) directory holding the SDL library files
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
jni/src/ - directory holding your C/C++ source
jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
jni/src/CMakeLists.txt - CMake file that you may customize to include your source code and any library references
src/main/assets/ - directory holding asset files for your application
src/main/res/ - directory holding resources for your application
src/main/res/mipmap-* - directories holding icons for different phone hardware
src/main/res/values/strings.xml - strings used in your application, including the application name
src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application.


================================================================================
Customizing your application name
Customizing your application name
================================================================================

To customize your application name, edit AndroidManifest.xml and replace
Expand Down Expand Up @@ -132,17 +147,15 @@ Then replace "SDLActivity" in AndroidManifest.xml with the name of your
class, .e.g. "MyGame"


================================================================================
Customizing your application icon
Customizing your application icon
================================================================================

Conceptually changing your icon is just replacing the "ic_launcher.png" files in
the drawable directories under the res directory. There are several directories
for different screen sizes.


================================================================================
Loading assets
Loading assets
================================================================================

Any files you put in the "app/src/main/assets" directory of your project
Expand Down Expand Up @@ -170,11 +183,10 @@ disable this behaviour, see for example:
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/


================================================================================
Pause / Resume behaviour
Pause / Resume behaviour
================================================================================

If SDL is compiled with SDL_ANDROID_BLOCK_ON_PAUSE defined (the default),
If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default),
the event loop will block itself when the app is paused (ie, when the user
returns to the main Android dashboard). Blocking is better in terms of battery
use, and it allows your app to spring back to life instantaneously after resume
Expand All @@ -186,13 +198,40 @@ app can continue to operate as it was.

However, there's a chance (on older hardware, or on systems under heavy load),
where the GL context can not be restored. In that case you have to listen for
a specific message, (which is not yet implemented!) and restore your textures
manually or quit the app (which is actually the kind of behaviour you'll see
under iOS, if the OS can not restore your GL context it will just kill your app)
a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
manually or quit the app.

You should not use the SDL renderer API while the app going in background:
- SDL_APP_WILLENTERBACKGROUND:
after you read this message, GL context gets backed-up and you should not
use the SDL renderer API.

When this event is received, you have to set the render target to NULL, if you're using it.
(eg call SDL_SetRenderTarget(renderer, NULL))

- SDL_APP_DIDENTERFOREGROUND:
GL context is restored, and the SDL renderer API is available (unless you
receive SDL_RENDER_DEVICE_RESET).

Mouse / Touch events
================================================================================
Threads and the Java VM

In some case, SDL generates synthetic mouse (resp. touch) events for touch
(resp. mouse) devices.
To enable/disable this behavior, see SDL_hints.h:
- SDL_HINT_TOUCH_MOUSE_EVENTS
- SDL_HINT_MOUSE_TOUCH_EVENTS

Misc
================================================================================

For some device, it appears to works better setting explicitly GL attributes
before creating a window:
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);

Threads and the Java VM
================================================================================

For a quick tour on how Linux native threads interoperate with the Java VM, take
Expand All @@ -207,8 +246,17 @@ your thread automatically anyway (when you make an SDL call), but it'll never
detach it.


================================================================================
Using STL
If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"),
it won't be able to find your java class and method because of the java class loader
which is different for native threads, than for java threads (eg your "main()").

the work-around is to find class/method, in you "main()" thread, and to use them
in your native thread.

see:
https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class

Using STL
================================================================================

You can use STL in your project by creating an Application.mk file in the jni
Expand All @@ -220,8 +268,7 @@ For more information go here:
https://developer.android.com/ndk/guides/cpp-support


================================================================================
Using the emulator
Using the emulator
================================================================================

There are some good tips and tricks for getting the most out of the
Expand All @@ -233,8 +280,7 @@ Notice that this software emulator is incredibly slow and needs a lot of disk sp
Using a real device works better.


================================================================================
Troubleshooting
Troubleshooting
================================================================================

You can see if adb can see any devices with the following command:
Expand Down Expand Up @@ -313,8 +359,7 @@ If you need to build without optimization turned on, you can create a file calle
APP_OPTIM := debug


================================================================================
Memory debugging
Memory debugging
================================================================================

The best (and slowest) way to debug memory issues on Android is valgrind.
Expand Down Expand Up @@ -365,8 +410,7 @@ When you're done instrumenting with valgrind, you can disable the wrapper:
adb shell setprop wrap.org.libsdl.app ""


================================================================================
Graphics debugging
Graphics debugging
================================================================================

If you are developing on a compatible Tegra-based tablet, NVidia provides
Expand All @@ -379,18 +423,16 @@ The Tegra Graphics Debugger is available from NVidia here:
https://developer.nvidia.com/tegra-graphics-debugger


================================================================================
Why is API level 14 the minimum required?
Why is API level 16 the minimum required?
================================================================================

The latest NDK toolchain doesn't support targeting earlier than API level 14.
The latest NDK toolchain doesn't support targeting earlier than API level 16.
As of this writing, according to https://developer.android.com/about/dashboards/index.html
about 99% of the Android devices accessing Google Play support API level 14 or
higher (October 2017).
about 99% of the Android devices accessing Google Play support API level 16 or
higher (January 2018).


================================================================================
A note regarding the use of the "dirty rectangles" rendering technique
A note regarding the use of the "dirty rectangles" rendering technique
================================================================================

If your app uses a variation of the "dirty rectangles" rendering technique,
Expand All @@ -408,8 +450,24 @@ screen each frame.
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html


Ending your application
================================================================================
Known issues

Two legitimate ways:

- return from your main() function. Java side will automatically terminate the
Activity by calling Activity.finish().

- Android OS can decide to terminate your application by calling onDestroy()
(see Activity life cycle). Your application will receive a SDL_QUIT event you
can handle to save things and quit.

Don't call exit() as it stops the activity badly.

NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
SDLK_AC_BACK, for any purpose.

Known issues
================================================================================

- The number of buttons reported for each joystick is hardcoded to be 36, which
Expand Down
Loading

0 comments on commit 5e3ab5d

Please sign in to comment.