From 5b0c047e0bb9391883e33026798f9e401c8d911b Mon Sep 17 00:00:00 2001 From: Eder Bastos Date: Sat, 16 May 2015 20:52:55 -0400 Subject: Android: Remove inheritance from Game model, and improve the relevance of its content --- Source/Core/DolphinWX/MainAndroid.cpp | 62 +++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 24 deletions(-) (limited to 'Source/Core/DolphinWX/MainAndroid.cpp') diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp index 44391f0ccd..39bd373667 100644 --- a/Source/Core/DolphinWX/MainAndroid.cpp +++ b/Source/Core/DolphinWX/MainAndroid.cpp @@ -162,38 +162,52 @@ static bool LoadBanner(std::string filename, u32 *Banner) return false; } -static bool IsWiiTitle(std::string filename) +static int GetCountry(std::string filename) { std::unique_ptr pVolume(DiscIO::CreateVolumeFromFilename(filename)); if (pVolume != nullptr) { - bool is_wii_title = pVolume->IsWiiDisc() || pVolume->IsWadFile(); + DiscIO::IVolume::ECountry country = pVolume->GetCountry(); - __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Is %s a Wii Disc: %s", filename.c_str(), is_wii_title ? "Yes" : "No" ); + __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Country Code: %i", country); - return is_wii_title; + return country; } - // Technically correct. - return false; + // Return UNKNOWN + return 13; } -static int GetCountry(std::string filename) +static int GetPlatform(std::string filename) { std::unique_ptr pVolume(DiscIO::CreateVolumeFromFilename(filename)); if (pVolume != nullptr) { - DiscIO::IVolume::ECountry country = pVolume->GetCountry(); + bool is_wii_disc = pVolume->IsWiiDisc(); + bool is_wii_wad = pVolume->IsWadFile(); - __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Country Code: %i", country); + if (is_wii_disc) + { + __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii disc."); - return country; + // See Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/Game.java + return 1; + } + else if (is_wii_wad) + { + __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii WAD."); + return 2; + } + else + { + __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Gamecube disc."); + return 0; + } } - // Technically correct. - return 13; + return -1; } static std::string GetTitle(std::string filename) @@ -292,15 +306,15 @@ static std::string GetGameId(std::string filename) return std::string (""); } -static std::string GetApploaderDate(std::string filename) +static std::string GetCompany(std::string filename) { - __android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Date for file: %s", filename.c_str()); + __android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Company for file: %s", filename.c_str()); DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(filename); if (pVolume != nullptr) { - std::string date = pVolume->GetApploaderDate(); - __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Date: %s", date.c_str()); + std::string date = pVolume->GetCompany(); + __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Company: %s", date.c_str()); return date; } @@ -349,9 +363,9 @@ JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBann JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDescription(JNIEnv *env, jobject obj, jstring jFilename); JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId(JNIEnv *env, jobject obj, jstring jFilename); JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv *env, jobject obj, jstring jFilename); -JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDate(JNIEnv *env, jobject obj, jstring jFilename); +JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(JNIEnv *env, jobject obj, jstring jFilename); JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize(JNIEnv *env, jobject obj, jstring jFilename); -JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsWiiTitle(JNIEnv *env, jobject obj, jstring jFilename); +JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv *env, jobject obj, jstring jFilename); JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv *env, jobject obj); JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv *env, jobject obj); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv *env, jobject obj); @@ -423,11 +437,11 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId return env->NewStringUTF(id.c_str()); } -JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDate(JNIEnv *env, jobject obj, jstring jFilename) +JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(JNIEnv *env, jobject obj, jstring jFilename) { std::string filename = GetJString(env, jFilename); - std::string date = GetApploaderDate(filename); - return env->NewStringUTF(date.c_str()); + std::string company = GetCompany(filename); + return env->NewStringUTF(company.c_str()); } JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv *env, jobject obj, jstring jFilename) @@ -444,11 +458,11 @@ JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize return size; } -JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsWiiTitle(JNIEnv *env, jobject obj, jstring jFilename) +JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv *env, jobject obj, jstring jFilename) { std::string filename = GetJString(env, jFilename); - bool wiiDisc = IsWiiTitle(filename); - return wiiDisc; + int platform = GetPlatform(filename); + return platform; } JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv *env, jobject obj) -- cgit v1.2.3