diff --git a/app/src/main/cpp/GakumasLocalify/Hook.cpp b/app/src/main/cpp/GakumasLocalify/Hook.cpp index 8645ace..d0c7f56 100644 --- a/app/src/main/cpp/GakumasLocalify/Hook.cpp +++ b/app/src/main/cpp/GakumasLocalify/Hook.cpp @@ -221,6 +221,15 @@ namespace GakumasLocal::HookMain { return Unity_set_position_Injected_Orig(_this, data); } + DEFINE_HOOK(void*, InternalSetOrientationAsync, (void* _this, int type, void* c, void* tc, void* mtd)) { + switch (Config::gameOrientation) { + case 1: type = 0x2; break; // FixedPortrait + case 2: type = 0x3; break; // FixedLandscape + default: break; + } + return InternalSetOrientationAsync_Orig(_this, type, c, tc, mtd); + } + DEFINE_HOOK(void, EndCameraRendering, (void* ctx, void* camera, void* method)) { EndCameraRendering_Orig(ctx, camera, method); @@ -797,6 +806,10 @@ namespace GakumasLocal::HookMain { ADD_HOOK(Internal_Log, Il2cppUtils::il2cpp_resolve_icall( "UnityEngine.DebugLogHandler::Internal_Log(UnityEngine.LogType,UnityEngine.LogOption,System.String,UnityEngine.Object)")); + ADD_HOOK(InternalSetOrientationAsync, + Il2cppUtils::GetMethodPointer("campus-submodule.Runtime.dll", "Campus.Common", + "ScreenOrientationControllerBase", "InternalSetOrientationAsync")); + ADD_HOOK(Unity_set_position_Injected, Il2cppUtils::il2cpp_resolve_icall( "UnityEngine.Transform::set_position_Injected(UnityEngine.Vector3&)")); ADD_HOOK(Unity_set_rotation_Injected, Il2cppUtils::il2cpp_resolve_icall( diff --git a/app/src/main/cpp/GakumasLocalify/config/Config.cpp b/app/src/main/cpp/GakumasLocalify/config/Config.cpp index 110f81e..b3cf550 100644 --- a/app/src/main/cpp/GakumasLocalify/config/Config.cpp +++ b/app/src/main/cpp/GakumasLocalify/config/Config.cpp @@ -9,6 +9,7 @@ namespace GakumasLocal::Config { bool enabled = true; bool forceExportResource = true; bool textTest = false; + int gameOrientation = 0; bool dumpText = false; bool enableFreeCamera = false; int targetFrameRate = 0; @@ -35,6 +36,7 @@ namespace GakumasLocal::Config { GetConfigItem(dbgMode); GetConfigItem(enabled); GetConfigItem(forceExportResource); + GetConfigItem(gameOrientation); GetConfigItem(textTest); GetConfigItem(dumpText); GetConfigItem(targetFrameRate); diff --git a/app/src/main/cpp/GakumasLocalify/config/Config.hpp b/app/src/main/cpp/GakumasLocalify/config/Config.hpp index f19ac5f..a37ea34 100644 --- a/app/src/main/cpp/GakumasLocalify/config/Config.hpp +++ b/app/src/main/cpp/GakumasLocalify/config/Config.hpp @@ -6,6 +6,7 @@ namespace GakumasLocal::Config { extern bool dbgMode; extern bool enabled; extern bool forceExportResource; + extern int gameOrientation; extern bool textTest; extern bool dumpText; extern bool enableFreeCamera; diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt index 09f3c12..b952404 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt @@ -3,17 +3,17 @@ package io.github.chinosk.gakumas.localify import android.annotation.SuppressLint import android.content.Intent -import androidx.appcompat.app.AppCompatActivity import android.os.Bundle -import android.util.Log import android.view.KeyEvent +import android.view.View +import android.view.ViewTreeObserver +import android.widget.ScrollView import android.widget.TextView import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil -import androidx.databinding.ObservableField -import com.google.android.material.switchmaterial.SwitchMaterial -import com.google.android.material.textfield.TextInputEditText -import com.google.android.material.textfield.TextInputLayout +import com.google.android.material.button.MaterialButton +import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.gson.Gson import com.google.gson.JsonSyntaxException import io.github.chinosk.gakumas.localify.databinding.ActivityMainBinding @@ -42,6 +42,7 @@ interface ConfigListener { fun onChangePresetQuality(level: Int) fun onReflectionQualityLevelChanged(s: CharSequence, start: Int, before: Int, count: Int) fun onLodQualityLevelChanged(s: CharSequence, start: Int, before: Int, count: Int) + fun onGameOrientationChanged(checkedId: Int) fun onDumpTextChanged(value: Boolean) } @@ -65,6 +66,42 @@ class MainActivity : AppCompatActivity(), ConfigListener { } } showVersion() + + val scrollView: ScrollView = findViewById(R.id.scrollView) + scrollView.viewTreeObserver.addOnScrollChangedListener { onScrollChanged() } + onScrollChanged() + + val coordinatorLayout = findViewById<View>(R.id.coordinatorLayout) + coordinatorLayout.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { + override fun onGlobalLayout() { + onScrollChanged() + coordinatorLayout.viewTreeObserver.removeOnGlobalLayoutListener(this) + } + }) + } + + private fun onScrollChanged() { + val fab: FloatingActionButton = findViewById(R.id.fabStartGame) + val startGameButton: MaterialButton = findViewById(R.id.StartGameButton) + val scrollView: ScrollView = findViewById(R.id.scrollView) + + val location = IntArray(2) + startGameButton.getLocationOnScreen(location) + val buttonTop = location[1] + val buttonBottom = buttonTop + startGameButton.height + + val scrollViewLocation = IntArray(2) + scrollView.getLocationOnScreen(scrollViewLocation) + val scrollViewTop = scrollViewLocation[1] + val scrollViewBottom = scrollViewTop + scrollView.height + + val isButtonVisible = buttonTop >= scrollViewTop && buttonBottom <= scrollViewBottom + + if (isButtonVisible) { + fab.hide() + } else { + fab.show() + } } private fun showToast(message: String) { @@ -301,18 +338,22 @@ class MainActivity : AppCompatActivity(), ConfigListener { binding.config!!.reflectionQualityLevel = 5 } } - binding.config = binding.config - binding.notifyChange() + checkConfigAndUpdateView() saveConfig() } - private fun showTextInputLayoutHint(view: TextInputLayout) { - showToast(view.hint.toString()) + override fun onGameOrientationChanged(checkedId: Int) { + when (checkedId) { + R.id.radioButtonGameDefault -> binding.config!!.gameOrientation = 0 + R.id.radioButtonGamePortrait -> binding.config!!.gameOrientation = 1 + R.id.radioButtonGameLandscape -> binding.config!!.gameOrientation = 2 + } + saveConfig() } - fun checkConfigAndUpdateView() { - val sw = findViewById<SwitchMaterial>(R.id.SwitchUnlockAllLive) - sw.visibility = if (binding.config!!.dbgMode) android.view.View.VISIBLE else android.view.View.GONE + private fun checkConfigAndUpdateView() { + binding.config = binding.config + binding.notifyChange() } override fun dispatchKeyEvent(event: KeyEvent): Boolean { @@ -321,8 +362,7 @@ class MainActivity : AppCompatActivity(), ConfigListener { val origDbg = binding.config?.dbgMode if (origDbg != null) { binding.config!!.dbgMode = !origDbg - binding.config = binding.config - binding.notifyChange() + checkConfigAndUpdateView() saveConfig() showToast("TestMode: ${!origDbg}") } diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt index 266cfb0..b0a48c5 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/models/GakumasConfig.kt @@ -7,6 +7,7 @@ data class GakumasConfig ( var enabled: Boolean = true, var textTest: Boolean = false, var dumpText: Boolean = false, + var gameOrientation: Int = 0, var forceExportResource: Boolean = false, var enableFreeCamera: Boolean = false, var targetFrameRate: Int = 0, diff --git a/app/src/main/res/drawable/start_game.xml b/app/src/main/res/drawable/start_game.xml new file mode 100644 index 0000000..3f29258 --- /dev/null +++ b/app/src/main/res/drawable/start_game.xml @@ -0,0 +1,5 @@ +<vector android:autoMirrored="true" android:height="24dp" + android:tint="#000000" android:viewportHeight="24" + android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M9.31,6.71c-0.39,0.39 -0.39,1.02 0,1.41L13.19,12l-3.88,3.88c-0.39,0.39 -0.39,1.02 0,1.41 0.39,0.39 1.02,0.39 1.41,0l4.59,-4.59c0.39,-0.39 0.39,-1.02 0,-1.41L10.72,6.7c-0.38,-0.38 -1.02,-0.38 -1.41,0.01z"/> +</vector> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 287abf5..b0c508d 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -10,533 +10,611 @@ type="io.github.chinosk.gakumas.localify.ConfigListener" /> </data> - <androidx.constraintlayout.widget.ConstraintLayout + <androidx.coordinatorlayout.widget.CoordinatorLayout + android:id="@+id/coordinatorLayout" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="6sp" tools:context=".MainActivity"> - <ScrollView + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> + android:padding="6sp" + tools:context=".MainActivity"> - <LinearLayout + <ScrollView + android:id="@+id/scrollView" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" + android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - <TextView - android:id="@+id/textViewTitle" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/gakumas_localify" - android:textColor="@color/black" - android:textSize="20sp" /> - - <TextView - android:id="@+id/textViewResVersion" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textColor="@color/black" /> - - <Space - android:layout_width="match_parent" - android:layout_height="25sp" /> - - <TableLayout - android:layout_width="match_parent" - android:layout_height="match_parent" android:orientation="vertical" - android:stretchColumns="0"> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - <TableRow + <TextView + android:id="@+id/textViewTitle" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="wrap_content" + android:text="@string/gakumas_localify" + android:textColor="@color/black" + android:textSize="20sp" /> - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/SwitchEnablePlugin" - android:layout_width="match_parent" - android:layout_height="48dp" - android:checked="@={config.enabled}" - android:onCheckedChanged="@{(view, value) -> listener.onEnabledChanged(value)}" - android:text="@string/enable_plugin" /> - </TableRow> - - <TableRow + <TextView + android:id="@+id/textViewResVersion" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="wrap_content" + android:textColor="@color/black" /> - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/textTestMode" - android:layout_width="match_parent" - android:layout_height="48dp" - android:checked="@={config.textTest}" - android:onCheckedChanged="@{(view, value) -> listener.onTextTestChanged(value)}" - android:text="@string/text_hook_test_mode" /> - </TableRow> - - <TableRow + <Space android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="25sp" /> - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/textExport" - android:layout_width="match_parent" - android:layout_height="48dp" - android:checked="@={config.dumpText}" - android:onCheckedChanged="@{(view, value) -> listener.onDumpTextChanged(value)}" - android:text="@string/export_text" /> - </TableRow> - - <TableRow + <TableLayout android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:orientation="vertical" + android:stretchColumns="0"> - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/textForceExtract" + <TableRow android:layout_width="match_parent" - android:layout_height="48dp" - android:checked="@={config.forceExportResource}" - android:onCheckedChanged="@{(view, value) -> listener.onForceExportResourceChanged(value)}" - android:text="@string/force_export_resource" /> - </TableRow> + android:layout_height="match_parent"> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.textfield.TextInputLayout - android:layout_width="match_parent" - android:layout_height="48dp" - android:background="@android:color/transparent" - android:hint="@string/setFpsTitle" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextTargetFps" + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/SwitchEnablePlugin" android:layout_width="match_parent" android:layout_height="48dp" - android:ems="10" - android:inputType="numberSigned" - android:onTextChanged="@{(s, st, b, a) -> listener.onTargetFpsChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={`` + config.targetFrameRate}" /> + android:checked="@={config.enabled}" + android:onCheckedChanged="@{(view, value) -> listener.onEnabledChanged(value)}" + android:text="@string/enable_plugin" /> + </TableRow> - </com.google.android.material.textfield.TextInputLayout> - - </TableRow> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/SwitchEnableFreeCameraPlugin" + <TableRow android:layout_width="match_parent" - android:layout_height="48dp" - android:checked="@={config.enableFreeCamera}" - android:onCheckedChanged="@{(view, value) -> listener.onEnableFreeCameraChanged(value)}" - android:text="@string/enable_free_camera" /> - </TableRow> + android:layout_height="match_parent"> - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/textTestMode" + android:layout_width="match_parent" + android:layout_height="48dp" + android:checked="@={config.textTest}" + android:onCheckedChanged="@{(view, value) -> listener.onTextTestChanged(value)}" + android:text="@string/text_hook_test_mode" /> + </TableRow> - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/SwitchUnlockAllLive" + <TableRow android:layout_width="match_parent" - android:layout_height="48dp" - android:visibility="@{config.dbgMode ? android.view.View.VISIBLE : android.view.View.GONE}" - android:checked="@={config.unlockAllLive}" - android:onCheckedChanged="@{(view, value) -> listener.onUnlockAllLiveChanged(value)}" - android:text="@string/unlockAllLive" /> - </TableRow> + android:layout_height="match_parent"> - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@drawable/table_row_border"> + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/textExport" + android:layout_width="match_parent" + android:layout_height="48dp" + android:checked="@={config.dumpText}" + android:onCheckedChanged="@{(view, value) -> listener.onDumpTextChanged(value)}" + android:text="@string/export_text" /> + </TableRow> - <TableLayout - android:layout_width="wrap_content" + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/textForceExtract" + android:layout_width="match_parent" + android:layout_height="48dp" + android:checked="@={config.forceExportResource}" + android:onCheckedChanged="@{(view, value) -> listener.onForceExportResourceChanged(value)}" + android:text="@string/force_export_resource" /> + </TableRow> + + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.textfield.TextInputLayout + android:layout_width="match_parent" + android:layout_height="48dp" + android:background="@android:color/transparent" + android:hint="@string/setFpsTitle" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextTargetFps" + android:layout_width="match_parent" + android:layout_height="48dp" + android:ems="10" + android:inputType="numberSigned" + android:onTextChanged="@{(s, st, b, a) -> listener.onTargetFpsChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={`` + config.targetFrameRate}" /> + + </com.google.android.material.textfield.TextInputLayout> + + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/SwitchEnableFreeCameraPlugin" + android:layout_width="match_parent" + android:layout_height="48dp" + android:checked="@={config.enableFreeCamera}" + android:onCheckedChanged="@{(view, value) -> listener.onEnableFreeCameraChanged(value)}" + android:text="@string/enable_free_camera" /> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/SwitchUnlockAllLive" + android:layout_width="match_parent" + android:layout_height="48dp" + android:visibility="@{config.dbgMode ? android.view.View.VISIBLE : android.view.View.GONE}" + android:checked="@={config.unlockAllLive}" + android:onCheckedChanged="@{(view, value) -> listener.onUnlockAllLiveChanged(value)}" + android:text="@string/unlockAllLive" /> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/table_row_border"> + + <TableLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="vertical" + android:visibility="@{config.dbgMode ? android.view.View.VISIBLE : android.view.View.GONE}" + android:paddingLeft="10sp" + android:paddingRight="10sp" + android:paddingBottom="10sp" + android:stretchColumns="0"> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/SwitchLiveUseCustomeDress" + android:layout_width="match_parent" + android:layout_height="48dp" + android:checked="@={config.enableLiveCustomeDress}" + android:onCheckedChanged="@{(view, value) -> listener.onLiveCustomeDressChanged(value)}" + android:text="@string/liveUseCustomeDress" /> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.textfield.TextInputLayout + android:layout_width="match_parent" + android:layout_height="48dp" + android:background="@android:color/transparent" + android:hint="@string/live_costume_head_id" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextLiveCustomeCharaId" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:onTextChanged="@{(s, st, b, a) -> listener.onLiveCustomeHeadIdChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={config.liveCustomeHeadId}" /> + + </com.google.android.material.textfield.TextInputLayout> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.textfield.TextInputLayout + android:layout_width="match_parent" + android:layout_height="48dp" + android:background="@android:color/transparent" + android:hint="@string/live_custome_dress_id" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextLiveCustomeCostumeId" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:onTextChanged="@{(s, st, b, a) -> listener.onLiveCustomeCostumeIdChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={config.liveCustomeCostumeId}" /> + </com.google.android.material.textfield.TextInputLayout> + </TableRow> + </TableLayout> + + </TableRow> + + <TableRow + android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - android:visibility="@{config.dbgMode ? android.view.View.VISIBLE : android.view.View.GONE}" - android:paddingLeft="10sp" - android:paddingRight="10sp" - android:paddingBottom="10sp" - android:stretchColumns="0"> + android:layout_marginTop="4sp" + android:background="@drawable/table_row_border"> - <TableRow + <LinearLayout android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:orientation="vertical" + android:paddingLeft="10sp" + android:paddingRight="10sp" + android:paddingTop="10sp"> - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/SwitchLiveUseCustomeDress" - android:layout_width="match_parent" - android:layout_height="48dp" - android:checked="@={config.enableLiveCustomeDress}" - android:onCheckedChanged="@{(view, value) -> listener.onLiveCustomeDressChanged(value)}" - android:text="@string/liveUseCustomeDress" /> - </TableRow> + <com.google.android.material.textview.MaterialTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/orientation_lock" + android:textColor="@color/material_dynamic_neutral0"/> - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.textfield.TextInputLayout - android:layout_width="match_parent" - android:layout_height="48dp" - android:background="@android:color/transparent" - android:hint="@string/live_costume_head_id" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextLiveCustomeCharaId" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:onTextChanged="@{(s, st, b, a) -> listener.onLiveCustomeHeadIdChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={config.liveCustomeHeadId}" /> - - </com.google.android.material.textfield.TextInputLayout> - </TableRow> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.textfield.TextInputLayout - android:layout_width="match_parent" - android:layout_height="48dp" - android:background="@android:color/transparent" - android:hint="@string/live_custome_dress_id" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextLiveCustomeCostumeId" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:onTextChanged="@{(s, st, b, a) -> listener.onLiveCustomeCostumeIdChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={config.liveCustomeCostumeId}" /> - </com.google.android.material.textfield.TextInputLayout> - </TableRow> - </TableLayout> - - </TableRow> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginTop="4sp" - android:background="@drawable/table_row_border"> - - <TableLayout - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:orientation="vertical" - android:paddingLeft="10sp" - android:paddingRight="10sp" - android:paddingBottom="10sp" - android:stretchColumns="0"> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/SwitchUseCustomeGraphicSettings" - android:layout_width="match_parent" - android:layout_height="48dp" - android:checked="@={config.useCustomeGraphicSettings}" - android:onCheckedChanged="@{(view, value) -> listener.onUseCustomeGraphicSettingsChanged(value)}" - android:text="@string/useCustomeGraphicSettings" /> - </TableRow> - - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout + <RadioGroup android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> + android:weightSum="3" + android:onCheckedChanged="@{(group, checkedId) -> listener.onGameOrientationChanged(checkedId)}"> - <com.google.android.material.button.MaterialButton - android:id="@+id/qualityRecordButton" + <com.google.android.material.radiobutton.MaterialRadioButton + android:id="@+id/radioButtonGameDefault" android:layout_width="wrap_content" - android:layout_height="48dp" - android:layout_margin="1sp" + android:layout_height="wrap_content" android:layout_weight="1" - android:minWidth="1sp" - android:onClick="@{() -> listener.onChangePresetQuality(4)}" - android:text="@string/max_high" /> + android:checked="@{config.gameOrientation == 0}" + android:text="@string/orientation_orig" /> - <com.google.android.material.button.MaterialButton - android:id="@+id/qualityVeryHighButton" + <com.google.android.material.radiobutton.MaterialRadioButton + android:id="@+id/radioButtonGamePortrait" android:layout_width="wrap_content" - android:layout_height="48dp" - android:layout_margin="1sp" + android:layout_height="wrap_content" android:layout_weight="1" - android:minWidth="1sp" - android:onClick="@{() -> listener.onChangePresetQuality(3)}" - android:text="@string/very_high" /> + android:checked="@{config.gameOrientation == 1}" + android:text="@string/orientation_portrait" /> - <com.google.android.material.button.MaterialButton - android:id="@+id/qualityHighButton" + <com.google.android.material.radiobutton.MaterialRadioButton + android:id="@+id/radioButtonGameLandscape" android:layout_width="wrap_content" - android:layout_height="48dp" - android:layout_margin="1sp" + android:layout_height="wrap_content" android:layout_weight="1" - android:minWidth="1sp" - android:onClick="@{() -> listener.onChangePresetQuality(2)}" - android:text="@string/hign" /> + android:checked="@{config.gameOrientation == 2}" + android:text="@string/orientation_landscape" /> - <com.google.android.material.button.MaterialButton - android:id="@+id/qualityMidButton" - android:layout_width="wrap_content" - android:layout_height="48dp" - android:layout_margin="1sp" - android:layout_weight="1" - android:minWidth="1sp" - android:onClick="@{() -> listener.onChangePresetQuality(1)}" - android:text="@string/middle" /> + </RadioGroup> - <com.google.android.material.button.MaterialButton - android:id="@+id/qualityLowButton" - android:layout_width="wrap_content" - android:layout_height="48dp" - android:layout_weight="1" - android:minWidth="1sp" - android:onClick="@{() -> listener.onChangePresetQuality(0)}" - android:text="@string/low" /> + </LinearLayout> - </LinearLayout> + </TableRow> - </TableRow> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <TableLayout - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:orientation="vertical"> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent" - android:weightSum="2"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/editTextRenderScaleLayout" - android:layout_width="match_parent" - android:layout_height="48dp" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="@string/renderscale" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextRenderScale" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:hint="0.5/0.59/0.67/0.77/1.0" - android:inputType="numberDecimal" - android:onTextChanged="@{(s, st, b, a) -> listener.onRenderScaleChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={`` + config.renderScale}" /> - - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/editTextQualitySettingsLevelLayout" - android:layout_width="match_parent" - android:layout_height="48dp" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="QualityLevel (1/1/2/3/5)" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextQualitySettingsLevel" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:hint="1/1/2/3/5" - android:inputType="number" - android:onTextChanged="@{(s, st, b, a) -> listener.onQualitySettingsLevelChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={`` + config.qualitySettingsLevel}" /> - - </com.google.android.material.textfield.TextInputLayout> - - - </TableRow> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent" - android:weightSum="2"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/editTextVolumeIndexLayout" - android:layout_width="match_parent" - android:layout_height="48dp" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="VolumeIndex (0/1/2/3/4)" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextVolumeIndex" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:hint="0/1/2/3/4" - android:inputType="number" - android:onTextChanged="@{(s, st, b, a) -> listener.onVolumeIndexChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={`` + config.volumeIndex}" /> - - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/editTextMaxBufferPixelLayout" - android:layout_width="match_parent" - android:layout_height="48dp" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="MaxBufferPixel (1024/1440/2538/3384/8190)" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextMaxBufferPixel" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:hint="1024/1440/2538/3384/8190" - android:inputType="number" - android:onTextChanged="@{(s, st, b, a) -> listener.onMaxBufferPixelChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={`` + config.maxBufferPixel}" /> - - </com.google.android.material.textfield.TextInputLayout> - - - </TableRow> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent" - android:weightSum="2"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/editTextReflectionQualityLevelLayout" - android:layout_width="match_parent" - android:layout_height="48dp" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="ReflectionLevel (0~5)" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextReflectionQualityLevel" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:hint="0/1/2/3/4/5" - android:inputType="number" - android:onTextChanged="@{(s, st, b, a) -> listener.onReflectionQualityLevelChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={`` + config.reflectionQualityLevel}" /> - - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/editTextLodQualityLevelLayout" - android:layout_width="match_parent" - android:layout_height="48dp" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="LOD Level (0~5)" - app:boxBackgroundColor="@android:color/transparent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/editTextLodQualityLevel" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:ems="10" - android:hint="0/1/2/3/4/5" - android:inputType="number" - android:onTextChanged="@{(s, st, b, a) -> listener.onLodQualityLevelChanged(s, st, b, a)}" - android:paddingStart="0dp" - android:paddingEnd="0dp" - android:paddingBottom="0dp" - android:text="@={`` + config.lodQualityLevel}" /> - - </com.google.android.material.textfield.TextInputLayout> - - - </TableRow> - - </TableLayout> - </TableRow> - </TableLayout> - - </TableRow> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/StartGameButton" + <TableRow android:layout_width="match_parent" - android:layout_height="48dp" - android:onClick="@{() -> listener.onClickStartGame()}" - android:text="@string/start_game" /> - </TableRow> + android:layout_height="match_parent" + android:layout_marginTop="4sp" + android:background="@drawable/table_row_border"> - </TableLayout> - </LinearLayout> + <TableLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="vertical" + android:paddingLeft="10sp" + android:paddingRight="10sp" + android:paddingBottom="10sp" + android:stretchColumns="0"> - </ScrollView> - </androidx.constraintlayout.widget.ConstraintLayout> + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/SwitchUseCustomeGraphicSettings" + android:layout_width="match_parent" + android:layout_height="48dp" + android:checked="@={config.useCustomeGraphicSettings}" + android:onCheckedChanged="@{(view, value) -> listener.onUseCustomeGraphicSettingsChanged(value)}" + android:text="@string/useCustomeGraphicSettings" /> + </TableRow> + + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <com.google.android.material.button.MaterialButton + android:id="@+id/qualityRecordButton" + android:layout_width="wrap_content" + android:layout_height="48dp" + android:layout_margin="1sp" + android:layout_weight="1" + android:minWidth="1sp" + android:onClick="@{() -> listener.onChangePresetQuality(4)}" + android:text="@string/max_high" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/qualityVeryHighButton" + android:layout_width="wrap_content" + android:layout_height="48dp" + android:layout_margin="1sp" + android:layout_weight="1" + android:minWidth="1sp" + android:onClick="@{() -> listener.onChangePresetQuality(3)}" + android:text="@string/very_high" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/qualityHighButton" + android:layout_width="wrap_content" + android:layout_height="48dp" + android:layout_margin="1sp" + android:layout_weight="1" + android:minWidth="1sp" + android:onClick="@{() -> listener.onChangePresetQuality(2)}" + android:text="@string/hign" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/qualityMidButton" + android:layout_width="wrap_content" + android:layout_height="48dp" + android:layout_margin="1sp" + android:layout_weight="1" + android:minWidth="1sp" + android:onClick="@{() -> listener.onChangePresetQuality(1)}" + android:text="@string/middle" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/qualityLowButton" + android:layout_width="wrap_content" + android:layout_height="48dp" + android:layout_weight="1" + android:minWidth="1sp" + android:onClick="@{() -> listener.onChangePresetQuality(0)}" + android:text="@string/low" /> + + </LinearLayout> + + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TableLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="vertical"> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:weightSum="2"> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/editTextRenderScaleLayout" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_weight="1" + android:background="@android:color/transparent" + android:hint="@string/renderscale" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextRenderScale" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:hint="0.5/0.59/0.67/0.77/1.0" + android:inputType="numberDecimal" + android:onTextChanged="@{(s, st, b, a) -> listener.onRenderScaleChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={`` + config.renderScale}" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/editTextQualitySettingsLevelLayout" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_weight="1" + android:background="@android:color/transparent" + android:hint="QualityLevel (1/1/2/3/5)" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextQualitySettingsLevel" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:hint="1/1/2/3/5" + android:inputType="number" + android:onTextChanged="@{(s, st, b, a) -> listener.onQualitySettingsLevelChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={`` + config.qualitySettingsLevel}" /> + + </com.google.android.material.textfield.TextInputLayout> + + + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:weightSum="2"> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/editTextVolumeIndexLayout" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_weight="1" + android:background="@android:color/transparent" + android:hint="VolumeIndex (0/1/2/3/4)" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextVolumeIndex" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:hint="0/1/2/3/4" + android:inputType="number" + android:onTextChanged="@{(s, st, b, a) -> listener.onVolumeIndexChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={`` + config.volumeIndex}" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/editTextMaxBufferPixelLayout" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_weight="1" + android:background="@android:color/transparent" + android:hint="MaxBufferPixel (1024/1440/2538/3384/8190)" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextMaxBufferPixel" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:hint="1024/1440/2538/3384/8190" + android:inputType="number" + android:onTextChanged="@{(s, st, b, a) -> listener.onMaxBufferPixelChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={`` + config.maxBufferPixel}" /> + + </com.google.android.material.textfield.TextInputLayout> + + + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:weightSum="2"> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/editTextReflectionQualityLevelLayout" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_weight="1" + android:background="@android:color/transparent" + android:hint="ReflectionLevel (0~5)" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextReflectionQualityLevel" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:hint="0/1/2/3/4/5" + android:inputType="number" + android:onTextChanged="@{(s, st, b, a) -> listener.onReflectionQualityLevelChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={`` + config.reflectionQualityLevel}" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/editTextLodQualityLevelLayout" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_weight="1" + android:background="@android:color/transparent" + android:hint="LOD Level (0~5)" + app:boxBackgroundColor="@android:color/transparent"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/editTextLodQualityLevel" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:ems="10" + android:hint="0/1/2/3/4/5" + android:inputType="number" + android:onTextChanged="@{(s, st, b, a) -> listener.onLodQualityLevelChanged(s, st, b, a)}" + android:paddingStart="0dp" + android:paddingEnd="0dp" + android:paddingBottom="0dp" + android:text="@={`` + config.lodQualityLevel}" /> + + </com.google.android.material.textfield.TextInputLayout> + + + </TableRow> + + </TableLayout> + </TableRow> + </TableLayout> + + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.button.MaterialButton + android:id="@+id/StartGameButton" + android:layout_width="match_parent" + android:layout_height="48dp" + android:onClick="@{() -> listener.onClickStartGame()}" + android:text="@string/start_game" /> + </TableRow> + + </TableLayout> + </LinearLayout> + + </ScrollView> + </androidx.constraintlayout.widget.ConstraintLayout> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fabStartGame" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:layout_margin="16dp" + android:src="@drawable/start_game" + android:visibility="gone" + android:onClick="@{() -> listener.onClickStartGame()}" + android:contentDescription="startGameFab" /> + + </androidx.coordinatorlayout.widget.CoordinatorLayout> </layout> diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a9ae75c..bc9cb7d 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -19,4 +19,8 @@ <string name="hign">高</string> <string name="middle">中</string> <string name="low">低</string> + <string name="orientation_orig">游戏原版</string> + <string name="orientation_portrait">竖屏</string> + <string name="orientation_landscape">横屏</string> + <string name="orientation_lock">方向锁定</string> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 676fc24..a0299f4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,4 +19,9 @@ <string name="hign">High</string> <string name="middle">Mid</string> <string name="low">Low</string> + <string name="orientation_orig">Original</string> + <string name="orientation_portrait">Portrait</string> + <string name="orientation_landscape">Landscape</string> + <string name="orientation_lock">Original Lock</string> + </resources> \ No newline at end of file