Merge pull request #269 from NoblesseOblige/master
@hooby3dfx has issues, but @LoungeKatt has pull requests. I win!
This commit is contained in:
commit
b8335773d3
|
@ -561,8 +561,8 @@ error:
|
|||
fd = ashmem_create_region(0,RAM_SIZE + VRAM_SIZE +ARAM_SIZE);
|
||||
if (false)//this causes writebacks to flash -> slow and stuttery
|
||||
{
|
||||
fd = open("/data/data/com.example.droidcast/dcnzorz_mem",O_CREAT|O_RDWR|O_TRUNC,S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
unlink("/data/data/com.example.droidcast/dcnzorz_mem");
|
||||
fd = open("/data/data/com.reicast.emulator/files/dcnzorz_mem",O_CREAT|O_RDWR|O_TRUNC,S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
unlink("/data/data/com.reicast.emulator/files/dcnzorz_mem");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -155,12 +155,43 @@ void VArray2::LockRegion(u32 offset,u32 size)
|
|||
}
|
||||
}
|
||||
|
||||
void print_mem_addr()
|
||||
{
|
||||
FILE *ifp, *ofp;
|
||||
char *mode = "r";
|
||||
char outputFilename[] = "/data/data/com.reicast.emulator/files/mem_alloc.txt";
|
||||
|
||||
ifp = fopen("/proc/self/maps", mode);
|
||||
|
||||
if (ifp == NULL) {
|
||||
fprintf(stderr, "Can't open input file /proc/self/maps!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ofp = fopen(outputFilename, "w");
|
||||
|
||||
if (ofp == NULL) {
|
||||
fprintf(stderr, "Can't open output file %s!\n",
|
||||
outputFilename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char line [ 512 ];
|
||||
while (fgets(line, sizeof line, ifp) != NULL) {
|
||||
fprintf(ofp, "%s", line);
|
||||
}
|
||||
|
||||
fclose(ifp);
|
||||
fclose(ofp);
|
||||
}
|
||||
|
||||
void VArray2::UnLockRegion(u32 offset,u32 size)
|
||||
{
|
||||
u32 inpage=offset & PAGE_MASK;
|
||||
u32 rv=mprotect (data+offset-inpage, size+inpage, PROT_READ | PROT_WRITE);
|
||||
if (rv!=0)
|
||||
{
|
||||
print_mem_addr();
|
||||
printf("mprotect(%08X,%08X,RW) failed: %d | %d\n",data+offset-inpage,size+inpage,rv,errno);
|
||||
die("mprotect failed ..\n");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<dimen name="padding_medium">8dp</dimen>
|
||||
<dimen name="padding_large">16dp</dimen>
|
||||
|
||||
<dimen name="slidingmenu_offset">160dp</dimen>
|
||||
<dimen name="slidingmenu_offset">80dp</dimen>
|
||||
<dimen name="list_padding">10dp</dimen>
|
||||
<dimen name="shadow_width">15dp</dimen>
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
home_directory = mPrefs.getString("home_directory", home_directory);
|
||||
JNIdc.config(home_directory);
|
||||
|
||||
getFilesDir().mkdir();
|
||||
|
||||
mUEHandler = new Thread.UncaughtExceptionHandler() {
|
||||
public void uncaughtException(Thread t, Throwable error) {
|
||||
if (error != null) {
|
||||
|
@ -416,20 +418,19 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
Fragment fragment = (FileBrowser) getSupportFragmentManager()
|
||||
.findFragmentByTag("MAIN_BROWSER");
|
||||
if (fragment != null && fragment.isVisible()) {
|
||||
MainActivity.this.finish();
|
||||
boolean readyToQuit = true;
|
||||
if (fragment.getArguments() != null) {
|
||||
readyToQuit = fragment.getArguments().getBoolean(
|
||||
"ImgBrowse", true);
|
||||
}
|
||||
if (readyToQuit) {
|
||||
MainActivity.this.finish();
|
||||
} else {
|
||||
launchMainFragment(fragment);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
fragment = new FileBrowser();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("ImgBrowse", true);
|
||||
args.putString("browse_entry", null);
|
||||
args.putBoolean("games_entry", false);
|
||||
fragment.setArguments(args);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_container, fragment,
|
||||
"MAIN_BROWSER").commit();
|
||||
setTitle(getString(R.string.browser));
|
||||
launchMainFragment(fragment);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -437,6 +438,20 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private void launchMainFragment(Fragment fragment) {
|
||||
fragment = new FileBrowser();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("ImgBrowse", true);
|
||||
args.putString("browse_entry", null);
|
||||
args.putBoolean("games_entry", false);
|
||||
fragment.setArguments(args);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_container, fragment,
|
||||
"MAIN_BROWSER").commit();
|
||||
setTitle(getString(R.string.browser));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.reicast.emulator.debug;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -14,7 +15,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
|
||||
public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
||||
|
||||
|
||||
public static final String build_model = android.os.Build.MODEL;
|
||||
public static final String build_device = android.os.Build.DEVICE;
|
||||
public static final String build_board = android.os.Build.BOARD;
|
||||
|
@ -29,7 +30,7 @@ public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
|||
public static final String JB = "JellyBean";
|
||||
public static final String KK = "KitKat";
|
||||
public static final String NF = "Not Found";
|
||||
|
||||
|
||||
private String unHandledIOE;
|
||||
|
||||
private Context mContext;
|
||||
|
@ -37,14 +38,14 @@ public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
|||
|
||||
public GenerateLogs(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
this.currentTime = String.valueOf(System.currentTimeMillis());
|
||||
this.currentTime = String.valueOf(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
protected void onPreExecute() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String discoverCPUData() {
|
||||
String s = "MODEL: " + Build.MODEL;
|
||||
s += "\r\n";
|
||||
|
@ -102,7 +103,7 @@ public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
|||
return "ERROR: " + ex.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setUnhandled(String unHandledIOE) {
|
||||
this.unHandledIOE = unHandledIOE;
|
||||
}
|
||||
|
@ -190,21 +191,24 @@ public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
|||
reader.close();
|
||||
mLogcatProc = null;
|
||||
reader = null;
|
||||
// mLogcatProc = Runtime.getRuntime().exec(
|
||||
// new String[] { "logcat", "-d", "newdc:V *:S" });
|
||||
// reader = new BufferedReader(new InputStreamReader(
|
||||
// mLogcatProc.getInputStream()));
|
||||
// log.append(separator);
|
||||
// log.append(separator);
|
||||
// log.append("Native Library Output");
|
||||
// log.append(separator);
|
||||
// log.append(separator);
|
||||
// while ((line = reader.readLine()) != null) {
|
||||
// log.append(line);
|
||||
// log.append(separator);
|
||||
// }
|
||||
// reader.close();
|
||||
// reader = null;
|
||||
File memory = new File(mContext.getFilesDir(), "mem_alloc.txt");
|
||||
if (memory.exists()) {
|
||||
log.append(separator);
|
||||
log.append(separator);
|
||||
log.append("Memory Allocation Table");
|
||||
log.append(separator);
|
||||
log.append(separator);
|
||||
FileInputStream fis = new FileInputStream(memory);
|
||||
reader = new BufferedReader(new InputStreamReader(fis));
|
||||
while ((line = reader.readLine()) != null) {
|
||||
log.append(line);
|
||||
log.append(separator);
|
||||
}
|
||||
fis.close();
|
||||
fis = null;
|
||||
reader.close();
|
||||
reader = null;
|
||||
}
|
||||
File file = new File(logOuput);
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||
writer.write(log.toString());
|
||||
|
@ -221,12 +225,12 @@ public class GenerateLogs extends AsyncTask<String, Integer, String> {
|
|||
protected void onPostExecute(String response) {
|
||||
if (response != null && !response.equals(null)) {
|
||||
UploadLogs mUploadLogs = new UploadLogs(mContext, currentTime);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mUploadLogs.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
response);
|
||||
} else {
|
||||
mUploadLogs.execute(response);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mUploadLogs.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
response);
|
||||
} else {
|
||||
mUploadLogs.execute(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.reicast.emulator.emu;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import tv.ouya.console.api.OuyaController;
|
||||
import android.annotation.TargetApi;
|
||||
|
@ -563,7 +564,7 @@ public class GL2JNIActivity extends Activity {
|
|||
if (!popUp.isShowing()) {
|
||||
displayPopUp(popUp);
|
||||
} else {
|
||||
popUp.dismiss();
|
||||
menu.dismissPopUps();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.reicast.emulator.emu;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
@ -29,6 +30,8 @@ public class OnScreenMenu {
|
|||
private boolean limitframes;
|
||||
private boolean audiodisabled;
|
||||
|
||||
private Vector<PopupWindow> popups;
|
||||
|
||||
private File sdcard = Environment.getExternalStorageDirectory();
|
||||
private String home_directory = sdcard + "/dc";
|
||||
|
||||
|
@ -36,6 +39,7 @@ public class OnScreenMenu {
|
|||
if (mContext instanceof GL2JNIActivity) {
|
||||
this.mContext = (GL2JNIActivity) mContext;
|
||||
}
|
||||
popups = new Vector<PopupWindow>();
|
||||
if (prefs != null) {
|
||||
this.prefs = prefs;
|
||||
home_directory = prefs.getString("home_directory", home_directory);
|
||||
|
@ -56,6 +60,7 @@ public class OnScreenMenu {
|
|||
|
||||
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popups.remove(popUp);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
@ -70,6 +75,7 @@ public class OnScreenMenu {
|
|||
hlay.addView(addbut(R.drawable.config, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
displayConfigPopup(popUp);
|
||||
popups.remove(popUp);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
@ -77,6 +83,7 @@ public class OnScreenMenu {
|
|||
hlay.addView(addbut(R.drawable.disk_unknown, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
displayDebugPopup(popUp);
|
||||
popups.remove(popUp);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
@ -91,6 +98,7 @@ public class OnScreenMenu {
|
|||
|
||||
// layout.addView(hlay,params);
|
||||
popUp.setContentView(hlay);
|
||||
popups.add(popUp);
|
||||
return popUp;
|
||||
}
|
||||
|
||||
|
@ -106,6 +114,7 @@ public class OnScreenMenu {
|
|||
|
||||
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popups.remove(popUpDebug);
|
||||
popUpDebug.dismiss();
|
||||
mContext.displayPopUp(popUp);
|
||||
}
|
||||
|
@ -141,11 +150,13 @@ public class OnScreenMenu {
|
|||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popups.remove(popUpDebug);
|
||||
popUpDebug.dismiss();
|
||||
}
|
||||
}), debugParams);
|
||||
|
||||
popUpDebug.setContentView(hlay);
|
||||
popups.add(popUpDebug);
|
||||
mContext.displayDebug(popUpDebug);
|
||||
}
|
||||
|
||||
|
@ -161,6 +172,7 @@ public class OnScreenMenu {
|
|||
|
||||
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popups.remove(popUpConfig);
|
||||
popUpConfig.dismiss();
|
||||
mContext.displayPopUp(popUp);
|
||||
}
|
||||
|
@ -261,11 +273,13 @@ public class OnScreenMenu {
|
|||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popups.remove(popUpConfig);
|
||||
popUpConfig.dismiss();
|
||||
}
|
||||
}), configParams);
|
||||
|
||||
popUpConfig.setContentView(hlay);
|
||||
popups.add(popUpConfig);
|
||||
mContext.displayConfig(popUpConfig);
|
||||
}
|
||||
|
||||
|
@ -281,6 +295,15 @@ public class OnScreenMenu {
|
|||
frames_up.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void dismissPopUps() {
|
||||
for (PopupWindow popup : popups) {
|
||||
if (popup.isShowing()) {
|
||||
popup.dismiss();
|
||||
popups.remove(popup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getPixelsFromDp(float dps, Context context) {
|
||||
return (int) (dps * context.getResources().getDisplayMetrics().density + 0.5f);
|
||||
|
|
Loading…
Reference in New Issue