mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-27 19:31:49 +01:00
Follow typical per-file detail formatting
Format the details in the expected format of individual files (instead of a complete game) and move the code to match the updated placement.
This commit is contained in:
parent
5d6eaee301
commit
04cae942ea
@ -61,8 +61,8 @@ extern "C" JNIEXPORT jint JNICALL Java_emu_skyline_loader_RomFile_populate(JNIEn
|
||||
language = loader->nacp->GetFirstSupportedTitleLanguage();
|
||||
|
||||
env->SetObjectField(thiz, applicationNameField, env->NewStringUTF(loader->nacp->GetApplicationName(language).c_str()));
|
||||
env->SetObjectField(thiz, applicationAuthorField, env->NewStringUTF(loader->nacp->GetApplicationPublisher(language).c_str()));
|
||||
env->SetObjectField(thiz, applicationVersionField, env->NewStringUTF(loader->nacp->GetApplicationVersion().c_str()));
|
||||
env->SetObjectField(thiz, applicationAuthorField, env->NewStringUTF(loader->nacp->GetApplicationPublisher(language).c_str()));
|
||||
|
||||
auto icon{loader->GetIcon(language)};
|
||||
jbyteArray iconByteArray{env->NewByteArray(static_cast<jsize>(icon.size()))};
|
||||
|
@ -29,13 +29,13 @@ namespace skyline::vfs {
|
||||
return std::string(applicationName.as_string(true));
|
||||
}
|
||||
|
||||
std::string NACP::GetApplicationPublisher(language::ApplicationLanguage language) {
|
||||
auto applicationPublisher{span(nacpContents.titleEntries.at(static_cast<size_t>(language)).applicationPublisher)};
|
||||
return std::string(applicationPublisher.as_string(true));
|
||||
}
|
||||
|
||||
std::string NACP::GetApplicationVersion() {
|
||||
auto applicationPublisher{span(nacpContents.displayVersion)};
|
||||
return std::string(applicationPublisher.as_string(true));
|
||||
}
|
||||
|
||||
std::string NACP::GetApplicationPublisher(language::ApplicationLanguage language) {
|
||||
auto applicationPublisher{span(nacpContents.titleEntries.at(static_cast<size_t>(language)).applicationPublisher)};
|
||||
return std::string(applicationPublisher.as_string(true));
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ namespace skyline::vfs {
|
||||
|
||||
std::string GetApplicationName(language::ApplicationLanguage language);
|
||||
|
||||
std::string GetApplicationPublisher(language::ApplicationLanguage language);
|
||||
|
||||
std::string GetApplicationVersion();
|
||||
|
||||
std::string GetApplicationPublisher(language::ApplicationLanguage language);
|
||||
};
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ class AppDialog : BottomSheetDialogFragment() {
|
||||
|
||||
binding.gameIcon.setImageBitmap(item.icon ?: missingIcon)
|
||||
binding.gameTitle.text = item.title
|
||||
binding.gameSubtitle.text = item.subTitle ?: item.loaderResultString(requireContext())
|
||||
binding.gameVersion.text = item.version ?: item.loaderResultString(requireContext())
|
||||
binding.gameSubtitle.text = item.subTitle ?: item.loaderResultString(requireContext())
|
||||
|
||||
binding.gamePlay.isEnabled = item.loaderResult == LoaderResult.Success
|
||||
binding.gamePlay.setOnClickListener {
|
||||
|
@ -44,10 +44,10 @@ interface LayoutBinding<V : ViewBinding> : ViewBinding {
|
||||
|
||||
val textTitle : TextView
|
||||
|
||||
val textSubtitle : TextView
|
||||
|
||||
val textVersion : TextView
|
||||
|
||||
val textSubtitle : TextView
|
||||
|
||||
val icon : ImageView
|
||||
}
|
||||
|
||||
@ -56,10 +56,10 @@ class ListBinding(parent : ViewGroup) : LayoutBinding<AppItemLinearBinding> {
|
||||
|
||||
override val textTitle = binding.textTitle
|
||||
|
||||
override val textSubtitle = binding.textSubtitle
|
||||
|
||||
override val textVersion = binding.textVersion
|
||||
|
||||
override val textSubtitle = binding.textSubtitle
|
||||
|
||||
override val icon = binding.icon
|
||||
}
|
||||
|
||||
@ -68,10 +68,10 @@ class GridBinding(parent : ViewGroup) : LayoutBinding<AppItemGridBinding> {
|
||||
|
||||
override val textTitle = binding.textTitle
|
||||
|
||||
override val textSubtitle = binding.textSubtitle
|
||||
|
||||
override val textVersion = binding.textVersion
|
||||
|
||||
override val textSubtitle = binding.textSubtitle
|
||||
|
||||
override val icon = binding.icon
|
||||
}
|
||||
|
||||
@ -80,10 +80,10 @@ class GridCompatBinding(parent : ViewGroup) : LayoutBinding<AppItemGridCompactBi
|
||||
|
||||
override val textTitle = binding.textTitle
|
||||
|
||||
override val textSubtitle = binding.textSubtitle
|
||||
|
||||
override val textVersion = binding.textVersion
|
||||
|
||||
override val textSubtitle = binding.textSubtitle
|
||||
|
||||
override val icon = binding.icon
|
||||
}
|
||||
|
||||
@ -95,8 +95,8 @@ class AppViewItem(var layoutType : LayoutType, private val item : AppItem, priva
|
||||
override fun bind(holder : GenericViewHolder<LayoutBinding<*>>, position : Int) {
|
||||
val binding = holder.binding
|
||||
binding.textTitle.text = item.title
|
||||
binding.textSubtitle.text = item.subTitle ?: item.loaderResultString(binding.root.context)
|
||||
binding.textVersion.text = item.version ?: item.loaderResultString(binding.root.context)
|
||||
binding.textSubtitle.text = item.subTitle ?: item.loaderResultString(binding.root.context)
|
||||
|
||||
binding.icon.setImageBitmap(item.icon ?: missingIcon)
|
||||
|
||||
|
@ -29,6 +29,11 @@ data class AppItem(private val meta : AppEntry) : DataItem() {
|
||||
*/
|
||||
val title get() = meta.name
|
||||
|
||||
/**
|
||||
* The application version
|
||||
*/
|
||||
val version get() = meta.version
|
||||
|
||||
/**
|
||||
* The string used as the sub-title, we currently use the author
|
||||
*/
|
||||
@ -39,11 +44,6 @@ data class AppItem(private val meta : AppEntry) : DataItem() {
|
||||
*/
|
||||
val uri get() = meta.uri
|
||||
|
||||
/**
|
||||
* The application version
|
||||
*/
|
||||
val version get() = meta.version
|
||||
|
||||
val loaderResult get() = meta.loaderResult
|
||||
|
||||
fun loaderResultString(context : Context) = context.getString(when (meta.loaderResult) {
|
||||
|
@ -65,9 +65,9 @@ enum class LoaderResult(val value : Int) {
|
||||
*/
|
||||
data class AppEntry(
|
||||
var name : String,
|
||||
var version : String?,
|
||||
var author : String?,
|
||||
var icon : Bitmap?,
|
||||
var version : String?,
|
||||
var format : RomFormat,
|
||||
var uri : Uri,
|
||||
var loaderResult : LoaderResult
|
||||
@ -82,12 +82,12 @@ data class AppEntry(
|
||||
output.writeUTF(name)
|
||||
output.writeObject(format)
|
||||
output.writeUTF(uri.toString())
|
||||
output.writeBoolean(author != null)
|
||||
if (author != null)
|
||||
output.writeUTF(author)
|
||||
output.writeBoolean(version != null)
|
||||
if (version != null)
|
||||
output.writeUTF(version)
|
||||
output.writeBoolean(author != null)
|
||||
if (author != null)
|
||||
output.writeUTF(author)
|
||||
output.writeInt(loaderResult.value)
|
||||
output.writeBoolean(icon != null)
|
||||
icon?.let {
|
||||
@ -103,10 +103,10 @@ data class AppEntry(
|
||||
name = input.readUTF()
|
||||
format = input.readObject() as RomFormat
|
||||
uri = Uri.parse(input.readUTF())
|
||||
if (input.readBoolean())
|
||||
author = input.readUTF()
|
||||
if (input.readBoolean())
|
||||
version = input.readUTF()
|
||||
if (input.readBoolean())
|
||||
author = input.readUTF()
|
||||
loaderResult = LoaderResult.get(input.readInt())
|
||||
if (input.readBoolean())
|
||||
icon = BitmapFactory.decodeStream(input)
|
||||
@ -129,6 +129,11 @@ internal class RomFile(context : Context, format : RomFormat, uri : Uri, systemL
|
||||
*/
|
||||
private var applicationName : String? = null
|
||||
|
||||
/**
|
||||
* @note This field is filled in by native code
|
||||
*/
|
||||
private var applicationVersion : String? = null
|
||||
|
||||
/**
|
||||
* @note This field is filled in by native code
|
||||
*/
|
||||
@ -139,11 +144,6 @@ internal class RomFile(context : Context, format : RomFormat, uri : Uri, systemL
|
||||
*/
|
||||
private var rawIcon : ByteArray? = null
|
||||
|
||||
/**
|
||||
* @note This field is filled in by native code
|
||||
*/
|
||||
private var applicationVersion : String? = null
|
||||
|
||||
val appEntry : AppEntry
|
||||
|
||||
var result = LoaderResult.Success
|
||||
@ -157,10 +157,10 @@ internal class RomFile(context : Context, format : RomFormat, uri : Uri, systemL
|
||||
}
|
||||
|
||||
appEntry = applicationName?.let { name ->
|
||||
applicationAuthor?.let { author ->
|
||||
applicationVersion?.let { version ->
|
||||
applicationVersion?.let { version ->
|
||||
applicationAuthor?.let { author ->
|
||||
rawIcon?.let { icon ->
|
||||
AppEntry(name, author, BitmapFactory.decodeByteArray(icon, 0, icon.size), version, format, uri, result)
|
||||
AppEntry(name, version, author, BitmapFactory.decodeByteArray(icon, 0, icon.size), format, uri, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,17 +34,6 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="The Legend of Zelda: Breath of the Wild" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="@android:color/tertiary_text_light"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="@id/game_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/game_title"
|
||||
tools:text="Nintendo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_version"
|
||||
android:layout_width="wrap_content"
|
||||
@ -52,11 +41,22 @@
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="@android:color/tertiary_text_light"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toStartOf="@id/game_subtitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/game_subtitle"
|
||||
tools:layout_editor_absoluteY="64dp"
|
||||
app:layout_constraintStart_toStartOf="@id/game_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/game_title"
|
||||
tools:text="Version" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="@android:color/tertiary_text_light"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="@id/game_version"
|
||||
app:layout_constraintTop_toBottomOf="@id/game_version"
|
||||
tools:layout_editor_absoluteY="64dp"
|
||||
tools:text="Nintendo" />
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -40,7 +40,7 @@
|
||||
tools:text="Title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_subtitle"
|
||||
android:id="@+id/text_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
@ -49,10 +49,10 @@
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp"
|
||||
tools:text="Subtitle" />
|
||||
tools:text="Version" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_version"
|
||||
android:id="@+id/text_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
@ -62,5 +62,5 @@
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp"
|
||||
tools:text="Version" />
|
||||
tools:text="Subtitle" />
|
||||
</LinearLayout>
|
||||
|
@ -40,13 +40,13 @@
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/text_subtitle"
|
||||
app:layout_constraintBottom_toTopOf="@id/text_version"
|
||||
app:layout_constraintEnd_toEndOf="@id/icon"
|
||||
app:layout_constraintStart_toStartOf="@id/icon"
|
||||
tools:text="Title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_subtitle"
|
||||
android:id="@+id/text_version"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="242.25"
|
||||
@ -59,13 +59,13 @@
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="@android:color/white"
|
||||
app:layout_constraintBottom_toTopOf="@id/text_version"
|
||||
app:layout_constraintBottom_toTopOf="@id/text_subtitle"
|
||||
app:layout_constraintEnd_toEndOf="@id/icon"
|
||||
app:layout_constraintStart_toStartOf="@id/icon"
|
||||
tools:text="Subtitle" />
|
||||
tools:text="Version" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_version"
|
||||
android:id="@+id/text_subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
@ -82,6 +82,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/icon"
|
||||
app:layout_constraintEnd_toEndOf="@id/icon"
|
||||
app:layout_constraintStart_toStartOf="@id/icon"
|
||||
tools:text="Version" />
|
||||
tools:text="Subtitle" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
@ -29,7 +29,7 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/text_subtitle"
|
||||
app:layout_constraintBottom_toTopOf="@id/text_version"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
@ -37,21 +37,22 @@
|
||||
tools:text="Title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_subtitle"
|
||||
android:id="@+id/text_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="@android:color/tertiary_text_light"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/text_subtitle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_title"
|
||||
tools:text="SubTitle" />
|
||||
app:layout_constraintTop_toBottomOf="@id/text_title"
|
||||
tools:text="Version" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_version"
|
||||
android:id="@+id/text_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
@ -62,6 +63,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_subtitle"
|
||||
tools:text="Version" />
|
||||
app:layout_constraintTop_toBottomOf="@id/text_version"
|
||||
tools:text="SubTitle" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user