Version 2.0 (2020-11-15)

This commit is contained in:
dgis 2020-11-15 16:42:39 +01:00
parent 3427c62a89
commit 23184e86d2
7 changed files with 234 additions and 232 deletions

View file

@ -63,7 +63,7 @@ LINKS
CHANGES
Version 2.0 (2020-11-XX)
Version 2.0 (2020-11-15)
- Updated source code from Eric Rechlin's Emu48 version 1.62+ that was merged from Christoph Gießelink's Emu48 version 1.63.
- For the HP49/50 port 2, it is now possible to load a new Flash ROM file (It fully replaces the ROM).
@ -72,6 +72,7 @@ Version 2.0 (2020-11-XX)
- Fix a printer issue from Christoph Gießelink's HP82240B Printer Simulator version 1.12.
- Fix the KML button Type 3 with a Background offset which was not display at the right location (Fix #15).
- Fix a timer issue.
- Fix a freeze with a hp48 sx or gx, when switching on/off several times port 1 and 2!
Version 1.9 (2020-09-07)
@ -219,21 +220,18 @@ TODO
- Manage the HP 48 port 2 with the same kind of interface for the memory card.
- The render pixels are very nice. A solution to obtain uniform pixel size could be a preset (a multiplier, auto) so the user could decide and upscale/downscale (Michael P).
- Bug: In Xiaomi mi A3 under Android10, the haptic feedback does not work (add an intensity setting).
- Somehow LEFT (Shift on the keyboard) + 7 activates the DIVIDE-key (z-Key)..., but with the NUM-Key it can make it work without problems...
I think it might have something to do with the "/" sign on the Shifted-7-key.
- The clock seems unsynchronized sometimes (Michael P).
- Retain a key by right clicking if it is from a mouse.
- Add the possibility to load and save the flash in another file.
- Sometimes, the calculator seems to lag and finally freeze.
- In Chrome OS:
- sometimes there is no OK button in the KML Script Compilation Result.
- In Chrome OS, sometimes there is no OK button in the KML Script Compilation Result.
- Add KML script loading dependencies fallback to the inner ROM (and may be KML include?).
BUILD
Emu48 for Android is built with Android Studio 4.0 (2020).
Emu48 for Android is built with Android Studio 4.1 (2020).
And to generate an installable APK file with a real Android device, it MUST be signed.
Either use Android Studio:

View file

@ -63,7 +63,7 @@ LINKS
CHANGES
Version 2.0 (2020-11-XX)
Version 2.0 (2020-11-15)
- Updated source code from Eric Rechlin's Emu48 version 1.62+ that was merged from Christoph Gießelink's Emu48 version 1.63.
- For the HP49/50 port 2, it is now possible to load a new Flash ROM file (It fully replaces the ROM).
@ -72,6 +72,7 @@ Version 2.0 (2020-11-XX)
- Fix a printer issue from Christoph Gießelink's HP82240B Printer Simulator version 1.12.
- Fix the KML button Type 3 with a Background offset which was not display at the right location (Fix #15).
- Fix a timer issue.
- Fix a freeze with a hp48 sx or gx, when switching on/off several times port 1 and 2!
Version 1.9 (2020-09-07)

View file

@ -1047,7 +1047,9 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(J
const char *configKey = (*env)->GetStringUTFChars(env, key, NULL) ;
const char *configStringValue = stringValue ? (*env)->GetStringUTFChars(env, stringValue, NULL) : NULL;
bAutoSave = FALSE;
//LOGE("NativeLib_setConfiguration(%s, %d, %d, %s)", configKey, intValue1, intValue2, configStringValue);
bAutoSave = FALSE;
bAutoSaveOnExit = FALSE;
bLoadObjectWarning = FALSE;
bAlwaysDisplayLog = TRUE;
@ -1081,7 +1083,9 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(J
if (Chipset.Port1Size && (cCurrentRomType!='X' || cCurrentRomType!='2' || cCurrentRomType!='Q')) // CdB for HP: add apples
{
UINT nOldState = SwitchToState(SM_SLEEP);
// save old card status
//LOGE("NativeLib_setConfiguration port1 start SwitchToState %d -> SM_SLEEP", nOldState);
// save old card status
BYTE byCardsStatus = Chipset.cards_status;
// port1 disabled?
@ -1103,7 +1107,9 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(J
Chipset.SoftInt = TRUE; // set interrupt
bInterrupt = TRUE;
}
//LOGE("NativeLib_setConfiguration port1 end SwitchToState %d", nOldState);
SwitchToState(nOldState);
while (nState!=nNextState) Sleep(0);
}
} else if(_tcscmp(_T("settings_port2"), configKey) == 0) {
settingsPort2en = (BOOL)intValue1;
@ -1139,6 +1145,7 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(J
if (bPort2CfgChange) // slot2 configuration changed
{
UINT nOldState = SwitchToState(SM_INVALID);
//LOGE("NativeLib_setConfiguration port2 start SwitchToState %d -> SM_INVALID", nOldState);
UnmapPort2(); // unmap port2
@ -1159,6 +1166,7 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(J
// save fingerprint of port2
Chipset.wPort2Crc = wPort2Crc;
}
//LOGE("NativeLib_setConfiguration port2 end SwitchToState %d", nOldState);
SwitchToState(nOldState);
}
}

View file

@ -612,8 +612,19 @@ DWORD ResumeThread(HANDLE hThread) {
BOOL SetThreadPriority(HANDLE hThread, int nPriority) {
THREAD_LOGD("SetThreadPriority()");
//TODO
return 0;
// if(hThread->handleType == HANDLE_TYPE_THREAD) {
// int policy;
// struct sched_param param;
// int result = pthread_getschedparam(hThread->threadId, &policy, &param);
// if(nPriority == THREAD_PRIORITY_HIGHEST) {
// param.sched_priority = sched_get_priority_min(policy);
// param.sched_priority = sched_get_priority_max(policy);
// }
// result = pthread_setschedparam(hThread->threadId, policy, &param);
// // THIS DOES NOT WORK WITH ANDROID!
// return TRUE;
// }
return FALSE;
}
@ -733,14 +744,19 @@ BOOL WINAPI CloseHandle(HANDLE hObject) {
return FALSE;
}
void Sleep(int ms)
{
time_t seconds = ms / 1000;
long milliseconds = ms - 1000 * seconds;
struct timespec timeOut, remains;
timeOut.tv_sec = seconds;
timeOut.tv_nsec = milliseconds * 1000000; /* 50 milliseconds */
nanosleep(&timeOut, &remains);
void Sleep(int ms) {
if(ms == 0) {
// Because sched_yield() does not seem to work with Android, try to increase the pause duration,
// hoping to switch to the others thread (WorkerThread).
ms = 1;
}
sched_yield();
time_t seconds = ms / 1000;
long milliseconds = ms - 1000 * seconds;
struct timespec timeOut, remains;
timeOut.tv_sec = seconds;
timeOut.tv_nsec = milliseconds * 1000000;
nanosleep(&timeOut, &remains);
}
BOOL QueryPerformanceFrequency(PLARGE_INTEGER l) {

View file

@ -350,25 +350,27 @@ public class SettingsFragment extends AppCompatDialogFragment {
Preference preferenceFlashPort2 = findPreference("settings_flash_port2");
if(preferenceFlashPort2 != null) {
String flashPort2Filename = settings.getString(preferenceFlashPort2.getKey(), "");
String displayName = flashPort2Filename;
try {
displayName = Utils.getFileName(getActivity(), flashPort2Filename);
} catch (Exception e) {
// Do nothing
}
preferenceFlashPort2.setSummary(displayName);
//TODO offer the possibility to manage the Flash from here too.
// preferenceFlashPort2.setOnPreferenceClickListener(preference -> {
// Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
// intent.addCategory(Intent.CATEGORY_OPENABLE);
// intent.setType("*/*");
// intent.putExtra(Intent.EXTRA_TITLE, "shared.bin");
// Fragment parentFragment = getParentFragment();
// if (parentFragment != null)
// parentFragment.startActivityForResult(intent, MainActivity.INTENT_PORT2LOAD);
// return true;
// });
int cCurrentRomType = NativeLib.getCurrentModel();
if(cCurrentRomType == 'X' || cCurrentRomType == 'Q') {
String flashPort2Filename = settings.getString(preferenceFlashPort2.getKey(), "");
String displayName = flashPort2Filename;
try {
displayName = Utils.getFileName(getActivity(), flashPort2Filename);
} catch (Exception e) {
// Do nothing
}
preferenceFlashPort2.setSummary(displayName);
//TODO offer the possibility to manage the Flash from here too.
preferenceFlashPort2.setOnPreferenceClickListener(preference -> {
new AlertDialog.Builder(requireContext())
.setTitle(getString(R.string.settings_flash_port2_title))
.setMessage(getString(R.string.settings_flash_port2_dialog_description))
.setPositiveButton(android.R.string.ok, (dialog1, which1) -> {
}).show();
return true;
});
} else
preferenceFlashPort2.setEnabled(false);
}
}

View file

@ -47,7 +47,7 @@
<string name="nav_change_kml_script">Change KML Script...</string>
<string name="nav_show_printer">Show the Printer Simulator...</string>
<string name="nav_tool">Tool</string>
<string name="nav_create_ram_card">Create RAM Card...</string>
<string name="nav_create_ram_card">Create RAM Card (HP48)...</string>
<string name="nav_manage_flash_rom">Manage Flash ROM (HP49)...</string>
<string name="nav_macro_record">Record Macro...</string>
<string name="nav_macro_play">Play Macro...</string>
@ -175,13 +175,15 @@
<string name="settings_background_custom_color_title">Custom color</string>
<string name="settings_background_custom_color_summary">Used when selecting the \'Custom color\' in the \'Other possible colors\'</string>
<string name="settings_category_memory_cards_title">Memory Cards</string>
<string name="settings_category_memory_cards_hp48_title">Memory Cards HP48</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>
<string name="settings_category_memory_cards_hp49_title">Memory Cards HP49/50</string>
<string name="settings_flash_port2_title">Port 2 Flash File</string>
<string name="settings_flash_port2_dialog_description">This file can be set from the main menu item "Manage Flash ROM (HP49)...".</string>
<string name="settings_category_printer_title">Printer Simulator</string>
<string name="settings_printer_model_title">Printer Model</string>

View file

@ -1,204 +1,179 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- General -->
<PreferenceCategory android:title="@string/settings_category_general_title">
<SwitchPreference
android:key="settings_realspeed"
android:title="@string/settings_realspeed_title"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_grayscale"
android:title="@string/settings_grayscale_title"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_autosave"
android:title="@string/settings_autosave_title"
android:defaultValue="true" />
<SwitchPreference
android:key="settings_objectloadwarning"
android:title="@string/settings_objectloadwarning_title"
android:defaultValue="true" />
<SwitchPreference
android:key="settings_alwaysdisplog"
android:title="@string/settings_alwaysdisplog_title"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_general_title">
<SwitchPreference
android:key="settings_realspeed"
android:title="@string/settings_realspeed_title"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_grayscale"
android:title="@string/settings_grayscale_title"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_autosave"
android:title="@string/settings_autosave_title"
android:defaultValue="true" />
<SwitchPreference
android:key="settings_objectloadwarning"
android:title="@string/settings_objectloadwarning_title"
android:defaultValue="true" />
<SwitchPreference
android:key="settings_alwaysdisplog"
android:title="@string/settings_alwaysdisplog_title"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_ui_title">
<ListPreference
android:key="settings_auto_layout"
android:title="@string/settings_auto_layout_title"
android:dialogTitle="@string/settings_auto_layout_title"
android:summary="@string/settings_auto_layout_summary"
android:entries="@array/settings_auto_layout_item"
android:entryValues="@array/settings_auto_layout_value"
android:defaultValue="1"
/>
<ListPreference
android:key="settings_rotation"
android:title="@string/settings_rotation_title"
android:dialogTitle="@string/settings_rotation_title"
android:summary="@string/settings_rotation_summary"
android:entries="@array/settings_rotation_item"
android:entryValues="@array/settings_rotation_value"
android:defaultValue="0"
/>
<SwitchPreference
android:key="settings_allow_pinch_zoom"
android:title="@string/settings_allow_pinch_zoom_title"
android:defaultValue="true" />
<ListPreference
android:key="settings_lcd_overlapping_mode"
android:title="@string/settings_lcd_overlapping_mode_title"
android:dialogTitle="@string/settings_lcd_overlapping_mode_title"
android:summary="@string/settings_lcd_overlapping_mode_summary"
android:entries="@array/settings_lcd_overlapping_mode_item"
android:entryValues="@array/settings_lcd_overlapping_mode_value"
android:defaultValue="0"
/>
<SwitchPreference
android:key="settings_lcd_pixel_borders"
android:title="@string/settings_lcd_pixel_borders_title"
android:summary="@string/settings_lcd_pixel_borders_summary"
android:defaultValue="false" />
<PreferenceCategory android:title="@string/settings_category_ui_title">
<ListPreference
android:key="settings_auto_layout"
android:title="@string/settings_auto_layout_title"
android:dialogTitle="@string/settings_auto_layout_title"
android:summary="@string/settings_auto_layout_summary"
android:entries="@array/settings_auto_layout_item"
android:entryValues="@array/settings_auto_layout_value"
android:defaultValue="1"
/>
<ListPreference
android:key="settings_rotation"
android:title="@string/settings_rotation_title"
android:dialogTitle="@string/settings_rotation_title"
android:summary="@string/settings_rotation_summary"
android:entries="@array/settings_rotation_item"
android:entryValues="@array/settings_rotation_value"
android:defaultValue="0"
/>
<SwitchPreference
android:key="settings_allow_pinch_zoom"
android:title="@string/settings_allow_pinch_zoom_title"
android:defaultValue="true" />
<ListPreference
android:key="settings_lcd_overlapping_mode"
android:title="@string/settings_lcd_overlapping_mode_title"
android:dialogTitle="@string/settings_lcd_overlapping_mode_title"
android:summary="@string/settings_lcd_overlapping_mode_summary"
android:entries="@array/settings_lcd_overlapping_mode_item"
android:entryValues="@array/settings_lcd_overlapping_mode_value"
android:defaultValue="0"
/>
<SwitchPreference
android:key="settings_lcd_pixel_borders"
android:title="@string/settings_lcd_pixel_borders_title"
android:summary="@string/settings_lcd_pixel_borders_summary"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_hide_bar_status"
android:title="@string/settings_hide_bar_status"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_hide_bar_nav"
android:title="@string/settings_hide_bar_nav"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_hide_button_menu"
android:title="@string/settings_hide_button_menu"
android:defaultValue="false" />
<SeekBarPreference
android:key="settings_sound_volume"
android:title="@string/settings_sound_volume_title"
android:defaultValue="64"
android:min="0"
android:max="255"
app:showSeekBarValue="true" />
<SeekBarPreference
android:key="settings_haptic_feedback_duration"
android:title="@string/settings_haptic_feedback_title"
android:summary="@string/settings_haptic_feedback_summary"
android:defaultValue="25"
android:min="0"
android:max="50"
app:showSeekBarValue="true" />
</PreferenceCategory>
<SwitchPreference
android:key="settings_hide_bar_status"
android:title="@string/settings_hide_bar_status"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_hide_bar_nav"
android:title="@string/settings_hide_bar_nav"
android:defaultValue="false" />
<SwitchPreference
android:key="settings_hide_button_menu"
android:title="@string/settings_hide_button_menu"
android:defaultValue="false" />
<SeekBarPreference
android:key="settings_sound_volume"
android:title="@string/settings_sound_volume_title"
android:defaultValue="64"
android:min="0"
android:max="255"
app:showSeekBarValue="true" />
<SeekBarPreference
android:key="settings_haptic_feedback_duration"
android:title="@string/settings_haptic_feedback_title"
android:summary="@string/settings_haptic_feedback_summary"
android:defaultValue="25"
android:min="0"
android:max="50"
app:showSeekBarValue="true" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_background_title">
<SwitchPreference
android:key="settings_background_kml_color"
android:title="@string/settings_background_kml_color_title"
android:summary="@string/settings_background_kml_color_summary"
android:defaultValue="false" />
<ListPreference
android:key="settings_background_fallback_color"
android:title="@string/settings_background_fallback_color_title"
android:dialogTitle="@string/settings_background_fallback_color_title"
android:summary="@string/settings_background_fallback_color_summary"
android:entries="@array/settings_background_fallback_color_item"
android:entryValues="@array/settings_background_fallback_color_value"
android:defaultValue="0"
/>
<!--<org.emulator.calculator.helpers.colorpicker.ColorPickerPreferenceCompat-->
<!--android:key="settings_background_custom_color"-->
<!--android:title="@string/settings_background_custom_color_title"-->
<!--android:summary="@string/settings_background_custom_color_summary"-->
<!--android:defaultValue="#FF000000"-->
<!--/>-->
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_background_title">
<SwitchPreference
android:key="settings_background_kml_color"
android:title="@string/settings_background_kml_color_title"
android:summary="@string/settings_background_kml_color_summary"
android:defaultValue="false" />
<ListPreference
android:key="settings_background_fallback_color"
android:title="@string/settings_background_fallback_color_title"
android:dialogTitle="@string/settings_background_fallback_color_title"
android:summary="@string/settings_background_fallback_color_summary"
android:entries="@array/settings_background_fallback_color_item"
android:entryValues="@array/settings_background_fallback_color_value"
android:defaultValue="0"
/>
<!--<org.emulator.calculator.helpers.colorpicker.ColorPickerPreferenceCompat-->
<!--android:key="settings_background_custom_color"-->
<!--android:title="@string/settings_background_custom_color_title"-->
<!--android:summary="@string/settings_background_custom_color_summary"-->
<!--android:defaultValue="#FF000000"-->
<!--/>-->
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_printer_title">
<ListPreference
android:key="settings_printer_model"
android:title="@string/settings_printer_model_title"
android:dialogTitle="@string/settings_printer_model_title"
android:summary="@string/settings_printer_model_summary"
android:entries="@array/settings_printer_model_item"
android:entryValues="@array/settings_printer_model_value"
android:defaultValue="1"
/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_printer_title">
<ListPreference
android:key="settings_printer_model"
android:title="@string/settings_printer_model_title"
android:dialogTitle="@string/settings_printer_model_title"
android:summary="@string/settings_printer_model_summary"
android:entries="@array/settings_printer_model_item"
android:entryValues="@array/settings_printer_model_value"
android:defaultValue="1"
/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_macro_title">
<SwitchPreference
android:key="settings_macro_real_speed"
android:title="@string/settings_macro_real_speed_title"
android:defaultValue="true" />
<SeekBarPreference
android:key="settings_macro_manual_speed"
android:title="@string/settings_macro_manual_speed_title"
android:defaultValue="500"
android:min="0"
android:max="500"
app:showSeekBarValue="true" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_macro_title">
<SwitchPreference
android:key="settings_macro_real_speed"
android:title="@string/settings_macro_real_speed_title"
android:defaultValue="true" />
<SeekBarPreference
android:key="settings_macro_manual_speed"
android:title="@string/settings_macro_manual_speed_title"
android:defaultValue="500"
android:min="0"
android:max="500"
app:showSeekBarValue="true" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_memory_cards_hp48_title">
<SwitchPreference
android:key="settings_port1en"
android:title="@string/settings_port1en_title"
android:defaultValue="false"
/>
<SwitchPreference
android:key="settings_port1wr"
android:title="@string/settings_port1wr_title"
android:defaultValue="false"
/>
<SwitchPreference
android:key="settings_port2en"
android:title="@string/settings_port2en_title"
android:defaultValue="false"
/>
<SwitchPreference
android:key="settings_port2wr"
android:title="@string/settings_port2wr_title"
android:defaultValue="false"
/>
<Preference
android:key="settings_port2load"
android:title="@string/settings_port2load_title"
android:summary=""
/>
</PreferenceCategory>
<!--<PreferenceCategory app:title="Disassembler">
"HP Mnemonics",IDC_DISASM_HP
"Class Mnemonics",IDC_DISASM_CLASS
</PreferenceCategory>-->
<!-- Memory -->
<PreferenceCategory android:title="@string/settings_category_memory_cards_title">
<SwitchPreference
android:key="settings_port1en"
android:title="@string/settings_port1en_title"
android:defaultValue="false"
/>
<SwitchPreference
android:key="settings_port1wr"
android:title="@string/settings_port1wr_title"
android:defaultValue="false"
/>
<SwitchPreference
android:key="settings_port2en"
android:title="@string/settings_port2en_title"
android:defaultValue="false"
/>
<SwitchPreference
android:key="settings_port2wr"
android:title="@string/settings_port2wr_title"
android:defaultValue="false"
/>
<Preference
android:key="settings_port2load"
android:title="@string/settings_port2load_title"
android:summary=""
/>
<Preference
android:key="settings_flash_port2"
android:title="@string/settings_flash_port2_title"
android:summary=""
/>
</PreferenceCategory>
<!-- Peripheral -->
<!--<PreferenceCategory app:title="Sound">-->
<!--"Volume",IDC_STATIC,14,21,24,8-->
<!--"Slider1",IDC_SOUND_SLIDER,"msctls_trackbar32",-->
<!--"Device",IDC_STATIC,13,42,24,8-->
<!--COMBOBOX IDC_SOUND_DEVICE,44,40,193,87,CBS_DROPDOWNLIST |-->
<!--</PreferenceCategory>-->
<!--<PreferenceCategory app:title="Infrared PrinterSimulator">
"IP Address:",IDC_STATIC
"Port:",IDC_STATIC
IDC_IR_ADDR
IDC_IR_PORT
</PreferenceCategory>-->
<!--<PreferenceCategory app:title="Serial Ports">
"Wire:",IDC_STATIC
COMBOBOX IDC_WIRE
"IR:",IDC_STATIC
COMBOBOX IDC_IR
</PreferenceCategory>-->
<PreferenceCategory android:title="@string/settings_category_memory_cards_hp49_title">
<Preference
android:key="settings_flash_port2"
android:title="@string/settings_flash_port2_title"
android:summary=""
/>
</PreferenceCategory>
</PreferenceScreen>