diff --git a/android/app/src/cpp/android_host_interface.cpp b/android/app/src/cpp/android_host_interface.cpp index 99b21248f..460427b44 100644 --- a/android/app/src/cpp/android_host_interface.cpp +++ b/android/app/src/cpp/android_host_interface.cpp @@ -57,7 +57,8 @@ AndroidHostInterface::AndroidHostInterface(jobject java_object) : m_java_object( m_settings.SetDefaults(); m_settings.bios_path = "/sdcard/PSX/BIOS/scph1001.bin"; m_settings.memory_card_a_path = "/sdcard/PSX/memory_card_a.mcd"; - m_settings.cpu_execution_mode = CPUExecutionMode::CachedInterpreter; + m_settings.cpu_execution_mode = CPUExecutionMode::Recompiler; + //m_settings.cpu_execution_mode = CPUExecutionMode::CachedInterpreter; //m_settings.gpu_renderer = GPURenderer::Software; m_settings.speed_limiter_enabled = false; m_settings.video_sync_enabled = false; @@ -453,7 +454,7 @@ DEFINE_JNI_ARGS_METHOD(jarray, GameList_getEntries, jobject unused, jstring j_ca jclass entry_class = env->FindClass("com/github/stenzek/duckstation/GameListEntry"); Assert(entry_class != nullptr); - jmethodID entry_constructor = env->GetMethodID(entry_class, "", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V"); + jmethodID entry_constructor = env->GetMethodID(entry_class, "", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V"); Assert(entry_constructor != nullptr); jobjectArray entry_array = env->NewObjectArray(gl.GetEntryCount(), entry_class, nullptr); @@ -466,9 +467,10 @@ DEFINE_JNI_ARGS_METHOD(jarray, GameList_getEntries, jobject unused, jstring j_ca jstring code = env->NewStringUTF(entry.code.c_str()); jstring title = env->NewStringUTF(entry.title.c_str()); jstring region = env->NewStringUTF(Settings::GetConsoleRegionName(entry.region)); + jstring type = env->NewStringUTF(GameList::EntryTypeToString(entry.type)); jlong size = entry.total_size; - jobject entry_jobject = env->NewObject(entry_class, entry_constructor, path, code, title, region, size); + jobject entry_jobject = env->NewObject(entry_class, entry_constructor, path, code, title, region, type, size); env->SetObjectArrayElement(entry_array, counter++, entry_jobject); } diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/GameListEntry.java b/android/app/src/main/java/com/github/stenzek/duckstation/GameListEntry.java index d4d4cab30..d61e5aada 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/GameListEntry.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/GameListEntry.java @@ -7,13 +7,21 @@ import android.widget.TextView; import androidx.core.content.ContextCompat; public class GameListEntry { + public enum EntryType + { + Disc, + PSExe + } + private String mPath; private String mCode; private String mTitle; private ConsoleRegion mRegion; + private EntryType mType; private long mSize; - public GameListEntry(String path, String code, String title, String region, long size) { + public GameListEntry(String path, String code, String title, String region, + String type, long size) { mPath = path; mCode = code; mTitle = title; @@ -24,6 +32,12 @@ public class GameListEntry { } catch (IllegalArgumentException e) { mRegion = ConsoleRegion.NTSC_U; } + + try { + mType = EntryType.valueOf(type); + } catch (IllegalArgumentException e) { + mType = EntryType.Disc; + } } public String getPath() { @@ -42,6 +56,8 @@ public class GameListEntry { return mRegion; } + public EntryType getType() { return mType; } + public void fillView(View view) { ((TextView) view.findViewById(R.id.game_list_view_entry_title)).setText(mTitle); ((TextView) view.findViewById(R.id.game_list_view_entry_path)).setText(mPath); @@ -49,21 +65,36 @@ public class GameListEntry { String sizeString = String.format("%.2f MB", (double) mSize / 1048576.0); ((TextView) view.findViewById(R.id.game_list_view_entry_size)).setText(sizeString); - int drawableId; + int regionDrawableId; switch (mRegion) { case NTSC_J: - drawableId = R.drawable.flag_jp; + regionDrawableId = R.drawable.flag_jp; break; case NTSC_U: default: - drawableId = R.drawable.flag_us; + regionDrawableId = R.drawable.flag_us; break; case PAL: - drawableId = R.drawable.flag_eu; + regionDrawableId = R.drawable.flag_eu; break; } ((ImageView) view.findViewById(R.id.game_list_view_entry_region_icon)) - .setImageDrawable(ContextCompat.getDrawable(view.getContext(), drawableId)); + .setImageDrawable(ContextCompat.getDrawable(view.getContext(), regionDrawableId)); + + int typeDrawableId; + switch (mType) { + case Disc: + default: + typeDrawableId = R.drawable.ic_media_cdrom; + break; + + case PSExe: + typeDrawableId = R.drawable.ic_emblem_system; + break; + } + + ((ImageView) view.findViewById(R.id.game_list_view_entry_type_icon)) + .setImageDrawable(ContextCompat.getDrawable(view.getContext(), typeDrawableId)); } } diff --git a/android/app/src/main/res/drawable/ic_emblem_system.xml b/android/app/src/main/res/drawable/ic_emblem_system.xml new file mode 100644 index 000000000..32b3d2397 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_emblem_system.xml @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/ic_media_cdrom.xml b/android/app/src/main/res/drawable/ic_media_cdrom.xml new file mode 100644 index 000000000..74afde8b9 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_media_cdrom.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/layout/game_list_view_entry.xml b/android/app/src/main/res/layout/game_list_view_entry.xml index 1ba1ab962..8f40b4686 100644 --- a/android/app/src/main/res/layout/game_list_view_entry.xml +++ b/android/app/src/main/res/layout/game_list_view_entry.xml @@ -6,32 +6,42 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + @@ -52,12 +62,13 @@ android:id="@+id/game_list_view_entry_region_icon" android:layout_width="32dp" android:layout_height="28dp" - android:layout_marginTop="4px" + android:layout_marginTop="8px" android:layout_marginEnd="8dp" - android:paddingBottom="8px" android:focusable="false" android:focusableInTouchMode="false" + android:paddingBottom="8px" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/game_list_view_entry_size" app:srcCompat="@drawable/flag_jp" /> + \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 21184e4b1..b57a6c6e5 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -3,8 +3,8 @@ diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index ae087e693..ea9a26525 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -5,6 +5,7 @@ #include "common/cd_image.h" #include "common/iso_reader.h" #include +#include #include #include #include @@ -20,6 +21,12 @@ GameList::GameList() = default; GameList::~GameList() = default; +const char* GameList::EntryTypeToString(GameList::EntryType type) +{ + static std::array names = {{"Disc", "PSExe"}}; + return names[static_cast(type)]; +} + std::string GameList::GetGameCodeForPath(const char* image_path) { std::unique_ptr cdi = CDImage::Open(image_path); diff --git a/src/core/game_list.h b/src/core/game_list.h index c39d0d17b..bcc60dfd3 100644 --- a/src/core/game_list.h +++ b/src/core/game_list.h @@ -41,6 +41,8 @@ public: GameList(); ~GameList(); + static const char* EntryTypeToString(EntryType type); + static std::string GetGameCodeForImage(CDImage* cdi); static std::string GetGameCodeForPath(const char* image_path); static std::optional GetRegionForCode(std::string_view code);