Fix tab/space mismatches in the Android project.

This commit is contained in:
Lioncash 2014-03-06 02:07:40 -05:00
parent 6c123ad04b
commit 6e3ab6d62c
6 changed files with 160 additions and 160 deletions

View File

@ -92,7 +92,7 @@ public class FileUtils {
}
public static void saveScreenshot(final Context c, int w, int h, GL10 gl){
try{
try {
File dir = new File(MainActivity.home_directory);
SimpleDateFormat s = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = s.format(new Date());
@ -108,34 +108,34 @@ public class FileUtils {
//c.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
}
});
}catch(Exception e){
} catch(Exception e) {
e.printStackTrace();
}
}
//thank you stackoverflow
public static Bitmap savePixels(int x, int y, int w, int h, GL10 gl)
{
int b[]=new int[w*(y+h)];
int bt[]=new int[w*h];
IntBuffer ib=IntBuffer.wrap(b);
ib.position(0);
gl.glReadPixels(x, 0, w, y+h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, ib);
{
int b[]=new int[w*(y+h)];
int bt[]=new int[w*h];
IntBuffer ib=IntBuffer.wrap(b);
ib.position(0);
gl.glReadPixels(x, 0, w, y+h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, ib);
for(int i=0, k=0; i<h; i++, k++)
{//remember, that OpenGL bitmap is incompatible with Android bitmap
//and so, some correction need.
for(int j=0; j<w; j++)
{
int pix=b[i*w+j];
int pb=(pix>>16)&0xff;
int pr=(pix<<16)&0x00ff0000;
int pix1=(pix&0xff00ff00) | pr | pb;
bt[(h-k-1)*w+j]=pix1;
}
}
for(int i=0, k=0; i<h; i++, k++)
{//remember, that OpenGL bitmap is incompatible with Android bitmap
//and so, some correction need.
for(int j=0; j<w; j++)
{
int pix=b[i*w+j];
int pb=(pix>>16)&0xff;
int pr=(pix<<16)&0x00ff0000;
int pix1=(pix&0xff00ff00) | pr | pb;
bt[(h-k-1)*w+j]=pix1;
}
}
Bitmap sb=Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888);
return sb;
Bitmap sb=Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888);
return sb;
}
}

View File

@ -285,8 +285,8 @@ public class FileBrowser extends Fragment {
.setImageResource(R.drawable.open_folder);
((TextView) headerView.findViewById(R.id.item_name))
.setText(header_text);
((TextView) headerView.findViewById(R.id.item_name))
.setTypeface(Typeface.DEFAULT_BOLD);
((TextView) headerView.findViewById(R.id.item_name))
.setTypeface(Typeface.DEFAULT_BOLD);
((ViewGroup) view).addView(headerView);
}

View File

@ -1,53 +1,53 @@
package com.reicast.emulator.emu;
public class JNIdc
public final class JNIdc
{
static { System.loadLibrary("dc"); }
public static native void config(String dirName);
public static native void init(String fileName);
public static native void run(Object track);
public static native void stop();
public static native int send(int cmd, int opt);
public static native int data(int cmd, byte[] data);
public static native void rendinit(int w, int y);
public static native void rendframe();
public static native void kcode(int[] kcode, int[] lt, int[] rt, int[] jx, int[] jy);
public static native void vjoy(int id,float x, float y, float w, float h);
//public static native int play(short result[],int size);
static { System.loadLibrary("dc"); }
public static native void initControllers(boolean[] controllers);
public static native void setupMic(Object sip);
public static native void vmuSwap();
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);
public static native void cable(int cable);
public static native void region(int region);
public static native void broadcast(int broadcast);
public static native void limitfps(int limiter);
public static native void nobatch(int nobatch);
public static native void nosound(int noaudio);
public static native void mipmaps(int mipmaps);
public static native void widescreen(int stretch);
public static native void subdivide(int subdivide);
public static native void frameskip(int frames);
public static native void pvrrender(int render);
public static native void cheatdisk(String disk);
public static native void dreamtime(long clock);
public static native void config(String dirName);
public static native void init(String fileName);
public static native void run(Object track);
public static native void stop();
public static void show_osd() {
JNIdc.vjoy(13, 1,0,0,0);
}
public static native int send(int cmd, int opt);
public static native int data(int cmd, byte[] data);
public static void hide_osd() {
JNIdc.vjoy(13, 0,0,0,0);
}
public static native void rendinit(int w, int y);
public static native void rendframe();
public static native void kcode(int[] kcode, int[] lt, int[] rt, int[] jx, int[] jy);
public static native void vjoy(int id,float x, float y, float w, float h);
//public static native int play(short result[],int size);
public static native void initControllers(boolean[] controllers);
public static native void setupMic(Object sip);
public static native void vmuSwap();
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);
public static native void cable(int cable);
public static native void region(int region);
public static native void broadcast(int broadcast);
public static native void limitfps(int limiter);
public static native void nobatch(int nobatch);
public static native void nosound(int noaudio);
public static native void mipmaps(int mipmaps);
public static native void widescreen(int stretch);
public static native void subdivide(int subdivide);
public static native void frameskip(int frames);
public static native void pvrrender(int render);
public static native void cheatdisk(String disk);
public static native void dreamtime(long clock);
public static void show_osd() {
JNIdc.vjoy(13, 1,0,0,0);
}
public static void hide_osd() {
JNIdc.vjoy(13, 0,0,0,0);
}
}

