├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── values
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── themes.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values-night
│ │ │ │ └── themes.xml
│ │ ├── java
│ │ │ └── xyz
│ │ │ │ └── hdk5
│ │ │ │ └── cunnyarchive
│ │ │ │ ├── Applicaton.kt
│ │ │ │ ├── ui
│ │ │ │ └── theme
│ │ │ │ │ ├── Color.kt
│ │ │ │ │ ├── Shape.kt
│ │ │ │ │ ├── Type.kt
│ │ │ │ │ └── Theme.kt
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── Censorship.kt
│ │ │ │ ├── StorageAccessHack.kt
│ │ │ │ ├── StorageUtil.kt
│ │ │ │ └── Ui.kt
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── xyz
│ │ │ └── hdk5
│ │ │ └── cunnyarchive
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── xyz
│ │ └── hdk5
│ │ └── cunnyarchive
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle.kts
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── settings.gradle
├── .gitignore
├── CENSORSHIP.md
├── LICENSE
├── gradle.properties
├── .github
└── workflows
│ └── release.yml
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hdk5/CunnyArchive/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4F86F7
4 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/Applicaton.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import android.app.Application
4 |
5 | class CunnyArchiveApp : Application() {
6 |
7 | companion object {
8 | const val TAG = "CunnyArchive"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | dependencyResolutionManagement {
2 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 | }
8 | rootProject.name = "Cunny Archive"
9 | include ':app'
10 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 20 12:36:56 MSK 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/ui/theme/Color.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive.ui.theme
2 |
3 | import androidx.compose.ui.graphics.Color
4 |
5 | val Blue200 = Color(0xFF90CAF9)
6 | val Blue500 = Color(0xFF2196F3)
7 | val Blue700 = Color(0xFF1976D2)
8 | val Pink200 = Color(0xFFF48FB1)
9 | val Pink700 = Color(0xFFC2185B)
10 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/ui/theme/Shape.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive.ui.theme
2 |
3 | import androidx.compose.foundation.shape.RoundedCornerShape
4 | import androidx.compose.material.Shapes
5 | import androidx.compose.ui.unit.dp
6 |
7 | val Shapes = Shapes(
8 | small = RoundedCornerShape(4.dp),
9 | medium = RoundedCornerShape(4.dp),
10 | large = RoundedCornerShape(0.dp),
11 | )
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF90CAF9
4 | #FF2196F3
5 | #FF1976D2
6 | #FFF48FB1
7 | #FFC2185B
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/app/src/test/java/xyz/hdk5/cunnyarchive/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Gradle files
2 | .gradle/
3 | build/
4 |
5 | # Local configuration file (sdk path, etc)
6 | local.properties
7 |
8 | # Log/OS Files
9 | *.log
10 |
11 | # Android Studio generated files and folders
12 | captures/
13 | .externalNativeBuild/
14 | .cxx/
15 | *.apk
16 | output.json
17 |
18 | # IntelliJ
19 | *.iml
20 | .idea/
21 |
22 | # Keystore files
23 | *.jks
24 | *.keystore
25 |
26 | # Google Services (e.g. APIs or Firebase)
27 | google-services.json
28 |
29 | # Android Profiling
30 | *.hprof
31 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/ui/theme/Type.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive.ui.theme
2 |
3 | import androidx.compose.material.Typography
4 | import androidx.compose.ui.text.TextStyle
5 | import androidx.compose.ui.text.font.FontFamily
6 | import androidx.compose.ui.text.font.FontWeight
7 | import androidx.compose.ui.unit.sp
8 |
9 | // Set of Material typography styles to start with
10 | val Typography = Typography(
11 | body1 = TextStyle(
12 | fontFamily = FontFamily.Default,
13 | fontWeight = FontWeight.Normal,
14 | fontSize = 16.sp,
15 | )
16 | )
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Cunny Archive
3 | Grant read/write permissions for the game directory.\nOn Android 10+ scoped storage access is used; legacy storage permissions otherwise\nYou only need to do this once.
4 | Copy files from the Korean version into the Global version.\nNote: on Android 10+ all required game files, including the censored ones, should exist in the local storage.\n(i.e. launch the game and let it download everything)
5 | Remove modified files to make the game download them again.
6 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/xyz/hdk5/cunnyarchive/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("xyz.hdk5.cunnyarchive", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import android.os.Bundle
4 | import androidx.activity.ComponentActivity
5 | import androidx.activity.compose.setContent
6 | import androidx.compose.material.MaterialTheme
7 | import androidx.compose.material.Surface
8 | import xyz.hdk5.cunnyarchive.ui.theme.CunnyArchiveTheme
9 |
10 | class MainActivity : ComponentActivity() {
11 | override fun onCreate(savedInstanceState: Bundle?) {
12 | super.onCreate(savedInstanceState)
13 | setContent {
14 | CunnyArchiveTheme {
15 | // A surface container using the 'background' color from the theme
16 | Surface(color = MaterialTheme.colors.background) {
17 | MainComposable()
18 | }
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/CENSORSHIP.md:
--------------------------------------------------------------------------------
1 | # Censorship Log
2 |
3 | ## 2021-12-14
4 |
5 | ### Main Story, Volume 2, Chapter 1, Episode 4
6 |
7 | Aris introduction background CGs were cropped
8 |
9 | #### Fix:
10 |
11 | Copy and replace files:
12 |
13 | 1. `files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_01.jpg`
14 | to
15 | `files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_01_c.png`
16 |
17 | 2. `files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_10.jpg`
18 | to
19 | `files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_10_c.png`
20 |
21 |
22 | ## Not Yet Implemented
23 |
24 | ### Various mistranslations
25 |
26 | Such as
27 |
28 | 1. Hoshino not being referred to as "Horus of the Dawn" in Volume 1, Chapter 1, Episode 17
29 | 2. Mutsuki's Christmas line
30 | 3. Aris' name (debatable)
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 hdk5
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | jobs:
9 | apk:
10 | name: Generate APK
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: Checkout
14 | uses: actions/checkout@v2
15 |
16 | - name: Setup JDK
17 | uses: actions/setup-java@v2
18 | with:
19 | distribution: 'temurin'
20 | java-version: '11'
21 | cache: 'gradle'
22 |
23 | - name: Build APK
24 | run: ./gradlew assembleRelease --stacktrace
25 |
26 | - name: Sign APK
27 | uses: r0adkll/sign-android-release@v1
28 | id: sign_app
29 | with:
30 | releaseDirectory: app/build/outputs/apk/release
31 | signingKeyBase64: ${{ secrets.SIGNING_KEY }}
32 | alias: ${{ secrets.ALIAS }}
33 | keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
34 | keyPassword: ${{ secrets.KEY_PASSWORD }}
35 |
36 | - name: Publish release
37 | uses: marvinpinto/action-automatic-releases@v1.2.1
38 | with:
39 | repo_token: "${{secrets.GITHUB_TOKEN}}"
40 | automatic_release_tag: latest
41 | prerelease: true
42 | files: |
43 | ${{steps.sign_app.outputs.signedReleaseFile}}
44 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/ui/theme/Theme.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive.ui.theme
2 |
3 | import androidx.compose.foundation.isSystemInDarkTheme
4 | import androidx.compose.material.MaterialTheme
5 | import androidx.compose.material.darkColors
6 | import androidx.compose.material.lightColors
7 | import androidx.compose.runtime.Composable
8 | import androidx.compose.ui.graphics.Color
9 |
10 | private val DarkColorPalette = darkColors(
11 | primary = Blue200,
12 | primaryVariant = Blue700,
13 | onPrimary = Color.Black,
14 |
15 | secondary = Pink200,
16 | secondaryVariant = Pink200,
17 | onSecondary = Color.Black,
18 | )
19 |
20 | private val LightColorPalette = lightColors(
21 | primary = Blue500,
22 | primaryVariant = Blue700,
23 | onPrimary = Color.White,
24 |
25 | secondary = Pink200,
26 | secondaryVariant = Pink700,
27 | onSecondary = Color.Black,
28 | )
29 |
30 | @Composable
31 | fun CunnyArchiveTheme(
32 | darkTheme: Boolean = isSystemInDarkTheme(),
33 | content: @Composable () -> Unit,
34 | ) {
35 | val colors = if (darkTheme) {
36 | DarkColorPalette
37 | } else {
38 | LightColorPalette
39 | }
40 |
41 | MaterialTheme(
42 | colors = colors,
43 | typography = Typography,
44 | shapes = Shapes,
45 | content = content,
46 | )
47 | }
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### Archival notice
2 |
3 | https://m.nexon.com/forum/thread/101347
4 |
5 | Nexon plans to release a separate age-restricted client for the game.
6 |
7 | No need for any unofficial patches anymore!
8 |
9 | # Cunny Archive
10 |
11 | Automatic Blue Archive decensor patch
12 |
13 | Works with both Android 10+ (using scoped storage) and older Android versions (using legacy storage permissions)
14 |
15 | At the moment, patch does not make any modifications with external assets. All uncensored assets already exist in the game directory.
16 |
17 | ## FAQ
18 |
19 | ### Where do I get it?
20 |
21 | Check out [GitHub Releases](https://github.com/hdk5/CunnyArchive/releases)
22 |
23 | ### How to use it?
24 |
25 | Install the .apk file, launch installed app and read what's on screen
26 |
27 | ### What does it do? Can I do decensoring myself?
28 |
29 | Check out [CENSORSHIP.md](/CENSORSHIP.md)
30 |
31 | ### Will I get banned?
32 |
33 | Yes
34 |
35 | ### I got banned!
36 |
37 | Told ya
38 |
39 | ### I didn't get banned!
40 |
41 | Yet
42 |
43 | ### It does not work
44 |
45 | Tell me in GitHub Issues
46 |
47 | ### Your code sucks
48 |
49 | I know
50 |
51 | ## TODO
52 |
53 | - Make better app to user interaction
54 |
55 | - Write better code
56 |
57 | - Find and eliminate Korean/Global conditional
58 |
59 | ## Alternatives
60 |
61 | [OrangeArchive](https://gitlab.com/timescam/orangeArchive)
62 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/Censorship.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import android.content.Context
4 |
5 | val ALL_CENSORSHIP = AllCensorship()
6 |
7 | abstract class Censorship {
8 | abstract fun fix(context: Context)
9 | abstract fun revert(context: Context)
10 | }
11 |
12 | open class MultiCensorship(
13 | private val censorships: Collection,
14 | ) : Censorship() {
15 | override fun fix(context: Context) {
16 | censorships.forEach { censorship ->
17 | censorship.fix(context)
18 | }
19 | }
20 |
21 | override fun revert(context: Context) {
22 | censorships.forEach { censorship ->
23 | censorship.revert(context)
24 | }
25 | }
26 | }
27 |
28 | open class FileCensorship(
29 | val censoredPath: String,
30 | val originalPath: String,
31 | ) : Censorship() {
32 |
33 | override fun fix(context: Context) {
34 | copy(
35 | context = context,
36 | src = makeMxTreeUri(originalPath),
37 | dst = makeMxTreeUri(censoredPath),
38 | )
39 | }
40 |
41 | override fun revert(context: Context) {
42 | delete(
43 | context = context,
44 | uri = makeMxTreeUri(censoredPath),
45 | )
46 | }
47 | }
48 |
49 | class AllCensorship : MultiCensorship(
50 | listOf(
51 | ArisCensorship(),
52 | )
53 | )
54 |
55 | class ArisCensorship : MultiCensorship(
56 | listOf(
57 | FileCensorship(
58 | censoredPath = "files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_01_c.png",
59 | originalPath = "files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_01.jpg",
60 | ),
61 | FileCensorship(
62 | censoredPath = "files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_10_c.png",
63 | originalPath = "files/PUB/Resource/GameData/MediaResources/UIs/03_Scenario/01_Background/BG_CS_Millenium_10.jpg",
64 | ),
65 | )
66 | )
67 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/StorageAccessHack.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import android.Manifest
4 | import android.annotation.SuppressLint
5 | import android.content.Context
6 | import android.content.Intent
7 | import android.net.Uri
8 | import android.os.Build
9 | import android.os.storage.StorageManager
10 | import android.provider.DocumentsContract
11 | import androidx.activity.compose.rememberLauncherForActivityResult
12 | import androidx.activity.result.contract.ActivityResultContracts
13 | import androidx.annotation.RequiresApi
14 | import androidx.compose.runtime.Composable
15 |
16 |
17 | @RequiresApi(Build.VERSION_CODES.Q)
18 | open class OpenDocumentTreeQWorkaround : ActivityResultContracts.OpenDocumentTree() {
19 | @SuppressLint("MissingSuperCall")
20 | override fun createIntent(context: Context, input: Uri?): Intent {
21 | // Huge thanks to https://stackoverflow.com/a/66466205 for this workaround
22 | val storageManager = context.getSystemService(Context.STORAGE_SERVICE) as StorageManager
23 | val primaryStorageVolume = storageManager.primaryStorageVolume
24 | val intent = primaryStorageVolume.createOpenDocumentTreeIntent()
25 | if (input != null) {
26 | intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, input)
27 | }
28 | return intent
29 | }
30 | }
31 |
32 | object makeLaunchFunction {
33 | @Composable
34 | @RequiresApi(Build.VERSION_CODES.Q)
35 | private fun invokeQ(onResult: () -> Unit): () -> Unit {
36 | val launcher = rememberLauncherForActivityResult(
37 | contract = OpenDocumentTreeQWorkaround(),
38 | ) {
39 | onResult()
40 | }
41 |
42 | return {
43 | launcher.launch(MX_URI)
44 | }
45 | }
46 |
47 | @Composable
48 | private fun invokeLegacy(onResult: () -> Unit): () -> Unit {
49 | val launcher = rememberLauncherForActivityResult(
50 | contract = ActivityResultContracts.RequestPermission(),
51 | ) {
52 | onResult()
53 | }
54 |
55 | return {
56 | launcher.launch(Manifest.permission.WRITE_EXTERNAL_STORAGE)
57 | }
58 | }
59 |
60 | @Composable
61 | operator fun invoke(onResult: () -> Unit): () -> Unit {
62 | return when {
63 | Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> invokeQ(onResult)
64 | else -> invokeLegacy(onResult)
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/StorageUtil.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import android.content.Context
4 | import android.net.Uri
5 | import android.os.Build
6 | import android.os.Environment
7 | import android.provider.DocumentsContract
8 | import androidx.annotation.RequiresApi
9 | import com.google.common.io.ByteStreams
10 | import java.io.File
11 |
12 | const val MX_PACKAGE_NAME = "com.nexon.bluearchive"
13 | const val MX_DATA_PATH = "Android/data/$MX_PACKAGE_NAME"
14 | const val MX_DOCID = "primary:$MX_DATA_PATH"
15 | const val EXTERNAL_STORAGE_PROVIDER_AUTHORITY = "com.android.externalstorage.documents"
16 | val MX_URI = DocumentsContract.buildDocumentUri(
17 | EXTERNAL_STORAGE_PROVIDER_AUTHORITY,
18 | MX_DOCID,
19 | )
20 | val MX_TREE_URI = DocumentsContract.buildTreeDocumentUri(
21 | EXTERNAL_STORAGE_PROVIDER_AUTHORITY,
22 | MX_DOCID,
23 | )
24 |
25 | @Suppress("ClassName")
26 | object makeMxTreeUri {
27 |
28 | @RequiresApi(Build.VERSION_CODES.Q)
29 | private fun invokeQ(path: String): Uri {
30 | val docid = "$MX_DOCID/$path"
31 | val uri = DocumentsContract.buildDocumentUriUsingTree(
32 | MX_TREE_URI,
33 | docid,
34 | )
35 | return uri
36 | }
37 |
38 | private fun invokeLegacy(path: String): Uri {
39 | @Suppress("DEPRECATION")
40 | val externalStorageDirectory = Environment.getExternalStorageDirectory()
41 | val storagePath = externalStorageDirectory.absolutePath
42 | return Uri.fromFile(File("$storagePath/$MX_DATA_PATH/$path"))
43 | }
44 |
45 | operator fun invoke(path: String): Uri {
46 | return when {
47 | Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> ::invokeQ
48 | else -> ::invokeLegacy
49 | }(path)
50 | }
51 | }
52 |
53 | fun delete(context: Context, uri: Uri): Boolean {
54 | val contentResolver = context.contentResolver
55 | return when (uri.scheme) {
56 | "file" -> File(uri.path!!).delete()
57 | "content" -> DocumentsContract.deleteDocument(contentResolver, uri)
58 | else -> false
59 | }
60 | }
61 |
62 | fun copy(context: Context, src: Uri, dst: Uri): Boolean {
63 | val contentResolver = context.contentResolver
64 |
65 | return contentResolver.openInputStream(src).use { inputStream ->
66 | contentResolver.openOutputStream(dst, "wt").use { outputStream ->
67 | ByteStreams.copy(inputStream!!, outputStream!!) > 0
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.android.application")
3 | id("kotlin-android")
4 | }
5 |
6 | android {
7 | compileSdk = 31
8 |
9 | defaultConfig {
10 | applicationId = "xyz.hdk5.cunnyarchive"
11 | minSdk = 21
12 | targetSdk = 31
13 | versionCode = 1
14 | versionName = "1.0.0"
15 |
16 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
17 | vectorDrawables {
18 | useSupportLibrary = true
19 | }
20 | }
21 |
22 | buildTypes {
23 | getByName("release") {
24 | isMinifyEnabled = true
25 | isShrinkResources = true
26 | proguardFiles(
27 | getDefaultProguardFile("proguard-android-optimize.txt"),
28 | "proguard-rules.pro",
29 | )
30 | }
31 | }
32 | compileOptions {
33 | sourceCompatibility = JavaVersion.VERSION_1_8
34 | targetCompatibility = JavaVersion.VERSION_1_8
35 | }
36 | kotlinOptions {
37 | jvmTarget = "1.8"
38 | }
39 | buildFeatures {
40 | compose = true
41 | }
42 | composeOptions {
43 | kotlinCompilerExtensionVersion ="1.1.0-rc02"
44 | }
45 | packagingOptions {
46 | resources {
47 | excludes += "/META-INF/{AL2.0,LGPL2.1}"
48 | }
49 | }
50 | }
51 |
52 | dependencies {
53 | implementation("androidx.core:core-ktx:1.7.0")
54 | implementation("androidx.appcompat:appcompat:1.4.0")
55 | implementation("com.google.android.material:material:1.4.0")
56 | implementation("androidx.compose.ui:ui:${rootProject.extra["compose_version"]}")
57 | implementation("androidx.compose.material:material:${rootProject.extra["compose_version"]}")
58 | implementation("androidx.compose.ui:ui-tooling-preview:${rootProject.extra["compose_version"]}")
59 | implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0")
60 | implementation("androidx.activity:activity-compose:1.4.0")
61 | testImplementation("junit:junit:4.+")
62 | androidTestImplementation("androidx.test.ext:junit:1.1.3")
63 | androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
64 | androidTestImplementation("androidx.compose.ui:ui-test-junit4:${rootProject.extra["compose_version"]}")
65 | debugImplementation("androidx.compose.ui:ui-tooling:${rootProject.extra["compose_version"]}")
66 |
67 | implementation("com.google.guava:guava:31.0.1-android")
68 | implementation("androidx.navigation:navigation-compose:2.4.0-rc01")
69 | implementation("androidx.compose.material:material-icons-extended:${rootProject.extra["compose_version"]}")
70 |
71 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/java/xyz/hdk5/cunnyarchive/Ui.kt:
--------------------------------------------------------------------------------
1 | package xyz.hdk5.cunnyarchive
2 |
3 | import android.widget.Toast
4 | import androidx.compose.foundation.layout.*
5 | import androidx.compose.material.*
6 | import androidx.compose.material.icons.Icons
7 | import androidx.compose.material.icons.filled.Home
8 | import androidx.compose.material.icons.outlined.Article
9 | import androidx.compose.runtime.Composable
10 | import androidx.compose.runtime.getValue
11 | import androidx.compose.ui.Modifier
12 | import androidx.compose.ui.graphics.vector.ImageVector
13 | import androidx.compose.ui.platform.LocalContext
14 | import androidx.compose.ui.res.stringResource
15 | import androidx.compose.ui.unit.dp
16 | import androidx.navigation.NavController
17 | import androidx.navigation.NavHostController
18 | import androidx.navigation.compose.NavHost
19 | import androidx.navigation.compose.composable
20 | import androidx.navigation.compose.currentBackStackEntryAsState
21 | import androidx.navigation.compose.rememberNavController
22 |
23 | sealed class BottomNavigationItem(val route: String, val icon: ImageVector, val title: String) {
24 | object Actions : BottomNavigationItem("actions", Icons.Filled.Home, "Actions")
25 | object Log : BottomNavigationItem("log", Icons.Outlined.Article, "Log")
26 | }
27 |
28 | @Composable
29 | fun MainComposable() {
30 | val navController = rememberNavController()
31 |
32 | Scaffold(
33 | topBar = { TopBar() },
34 | bottomBar = { BottomNavigationBar(navController) }
35 | ) {
36 | Navigation(navController)
37 | }
38 | }
39 |
40 | @Composable
41 | fun TopBar() {
42 | TopAppBar(
43 | title = { Text(text = stringResource(R.string.app_name)) }
44 | )
45 | }
46 |
47 | @Composable
48 | fun Navigation(navController: NavHostController) {
49 | NavHost(
50 | navController = navController,
51 | startDestination = BottomNavigationItem.Actions.route,
52 | ) {
53 | composable(BottomNavigationItem.Actions.route) { ActionsScreen() }
54 | composable(BottomNavigationItem.Log.route) { LogScreen() }
55 | }
56 | }
57 |
58 | @Composable
59 | fun BottomNavigationBar(navController: NavController) {
60 | val items = listOf(
61 | BottomNavigationItem.Actions,
62 | BottomNavigationItem.Log,
63 | )
64 | BottomNavigation {
65 | val navBackStackEntry by navController.currentBackStackEntryAsState()
66 | val currentRoute = navBackStackEntry?.destination?.route
67 |
68 | items.forEach { item ->
69 | BottomNavigationItem(
70 | icon = { Icon(item.icon, item.title) },
71 | label = { Text(item.title) },
72 | alwaysShowLabel = true,
73 | selected = currentRoute == item.route,
74 | onClick = {
75 | navController.navigate(item.route) {
76 | popUpTo(navController.graph.startDestinationId) {
77 | saveState = true
78 | }
79 | launchSingleTop = true
80 | restoreState = true
81 | }
82 |
83 | }
84 | )
85 | }
86 | }
87 | }
88 |
89 | @Composable
90 | fun ActionsScreen() {
91 | Column(
92 | modifier = Modifier
93 | .fillMaxWidth()
94 | .fillMaxHeight()
95 | .padding(16.dp)
96 | ) {
97 | Text(stringResource(R.string.open_directory_note))
98 | Spacer(modifier = Modifier.height(8.dp))
99 | OpenDirectoryButton()
100 |
101 | Spacer(modifier = Modifier.height(16.dp))
102 |
103 | Text(stringResource(R.string.uncensor_note))
104 | Spacer(modifier = Modifier.height(8.dp))
105 | UncensorButton()
106 |
107 | Spacer(modifier = Modifier.height(16.dp))
108 |
109 | Text(stringResource(R.string.recensor_note))
110 | Spacer(modifier = Modifier.height(8.dp))
111 | RecensorButton()
112 | }
113 | }
114 |
115 | @Composable
116 | fun OpenDirectoryButton() {
117 | val context = LocalContext.current
118 | val doneToast = Toast.makeText(context, "Permission acquired", Toast.LENGTH_LONG)
119 |
120 | Button(
121 | modifier = Modifier.fillMaxWidth(),
122 | onClick = makeLaunchFunction {
123 | doneToast.show()
124 | },
125 | ) {
126 | Text("Request Storage Access".uppercase())
127 | }
128 | }
129 |
130 | @Composable
131 | fun UncensorButton() {
132 | val context = LocalContext.current
133 | val doneToast = Toast.makeText(context, "Uncensoring completed", Toast.LENGTH_LONG)
134 |
135 | Button(
136 | modifier = Modifier.fillMaxWidth(),
137 | onClick = {
138 | // TODO: Do this asynchronously
139 | ALL_CENSORSHIP.fix(context)
140 | doneToast.show()
141 | },
142 | ) {
143 | Text("Uncensor".uppercase())
144 | }
145 | }
146 |
147 | @Composable
148 | fun RecensorButton() {
149 | val context = LocalContext.current
150 | val doneToast = Toast.makeText(context, "Recensoring completed", Toast.LENGTH_LONG)
151 |
152 | Button(
153 | modifier = Modifier.fillMaxWidth(),
154 | onClick = {
155 | // TODO: Do this asynchronously
156 | ALL_CENSORSHIP.revert(context)
157 | doneToast.show()
158 | }
159 | ) {
160 | Text("Recensor".uppercase())
161 | }
162 | }
163 |
164 | @Composable
165 | fun LogScreen() {
166 | Text("Nothing here yet")
167 | }
168 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------