This commit is contained in:
shagr4th 2016-12-18 18:30:48 +01:00
parent b5b5132722
commit 6be844392b
3 changed files with 21 additions and 15 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.ab.x48" android:installLocation="auto" android:versionCode="66" android:versionName="1.66">
package="org.ab.x48" android:installLocation="auto" android:versionCode="67" android:versionName="1.67">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".X48"
android:label="@string/app_name"

View file

@ -90,9 +90,7 @@ public class X48 extends Activity {
checkPrefs();
SIGALRM = new Timer();
thread = new EmulatorThread(this);
thread = new EmulatorThread(this);
thread.start();
mainView.resume();
}
@ -185,6 +183,11 @@ public class X48 extends Activity {
protected void onResume() {
super.onResume();
Log.i("x48", "resume");
if (SIGALRM != null) {
SIGALRM.cancel();
SIGALRM = null;
}
SIGALRM = new Timer();
SIGALRM.schedule(new TimerTask() {
@Override
public void run() {
@ -458,7 +461,10 @@ private void managePort(int number, String value) {
protected void onPause() {
super.onPause();
Log.i("x48", "pause");
SIGALRM.cancel();
if (SIGALRM != null) {
SIGALRM.cancel();
SIGALRM = null;
}
if (mainView != null)
mainView.pause();
Log.i("x48", "paused");

View file

@ -2234,7 +2234,7 @@ schedule()
old_sched_instr = instructions;
#ifdef DEBUG_SCHED
fprintf(stderr, "schedule called after %ld instructions\n", steps);
LOGE("schedule called after %ld instructions\n", steps);
#endif
if ((sched_timer2 -= steps) <= 0) {
@ -2255,7 +2255,7 @@ schedule()
schedule_event = sched_timer2;
#ifdef DEBUG_SCHED
fprintf(stderr, "next timer 2 step: %ld, event: %ld\n",
LOGE("next timer 2 step: %ld, event: %ld\n",
sched_timer2, schedule_event);
#endif
@ -2265,7 +2265,7 @@ schedule()
if (device.display_touched) device.display_touched -= steps;
if (device.display_touched < 0) device.display_touched = 1;
#ifdef DEBUG_DISP_SCHED
fprintf(stderr, "check_device: disp_when %d, disp_touched %d\n",
LOGE("check_device: disp_when %d, disp_touched %d\n",
sched_display, device.display_touched);
#endif
}
@ -2287,7 +2287,7 @@ schedule()
if (sched_receive < schedule_event) schedule_event = sched_receive;
#ifdef DEBUG_SCHED
fprintf(stderr, "next receive: %ld, event: %ld\n",
LOGE("next receive: %ld, event: %ld\n",
sched_receive, schedule_event);
#endif
@ -2329,7 +2329,7 @@ schedule()
if (sched_adjtime < schedule_event) schedule_event = sched_adjtime;
#ifdef DEBUG_SCHED
fprintf(stderr, "next adjtime: %ld, event: %ld\n",
LOGE( "next adjtime: %ld, event: %ld\n",
sched_adjtime, schedule_event);
#endif
@ -2349,7 +2349,7 @@ schedule()
if (sched_timer1 < schedule_event) schedule_event = sched_timer1;
#ifdef DEBUG_SCHED
fprintf(stderr, "next timer 1 step: %ld, event: %ld\n",
LOGE( "next timer 1 step: %ld, event: %ld\n",
sched_timer1, schedule_event);
#endif
@ -2380,11 +2380,11 @@ schedule()
#ifdef DEBUG_TIMER
if (delta_t_1 > 0) {
#if 0
fprintf(stderr, "I/s = %ld, T1 I/TICK = %d (%ld), T2 I/TICK = %d (%ld)\n",
LOGE("I/s = %ld, T1 I/TICK = %d (%ld), T2 I/TICK = %d (%ld)\n",
saturn.i_per_s, saturn.t1_tick, t1_i_per_tick,
saturn.t2_tick, t2_i_per_tick);
#else
fprintf(stderr, "I/s = %ld, T1 I/TICK = %d, T2 I/TICK = %d (%ld)\n",
LOGE( "I/s = %ld, T1 I/TICK = %d, T2 I/TICK = %d (%ld)\n",
saturn.i_per_s, saturn.t1_tick, saturn.t2_tick, t2_i_per_tick);
#endif
}
@ -2394,7 +2394,7 @@ schedule()
schedule_event = sched_statistics;
#ifdef DEBUG_SCHED
fprintf(stderr, "next statistics: %ld, event: %ld\n",
LOGE( "next statistics: %ld, event: %ld\n",
sched_statistics, schedule_event);
#endif
@ -2410,7 +2410,7 @@ schedule()
schedule_event = sched_instr_rollover;
#ifdef DEBUG_SCHED
fprintf(stderr, "next instruction rollover: %ld, event: %ld\n",
LOGE("next instruction rollover: %ld, event: %ld\n",
sched_instr_rollover, schedule_event);
#endif