Skip to content

Commit

Permalink
Launcher: move shortcut from menu to tab1
Browse files Browse the repository at this point in the history
  • Loading branch information
glKarin committed Nov 8, 2024
1 parent 5ad9d97 commit 00a2eec
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 66 deletions.
Empty file.
10 changes: 6 additions & 4 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ on:
push:
branches: [ "master" ]
paths:
- 'idTech4Amm/**'
- 'Q3E/**'
#- 'idTech4Amm/**'
#- 'Q3E/**'
- '.github/workflows/android.yml'
- '.github/workflows/android.changelog'
pull_request:
branches: [ "master" ]
paths:
- 'idTech4Amm/**'
- 'Q3E/**'
#- 'idTech4Amm/**'
#- 'Q3E/**'
- '.github/workflows/android.yml'
- '.github/workflows/android.changelog'

jobs:
build-android:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/win_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,23 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
sudo dpkg --add-architecture i386
sudo apt install -y gcc-multilib g++-multilib libsdl2-dev libopenal-dev # zlib1g-dev # libcurl4-openssl-dev
sudo apt install -y gcc-multilib g++-multilib libopenal-dev libsdl2-dev # libwayland-dev libxext-dev # zlib1g-dev libcurl4-openssl-dev
# - name: Download SDL2(Linux)
# if: matrix.os == 'ubuntu-latest'
# run: |
# cd Q3E/src/main/jni/doom3/neo/externlibs
# cd SDL2
# wget https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-2.30.9.tar.gz
# tar zxvf SDL2-2.30.9.tar.gz -C SDL2
# mv SDL2/SDL2-2.30.9/* SDL2/
# ls SDL2

