Merge pull request #514 from LoungeKatt/master

Revert filesystem changes [testing], RS sensitivity, merge r7-sprint
This commit is contained in:
TwistedUmbrella 2014-08-02 12:47:16 -04:00
commit bc6870a9ca
7 changed files with 78 additions and 73 deletions

View File

@ -315,9 +315,10 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_run(JNIEnv *env,jobje
jsamples=env->NewShortArray(SAMPLE_COUNT*2); jsamples=env->NewShortArray(SAMPLE_COUNT*2);
writemid=env->GetMethodID(env->GetObjectClass(track),"WriteBuffer","([SI)I"); writemid=env->GetMethodID(env->GetObjectClass(track),"WriteBuffer","([SI)I");
//showMessageMid=env->GetMethodID(env->GetObjectClass(track),"WriteBuffer","([SI)I");
//dieMid=env->GetMethodID(env->GetObjectClass(track),"Die","([SI)I");
dc_run(); dc_run();
} }
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupMic(JNIEnv *env,jobject obj,jobject sip) JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupMic(JNIEnv *env,jobject obj,jobject sip)

View File

@ -66,11 +66,6 @@ public class FileBrowser extends Fragment {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
sdcard = getActivity().getExternalFilesDir(null);
home_directory = sdcard + "/dc";
game_directory = sdcard + "/dc";
}
home_directory = mPrefs.getString(Config.pref_home, home_directory); home_directory = mPrefs.getString(Config.pref_home, home_directory);
game_directory = mPrefs.getString(Config.pref_games, game_directory); game_directory = mPrefs.getString(Config.pref_games, game_directory);

View File