View File

@ -73,100 +73,100 @@ public class Gamepad {
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;
public static final int key_CONT_DPAD_UP = 0x0010;
public static final int key_CONT_DPAD_DOWN = 0x0020;
public static final int key_CONT_DPAD_LEFT = 0x0040;
public static final int key_CONT_B = 0x0002;
public static final int key_CONT_A = 0x0004;
public static final int key_CONT_START = 0x0008;
public static final int key_CONT_DPAD_UP = 0x0010;
public static final int key_CONT_DPAD_DOWN = 0x0020;
public static final int key_CONT_DPAD_LEFT = 0x0040;
public static final int key_CONT_DPAD_RIGHT = 0x0080;
public static final int key_CONT_Y = 0x0200;
public static final int key_CONT_X = 0x0400;
public static final int key_CONT_Y = 0x0200;
public static final int key_CONT_X = 0x0400;
public int[] getConsoleController() {
return new int[] {
OuyaController.BUTTON_O, key_CONT_A,
OuyaController.BUTTON_A, key_CONT_B,
OuyaController.BUTTON_U, key_CONT_X,
OuyaController.BUTTON_Y, key_CONT_Y,
OuyaController.BUTTON_O, key_CONT_A,
OuyaController.BUTTON_A, key_CONT_B,
OuyaController.BUTTON_U, key_CONT_X,
OuyaController.BUTTON_Y, key_CONT_Y,
OuyaController.BUTTON_DPAD_UP, key_CONT_DPAD_UP,
OuyaController.BUTTON_DPAD_DOWN, key_CONT_DPAD_DOWN,
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
OuyaController.BUTTON_DPAD_UP, key_CONT_DPAD_UP,
OuyaController.BUTTON_DPAD_DOWN, key_CONT_DPAD_DOWN,
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
getStartButtonCode(), key_CONT_START,
getSelectButtonCode(), getSelectButtonCode()
getStartButtonCode(), key_CONT_START,
getSelectButtonCode(), getSelectButtonCode()
// Redundant, but verifies it is mapped properly
};
}
public int[] getXPlayController() {
return new int[] {
KeyEvent.KEYCODE_DPAD_CENTER, key_CONT_A,
KeyEvent.KEYCODE_BACK, key_CONT_B,
OuyaController.BUTTON_U, key_CONT_X,
OuyaController.BUTTON_Y, key_CONT_Y,
KeyEvent.KEYCODE_DPAD_CENTER, key_CONT_A,
KeyEvent.KEYCODE_BACK, key_CONT_B,
OuyaController.BUTTON_U, key_CONT_X,
OuyaController.BUTTON_Y, key_CONT_Y,
OuyaController.BUTTON_DPAD_UP, key_CONT_DPAD_UP,
OuyaController.BUTTON_DPAD_DOWN, key_CONT_DPAD_DOWN,
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
OuyaController.BUTTON_DPAD_UP, key_CONT_DPAD_UP,
OuyaController.BUTTON_DPAD_DOWN, key_CONT_DPAD_DOWN,
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
getStartButtonCode(), key_CONT_START,
getSelectButtonCode(), getSelectButtonCode()
getStartButtonCode(), key_CONT_START,
getSelectButtonCode(), getSelectButtonCode()
// Redundant, but verifies it is mapped properly
};
}
public int[] getOUYAController() {
return new int[] {
OuyaController.BUTTON_O, key_CONT_A,
OuyaController.BUTTON_A, key_CONT_B,
OuyaController.BUTTON_U, key_CONT_X,
OuyaController.BUTTON_Y, key_CONT_Y,
OuyaController.BUTTON_O, key_CONT_A,
OuyaController.BUTTON_A, key_CONT_B,
OuyaController.BUTTON_U, key_CONT_X,
OuyaController.BUTTON_Y, key_CONT_Y,
OuyaController.BUTTON_DPAD_UP, key_CONT_DPAD_UP,
OuyaController.BUTTON_DPAD_DOWN, key_CONT_DPAD_DOWN,
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
OuyaController.BUTTON_DPAD_UP, key_CONT_DPAD_UP,
OuyaController.BUTTON_DPAD_DOWN, key_CONT_DPAD_DOWN,
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
getStartButtonCode(), key_CONT_START,
OuyaController.BUTTON_R3, key_CONT_START
getStartButtonCode(), key_CONT_START,
OuyaController.BUTTON_R3, key_CONT_START
};
}
public int[] getMogaController() {
return new int[] {
KeyEvent.KEYCODE_BUTTON_A, key_CONT_A,
KeyEvent.KEYCODE_BUTTON_B, key_CONT_B,
KeyEvent.KEYCODE_BUTTON_X, key_CONT_X,
KeyEvent.KEYCODE_BUTTON_Y, key_CONT_Y,
KeyEvent.KEYCODE_BUTTON_A, key_CONT_A,
KeyEvent.KEYCODE_BUTTON_B, key_CONT_B,
KeyEvent.KEYCODE_BUTTON_X, key_CONT_X,
KeyEvent.KEYCODE_BUTTON_Y, key_CONT_Y,
KeyEvent.KEYCODE_DPAD_UP, key_CONT_DPAD_UP,
KeyEvent.KEYCODE_DPAD_DOWN, key_CONT_DPAD_DOWN,
KeyEvent.KEYCODE_DPAD_LEFT, key_CONT_DPAD_LEFT,
KeyEvent.KEYCODE_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
KeyEvent.KEYCODE_DPAD_UP, key_CONT_DPAD_UP,
KeyEvent.KEYCODE_DPAD_DOWN, key_CONT_DPAD_DOWN,
KeyEvent.KEYCODE_DPAD_LEFT, key_CONT_DPAD_LEFT,
KeyEvent.KEYCODE_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
getStartButtonCode(), key_CONT_START,
getSelectButtonCode(), getSelectButtonCode()
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,
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,
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,
mPrefs.getInt(pref_dpad_up + id, OuyaController.BUTTON_DPAD_UP), key_CONT_DPAD_UP,
mPrefs.getInt(pref_dpad_down + id, OuyaController.BUTTON_DPAD_DOWN), key_CONT_DPAD_DOWN,
mPrefs.getInt(pref_dpad_left + id, OuyaController.BUTTON_DPAD_LEFT), key_CONT_DPAD_LEFT,
mPrefs.getInt(pref_dpad_right + id, OuyaController.BUTTON_DPAD_RIGHT), key_CONT_DPAD_RIGHT,
mPrefs.getInt(pref_dpad_up + id, OuyaController.BUTTON_DPAD_UP), key_CONT_DPAD_UP,
mPrefs.getInt(pref_dpad_down + id, OuyaController.BUTTON_DPAD_DOWN), key_CONT_DPAD_DOWN,
mPrefs.getInt(pref_dpad_left + id, OuyaController.BUTTON_DPAD_LEFT), key_CONT_DPAD_LEFT,
mPrefs.getInt(pref_dpad_right + id, OuyaController.BUTTON_DPAD_RIGHT), key_CONT_DPAD_RIGHT,
mPrefs.getInt(pref_button_start + id, getStartButtonCode()), key_CONT_START,
mPrefs.getInt(pref_button_select + id, getSelectButtonCode()), getSelectButtonCode()
mPrefs.getInt(pref_button_start + id, getStartButtonCode()), key_CONT_START,
mPrefs.getInt(pref_button_select + id, getSelectButtonCode()), getSelectButtonCode()
};
}

View File

@ -181,19 +181,19 @@ public class MOGAInput
}
if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) {
int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION);
if (mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) {
pad.isMogaPro[playerNum] = true;
pad.isActiveMoga[playerNum] = true;
Log.d("com.reicast.emulator", act.getApplicationContext().getString(R.string.moga_pro_connect));
} else if (mControllerVersion == Controller.ACTION_VERSION_MOGA) {
pad.isMogaPro[playerNum] = false;
pad.isActiveMoga[playerNum] = true;
Log.d("com.reicast.emulator", act.getApplicationContext().getString(R.string.moga_connect));
}
if (pad.isActiveMoga[playerNum]) {
notifyMogaConnected(notify, playerNum);
}
int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION);
if (mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) {
pad.isMogaPro[playerNum] = true;
pad.isActiveMoga[playerNum] = true;
Log.d("com.reicast.emulator", act.getApplicationContext().getString(R.string.moga_pro_connect));
} else if (mControllerVersion == Controller.ACTION_VERSION_MOGA) {
pad.isMogaPro[playerNum] = false;
pad.isActiveMoga[playerNum] = true;
Log.d("com.reicast.emulator", act.getApplicationContext().getString(R.string.moga_connect));
}
if (pad.isActiveMoga[playerNum]) {
notifyMogaConnected(notify, playerNum);
}
}
}
}

