Compare commits

...

2 commits

Author SHA1 Message Date
dgis
03d5beeeed Version 2.8 2024-10-29 16:03:09 +01:00
dgis
f71367b05e Fix Cpp warnings and add a dummy/empty DDE server. 2024-10-21 16:35:39 +02:00
9 changed files with 127 additions and 11 deletions

View file

@ -58,7 +58,7 @@ LINKS
CHANGES
Version 2.8 (2024-xx-xx)
Version 2.8 (2024-10-29)
- Updated source code with Emu48 version 1.66+.
- Fix an USB serial issue with Android 13+ (fix #23).

View file

@ -5,6 +5,8 @@
cmake_minimum_required(VERSION 3.6.0)
project("org.emulator.calculator.EmuApplication")
#add_compile_options(-DDEBUG_DISPLAY)
#add_compile_options(-DDEBUG_SOUND)
#add_compile_options(-DDEBUG_DEBUGGER)
@ -34,6 +36,16 @@ add_compile_options(-DEMUXX=48)
#add_compile_options(-Wno-error=implicit-function-declaration)
add_compile_options(-fpermissive)
add_compile_options(-Wno-error=incompatible-pointer-types)
add_compile_options(-Wno-absolute-value)
add_compile_options(-Wno-ignored-pragmas)
add_compile_options(-Wno-incompatible-pointer-types)
add_compile_options(-Wno-int-conversion)
add_compile_options(-Wno-nonportable-include-path)
add_compile_options(-Wno-pointer-bool-conversion)
add_compile_options(-Wno-pointer-integer-compare)
add_compile_options(-Wno-pointer-sign)
add_compile_options(-Wno-return-type)
add_compile_options(-Wno-unsequenced)
if(CMAKE_BUILD_TYPE STREQUAL Release)
message("RELEASE BUILD")
@ -57,7 +69,7 @@ add_library( # Sets the name of the library.
src/main/cpp/core/apple.c
# src/main/cpp/core/cursor.c
# src/main/cpp/core/ddeserv.c
src/main/cpp/core/ddeserv.c
# src/main/cpp/core/debugger.c
src/main/cpp/core/disasm.c
src/main/cpp/core/dismem.c

View file

@ -34,8 +34,8 @@ android {
applicationId "org.emulator.forty.eight"
minSdk 21
targetSdk 34
versionCode 26
versionName "2.7"
versionCode 27
versionName "2.8"
setProperty("archivesBaseName", "Emu48-v$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
@ -90,6 +90,6 @@ dependencies {
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.documentfile:documentfile:1.0.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test:runner:1.6.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

View file

@ -58,7 +58,7 @@ LINKS
CHANGES
Version 2.8 (2024-xx-xx)
Version 2.8 (2024-10-29)
- Updated source code with Emu48 version 1.66+.
- Fix an USB serial issue with Android 13+ (fix #23).

View file

@ -20,6 +20,8 @@
#include "core/debugger.h"
#include "win32-layer.h"
LPTSTR szAppName = _T("Emu48"); // application name for DDE server
LPTSTR szTopic = _T("Stack"); // topic for DDE server
LPTSTR szTitle = NULL;
CRITICAL_SECTION csGDILock; // critical section for hWindowDC
@ -36,6 +38,8 @@ INT nArgc; // no. of command line arguments
LPCTSTR *ppArgv; // command line arguments
LARGE_INTEGER lFreq; // high performance counter frequency
LARGE_INTEGER lAppStart; // high performance counter value at Appl. start
DWORD idDdeInst; // DDE server id
UINT uCF_HpObj; // DDE clipboard format
HANDLE hThread;
HANDLE hEventShutdn; // event handle to stop cpu thread

View file

@ -88,7 +88,7 @@ enum CALLBACK_TYPE {
};
// 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) {
if (mainActivity) {
JNIEnv *jniEnv = getJNIEnvironment();
if(jniEnv) {
@ -501,7 +501,28 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_start(JNIEnv *env,
return;
}
soundEnabled = soundAvailable = SoundOpen(uWaveDevId); // open waveform-audio output device
idDdeInst = 0; // initialize DDE server
if (DdeInitialize(&idDdeInst,(PFNCALLBACK) &DdeCallback,
APPCLASS_STANDARD |
CBF_FAIL_EXECUTES | CBF_FAIL_ADVISES |
CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS,0))
{
// TerminateThread(hThread, 0); // kill emulation thread
CloseHandle(hEventShutdn); // close event handle
AbortMessage(_T("Could not initialize server!"));
//DestroyWindow(hWnd);
return; // FALSE;
}
// init clipboard format and name service
HSZ hszService, hszTopic; // variables for DDE server
uCF_HpObj = RegisterClipboardFormat(_T(CF_HPOBJ));
hszService = DdeCreateStringHandle(idDdeInst,szAppName,0);
hszTopic = DdeCreateStringHandle(idDdeInst,szTopic,0);
DdeNameService(idDdeInst,hszService,NULL,DNS_REGISTER);
soundEnabled = soundAvailable = SoundOpen(uWaveDevId); // open waveform-audio output device
ResumeThread(hThread); // start thread
while (nState!=nNextState) Sleep(0); // wait for thread initialized
@ -874,7 +895,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_emulator_calculator_NativeLib_getObjects
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onObjectSave(JNIEnv *env, jobject thisz, jstring filename, jbooleanArray objectsToSaveItemChecked) {
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, filename , NULL) ;
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, filename , NULL);
if (nState != SM_RUN)
{

View file

@ -3645,3 +3645,46 @@ int GetLocaleInfo(LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData) {
return 0;
}
/* DDE */
DWORD DdeQueryString(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage) {
//TODO
return 0;
}
LPBYTE DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize) {
//TODO
return 0;
}
BOOL DdeUnaccessData(HDDEDATA hData) {
//TODO
return 0;
}
HDDEDATA DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd) {
//TODO
return 0;
}
UINT DdeInitialize(LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes) {
//TODO
return 0;
}
UINT RegisterClipboardFormat(LPCSTR lpszFormat) {
//TODO
return 0;
}
HSZ DdeCreateStringHandle(DWORD idInst, LPCSTR psz, int iCodePage) {
//TODO
return 0;
}
HDDEDATA DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) {
//TODO
return 0;
}

View file

@ -1401,3 +1401,40 @@ typedef struct addrinfo ADDRINFO;
extern int closesocket(SOCKET s);
/* DDE */
#define DDE_FACK 0x8000
#define DDE_FNOTPROCESSED 0x0000
#define XTYPF_NOBLOCK 0x0002
#define XCLASS_BOOL 0x1000
#define XCLASS_DATA 0x2000
#define XCLASS_FLAGS 0x4000
#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
#define XTYP_POKE (0x0090 | XCLASS_FLAGS )
#define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
DWORD DdeQueryString(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage);
LPBYTE DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize);
BOOL DdeUnaccessData(HDDEDATA hData);
HDDEDATA DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd);
typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT wType, UINT wFmt, HCONV hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG_PTR dwData1, ULONG_PTR dwData2);
#define APPCLASS_STANDARD 0x00000000L
#define CBF_FAIL_ADVISES 0x00004000
#define CBF_FAIL_EXECUTES 0x00008000
#define CBF_SKIP_REGISTRATIONS 0x00080000
#define CBF_SKIP_UNREGISTRATIONS 0x00100000
#define DNS_REGISTER 0x0001
#define DNS_UNREGISTER 0x0002
UINT DdeInitialize(LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes);
UINT RegisterClipboardFormat(LPCSTR lpszFormat);
HSZ DdeCreateStringHandle(DWORD idInst, LPCSTR psz, int iCodePage);
HDDEDATA DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd);

View file

@ -157,7 +157,6 @@ public class Settings extends PreferenceDataStore {
return json.toString();
}
@SuppressWarnings("unchecked")
private static String toJSON(Map<String, Object> map) {
StringBuilder json = new StringBuilder();
json.append("{");