Permalink
Browse files

front: Added texture extraction tool, but this only works with rice

texture packs.
  • Loading branch information...
fzurita committed Mar 25, 2016
1 parent d9c140f commit dd5facf0c91124f018653d36f30f1a7d4d0bc5d5
View
@@ -75,6 +75,12 @@
android:label="@string/ScanRomsActivity_title"
android:theme="@style/Theme.Mupen64plusaeTheme" >
</activity>
<activity
android:name="paulscode.android.mupen64plusae.ExtractTexturesActivity"
android:exported="false"
android:label="@string/ExtractTexturesActivity_title"
android:theme="@style/Theme.Mupen64plusaeTheme" >
</activity>
<activity
android:name="paulscode.android.mupen64plusae.persistent.GamePrefsActivity"
android:exported="false"
@@ -263,7 +269,7 @@
android:theme="@style/appTheme.Black" >
</activity>
<service android:name="paulscode.android.mupen64plusae.task.CacheRomInfoService" />
<service android:name="paulscode.android.mupen64plusae.task.ExtractTexturesService" />
<meta-data
android:name="game_display_name"
android:resource="@string/app_name" />
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal" >
<ListView
android:id="@+id/listView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".50"
android:orientation="vertical" >
</ListView>
<RelativeLayout
android:id="@+id/relativeLayoutRight"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".50"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayoutButtons"
android:orientation="vertical"
android:padding="16dp" >
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pathHiResTexturesTask_select_zip"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<RelativeLayout
android:id="@+id/linearLayoutButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:padding="10dp" >
<Button
android:id="@+id/buttonCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/buttonOk"
android:layout_toStartOf="@+id/buttonOk"
android:text="@android:string/cancel" />
<Button
android:id="@+id/buttonOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:text="@android:string/ok" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@+id/linearLayout1"
android:orientation="vertical" >
</ListView>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayoutButtons"
android:orientation="vertical"
android:padding="16dp" >
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pathHiResTexturesTask_select_zip"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<RelativeLayout
android:id="@+id/linearLayoutButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:padding="10dp" >
<Button
android:id="@+id/buttonCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/buttonOk"
android:layout_toStartOf="@+id/buttonOk"
android:text="@android:string/cancel" />
<Button
android:id="@+id/buttonOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:text="@android:string/ok" />
</RelativeLayout>
</RelativeLayout>
@@ -51,6 +51,22 @@
android:title="@string/menuItem_controllerProfiles"/>
</menu>
</item>
<item
android:id="@+id/menuItem_tools"
android:icon="@drawable/ic_circuit"
android:title="@string/menuItem_Tools">
<menu>
<item
android:id="@+id/menuItem_extract"
android:title="@string/menuItem_Extract"/>
<item
android:id="@+id/menuItem_logcat"
android:title="@string/menuItem_logcat"/>
<item
android:id="@+id/menuItem_hardwareInfo"
android:title="@string/menuItem_hardwareInfo"/>
</menu>
</item>
<item
android:id="@+id/menuItem_help"
android:icon="@drawable/ic_help"
@@ -81,12 +97,6 @@
<item
android:id="@+id/menuItem_changelog"
android:title="@string/menuItem_changelog"/>
<item
android:id="@+id/menuItem_logcat"
android:title="@string/menuItem_logcat"/>
<item
android:id="@+id/menuItem_hardwareInfo"
android:title="@string/menuItem_hardwareInfo"/>
<item
android:id="@+id/menuItem_credits"
android:title="@string/menuItem_credits"/>
@@ -18,6 +18,7 @@
<string name="SplashActivity_title" translatable="false">@string/app_name</string>
<string name="GalleryActivity_title" translatable="false">@string/app_name</string>
<string name="ScanRomsActivity_title" translatable="false">@string/app_name</string>
<string name="ExtractTexturesActivity_title" translatable="false">@string/app_name</string>
<string name="PlayMenuActivity_title" translatable="false">@string/menuItem_play</string>
<string name="SettingsGlobalActivity_title" translatable="false">@string/menuItem_globalSettings</string>
<string name="ManageControllerProfilesActivity_title" translatable="false">@string/menuItem_controllerProfiles</string>
View
@@ -81,6 +81,8 @@
<string name="menuItem_changelog">Changelog</string>
<string name="menuItem_logcat">Logcat</string>
<string name="menuItem_hardwareInfo">Hardware info</string>
<string name="menuItem_Tools">Tools</string>
<string name="menuItem_Extract">Add Texture Pack</string>
<string name="menuItem_localeOverride">Language</string>
<!-- ManageProfilesActivity -->
@@ -559,7 +561,8 @@
<string name="cheatEditor_remove_option">Remove option</string>
<!-- Hi-Res Texture Unpacking -->
<string name="pathHiResTexturesTask_title">Unpacking textures</string>
<string name="pathHiResTexturesTask_select_zip">Select the ZIP file containing the high resolution texture pack</string>
<string name="pathHiResTexturesTask_title">Unpacking textures...</string>
<string name="pathHiResTexturesTask_message">Please be patient. This process may take some time.</string>
<string name="pathHiResTexturesTask_errorMessage">Problem unpacking textures!</string>
@@ -114,14 +114,6 @@
android:key="riceHiResTextures"
android:summary="@string/riceHiResTextures_summary"
android:title="@string/riceHiResTextures_title" />
<paulscode.android.mupen64plusae.preference.PathPreference
android:defaultValue="@string/pathHiResTextures_default"
android:dependency="riceHiResTextures"
android:key="pathHiResTextures"
android:summary="@string/pathHiResTextures_summary"
android:title="@string/pathHiResTextures_title"
mupen64:selectionMode="1" />
</android.support.v7.preference.PreferenceCategory>
<android.support.v7.preference.PreferenceCategory
android:key="categoryGlide64"
View
Binary file not shown.
@@ -37,6 +37,7 @@
import paulscode.android.mupen64plusae.profile.ManageTouchscreenProfilesActivity;
import paulscode.android.mupen64plusae.profile.TouchscreenProfileActivity;
import paulscode.android.mupen64plusae.task.CacheRomInfoService;
import paulscode.android.mupen64plusae.task.ExtractTexturesService;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
@@ -82,6 +83,7 @@
}
public static final int SCAN_ROM_REQUEST_CODE = 1;
public static final int EXTRACT_TEXTURES_CODE = 2;
public static void launchUri( Context context, int resId )
{
@@ -267,18 +269,42 @@ public static void startCacheRomInfoService(Context context, ServiceConnection s
context.startService(intent);
context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
}
public static void stopCacheRomInfoService(Context context, ServiceConnection serviceConnection)
{
Intent intent = new Intent(context, CacheRomInfoService.class);
context.unbindService(serviceConnection);
context.stopService(intent);
}
public static void StartRomScanService(Activity activity)
public static void startRomScanActivity(Activity activity)
{
Intent intent = new Intent(activity, ScanRomsActivity.class);
activity.startActivityForResult( intent, SCAN_ROM_REQUEST_CODE );
}
public static void startExtractTexturesService(Context context, ServiceConnection serviceConnection,
String searchPath)
{
Intent intent = new Intent(context, ExtractTexturesService.class);
intent.putExtra(ActivityHelper.Keys.SEARCH_PATH, searchPath);
context.startService(intent);
context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
}
public static void stopExtractTexturesService(Context context, ServiceConnection serviceConnection)
{
Intent intent = new Intent(context, ExtractTexturesService.class);
context.unbindService(serviceConnection);
context.stopService(intent);
}
public static void starExtractTextureActivity(Activity activity)
{
Intent intent = new Intent(activity, ExtractTexturesActivity.class);
activity.startActivityForResult( intent, EXTRACT_TEXTURES_CODE );
}
}
@@ -0,0 +1,109 @@
package paulscode.android.mupen64plusae;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.mupen64plusae.v3.alpha.R;
import paulscode.android.mupen64plusae.dialog.Prompt;
import paulscode.android.mupen64plusae.util.FileUtil;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class ExtractTexturesActivity extends AppCompatActivity implements OnItemClickListener
{
private List<CharSequence> mNames;
private List<String> mPaths;
private Button mCancelButton;
private Button mOkButton;
private File mCurrentPath = null;
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate(savedInstanceState);
String currentPath = null;
if(savedInstanceState != null)
{
currentPath = savedInstanceState.getString( ActivityHelper.Keys.SEARCH_PATH );
}
if( currentPath != null )
{
mCurrentPath = new File(currentPath);
}
else
{
// Pick the root of the storage directory by default
mCurrentPath = new File( Environment.getExternalStorageDirectory().getAbsolutePath() );
}
setContentView(R.layout.extract_textures_activity);
mCancelButton = (Button) findViewById( R.id.buttonCancel );
mCancelButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
ExtractTexturesActivity.this.setResult(RESULT_CANCELED, null);
ExtractTexturesActivity.this.finish();
}
});
mOkButton = (Button) findViewById( R.id.buttonOk );
mOkButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent data = new Intent();
data.putExtra(ActivityHelper.Keys.SEARCH_PATH, mCurrentPath.getPath());
ExtractTexturesActivity.this.setResult(RESULT_OK, data);
ExtractTexturesActivity.this.finish();
}
});
PopulateFileList();
}
@Override
public void onSaveInstanceState( Bundle savedInstanceState )
{
if( mCurrentPath != null )
savedInstanceState.putString( ActivityHelper.Keys.SEARCH_PATH, mCurrentPath.getAbsolutePath() );
super.onSaveInstanceState( savedInstanceState );
}
private void PopulateFileList()
{
setTitle( mCurrentPath.getPath() );
// Populate the file list
// Get the filenames and absolute paths
mNames = new ArrayList<CharSequence>();
mPaths = new ArrayList<String>();
FileUtil.populate( mCurrentPath, true, true, true, mNames, mPaths );
if(mCurrentPath.isDirectory())
{
ListView listView1 = (ListView) findViewById( R.id.listView1 );
ArrayAdapter<String> adapter = Prompt.createFilenameAdapter( this, mPaths, mNames );
listView1.setAdapter( adapter );
listView1.setOnItemClickListener( this );
}
}
@Override
public void onItemClick( AdapterView<?> parent, View view, int position, long id )
{
mCurrentPath = new File(mPaths.get( position ));
PopulateFileList();
}
}
Oops, something went wrong.

0 comments on commit dd5facf

Please sign in to comment.