Android: Create a Christmas theme via auto-indent

This commit is contained in:
Ender's Games 2018-08-05 09:31:38 -04:00
parent ff073d491f
commit 1c1ebc2bfb
23 changed files with 1757 additions and 1757 deletions

View File

@ -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,7 +207,7 @@ 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();
}
});

View File

@ -55,9 +55,9 @@ public class CloudFragment extends Fragment {
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) {
@ -69,14 +69,14 @@ 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());
}
@ -86,39 +86,39 @@ public class CloudFragment extends Fragment {
@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
@ -175,64 +175,64 @@ class DropBoxClient {
Context context;
final static private String APP_KEY = "7d7tw1t57sbzrj5";
final static private String APP_SECRET = "5xxqa2uctousyi2";
final static private String APP_KEY = "7d7tw1t57sbzrj5";
final static private String APP_SECRET = "5xxqa2uctousyi2";
public DropboxAPI<AndroidAuthSession> mDBApi;
AndroidAuthSession session;
public DropboxAPI<AndroidAuthSession> mDBApi;
AndroidAuthSession session;
public DropBoxClient(Context context){
this.context = context;
session = buildSession();
mDBApi = new DropboxAPI<AndroidAuthSession>(session);
}
public DropBoxClient(Context context){
this.context = context;
session = buildSession();
mDBApi = new DropboxAPI<AndroidAuthSession>(session);
}
public void startLogin(){
mDBApi.getSession().startOAuth2Authentication(context);
}
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();
}
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;
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);
}
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;
}
return session;
}
}
@ -247,94 +247,94 @@ class netOperation extends AsyncTask<String, Void, String> {
}
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) {}
@Override
protected void onProgressUpdate(Void... values) {}
void createBackupOfVmu(String vmuName){
File backupDir = new File(home_directory+"/VmuBackups/");
if(!backupDir.exists()) {
backupDir.mkdirs();
}
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 {
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();
}
}
}
}

View File

@ -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;
}
}
@ -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);

View File

@ -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;
}
@ -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,26 +231,26 @@ 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() {
@ -259,9 +259,9 @@ public class MainActivity extends AppCompatActivity implements
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
@ -362,7 +362,7 @@ public class MainActivity extends AppCompatActivity implements
}
private void launchMainFragment() {
onMainBrowseSelected(true, null, false, null);
onMainBrowseSelected(true, null, false, null);
}
@Override
@ -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) {

View File

@ -65,7 +65,7 @@ public class EditVJoyActivity extends Activity {
vjoy_d_cached = VJoy.readCustomVjoyValues(getApplicationContext());
JNIdc.show_osd();
JNIdc.show_osd();
}
@Override

View File

@ -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;
}
}

View File

@ -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);
}
@ -101,7 +101,7 @@ 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();
}
};
@ -110,7 +110,7 @@ public class InputModFragment extends Fragment {
OnCheckedChangeListener rstick_mode = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
boolean isChecked) {
mPrefs.edit().putBoolean(Gamepad.pref_js_rbuttons + player, isChecked).apply();
}
};
@ -119,7 +119,7 @@ public class InputModFragment extends Fragment {
OnCheckedChangeListener modified_layout = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
boolean isChecked) {
mPrefs.edit().putBoolean(Gamepad.pref_js_modified + player, isChecked).apply();
}
};
@ -128,7 +128,7 @@ public class InputModFragment extends Fragment {
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();
@ -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);
}

View File

@ -67,7 +67,7 @@ public class OptionsFragment extends Fragment {
// 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
@ -100,7 +100,7 @@ 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);
}
@ -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);
}
});
@ -167,7 +167,7 @@ public class OptionsFragment extends Fragment {
OnCheckedChangeListener reios_options = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
boolean isChecked) {
mPrefs.edit().putBoolean(Emulator.pref_usereios, isChecked).apply();
}
};
@ -179,7 +179,7 @@ public class OptionsFragment extends Fragment {
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,8 +243,8 @@ 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();
}
};

View File

@ -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) {

View File

@ -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);
}
}
}

View File

@ -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);
}
}
@ -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);

View File

@ -131,7 +131,7 @@ public class Gamepad {
getStartButtonCode(), key_CONT_START,
getSelectButtonCode(), getSelectButtonCode()
};
};
}
public int[] setModifiedKeys(String id, int playerNum, SharedPreferences mPrefs) {

View File

@ -25,7 +25,7 @@ import java.util.Arrays;
/*
*/
*/
public final class MOGAInput
{
private SharedPreferences prefs;

View File

@ -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;

View File

@ -23,86 +23,86 @@ public class VJoy {
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},
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},
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},
};
}