From a08abcf64ae2391110b7640a16f01582109188e0 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 3 Jul 2025 19:37:16 +0300 Subject: [PATCH] AF updates --- od-win32/cloanto/RetroPlatformIPC.h | 84 +++++++++++++++++++++++++---- od-win32/hardfile_win32.cpp | 26 ++++++++- od-win32/rp.cpp | 9 +++- od-win32/rp.h | 1 + od-win32/win32gui.cpp | 10 ++-- 5 files changed, 113 insertions(+), 17 deletions(-) diff --git a/od-win32/cloanto/RetroPlatformIPC.h b/od-win32/cloanto/RetroPlatformIPC.h index b216ce34..4360ab35 100644 --- a/od-win32/cloanto/RetroPlatformIPC.h +++ b/od-win32/cloanto/RetroPlatformIPC.h @@ -2,14 +2,14 @@ Name : RetroPlatformIPC.h Project : RetroPlatform Player Support : http://www.retroplatform.com - Legal : Copyright 2007-2023 Cloanto Corporation - All rights reserved. This + Legal : Copyright 2007-2025 Cloanto Corporation - All rights reserved. This : file is multi-licensed under the terms of the Mozilla Public License : version 2.0 as published by Mozilla Corporation and the GNU General : Public License, version 2 or later, as published by the Free : Software Foundation. Authors : os, m Created : 2007-08-27 13:55:49 - Updated : 2023-05-11 10:31:21 + Updated : 2025-06-28 17:42:21 Comment : RetroPlatform Player interprocess communication include file *****************************************************************************/ @@ -18,8 +18,8 @@ #include -#define RETROPLATFORM_API_VER "10.2" -#define RETROPLATFORM_API_VER_MAJOR 10 +#define RETROPLATFORM_API_VER "11.2" +#define RETROPLATFORM_API_VER_MAJOR 11 #define RETROPLATFORM_API_VER_MINOR 2 #define RPIPC_HostWndClass "RetroPlatformHost%s" @@ -59,7 +59,7 @@ #define RP_IPC_TO_HOST_DEVICECONTENT (WM_APP + 27) // extended in RetroPlatform API 3.0 #define RP_IPC_TO_HOST_KEYBOARDLAYOUT (WM_APP + 30) // introduced in RetroPlatform API 7.1 #define RP_IPC_TO_HOST_PRIVATE_SHAREDEVENT (WM_APP + 31) // introduced in RetroPlatform API 7.2 -#define RP_IPC_TO_HOST_PRIVATE_TYPECLIPDONE (WM_APP + 32) // introduced in RetroPlatform API 7.2 +#define RP_IPC_TO_HOST_PRIVATE_TYPETEXTDONE (WM_APP + 32) // introduced in RetroPlatform API 7.2 #define RP_IPC_TO_HOST_PRIVATE_KEYEVENT (WM_APP + 33) // introduced in RetroPlatform API 7.2 #define RP_IPC_TO_HOST_PRIVATE_GUESTEVENT (WM_APP + 34) // introduced in RetroPlatform API 7.2 #define RP_IPC_TO_HOST_PRIVATE_KEYREMINDER (WM_APP + 35) // introduced in RetroPlatform API 7.2 @@ -79,6 +79,11 @@ #define RP_IPC_TO_HOST_PRIVATE_CANTYPECLIPB (WM_APP + 49) // introduced in RetroPlatform API 10.0 #define RP_IPC_TO_HOST_DEVICEWRITEBYTES (WM_APP + 50) // introduced in RetroPlatform API 10.1 #define RP_IPC_TO_HOST_DEVICESETSIGNALS (WM_APP + 51) // introduced in RetroPlatform API 10.1 +#define RP_IPC_TO_HOST_PRIVATE_GUESTDLLSTARTUP (WM_APP + 52) // introduced in RetroPlatform API 10.3 +#define RP_IPC_TO_HOST_PRIVATE_FRAMEWINDOW (WM_APP + 53) // introduced in RetroPlatform API 10.3 +#define RP_IPC_TO_HOST_TOPWINDOW (WM_APP + 54) // introduced in RetroPlatform API 10.3 +#define RP_IPC_TO_HOST_PRIVATE_PRINTERATTR (WM_APP + 55) // introduced in RetroPlatform API 11.1 +#define RP_IPC_TO_HOST_STATUS (WM_APP + 56) // introduced in RetroPlatform API 11.2 // **************************************************************************** // Host-to-Guest Messages @@ -131,6 +136,9 @@ #define RP_IPC_TO_GUEST_EXECUTE (WM_APP + 248) // introduced in RetroPlatform API 10.0 #define RP_IPC_TO_GUEST_DEVICEWRITEBYTE (WM_APP + 249) // introduced in RetroPlatform API 10.1 #define RP_IPC_TO_GUEST_DEVICESETSIGNALS (WM_APP + 250) // introduced in RetroPlatform API 10.1 +#define RP_IPC_TO_GUEST_PRIVATE_FRAMEWINDOW (WM_APP + 251) // introduced in RetroPlatform API 10.3 +#define RP_IPC_TO_GUEST_PRIVATE_TYPETEXT (WM_APP + 252) // introduced in RetroPlatform API 10.4 +#define RP_IPC_TO_GUEST_PRIVATE_DEVICECOMMAND (WM_APP + 253) // introduced in RetroPlatform API 11.0 // **************************************************************************** // Message Data Structures and Defines @@ -524,11 +532,11 @@ typedef struct RPScreenCapture #define RP_SHARED_EVENT_PRESSED_DEFERRED 0x0002 #define RP_SHARED_EVENT_RELEASED 0x0001 -// RP_IPC_TO_GUEST_PRIVATE_TYPECLIP return code -#define PRIVATETYPECLIP_NOTIMPL 0 -#define PRIVATETYPECLIP_FAILED 1 -#define PRIVATETYPECLIP_SUCCEDED 2 -#define PRIVATETYPECLIP_INPROGRESS 3 // a RP_IPC_TO_HOST_PRIVATE_TYPECLIPDONE will be sent when done +// RP_IPC_TO_GUEST_PRIVATE_TYPECLIP and RP_IPC_TO_GUEST_PRIVATE_TYPETEXT return code +#define PRIVATETYPETEXT_NOTIMPL 0 +#define PRIVATETYPETEXT_FAILED 1 +#define PRIVATETYPETEXT_SUCCEEDED 2 +#define PRIVATETYPETEXT_INPROGRESS 3 // a RP_IPC_TO_HOST_PRIVATE_TYPETEXTDONE will be sent when done // RPScreenOverlay (used by RP_IPC_TO_GUEST_SCREENOVERLAY) @@ -660,8 +668,64 @@ typedef struct RPExecuteResult #define RP_SIGNAL_DTR 0x00000020 // Data Terminal Ready +// RP_IPC_TO_GUEST_PRIVATE_TYPETEXT + +typedef struct RPTypeText +{ + DWORD cbSize; // the size of this structure, in bytes (not including the extra size of the szText array) + DWORD dwTypematicRate; // characters per second or 0 + DWORD dwGuestFeatures; // RP_FEATURE_* flags + DWORD dwTextLength; // length of the output string (not including the terminating null character) + WCHAR szText[1]; // output string (variable-sized array) +} RPTYPETEXT; + + +// RP_IPC_TO_GUEST_PRIVATE_DEVICECOMMAND +#define RP_PDCMD_SHOW_PREVIEW 1 +#define RP_PDCMD_PRINT_LIST 2 + +#define PRIVATEDEVICECOMMAND_NOTIMPL PRIVATETYPETEXT_NOTIMPL +#define PRIVATEDEVICECOMMAND_FAILED PRIVATETYPETEXT_FAILED +#define PRIVATEDEVICECOMMAND_SUCCEEDED PRIVATETYPETEXT_SUCCEEDED +#define PRIVATEDEVICECOMMAND_INPROGRESS PRIVATETYPETEXT_INPROGRESS // a RP_IPC_TO_HOST_PRIVATE_TYPETEXTDONE will be sent when done + +typedef struct RPPrivateDeviceCommand +{ + DWORD cbSize; // the size of this structure, in bytes (not including the extra size of the dwParams array) + BYTE btDeviceCategory; // RP_PDCMD_* value + BYTE btDeviceNumber; // device number + DWORD dwCommand; // RP_DEVCMD_* value + DWORD dwParamCount; // count of the dwParams array + DWORD dwParams[1]; +} RPPRIVATEDEVICECOMMAND; + + +// RP_IPC_TO_HOST_PRIVATE_PRINTERATTR + +typedef struct RPPrinterAttribute +{ + DWORD cbSize; // the size of this structure, in bytes + WCHAR szPort[100]; // printer port + DWORD dwUnit; // printer unit + WCHAR szAttribute[100]; // attribute name + WCHAR szValue[100]; // attribute value +} RPPRINTERATTRIBUTE; + + +// RP_IPC_TO_HOST_STATUS + +#define RP_STATUS_PARTITION_TABLE_WRITE_ERROR 1 + + + // Legacy Compatibility #ifndef RP_NO_LEGACY +// Changed in 10.4 +#define RP_IPC_TO_HOST_PRIVATE_TYPECLIPDONE RP_IPC_TO_HOST_PRIVATE_TYPETEXTDONE +#define PRIVATETYPECLIP_NOTIMPL PRIVATETYPETEXT_NOTIMPL +#define PRIVATETYPECLIP_FAILED PRIVATETYPETEXT_FAILED +#define PRIVATETYPECLIP_SUCCEEDED PRIVATETYPETEXT_SUCCEEDED +#define PRIVATETYPECLIP_INPROGRESS PRIVATETYPETEXT_INPROGRESS // Changed in 7.0 #define RP_MOUSECAPTURE_MAGICMOUSE RP_MOUSECAPTURE_INTEGRATED // Changed in 3.0 diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index e55bac8b..3ea3ee64 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -21,6 +21,10 @@ #include "rommgr.h" #include "fsdb.h" +#ifdef RETROPLATFORM +#include "rp.h" +#endif + #define hfd_log write_log #define hfd_log2 //#define hdf_log2 write_log @@ -2661,12 +2665,18 @@ static int hdf_write_2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, i { DWORD outlen = 0; - if (hfd->ci.readonly) { + if (hfd->dangerous) { *error = 28; +#ifdef RETROPLATFORM + rp_drive_access_error(3); +#endif return 0; } - if (hfd->dangerous) { + if (hfd->ci.readonly) { *error = 28; +#ifdef RETROPLATFORM + rp_drive_access_error(4); +#endif return 0; } if (len == 0) @@ -2675,6 +2685,9 @@ static int hdf_write_2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, i hfd->cache_valid = 0; if (hdf_seek(hfd, offset, true)) { *error = 45; +#ifdef RETROPLATFORM + rp_drive_access_error(2); +#endif return 0; } poscheck (hfd, len); @@ -2689,6 +2702,9 @@ static int hdf_write_2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, i gui_message (_T("\"%s\"\n\nBlock zero write attempt but drive has one or more mounted PC partitions or WinUAE does not have Administrator privileges. Erase the drive or unmount all PC partitions first."), name); hfd->ci.readonly = true; *error = 45; +#ifdef RETROPLATFORM + rp_drive_access_error(0); +#endif return 0; } } @@ -2696,6 +2712,9 @@ static int hdf_write_2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, i HD_WriteFile(hfd->handle->h, hfd->cache, len, &outlen, offset); if (outlen != len) { *error = 45; +#ifdef RETROPLATFORM + rp_drive_access_error(5); +#endif } if (offset == 0) { DWORD err = GetLastError(); @@ -2711,6 +2730,9 @@ static int hdf_write_2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, i if (memcmp (hfd->cache, tmp, cmplen) != 0 || outlen != len) { gui_message (_T("\"%s\"\n\nblock zero write failed! Make sure WinUAE has Windows Administrator privileges. Error=%d"), name, err); *error = 45; +#ifdef RETROPLATFORM + rp_drive_access_error(1); +#endif } VirtualFree (tmp, 0, MEM_RELEASE); } diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index 69ed48fd..1516281f 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -1549,7 +1549,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM savestate_initsave (NULL, 0, TRUE, true); return 1; } - if (vpos == maxvpos_display_vsync + 1) { + if (vpos == vsync_startline + 1) { savestate_initsave (_T(""), 1, TRUE, true); save_state (s, _T("AmigaForever")); ret = 1; @@ -2578,6 +2578,13 @@ void rp_writeprinter(uae_char *b, int len) RPSendMessagex(RP_IPC_TO_HOST_DEVICEWRITEBYTES, unit, 0, b, len, &guestinfo, NULL); } +void rp_drive_access_error(int error) +{ + if (!initialized) + return; + RPSendMessage(RP_IPC_TO_HOST_STATUS, RP_STATUS_PARTITION_TABLE_WRITE_ERROR, error, NULL, 0, &guestinfo, NULL); +} + void rp_test(void) { #if 0 diff --git a/od-win32/rp.h b/od-win32/rp.h index be86d77b..a0898ce8 100644 --- a/od-win32/rp.h +++ b/od-win32/rp.h @@ -32,6 +32,7 @@ extern void rp_writemodem(uae_u8); extern void rp_modemstate(int); extern void rp_writemodemstatus(bool, bool, bool, bool); extern void rp_readmodemstatus(bool*,bool*,bool*,bool*); +extern void rp_drive_access_error(int error); extern TCHAR *rp_param; extern int rp_rpescapekey; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index f0ddf278..d7e6a634 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -24236,7 +24236,7 @@ void gui_message (const TCHAR *format,...) _vsntprintf (msg, sizeof msg / sizeof (TCHAR), format, parms); va_end (parms); - if (full_property_sheet) { + if (full_property_sheet || rp_isactive()) { pre_gui_message (msg); return; } @@ -24291,9 +24291,11 @@ void pre_gui_message (const TCHAR *format,...) if (msg[_tcslen (msg) - 1] != '\n') write_log (_T("\n")); - WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH); - _tcscat (szTitle, BetaStr); - MessageBox (guiDlg, msg, szTitle, MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); + if (!rp_isactive()) { + WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH); + _tcscat (szTitle, BetaStr); + MessageBox (guiDlg, msg, szTitle, MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); + } } -- 2.47.3