diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index d0f0dd8..1d44943 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -5,6 +5,9 @@ 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 +37,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 +70,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 diff --git a/app/src/main/cpp/android-emu.c b/app/src/main/cpp/android-emu.c index a11897a..f2e383c 100644 --- a/app/src/main/cpp/android-emu.c +++ b/app/src/main/cpp/android-emu.c @@ -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 diff --git a/app/src/main/cpp/emu-jni.c b/app/src/main/cpp/emu-jni.c index cfad6b5..2e8563c 100644 --- a/app/src/main/cpp/emu-jni.c +++ b/app/src/main/cpp/emu-jni.c @@ -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 diff --git a/app/src/main/cpp/win32-layer.c b/app/src/main/cpp/win32-layer.c index 4e8cb22..6b0a978 100644 --- a/app/src/main/cpp/win32-layer.c +++ b/app/src/main/cpp/win32-layer.c @@ -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; +} + diff --git a/app/src/main/cpp/win32-layer.h b/app/src/main/cpp/win32-layer.h index 0a6b3fe..8025174 100644 --- a/app/src/main/cpp/win32-layer.h +++ b/app/src/main/cpp/win32-layer.h @@ -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); diff --git a/app/src/main/java/org/emulator/calculator/Settings.java b/app/src/main/java/org/emulator/calculator/Settings.java index e0c1e8f..fdc0e29 100644 --- a/app/src/main/java/org/emulator/calculator/Settings.java +++ b/app/src/main/java/org/emulator/calculator/Settings.java @@ -157,7 +157,6 @@ public class Settings extends PreferenceDataStore { return json.toString(); } - @SuppressWarnings("unchecked") private static String toJSON(Map map) { StringBuilder json = new StringBuilder(); json.append("{");