Merge pull request #3767 from degasus/android

Android: Also copy sys/Wii directory.
This commit is contained in:
Pierre Bourdon 2016-04-24 15:12:57 +02:00
commit 3033096223
3 changed files with 30 additions and 30 deletions

View File

@ -37,28 +37,17 @@ public final class AssetCopyService extends IntentService
{
String BaseDir = NativeLibrary.GetUserDirectory();
String ConfigDir = BaseDir + File.separator + "Config";
String GCDir = BaseDir + File.separator + "GC";
// Copy assets if needed
File file = new File(GCDir + File.separator + "font_sjis.bin");
if(!file.exists())
{
NativeLibrary.CreateUserFolders();
copyAsset("dsp_coef.bin", GCDir + File.separator + "dsp_coef.bin");
copyAsset("dsp_rom.bin", GCDir + File.separator + "dsp_rom.bin");
copyAsset("font_ansi.bin", GCDir + File.separator + "font_ansi.bin");
copyAsset("font_sjis.bin", GCDir + File.separator + "font_sjis.bin");
copyAssetFolder("Shaders", BaseDir + File.separator + "Shaders");
}
else
{
Log.verbose("[AssetCopyService] Skipping asset copy operation.");
}
copyAssetFolder("GC", BaseDir + File.separator + "GC", false);
copyAssetFolder("Shaders", BaseDir + File.separator + "Shaders", false);
copyAssetFolder("Wii", BaseDir + File.separator + "Wii", false);
// Always copy over the GCPad config in case of change or corruption.
// Not a user configurable file.
copyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini");
copyAsset("WiimoteNew.ini", ConfigDir + File.separator + "WiimoteNew.ini");
copyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini", true);
copyAsset("WiimoteNew.ini", ConfigDir + File.separator + "WiimoteNew.ini", true);
// Record the fact that we've done this before, so we don't do it on every launch.
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
@ -68,13 +57,16 @@ public final class AssetCopyService extends IntentService
editor.commit();
}
private void copyAsset(String asset, String output)
private void copyAsset(String asset, String output, Boolean overwrite)
{
Log.verbose("[AssetCopyService] Copying " + asset + " to " + output);
Log.verbose("[AssetCopyService] Copying File " + asset + " to " + output);
InputStream in = null;
OutputStream out = null;
try
{
File file = new File(output);
if(!file.exists() || overwrite)
{
in = getAssets().open(asset);
out = new FileOutputStream(output);
@ -82,21 +74,23 @@ public final class AssetCopyService extends IntentService
in.close();
out.close();
}
}
catch (IOException e)
{
Log.error("[AssetCopyService] Failed to copy asset file: " + asset + e.getMessage());
}
}
private void copyAssetFolder(String assetFolder, String outputFolder)
private void copyAssetFolder(String assetFolder, String outputFolder, Boolean overwrite)
{
Log.verbose("[AssetCopyService] Copying " + assetFolder + " to " + outputFolder);
Log.verbose("[AssetCopyService] Copying Folder " + assetFolder + " to " + outputFolder);
try
{
for (String file : getAssets().list(assetFolder))
{
copyAsset(assetFolder + File.separator + file, outputFolder + File.separator + file);
copyAssetFolder(assetFolder + File.separator + file, outputFolder + File.separator + file, overwrite);
copyAsset(assetFolder + File.separator + file, outputFolder + File.separator + file, overwrite);
}
}
catch (IOException e)

View File

@ -26,7 +26,10 @@ add_custom_command(TARGET ${SHARED_LIB} POST_BUILD
COMMAND ${CMAKE_STRIP} ${CMAKE_SOURCE_DIR}/Source/Android/app/src/main/jniLibs/${ANDROID_NDK_ABI_NAME}/lib${SHARED_LIB}.so
)
add_custom_command(TARGET ${SHARED_LIB} POST_BUILD
COMMAND cp ARGS ${CMAKE_SOURCE_DIR}/Data/Sys/GC/* ${CMAKE_SOURCE_DIR}/Source/Android/app/src/main/assets/
COMMAND cp ARGS -r ${CMAKE_SOURCE_DIR}/Data/Sys/GC ${CMAKE_SOURCE_DIR}/Source/Android/app/src/main/assets/
)
add_custom_command(TARGET ${SHARED_LIB} POST_BUILD
COMMAND cp ARGS -r ${CMAKE_SOURCE_DIR}/Data/Sys/Wii ${CMAKE_SOURCE_DIR}/Source/Android/app/src/main/assets/
)
add_custom_command(TARGET ${SHARED_LIB} POST_BUILD
COMMAND cp ARGS -r ${CMAKE_SOURCE_DIR}/Data/Sys/Shaders ${CMAKE_SOURCE_DIR}/Source/Android/app/src/main/assets/

View File

@ -541,7 +541,10 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFo
{
File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_WC24CONF_DIR DIR_SEP "mbox" DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP "shared2" DIR_SEP "succession" DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP "shared2" DIR_SEP "ec" DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_SYSCONF_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
@ -549,7 +552,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFo
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX));
File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX) + "Anaglyph" DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + USA_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + EUR_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);