- name: Configure project with CMake(Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cd Q3E/src/main/jni/doom3/neo
cmake -B ${{ steps.strings.outputs.name }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_SHARED_LINKER_FLAGS=-m${{ matrix.bits }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DUSE_MINIZ=ON CMakeLists.txt # -DBUILD_D3_MOD=OFF -DBUILD_Q4=OFF -DBUILD_PREY=OFF -DBUILD_Q4_MOD=OFF
cmake -B ${{ steps.strings.outputs.name }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_SHARED_LINKER_FLAGS=-m${{ matrix.bits }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DUSE_MINIZ=ON -DUSE_LOCAL_SDL=OFF CMakeLists.txt # -DBUILD_D3_MOD=OFF -DBUILD_Q4=OFF -DBUILD_PREY=OFF -DBUILD_Q4_MOD=OFF
- name: Build with Make/Ninja
run: |
Expand Down Expand Up @@ -182,5 +192,4 @@ jobs:
prerelease: true
title: "[${{steps.release_datetime.outputs.time}}] Windows/Linux testing (Non-release. Automatic CI builds)"
files: |
idTech4A++-testing_win*.zip
idTech4A++-testing_linux*.tar.gz
idTech4A++-testing_*
39 changes: 25 additions & 14 deletions Q3E/src/main/jni/doom3/neo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ option(DEDICATED "Build the dedicated server" OFF)
option(ONATIVE "Optimize for the host CPU" OFF)
option(REPRODUCIBLE_BUILD "Replace __DATE__ and __TIME__ by hardcoded values for reproducible builds" OFF)
option(CONSOLE "Run on console" OFF)
if(LINUX)
if(LINUX AND NOT ANDROID)
option(USE_X11 "Use X11" OFF) # else SDL2
option(USE_LOCAL_SDL "Use local SDL library" OFF) # else system
endif()

# For dev: Quick build
Expand Down Expand Up @@ -554,19 +555,29 @@ else() #TODO linux
message(STATUS "use X11 + EGL")
set(sys_libs ${sys_libs} X11 EGL)
else() # SDL2
find_package(SDL2)
if(SDL2_FOUND)
set(LINUX_SDL TRUE)
message(STATUS "use SDL2")
include_directories(${SDL2_INCLUDE_DIRS})
set(SDLx_LIBRARY ${SDL2_LIBRARIES})
add_definitions(-D_SDL)
set(sys_libs ${sys_libs} ${SDLx_LIBRARY})
else()
set(LINUX_SDL FALSE)
message(STATUS "SDL2 not found, using X11 + EGL")
set(sys_libs ${sys_libs} X11 EGL)
endif()
if(USE_LOCAL_SDL)
add_subdirectory(externlibs/SDL2)
set(LINUX_SDL TRUE)
message(STATUS "use local SDL2")
include_directories(externlibs/SDL2/include)
set(SDLx_LIBRARY "SDL2::SDL2")
add_definitions(-D_SDL)
set(sys_libs ${sys_libs} ${SDLx_LIBRARY})
else()
find_package(SDL2)
if(SDL2_FOUND)
set(LINUX_SDL TRUE)
message(STATUS "use system SDL2")
include_directories(${SDL2_INCLUDE_DIRS})
set(SDLx_LIBRARY ${SDL2_LIBRARIES})
add_definitions(-D_SDL)
set(sys_libs ${sys_libs} ${SDLx_LIBRARY})
else()
set(LINUX_SDL FALSE)
message(STATUS "SDL2 not found, using X11 + EGL")
set(sys_libs ${sys_libs} X11 EGL)
endif()
endif()
endif()
if(NOT USE_MINIZ)
set(sys_libs ${sys_libs} z)
Expand Down
66 changes: 34 additions & 32 deletions Q3E/src/main/jni/doom3bfg/neo/idlib/DataQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,39 +95,41 @@ idDataQueue::Append
template< int maxItems, int maxBuffer >
bool idDataQueue< maxItems, maxBuffer >::Append( int sequence, const byte* b1, int b1Len, const byte* b2, int b2Len )
{
#if !defined(__ANDROID__) && defined(__linux__)
#define ARTEMS2_FIX //ArtemS2 fix :)
#endif
#ifdef ARTEMS2_FIX
if (b1 == NULL || b1Len < 0) {
return false;
}
if (b2 == NULL) {
b2Len = 0;
}
#endif

if (b1 == NULL || b1Len < 0) {
return false;
}


if (b2 == NULL) {
b2Len = 0;
}

if (items.Num() == items.Max()) {
return false;
}
if (dataLength + b1Len + b2Len >= maxBuffer) {
return false;
}

msgItem_t& item = *items.Alloc();
item.length = b1Len + b2Len;
item.sequence = sequence;
item.dataOffset = dataLength;


memcpy(data + dataLength, b1, b1Len);
dataLength += b1Len;


if (b2Len > 0) {
memcpy(data + dataLength, b2, b2Len);
dataLength += b2Len;
}
//ArtemS2 fix :)
return true;
if( items.Num() == items.Max() )
{
return false;
}
if( dataLength + b1Len + b2Len >= maxBuffer )
{
return false;
}
msgItem_t& item = *items.Alloc();
item.length = b1Len + b2Len;
item.sequence = sequence;
item.dataOffset = dataLength;
memcpy( data + dataLength, b1, b1Len );
dataLength += b1Len;
#ifdef ARTEMS2_FIX
if (b2Len > 0) {
#endif
memcpy( data + dataLength, b2, b2Len );
dataLength += b2Len;
#ifdef ARTEMS2_FIX
}
#endif
return true;
}

#endif // DATAQUEUE_H
11 changes: 9 additions & 2 deletions idTech4Amm/src/main/java/com/n0n3m4/DIII4A/GameLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,10 @@ else if (id == R.id.launcher_tab1_command_record)
{
OpenCommandChooser();
}
else if (id == R.id.launcher_tab1_create_shortcut)
{
OpenShortcutWithCommandCreator();
}
else if (id == R.id.show_directory_helper)
{
OpenDirectoryHelper();
Expand Down Expand Up @@ -1398,6 +1402,7 @@ public boolean onEditorAction(TextView view, int id, KeyEvent ev)
V.launcher_tab1_edit_doomconfig.setOnClickListener(m_buttonClickListener);
V.launcher_tab1_edit_cvar.setOnClickListener(m_buttonClickListener);
V.launcher_tab1_command_record.setOnClickListener(m_buttonClickListener);
V.launcher_tab1_create_shortcut.setOnClickListener(m_buttonClickListener);
V.show_directory_helper.setOnClickListener(m_buttonClickListener);

boolean userMod = mPrefs.getBoolean(Q3EUtils.q3ei.GetEnableModPreferenceKey(), false);
Expand Down Expand Up @@ -1910,11 +1915,11 @@ else if (itemId == R.id.main_menu_shortcut)
OpenShortcutCreator();
return true;
}
else if (itemId == R.id.main_menu_shortcut_command)
/* else if (itemId == R.id.main_menu_shortcut_command)
{
OpenShortcutWithCommandCreator();
return true;
}
}*/

else if (itemId == R.id.main_menu_game_doom3)
{
Expand Down Expand Up @@ -3571,6 +3576,7 @@ private class ViewHolder
public TextView tv_scale_current;
public LinearLayout res_scale_layout;
public Button launcher_tab1_command_record;
public Button launcher_tab1_create_shortcut;
public CheckBox image_useetc2;
public EditText edt_harm_r_specularExponentBlinnPhong;
public EditText edt_harm_r_specularExponentPBR;
Expand Down Expand Up @@ -3686,6 +3692,7 @@ public void Setup()
tv_scale_current = findViewById(R.id.tv_scale_current);
res_scale_layout = findViewById(R.id.res_scale_layout);
launcher_tab1_command_record = findViewById(R.id.launcher_tab1_command_record);
launcher_tab1_create_shortcut = findViewById(R.id.launcher_tab1_create_shortcut);
image_useetc2 = findViewById(R.id.image_useetc2);
edt_harm_r_specularExponentBlinnPhong = findViewById(R.id.edt_harm_r_specularExponentBlinnPhong);
edt_harm_r_specularExponentPBR = findViewById(R.id.edt_harm_r_specularExponentPBR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ public void Start(Bundle data)

public void run()
{
final List<CharSequence> items = new ArrayList<>();
final List<String> values = new ArrayList<>();
final CharSequence[] items = new CharSequence[GameManager.Games.length];
final String[] values = new String[GameManager.Games.length];
// Map<String, Integer> pinnedShortcuts = GetPinnedShortcuts();
int selected = -1;
for(int i = 0; i < GameManager.Games.length; i++)
{
String game = GameManager.Games[i];
items.add(Tr(GameManager.GetGameNameRS(game)));
values.add(game);
items[i] = Tr(GameManager.GetGameNameRS(game));
values[i] = game;
if(game.equals(m_game))
selected = i;
}

AlertDialog.Builder builder = new AlertDialog.Builder(m_gameLauncher);
builder.setTitle(R.string.create_desktop_shortcut);
builder.setSingleChoiceItems(items.toArray(new CharSequence[0]), selected, new DialogInterface.OnClickListener(){
builder.setSingleChoiceItems(items, selected, new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int p)
{
String g = values.get(p);
String g = values[p];
UpdateDialogButtonState((AlertDialog)dialog, g);
}
});
Expand Down
12 changes: 10 additions & 2 deletions idTech4Amm/src/main/res/layout/launcher_tab1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -934,15 +934,23 @@
android:id="@+id/launcher_tab1_command_record"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_weight="0.33"
android:text="@string/command_record"
android:textAllCaps="false" />

<Button
android:id="@+id/launcher_tab1_create_shortcut"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.34"
android:text="@string/commandshortcut"
android:textAllCaps="false" />

<Button
android:id="@+id/launcher_tab1_edit_cvar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_weight="0.33"
android:text="@string/edit_cvar"
android:textAllCaps="false" />
</LinearLayout>
Expand Down
4 changes: 2 additions & 2 deletions idTech4Amm/src/main/res/menu/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@
android:id="@+id/main_menu_shortcut"
android:title="@string/shortcut"
android:showAsAction="never"/>
<item
<!-- <item
android:id="@+id/main_menu_shortcut_command"
android:title="@string/command_shortcut"
android:showAsAction="never"/>
android:showAsAction="never"/>-->
</menu>
</item>

Expand Down
1 change: 1 addition & 0 deletions idTech4Amm/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,5 +415,6 @@
<string name="shodow_cg_shadows">Shodow(cg_shadows)</string>
<string name="renderer_vid_renderer">Renderer(vid_renderer)</string>
<string name="cache_compression_texture_harm_image_usecompressioncache">Cache compression texture(harm_image_useCompressionCache)</string>
<string name="commandshortcut">Command shortcut</string>

</resources>
1 change: 1 addition & 0 deletions idTech4Amm/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,5 @@
<string name="shodow_cg_shadows">阴影(cg_shadows)</string>
<string name="renderer_vid_renderer">渲染器(vid_renderer)</string>
<string name="cache_compression_texture_harm_image_usecompressioncache">缓存压缩纹理(harm_image_useCompressionCache)</string>
<string name="commandshortcut">命令快捷方式</string>
</resources>
1 change: 1 addition & 0 deletions idTech4Amm/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -418,5 +418,6 @@
<string name="shodow_cg_shadows">Shodow(cg_shadows)</string>
<string name="renderer_vid_renderer">Renderer(vid_renderer)</string>
<string name="cache_compression_texture_harm_image_usecompressioncache">Cache compression texture(harm_image_useCompressionCache)</string>
<string name="commandshortcut">Command shortcut</string>

</resources>

0 comments on commit 00a2eec

Please sign in to comment.