Fix Cpp warnings and add a dummy/empty DDE server.

This commit is contained in:
dgis 2024-10-21 16:35:39 +02:00
parent c6c3456ed7
commit f71367b05e
6 changed files with 120 additions and 3 deletions

View file

@ -5,6 +5,9 @@
cmake_minimum_required(VERSION 3.6.0) cmake_minimum_required(VERSION 3.6.0)
project("org.emulator.calculator.EmuApplication")
#add_compile_options(-DDEBUG_DISPLAY) #add_compile_options(-DDEBUG_DISPLAY)
#add_compile_options(-DDEBUG_SOUND) #add_compile_options(-DDEBUG_SOUND)
#add_compile_options(-DDEBUG_DEBUGGER) #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(-Wno-error=implicit-function-declaration)
add_compile_options(-fpermissive) add_compile_options(-fpermissive)
add_compile_options(-Wno-error=incompatible-pointer-types) 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) if(CMAKE_BUILD_TYPE STREQUAL Release)
message("RELEASE BUILD") 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/apple.c
# src/main/cpp/core/cursor.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/debugger.c
src/main/cpp/core/disasm.c src/main/cpp/core/disasm.c
src/main/cpp/core/dismem.c src/main/cpp/core/dismem.c

View file

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

View file

@ -501,7 +501,28 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_start(JNIEnv *env,
return; 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 ResumeThread(hThread); // start thread
while (nState!=nNextState) Sleep(0); // wait for thread initialized while (nState!=nNextState) Sleep(0); // wait for thread initialized

View file

@ -3645,3 +3645,46 @@ int GetLocaleInfo(LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData) {
return 0; 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); 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(); return json.toString();
} }
@SuppressWarnings("unchecked")
private static String toJSON(Map<String, Object> map) { private static String toJSON(Map<String, Object> map) {
StringBuilder json = new StringBuilder(); StringBuilder json = new StringBuilder();
json.append("{"); json.append("{");