mirror of
https://github.com/david-schmidt/gsport.git
synced 2024-11-16 06:06:56 +00:00
Added 'Paste from Clipboard' with F5 key on Windows.
This commit is contained in:
parent
05fcad315e
commit
93eda21bae
@ -113,6 +113,7 @@ F1: Alias of Command
|
||||
F2: Alias of Option
|
||||
F3: Alias of ESC
|
||||
F4: Configuration Panel
|
||||
F5: Paste from clipboard (on Windows)
|
||||
F6: Toggle through the 4 speeds: Unlimited, 1MHz, 2.8MHz, 8.0MHz
|
||||
Shift-F6: Enter GSport debugger
|
||||
F7: Toggle fast_disk_emul on/off
|
||||
@ -738,4 +739,4 @@ brw-r--r-- 1 root operator 14, 0 Jun 10 00:01 /dev/disk2
|
||||
|
||||
---
|
||||
sudo chmod 644 /dev/disk2
|
||||
---
|
||||
---
|
||||
|
13
src/adb.c
13
src/adb.c
@ -1562,7 +1562,13 @@ adb_read_c000()
|
||||
word32 vbl_count;
|
||||
|
||||
if( ((g_kbd_buf[0] & 0x80) == 0) && (g_key_down == 0)) {
|
||||
/* nothing happening, just get out */
|
||||
/* nothing happening, check clipboard */
|
||||
int c = clipboard_get_char();
|
||||
if(c) {
|
||||
/* inject clipboard char into keyboard buffer */
|
||||
g_kbd_buf[0] = c;
|
||||
}
|
||||
/* just get out */
|
||||
return g_kbd_buf[0];
|
||||
}
|
||||
if(g_kbd_buf[0] & 0x80) {
|
||||
@ -1726,9 +1732,12 @@ adb_physical_key_update(int a2code, int is_up)
|
||||
switch(special) {
|
||||
// OG Disabled special keys (but warp)
|
||||
#ifndef ACTIVEGS
|
||||
case 0x04: /* F4 - Emulator config panel */
|
||||
case 0x04: /* F4 - emulator config panel */
|
||||
cfg_toggle_config_panel();
|
||||
break;
|
||||
case 0x05: /* F5 - emulator clipboard paste */
|
||||
clipboard_paste();
|
||||
break;
|
||||
case 0x06: /* F6 - emulator speed */
|
||||
if(SHIFT_DOWN) {
|
||||
halt2_printf("Shift-F6 pressed\n");
|
||||
|
@ -504,3 +504,16 @@ int x_calc_ratio(float x,float y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
clipboard_paste(void)
|
||||
{
|
||||
// TODO: Add clipboard support
|
||||
}
|
||||
|
||||
int
|
||||
clipboard_get_char(void)
|
||||
{
|
||||
// TODO: Add clipboard support
|
||||
return 0;
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ void x_push_done();
|
||||
void x_hide_pointer(int);
|
||||
void x_get_kimage(Kimage *kimage_ptr);
|
||||
void x_full_screen(int do_full);
|
||||
void clipboard_paste(void);
|
||||
int clipboard_get_char(void);
|
||||
|
||||
/* test65.c */
|
||||
void do_gen_test(int got_num, int base_seed);
|
||||
|
@ -26,11 +26,11 @@
|
||||
#include <windowsx.h>
|
||||
#include <mmsystem.h>
|
||||
#include <winsock.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "defc.h"
|
||||
#include "protos.h"
|
||||
#include "protos.h"
|
||||
#include "protos_windriver.h"
|
||||
|
||||
extern int Verbose;
|
||||
@ -98,6 +98,9 @@ RECT g_main_window_saved_rect;
|
||||
HMENU g_main_window_menu_saved;
|
||||
int g_win_fullscreen_state = 0;
|
||||
|
||||
LPSTR g_clipboard;
|
||||
size_t g_clipboard_pos;
|
||||
|
||||
/* this table is used to search for the Windows VK_* in col 1 or 2 */
|
||||
/* flags bit 8 is or'ed into the VK, so we can distinguish keypad keys */
|
||||
/* regardless of numlock */
|
||||
@ -448,10 +451,10 @@ win_event_redraw()
|
||||
LRESULT CALLBACK
|
||||
win_event_handler(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int i, j;
|
||||
int numDraggedFiles;
|
||||
int szFilename;
|
||||
LPTSTR lpszFile;
|
||||
int i, j;
|
||||
int numDraggedFiles;
|
||||
int szFilename;
|
||||
LPTSTR lpszFile;
|
||||
|
||||
switch(umsg) {
|
||||
case WM_MOUSEMOVE:
|
||||
@ -467,17 +470,17 @@ LPTSTR lpszFile;
|
||||
case WM_PAINT:
|
||||
win_event_redraw();
|
||||
break;
|
||||
case WM_DROPFILES:
|
||||
numDraggedFiles = DragQueryFile((HDROP)wParam, 0xFFFFFFFF, NULL, 0);
|
||||
for (i = 0; i < numDraggedFiles; i++) {
|
||||
szFilename = DragQueryFile((HDROP)wParam, i, NULL, 0);
|
||||
lpszFile = (LPTSTR)malloc(szFilename + 1);
|
||||
case WM_DROPFILES:
|
||||
numDraggedFiles = DragQueryFile((HDROP)wParam, 0xFFFFFFFF, NULL, 0);
|
||||
for (i = 0; i < numDraggedFiles; i++) {
|
||||
szFilename = DragQueryFile((HDROP)wParam, i, NULL, 0);
|
||||
lpszFile = (LPTSTR)malloc(szFilename + 1);
|
||||
szFilename = DragQueryFile((HDROP)wParam, i, lpszFile, szFilename + 1);
|
||||
cfg_inspect_maybe_insert_file(lpszFile, 0);
|
||||
free(lpszFile);
|
||||
}
|
||||
DragFinish((HDROP)wParam);
|
||||
break;
|
||||
cfg_inspect_maybe_insert_file(lpszFile, 0);
|
||||
free(lpszFile);
|
||||
}
|
||||
DragFinish((HDROP)wParam);
|
||||
break;
|
||||
}
|
||||
switch(umsg) {
|
||||
HANDLE_MSG(hwnd, WM_KEYUP, WIN_EVENT_KEY);
|
||||
@ -913,3 +916,45 @@ x_full_screen(int do_full)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
clipboard_paste(void)
|
||||
{
|
||||
if (!IsClipboardFormatAvailable(CF_TEXT))
|
||||
return;
|
||||
if (!OpenClipboard(g_hwnd_main))
|
||||
return;
|
||||
{
|
||||
HGLOBAL hclipboard = GetClipboardData(CF_TEXT);
|
||||
if (!hclipboard) {
|
||||
CloseClipboard();
|
||||
return;
|
||||
}
|
||||
{
|
||||
LPSTR clipboard = (LPSTR)GlobalLock(hclipboard);
|
||||
if (!clipboard) {
|
||||
CloseClipboard();
|
||||
return;
|
||||
}
|
||||
if (g_clipboard) {
|
||||
free(g_clipboard);
|
||||
g_clipboard_pos = 0;
|
||||
}
|
||||
g_clipboard = strdup(clipboard);
|
||||
}
|
||||
GlobalUnlock(hclipboard);
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
int
|
||||
clipboard_get_char(void)
|
||||
{
|
||||
if (!g_clipboard)
|
||||
return 0;
|
||||
if (g_clipboard[g_clipboard_pos] == '\n')
|
||||
g_clipboard_pos++;
|
||||
if (g_clipboard[g_clipboard_pos] == '\0')
|
||||
return 0;
|
||||
return g_clipboard[g_clipboard_pos++] | 0x80;
|
||||
}
|
||||
|
@ -1360,3 +1360,16 @@ int x_calc_ratio(float x,float y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
clipboard_paste(void)
|
||||
{
|
||||
// TODO: Add clipboard support
|
||||
}
|
||||
|
||||
int
|
||||
clipboard_get_char(void)
|
||||
{
|
||||
// TODO: Add clipboard support
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user