View File

@ -105,30 +105,30 @@ public class VJoy {
}
public static void resetCustomVjoyValues(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
prefs.edit().remove("touch_x_shift_dpad").commit();
prefs.edit().remove("touch_y_shift_dpad").commit();
prefs.edit().remove("touch_scale_dpad").commit();
prefs.edit().remove("touch_x_shift_dpad").commit();
prefs.edit().remove("touch_y_shift_dpad").commit();
prefs.edit().remove("touch_scale_dpad").commit();
prefs.edit().remove("touch_x_shift_buttons").commit();
prefs.edit().remove("touch_y_shift_buttons").commit();
prefs.edit().remove("touch_scale_buttons").commit();
prefs.edit().remove("touch_x_shift_buttons").commit();
prefs.edit().remove("touch_y_shift_buttons").commit();
prefs.edit().remove("touch_scale_buttons").commit();
prefs.edit().remove("touch_x_shift_start").commit();
prefs.edit().remove("touch_y_shift_start").commit();
prefs.edit().remove("touch_scale_start").commit();
prefs.edit().remove("touch_x_shift_start").commit();
prefs.edit().remove("touch_y_shift_start").commit();
prefs.edit().remove("touch_scale_start").commit();
prefs.edit().remove("touch_x_shift_left_trigger").commit();
prefs.edit().remove("touch_y_shift_left_trigger").commit();
prefs.edit().remove("touch_scale_left_trigger").commit();
prefs.edit().remove("touch_x_shift_left_trigger").commit();
prefs.edit().remove("touch_y_shift_left_trigger").commit();
prefs.edit().remove("touch_scale_left_trigger").commit();
prefs.edit().remove("touch_x_shift_right_trigger").commit();
prefs.edit().remove("touch_y_shift_right_trigger").commit();
prefs.edit().remove("touch_scale_right_trigger").commit();
prefs.edit().remove("touch_x_shift_right_trigger").commit();
prefs.edit().remove("touch_y_shift_right_trigger").commit();
prefs.edit().remove("touch_scale_right_trigger").commit();
prefs.edit().remove("touch_x_shift_analog").commit();
prefs.edit().remove("touch_y_shift_analog").commit();
prefs.edit().remove("touch_scale_analog").commit();
}
prefs.edit().remove("touch_x_shift_analog").commit();
prefs.edit().remove("touch_y_shift_analog").commit();
prefs.edit().remove("touch_scale_analog").commit();
}
}