@ -282,10 +282,10 @@ public class GL2JNIActivity extends Activity {
GL2JNIView.rt[playerNum] = (int) (R2 * 255); GL2JNIView.rt[playerNum] = (int) (R2 * 255);
if (prefs.getBoolean("right_buttons", true)) { if (prefs.getBoolean("right_buttons", true)) {
if (RS_Y > 0.5) { if (RS_Y > 0.25) {
handle_key(playerNum, pad.map[playerNum][0]/* A */, true); handle_key(playerNum, pad.map[playerNum][0]/* A */, true);
pad.wasKeyStick[playerNum] = true; pad.wasKeyStick[playerNum] = true;
} else if (RS_Y < 0.5) { } else if (RS_Y < 0.25) {
handle_key(playerNum, pad.map[playerNum][1]/* B */, true); handle_key(playerNum, pad.map[playerNum][1]/* B */, true);
pad.wasKeyStick[playerNum] = true; pad.wasKeyStick[playerNum] = true;
} else if (pad.wasKeyStick[playerNum]){ } else if (pad.wasKeyStick[playerNum]){
@ -294,10 +294,10 @@ public class GL2JNIActivity extends Activity {
pad.wasKeyStick[playerNum] = false; pad.wasKeyStick[playerNum] = false;
} }
} else { } else {
if (RS_Y > 0.5) { if (RS_Y > 0.25) {
GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); GL2JNIView.rt[playerNum] = (int) (RS_Y * 255);
GL2JNIView.lt[playerNum] = (int) (L2 * 255); GL2JNIView.lt[playerNum] = (int) (L2 * 255);
} else if (RS_Y < 0.5) { } else if (RS_Y < 0.25) {
GL2JNIView.rt[playerNum] = (int) (R2 * 255); GL2JNIView.rt[playerNum] = (int) (R2 * 255);
GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255);
} }

View File

@ -372,10 +372,10 @@ public class GL2JNINative extends NativeActivity {
GL2JNIView.rt[playerNum] = (int) (R2 * 255); GL2JNIView.rt[playerNum] = (int) (R2 * 255);
if (prefs.getBoolean("right_buttons", true)) { if (prefs.getBoolean("right_buttons", true)) {
if (RS_Y > 0.5) { if (RS_Y > 0.25) {
handle_key(playerNum, pad.map[playerNum][0]/* A */, true); handle_key(playerNum, pad.map[playerNum][0]/* A */, true);
pad.wasKeyStick[playerNum] = true; pad.wasKeyStick[playerNum] = true;
} else if (RS_Y < 0.5) { } else if (RS_Y < 0.25) {
handle_key(playerNum, pad.map[playerNum][1]/* B */, true); handle_key(playerNum, pad.map[playerNum][1]/* B */, true);
pad.wasKeyStick[playerNum] = true; pad.wasKeyStick[playerNum] = true;
} else if (pad.wasKeyStick[playerNum]){ } else if (pad.wasKeyStick[playerNum]){
@ -384,10 +384,10 @@ public class GL2JNINative extends NativeActivity {
pad.wasKeyStick[playerNum] = false; pad.wasKeyStick[playerNum] = false;
} }
} else { } else {
if (RS_Y > 0.5) { if (RS_Y > 0.25) {
GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); GL2JNIView.rt[playerNum] = (int) (RS_Y * 255);
GL2JNIView.lt[playerNum] = (int) (L2 * 255); GL2JNIView.lt[playerNum] = (int) (L2 * 255);
} else if (RS_Y < 0.5) { } else if (RS_Y < 0.25) {
GL2JNIView.rt[playerNum] = (int) (R2 * 255); GL2JNIView.rt[playerNum] = (int) (R2 * 255);
GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255);
} }

View File

@ -1,12 +1,10 @@
package com.reicast.emulator.config; package com.reicast.emulator.config;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.channels.FileChannel;
import android.app.Activity; import android.app.Activity;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -85,11 +83,6 @@ public class OptionsFragment extends Fragment {
// setContentView(R.layout.activity_main); // setContentView(R.layout.activity_main);
//parentActivity = getActivity(); //parentActivity = getActivity();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
sdcard = getActivity().getExternalFilesDir(null);
home_directory = sdcard + "/dc";
game_directory = sdcard + "/dc";
}
mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
@ -124,11 +117,6 @@ public class OptionsFragment extends Fragment {
Toast.makeText(getActivity(), R.string.data_folder, Toast.makeText(getActivity(), R.string.data_folder,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
cleanHouse(getActivity().getExternalFilesDir(null));
buildHouse(new File(home_directory), getActivity().getExternalFilesDir(null));
home_directory = sdcard + "/dc";
}
mPrefs.edit().putString("home_directory", home_directory) mPrefs.edit().putString("home_directory", home_directory)
.commit(); .commit();
} }
@ -518,43 +506,6 @@ public class OptionsFragment extends Fragment {
}); });
} }
private void cleanHouse(File dir) {
File[] existing = dir.listFiles();
for (File item: existing) {
if (item.isDirectory()) {
cleanHouse(item);
} else {
item.delete();
}
}
}
private void buildHouse(File dir, File root) {
File[] existing = dir.listFiles();
for (File item: existing) {
if (item.isDirectory()) {
item.mkdirs();
buildHouse(item, item);
} else {
try {
copy(item, new File(root + "/" + item));
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public void copy(File src, File dst) throws IOException {
FileInputStream inStream = new FileInputStream(src);
FileOutputStream outStream = new FileOutputStream(dst);
FileChannel inChannel = inStream.getChannel();
FileChannel outChannel = outStream.getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
inStream.close();
outStream.close();
}
private void flashBios(String localized) { private void flashBios(String localized) {
File local = new File(home_directory, "data/dc_flash[" + localized File local = new File(home_directory, "data/dc_flash[" + localized
+ "].bin"); + "].bin");

View File

@ -291,7 +291,7 @@ public class GL2JNIView extends GLSurfaceView
vjoy[i][3] = vbase(vjoy_d[i][3],scl); vjoy[i][3] = vbase(vjoy_d[i][3],scl);
} }
for(int i=0;i<vjoy.length;i++) for(int i=0;i<VJoy.VJoyCount;i++)
JNIdc.vjoy(i,vjoy[i][0],vjoy[i][1],vjoy[i][2],vjoy[i][3]); JNIdc.vjoy(i,vjoy[i][0],vjoy[i][1],vjoy[i][2],vjoy[i][3]);
reset_analog(); reset_analog();
@ -319,7 +319,7 @@ public class GL2JNIView extends GLSurfaceView
else if (buttonId <= 12) else if (buttonId <= 12)
return 5; // Analog return 5; // Analog
else else
return -1; // Invalid return 0; // DPAD diagonials
} }
public static int[] kcode_raw = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; public static int[] kcode_raw = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF };
@ -377,6 +377,10 @@ public class GL2JNIView extends GLSurfaceView
{ {
if(x>vjoy[j][0] && x<=(vjoy[j][0]+vjoy[j][2])) if(x>vjoy[j][0] && x<=(vjoy[j][0]+vjoy[j][2]))
{ {
/*
//Disable pressure sensitive R/L
//Doesn't really work properly
int pre=(int)(event.getPressure(i)*255); int pre=(int)(event.getPressure(i)*255);
if (pre>20) if (pre>20)
{ {
@ -384,6 +388,9 @@ public class GL2JNIView extends GLSurfaceView
pre*=7; pre*=7;
} }
if (pre>255) pre=255; if (pre>255) pre=255;
*/
int pre = 255;
if(y>vjoy[j][1] && y<=(vjoy[j][1]+vjoy[j][3])) if(y>vjoy[j][1] && y<=(vjoy[j][1]+vjoy[j][3]))
{ {
@ -564,7 +571,8 @@ public class GL2JNIView extends GLSurfaceView
public void onSurfaceChanged(GL10 gl,int width,int height) public void onSurfaceChanged(GL10 gl,int width,int height)
{ {
JNIdc.rendinit(sWidth,sHeight); gl.glViewport(0, 0, width, height);
JNIdc.rendinit(width,height);
} }
public void onSurfaceCreated(GL10 gl,EGLConfig config) public void onSurfaceCreated(GL10 gl,EGLConfig config)
@ -673,6 +681,44 @@ public class GL2JNIView extends GLSurfaceView
} }
} }
void showMessage(String msg) {
/*
activity.runOnUiThread(new Runnable() {
public void run() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);
// set title
alertDialogBuilder.setTitle("Ooops");
// set dialog message
alertDialogBuilder
.setMessage(msg)
.setCancelable(false)
.setPositiveButton("Okay...",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
MainActivity.this.finish();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
});
*/
}
void die() {
showMessage("Something went very bad. Please report this on the reicast forums.");
onStop();
}
public void onStop() { public void onStop() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
System.exit(0); System.exit(0);

View File

@ -19,6 +19,8 @@ public class VJoy {
public static final int LAYER_TYPE_SOFTWARE = 1; public static final int LAYER_TYPE_SOFTWARE = 1;
public static final int LAYER_TYPE_HARDWARE = 2; public static final int LAYER_TYPE_HARDWARE = 2;
public static int VJoyCount = 13;
public static float[][] baseVJoy() { public static float[][] baseVJoy() {
return new float[][] { return new float[][] {
new float[] { 24+0, 24+64, 64,64, VJoy.key_CONT_DPAD_LEFT, 0}, new float[] { 24+0, 24+64, 64,64, VJoy.key_CONT_DPAD_LEFT, 0},
@ -38,6 +40,11 @@ public class VJoy {
new float[] { 0, 128+224, 128,128, -3, 0}, new float[] { 0, 128+224, 128,128, -3, 0},
new float[] { 96, 320, 32,32, -4, 0}, new float[] { 96, 320, 32,32, -4, 0},
new float[] { 20+0 , 288+0 , 64,64, key_CONT_DPAD_LEFT|key_CONT_DPAD_UP, 0},
new float[] { 20+128, 288+0 , 64,64, key_CONT_DPAD_RIGHT|key_CONT_DPAD_UP, 0},
new float[] { 20+0 , 288+128, 64,64, key_CONT_DPAD_LEFT|key_CONT_DPAD_DOWN, 0},
new float[] { 20+128, 288+128, 64,64, key_CONT_DPAD_RIGHT|key_CONT_DPAD_DOWN, 0},
}; };
} }
@ -73,6 +80,11 @@ public class VJoy {
new float[] { 16+vjoy_d_custom[5][0], 24+32+vjoy_d_custom[5][1], 128*vjoy_d_custom[5][2],128*vjoy_d_custom[5][2], -3}, new float[] { 16+vjoy_d_custom[5][0], 24+32+vjoy_d_custom[5][1], 128*vjoy_d_custom[5][2],128*vjoy_d_custom[5][2], -3},
new float[] { 96+vjoy_d_custom[5][0], 320+vjoy_d_custom[5][1], 32*vjoy_d_custom[5][2],32*vjoy_d_custom[5][2], -4}, new float[] { 96+vjoy_d_custom[5][0], 320+vjoy_d_custom[5][1], 32*vjoy_d_custom[5][2],32*vjoy_d_custom[5][2], -4},
new float[] { 20+0*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+0*vjoy_d_custom[0][2]+vjoy_d_custom[0][1], 64*vjoy_d_custom[0][2],64*vjoy_d_custom[0][2], key_CONT_DPAD_LEFT|key_CONT_DPAD_UP},
new float[] { 20+128*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+0*vjoy_d_custom[0][2]+vjoy_d_custom[0][1], 64*vjoy_d_custom[0][2],64*vjoy_d_custom[0][2], key_CONT_DPAD_RIGHT|key_CONT_DPAD_UP},
new float[] { 20+0*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+128*vjoy_d_custom[0][2]+vjoy_d_custom[0][1], 64*vjoy_d_custom[0][2],64*vjoy_d_custom[0][2], key_CONT_DPAD_LEFT|key_CONT_DPAD_DOWN},
new float[] { 20+128*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+128*vjoy_d_custom[0][2]+vjoy_d_custom[0][1], 64*vjoy_d_custom[0][2],64*vjoy_d_custom[0][2], key_CONT_DPAD_RIGHT|key_CONT_DPAD_DOWN},
}; };
} }