Android: Implement reading country value from game files.

This commit is contained in:
Eder Bastos
2015-05-16 19:02:46 -04:00
parent 12493c332c
commit 4c786cb70c
8 changed files with 74 additions and 11 deletions

View File

@ -132,6 +132,8 @@ public final class NativeLibrary
public static native String GetDescription(String filename);
public static native String GetGameId(String filename);
public static native int GetCountry(String filename);
public static native String GetDate(String filename);
public static native long GetFilesize(String filename);
public static native boolean IsWiiTitle(String filename);

View File

@ -181,8 +181,7 @@ public final class GameGridActivity extends Activity
{
GcGame game = new GcGame(NativeLibrary.GetTitle(entry.getAbsolutePath()),
NativeLibrary.GetDescription(entry.getAbsolutePath()).replace("\n", " "),
// TODO Some games might actually not be from this region, believe it or not.
"United States",
NativeLibrary.GetCountry(entry.getAbsolutePath()),
entry.getAbsolutePath(),
NativeLibrary.GetGameId(entry.getAbsolutePath()),
NativeLibrary.GetDate(entry.getAbsolutePath()));

View File

@ -38,7 +38,7 @@ public class GameDetailsDialog extends DialogFragment
Bundle arguments = new Bundle();
arguments.putString(ARGUMENT_GAME_TITLE, game.getTitle());
arguments.putString(ARGUMENT_GAME_DESCRIPTION, game.getDescription());
arguments.putString(ARGUMENT_GAME_COUNTRY, game.getCountry());
arguments.putInt(ARGUMENT_GAME_COUNTRY, game.getCountry());
arguments.putString(ARGUMENT_GAME_DATE, game.getDate());
arguments.putString(ARGUMENT_GAME_PATH, game.getPath());
arguments.putString(ARGUMENT_GAME_SCREENSHOT_PATH, game.getScreenPath());
@ -64,9 +64,12 @@ public class GameDetailsDialog extends DialogFragment
ImageButton buttonLaunch = (ImageButton) contents.findViewById(R.id.button_launch);
int countryIndex = getArguments().getInt(ARGUMENT_GAME_COUNTRY);
String country = getResources().getStringArray(R.array.country_names)[countryIndex];
textTitle.setText(getArguments().getString(ARGUMENT_GAME_TITLE));
textDescription.setText(getArguments().getString(ARGUMENT_GAME_DESCRIPTION));
textCountry.setText(getArguments().getString(ARGUMENT_GAME_COUNTRY));
textCountry.setText(country);
textDate.setText(getArguments().getString(ARGUMENT_GAME_DATE));
buttonLaunch.setOnClickListener(new View.OnClickListener()
{

View File

@ -4,6 +4,23 @@ public interface Game
{
public static final int PLATFORM_GC = 0;
public static final int PLATFORM_WII = 1;
public static final int PLATFORM_WII_WARE = 2;
// Copied from IVolume::ECountry. Update these if that is ever modified.
public static final int COUNTRY_EUROPE = 0;
public static final int COUNTRY_JAPAN = 1;
public static final int COUNTRY_USA = 2;
public static final int COUNTRY_AUSTRALIA = 3;
public static final int COUNTRY_FRANCE = 4;
public static final int COUNTRY_GERMANY = 5;
public static final int COUNTRY_ITALY = 6;
public static final int COUNTRY_KOREA = 7;
public static final int COUNTRY_NETHERLANDS = 8;
public static final int COUNTRY_RUSSIA = 9;
public static final int COUNTRY_SPAIN = 10;
public static final int COUNTRY_TAIWAN = 11;
public static final int COUNTRY_WORLD = 12;
public static final int COUNTRY_UNKNOWN = 13;
public int getPlatform();
@ -13,7 +30,7 @@ public interface Game
public String getDescription();
public String getCountry();
public int getCountry();
public String getPath();

View File

@ -7,18 +7,18 @@ public final class GcGame implements Game
{
private String mTitle;
private String mDescription;
private String mCountry;
private String mPath;
private String mGameId;
private String mScreenshotFolderPath;
private String mDate;
private int mCountry;
private int mPlatform = PLATFORM_GC;
private static final String PATH_SCREENSHOT_FOLDER = "file:///sdcard/dolphin-emu/ScreenShots/";
public GcGame(String title, String description, String country, String path, String gameId, String date)
public GcGame(String title, String description, int country, String path, String gameId, String date)
{
mTitle = title;
mDescription = description;
@ -54,7 +54,7 @@ public final class GcGame implements Game
}
@Override
public String getCountry()
public int getCountry()
{
return mCountry;
}

View File

@ -28,9 +28,9 @@ public final class WiiGame implements Game
}
@Override
public String getCountry()
public int getCountry()
{
return null;
return 13;
}
@Override

View File

@ -190,4 +190,20 @@
<item>2</item>
<item>3</item>
</string-array>
<string-array name="country_names">
<item>Europe</item>
<item>Japan</item>
<item>USA</item>
<item>Australia</item>
<item>France</item>
<item>Germany</item>
<item>Italy</item>
<item>Korea</item>
<item>Netherlands</item>
<item>Russia</item>
<item>Spain</item>
<item>Taiwan</item>
<item>Unknown</item>
</string-array>
</resources>