Android: Create a Christmas theme via auto-indent
This commit is contained in:
parent
ff073d491f
commit
1c1ebc2bfb
|
@ -51,7 +51,7 @@ public class AboutFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.about_fragment, container, false);
|
||||
}
|
||||
|
@ -207,14 +207,14 @@ public class AboutFragment extends Fragment {
|
|||
|
||||
list.setOnItemClickListener(new OnItemClickListener() {
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
int position, long id) {
|
||||
slidingGithub.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private JSONArray getContent(String urlString) throws IOException, JSONException {
|
||||
HttpURLConnection conn = (HttpURLConnection) new URL(urlString).openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.reicast.emulator;
|
|||
* File: CloudFragment.java
|
||||
* Author: Luca D'Amico (Luca91)
|
||||
* Last Edit: 11 May 2014
|
||||
*
|
||||
*
|
||||
* Reference: http://forums.reicast.com/index.php?topic=160.msg422
|
||||
*/
|
||||
|
||||
|
@ -45,20 +45,20 @@ import java.util.concurrent.ExecutionException;
|
|||
|
||||
|
||||
public class CloudFragment extends Fragment {
|
||||
|
||||
|
||||
Button uploadBtn;
|
||||
Button downloadBtn;
|
||||
AlertDialog.Builder confirmDialog = null;
|
||||
AlertDialog.Builder confirmDialog = null;
|
||||
boolean actionRequired=false;
|
||||
public String task = "";
|
||||
DropBoxClient client = null;
|
||||
private String home_directory;
|
||||
|
||||
|
||||
String[] vmus = {"vmu_save_A1.bin","vmu_save_A2.bin",
|
||||
"vmu_save_B1.bin","vmu_save_B2.bin",
|
||||
"vmu_save_C1.bin","vmu_save_C2.bin",
|
||||
"vmu_save_D1.bin","vmu_save_D2.bin"};
|
||||
|
||||
"vmu_save_B1.bin","vmu_save_B2.bin",
|
||||
"vmu_save_C1.bin","vmu_save_C2.bin",
|
||||
"vmu_save_D1.bin","vmu_save_D2.bin"};
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.cloud_fragment, container, false);
|
||||
|
@ -69,58 +69,58 @@ public class CloudFragment extends Fragment {
|
|||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
home_directory = mPrefs.getString(Config.pref_home,
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
buttonListener();
|
||||
confirmDialog = new AlertDialog.Builder(getActivity());
|
||||
setClient();
|
||||
buttonListener();
|
||||
confirmDialog = new AlertDialog.Builder(getActivity());
|
||||
setClient();
|
||||
}
|
||||
|
||||
|
||||
public void setClient(){
|
||||
if(client==null)
|
||||
client = new DropBoxClient(getActivity());
|
||||
client = new DropBoxClient(getActivity());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void buttonListener() {
|
||||
uploadBtn = (Button) getView().findViewById(R.id.uploadBtn);
|
||||
uploadBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
confirmDialog.setMessage(R.string.uploadWarning);
|
||||
confirmDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setClient();
|
||||
task = "Upload";
|
||||
client.startLogin();
|
||||
actionRequired = true;
|
||||
}
|
||||
});
|
||||
confirmDialog.setNegativeButton(R.string.cancel, null);
|
||||
confirmDialog.show();
|
||||
confirmDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setClient();
|
||||
task = "Upload";
|
||||
client.startLogin();
|
||||
actionRequired = true;
|
||||
}
|
||||
});
|
||||
confirmDialog.setNegativeButton(R.string.cancel, null);
|
||||
confirmDialog.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
downloadBtn = (Button) getView().findViewById(R.id.downloadBtn);
|
||||
downloadBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
confirmDialog.setMessage(R.string.downloadWarning);
|
||||
confirmDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setClient();
|
||||
task = "Download";
|
||||
client.startLogin();
|
||||
actionRequired = true;
|
||||
}
|
||||
});
|
||||
confirmDialog.setNegativeButton(R.string.cancel, null);
|
||||
confirmDialog.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
confirmDialog.setMessage(R.string.downloadWarning);
|
||||
confirmDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setClient();
|
||||
task = "Download";
|
||||
client.startLogin();
|
||||
actionRequired = true;
|
||||
}
|
||||
});
|
||||
confirmDialog.setNegativeButton(R.string.cancel, null);
|
||||
confirmDialog.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
@ -143,7 +143,7 @@ public class CloudFragment extends Fragment {
|
|||
try {
|
||||
String vmuPath = home_directory+"/"+vmus[k];
|
||||
File vmu = new File(vmuPath);
|
||||
if(vmu.exists() || task.equals("Download") ){
|
||||
if(vmu.exists() || task.equals("Download") ){
|
||||
result = new netOperation(client, home_directory).execute(
|
||||
task,vmuPath,vmus[k]).get();
|
||||
}
|
||||
|
@ -166,175 +166,175 @@ public class CloudFragment extends Fragment {
|
|||
actionRequired = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class DropBoxClient {
|
||||
|
||||
|
||||
Context context;
|
||||
|
||||
final static private String APP_KEY = "7d7tw1t57sbzrj5";
|
||||
final static private String APP_SECRET = "5xxqa2uctousyi2";
|
||||
|
||||
public DropboxAPI<AndroidAuthSession> mDBApi;
|
||||
AndroidAuthSession session;
|
||||
|
||||
public DropBoxClient(Context context){
|
||||
this.context = context;
|
||||
session = buildSession();
|
||||
mDBApi = new DropboxAPI<AndroidAuthSession>(session);
|
||||
}
|
||||
|
||||
public void startLogin(){
|
||||
mDBApi.getSession().startOAuth2Authentication(context);
|
||||
}
|
||||
|
||||
|
||||
final static private String APP_KEY = "7d7tw1t57sbzrj5";
|
||||
final static private String APP_SECRET = "5xxqa2uctousyi2";
|
||||
|
||||
public DropboxAPI<AndroidAuthSession> mDBApi;
|
||||
AndroidAuthSession session;
|
||||
|
||||
public DropBoxClient(Context context){
|
||||
this.context = context;
|
||||
session = buildSession();
|
||||
mDBApi = new DropboxAPI<AndroidAuthSession>(session);
|
||||
}
|
||||
|
||||
public void startLogin(){
|
||||
mDBApi.getSession().startOAuth2Authentication(context);
|
||||
}
|
||||
|
||||
public String[] getKeys() {
|
||||
SharedPreferences prefs = context.getSharedPreferences("ReicastVMUUploader", 0);
|
||||
String key = prefs.getString("DBoxKey", null);
|
||||
String secret = prefs.getString("DBoxSecret", null);
|
||||
if (key != null && secret != null) {
|
||||
String[] ret = new String[2];
|
||||
ret[0] = key;
|
||||
ret[1] = secret;
|
||||
return ret;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
SharedPreferences prefs = context.getSharedPreferences("ReicastVMUUploader", 0);
|
||||
String key = prefs.getString("DBoxKey", null);
|
||||
String secret = prefs.getString("DBoxSecret", null);
|
||||
if (key != null && secret != null) {
|
||||
String[] ret = new String[2];
|
||||
ret[0] = key;
|
||||
ret[1] = secret;
|
||||
return ret;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void storeKeys(String key, String secret) {
|
||||
SharedPreferences prefs = context.getSharedPreferences("ReicastVMUUploader", 0);
|
||||
Editor edit = prefs.edit();
|
||||
edit.putString("DBoxKey", key);
|
||||
edit.putString("DBoxSecret", secret);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private AndroidAuthSession buildSession() {
|
||||
AppKeyPair appKeyPair = new AppKeyPair(APP_KEY, APP_SECRET);
|
||||
AndroidAuthSession session;
|
||||
public void storeKeys(String key, String secret) {
|
||||
SharedPreferences prefs = context.getSharedPreferences("ReicastVMUUploader", 0);
|
||||
Editor edit = prefs.edit();
|
||||
edit.putString("DBoxKey", key);
|
||||
edit.putString("DBoxSecret", secret);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
String[] stored = getKeys();
|
||||
if (stored != null) {
|
||||
AccessTokenPair accessToken = new AccessTokenPair(stored[0], stored[1]);
|
||||
session = new AndroidAuthSession(appKeyPair, accessToken);
|
||||
} else {
|
||||
session = new AndroidAuthSession(appKeyPair);
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private AndroidAuthSession buildSession() {
|
||||
AppKeyPair appKeyPair = new AppKeyPair(APP_KEY, APP_SECRET);
|
||||
AndroidAuthSession session;
|
||||
|
||||
String[] stored = getKeys();
|
||||
if (stored != null) {
|
||||
AccessTokenPair accessToken = new AccessTokenPair(stored[0], stored[1]);
|
||||
session = new AndroidAuthSession(appKeyPair, accessToken);
|
||||
} else {
|
||||
session = new AndroidAuthSession(appKeyPair);
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class netOperation extends AsyncTask<String, Void, String> {
|
||||
|
||||
|
||||
DropBoxClient client = null;
|
||||
private String home_directory;
|
||||
|
||||
|
||||
public netOperation(DropBoxClient client, String home_directory){
|
||||
this.client = client;
|
||||
this.home_directory = home_directory;
|
||||
}
|
||||
|
||||
public boolean uploadFile(String filePath, String fileName) {
|
||||
File file = new File(filePath);
|
||||
FileInputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
File file = new File(filePath);
|
||||
FileInputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
DropboxAPI.Entry response = null;
|
||||
try {
|
||||
response = client.mDBApi.putFileOverwrite("/"+fileName, inputStream, file.length(), null);
|
||||
} catch (DropboxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i("FileInfos", "The uploaded file's rev is: "+ response);
|
||||
return true;
|
||||
}
|
||||
DropboxAPI.Entry response = null;
|
||||
try {
|
||||
response = client.mDBApi.putFileOverwrite("/"+fileName, inputStream, file.length(), null);
|
||||
} catch (DropboxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i("FileInfos", "The uploaded file's rev is: "+ response);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean downloadFile(String filePath, String fileName) {
|
||||
DropboxAPI.DropboxFileInfo info = null;
|
||||
try {
|
||||
Entry remoteFile = client.mDBApi.metadata("/"+fileName, 1, null, false, null);
|
||||
if((remoteFile.rev != null) && (remoteFile.bytes > 0)){ // Avoid to download 0 bytes vmus!
|
||||
File file = new File(filePath);
|
||||
if(file.exists())
|
||||
createBackupOfVmu(fileName);
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
info = client.mDBApi.getFile("/"+fileName,null,out,null);
|
||||
}
|
||||
} catch (DropboxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i("FileInfos", "The downloaded file's rev is: "+ info);
|
||||
return true;
|
||||
}
|
||||
public boolean downloadFile(String filePath, String fileName) {
|
||||
DropboxAPI.DropboxFileInfo info = null;
|
||||
try {
|
||||
Entry remoteFile = client.mDBApi.metadata("/"+fileName, 1, null, false, null);
|
||||
if((remoteFile.rev != null) && (remoteFile.bytes > 0)){ // Avoid to download 0 bytes vmus!
|
||||
File file = new File(filePath);
|
||||
if(file.exists())
|
||||
createBackupOfVmu(fileName);
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
info = client.mDBApi.getFile("/"+fileName,null,out,null);
|
||||
}
|
||||
} catch (DropboxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i("FileInfos", "The downloaded file's rev is: "+ info);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... strings) {
|
||||
if(strings[0].equals("Upload")){
|
||||
if(uploadFile(strings[1],strings[2]))
|
||||
return "Ok";
|
||||
else
|
||||
return "No";
|
||||
}
|
||||
else if(strings[0].equals("Download")){
|
||||
if(downloadFile(strings[1],strings[2]))
|
||||
return "Ok";
|
||||
else
|
||||
return "No";
|
||||
}
|
||||
else
|
||||
return "Unknown";
|
||||
}
|
||||
@Override
|
||||
protected String doInBackground(String... strings) {
|
||||
if(strings[0].equals("Upload")){
|
||||
if(uploadFile(strings[1],strings[2]))
|
||||
return "Ok";
|
||||
else
|
||||
return "No";
|
||||
}
|
||||
else if(strings[0].equals("Download")){
|
||||
if(downloadFile(strings[1],strings[2]))
|
||||
return "Ok";
|
||||
else
|
||||
return "No";
|
||||
}
|
||||
else
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {}
|
||||
@Override
|
||||
protected void onPreExecute() {}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(Void... values) {}
|
||||
|
||||
|
||||
void createBackupOfVmu(String vmuName){
|
||||
File backupDir = new File(home_directory+"/VmuBackups/");
|
||||
if(!backupDir.exists()) {
|
||||
backupDir.mkdirs();
|
||||
}
|
||||
|
||||
File source = new File(home_directory+"/"+vmuName);
|
||||
File destination = new File(home_directory+"/VmuBackups/"+vmuName);
|
||||
if(!destination.exists()) {
|
||||
try {
|
||||
@Override
|
||||
protected void onProgressUpdate(Void... values) {}
|
||||
|
||||
|
||||
void createBackupOfVmu(String vmuName){
|
||||
File backupDir = new File(home_directory+"/VmuBackups/");
|
||||
if(!backupDir.exists()) {
|
||||
backupDir.mkdirs();
|
||||
}
|
||||
|
||||
File source = new File(home_directory+"/"+vmuName);
|
||||
File destination = new File(home_directory+"/VmuBackups/"+vmuName);
|
||||
if(!destination.exists()) {
|
||||
try {
|
||||
destination.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
}
|
||||
try {
|
||||
InputStream in = new FileInputStream(source);
|
||||
OutputStream out = new FileOutputStream(destination);
|
||||
byte[] buffer = new byte[1024];
|
||||
|
@ -349,6 +349,6 @@ class netOperation extends AsyncTask<String, Void, String> {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -68,7 +68,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
|
||||
pad.isOuyaOrTV = pad.IsOuyaOrTV(GL2JNINative.this);
|
||||
// isNvidiaShield = Gamepad.IsNvidiaShield();
|
||||
|
||||
|
||||
RegisterNative(false);
|
||||
|
||||
Emulator app = (Emulator)getApplicationContext();
|
||||
|
@ -105,18 +105,18 @@ public class GL2JNINative extends NativeActivity {
|
|||
Integer playerNum = e.getValue();
|
||||
|
||||
switch (playerNum) {
|
||||
case 1:
|
||||
if (descriptor != null)
|
||||
controllerTwoConnected = true;
|
||||
break;
|
||||
case 2:
|
||||
if (descriptor != null)
|
||||
controllerThreeConnected = true;
|
||||
break;
|
||||
case 3:
|
||||
if (descriptor != null)
|
||||
controllerFourConnected = true;
|
||||
break;
|
||||
case 1:
|
||||
if (descriptor != null)
|
||||
controllerTwoConnected = true;
|
||||
break;
|
||||
case 2:
|
||||
if (descriptor != null)
|
||||
controllerThreeConnected = true;
|
||||
break;
|
||||
case 3:
|
||||
if (descriptor != null)
|
||||
controllerFourConnected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
sip.startRecording();
|
||||
JNIdc.setupMic(sip);
|
||||
}
|
||||
|
||||
|
||||
popUp = menu.new MainPopup(this);
|
||||
vmuPop = menu.new VmuPopup(this);
|
||||
if(prefs.getBoolean(Config.pref_vmu, false)){
|
||||
|
@ -222,14 +222,14 @@ public class GL2JNINative extends NativeActivity {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean simulatedTouchEvent(int playerNum, float L2, float R2) {
|
||||
GL2JNIView.lt[playerNum] = (int) (L2 * 255);
|
||||
GL2JNIView.rt[playerNum] = (int) (R2 * 255);
|
||||
mView.pushInput();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void displayPopUp(PopupWindow popUp) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
popUp.showAtLocation(mView, Gravity.BOTTOM, 0, 60);
|
||||
|
@ -239,7 +239,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
popUp.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
public void displayDebug(PopupWindow popUpDebug) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
popUpDebug.showAtLocation(mView, Gravity.BOTTOM, 0, 60);
|
||||
|
@ -276,7 +276,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
}
|
||||
prefs.edit().putBoolean(Config.pref_vmu, showFloating).apply();
|
||||
}
|
||||
|
||||
|
||||
public void displayConfig(PopupWindow popUpConfig) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
popUpConfig.showAtLocation(mView, Gravity.BOTTOM, 0, 60);
|
||||
|
@ -286,7 +286,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
popUpConfig.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
public boolean motionEventHandler(Integer playerNum, com.bda.controller.MotionEvent event) {
|
||||
if (playerNum == null || playerNum == -1)
|
||||
return false;
|
||||
|
@ -385,7 +385,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
|
||||
GL2JNIView.jx[playerNum] = (int) (LS_X * 126);
|
||||
GL2JNIView.jy[playerNum] = (int) (LS_Y * 126);
|
||||
|
||||
|
||||
GL2JNIView.lt[playerNum] = (int) (L2 * 255);
|
||||
GL2JNIView.rt[playerNum] = (int) (R2 * 255);
|
||||
|
||||
|
@ -493,7 +493,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
if (keyCode == prefs.getInt(Gamepad.pref_button_l + id,
|
||||
KeyEvent.KEYCODE_BUTTON_L1)
|
||||
|| keyCode == prefs.getInt(Gamepad.pref_button_r + id,
|
||||
KeyEvent.KEYCODE_BUTTON_R1)) {
|
||||
KeyEvent.KEYCODE_BUTTON_R1)) {
|
||||
return simulatedTouchEvent(playerNum, 0.0f, 0.0f);
|
||||
} else {
|
||||
return handle_key(playerNum, keyCode, false);
|
||||
|
@ -503,10 +503,10 @@ public class GL2JNINative extends NativeActivity {
|
|||
return false;
|
||||
}
|
||||
|
||||
// public boolean OnNativeMotion(int device, int source, int action, int x,
|
||||
// public boolean OnNativeMotion(int device, int source, int action, int x,
|
||||
// int y, boolean newEvent) {
|
||||
public boolean OnNativeMotion(int device, int source, int action, int x,
|
||||
int y) {
|
||||
int y) {
|
||||
Integer playerNum = pad.playerNumX.get(device);
|
||||
if (playerNum != null && playerNum != -1) {
|
||||
Log.d("reicast", playerNum + " - " + device + ": " + source);
|
||||
|
@ -547,7 +547,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
public void screenGrab() {
|
||||
mView.screenGrab();
|
||||
}
|
||||
|
||||
|
||||
private boolean showMenu() {
|
||||
if (popUp != null) {
|
||||
if (!menu.dismissPopUps()) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MainActivity extends AppCompatActivity implements
|
|||
|
||||
private SharedPreferences mPrefs;
|
||||
private boolean hasAndroidMarket = false;
|
||||
|
||||
|
||||
private UncaughtExceptionHandler mUEHandler;
|
||||
|
||||
Gamepad pad = new Gamepad();
|
||||
|
@ -61,7 +61,7 @@ public class MainActivity extends AppCompatActivity implements
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener (new OnSystemUiVisibilityChangeListener() {
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
|
@ -69,16 +69,16 @@ public class MainActivity extends AppCompatActivity implements
|
|||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
// View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getWindow().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
|
||||
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
@ -130,15 +130,15 @@ public class MainActivity extends AppCompatActivity implements
|
|||
onGameSelected(Uri.parse(intent.getData().toString()));
|
||||
// Flush the intent to prevent multiple calls
|
||||
getIntent().setData(null);
|
||||
setIntent(null);
|
||||
Config.externalIntent = true;
|
||||
setIntent(null);
|
||||
Config.externalIntent = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that the activity is using the layout version with
|
||||
// the fragment_container FrameLayout
|
||||
if (findViewById(R.id.fragment_container) != null) {
|
||||
onMainBrowseSelected(true, null, false, null);
|
||||
onMainBrowseSelected(true, null, false, null);
|
||||
}
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
@ -160,10 +160,10 @@ public class MainActivity extends AppCompatActivity implements
|
|||
toggle.syncState();
|
||||
|
||||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
if (!hasAndroidMarket) {
|
||||
if (!hasAndroidMarket) {
|
||||
navigationView.getMenu().findItem(R.id.rateme_menu).setEnabled(false);
|
||||
navigationView.getMenu().findItem(R.id.rateme_menu).setVisible(false);
|
||||
}
|
||||
}
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
final SearchView searchView = (SearchView) findViewById(R.id.searchView);
|
||||
|
@ -172,9 +172,9 @@ public class MainActivity extends AppCompatActivity implements
|
|||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
onMainBrowseSelected(true, mPrefs.getString(Config.pref_games,
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath()),
|
||||
true, query);
|
||||
onMainBrowseSelected(true, mPrefs.getString(Config.pref_games,
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath()),
|
||||
true, query);
|
||||
searchView.onActionViewCollapsed();
|
||||
return false;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public class MainActivity extends AppCompatActivity implements
|
|||
|
||||
/**
|
||||
* Display a dialog to notify the user of prior crash
|
||||
*
|
||||
*
|
||||
* @param error
|
||||
* A generalized summary of the crash cause
|
||||
*/
|
||||
|
@ -216,13 +216,13 @@ public class MainActivity extends AppCompatActivity implements
|
|||
builder.show();
|
||||
}
|
||||
|
||||
public static boolean isBiosExisting(String home_directory) {
|
||||
return new File (home_directory, "data/dc_boot.bin").exists();
|
||||
}
|
||||
public static boolean isBiosExisting(String home_directory) {
|
||||
return new File (home_directory, "data/dc_boot.bin").exists();
|
||||
}
|
||||
|
||||
public static boolean isFlashExisting(String home_directory) {
|
||||
public static boolean isFlashExisting(String home_directory) {
|
||||
return new File (home_directory, "data/dc_flash.bin").exists();
|
||||
}
|
||||
}
|
||||
|
||||
public void onGameSelected(Uri uri) {
|
||||
if (Config.readOutput("uname -a").equals(getString(R.string.error_kernel))) {
|
||||
|
@ -231,37 +231,37 @@ public class MainActivity extends AppCompatActivity implements
|
|||
String home_directory = mPrefs.getString(Config.pref_home,
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
|
||||
if (!isBiosExisting(home_directory)) {
|
||||
launchBIOSdetection();
|
||||
return;
|
||||
}
|
||||
if (!isBiosExisting(home_directory)) {
|
||||
launchBIOSdetection();
|
||||
return;
|
||||
}
|
||||
if (!isFlashExisting(home_directory)) {
|
||||
launchBIOSdetection();
|
||||
return;
|
||||
}
|
||||
launchBIOSdetection();
|
||||
return;
|
||||
}
|
||||
|
||||
JNIdc.config(home_directory);
|
||||
|
||||
Emulator.nativeact = PreferenceManager.getDefaultSharedPreferences(
|
||||
getApplicationContext()).getBoolean(Emulator.pref_nativeact, Emulator.nativeact);
|
||||
if (Emulator.nativeact) {
|
||||
startActivity(new Intent("com.reicast.EMULATOR", uri, getApplicationContext(),
|
||||
GL2JNINative.class));
|
||||
} else {
|
||||
startActivity(new Intent("com.reicast.EMULATOR", uri, getApplicationContext(),
|
||||
GL2JNIActivity.class));
|
||||
}
|
||||
Emulator.nativeact = PreferenceManager.getDefaultSharedPreferences(
|
||||
getApplicationContext()).getBoolean(Emulator.pref_nativeact, Emulator.nativeact);
|
||||
if (Emulator.nativeact) {
|
||||
startActivity(new Intent("com.reicast.EMULATOR", uri, getApplicationContext(),
|
||||
GL2JNINative.class));
|
||||
} else {
|
||||
startActivity(new Intent("com.reicast.EMULATOR", uri, getApplicationContext(),
|
||||
GL2JNIActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void launchBIOSdetection() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.bios_selection);
|
||||
builder.setPositiveButton(R.string.browse,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
onMainBrowseSelected(false,
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath(),
|
||||
false, null);
|
||||
onMainBrowseSelected(false,
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath(),
|
||||
false, null);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.gdrive,
|
||||
|
@ -292,29 +292,29 @@ public class MainActivity extends AppCompatActivity implements
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch the browser activity with specified parameters
|
||||
*
|
||||
* @param browse
|
||||
* Conditional for image files or folders
|
||||
* @param path
|
||||
* The root path of the browser fragment
|
||||
* @param games
|
||||
* Conditional for viewing games or BIOS
|
||||
* @param query
|
||||
* Search parameters to limit list items
|
||||
*/
|
||||
/**
|
||||
* Launch the browser activity with specified parameters
|
||||
*
|
||||
* @param browse
|
||||
* Conditional for image files or folders
|
||||
* @param path
|
||||
* The root path of the browser fragment
|
||||
* @param games
|
||||
* Conditional for viewing games or BIOS
|
||||
* @param query
|
||||
* Search parameters to limit list items
|
||||
*/
|
||||
public void onMainBrowseSelected(boolean browse, String path, boolean games, String query) {
|
||||
FileBrowser firstFragment = new FileBrowser();
|
||||
Bundle args = new Bundle();
|
||||
// args.putBoolean("ImgBrowse", false);
|
||||
args.putBoolean("ImgBrowse", browse);
|
||||
args.putBoolean("ImgBrowse", browse);
|
||||
// specify ImgBrowse option. true = images, false = folders only
|
||||
args.putString("browse_entry", path);
|
||||
// specify a path for selecting folder options
|
||||
args.putBoolean("games_entry", games);
|
||||
// specify if the desired path is for games or data
|
||||
args.putString("search_params", query);
|
||||
args.putString("search_params", query);
|
||||
|
||||
firstFragment.setArguments(args);
|
||||
// In case this activity was started with special instructions from
|
||||
|
@ -326,7 +326,7 @@ public class MainActivity extends AppCompatActivity implements
|
|||
.beginTransaction()
|
||||
.replace(R.id.fragment_container, firstFragment, "MAIN_BROWSER")
|
||||
.addToBackStack(null).commit();
|
||||
setTitle(R.string.browser);
|
||||
setTitle(R.string.browser);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -360,9 +360,9 @@ public class MainActivity extends AppCompatActivity implements
|
|||
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
|
||||
private void launchMainFragment() {
|
||||
onMainBrowseSelected(true, null, false, null);
|
||||
onMainBrowseSelected(true, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -399,14 +399,14 @@ public class MainActivity extends AppCompatActivity implements
|
|||
fragment.moga.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CloudFragment cloudfragment = (CloudFragment) getSupportFragmentManager()
|
||||
.findFragmentByTag("CLOUD_FRAG");
|
||||
if (cloudfragment != null && cloudfragment.isVisible()) {
|
||||
cloudfragment.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
@ -546,11 +546,11 @@ public class MainActivity extends AppCompatActivity implements
|
|||
if (hasFocus && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
}
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCallable(Intent intent) {
|
||||
|
|
|
@ -79,7 +79,7 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
this.childview = childview;
|
||||
this.mCallback = mCallback;
|
||||
}
|
||||
|
||||
|
||||
public void setGameID(String id) {
|
||||
this.gameId = id;
|
||||
initializeDefaults();
|
||||
|
@ -157,7 +157,7 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
} else {
|
||||
((ImageView) childview.findViewById(R.id.item_icon)).setImageBitmap(coverart);
|
||||
}
|
||||
|
||||
|
||||
if (mPrefs.getBoolean(Config.pref_gamedetails, false)) {
|
||||
childview.findViewById(R.id.childview).setOnLongClickListener(
|
||||
new OnLongClickListener() {
|
||||
|
@ -202,7 +202,7 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
|
||||
childview.setTag(game_name);
|
||||
}
|
||||
|
||||
|
||||
private void initializeDefaults() {
|
||||
game_details = mContext.getString(R.string.info_unavailable);
|
||||
final String nameLower = game.getName().toLowerCase(
|
||||
|
@ -218,7 +218,7 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
|
||||
public boolean isNetworkAvailable() {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) mContext
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
NetworkInfo mMobile = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
|
@ -232,7 +232,7 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
public Drawable getGameIcon() {
|
||||
return game_icon;
|
||||
}
|
||||
|
||||
|
||||
public Bitmap getGameCover() {
|
||||
return coverart;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
public String getGameTitle() {
|
||||
return game_name;
|
||||
}
|
||||
|
||||
|
||||
public String getGameDetails() {
|
||||
return game_details;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class Config {
|
|||
|
||||
/**
|
||||
* Read the output of a shell command
|
||||
*
|
||||
*
|
||||
* @param command
|
||||
* The shell command being issued to the terminal
|
||||
*/
|
||||
|
|
|
@ -30,7 +30,7 @@ public class EditVJoyActivity extends Activity {
|
|||
GL2JNIView mView;
|
||||
PopupWindow popUp;
|
||||
LayoutParams params;
|
||||
|
||||
|
||||
private float[][] vjoy_d_cached;
|
||||
|
||||
View addbut(int x, OnClickListener ocl) {
|
||||
|
@ -46,7 +46,7 @@ public class EditVJoyActivity extends Activity {
|
|||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
|
||||
popUp = createVJoyPopup();
|
||||
|
||||
// Call parent onCreate()
|
||||
|
@ -65,7 +65,7 @@ public class EditVJoyActivity extends Activity {
|
|||
|
||||
vjoy_d_cached = VJoy.readCustomVjoyValues(getApplicationContext());
|
||||
|
||||
JNIdc.show_osd();
|
||||
JNIdc.show_osd();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,7 +91,7 @@ public class EditVJoyActivity extends Activity {
|
|||
super.onDestroy();
|
||||
mView.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
PopupWindow createVJoyPopup() {
|
||||
final PopupWindow popUp = new PopupWindow(this);
|
||||
int p = OnScreenMenu.getPixelsFromDp(60, this);
|
||||
|
@ -151,7 +151,7 @@ public class EditVJoyActivity extends Activity {
|
|||
} else
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class InputFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.input_fragment, container, false);
|
||||
}
|
||||
|
@ -109,34 +109,34 @@ public class InputFragment extends Fragment {
|
|||
final SeekBar vibSeek = (SeekBar) getView().findViewById(R.id.vib_seekBar);
|
||||
|
||||
if (sharedPreferences.getBoolean(Config.pref_touchvibe, true)) {
|
||||
vibLay.setVisibility(View.VISIBLE);
|
||||
vibLay.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
vibLay.setVisibility(View.GONE);
|
||||
vibLay.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
duration.setText(String.valueOf(Config.vibrationDuration + " ms"));
|
||||
vibSeek.setProgress(Config.vibrationDuration);
|
||||
|
||||
vibSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
duration.setText(String.valueOf(progress + 5 + " ms"));
|
||||
}
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
duration.setText(String.valueOf(progress + 5 + " ms"));
|
||||
}
|
||||
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
int progress = seekBar.getProgress() + 5;
|
||||
sharedPreferences.edit().putInt(Config.pref_vibrationDuration, progress).apply();
|
||||
Config.vibrationDuration = progress;
|
||||
vib.vibrate(progress);
|
||||
}
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
int progress = seekBar.getProgress() + 5;
|
||||
sharedPreferences.edit().putInt(Config.pref_vibrationDuration, progress).apply();
|
||||
Config.vibrationDuration = progress;
|
||||
vib.vibrate(progress);
|
||||
}
|
||||
});
|
||||
|
||||
OnCheckedChangeListener touch_vibration = new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
sharedPreferences.edit()
|
||||
.putBoolean(Config.pref_touchvibe, isChecked).apply();
|
||||
vibLay.setVisibility( isChecked ? View.VISIBLE : View.GONE );
|
||||
|
@ -163,7 +163,7 @@ public class InputFragment extends Fragment {
|
|||
micPluggedIntoFirstController
|
||||
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
sharedPreferences.edit().putBoolean(Config.pref_mic, isChecked).apply();
|
||||
}
|
||||
});
|
||||
|
@ -406,7 +406,7 @@ public class InputFragment extends Fragment {
|
|||
});
|
||||
builder.setOnKeyListener(new Dialog.OnKeyListener() {
|
||||
public boolean onKey(DialogInterface dialog, int keyCode,
|
||||
KeyEvent event) {
|
||||
KeyEvent event) {
|
||||
return mapDevice(keyCode, event);
|
||||
}
|
||||
});
|
||||
|
@ -452,20 +452,20 @@ public class InputFragment extends Fragment {
|
|||
}
|
||||
|
||||
switch (listenForButton) {
|
||||
case 0:
|
||||
return false;
|
||||
case 1:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player1, descriptor).apply();
|
||||
break;
|
||||
case 2:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player2, descriptor).apply();
|
||||
break;
|
||||
case 3:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player3, descriptor).apply();
|
||||
break;
|
||||
case 4:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player4, descriptor).apply();
|
||||
break;
|
||||
case 0:
|
||||
return false;
|
||||
case 1:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player1, descriptor).apply();
|
||||
break;
|
||||
case 2:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player2, descriptor).apply();
|
||||
break;
|
||||
case 3:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player3, descriptor).apply();
|
||||
break;
|
||||
case 4:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player4, descriptor).apply();
|
||||
break;
|
||||
}
|
||||
|
||||
Log.d("New port " + listenForButton + " controller:", descriptor);
|
||||
|
@ -479,18 +479,18 @@ public class InputFragment extends Fragment {
|
|||
|
||||
private void removeController(int playerNum) {
|
||||
switch (playerNum) {
|
||||
case 1:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player1, null).apply();
|
||||
break;
|
||||
case 2:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player2, null).apply();
|
||||
break;
|
||||
case 3:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player3, null).apply();
|
||||
break;
|
||||
case 4:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player4, null).apply();
|
||||
break;
|
||||
case 1:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player1, null).apply();
|
||||
break;
|
||||
case 2:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player2, null).apply();
|
||||
break;
|
||||
case 3:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player3, null).apply();
|
||||
break;
|
||||
case 4:
|
||||
sharedPreferences.edit().putString(Gamepad.pref_player4, null).apply();
|
||||
break;
|
||||
}
|
||||
|
||||
updateControllers();
|
||||
|
@ -519,13 +519,13 @@ public class InputFragment extends Fragment {
|
|||
|
||||
public void onStateEvent(StateEvent event) {
|
||||
if (event.getState() == StateEvent.STATE_CONNECTION &&
|
||||
event.getAction() == MOGAInput.ACTION_CONNECTED) {
|
||||
event.getAction() == MOGAInput.ACTION_CONNECTED) {
|
||||
|
||||
int mControllerVersion = moga.mController
|
||||
.getState(Controller.STATE_CURRENT_PRODUCT_VERSION);
|
||||
.getState(Controller.STATE_CURRENT_PRODUCT_VERSION);
|
||||
|
||||
if (mControllerVersion == Controller.ACTION_VERSION_MOGA ||
|
||||
mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) {
|
||||
mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) {
|
||||
pad.isActiveMoga[playerNum] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.input_mod_fragment, container, false);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class InputModFragment extends Fragment {
|
|||
if (b != null) {
|
||||
playerNum = b.getInt("portNumber", -1);
|
||||
}
|
||||
|
||||
|
||||
switchJoystickDpadEnabled = (CompoundButton) getView().findViewById(
|
||||
R.id.switchJoystickDpadEnabled);
|
||||
switchRightStickLREnabled = (CompoundButton) getView().findViewById(
|
||||
|
@ -101,41 +101,41 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
OnCheckedChangeListener joystick_mode = new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Gamepad.pref_js_merged + player, isChecked).apply();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
switchJoystickDpadEnabled.setOnCheckedChangeListener(joystick_mode);
|
||||
|
||||
|
||||
OnCheckedChangeListener rstick_mode = new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Gamepad.pref_js_rbuttons + player, isChecked).apply();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
switchRightStickLREnabled.setOnCheckedChangeListener(rstick_mode);
|
||||
|
||||
OnCheckedChangeListener modified_layout = new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Gamepad.pref_js_modified + player, isChecked).apply();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
switchModifiedLayoutEnabled.setOnCheckedChangeListener(modified_layout);
|
||||
|
||||
OnCheckedChangeListener compat_mode = new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Gamepad.pref_js_compat + player, isChecked).apply();
|
||||
if (isChecked) {
|
||||
selectController();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
switchCompatibilityEnabled.setOnCheckedChangeListener(compat_mode);
|
||||
|
||||
mKey = new mapKeyCode(getActivity());
|
||||
|
@ -358,11 +358,11 @@ public class InputModFragment extends Fragment {
|
|||
player_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
public void onItemSelected(AdapterView<?> parent, View view,
|
||||
int pos, long id) {
|
||||
int pos, long id) {
|
||||
String selection = parent.getItemAtPosition(pos).toString();
|
||||
player = "_"
|
||||
+ selection.substring(selection.lastIndexOf(" ") + 1,
|
||||
selection.length());
|
||||
selection.length());
|
||||
playerNum = pos;
|
||||
updateController(player);
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
/**
|
||||
* Retrieve an image to serve as a visual representation
|
||||
*
|
||||
*
|
||||
* @param x
|
||||
* The x start value of the image within the atlas
|
||||
* @param y
|
||||
|
@ -430,7 +430,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
/**
|
||||
* Prompt the user to specify the controller to modify
|
||||
*
|
||||
*
|
||||
*/
|
||||
private void selectController() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
@ -464,7 +464,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
/**
|
||||
* Prompt the user for the button to be assigned
|
||||
*
|
||||
*
|
||||
* @param button
|
||||
* The name of the emulator button being defined
|
||||
* @param output
|
||||
|
@ -498,7 +498,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
/**
|
||||
* Assign the user button to the emulator button
|
||||
*
|
||||
*
|
||||
* @param keyCode
|
||||
* The keycode generated by the button being assigned
|
||||
* @param event
|
||||
|
@ -549,7 +549,7 @@ public class InputModFragment extends Fragment {
|
|||
if (label.contains(":")) {
|
||||
label = label.substring(0, label.indexOf(":"));
|
||||
}
|
||||
|
||||
|
||||
output.setText(label + ": " + ev.getAction());
|
||||
}
|
||||
|
||||
|
|
|
@ -62,18 +62,18 @@ public class OptionsFragment extends Fragment {
|
|||
private File sdcard = Environment.getExternalStorageDirectory();
|
||||
private String home_directory = sdcard.getAbsolutePath();
|
||||
private String game_directory = sdcard.getAbsolutePath();
|
||||
|
||||
|
||||
private String[] codes;
|
||||
|
||||
// Container Activity must implement this interface
|
||||
public interface OnClickListener {
|
||||
void onMainBrowseSelected(boolean browse, String path_entry, boolean games, String query);
|
||||
void onMainBrowseSelected(boolean browse, String path_entry, boolean games, String query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
|
||||
// This makes sure that the container activity has implemented
|
||||
// the callback interface. If not, it throws an exception
|
||||
try {
|
||||
|
@ -100,16 +100,16 @@ public class OptionsFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.configure_fragment, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
|
||||
|
||||
mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
|
||||
|
||||
// Specialized handler for devices with an extSdCard mount for external
|
||||
HashSet<String> extStorage = FileBrowser.getExternalMounts();
|
||||
if (extStorage != null && !extStorage.isEmpty()) {
|
||||
|
@ -120,7 +120,7 @@ public class OptionsFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
home_directory = mPrefs.getString(Config.pref_home, home_directory);
|
||||
Emulator app = (Emulator) getActivity().getApplicationContext();
|
||||
app.getConfigurationPrefs(mPrefs);
|
||||
|
@ -137,7 +137,7 @@ public class OptionsFragment extends Fragment {
|
|||
mainBrowse.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
mPrefs.edit().remove(Config.pref_home).apply();
|
||||
hideSoftKeyBoard();
|
||||
hideSoftKeyBoard();
|
||||
mCallback.onMainBrowseSelected(false, home_directory, false, null);
|
||||
}
|
||||
});
|
||||
|
@ -163,11 +163,11 @@ public class OptionsFragment extends Fragment {
|
|||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
OnCheckedChangeListener reios_options = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Emulator.pref_usereios, isChecked).apply();
|
||||
}
|
||||
};
|
||||
|
@ -175,11 +175,11 @@ public class OptionsFragment extends Fragment {
|
|||
R.id.reios_option);
|
||||
reios_opt.setChecked(mPrefs.getBoolean(Emulator.pref_usereios, false));
|
||||
reios_opt.setOnCheckedChangeListener(reios_options);
|
||||
|
||||
|
||||
OnCheckedChangeListener details_options = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Config.pref_gamedetails, isChecked).apply();
|
||||
if (!isChecked) {
|
||||
File dir = new File(getActivity().getExternalFilesDir(null), "images");
|
||||
|
@ -209,7 +209,7 @@ public class OptionsFragment extends Fragment {
|
|||
if (editBrowse.getText() != null) {
|
||||
game_directory = editGames.getText().toString();
|
||||
}
|
||||
hideSoftKeyBoard();
|
||||
hideSoftKeyBoard();
|
||||
mCallback.onMainBrowseSelected(false, game_directory, true, null);
|
||||
}
|
||||
});
|
||||
|
@ -243,12 +243,12 @@ public class OptionsFragment extends Fragment {
|
|||
bios_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
public void onItemSelected(AdapterView<?> parent, View view,
|
||||
int pos, long id) {
|
||||
flashBios(codes[pos]);
|
||||
int pos, long id) {
|
||||
flashBios(codes[pos]);
|
||||
}
|
||||
|
||||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -256,7 +256,7 @@ public class OptionsFragment extends Fragment {
|
|||
OnCheckedChangeListener native_options = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Emulator.pref_nativeact, isChecked).apply();
|
||||
Emulator.nativeact = isChecked;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class OptionsFragment extends Fragment {
|
|||
OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Emulator.pref_dynarecopt, isChecked).apply();
|
||||
Emulator.dynarecopt = isChecked;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ public class OptionsFragment extends Fragment {
|
|||
OnCheckedChangeListener unstable_option = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Emulator.pref_unstable, isChecked).apply();
|
||||
Emulator.unstableopt = isChecked;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ public class OptionsFragment extends Fragment {
|
|||
cable_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
public void onItemSelected(AdapterView<?> parent, View view,
|
||||
int pos, long id) {
|
||||
int pos, long id) {
|
||||
mPrefs.edit().putInt(Emulator.pref_cable, pos + 1).apply();
|
||||
Emulator.cable = pos + 1;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ public class OptionsFragment extends Fragment {
|
|||
pvr_render.setChecked(Emulator.pvrrender);
|
||||
pvr_render.setOnCheckedChangeListener(pvr_rendering);
|
||||
|
||||
OnCheckedChangeListener synchronous = new OnCheckedChangeListener() {
|
||||
OnCheckedChangeListener synchronous = new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Emulator.pref_syncedrender, isChecked).apply();
|
||||
Emulator.syncedrender = isChecked;
|
||||
|
@ -514,7 +514,7 @@ public class OptionsFragment extends Fragment {
|
|||
OnCheckedChangeListener fps_options = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean(Config.pref_showfps, isChecked).apply();
|
||||
}
|
||||
};
|
||||
|
@ -595,7 +595,7 @@ public class OptionsFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private final class LocateThemes extends AsyncTask<String, Integer, List<File>> {
|
||||
@Override
|
||||
protected List<File> doInBackground(String... paths) {
|
||||
|
@ -663,7 +663,7 @@ public class OptionsFragment extends Fragment {
|
|||
iMm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void copy(File src, File dst) throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
try (InputStream in = new FileInputStream(src)) {
|
||||
|
@ -692,7 +692,7 @@ public class OptionsFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void flashBios(String localized) {
|
||||
File local = new File(home_directory, "data/dc_flash[" + localized
|
||||
+ "].bin");
|
||||
|
|
|
@ -59,7 +59,7 @@ public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
|||
|
||||
/**
|
||||
* Obtain the specific parameters of the current device
|
||||
*
|
||||
*
|
||||
*/
|
||||
private String discoverCPUData() {
|
||||
String s = "MODEL: " + Build.MODEL;
|
||||
|
@ -108,7 +108,7 @@ public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
|||
|
||||
/**
|
||||
* Read the output of a shell command
|
||||
*
|
||||
*
|
||||
* @param command
|
||||
* The shell command being issued to the terminal
|
||||
*/
|
||||
|
|
|
@ -114,7 +114,7 @@ public class GitAdapter extends BaseAdapter {
|
|||
}
|
||||
|
||||
private void displayCommit(final String sha, String message, String url,
|
||||
Context context) {
|
||||
Context context) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setCancelable(true);
|
||||
builder.setTitle(sha.substring(0,7));
|
||||
|
@ -138,7 +138,7 @@ public class GitAdapter extends BaseAdapter {
|
|||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@SuppressWarnings("deprecation")
|
||||
private WebView configureWebview(String url, Context context,
|
||||
WebView mWebView) {
|
||||
WebView mWebView) {
|
||||
mWebView.getSettings().setSupportZoom(true);
|
||||
mWebView.getSettings().setBuiltInZoomControls(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,230 +12,230 @@ import javax.microedition.khronos.egl.EGLDisplay;
|
|||
|
||||
public class GLCFactory {
|
||||
|
||||
private static void LOGI(String S) { Log.i("GL2JNIView",S); }
|
||||
private static void LOGW(String S) { Log.w("GL2JNIView",S); }
|
||||
private static void LOGE(String S) { Log.e("GL2JNIView",S); }
|
||||
private static void LOGI(String S) { Log.i("GL2JNIView",S); }
|
||||
private static void LOGW(String S) { Log.w("GL2JNIView",S); }
|
||||
private static void LOGE(String S) { Log.e("GL2JNIView",S); }
|
||||
|
||||
private int DEPTH_COMPONENT16_NONLINEAR_NV = 0x8E2C;
|
||||
private int EGL_DEPTH_ENCODING_NV = 0x30E2;
|
||||
private int EGL_DEPTH_ENCODING_NONLINEAR_NV = 0x30E3;
|
||||
private int DEPTH_COMPONENT16_NONLINEAR_NV = 0x8E2C;
|
||||
private int EGL_DEPTH_ENCODING_NV = 0x30E2;
|
||||
private int EGL_DEPTH_ENCODING_NONLINEAR_NV = 0x30E3;
|
||||
|
||||
public static class ContextFactory implements GLSurfaceView.EGLContextFactory
|
||||
{
|
||||
private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
|
||||
public static class ContextFactory implements GLSurfaceView.EGLContextFactory
|
||||
{
|
||||
private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
|
||||
|
||||
public EGLContext createContext(EGL10 egl,EGLDisplay display,EGLConfig eglConfig)
|
||||
{
|
||||
int[] attrList = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
|
||||
public EGLContext createContext(EGL10 egl,EGLDisplay display,EGLConfig eglConfig)
|
||||
{
|
||||
int[] attrList = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
|
||||
|
||||
LOGI("Creating OpenGL ES 2.0 context");
|
||||
LOGI("Creating OpenGL ES 2.0 context");
|
||||
|
||||
checkEglError("Before eglCreateContext",egl);
|
||||
EGLContext context = egl.eglCreateContext(display,eglConfig,EGL10.EGL_NO_CONTEXT,attrList);
|
||||
checkEglError("After eglCreateContext",egl);
|
||||
return(context);
|
||||
}
|
||||
checkEglError("Before eglCreateContext",egl);
|
||||
EGLContext context = egl.eglCreateContext(display,eglConfig,EGL10.EGL_NO_CONTEXT,attrList);
|
||||
checkEglError("After eglCreateContext",egl);
|
||||
return(context);
|
||||
}
|
||||
|
||||
public void destroyContext(EGL10 egl,EGLDisplay display,EGLContext context)
|
||||
{
|
||||
LOGI("Destroying OpenGL ES 2.0 context");
|
||||
egl.eglDestroyContext(display,context);
|
||||
}
|
||||
}
|
||||
public void destroyContext(EGL10 egl,EGLDisplay display,EGLContext context)
|
||||
{
|
||||
LOGI("Destroying OpenGL ES 2.0 context");
|
||||
egl.eglDestroyContext(display,context);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkEglError(String prompt,EGL10 egl)
|
||||
{
|
||||
int error;
|
||||
private static void checkEglError(String prompt,EGL10 egl)
|
||||
{
|
||||
int error;
|
||||
|
||||
while((error=egl.eglGetError()) != EGL10.EGL_SUCCESS)
|
||||
LOGE(String.format("%s: EGL error: 0x%x",prompt,error));
|
||||
}
|
||||
while((error=egl.eglGetError()) != EGL10.EGL_SUCCESS)
|
||||
LOGE(String.format("%s: EGL error: 0x%x",prompt,error));
|
||||
}
|
||||
|
||||
public static class ConfigChooser implements GLSurfaceView.EGLConfigChooser
|
||||
{
|
||||
// Subclasses can adjust these values:
|
||||
protected int mRedSize;
|
||||
protected int mGreenSize;
|
||||
protected int mBlueSize;
|
||||
protected int mAlphaSize;
|
||||
protected int mDepthSize;
|
||||
protected int mStencilSize;
|
||||
private int[] mValue = new int[1];
|
||||
public static class ConfigChooser implements GLSurfaceView.EGLConfigChooser
|
||||
{
|
||||
// Subclasses can adjust these values:
|
||||
protected int mRedSize;
|
||||
protected int mGreenSize;
|
||||
protected int mBlueSize;
|
||||
protected int mAlphaSize;
|
||||
protected int mDepthSize;
|
||||
protected int mStencilSize;
|
||||
private int[] mValue = new int[1];
|
||||
|
||||
public ConfigChooser(int r,int g,int b,int a,int depth,int stencil)
|
||||
{
|
||||
mRedSize = r;
|
||||
mGreenSize = g;
|
||||
mBlueSize = b;
|
||||
mAlphaSize = a;
|
||||
mDepthSize = depth;
|
||||
mStencilSize = stencil;
|
||||
}
|
||||
public ConfigChooser(int r,int g,int b,int a,int depth,int stencil)
|
||||
{
|
||||
mRedSize = r;
|
||||
mGreenSize = g;
|
||||
mBlueSize = b;
|
||||
mAlphaSize = a;
|
||||
mDepthSize = depth;
|
||||
mStencilSize = stencil;
|
||||
}
|
||||
|
||||
// This EGL config specification is used to specify 2.0 rendering.
|
||||
// We use a minimum size of 4 bits for red/green/blue, but will
|
||||
// perform actual matching in chooseConfig() below.
|
||||
private static final int EGL_OPENGL_ES2_BIT = 4;
|
||||
private static final int[] cfgAttrs =
|
||||
{
|
||||
EGL10.EGL_RED_SIZE, 4,
|
||||
EGL10.EGL_GREEN_SIZE, 4,
|
||||
EGL10.EGL_BLUE_SIZE, 4,
|
||||
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL10.EGL_DEPTH_SIZE, 24,
|
||||
EGL10.EGL_NONE
|
||||
};
|
||||
// This EGL config specification is used to specify 2.0 rendering.
|
||||
// We use a minimum size of 4 bits for red/green/blue, but will
|
||||
// perform actual matching in chooseConfig() below.
|
||||
private static final int EGL_OPENGL_ES2_BIT = 4;
|
||||
private static final int[] cfgAttrs =
|
||||
{
|
||||
EGL10.EGL_RED_SIZE, 4,
|
||||
EGL10.EGL_GREEN_SIZE, 4,
|
||||
EGL10.EGL_BLUE_SIZE, 4,
|
||||
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL10.EGL_DEPTH_SIZE, 24,
|
||||
EGL10.EGL_NONE
|
||||
};
|
||||
|
||||
public EGLConfig chooseConfig(EGL10 egl,EGLDisplay display)
|
||||
{
|
||||
// Get the number of minimally matching EGL configurations
|
||||
int[] cfgCount = new int[1];
|
||||
egl.eglChooseConfig(display,cfgAttrs,null,0,cfgCount);
|
||||
public EGLConfig chooseConfig(EGL10 egl,EGLDisplay display)
|
||||
{
|
||||
// Get the number of minimally matching EGL configurations
|
||||
int[] cfgCount = new int[1];
|
||||
egl.eglChooseConfig(display,cfgAttrs,null,0,cfgCount);
|
||||
|
||||
if(cfgCount[0]<=0)
|
||||
{
|
||||
cfgAttrs[9]=16;
|
||||
egl.eglChooseConfig(display,cfgAttrs,null,0,cfgCount);
|
||||
}
|
||||
if (cfgCount[0]<=0)
|
||||
{
|
||||
cfgAttrs[9]=16;
|
||||
egl.eglChooseConfig(display,cfgAttrs,null,0,cfgCount);
|
||||
}
|
||||
|
||||
|
||||
if(cfgCount[0]<=0)
|
||||
throw new IllegalArgumentException("No configs match configSpec");
|
||||
if (cfgCount[0]<=0)
|
||||
throw new IllegalArgumentException("No configs match configSpec");
|
||||
|
||||
// Allocate then read the array of minimally matching EGL configs
|
||||
EGLConfig[] configs = new EGLConfig[cfgCount[0]];
|
||||
egl.eglChooseConfig(display,cfgAttrs,configs,cfgCount[0],cfgCount);
|
||||
// Allocate then read the array of minimally matching EGL configs
|
||||
EGLConfig[] configs = new EGLConfig[cfgCount[0]];
|
||||
egl.eglChooseConfig(display,cfgAttrs,configs,cfgCount[0],cfgCount);
|
||||
|
||||
if(GL2JNIView.DEBUG)
|
||||
printConfigs(egl,display,configs);
|
||||
if (GL2JNIView.DEBUG)
|
||||
printConfigs(egl,display,configs);
|
||||
|
||||
// Now return the "best" one
|
||||
return(chooseConfig(egl,display,configs));
|
||||
}
|
||||
// Now return the "best" one
|
||||
return(chooseConfig(egl,display,configs));
|
||||
}
|
||||
|
||||
public EGLConfig chooseConfig(EGL10 egl,EGLDisplay display,EGLConfig[] configs)
|
||||
{
|
||||
for(EGLConfig config : configs)
|
||||
{
|
||||
int d = findConfigAttrib(egl,display,config,EGL10.EGL_DEPTH_SIZE,0);
|
||||
int s = findConfigAttrib(egl,display,config,EGL10.EGL_STENCIL_SIZE,0);
|
||||
public EGLConfig chooseConfig(EGL10 egl,EGLDisplay display,EGLConfig[] configs)
|
||||
{
|
||||
for (EGLConfig config : configs)
|
||||
{
|
||||
int d = findConfigAttrib(egl,display,config,EGL10.EGL_DEPTH_SIZE,0);
|
||||
int s = findConfigAttrib(egl,display,config,EGL10.EGL_STENCIL_SIZE,0);
|
||||
|
||||
// We need at least mDepthSize and mStencilSize bits
|
||||
if(d>=mDepthSize || s>=mStencilSize)
|
||||
{
|
||||
// We want an *exact* match for red/green/blue/alpha
|
||||
int r = findConfigAttrib(egl,display,config,EGL10.EGL_RED_SIZE, 0);
|
||||
int g = findConfigAttrib(egl,display,config,EGL10.EGL_GREEN_SIZE,0);
|
||||
int b = findConfigAttrib(egl,display,config,EGL10.EGL_BLUE_SIZE, 0);
|
||||
int a = findConfigAttrib(egl,display,config,EGL10.EGL_ALPHA_SIZE,0);
|
||||
// We need at least mDepthSize and mStencilSize bits
|
||||
if (d>=mDepthSize || s>=mStencilSize)
|
||||
{
|
||||
// We want an *exact* match for red/green/blue/alpha
|
||||
int r = findConfigAttrib(egl,display,config,EGL10.EGL_RED_SIZE, 0);
|
||||
int g = findConfigAttrib(egl,display,config,EGL10.EGL_GREEN_SIZE,0);
|
||||
int b = findConfigAttrib(egl,display,config,EGL10.EGL_BLUE_SIZE, 0);
|
||||
int a = findConfigAttrib(egl,display,config,EGL10.EGL_ALPHA_SIZE,0);
|
||||
|
||||
if(r==mRedSize && g==mGreenSize && b==mBlueSize && a==mAlphaSize)
|
||||
return(config);
|
||||
}
|
||||
}
|
||||
if(r==mRedSize && g==mGreenSize && b==mBlueSize && a==mAlphaSize)
|
||||
return(config);
|
||||
}
|
||||
}
|
||||
|
||||
return(null);
|
||||
}
|
||||
return(null);
|
||||
}
|
||||
|
||||
private int findConfigAttrib(EGL10 egl,EGLDisplay display,EGLConfig config,int attribute,int defaultValue)
|
||||
{
|
||||
return(egl.eglGetConfigAttrib(display,config,attribute,mValue)? mValue[0] : defaultValue);
|
||||
}
|
||||
private int findConfigAttrib(EGL10 egl,EGLDisplay display,EGLConfig config,int attribute,int defaultValue)
|
||||
{
|
||||
return(egl.eglGetConfigAttrib(display,config,attribute,mValue)? mValue[0] : defaultValue);
|
||||
}
|
||||
|
||||
private void printConfigs(EGL10 egl,EGLDisplay display,EGLConfig[] configs)
|
||||
{
|
||||
LOGW(String.format(Locale.getDefault(), "%d configurations", configs.length));
|
||||
private void printConfigs(EGL10 egl,EGLDisplay display,EGLConfig[] configs)
|
||||
{
|
||||
LOGW(String.format(Locale.getDefault(), "%d configurations", configs.length));
|
||||
|
||||
for(int i=0 ; i<configs.length ; i++)
|
||||
{
|
||||
LOGW(String.format(Locale.getDefault(), "Configuration %d:", i));
|
||||
printConfig(egl,display,configs[i]);
|
||||
}
|
||||
}
|
||||
for(int i=0 ; i<configs.length ; i++)
|
||||
{
|
||||
LOGW(String.format(Locale.getDefault(), "Configuration %d:", i));
|
||||
printConfig(egl,display,configs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void printConfig(EGL10 egl,EGLDisplay display,EGLConfig config)
|
||||
{
|
||||
final int[] attributes =
|
||||
{
|
||||
EGL10.EGL_BUFFER_SIZE,
|
||||
EGL10.EGL_ALPHA_SIZE,
|
||||
EGL10.EGL_BLUE_SIZE,
|
||||
EGL10.EGL_GREEN_SIZE,
|
||||
EGL10.EGL_RED_SIZE,
|
||||
EGL10.EGL_DEPTH_SIZE,
|
||||
EGL10.EGL_STENCIL_SIZE,
|
||||
EGL10.EGL_CONFIG_CAVEAT,
|
||||
EGL10.EGL_CONFIG_ID,
|
||||
EGL10.EGL_LEVEL,
|
||||
EGL10.EGL_MAX_PBUFFER_HEIGHT,
|
||||
EGL10.EGL_MAX_PBUFFER_PIXELS,
|
||||
EGL10.EGL_MAX_PBUFFER_WIDTH,
|
||||
EGL10.EGL_NATIVE_RENDERABLE,
|
||||
EGL10.EGL_NATIVE_VISUAL_ID,
|
||||
EGL10.EGL_NATIVE_VISUAL_TYPE,
|
||||
0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
|
||||
EGL10.EGL_SAMPLES,
|
||||
EGL10.EGL_SAMPLE_BUFFERS,
|
||||
EGL10.EGL_SURFACE_TYPE,
|
||||
EGL10.EGL_TRANSPARENT_TYPE,
|
||||
EGL10.EGL_TRANSPARENT_RED_VALUE,
|
||||
EGL10.EGL_TRANSPARENT_GREEN_VALUE,
|
||||
EGL10.EGL_TRANSPARENT_BLUE_VALUE,
|
||||
0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
|
||||
0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
|
||||
0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
|
||||
0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
|
||||
EGL10.EGL_LUMINANCE_SIZE,
|
||||
EGL10.EGL_ALPHA_MASK_SIZE,
|
||||
EGL10.EGL_COLOR_BUFFER_TYPE,
|
||||
EGL10.EGL_RENDERABLE_TYPE,
|
||||
0x3042 // EGL10.EGL_CONFORMANT
|
||||
};
|
||||
private void printConfig(EGL10 egl,EGLDisplay display,EGLConfig config)
|
||||
{
|
||||
final int[] attributes =
|
||||
{
|
||||
EGL10.EGL_BUFFER_SIZE,
|
||||
EGL10.EGL_ALPHA_SIZE,
|
||||
EGL10.EGL_BLUE_SIZE,
|
||||
EGL10.EGL_GREEN_SIZE,
|
||||
EGL10.EGL_RED_SIZE,
|
||||
EGL10.EGL_DEPTH_SIZE,
|
||||
EGL10.EGL_STENCIL_SIZE,
|
||||
EGL10.EGL_CONFIG_CAVEAT,
|
||||
EGL10.EGL_CONFIG_ID,
|
||||
EGL10.EGL_LEVEL,
|
||||
EGL10.EGL_MAX_PBUFFER_HEIGHT,
|
||||
EGL10.EGL_MAX_PBUFFER_PIXELS,
|
||||
EGL10.EGL_MAX_PBUFFER_WIDTH,
|
||||
EGL10.EGL_NATIVE_RENDERABLE,
|
||||
EGL10.EGL_NATIVE_VISUAL_ID,
|
||||
EGL10.EGL_NATIVE_VISUAL_TYPE,
|
||||
0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
|
||||
EGL10.EGL_SAMPLES,
|
||||
EGL10.EGL_SAMPLE_BUFFERS,
|
||||
EGL10.EGL_SURFACE_TYPE,
|
||||
EGL10.EGL_TRANSPARENT_TYPE,
|
||||
EGL10.EGL_TRANSPARENT_RED_VALUE,
|
||||
EGL10.EGL_TRANSPARENT_GREEN_VALUE,
|
||||
EGL10.EGL_TRANSPARENT_BLUE_VALUE,
|
||||
0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
|
||||
0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
|
||||
0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
|
||||
0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
|
||||
EGL10.EGL_LUMINANCE_SIZE,
|
||||
EGL10.EGL_ALPHA_MASK_SIZE,
|
||||
EGL10.EGL_COLOR_BUFFER_TYPE,
|
||||
EGL10.EGL_RENDERABLE_TYPE,
|
||||
0x3042 // EGL10.EGL_CONFORMANT
|
||||
};
|
||||
|
||||
final String[] names =
|
||||
{
|
||||
"EGL_BUFFER_SIZE",
|
||||
"EGL_ALPHA_SIZE",
|
||||
"EGL_BLUE_SIZE",
|
||||
"EGL_GREEN_SIZE",
|
||||
"EGL_RED_SIZE",
|
||||
"EGL_DEPTH_SIZE",
|
||||
"EGL_STENCIL_SIZE",
|
||||
"EGL_CONFIG_CAVEAT",
|
||||
"EGL_CONFIG_ID",
|
||||
"EGL_LEVEL",
|
||||
"EGL_MAX_PBUFFER_HEIGHT",
|
||||
"EGL_MAX_PBUFFER_PIXELS",
|
||||
"EGL_MAX_PBUFFER_WIDTH",
|
||||
"EGL_NATIVE_RENDERABLE",
|
||||
"EGL_NATIVE_VISUAL_ID",
|
||||
"EGL_NATIVE_VISUAL_TYPE",
|
||||
"EGL_PRESERVED_RESOURCES",
|
||||
"EGL_SAMPLES",
|
||||
"EGL_SAMPLE_BUFFERS",
|
||||
"EGL_SURFACE_TYPE",
|
||||
"EGL_TRANSPARENT_TYPE",
|
||||
"EGL_TRANSPARENT_RED_VALUE",
|
||||
"EGL_TRANSPARENT_GREEN_VALUE",
|
||||
"EGL_TRANSPARENT_BLUE_VALUE",
|
||||
"EGL_BIND_TO_TEXTURE_RGB",
|
||||
"EGL_BIND_TO_TEXTURE_RGBA",
|
||||
"EGL_MIN_SWAP_INTERVAL",
|
||||
"EGL_MAX_SWAP_INTERVAL",
|
||||
"EGL_LUMINANCE_SIZE",
|
||||
"EGL_ALPHA_MASK_SIZE",
|
||||
"EGL_COLOR_BUFFER_TYPE",
|
||||
"EGL_RENDERABLE_TYPE",
|
||||
"EGL_CONFORMANT"
|
||||
};
|
||||
final String[] names =
|
||||
{
|
||||
"EGL_BUFFER_SIZE",
|
||||
"EGL_ALPHA_SIZE",
|
||||
"EGL_BLUE_SIZE",
|
||||
"EGL_GREEN_SIZE",
|
||||
"EGL_RED_SIZE",
|
||||
"EGL_DEPTH_SIZE",
|
||||
"EGL_STENCIL_SIZE",
|
||||
"EGL_CONFIG_CAVEAT",
|
||||
"EGL_CONFIG_ID",
|
||||
"EGL_LEVEL",
|
||||
"EGL_MAX_PBUFFER_HEIGHT",
|
||||
"EGL_MAX_PBUFFER_PIXELS",
|
||||
"EGL_MAX_PBUFFER_WIDTH",
|
||||
"EGL_NATIVE_RENDERABLE",
|
||||
"EGL_NATIVE_VISUAL_ID",
|
||||
"EGL_NATIVE_VISUAL_TYPE",
|
||||
"EGL_PRESERVED_RESOURCES",
|
||||
"EGL_SAMPLES",
|
||||
"EGL_SAMPLE_BUFFERS",
|
||||
"EGL_SURFACE_TYPE",
|
||||
"EGL_TRANSPARENT_TYPE",
|
||||
"EGL_TRANSPARENT_RED_VALUE",
|
||||
"EGL_TRANSPARENT_GREEN_VALUE",
|
||||
"EGL_TRANSPARENT_BLUE_VALUE",
|
||||
"EGL_BIND_TO_TEXTURE_RGB",
|
||||
"EGL_BIND_TO_TEXTURE_RGBA",
|
||||
"EGL_MIN_SWAP_INTERVAL",
|
||||
"EGL_MAX_SWAP_INTERVAL",
|
||||
"EGL_LUMINANCE_SIZE",
|
||||
"EGL_ALPHA_MASK_SIZE",
|
||||
"EGL_COLOR_BUFFER_TYPE",
|
||||
"EGL_RENDERABLE_TYPE",
|
||||
"EGL_CONFORMANT"
|
||||
};
|
||||
|
||||
int[] value = new int[1];
|
||||
int[] value = new int[1];
|
||||
|
||||
for(int i=0 ; i<attributes.length ; i++)
|
||||
if(egl.eglGetConfigAttrib(display,config,attributes[i],value))
|
||||
LOGI(String.format(Locale.getDefault(), " %s: %d\n",names[i],value[0]));
|
||||
else
|
||||
while(egl.eglGetError()!=EGL10.EGL_SUCCESS);
|
||||
}
|
||||
}
|
||||
for (int i=0 ; i<attributes.length ; i++)
|
||||
if (egl.eglGetConfigAttrib(display,config,attributes[i],value))
|
||||
LOGI(String.format(Locale.getDefault(), " %s: %d\n",names[i],value[0]));
|
||||
else
|
||||
while(egl.eglGetError()!=EGL10.EGL_SUCCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class JNIdc
|
|||
public static native void setupMic(Object sip);
|
||||
public static native void diskSwap(String disk);
|
||||
public static native void vmuSwap();
|
||||
public static native void setupVmu(Object sip);
|
||||
public static native void setupVmu(Object sip);
|
||||
public static native void dynarec(int dynarec);
|
||||
public static native void idleskip(int idleskip);
|
||||
public static native void unstable(int unstable);
|
||||
|
@ -52,6 +52,6 @@ public final class JNIdc
|
|||
}
|
||||
|
||||
public static void hide_osd() {
|
||||
JNIdc.vjoy(13, 0,0,0,0);
|
||||
JNIdc.vjoy(13, 0,0,0,0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,11 +106,11 @@ public class OnScreenMenu {
|
|||
popups.remove(window);
|
||||
if (mContext instanceof GL2JNINative) {
|
||||
((GL2JNINative) mContext)
|
||||
.displayPopUp(((GL2JNINative) OnScreenMenu.this.mContext).popUp);
|
||||
.displayPopUp(((GL2JNINative) OnScreenMenu.this.mContext).popUp);
|
||||
}
|
||||
if (mContext instanceof GL2JNIActivity) {
|
||||
((GL2JNIActivity) mContext)
|
||||
.displayPopUp(((GL2JNIActivity) OnScreenMenu.this.mContext).popUp);
|
||||
.displayPopUp(((GL2JNIActivity) OnScreenMenu.this.mContext).popUp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonBack = (Button) hlay.findViewById(R.id.buttonBack);
|
||||
addimg(buttonBack, R.drawable.up, clickBack);
|
||||
|
||||
|
||||
OnClickListener clickClearCache = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 0); // Killing texture cache
|
||||
|
@ -139,7 +139,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonCache = (Button) hlay.findViewById(R.id.buttonClearCache);
|
||||
addimg(buttonCache, R.drawable.clear_cache, clickClearCache);
|
||||
|
||||
|
||||
OnClickListener clickProfilerOne = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(1, 3000); // sample_Start(param);
|
||||
|
@ -148,7 +148,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonProfilerOne = (Button) hlay.findViewById(R.id.buttonProfilerOne);
|
||||
addimg(buttonProfilerOne, R.drawable.profiler, clickProfilerOne);
|
||||
|
||||
|
||||
OnClickListener clickProfilerTwo = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(1, 0); // sample_Start(param);
|
||||
|
@ -157,7 +157,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonProfilerTwo = (Button) hlay.findViewById(R.id.buttonProfilerTwo);
|
||||
addimg(buttonProfilerTwo, R.drawable.profiler, clickProfilerTwo);
|
||||
|
||||
|
||||
OnClickListener clickPrintStats = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 2);
|
||||
|
@ -179,7 +179,7 @@ public class OnScreenMenu {
|
|||
}
|
||||
if (mContext instanceof GL2JNIActivity) {
|
||||
((GL2JNIActivity) mContext)
|
||||
.displayConfig(new ConfigPopup(mContext));
|
||||
.displayConfig(new ConfigPopup(mContext));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,22 +277,22 @@ public class OnScreenMenu {
|
|||
if (audio) {
|
||||
if (mContext instanceof GL2JNINative) {
|
||||
((GL2JNINative) mContext).mView
|
||||
.audioDisable(true);
|
||||
.audioDisable(true);
|
||||
}
|
||||
if (mContext instanceof GL2JNIActivity) {
|
||||
((GL2JNIActivity) mContext).mView
|
||||
.audioDisable(true);
|
||||
.audioDisable(true);
|
||||
}
|
||||
audio = false;
|
||||
addimg(audiosetting, R.drawable.enable_sound, this);
|
||||
} else {
|
||||
if (mContext instanceof GL2JNINative) {
|
||||
((GL2JNINative) mContext).mView
|
||||
.audioDisable(false);
|
||||
.audioDisable(false);
|
||||
}
|
||||
if (mContext instanceof GL2JNIActivity) {
|
||||
((GL2JNIActivity) mContext).mView
|
||||
.audioDisable(false);
|
||||
.audioDisable(false);
|
||||
}
|
||||
audio = true;
|
||||
addimg(audiosetting, R.drawable.mute_sound, this);
|
||||
|
@ -314,11 +314,11 @@ public class OnScreenMenu {
|
|||
if (boosted) {
|
||||
if (mContext instanceof GL2JNINative) {
|
||||
((GL2JNINative) mContext).mView
|
||||
.audioDisable(!audio);
|
||||
.audioDisable(!audio);
|
||||
}
|
||||
if (mContext instanceof GL2JNIActivity) {
|
||||
((GL2JNIActivity) mContext).mView
|
||||
.audioDisable(!audio);
|
||||
.audioDisable(!audio);
|
||||
}
|
||||
JNIdc.nosound(!audio ? 1 : 0);
|
||||
audiosetting.setEnabled(true);
|
||||
|
@ -331,7 +331,7 @@ public class OnScreenMenu {
|
|||
}
|
||||
if (mContext instanceof GL2JNIActivity) {
|
||||
((GL2JNIActivity) mContext).mView
|
||||
.fastForward(false);
|
||||
.fastForward(false);
|
||||
}
|
||||
boosted = false;
|
||||
addimg(fastforward, R.drawable.star, this);
|
||||
|
@ -341,7 +341,7 @@ public class OnScreenMenu {
|
|||
}
|
||||
if (mContext instanceof GL2JNIActivity) {
|
||||
((GL2JNIActivity) mContext).mView
|
||||
.audioDisable(true);
|
||||
.audioDisable(true);
|
||||
}
|
||||
JNIdc.nosound(1);
|
||||
audiosetting.setEnabled(false);
|
||||
|
@ -379,7 +379,7 @@ public class OnScreenMenu {
|
|||
|
||||
/**
|
||||
* Toggle the frameskip button visibility by current value
|
||||
*
|
||||
*
|
||||
* @param fdown
|
||||
* The frameskip reduction button view
|
||||
* @param fup
|
||||
|
@ -417,7 +417,7 @@ public class OnScreenMenu {
|
|||
return vmuLcd;
|
||||
}
|
||||
|
||||
View addbut(int x, String l, OnClickListener ocl) {
|
||||
View addbut(int x, String l, OnClickListener ocl) {
|
||||
Button but = new Button(mContext);
|
||||
Drawable image = mContext.getResources().getDrawable(x);
|
||||
image.setBounds(0, 0, 72, 72);
|
||||
|
@ -425,8 +425,8 @@ public class OnScreenMenu {
|
|||
but.setOnClickListener(ocl);
|
||||
return but;
|
||||
}
|
||||
|
||||
Button addimg(Button but, int x, OnClickListener ocl) {
|
||||
|
||||
Button addimg(Button but, int x, OnClickListener ocl) {
|
||||
Drawable image = mContext.getResources().getDrawable(x);
|
||||
image.setBounds(0, 0, 72, 72);
|
||||
but.setCompoundDrawables(image, null, null, null);
|
||||
|
@ -461,7 +461,7 @@ public class OnScreenMenu {
|
|||
vmuLcd.configureScale(96);
|
||||
vlay.addView(vmuLcd, vparams);
|
||||
}
|
||||
|
||||
|
||||
public void hideVmu() {
|
||||
vlay.removeView(vmuLcd);
|
||||
}
|
||||
|
@ -469,10 +469,10 @@ public class OnScreenMenu {
|
|||
}
|
||||
|
||||
public class MainPopup extends PopupWindow {
|
||||
|
||||
|
||||
private LinearLayout vmuIcon;
|
||||
LinearLayout.LayoutParams params;
|
||||
|
||||
|
||||
private LinearLayout.LayoutParams setVmuParams() {
|
||||
int vpX = getPixelsFromDp(72, mContext);
|
||||
int vpY = getPixelsFromDp(52, mContext);
|
||||
|
@ -487,15 +487,15 @@ public class OnScreenMenu {
|
|||
public MainPopup(Context c) {
|
||||
super(c);
|
||||
setBackgroundDrawable(new BitmapDrawable());
|
||||
|
||||
|
||||
View shell = mContext.getLayoutInflater().inflate(R.layout.menu_popup_main, null);
|
||||
ScrollView hlay = (ScrollView) shell.findViewById(R.id.menuMain);
|
||||
|
||||
|
||||
vmuIcon = (LinearLayout) hlay.findViewById(R.id.vmuIcon);
|
||||
vmuLcd.configureScale(72);
|
||||
params = setVmuParams();
|
||||
vmuIcon.addView(vmuLcd, params);
|
||||
|
||||
|
||||
OnClickListener clickDisk = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.diskSwap(null);
|
||||
|
@ -513,7 +513,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonVmuSwap = (Button) hlay.findViewById(R.id.buttonVmuSwap);
|
||||
addimg(buttonVmuSwap, R.drawable.vmu_swap, clickVmuSwap);
|
||||
|
||||
|
||||
OnClickListener clickOptions = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
displayConfigPopup(MainPopup.this);
|
||||
|
@ -523,7 +523,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonOptions = (Button) hlay.findViewById(R.id.buttonOptions);
|
||||
addimg(buttonOptions, R.drawable.config, clickOptions);
|
||||
|
||||
|
||||
OnClickListener clickDebugging = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
displayDebugPopup(MainPopup.this);
|
||||
|
@ -533,7 +533,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonDebugging = (Button) hlay.findViewById(R.id.buttonDebugging);
|
||||
addimg(buttonDebugging, R.drawable.disk_unknown, clickDebugging);
|
||||
|
||||
|
||||
OnClickListener clickScreenshot = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
// screenshot
|
||||
|
@ -549,7 +549,7 @@ public class OnScreenMenu {
|
|||
};
|
||||
Button buttonScreenshot = (Button) hlay.findViewById(R.id.buttonScreenshot);
|
||||
addimg(buttonScreenshot, R.drawable.print_stats, clickScreenshot);
|
||||
|
||||
|
||||
OnClickListener clickExit = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
if (Config.externalIntent) {
|
||||
|
@ -567,11 +567,11 @@ public class OnScreenMenu {
|
|||
setContentView(shell);
|
||||
setFocusable(true);
|
||||
}
|
||||
|
||||
|
||||
public void hideVmu() {
|
||||
vmuIcon.removeView(vmuLcd);
|
||||
}
|
||||
|
||||
|
||||
public void showVmu() {
|
||||
vmuLcd.configureScale(72);
|
||||
params = setVmuParams();
|
||||
|
|
|
@ -71,7 +71,7 @@ public class Gamepad {
|
|||
// public boolean isNvidiaShield;
|
||||
|
||||
public static final int Xperia_Touchpad = 1048584;
|
||||
|
||||
|
||||
public static final int key_CONT_B = 0x0002;
|
||||
public static final int key_CONT_A = 0x0004;
|
||||
public static final int key_CONT_START = 0x0008;
|
||||
|
@ -131,12 +131,12 @@ public class Gamepad {
|
|||
|
||||
getStartButtonCode(), key_CONT_START,
|
||||
getSelectButtonCode(), getSelectButtonCode()
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public int[] setModifiedKeys(String id, int playerNum, SharedPreferences mPrefs) {
|
||||
return new int[] {
|
||||
mPrefs.getInt(pref_button_a + id, OuyaController.BUTTON_O), key_CONT_A,
|
||||
return new int[] {
|
||||
mPrefs.getInt(pref_button_a + id, OuyaController.BUTTON_O), key_CONT_A,
|
||||
mPrefs.getInt(pref_button_b + id, OuyaController.BUTTON_A), key_CONT_B,
|
||||
mPrefs.getInt(pref_button_x + id, OuyaController.BUTTON_U), key_CONT_X,
|
||||
mPrefs.getInt(pref_button_y + id, OuyaController.BUTTON_Y), key_CONT_Y,
|
||||
|
@ -161,7 +161,7 @@ public class Gamepad {
|
|||
return pMan.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
|
||||
|| OuyaFacade.getInstance().isRunningOnOUYAHardware();
|
||||
}
|
||||
|
||||
|
||||
public int getStartButtonCode() {
|
||||
return KeyEvent.KEYCODE_BUTTON_START;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class Gamepad {
|
|||
|| android.os.Build.DEVICE.equals("roth")
|
||||
|| android.os.Build.PRODUCT.equals("thor");
|
||||
}
|
||||
|
||||
|
||||
public void setCustomMapping(String id, int playerNum, SharedPreferences prefs) {
|
||||
map[playerNum] = setModifiedKeys(id, playerNum, prefs);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public class Gamepad {
|
|||
globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void runCompatibilityMode(int joy, SharedPreferences prefs) {
|
||||
for (int n = 0; n < 4; n++) {
|
||||
if (compat[n]) {
|
||||
|
@ -197,7 +197,7 @@ public class Gamepad {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void fullCompatibilityMode(SharedPreferences prefs) {
|
||||
for (int n = 0; n < 4; n++) {
|
||||
runCompatibilityMode(n, prefs);
|
||||
|
|
|
@ -25,13 +25,13 @@ import java.util.Arrays;
|
|||
|
||||
/*
|
||||
|
||||
*/
|
||||
*/
|
||||
public final class MOGAInput
|
||||
{
|
||||
private SharedPreferences prefs;
|
||||
|
||||
static final int DELAY = 1000 / 50; // 50 Hz
|
||||
|
||||
|
||||
public static final int ACTION_CONNECTED = Controller.ACTION_CONNECTED;
|
||||
static final int ACTION_DISCONNECTED = Controller.ACTION_DISCONNECTED;
|
||||
static final int ACTION_VERSION_MOGA = Controller.ACTION_VERSION_MOGA;
|
||||
|
@ -134,11 +134,11 @@ public final class MOGAInput
|
|||
public class ExampleControllerListener implements ControllerListener
|
||||
{
|
||||
int playerNum;
|
||||
|
||||
|
||||
public void setPlayerNum(int playerNum) {
|
||||
this.playerNum = playerNum;
|
||||
}
|
||||
|
||||
|
||||
public void onKeyEvent(KeyEvent event)
|
||||
{
|
||||
boolean keydown = false;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/**
|
||||
* Mupen64PlusAE, an N64 emulator for the Android platform
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2013 Paul Lamb
|
||||
*
|
||||
*
|
||||
* This file is part of Mupen64PlusAE.
|
||||
*
|
||||
*
|
||||
* Mupen64PlusAE is free software: you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Mupen64PlusAE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with Mupen64PlusAE. If
|
||||
* not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Authors: Paul Lamb
|
||||
*/
|
||||
package com.reicast.emulator.periph;
|
||||
|
@ -37,11 +37,11 @@ import java.util.List;
|
|||
* Temporary hack for crash in MOGA library on Lollipop. This hack can be removed once MOGA fixes
|
||||
* their library. The actual issue is caused by the use of implicit service intents, which are
|
||||
* illegal in Lollipop, as seen in the logcat message below.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* {@code Service Intent must be explicit: Intent { act=com.bda.controller.IControllerService } }
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @see <a href="http://www.mogaanywhere.com/developers/">MOGA developer site</a>
|
||||
* @see <a href="http://commonsware.com/blog/2014/06/29/dealing-deprecations-bindservice.html">
|
||||
* Discussion on explicit intents</a>
|
||||
|
@ -50,7 +50,7 @@ public class MogaHack
|
|||
{
|
||||
public static void init( Controller controller, Context context )
|
||||
{
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
||||
{
|
||||
boolean mIsBound = false;
|
||||
java.lang.reflect.Field fIsBound = null;
|
||||
|
@ -64,7 +64,7 @@ public class MogaHack
|
|||
mIsBound = fIsBound.getBoolean( controller );
|
||||
fServiceConnection = cMogaController.getDeclaredField( "mServiceConnection" );
|
||||
fServiceConnection.setAccessible( true );
|
||||
mServiceConnection = ( android.content.ServiceConnection ) fServiceConnection.get( controller );
|
||||
mServiceConnection = ( android.content.ServiceConnection ) fServiceConnection.get( controller );
|
||||
}
|
||||
catch( NoSuchFieldException e )
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ public class MogaHack
|
|||
String packageName = serviceInfo.packageName;
|
||||
String className = serviceInfo.name;
|
||||
intent.setComponent( new ComponentName( packageName, className ) );
|
||||
|
||||
|
||||
// Start the service explicitly
|
||||
context.startService( intent );
|
||||
context.bindService( intent, mServiceConnection, 1 );
|
||||
|
|
|
@ -8,19 +8,19 @@ import android.util.Log;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class SipEmulator extends Thread {
|
||||
|
||||
|
||||
static final String TAG = "SipEmulator";
|
||||
|
||||
|
||||
//one second of audio data in bytes
|
||||
static final int BUFFER_SIZE = 22050;
|
||||
//this needs to get set to the amount the mic normally sends per data request
|
||||
//...cant be bigger than a maple packet
|
||||
// 240 16 (or 14) bit samples
|
||||
static final int ONE_BLIP_SIZE = 480; //ALSO DEFINED IN maple_devs.h
|
||||
|
||||
|
||||
private AudioRecord record;
|
||||
private ConcurrentLinkedQueue<byte[]> bytesReadBuffer;
|
||||
|
||||
|
||||
private boolean continueRecording;
|
||||
private boolean firstGet;
|
||||
|
||||
|
@ -29,31 +29,31 @@ public class SipEmulator extends Thread {
|
|||
== 176.4 kbit/s
|
||||
== 22050 bytes/s
|
||||
*/
|
||||
|
||||
|
||||
public SipEmulator(){
|
||||
|
||||
|
||||
Log.d(TAG, "SipEmulator constructor called");
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void init(){
|
||||
Log.d(TAG, "SipEmulator init called");
|
||||
|
||||
record = new AudioRecord(
|
||||
MediaRecorder.AudioSource.VOICE_RECOGNITION,
|
||||
11025,
|
||||
AudioFormat.CHANNEL_IN_MONO,
|
||||
AudioFormat.ENCODING_PCM_16BIT,
|
||||
MediaRecorder.AudioSource.VOICE_RECOGNITION,
|
||||
11025,
|
||||
AudioFormat.CHANNEL_IN_MONO,
|
||||
AudioFormat.ENCODING_PCM_16BIT,
|
||||
BUFFER_SIZE);
|
||||
|
||||
|
||||
bytesReadBuffer = new ConcurrentLinkedQueue<byte[]>();
|
||||
|
||||
|
||||
continueRecording = false;
|
||||
firstGet = true;
|
||||
}
|
||||
|
||||
|
||||
public void startRecording(){
|
||||
Log.d(TAG, "SipEmulator startRecording called");
|
||||
if(continueRecording){
|
||||
|
@ -63,13 +63,13 @@ public class SipEmulator extends Thread {
|
|||
continueRecording = true;
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
||||
public void stopRecording(){
|
||||
Log.d(TAG, "SipEmulator stopRecording called");
|
||||
continueRecording = false;
|
||||
record.stop();
|
||||
}
|
||||
|
||||
|
||||
public byte[] getData(){
|
||||
//Log.d(TAG, "SipEmulator getData called");
|
||||
//Log.d(TAG, "SipEmulator getData bytesReadBuffer size: "+bytesReadBuffer.size());
|
||||
|
@ -79,26 +79,26 @@ public class SipEmulator extends Thread {
|
|||
}
|
||||
return bytesReadBuffer.poll();
|
||||
}
|
||||
|
||||
|
||||
private byte[] catchUp(){
|
||||
Log.d(TAG, "SipEmulator catchUp");
|
||||
byte[] last = bytesReadBuffer.poll();
|
||||
bytesReadBuffer.clear();
|
||||
return last;
|
||||
}
|
||||
|
||||
|
||||
public void configSomething(int what, int setting){
|
||||
Log.d(TAG, "SipEmulator configSomething called");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void run() {
|
||||
Log.d(TAG, "recordThread starting");
|
||||
|
||||
|
||||
while(continueRecording){
|
||||
byte[] freshData = new byte[ONE_BLIP_SIZE];
|
||||
// read blocks
|
||||
record.read(freshData, 0, ONE_BLIP_SIZE);
|
||||
record.read(freshData, 0, ONE_BLIP_SIZE);
|
||||
if(!firstGet){
|
||||
bytesReadBuffer.add(freshData);
|
||||
}
|
||||
|
|
|
@ -22,87 +22,87 @@ public class VJoy {
|
|||
public static int VJoyCount = 13;
|
||||
|
||||
public static float[][] baseVJoy() {
|
||||
return new float[][] {
|
||||
new float[] { 24+0, 24+64, 64,64, VJoy.key_CONT_DPAD_LEFT, 0},
|
||||
new float[] { 24+64, 24+0, 64,64, VJoy.key_CONT_DPAD_UP, 0},
|
||||
new float[] { 24+128, 24+64, 64,64, VJoy.key_CONT_DPAD_RIGHT, 0},
|
||||
new float[] { 24+64, 24+128, 64,64, VJoy.key_CONT_DPAD_DOWN, 0},
|
||||
return new float[][] {
|
||||
new float[] { 24+0, 24+64, 64,64, VJoy.key_CONT_DPAD_LEFT, 0},
|
||||
new float[] { 24+64, 24+0, 64,64, VJoy.key_CONT_DPAD_UP, 0},
|
||||
new float[] { 24+128, 24+64, 64,64, VJoy.key_CONT_DPAD_RIGHT, 0},
|
||||
new float[] { 24+64, 24+128, 64,64, VJoy.key_CONT_DPAD_DOWN, 0},
|
||||
|
||||
new float[] { 440+0, 280+64, 64,64, VJoy.key_CONT_X, 0},
|
||||
new float[] { 440+64, 280+0, 64,64, VJoy.key_CONT_Y, 0},
|
||||
new float[] { 440+128, 280+64, 64,64, VJoy.key_CONT_B, 0},
|
||||
new float[] { 440+64, 280+128, 64,64, VJoy.key_CONT_A, 0},
|
||||
new float[] { 440+0, 280+64, 64,64, VJoy.key_CONT_X, 0},
|
||||
new float[] { 440+64, 280+0, 64,64, VJoy.key_CONT_Y, 0},
|
||||
new float[] { 440+128, 280+64, 64,64, VJoy.key_CONT_B, 0},
|
||||
new float[] { 440+64, 280+128, 64,64, VJoy.key_CONT_A, 0},
|
||||
|
||||
new float[] { 320-32, 360+32, 64,64, VJoy.key_CONT_START, 0},
|
||||
new float[] { 320-32, 360+32, 64,64, VJoy.key_CONT_START, 0},
|
||||
|
||||
new float[] { 440, 200, 90,64, -1, 0},
|
||||
new float[] { 542, 200, 90,64, -2, 0},
|
||||
new float[] { 440, 200, 90,64, -1, 0},
|
||||
new float[] { 542, 200, 90,64, -2, 0},
|
||||
|
||||
new float[] { 0, 128+224, 128,128, -3, 0},
|
||||
new float[] { 96, 320, 32,32, -4, 0},
|
||||
new float[] { 0, 128+224, 128,128, -3, 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},
|
||||
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},
|
||||
};
|
||||
}
|
||||
|
||||
public static float[][] readCustomVjoyValues(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return new float[][] {
|
||||
// x-shift, y-shift, sizing-factor
|
||||
new float[] { prefs.getFloat("touch_x_shift_dpad", 0),
|
||||
prefs.getFloat("touch_y_shift_dpad", 0),
|
||||
prefs.getFloat("touch_scale_dpad", 1)
|
||||
}, // DPAD
|
||||
new float[] { prefs.getFloat("touch_x_shift_buttons", 0),
|
||||
prefs.getFloat("touch_y_shift_buttons", 0),
|
||||
prefs.getFloat("touch_scale_buttons", 1)
|
||||
}, // X, Y, B, A Buttons
|
||||
new float[] { prefs.getFloat("touch_x_shift_start", 0),
|
||||
prefs.getFloat("touch_y_shift_start", 0),
|
||||
prefs.getFloat("touch_scale_start", 1)
|
||||
}, // Start
|
||||
new float[] { prefs.getFloat("touch_x_shift_left_trigger", 0),
|
||||
prefs.getFloat("touch_y_shift_left_trigger", 0),
|
||||
prefs.getFloat("touch_scale_left_trigger", 1)
|
||||
}, // Left Trigger
|
||||
new float[] { prefs.getFloat("touch_x_shift_right_trigger", 0),
|
||||
prefs.getFloat("touch_y_shift_right_trigger", 0),
|
||||
prefs.getFloat("touch_scale_right_trigger", 1)
|
||||
}, // Right Trigger
|
||||
new float[] { prefs.getFloat("touch_x_shift_analog", 0),
|
||||
prefs.getFloat("touch_y_shift_analog", 0),
|
||||
prefs.getFloat("touch_scale_analog", 1)
|
||||
} // Analog Stick
|
||||
// x-shift, y-shift, sizing-factor
|
||||
new float[] { prefs.getFloat("touch_x_shift_dpad", 0),
|
||||
prefs.getFloat("touch_y_shift_dpad", 0),
|
||||
prefs.getFloat("touch_scale_dpad", 1)
|
||||
}, // DPAD
|
||||
new float[] { prefs.getFloat("touch_x_shift_buttons", 0),
|
||||
prefs.getFloat("touch_y_shift_buttons", 0),
|
||||
prefs.getFloat("touch_scale_buttons", 1)
|
||||
}, // X, Y, B, A Buttons
|
||||
new float[] { prefs.getFloat("touch_x_shift_start", 0),
|
||||
prefs.getFloat("touch_y_shift_start", 0),
|
||||
prefs.getFloat("touch_scale_start", 1)
|
||||
}, // Start
|
||||
new float[] { prefs.getFloat("touch_x_shift_left_trigger", 0),
|
||||
prefs.getFloat("touch_y_shift_left_trigger", 0),
|
||||
prefs.getFloat("touch_scale_left_trigger", 1)
|
||||
}, // Left Trigger
|
||||
new float[] { prefs.getFloat("touch_x_shift_right_trigger", 0),
|
||||
prefs.getFloat("touch_y_shift_right_trigger", 0),
|
||||
prefs.getFloat("touch_scale_right_trigger", 1)
|
||||
}, // Right Trigger
|
||||
new float[] { prefs.getFloat("touch_x_shift_analog", 0),
|
||||
prefs.getFloat("touch_y_shift_analog", 0),
|
||||
prefs.getFloat("touch_scale_analog", 1)
|
||||
} // Analog Stick
|
||||
};
|
||||
}
|
||||
|
||||
public static float[][] getVjoy_d(float[][] vjoy_d_custom) {
|
||||
return new float[][] {
|
||||
new float[] { 20+0*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+64*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},
|
||||
new float[] { 20+64*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_UP},
|
||||
new float[] { 20+128*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+64*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},
|
||||
new float[] { 20+64*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_DOWN},
|
||||
return new float[][] {
|
||||
new float[] { 20+0*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+64*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},
|
||||
new float[] { 20+64*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_UP},
|
||||
new float[] { 20+128*vjoy_d_custom[0][2]+vjoy_d_custom[0][0], 288+64*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},
|
||||
new float[] { 20+64*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_DOWN},
|
||||
|
||||
new float[] { 448+0*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_X},
|
||||
new float[] { 448+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+0*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_Y},
|
||||
new float[] { 448+128*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_B},
|
||||
new float[] { 448+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+128*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_A},
|
||||
new float[] { 448+0*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_X},
|
||||
new float[] { 448+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+0*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_Y},
|
||||
new float[] { 448+128*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_B},
|
||||
new float[] { 448+64*vjoy_d_custom[1][2]+vjoy_d_custom[1][0], 288+128*vjoy_d_custom[1][2]+vjoy_d_custom[1][1], 64*vjoy_d_custom[1][2],64*vjoy_d_custom[1][2], key_CONT_A},
|
||||
|
||||
new float[] { 320-32+vjoy_d_custom[2][0], 288+128+vjoy_d_custom[2][1], 64*vjoy_d_custom[2][2],64*vjoy_d_custom[2][2], key_CONT_START},
|
||||
new float[] { 320-32+vjoy_d_custom[2][0], 288+128+vjoy_d_custom[2][1], 64*vjoy_d_custom[2][2],64*vjoy_d_custom[2][2], key_CONT_START},
|
||||
|
||||
new float[] { 440+vjoy_d_custom[3][0], 200+vjoy_d_custom[3][1], 90*vjoy_d_custom[3][2],64*vjoy_d_custom[3][2], -1},
|
||||
new float[] { 542+vjoy_d_custom[4][0], 200+vjoy_d_custom[4][1], 90*vjoy_d_custom[4][2],64*vjoy_d_custom[4][2], -2},
|
||||
new float[] { 440+vjoy_d_custom[3][0], 200+vjoy_d_custom[3][1], 90*vjoy_d_custom[3][2],64*vjoy_d_custom[3][2], -1},
|
||||
new float[] { 542+vjoy_d_custom[4][0], 200+vjoy_d_custom[4][1], 90*vjoy_d_custom[4][2],64*vjoy_d_custom[4][2], -2},
|
||||
|
||||
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[] { 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[] { 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},
|
||||
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},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class VJoy {
|
|||
prefs.edit().putFloat("touch_y_shift_analog", vjoy_d_custom[5][1]).apply();
|
||||
prefs.edit().putFloat("touch_scale_analog", vjoy_d_custom[5][2]).apply();
|
||||
}
|
||||
|
||||
|
||||
public static void resetCustomVjoyValues(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
|
|
|
@ -11,26 +11,26 @@ import android.view.View;
|
|||
import com.reicast.emulator.emu.OnScreenMenu;
|
||||
|
||||
public class VmuLcd extends View {
|
||||
|
||||
|
||||
public final static int w = 48;
|
||||
public final static int h = 32;
|
||||
|
||||
|
||||
private int[] image = new int[w*h];
|
||||
private Bitmap current = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
|
||||
private float scale;
|
||||
private Paint paint;
|
||||
|
||||
|
||||
public VmuLcd(Context context) {
|
||||
super(context);
|
||||
paint = new Paint();
|
||||
scale = (float)OnScreenMenu.getPixelsFromDp(60, getContext()) / w;
|
||||
Log.d("VmuLcd", "scale: "+scale);
|
||||
}
|
||||
|
||||
|
||||
public void configureScale(int dp) {
|
||||
scale = (float)OnScreenMenu.getPixelsFromDp(dp, getContext()) / w;
|
||||
}
|
||||
|
||||
|
||||
public void updateBytes(byte[] data){
|
||||
for(int i=0; i<h; i++){
|
||||
for(int j=0; j<w; j++){
|
||||
|
|
Loading…
Reference in New Issue