mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
PS4 Firmware 8.0 Compatibility (Fix #328)
This commit is contained in:
parent
f1071f31b6
commit
4dac2253df
20 changed files with 1273 additions and 136 deletions
|
@ -31,6 +31,7 @@ android {
|
|||
arguments "-DCHIAKI_ENABLE_TESTS=OFF",
|
||||
"-DCHIAKI_ENABLE_CLI=OFF",
|
||||
"-DCHIAKI_ENABLE_GUI=OFF",
|
||||
"-DCHIAKI_ENABLE_SETSU=OFF",
|
||||
"-DCHIAKI_ENABLE_ANDROID=ON",
|
||||
"-DCHIAKI_LIB_ENABLE_OPUS=OFF",
|
||||
"-DCHIAKI_LIB_OPENSSL_EXTERNAL_PROJECT=ON"
|
||||
|
|
|
@ -702,6 +702,11 @@ JNIEXPORT void JNICALL JNI_FCN(registStart)(JNIEnv *env, jobject obj, jobject re
|
|||
")V");
|
||||
|
||||
jclass regist_info_class = E->GetObjectClass(env, regist_info_obj);
|
||||
|
||||
jobject target_obj = E->GetObjectField(env, regist_info_obj, E->GetFieldID(env, regist_info_class, "target", "L"BASE_PACKAGE"/Target;"));
|
||||
jclass target_class = E->GetObjectClass(env, target_obj);
|
||||
jint target_value = E->GetIntField(env, target_obj, E->GetFieldID(env, target_class, "value", "I"));
|
||||
|
||||
jstring host_string = E->GetObjectField(env, regist_info_obj, E->GetFieldID(env, regist_info_class, "host", "Ljava/lang/String;"));
|
||||
jboolean broadcast = E->GetBooleanField(env, regist_info_obj, E->GetFieldID(env, regist_info_class, "broadcast", "Z"));
|
||||
jstring psn_online_id_string = E->GetObjectField(env, regist_info_obj, E->GetFieldID(env, regist_info_class, "psnOnlineId", "Ljava/lang/String;"));
|
||||
|
@ -709,6 +714,7 @@ JNIEXPORT void JNICALL JNI_FCN(registStart)(JNIEnv *env, jobject obj, jobject re
|
|||
jint pin = E->GetIntField(env, regist_info_obj, E->GetFieldID(env, regist_info_class, "pin", "I"));
|
||||
|
||||
ChiakiRegistInfo regist_info = { 0 };
|
||||
regist_info.target = (ChiakiTarget)target_value;
|
||||
regist_info.host = E->GetStringUTFChars(env, host_string, NULL);
|
||||
regist_info.broadcast = broadcast;
|
||||
if(psn_online_id_string)
|
||||
|
|
|
@ -3,11 +3,19 @@ package com.metallic.chiaki.lib
|
|||
import android.os.Parcelable
|
||||
import android.util.Log
|
||||
import android.view.Surface
|
||||
import kotlinx.android.parcel.IgnoredOnParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import java.lang.Exception
|
||||
import java.net.InetSocketAddress
|
||||
import kotlin.math.abs
|
||||
|
||||
enum class Target(val value: Int)
|
||||
{
|
||||
PS4_8(800),
|
||||
PS4_9(900),
|
||||
PS4_10(1000)
|
||||
}
|
||||
|
||||
enum class VideoResolutionPreset(val value: Int)
|
||||
{
|
||||
RES_360P(1),
|
||||
|
@ -316,6 +324,7 @@ class DiscoveryService(
|
|||
|
||||
@Parcelize
|
||||
data class RegistInfo(
|
||||
val target: Target,
|
||||
val host: String,
|
||||
val broadcast: Boolean,
|
||||
val psnOnlineId: String?,
|
||||
|
|
|
@ -28,6 +28,7 @@ import androidx.lifecycle.ViewModelProvider
|
|||
import com.metallic.chiaki.R
|
||||
import com.metallic.chiaki.common.ext.RevealActivity
|
||||
import com.metallic.chiaki.lib.RegistInfo
|
||||
import com.metallic.chiaki.lib.Target
|
||||
import kotlinx.android.synthetic.main.activity_regist.*
|
||||
import java.lang.IllegalArgumentException
|
||||
|
||||
|
@ -63,7 +64,8 @@ class RegistActivity: AppCompatActivity(), RevealActivity
|
|||
|
||||
registButton.setOnClickListener { doRegist() }
|
||||
|
||||
ps4VersionRadioGroup.check(when(viewModel.ps4Version.value ?: RegistViewModel.PS4Version.GE_7) {
|
||||
ps4VersionRadioGroup.check(when(viewModel.ps4Version.value ?: RegistViewModel.PS4Version.GE_8) {
|
||||
RegistViewModel.PS4Version.GE_8 -> R.id.ps4VersionGE8RadioButton
|
||||
RegistViewModel.PS4Version.GE_7 -> R.id.ps4VersionGE7RadioButton
|
||||
RegistViewModel.PS4Version.LT_7 -> R.id.ps4VersionLT7RadioButton
|
||||
})
|
||||
|
@ -71,6 +73,7 @@ class RegistActivity: AppCompatActivity(), RevealActivity
|
|||
ps4VersionRadioGroup.setOnCheckedChangeListener { _, checkedId ->
|
||||
viewModel.ps4Version.value = when(checkedId)
|
||||
{
|
||||
R.id.ps4VersionGE8RadioButton -> RegistViewModel.PS4Version.GE_8
|
||||
R.id.ps4VersionGE7RadioButton -> RegistViewModel.PS4Version.GE_7
|
||||
R.id.ps4VersionLT7RadioButton -> RegistViewModel.PS4Version.LT_7
|
||||
else -> RegistViewModel.PS4Version.GE_7
|
||||
|
@ -78,11 +81,11 @@ class RegistActivity: AppCompatActivity(), RevealActivity
|
|||
}
|
||||
|
||||
viewModel.ps4Version.observe(this, Observer {
|
||||
psnAccountIdHelpGroup.visibility = if(it == RegistViewModel.PS4Version.GE_7) View.VISIBLE else View.GONE
|
||||
psnAccountIdHelpGroup.visibility = if(it == RegistViewModel.PS4Version.LT_7) View.GONE else View.VISIBLE
|
||||
psnIdTextInputLayout.hint = getString(when(it!!)
|
||||
{
|
||||
RegistViewModel.PS4Version.GE_7 -> R.string.hint_regist_psn_account_id
|
||||
RegistViewModel.PS4Version.LT_7 -> R.string.hint_regist_psn_online_id
|
||||
else -> R.string.hint_regist_psn_account_id
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -98,14 +101,14 @@ class RegistActivity: AppCompatActivity(), RevealActivity
|
|||
val psnId = psnIdEditText.text.toString().trim()
|
||||
val psnOnlineId: String? = if(ps4Version == RegistViewModel.PS4Version.LT_7) psnId else null
|
||||
val psnAccountId: ByteArray? =
|
||||
if(ps4Version == RegistViewModel.PS4Version.GE_7)
|
||||
if(ps4Version != RegistViewModel.PS4Version.LT_7)
|
||||
try { Base64.decode(psnId, Base64.DEFAULT) } catch(e: IllegalArgumentException) { null }
|
||||
else
|
||||
null
|
||||
val psnIdValid = when(ps4Version)
|
||||
{
|
||||
RegistViewModel.PS4Version.GE_7 -> psnAccountId != null && psnAccountId.size == RegistInfo.ACCOUNT_ID_SIZE
|
||||
RegistViewModel.PS4Version.LT_7 -> psnOnlineId?.isNotEmpty() ?: false
|
||||
else -> psnAccountId != null && psnAccountId.size == RegistInfo.ACCOUNT_ID_SIZE
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,8 +120,8 @@ class RegistActivity: AppCompatActivity(), RevealActivity
|
|||
if(!psnIdValid)
|
||||
getString(when(ps4Version)
|
||||
{
|
||||
RegistViewModel.PS4Version.GE_7 -> R.string.regist_psn_account_id_invalid
|
||||
RegistViewModel.PS4Version.LT_7 -> R.string.regist_psn_online_id_invalid
|
||||
else -> R.string.regist_psn_account_id_invalid
|
||||
})
|
||||
else
|
||||
null
|
||||
|
@ -127,7 +130,14 @@ class RegistActivity: AppCompatActivity(), RevealActivity
|
|||
if(!hostValid || !psnIdValid || !pinValid)
|
||||
return
|
||||
|
||||
val registInfo = RegistInfo(host, broadcast, psnOnlineId, psnAccountId, pin.toInt())
|
||||
val target = when(ps4Version)
|
||||
{
|
||||
RegistViewModel.PS4Version.GE_8 -> Target.PS4_10
|
||||
RegistViewModel.PS4Version.GE_7 -> Target.PS4_9
|
||||
RegistViewModel.PS4Version.LT_7 -> Target.PS4_8
|
||||
}
|
||||
|
||||
val registInfo = RegistInfo(target, host, broadcast, psnOnlineId, psnAccountId, pin.toInt())
|
||||
|
||||
Intent(this, RegistExecuteActivity::class.java).also {
|
||||
it.putExtra(RegistExecuteActivity.EXTRA_REGIST_INFO, registInfo)
|
||||
|
|
|
@ -23,9 +23,10 @@ import androidx.lifecycle.ViewModel
|
|||
class RegistViewModel: ViewModel()
|
||||
{
|
||||
enum class PS4Version {
|
||||
GE_8,
|
||||
GE_7,
|
||||
LT_7
|
||||
}
|
||||
|
||||
val ps4Version = MutableLiveData<PS4Version>(PS4Version.GE_7)
|
||||
val ps4Version = MutableLiveData<PS4Version>(PS4Version.GE_8)
|
||||
}
|
|
@ -69,13 +69,22 @@
|
|||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toBottomOf="@id/broadcastCheckBox">
|
||||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
android:id="@+id/ps4VersionGE8RadioButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/regist_option_ps4_ge_8"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"/>
|
||||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
android:id="@+id/ps4VersionGE7RadioButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/regist_option_ps4_ge_7"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"/>
|
||||
android:checked="false"
|
||||
android:text="@string/regist_option_ps4_ge_7" />
|
||||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
android:id="@+id/ps4VersionLT7RadioButton"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
<string name="hint_regist_host">Host</string>
|
||||
<string name="regist_broadcast">Broadcast</string>
|
||||
<string name="regist_option_ps4_lt_7">PS4 < 7.0</string>
|
||||
<string name="regist_option_ps4_ge_7">PS4 ≥ 7.0</string>
|
||||
<string name="regist_option_ps4_ge_7">PS4 ≥ 7.0, < 8</string>
|
||||
<string name="regist_option_ps4_ge_8">PS4 ≥ 8.0</string>
|
||||
<string name="regist_psn_account_id_help">About obtaining your Account ID, see</string>
|
||||
<string name="regist_psn_account_id_help_url">https://github.com/thestr4ng3r/chiaki/blob/master/README.md#obtaining-your-psn-accountid</string>
|
||||
<string name="hint_regist_psn_online_id">PSN Online ID (username, case-sensitive)</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue