mirror of
https://github.com/dgis/emu48android
synced 2025-01-17 18:11:37 +01:00
- Fix a bug about the timer delay in timeSetEvent(). I hope it fix the slow down.
- Fix deprecated classes in the settings. - Add a haptic feedback when touching a button.
This commit is contained in:
parent
0c5834011d
commit
e4727e0192
11 changed files with 105 additions and 52 deletions
|
@ -40,6 +40,10 @@ CHANGES
|
|||
Version 1.3alpha (2019-03-xx)
|
||||
|
||||
- Fix the red and blue color inversion.
|
||||
- Add the HP 50g (Calypso 2K/4K) KML script from Carl Reinke (4K is a slow because there is no hardware acceleration).
|
||||
- Fix a bug about the timer delay in timeSetEvent(). I hope it fix the slow down.
|
||||
- Fix deprecated classes in the settings.
|
||||
- Add a haptic feedback when touching a button.
|
||||
|
||||
|
||||
Version 1.2 (2019-03-14)
|
||||
|
@ -93,7 +97,6 @@ TODO
|
|||
- Add a separation between the pixels (Suggestion from Jaime Meza)
|
||||
- Sometimes the "busy" annunciator gets stuck
|
||||
- Add KML script loading dependencies fallback to the inner ROM (and may be KML include?)
|
||||
- Add haptic feedback when touch a button
|
||||
- Add a true fullscreen mode under the status bar and the bottom buttons
|
||||
- Improve the access to the menu
|
||||
- Change the logo following the template
|
||||
|
|
|
@ -7,7 +7,7 @@ def keystoreProperties = new Properties()
|
|||
def canSign = false
|
||||
if(keystorePropertiesFile.exists()) {
|
||||
canSign = true
|
||||
println("The release flavor will signed in app/build/outputs/apk/release/app-release.apk")
|
||||
println("The release flavor will signed in the folder app/build/outputs/apk/release/")
|
||||
|
||||
// Load your keystore.properties file into the keystoreProperties object.
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
|
@ -35,6 +35,7 @@ android {
|
|||
targetSdkVersion 28
|
||||
versionCode 4
|
||||
versionName "1.3"
|
||||
setProperty("archivesBaseName", "Emu48-v$versionName")
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
@ -44,13 +45,10 @@ android {
|
|||
}
|
||||
}
|
||||
}
|
||||
// if(project.hasProperty("MyProject.properties")
|
||||
// && new File(project.property("MyProject.properties")).exists()) {
|
||||
|
||||
if(canSign) {
|
||||
signingConfigs {
|
||||
release {
|
||||
// storeFile new File(keystoreProperties['storeFile'])
|
||||
storeFile file(keystoreProperties['storeFile'])
|
||||
storePassword keystoreProperties['storePassword']
|
||||
keyAlias keystoreProperties['keyAlias']
|
||||
|
@ -78,11 +76,11 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
|
||||
implementation 'androidx.preference:preference:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha04'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ QUICK START
|
|||
|
||||
NOTES
|
||||
|
||||
- When using a custom KML script by selecting a folder, you must take care of the case sensitivity of its dependencies.
|
||||
- When using a custom KML script by selecting a folder, you must take care of the case sensitivity of its dependency files.
|
||||
|
||||
|
||||
NOT WORKING YET
|
||||
|
@ -40,6 +40,10 @@ CHANGES
|
|||
Version 1.3alpha (2019-03-xx)
|
||||
|
||||
- Fix the red and blue color inversion.
|
||||
- Add the HP 50g (Calypso 2K/4K) KML script from Carl Reinke (4K is a slow because there is no hardware acceleration).
|
||||
- Fix a bug about the timer delay in timeSetEvent(). I hope it fix the slow down.
|
||||
- Fix deprecated classes in the settings.
|
||||
- Add a haptic feedback when touching a button.
|
||||
|
||||
|
||||
Version 1.2 (2019-03-14)
|
||||
|
|
|
@ -141,7 +141,11 @@ static LRESULT OnPaint(HWND hWindow)
|
|||
static LRESULT OnLButtonDown(UINT nFlags, WORD x, WORD y)
|
||||
{
|
||||
if (nMacroState == MACRO_PLAY) return 0; // playing macro
|
||||
if (nState == SM_RUN) MouseButtonDownAt(nFlags, x,y);
|
||||
if (nState == SM_RUN) {
|
||||
MouseButtonDownAt(nFlags, x,y);
|
||||
if(MouseIsButton(x,y))
|
||||
performHapticFeedback();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,6 +238,19 @@ const TCHAR * clipboardPasteText() {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void performHapticFeedback() {
|
||||
JNIEnv *jniEnv = getJNIEnvironment();
|
||||
if(jniEnv) {
|
||||
jclass mainActivityClass = (*jniEnv)->GetObjectClass(jniEnv, mainActivity);
|
||||
if(mainActivityClass) {
|
||||
jmethodID midStr = (*jniEnv)->GetMethodID(jniEnv, mainActivityClass, "performHapticFeedback", "()V");
|
||||
(*jniEnv)->CallVoidMethod(jniEnv, mainActivity, midStr);
|
||||
(*jniEnv)->DeleteLocalRef(jniEnv, mainActivityClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_start(JNIEnv *env, jobject thisz, jobject assetMgr, jobject bitmapMainScreen0, jobject activity, jobject view) {
|
||||
|
||||
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
||||
|
|
|
@ -1679,6 +1679,9 @@ HANDLE WINAPI GetClipboardData(UINT uFormat) {
|
|||
return szText;
|
||||
}
|
||||
|
||||
//#define TIMER_LOGD LOGD
|
||||
#define TIMER_LOGD
|
||||
|
||||
void deleteTimeEvent(UINT uTimerID) {
|
||||
timer_delete(timerEvents[uTimerID - 1].timer);
|
||||
timerEvents[uTimerID - 1].valid = FALSE;
|
||||
|
@ -1688,13 +1691,13 @@ void timerCallback(int timerId) {
|
|||
timerEvents[timerId].fptc((UINT) (timerId + 1), 0, (DWORD) timerEvents[timerId].dwUser, 0, 0);
|
||||
|
||||
if(timerEvents[timerId].fuEvent == TIME_ONESHOT) {
|
||||
//LOGD("timerCallback remove timer uTimerID [%d]", timerId + 1);
|
||||
TIMER_LOGD("timerCallback remove timer uTimerID [%d]", timerId + 1);
|
||||
deleteTimeEvent((UINT) (timerId + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD_PTR dwUser, UINT fuEvent) {
|
||||
//LOGD("timeSetEvent(uDelay: %d, fuEvent: %d)", uDelay, fuEvent);
|
||||
TIMER_LOGD("timeSetEvent(uDelay: %d, fuEvent: %d)", uDelay, fuEvent);
|
||||
|
||||
// Find a timer id
|
||||
int timerId = -1;
|
||||
|
@ -1705,7 +1708,7 @@ MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD_
|
|||
}
|
||||
}
|
||||
if(timerId == -1) {
|
||||
//LOGD("timeSetEvent() ERROR: No more timer available");
|
||||
TIMER_LOGD("timeSetEvent() ERROR: No more timer available");
|
||||
return NULL;
|
||||
}
|
||||
timerEvents[timerId].timerId = timerId;
|
||||
|
@ -1721,11 +1724,11 @@ MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD_
|
|||
sev.sigev_notify_attributes = NULL;
|
||||
timer_t * timer = &(timerEvents[timerId].timer);
|
||||
if (timer_create(CLOCK_REALTIME, &sev, timer) == -1) {
|
||||
//LOGD("timeSetEvent() ERROR in timer_create");
|
||||
TIMER_LOGD("timeSetEvent() ERROR in timer_create");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
long long freq_nanosecs = uDelay * 1000000;
|
||||
long long freq_nanosecs = uDelay * 1000000L;
|
||||
struct itimerspec its;
|
||||
its.it_value.tv_sec = freq_nanosecs / 1000000000;
|
||||
its.it_value.tv_nsec = freq_nanosecs % 1000000000;
|
||||
|
@ -1738,15 +1741,15 @@ MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD_
|
|||
}
|
||||
if (timer_settime(timerEvents[timerId].timer, 0, &its, NULL) == -1) {
|
||||
timer_delete(timerEvents[timerId].timer);
|
||||
//LOGD("timeSetEvent() ERROR in timer_settime");
|
||||
TIMER_LOGD("timeSetEvent() ERROR in timer_settime");
|
||||
return NULL;
|
||||
}
|
||||
timerEvents[timerId].valid = TRUE;
|
||||
//LOGD("timeSetEvent() -> timerId+1: [%d]", timerId + 1);
|
||||
TIMER_LOGD("timeSetEvent() -> timerId+1: [%d]", timerId + 1);
|
||||
return (MMRESULT) (timerId + 1); // No error
|
||||
}
|
||||
MMRESULT timeKillEvent(UINT uTimerID) {
|
||||
//LOGD("timeKillEvent(uTimerID: [%d])", uTimerID);
|
||||
TIMER_LOGD("timeKillEvent(uTimerID: [%d])", uTimerID);
|
||||
deleteTimeEvent(uTimerID);
|
||||
return 0; //No error
|
||||
}
|
||||
|
|
|
@ -1141,3 +1141,4 @@ extern enum ChooseKmlMode chooseCurrentKmlMode;
|
|||
BOOL getFirstKMLFilenameForType(BYTE chipsetType, TCHAR * firstKMLFilename, size_t firstKMLFilenameSize);
|
||||
void clipboardCopyText(const TCHAR * text);
|
||||
const TCHAR * clipboardPasteText();
|
||||
void performHapticFeedback();
|
||||
|
|
|
@ -17,6 +17,7 @@ import android.os.Bundle;
|
|||
import android.os.ParcelFileDescriptor;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
|
@ -1181,6 +1182,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
return "";
|
||||
}
|
||||
|
||||
void performHapticFeedback() {
|
||||
if(sharedPreferences.getBoolean("settings_haptic_feedback", true))
|
||||
mainScreenView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
|
||||
private void setPort1Settings(boolean port1Plugged, boolean port1Writable) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean("settings_port1en", port1Plugged);
|
||||
|
@ -1192,7 +1198,10 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
private void updateFromPreferences(String key, boolean isDynamic) {
|
||||
int isDynamicValue = isDynamic ? 1 : 0;
|
||||
if(key == null) {
|
||||
String[] settingKeys = { "settings_realspeed", "settings_grayscale", "settings_allow_rotation", "settings_fill_screen", "settings_scale", "settings_allow_sound", "settings_kml", "settings_port1", "settings_port2" };
|
||||
String[] settingKeys = {
|
||||
"settings_realspeed", "settings_grayscale", "settings_allow_rotation", "settings_fill_screen",
|
||||
"settings_scale", "settings_allow_sound", "settings_haptic_feedback",
|
||||
"settings_kml", "settings_port1", "settings_port2" };
|
||||
for (String settingKey : settingKeys) {
|
||||
updateFromPreferences(settingKey, false);
|
||||
}
|
||||
|
@ -1223,6 +1232,10 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
sharedPreferences.getBoolean("settings_allow_sound", true) ? 64 : 0, 0, null);
|
||||
break;
|
||||
|
||||
case "settings_haptic_feedback":
|
||||
// Nothing to do
|
||||
break;
|
||||
|
||||
case "settings_kml":
|
||||
case "settings_kml_default":
|
||||
case "settings_kml_folder":
|
||||
|
|
|
@ -6,9 +6,6 @@ import android.content.SharedPreferences;
|
|||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
@ -16,6 +13,9 @@ import java.util.HashSet;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
|||
}
|
||||
|
||||
generalPreferenceFragment = new GeneralPreferenceFragment();
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, generalPreferenceFragment).commit();
|
||||
getSupportFragmentManager().beginTransaction().replace(android.R.id.content, generalPreferenceFragment).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,13 +104,14 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
|||
* This fragment shows general preferences only. It is used when the
|
||||
* activity is showing a two-pane settings UI.
|
||||
*/
|
||||
public static class GeneralPreferenceFragment extends PreferenceFragment {
|
||||
public static class GeneralPreferenceFragment extends PreferenceFragmentCompat {
|
||||
|
||||
Preference preferencePort2load = null;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.pref_general);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
|
@ -167,6 +168,11 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
|
||||
}
|
||||
|
||||
public void updatePort2LoadFilename(String port2Filename) {
|
||||
if(preferencePort2load != null) {
|
||||
String displayName = port2Filename;
|
||||
|
|
|
@ -56,6 +56,22 @@
|
|||
<string name="message_press_reset">Are you sure you want to press the Reset Button?</string>
|
||||
<string name="message_change_kml">You cannot change the KML script when Emu48 is not running. Use the File, New menu item to create a new calculator.</string>
|
||||
<string name="message_kml_script_compilation_result">KML Script Compilation Result</string>
|
||||
<string name="settings_category_general_title">General</string>
|
||||
<string name="settings_realspeed_title">Authentic Calculator Speed</string>
|
||||
<string name="settings_grayscale_title">Enable Virtual LCD Delay</string>
|
||||
<string name="settings_autosave_title">Automatically Save Files</string>
|
||||
<string name="settings_objectloadwarning_title">Show Load Object Warning</string>
|
||||
<string name="settings_alwaysdisplog_title">Always Show KML Compilation Result</string>
|
||||
<string name="settings_allow_rotation_title">Allow rotation</string>
|
||||
<string name="settings_fill_screen_title">Fill screen</string>
|
||||
<string name="settings_allow_sound_title">Allow sounds</string>
|
||||
<string name="settings_haptic_feedback_title">Allow haptic feedback</string>
|
||||
<string name="settings_category_memory_cards_title">Memory Cards</string>
|
||||
<string name="settings_port1en_title">Port 1 is Plugged</string>
|
||||
<string name="settings_port1wr_title">Port 1 is Writable</string>
|
||||
<string name="settings_port2en_title">Port 2 is Plugged</string>
|
||||
<string name="settings_port2wr_title">Port 2 is Writable</string>
|
||||
<string name="settings_port2load_title">Port 2 File</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -2,54 +2,46 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<!-- General -->
|
||||
<PreferenceCategory android:title="General">
|
||||
<PreferenceCategory android:title="@string/settings_category_general_title">
|
||||
<SwitchPreference
|
||||
android:key="settings_realspeed"
|
||||
android:title="Authentic Calculator Speed"
|
||||
android:title="@string/settings_realspeed_title"
|
||||
android:defaultValue="false" />
|
||||
<SwitchPreference
|
||||
android:key="settings_grayscale"
|
||||
android:title="Enable Virtual LCD Delay"
|
||||
android:title="@string/settings_grayscale_title"
|
||||
android:defaultValue="false" />
|
||||
<SwitchPreference
|
||||
android:key="settings_autosave"
|
||||
android:title="Automatically Save Files"
|
||||
android:title="@string/settings_autosave_title"
|
||||
android:defaultValue="true" />
|
||||
<SwitchPreference
|
||||
android:key="settings_objectloadwarning"
|
||||
android:title="Show Load Object Warning"
|
||||
android:title="@string/settings_objectloadwarning_title"
|
||||
android:defaultValue="true" />
|
||||
<SwitchPreference
|
||||
android:key="settings_alwaysdisplog"
|
||||
android:title="Always Show KML Compilation Result"
|
||||
android:title="@string/settings_alwaysdisplog_title"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="settings_allow_rotation"
|
||||
android:title="Allow rotation"
|
||||
android:title="@string/settings_allow_rotation_title"
|
||||
android:defaultValue="false" />
|
||||
<SwitchPreference
|
||||
android:key="settings_fill_screen"
|
||||
android:title="Fill screen"
|
||||
android:title="@string/settings_fill_screen_title"
|
||||
android:defaultValue="false" />
|
||||
<SwitchPreference
|
||||
android:key="settings_allow_sound"
|
||||
android:title="Allow sounds"
|
||||
android:title="@string/settings_allow_sound_title"
|
||||
android:defaultValue="true" />
|
||||
<SwitchPreference
|
||||
android:key="settings_haptic_feedback"
|
||||
android:title="@string/settings_haptic_feedback_title"
|
||||
android:defaultValue="true" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<!--<PreferenceCategory android:title="General">-->
|
||||
<!--<SwitchPreference-->
|
||||
<!--android:key="settings_kml_default"-->
|
||||
<!--android:title="Default Internal KML Folder"-->
|
||||
<!--android:defaultValue="true" />-->
|
||||
<!--<Preference-->
|
||||
<!--android:key="settings_kml_folder"-->
|
||||
<!--android:title="Custom KML Folder"-->
|
||||
<!--android:summary=""-->
|
||||
<!--/>-->
|
||||
<!--</PreferenceCategory>-->
|
||||
|
||||
<!--<PreferenceCategory app:title="Style">
|
||||
"Show Title",IDC_SHOWTITLE
|
||||
"Show Menu",IDC_SHOWMENU
|
||||
|
@ -60,30 +52,30 @@
|
|||
</PreferenceCategory>-->
|
||||
|
||||
<!-- Memory -->
|
||||
<PreferenceCategory android:title="Memory Cards">
|
||||
<PreferenceCategory android:title="@string/settings_category_memory_cards_title">
|
||||
<SwitchPreference
|
||||
android:key="settings_port1en"
|
||||
android:title="Port 1 is Plugged"
|
||||
android:title="@string/settings_port1en_title"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<SwitchPreference
|
||||
android:key="settings_port1wr"
|
||||
android:title="Port 1 is Writeable"
|
||||
android:title="@string/settings_port1wr_title"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<SwitchPreference
|
||||
android:key="settings_port2en"
|
||||
android:title="Port 2 is Plugged"
|
||||
android:title="@string/settings_port2en_title"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<SwitchPreference
|
||||
android:key="settings_port2wr"
|
||||
android:title="Port 2 is Writeable"
|
||||
android:title="@string/settings_port2wr_title"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<Preference
|
||||
android:key="settings_port2load"
|
||||
android:title="Port 2 File"
|
||||
android:title="@string/settings_port2load_title"
|
||||
android:summary=""
|
||||
/>
|
||||
</PreferenceCategory>
|
||||
|
|
Loading…
Reference in a new issue