Update the readme.txt file and cleanup LCD update functions.

This commit is contained in:
dgis 2024-10-07 19:43:48 +02:00
parent 9f58423a93
commit 822845e1ba
5 changed files with 18 additions and 16 deletions

View file

@ -61,6 +61,7 @@ CHANGES
Version 2.8 (2024-xx-xx) Version 2.8 (2024-xx-xx)
- Updated source code with Emu48 version 1.66+. - Updated source code with Emu48 version 1.66+.
- Fix an USB serial issue with Android 13+ (fix #23).
Version 2.7 (2024-06-14) Version 2.7 (2024-06-14)

View file

@ -58,6 +58,12 @@ LINKS
CHANGES CHANGES
Version 2.8 (2024-xx-xx)
- Updated source code with Emu48 version 1.66+.
- Fix an USB serial issue with Android 13+ (fix #23).
Version 2.7 (2024-06-14) Version 2.7 (2024-06-14)
- Updated source code with Emu48 version 1.65+. This new version improve the serial communication. - Updated source code with Emu48 version 1.65+. This new version improve the serial communication.

View file

@ -88,16 +88,14 @@ enum CALLBACK_TYPE {
}; };
// https://stackoverflow.com/questions/9630134/jni-how-to-callback-from-c-or-c-to-java // https://stackoverflow.com/questions/9630134/jni-how-to-callback-from-c-or-c-to-java
int mainViewCallback(int type, int param1, int param2, const TCHAR * param3, const TCHAR * param4) { int mainViewCallback(int type, int param1, int param2/*, const TCHAR * param3, const TCHAR * param4*/) {
if (mainActivity) { if (mainActivity) {
JNIEnv *jniEnv = getJNIEnvironment(); JNIEnv *jniEnv = getJNIEnvironment();
if(jniEnv) { if(jniEnv) {
jclass mainActivityClass = (*jniEnv)->GetObjectClass(jniEnv, mainActivity); jclass mainActivityClass = (*jniEnv)->GetObjectClass(jniEnv, mainActivity);
if(mainActivityClass) { if(mainActivityClass) {
jmethodID midStr = (*jniEnv)->GetMethodID(jniEnv, mainActivityClass, "updateCallback", "(IIILjava/lang/String;Ljava/lang/String;)I"); jmethodID midStr = (*jniEnv)->GetMethodID(jniEnv, mainActivityClass, "updateCallback", "(III)I");
jstring utfParam3 = (*jniEnv)->NewStringUTF(jniEnv, param3); int result = (*jniEnv)->CallIntMethod(jniEnv, mainActivity, midStr, type, param1, param2);
jstring utfParam4 = (*jniEnv)->NewStringUTF(jniEnv, param4);
int result = (*jniEnv)->CallIntMethod(jniEnv, mainActivity, midStr, type, param1, param2, utfParam3, utfParam4);
(*jniEnv)->DeleteLocalRef(jniEnv, mainActivityClass); (*jniEnv)->DeleteLocalRef(jniEnv, mainActivityClass);
//if(needDetach) ret = (*java_machine)->DetachCurrentThread(java_machine); //if(needDetach) ret = (*java_machine)->DetachCurrentThread(java_machine);
return result; return result;
@ -113,18 +111,16 @@ void mainViewUpdateCallback() {
// int param2 = ((mainViewRectangleToUpdate.right & 0xFFFF) << 16) | (mainViewRectangleToUpdate.bottom & 0xFFFF); // int param2 = ((mainViewRectangleToUpdate.right & 0xFFFF) << 16) | (mainViewRectangleToUpdate.bottom & 0xFFFF);
// mainViewCallback(CALLBACK_TYPE_INVALIDATE, // mainViewCallback(CALLBACK_TYPE_INVALIDATE,
// param1, // param1,
// param2, // param2);
// NULL, NULL);
// SetRectEmpty(&mainViewRectangleToUpdate); // SetRectEmpty(&mainViewRectangleToUpdate);
// } else // } else
mainViewCallback(CALLBACK_TYPE_INVALIDATE, mainViewCallback(CALLBACK_TYPE_INVALIDATE,
0, 0,
0, 0);
NULL, NULL);
} }
void mainViewResizeCallback(int x, int y) { void mainViewResizeCallback(int x, int y) {
mainViewCallback(CALLBACK_TYPE_WINDOW_RESIZE, x, y, NULL, NULL); mainViewCallback(CALLBACK_TYPE_WINDOW_RESIZE, x, y);
JNIEnv * jniEnv; JNIEnv * jniEnv;
int ret = (*java_machine)->GetEnv(java_machine, (void **) &jniEnv, JNI_VERSION_1_6); int ret = (*java_machine)->GetEnv(java_machine, (void **) &jniEnv, JNI_VERSION_1_6);

View file

@ -483,7 +483,7 @@ public class MainScreenView extends PanAndScaleView {
canvas.drawLines(pointsBuffer, paintLCD); canvas.drawLines(pointsBuffer, paintLCD);
} }
public void updateCallback(int type, int param1, int param2, String param3, String param4) { public void updateCallback(int type, int param1, int param2) {
try { try {
switch (type) { switch (type) {
case NativeLib.CALLBACK_TYPE_INVALIDATE: case NativeLib.CALLBACK_TYPE_INVALIDATE:

View file

@ -1783,13 +1783,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
// Method used from JNI! // Method used from JNI!
@SuppressWarnings("UnusedDeclaration") @SuppressWarnings("UnusedDeclaration")
public int updateCallback(int type, int param1, int param2, String param3, String param4) { public int updateCallback(int type, int param1, int param2) {
mainScreenView.updateCallback(type, param1, param2, param3, param4); mainScreenView.updateCallback(type, param1, param2);
return -1; return -1;
} }
final int GENERIC_READ = 1; final int GENERIC_READ = 1;
final int GENERIC_WRITE = 2; final int GENERIC_WRITE = 2;
SparseArray<ParcelFileDescriptor> parcelFileDescriptorPerFd = null; SparseArray<ParcelFileDescriptor> parcelFileDescriptorPerFd = null;