Compare commits

..
Author SHA1 Message Date
Eva Isabella Luna b12ad04815 Discontinued 2025-09-23 14:12:28 -06:00
MovTery 6eb830ba7a Fix(DownloadUtils): Set Read Timeout Duration (#6504)
* Fix[DownloadUtils]: Set Read Timeout Duration
Pojav has not set a timeout for downloading files, which results in situations where file downloads do not throw an exception or terminate even after timing out.

* Update DownloadUtils.java
2025-04-18 20:56:13 +02:00
TarikBR 42c1c98c21 fix(log): log4j with incorrect configuration (#6822)
* fix[log]: log4j with incorrect configuration, mostly in newer minecraft versions

* fix[log]: add xml configuration for minecraft 1.21.2+

* refactor[log] improved getLog4jConfiguration()

* refactor[log]: just change version number instead unpacking in a method to get the log4j config
2025-04-18 20:55:40 +02:00
Eva Isabella Luna 3b4364bca2 Bump dawidd/actions-download-artifact to v9 (dependabot alert) 2025-04-14 15:13:46 -06:00
TarikBR 093c810e9f fix[demo]: being able to access the hidden demo folder (#6827)
* fix[demo]: button to open the game directory allowing access to the hidden demo folder

* fix[demo]: switching accounts being able to access hidden folder
2025-04-14 14:56:40 -06:00
alexytomi dcc2b95f54 Undo removal of force close button in-game (#6823)
Reverts commit 19dc51f (cleanup: remove unneeded menu entry)

Even if it closes when swiping away the app, there are cases where you
cannot swipe it away, or even bring up the navigation bar.
2025-04-13 15:11:27 -06:00
7c9c076105 Update README.md (#6590)
* Update README.md

* Update README.md

* Crystall1nedev's changes #1

* Small tweaks

---------

Co-authored-by: Dev1ss0 <[email protected]>
Co-authored-by: Eva Isabella Luna <[email protected]>
2025-04-11 14:47:37 -06:00
TarikBR a6f3fc0606 New demo mode and local mode reimplementation (#6819)
* feat: demo mode when using local account

* refactor[demo]: do not allow local account download the game and switch game dir when is demo, use DateUtils instead creating another date checker

* fix[demo]: require activity from optifine installer fragment to minecraft downloader verify if is a local account
2025-04-11 14:33:01 -06:00
alexytomi 2387817f4f Fix last PR's issues with building (#6773)
* fix(submodules): Remove broken, unused gl4es submodule

* fix(build): Git checks had typo

version also gets updated here because I changed their build.gradle
2025-03-29 19:26:57 -06:00
alexytomiandItsWinterBush 98947f23d3 Downgrade zink + some other fixes (#6752)
* [Actions]: Remove private token and use public release (#6742)

* Feat[zink]: Downgrade to Mesa 23.0.4 from Questcraft

This reverts commit f88fb3c61a.

Mali devices are severely screwed over by this change.

* [Misc]: Make reading custom_env.txt better

This makes it override anything that could be set by the launcher, which
is the point. Also it looks cleaner imo.

* [Misc]: Turn component version file into commit hash of project folder

I'm really annoyed at how the version file keeps changing and it seems
dumb

* fix(actions): Upgrade workflow Java version from 8 to 21

Using 8 is causing some really weird unreproducable shitfuckery that is
likely related to caches.

Co-authored-by: ItsWinterBush <[email protected]>

* enhancement(build): Explicitly clone submodules recursively

* fix(build): Update Gradle to 8.13

This is to fix `aar-metadata.properties (No such file or directory)`

See https://github.com/leancodepl/patrol/issues/2181 for similar issue

* enhancement(build): Add git checks to prevent build errors

---------

Co-authored-by: ItsWinterBush <[email protected]>
2025-03-29 11:25:18 -06:00
alexytomi b239d06745 [Actions] Remove private token and use public release (#6742) 2025-03-23 02:53:46 -06:00
Mathias-Boulay 3733f9cdd4 fix(gamepad): handle dpad events without associated device 2025-03-02 23:27:18 +01:00
Maksim Belov e49222380f Feat[downloader]: download and extract native libraries (#6629) 2025-02-20 21:39:34 +03:00
32 changed files with 369 additions and 235 deletions

No files matched your search

+12 -16
View File
@@ -18,28 +18,24 @@ jobs:
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Set up JDK 8
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
java-version: '21'
- name: Get LTW
uses: dawidd6/action-download-artifact@v2
continue-on-error: true
with:
github_token: ${{secrets.LTW_CLONER_SECRET}}
repo: PojavLauncherTeam/BigTinyWrapper
workflow: android.yml
workflow_conclusion: success
name: output-aar
path: app_pojavlauncher/libs
allow_forks: false
run: |
apt update && apt install wget
cd app_pojavlauncher/libs
wget https://github.com/PojavLauncherTeam/LTW/releases/latest/download/ltw-release.aar
- name: Get JRE 8
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v9
with:
workflow: build.yml
path: app_pojavlauncher/src/main/assets/components/jre
@@ -49,7 +45,7 @@ jobs:
name: jre8-pojav
- name: Get JRE17
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v9
with:
workflow: build.yml
path: app_pojavlauncher/src/main/assets/components/jre-new
@@ -59,7 +55,7 @@ jobs:
name: jre17-pojav
- name: Get JRE21
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v9
with:
workflow: build.yml
path: app_pojavlauncher/src/main/assets/components/jre-21
+118 -102
View File
@@ -1,135 +1,151 @@
<H1 align="center">PojavLauncher</H1>
<h1 align="center">PojavLauncher</h1>
<img src="https://github.com/PojavLauncherTeam/PojavLauncher/blob/v3_openjdk/app_pojavlauncher/src/main/assets/pojavlauncher.png" align="left" width="130" height="150" alt="PojavLauncher logo">
[![Android CI](https://github.com/PojavLauncherTeam/PojavLauncher/workflows/Android%20CI/badge.svg)](https://github.com/PojavLauncherTeam/PojavLauncher/actions)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/PojavLauncherTeam/PojavLauncher)](https://github.com/PojavLauncherTeam/PojavLauncher/actions)
[![Crowdin](https://badges.crowdin.net/pojavlauncher/localized.svg)](https://crowdin.com/project/pojavlauncher)
[![Discord](https://img.shields.io/discord/724163890803638273.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.com/invite/aenk3EUvER)
[![Discord](https://img.shields.io/discord/724163890803638273.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.com/invite/aenk3EUvER)
[![Twitter Follow](https://img.shields.io/twitter/follow/plaunchteam?color=blue&style=flat-square)](https://twitter.com/PLaunchTeam)
* From [Boardwalk](https://github.com/zhuowei/Boardwalk)'s ashes here comes PojavLauncher!
*From [Boardwalk](https://github.com/zhuowei/Boardwalk)'s ashes here comes PojavLauncher!*
* PojavLauncher is a launcher that allows you to play Minecraft: Java Edition on your Android device!
PojavLauncher is a launcher that allows you to play Minecraft: Java Edition on your Android and [iOS](https://github.com/PojavLauncherTeam/PojavLauncher_iOS) devices.
* It can run almost every version of Minecraft, allowing you to use .jar only installers to install modloaders such as [Forge](https://files.minecraftforge.net/) and [Fabric](http://fabricmc.net/), mods like [OptiFine](https://optifine.net) and [LabyMod](https://www.labymod.net/en), as well as hack clients like [Wurst](https://www.wurstclient.net/), and much more!
For more details, check out our [wiki](https://pojavlauncher.app/)!
* For more details [check out our wiki](https://pojavlauncherteam.github.io/)
## Some notes to start with
- We do not have an official TikTok account. No one from the dev team makes TikTok videos.
- The official Twitter for PojavLauncher is [@PLaunchTeam](https://twitter.com/PLaunchTeam). Any others (most notably @PojavLauncher) are fake.
## Important Notes
## Navigation
- [Introduction](#introduction)
- [Getting PojavLauncher](#getting-pojavlauncher)
- [Building](#building)
- [Current status](#current-status)
- [License](#license)
- [Contributing](#contributing)
- [Credits & Third party components and their licenses](#credits--third-party-components-and-their-licenses-if-available)
**PojavLauncher has been discontinued** and is no longer supported. Its successor is available [here](https://github.com/AngelAuraMC/Amethyst-Android).
## Introduction
* PojavLauncher is a Minecraft: Java Edition launcher for Android and iOS based on [Boardwalk](https://github.com/zhuowei/Boardwalk).
* This launcher can launch almost all available Minecraft versions ranging from rd-132211 to 1.21 snapshots (including Combat Test versions).
* Modding via Forge and Fabric are also supported.
* This repository contains source code for Android.
* For iOS/iPadOS, check out [PojavLauncher_iOS](https://github.com/PojavLauncherTeam/PojavLauncher_iOS).
## Table of Contents
* [Introduction](#introduction)
* [Getting PojavLauncher](#getting-pojavlauncher)
* [Building](#building)
* [Quick Build (Recommended)](#quick-build-recommended)
* [Detailed Build](#detailed-build)
* [Current Status](#current-status)
* [Known Issues](#known-issues)
* [FAQ](#faq)
* [Contributing](#contributing)
* [Support](#support)
* [License](#license)
* [Credits & Dependencies](#credits--dependencies)
* [Roadmap](#roadmap)
## Introduction
* PojavLauncher is a Minecraft: Java Edition launcher for Android and iOS based on [Boardwalk](https://github.com/zhuowei/Boardwalk)
* This launcher can launch almost all available Minecraft versions ranging from rd-132211 to 1.21 snapshots (including Combat Test versions)
* Modding via Forge and Fabric are also supported.
* This repository contains source code for Android. For iOS/iPadOS, check out [PojavLauncher_iOS](https://github.com/PojavLauncherTeam/PojavLauncher_iOS).
## Getting PojavLauncher
You can get PojavLauncher via three methods:
1. You can get the prebuilt app from [stable releases](https://github.com/PojavLauncherTeam/PojavLauncher/releases) or [automatic builds](https://github.com/PojavLauncherTeam/PojavLauncher/actions).
1. **Releases:** Download the prebuilt app from our [stable releases](https://github.com/PojavLauncherTeam/PojavLauncher/releases) or [automatic builds](https://github.com/PojavLauncherTeam/PojavLauncher/actions).
2. **Google Play:** Get it from Google Play by clicking on this badge: [![Google Play](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=net.kdt.pojavlaunch)
3. **Build from Source:** Follow the [building instructions](#building) below.
2. You can get it from Google Play by clicking on this badge:
[![Google Play](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=net.kdt.pojavlaunch)
3. You can [build](#building) from source.
## Building
If you want to build from source code, follow the steps below.
### Java Runtime Environment (JRE)
- JRE for Android is [here](https://github.com/PojavLauncherTeam/openjdk-multiarch-jdk8u), and the build script is [here](https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch).
- Follow build instruction on build script [README.md](https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/blob/buildjre8/README.md).
- You can also get [CI auto builds](https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/actions) if you are lazy or are failing to build it for some reason.
* Either get the `jre8-pojav` artifact from auto builds, or split all artifacts by yourself:</br>
- Get JREs for all of 4 supported architectures (arm, arm64, x86, x86_64) </br>
- Split JRE into parts:</br>
Platform-independent: .jar files, libraries, configs, etc...</br>
Platform-dependent: .so files, etc...</br>
- Create:</br>
A file named `universal.tar.xz` with all platform-independent files</br>
4 files named `bin-<arch>.tar.xz` with all platform-dependent files per-architecture</br>
- Put these in the `assets/components/jre/` folder</br>
- (If needed) update the Version file with the current date</br>
### LWJGL
The build instructions for the custom LWJGL are available over the [LWJGL repository](https://github.com/PojavLauncherTeam/lwjgl3)
### Quick Build (Recommended)
### The Launcher
- Because languages are auto-added by Crowdin, you need to run the language list generator before building. In the project directory, run:
The easiest way to build PojavLauncher is to use the pre-built JREs provided by our CI.
* On Linux, Mac OS:
```
chmod +x scripts/languagelist_updater.sh
bash scripts/languagelist_updater.sh
```
* On Windows:
```
scripts\languagelist_updater.bat
```
Then, run these commands ~~or build using Android Studio~~.
1. Clone the repository: `git clone https://github.com/PojavLauncherTeam/PojavLauncher.git`
2. Build the launcher: `./gradlew :app_pojavlauncher:assembleDebug` (Use `gradlew.bat` on Windows)
* Build GLFW stub:
```
./gradlew :jre_lwjgl3glfw:build
```
* Build the launcher
```
./gradlew :app_pojavlauncher:assembleDebug
```
(Replace `gradlew` with `gradlew.bat` if you are building on Windows).
The built APK will be located in `app_pojavlauncher/build/outputs/apk/debug/`.
## Current status
- [x] ~~OpenJDK 9 Mobile port: ARM32, ARM64, x86, x86_64.~~ Replaced by JRE8.
- [x] OpenJDK 8 Mobile port: ARM32, ARM64, x86, x86_64
- [x] OpenJDK 17 Mobile port: ARM32, ARM64, x86, x86_64
- [x] Headless mod installer
- [x] Mod installer with GUI. Used `Caciocavallo` project for AWT without X11.
- [x] OpenGL in OpenJDK environment
- [x] OpenAL (works on most devices)
- [x] Support for Minecraft 1.12.2 and below. Used [lwjglx](https://github.com/PojavLauncherTeam/lwjglx), a LWJGL2 compatibility layer for LWJGL3.
- [x] Support for Minecraft 1.13 and above. Used [GLFW stub](https://github.com/PojavLauncherTeam/lwjgl3-glfw-java).
- [x] Support for Minecraft 1.17 (22w13a to be exact) and above. Used [Holy GL4ES](https://github.com/PojavLauncherTeam/gl4es-114-extra)
- [x] Game surface zooming.
- [x] New input pipe rewritten to native code to boost performance.
- [x] Rewritten entire controls system (thanks to @Mathias-Boulay)
- [ ] More to come!
### Detailed Build
If you need more control over the build process, follow these steps:
1. **Java Runtime Environment (JRE):** Download the `jre8-pojav` artifact from our [CI auto builds](https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/actions). This package contains pre-built JREs for all supported architectures. If you need to build the JRE yourself, follow the instructions in the [android-openjdk-build-multiarch](https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch) repository.
2. **LWJGL:** The build instructions for the custom LWJGL are available over the [LWJGL repository](https://github.com/PojavLauncherTeam/lwjgl3).
3. **Language List:** Because languages are auto-added by Crowdin, you need to run the language list generator before building. In the project directory, run:
* Linux/macOS:
```bash
chmod +x scripts/languagelist_updater.sh
bash scripts/languagelist_updater.sh
```
* Windows:
```batch
scripts\languagelist_updater.bat
```
4. **Build GLFW stub:** `./gradlew :jre_lwjgl3glfw:build`
5. **Build the launcher:** `./gradlew :app_pojavlauncher:assembleDebug` (Replace `gradlew` with `gradlew.bat` on Windows).
## Current Status
* [x] OpenJDK 8 Mobile port: ARM32, ARM64, x86, x86_64
* [x] OpenJDK 17 Mobile port: ARM32, ARM64, x86, x86_64
* [x] OpenJDK 21 Mobile port: ARM32, ARM64, x86, x86_64
* [x] Headless mod installer
* [x] Mod installer with GUI
* [x] OpenGL in OpenJDK environment
* [x] OpenAL (works on most devices)
* [x] Support for Minecraft 1.12.2 and below
* [x] Support for Minecraft 1.13 and above
* [x] Support for Minecraft 1.17 (22w13a) and above
* [x] Game surface zooming
* [x] New input pipe rewritten to native code
* [x] Rewritten entire controls system
* [ ] More to come!
## Known Issues
- Controller mods aren't working.
- Random crashes could happen very often on Android 5.x when loading the game or joining a world.
- With big modpacks textures could be messed up
- Probably more, that's why we have a bug tracker ;)
## License
- PojavLauncher is licensed under [GNU LGPLv3](https://github.com/PojavLauncherTeam/PojavLauncher/blob/v3_openjdk/LICENSE).
See our [issue tracker](https://github.com/PojavLauncherTeam/PojavLauncher/issues) for a list of known issues and their current status.
## FAQ
See our [wiki](https://pojavlauncherteam.github.io/) for more information.
## Contributing
Contributions are welcome! We welcome any type of contribution, not only code. For example, you can help the wiki shape up. You can help the [translation](https://crowdin.com/project/pojavlauncher) too!
Contributions are welcome! We welcome any type of contribution, not only code. For example, you can help improve the [wiki](https://pojavlauncherteam.github.io/), contribute to the [translations](https://crowdin.com/project/pojavlauncher), or submit bug reports and feature requests.
Any code change to this repository (or iOS) should be submitted as a pull request. The description should explain what the code does and give steps to execute it.
Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it.
## Credits & Third party components and their licenses (if available)
- [Boardwalk](https://github.com/zhuowei/Boardwalk) (JVM Launcher): Unknown License/[Apache License 2.0](https://github.com/zhuowei/Boardwalk/blob/master/LICENSE) or GNU GPLv2.
- Android Support Libraries: [Apache License 2.0](https://android.googlesource.com/platform/prebuilts/maven_repo/android/+/master/NOTICE.txt).
- [GL4ES](https://github.com/PojavLauncherTeam/gl4es): [MIT License](https://github.com/ptitSeb/gl4es/blob/master/LICENSE).<br>
- [OpenJDK](https://github.com/PojavLauncherTeam/openjdk-multiarch-jdk8u): [GNU GPLv2 License](https://openjdk.java.net/legal/gplv2+ce.html).<br>
- [LWJGL3](https://github.com/PojavLauncherTeam/lwjgl3): [BSD-3 License](https://github.com/LWJGL/lwjgl3/blob/master/LICENSE.md).
- [LWJGLX](https://github.com/PojavLauncherTeam/lwjglx) (LWJGL2 API compatibility layer for LWJGL3): unknown license.<br>
- [Mesa 3D Graphics Library](https://gitlab.freedesktop.org/mesa/mesa): [MIT License](https://docs.mesa3d.org/license.html).
- [pro-grade](https://github.com/pro-grade/pro-grade) (Java sandboxing security manager): [Apache License 2.0](https://github.com/pro-grade/pro-grade/blob/master/LICENSE.txt).
- [bhook](https://github.com/bytedance/bhook) (Used for exit code trapping): [MIT license](https://github.com/bytedance/bhook/blob/main/LICENSE).
- [libepoxy](https://github.com/anholt/libepoxy): [MIT License](https://github.com/anholt/libepoxy/blob/master/COPYING).
- [virglrenderer](https://github.com/PojavLauncherTeam/virglrenderer): [MIT License](https://gitlab.freedesktop.org/virgl/virglrenderer/-/blob/master/COPYING).
- Thanks to [MCHeads](https://mc-heads.net) for providing Minecraft avatars.
## Support
For support, please join our [Discord server](https://discord.com/invite/aenk3EUvER).
## License
PojavLauncher is licensed under [GNU LGPLv3](https://github.com/PojavLauncherTeam/PojavLauncher/blob/v3_openjdk/LICENSE).
## Credits & Dependencies
* [Boardwalk](https://github.com/zhuowei/Boardwalk) (JVM Launcher): Unknown License/[Apache License 2.0](https://github.com/zhuowei/Boardwalk/blob/master/LICENSE) or GNU GPLv2.
* Android Support Libraries: [Apache License 2.0](https://android.googlesource.com/platform/prebuilts/maven_repo/android/+/master/NOTICE.txt).
* [GL4ES](https://github.com/PojavLauncherTeam/gl4es): [MIT License](https://github.com/ptitSeb/gl4es/blob/master/LICENSE).
* [OpenJDK](https://github.com/PojavLauncherTeam/openjdk-multiarch-jdk8u): [GNU GPLv2 License](https://openjdk.java.net/legal/gplv2+ce.html).
* [LWJGL3](https://github.com/PojavLauncherTeam/lwjgl3): [BSD-3 License](https://github.com/LWJGL/lwjgl3/blob/master/LICENSE.md).
* [LWJGLX](https://github.com/PojavLauncherTeam/lwjglx) (LWJGL2 API compatibility layer for LWJGL3): unknown license.
* [Mesa 3D Graphics Library](https://gitlab.freedesktop.org/mesa/mesa): [MIT License](https://docs.mesa3d.org/license.html).
* [pro-grade](https://github.com/pro-grade/pro-grade) (Java sandboxing security manager): [Apache License 2.0](https://github.com/pro-grade/pro-grade/blob/master/LICENSE.txt).
* [bhook](https://github.com/bytedance/bhook) (Used for exit code trapping): [MIT license](https://github.com/bytedance/bhook/blob/main/LICENSE).
* [libepoxy](https://github.com/anholt/libepoxy): [MIT License](https://github.com/anholt/libepoxy/blob/master/COPYING).
* [virglrenderer](https://github.com/PojavLauncherTeam/virglrenderer): [MIT License](https://gitlab.freedesktop.org/virgl/virglrenderer/-/blob/master/COPYING).
* Thanks to [MCHeads](https://mc-heads.net) for providing Minecraft avatars.
## Roadmap
We are currently focusing on:
* Exploring new rendering technologies.
Future plans include:
* Improving stability and performance.
* Enhancing the mod installation experience.
We welcome community feedback and suggestions for our roadmap. Please feel free to open a feature request in our [issue tracker](https://github.com/PojavLauncherTeam/PojavLauncher/issues).
@@ -1 +1 @@
1738839797928
98947f23d338012c5869dc13de31cb39dadba333
@@ -1 +1 @@
1738839797913
98947f23d338012c5869dc13de31cb39dadba333
@@ -1 +1 @@
1738839797921
98947f23d338012c5869dc13de31cb39dadba333
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="SysOut" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
</Policies>
</Console>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
</Policies>
</RollingRandomAccessFile>
<Listener name="Tracy">
<PatternLayout pattern="(%F:%L): %msg{nolookups}%n"/>
</Listener>
</Appenders>
<Loggers>
<Root level="info">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
<AppenderRef ref="SysOut"/>
<AppenderRef ref="File"/>
<AppenderRef ref="Tracy"/>
</Root>
</Loggers>
</Configuration>
@@ -1 +1 @@
1
2
@@ -43,11 +43,13 @@ import net.kdt.pojavlaunch.services.ProgressServiceKeeper;
import net.kdt.pojavlaunch.tasks.AsyncMinecraftDownloader;
import net.kdt.pojavlaunch.tasks.AsyncVersionList;
import net.kdt.pojavlaunch.tasks.MinecraftDownloader;
import net.kdt.pojavlaunch.utils.DateUtils;
import net.kdt.pojavlaunch.utils.NotificationUtils;
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
import java.lang.ref.WeakReference;
import java.text.ParseException;
public class LauncherActivity extends BaseActivity {
public static final String SETTING_FRAGMENT_TAG = "SETTINGS_FRAGMENT";
@@ -125,6 +127,23 @@ public class LauncherActivity extends BaseActivity {
}
String normalizedVersionId = AsyncMinecraftDownloader.normalizeVersionId(prof.lastVersionId);
JMinecraftVersionList.Version mcVersion = AsyncMinecraftDownloader.getListedVersion(normalizedVersionId);
// Do not load when is a modded version or older than minecraft 1.3 on demo account
if (mAccountSpinner.getSelectedAccount().isDemo()) {
boolean isOlderThan13 = true;
if (mcVersion != null) {
try {
isOlderThan13 = DateUtils.dateBefore(DateUtils.parseReleaseDate(mcVersion.releaseTime), 2012, 6, 22);
} catch (ParseException ignored) {}
}
if (isOlderThan13) {
Toast.makeText(this, R.string.toast_not_available_demo, Toast.LENGTH_LONG).show();
return false;
}
}
new MinecraftDownloader().start(
this,
mcVersion,
@@ -1,6 +1,7 @@
package net.kdt.pojavlaunch;
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
import static net.kdt.pojavlaunch.Tools.dialogForceClose;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_ENABLE_GYRO;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_SUSTAINED_PERFORMANCE;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_USE_ALTERNATE_SURFACE;
@@ -190,10 +191,11 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.menu_ingame));
gameActionClickListener = (parent, view, position, id) -> {
switch(position) {
case 0: openLogOutput(); break;
case 1: dialogSendCustomKey(); break;
case 2: openQuickSettings(); break;
case 3: openCustomControls(); break;
case 0: dialogForceClose(MainActivity.this); break;
case 1: openLogOutput(); break;
case 2: dialogSendCustomKey(); break;
case 3: openQuickSettings(); break;
case 4: openCustomControls(); break;
}
drawerLayout.closeDrawers();
};
@@ -118,6 +118,7 @@ public final class Tools {
public static String DIR_ACCOUNT_NEW;
public static String DIR_GAME_HOME = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/PojavLauncher";
public static String DIR_GAME_NEW;
public static String GAME_PROFILES_FILE;
// New since 3.0.0
public static String DIRNAME_HOME_JRE = "lib";
@@ -200,6 +201,8 @@ public final class Tools {
OBSOLETE_RESOURCES_PATH = DIR_GAME_NEW + "/resources";
CTRLMAP_PATH = DIR_GAME_HOME + "/controlmap";
CTRLDEF_FILE = DIR_GAME_HOME + "/controlmap/default.json";
GAME_PROFILES_FILE = Tools.DIR_GAME_NEW + "/launcher_profiles.json";
switchDemo(isDemoProfile(ctx));
}
/**
@@ -461,7 +464,7 @@ public final class Tools {
}
public static String[] getMinecraftClientArgs(MinecraftAccount profile, JMinecraftVersionList.Version versionInfo, File gameDir) {
String username = profile.username;
String username = profile.username.replace("Demo.", "");
String versionName = versionInfo.id;
if (versionInfo.inheritsFrom != null) {
versionName = versionInfo.inheritsFrom;
@@ -506,13 +509,13 @@ public final class Tools {
}
}
return JSONUtils.insertJSONValueList(
splitAndFilterEmpty(
versionInfo.minecraftArguments == null ?
fromStringArray(minecraftArgs.toArray(new String[0])):
versionInfo.minecraftArguments
), varArgMap
);
String mcArguments = versionInfo.minecraftArguments == null ?
fromStringArray(minecraftArgs.toArray(new String[0])):
versionInfo.minecraftArguments;
if(profile.isDemo()) mcArguments += " --demo";
return JSONUtils.insertJSONValueList(splitAndFilterEmpty(mcArguments), varArgMap);
}
public static String fromStringArray(String[] strArr) {
@@ -1413,4 +1416,26 @@ public final class Tools {
}
}).show();
}
public static void switchDemo(boolean isDemo){
if(isDemo) {
DIR_GAME_NEW = DIR_DATA + "/demo/.minecraft";
} else {
DIR_GAME_NEW = DIR_GAME_HOME + "/.minecraft";
}
DIR_HOME_VERSION = DIR_GAME_NEW + "/versions";
DIR_HOME_LIBRARY = DIR_GAME_NEW + "/libraries";
ASSETS_PATH = DIR_GAME_NEW + "/assets";
OBSOLETE_RESOURCES_PATH = DIR_GAME_NEW + "/resources";
}
public static boolean isDemoProfile(Context ctx){
MinecraftAccount currentProfile = PojavProfile.getCurrentProfileContent(ctx, null);
return currentProfile != null && currentProfile.isDemo();
}
public static boolean isLocalProfile(Context ctx){
MinecraftAccount currentProfile = PojavProfile.getCurrentProfileContent(ctx, null);
return currentProfile == null || currentProfile.isLocal();
}
}
@@ -87,17 +87,15 @@ public class MicrosoftBackgroundLogin {
MinecraftAccount acc = MinecraftAccount.load(mcName);
if(acc == null) acc = new MinecraftAccount();
if (doesOwnGame) {
acc.xuid = xsts[0];
acc.clientToken = "0"; /* FIXME */
acc.accessToken = mcToken;
acc.username = mcName;
acc.profileId = mcUuid;
acc.isMicrosoft = true;
acc.msaRefreshToken = msRefreshToken;
acc.expiresAt = expiresAt;
acc.updateSkinFace();
}
acc.xuid = xsts[0];
acc.clientToken = "0"; /* FIXME */
acc.accessToken = mcToken;
acc.username = mcName;
acc.profileId = mcUuid;
acc.isMicrosoft = true;
acc.msaRefreshToken = msRefreshToken;
acc.expiresAt = expiresAt;
acc.updateSkinFace();
acc.save();
if(doneListener != null) {
@@ -298,7 +296,9 @@ public class MicrosoftBackgroundLogin {
}else{
Log.i("MicrosoftLogin","It seems that this Microsoft Account does not own the game.");
doesOwnGame = false;
throw new PresentedException(new RuntimeException(conn.getResponseMessage()), R.string.minecraft_not_owned);
mcName = "Demo.Player";
mcUuid = "00000000-0000-0000-0000-000000000000";
//throw new PresentedException(new RuntimeException(conn.getResponseMessage()), R.string.minecraft_not_owned);
//throwResponseError(conn);
}
}
@@ -2,61 +2,12 @@ package net.kdt.pojavlaunch.customcontrols.gamepad;
import static android.view.InputDevice.KEYBOARD_TYPE_ALPHABETIC;
import static android.view.InputDevice.SOURCE_GAMEPAD;
import static android.view.KeyEvent.KEYCODE_DPAD_CENTER;
import static android.view.KeyEvent.KEYCODE_DPAD_DOWN;
import static android.view.KeyEvent.KEYCODE_DPAD_LEFT;
import static android.view.KeyEvent.KEYCODE_DPAD_RIGHT;
import static android.view.KeyEvent.KEYCODE_DPAD_UP;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
public class GamepadDpad {
private int mLastKeycode = KEYCODE_DPAD_CENTER;
/**
* Convert the event to a 2 int array: keycode and keyAction, similar to a keyEvent
* @param event The motion to convert
* @return int[0] keycode, int[1] keyAction
*/
public int[] convertEvent(MotionEvent event){
// Use the hat axis value to find the D-pad direction
float xaxis = event.getAxisValue(MotionEvent.AXIS_HAT_X);
float yaxis = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
int action = KeyEvent.ACTION_DOWN;
// Check if the AXIS_HAT_X value is -1 or 1, and set the D-pad
// LEFT and RIGHT direction accordingly.
if (Float.compare(xaxis, -1.0f) == 0) {
mLastKeycode = KEYCODE_DPAD_LEFT;
} else if (Float.compare(xaxis, 1.0f) == 0) {
mLastKeycode = KEYCODE_DPAD_RIGHT;
}
// Check if the AXIS_HAT_Y value is -1 or 1, and set the D-pad
// UP and DOWN direction accordingly.
else if (Float.compare(yaxis, -1.0f) == 0) {
mLastKeycode = KEYCODE_DPAD_UP;
} else if (Float.compare(yaxis, 1.0f) == 0) {
mLastKeycode = KEYCODE_DPAD_DOWN;
}else {
//No keycode change
action = KeyEvent.ACTION_UP;
}
return new int[]{mLastKeycode, action};
}
@SuppressWarnings("unused") public static boolean isDpadEvent(MotionEvent event) {
// Check that input comes from a device with directional pads.
// And... also the joystick since it declares sometimes as a joystick.
return (event.getSource() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK;
}
public static boolean isDpadEvent(KeyEvent event){
//return ((event.getSource() & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) && (event.getDevice().getKeyboardType() == KEYBOARD_TYPE_NON_ALPHABETIC);
return event.isFromSource(SOURCE_GAMEPAD) && event.getDevice().getKeyboardType() != KEYBOARD_TYPE_ALPHABETIC;
public static boolean isDpadEvent(KeyEvent event) {
return event.isFromSource(SOURCE_GAMEPAD) && (event.getDevice() == null || event.getDevice().getKeyboardType() != KEYBOARD_TYPE_ALPHABETIC);
}
}
@@ -64,7 +64,15 @@ public class MainMenuFragment extends Fragment {
mShareLogsButton.setOnClickListener((v) -> shareLog(requireContext()));
mOpenDirectoryButton.setOnClickListener((v)-> openPath(v.getContext(), getCurrentProfileDirectory(), false));
mOpenDirectoryButton.setOnClickListener((v)-> {
Tools.switchDemo(Tools.isDemoProfile(v.getContext())); // avoid switching accounts being able to access
if(Tools.isDemoProfile(v.getContext())){
Toast.makeText(v.getContext(), R.string.toast_not_available_demo, Toast.LENGTH_LONG).show();
return;
}
openPath(v.getContext(), getCurrentProfileDirectory(), false);
});
mNewsButton.setOnLongClickListener((v)->{
@@ -89,6 +97,12 @@ public class MainMenuFragment extends Fragment {
}
private void runInstallerWithConfirmation(boolean isCustomArgs) {
// avoid using custom installers to install a version
if(Tools.isLocalProfile(requireContext()) || Tools.isDemoProfile(requireContext())){
Toast.makeText(requireContext(), R.string.toast_not_available_demo, Toast.LENGTH_LONG).show();
return;
}
if (ProgressKeeper.getTaskCount() == 0)
Tools.installMod(requireActivity(), isCustomArgs);
else
@@ -41,7 +41,7 @@ public class OptiFineInstallFragment extends ModVersionListFragment<OptiFineUtil
@Override
public Runnable createDownloadTask(Object selectedVersion, ModloaderListenerProxy listenerProxy) {
return new OptiFineDownloadTask((OptiFineUtils.OptiFineVersion) selectedVersion, listenerProxy);
return new OptiFineDownloadTask((OptiFineUtils.OptiFineVersion) selectedVersion, listenerProxy, requireActivity());
}
@Override
@@ -2,11 +2,13 @@ package net.kdt.pojavlaunch.fragments;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import net.kdt.pojavlaunch.PojavProfile;
import net.kdt.pojavlaunch.R;
import net.kdt.pojavlaunch.Tools;
@@ -25,17 +27,25 @@ public class ProfileTypeSelectFragment extends Fragment {
// NOTE: Special care needed! If you wll decide to add these to the back stack, please read
// the comment in FabricInstallFragment.onDownloadFinished() and amend the code
// in FabricInstallFragment.onDownloadFinished() and ModVersionListFragment.onDownloadFinished()
view.findViewById(R.id.optifine_profile).setOnClickListener(v -> Tools.swapFragment(requireActivity(), OptiFineInstallFragment.class,
OptiFineInstallFragment.TAG, null));
view.findViewById(R.id.optifine_profile).setOnClickListener(v ->
tryInstall(OptiFineInstallFragment.class, OptiFineInstallFragment.TAG));
view.findViewById(R.id.modded_profile_fabric).setOnClickListener((v)->
Tools.swapFragment(requireActivity(), FabricInstallFragment.class, FabricInstallFragment.TAG, null));
tryInstall(FabricInstallFragment.class, FabricInstallFragment.TAG));
view.findViewById(R.id.modded_profile_forge).setOnClickListener((v)->
Tools.swapFragment(requireActivity(), ForgeInstallFragment.class, ForgeInstallFragment.TAG, null));
tryInstall(ForgeInstallFragment.class, ForgeInstallFragment.TAG));
view.findViewById(R.id.modded_profile_modpack).setOnClickListener((v)->
Tools.swapFragment(requireActivity(), SearchModFragment.class, SearchModFragment.TAG, null));
tryInstall(SearchModFragment.class, SearchModFragment.TAG));
view.findViewById(R.id.modded_profile_quilt).setOnClickListener((v)->
Tools.swapFragment(requireActivity(), QuiltInstallFragment.class, QuiltInstallFragment.TAG, null));
tryInstall(QuiltInstallFragment.class, QuiltInstallFragment.TAG));
view.findViewById(R.id.modded_profile_bta).setOnClickListener((v)->
Tools.swapFragment(requireActivity(), BTAInstallFragment.class, BTAInstallFragment.TAG, null));
tryInstall(BTAInstallFragment.class, BTAInstallFragment.TAG));
}
private void tryInstall(Class<? extends Fragment> fragmentClass, String tag){
if(Tools.isLocalProfile(requireContext()) || Tools.isDemoProfile(requireContext())){
Toast.makeText(requireContext(), R.string.toast_not_available_demo, Toast.LENGTH_LONG).show();
} else {
Tools.swapFragment(requireActivity(), fragmentClass, tag, null);
}
}
}
@@ -1,5 +1,7 @@
package net.kdt.pojavlaunch.modloaders;
import android.app.Activity;
import com.kdt.mcgui.ProgressLayout;
import net.kdt.pojavlaunch.JMinecraftVersionList;
@@ -22,11 +24,13 @@ public class OptiFineDownloadTask implements Runnable, Tools.DownloaderFeedback,
private final ModloaderDownloadListener mListener;
private final Object mMinecraftDownloadLock = new Object();
private Throwable mDownloaderThrowable;
private final Activity activity;
public OptiFineDownloadTask(OptiFineUtils.OptiFineVersion mOptiFineVersion, ModloaderDownloadListener mListener) {
public OptiFineDownloadTask(OptiFineUtils.OptiFineVersion mOptiFineVersion, ModloaderDownloadListener mListener, Activity activity) {
this.mOptiFineVersion = mOptiFineVersion;
this.mDestinationFile = new File(Tools.DIR_CACHE, "optifine-installer.jar");
this.mListener = mListener;
this.activity = activity;
}
@Override
@@ -89,7 +93,7 @@ public class OptiFineDownloadTask implements Runnable, Tools.DownloaderFeedback,
if(minecraftJsonVersion == null) return false;
try {
synchronized (mMinecraftDownloadLock) {
new MinecraftDownloader().start(null, minecraftJsonVersion, minecraftVersion, this);
new MinecraftDownloader().start(activity, minecraftJsonVersion, minecraftVersion, this);
mMinecraftDownloadLock.wait();
}
}catch (InterruptedException e) {
@@ -54,6 +54,8 @@ public class MinecraftDownloader {
private static final ThreadLocal<byte[]> sThreadLocalDownloadBuffer = new ThreadLocal<>();
private boolean isLocalProfile = false;
/**
* Start the game version download process on the global executor service.
* @param activity Activity, used for automatic installation of JRE 17 if needed
@@ -64,6 +66,14 @@ public class MinecraftDownloader {
public void start(@Nullable Activity activity, @Nullable JMinecraftVersionList.Version version,
@NonNull String realVersion, // this was there for a reason
@NonNull AsyncMinecraftDownloader.DoneListener listener) {
if(activity != null){
isLocalProfile = Tools.isLocalProfile(activity);
Tools.switchDemo(Tools.isDemoProfile(activity));
} else {
isLocalProfile = true;
Tools.switchDemo(true);
}
sExecutorService.execute(() -> {
try {
downloadGame(activity, version, realVersion);
@@ -506,6 +516,10 @@ public class MinecraftDownloader {
}
private void downloadFile() throws Exception {
if(isLocalProfile){
throw new RuntimeException("Download failed. Please make sure you are logged in with a Microsoft Account.");
}
try {
DownloadUtils.ensureSha1(mTargetPath, mTargetSha1, () -> {
DownloadMirror.downloadFileMirrored(mDownloadClass, mTargetUrl, mTargetPath,
@@ -15,6 +15,7 @@ import org.apache.commons.io.*;
@SuppressWarnings("IOStreamConstructor")
public class DownloadUtils {
public static final String USER_AGENT = Tools.APP_NAME;
private static final int TIME_OUT = 10000;
public static void download(String url, OutputStream os) throws IOException {
download(new URL(url), os);
@@ -26,7 +27,8 @@ public class DownloadUtils {
// System.out.println("Connecting: " + url.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent", USER_AGENT);
conn.setConnectTimeout(10000);
conn.setConnectTimeout(TIME_OUT);
conn.setReadTimeout(TIME_OUT);
conn.setDoInput(true);
conn.connect();
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
@@ -67,6 +69,8 @@ public class DownloadUtils {
FileUtils.ensureParentDirectory(outputFile);
HttpURLConnection conn = (HttpURLConnection) new URL(urlInput).openConnection();
conn.setConnectTimeout(TIME_OUT);
conn.setReadTimeout(TIME_OUT);
InputStream readStr = conn.getInputStream();
try (FileOutputStream fos = new FileOutputStream(outputFile)) {
int current;
@@ -81,8 +85,9 @@ public class DownloadUtils {
monitor.updateProgress(overall, length);
}
conn.disconnect();
} catch (IOException e) {
throw new IOException("Unable to download from " + urlInput, e);
}
}
public static <T> T downloadStringCached(String url, String cacheName, ParseCallback<T> parseCallback) throws IOException, ParseException{
@@ -223,18 +223,6 @@ public class JREUtils {
envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth > 0 ? CallbackBridge.windowWidth : CallbackBridge.physicalWidth));
envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight > 0 ? CallbackBridge.windowHeight : CallbackBridge.physicalHeight));
File customEnvFile = new File(Tools.DIR_GAME_HOME, "custom_env.txt");
if (customEnvFile.exists() && customEnvFile.isFile()) {
BufferedReader reader = new BufferedReader(new FileReader(customEnvFile));
String line;
while ((line = reader.readLine()) != null) {
// Not use split() as only split first one
int index = line.indexOf("=");
envMap.put(line.substring(0, index), line.substring(index + 1));
}
reader.close();
}
GLInfoUtils.GLInfo info = GLInfoUtils.getGlInfo();
if(!envMap.containsKey("LIBGL_ES") && LOCAL_RENDERER != null) {
int glesMajor = info.glesMajorVersion;
@@ -256,6 +244,8 @@ public class JREUtils {
envMap.put("POJAV_LOAD_TURNIP", "1");
}
readCustomEnv(envMap); // Must be last so it overrides anything the user sets for obvious reasons.
for (Map.Entry<String, String> env : envMap.entrySet()) {
Logger.appendToLog("Added custom env: " + env.getKey() + "=" + env.getValue());
try {
@@ -274,6 +264,19 @@ public class JREUtils {
// return ldLibraryPath;
}
private static void readCustomEnv(Map<String, String> envMap) throws IOException {
File customEnvFile = new File(Tools.DIR_GAME_HOME, "custom_env.txt");
if (customEnvFile.exists() && customEnvFile.isFile()) {
BufferedReader reader = new BufferedReader(new FileReader(customEnvFile));
String line;
while ((line = reader.readLine()) != null) {
// Not use split() as only split first one
int index = line.indexOf("=");
envMap.put(line.substring(0, index), line.substring(index + 1));
}
reader.close();
}
}
public static void launchJavaVM(final AppCompatActivity activity, final Runtime runtime, File gameDirectory, final List<String> JVMArgs, final String userArgsString) throws Throwable {
String runtimeHome = MultiRTUtils.getRuntimeHome(runtime.name).getAbsolutePath();
@@ -45,7 +45,11 @@ public class MinecraftAccount {
}
public boolean isLocal(){
return accessToken.equals("0");
return accessToken.equals("0") && !username.startsWith("Demo.");
}
public boolean isDemo(){
return username.startsWith("Demo.");
}
public void updateSkinFace() {
@@ -16,7 +16,7 @@ import java.util.UUID;
public class LauncherProfiles {
public static MinecraftLauncherProfiles mainProfileJson;
private static final File launcherProfilesFile = new File(Tools.DIR_GAME_NEW, "launcher_profiles.json");
private static final File launcherProfilesFile = new File(Tools.GAME_PROFILES_FILE);
/** Reload the profile from the file, creating a default one if necessary */
public static void load(){
@@ -27,6 +27,7 @@
</string-array>
<string-array name="menu_ingame">
<item>@string/control_forceclose</item>
<item>@string/control_viewout</item>
<item>@string/control_customkey</item>
<item>@string/quick_setting_title</item>
@@ -252,7 +252,7 @@
<string name="main_add_account">Add account</string>
<string name="tasks_ongoing">Tasks are in progress, please wait</string>
<string name="no_saved_accounts">No saved accounts</string>
<string name="mc_download_failed">Failed to download Minecraft! This could be due to bad network connection, incorrectly placed files, etc..</string>
<string name="mc_download_failed">Failed to download Minecraft! This could be due to bad network connection, incorrectly placed files, trying to download Minecraft from a Local account, etc..</string>
<string name="xerr_unknown">Unknown Xbox Live API error %d</string>
<string name="xerr_no_account">You don\'t seem to have an Xbox Live account. Please log in once on https://minecraft.net/ and try again.</string>
<string name="xerr_adult_verification">An adult needs to verify your account.</string>
@@ -430,4 +430,5 @@
<string name="bta_installer_untested_versions">Untested BTA versions</string>
<string name="bta_installer_nightly_versions">Nightly BTA versions</string>
<string name="newdl_extracting_native_libraries">Extracting native libraries (%d/%d)</string>
<string name="toast_not_available_demo">This is not available in demo mode</string>
</resources>
+5 -2
View File
@@ -6,12 +6,15 @@ java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
jar {
manifest {
attributes("Manifest-Version": "1.0",
"PreMain-Class": "git.artdeell.arcdns.ArcDNSInjectorAgent")
}
File versionFile = file("../app_pojavlauncher/src/main/assets/components/arc_dns_injector/version")
versionFile.write(String.valueOf(new Date().getTime()))
if (gitUsed()){
File versionFile = file("../app_pojavlauncher/src/main/assets/components/arc_dns_injector/version")
versionFile.write(getGitHash(project.name))
}
destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/arc_dns_injector/"))
}
+32
View File
@@ -1 +1,33 @@
import java.io.IOException
plugins{
id 'com.android.application' version '8.7.2' apply false
id 'com.android.library' version '8.7.2' apply false
}
String getGitHash(String project) {
def command = Runtime.getRuntime().exec("git rev-list -1 HEAD " + project)
def returnCode = command.waitFor()
if (returnCode != 0) {
throw new IOException("Command 'getGitHash()' exited with " + returnCode)
}
String gitCommitHash = command.inputStream.text.trim()
return gitCommitHash
}
Boolean gitUsed() {
def returnCode = Runtime.getRuntime().exec("git rev-parse --is-inside-work-tree").waitFor()
switch(returnCode){
case 127:
println("git not found");
return false;
break;
case 128:
println("not inside a git repository");
return false;
break;
case 0:
return true;
default:
throw new IOException("Command 'gitUsed()' exited with " + returnCode)
}
}
+5 -3
View File
@@ -15,11 +15,13 @@ jar {
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
File versionFile = file("../app_pojavlauncher/src/main/assets/components/forge_installer/version")
versionFile.write(String.valueOf(new Date().getTime()))
if (gitUsed()){
File versionFile = file("../app_pojavlauncher/src/main/assets/components/forge_installer/version")
versionFile.write(getGitHash(project.name))
}
manifest {
attributes("Manifest-Version": "1.0",
"PreMain-Class": "git.artdeell.installer_agent.Agent")
}
destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/forge_installer/"))
}
}
Submodule gl4es deleted from b9c0c79dd9.
+1 -1
View File
@@ -1,7 +1,7 @@
#Fri Dec 06 21:56:04 CET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+4 -3
View File
@@ -10,9 +10,10 @@ jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveBaseName = "lwjgl-glfw-classes"
destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/lwjgl3/"))
// Auto update the version with a timestamp so the project jar gets updated by Pojav
File versionFile = file("../app_pojavlauncher/src/main/assets/components/lwjgl3/version")
versionFile.write(String.valueOf(new Date().getTime()))
if (gitUsed()){
File versionFile = file("../app_pojavlauncher/src/main/assets/components/lwjgl3/version")
versionFile.write(getGitHash(project.name))
}
from {
configurations.default.collect {
println(it.getName())