Skip to content

Commit 2a0e06f

Browse files
committed
split files
1 parent 285e153 commit 2a0e06f

File tree

11 files changed

+6000
-5856
lines changed

11 files changed

+6000
-5856
lines changed

src/dos/dos_devices.cpp

Lines changed: 4 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -387,93 +387,11 @@ uint16_t cpMap_PC98[256] = {
387387
0x0020, 0x0020, 0x0020, 0x0020, 0x005C, 0x0020, 0x0020, 0x0020 // 0xF8-0xFF 0xFC = Backslash
388388
};
389389

390+
bool getClipboard();
390391
bool lastwrite = false;
391-
uint8_t *clipAscii = NULL;
392-
uint32_t clipSize = 0, cPointer = 0, fPointer;
393-
394-
#if defined(WIN32)
395-
bool CodePageHostToGuestUTF16(char *d/*CROSS_LEN*/,const uint16_t *s/*CROSS_LEN*/);
396-
bool Unicode2Ascii(const uint16_t* unicode) {
397-
int memNeeded = 0;
398-
char temp[4096];
399-
bool ret=false;
400-
morelen=true;
401-
if (CodePageHostToGuestUTF16(temp,unicode) && (clipAscii = (uint8_t *)malloc(strlen(temp)+1))) {
402-
morelen=false;
403-
ret=true;
404-
strcpy((char *)clipAscii, temp);
405-
memNeeded = strlen(temp);
406-
} else {
407-
morelen=false;
408-
int memNeeded = WideCharToMultiByte(dos.loaded_codepage==808?866:(dos.loaded_codepage==872?855:(dos.loaded_codepage==951?950:dos.loaded_codepage)), WC_NO_BEST_FIT_CHARS, (LPCWSTR)unicode, -1, NULL, 0, "\x07", NULL);
409-
if (memNeeded <= 1) // Includes trailing null
410-
return false;
411-
if (!(clipAscii = (uint8_t *)malloc(memNeeded)))
412-
return false;
413-
// Untranslated characters will be set to 0x07 (BEL), and later stripped
414-
if (WideCharToMultiByte(dos.loaded_codepage==808?866:(dos.loaded_codepage==872?855:(dos.loaded_codepage==951?950:dos.loaded_codepage)), WC_NO_BEST_FIT_CHARS, (LPCWSTR)unicode, -1, (LPSTR)clipAscii, memNeeded, "\x07", NULL) != memNeeded) { // Can't actually happen of course
415-
free(clipAscii);
416-
clipAscii = NULL;
417-
return false;
418-
}
419-
memNeeded--; // Don't include trailing null
420-
}
421-
for (int i = 0; i < memNeeded; i++)
422-
if (clipAscii[i] > 31 || clipAscii[i] == 9 || clipAscii[i] == 10 || clipAscii[i] == 13 // Space and up, or TAB, CR/LF allowed (others make no sense when pasting)
423-
|| (dos.loaded_codepage == 932 && (TTF_using() || IS_JEGA_ARCH || showdbcs)
424-
#if defined(USE_TTF)
425-
&& halfwidthkana
426-
#endif
427-
&& ((IS_JEGA_ARCH && clipAscii[i] && clipAscii[i] < 32) || (!IS_PC98_ARCH && !IS_JEGA_ARCH && lowboxdrawmap.find(clipAscii[i])!=lowboxdrawmap.end()))))
428-
clipAscii[clipSize++] = clipAscii[i];
429-
return ret; // clipAscii dould be downsized, but of no real interest
430-
}
431-
#else
432-
typedef char host_cnv_char_t;
433-
host_cnv_char_t *CodePageGuestToHost(const char *s);
434-
#endif
435-
436-
bool swapad=true;
437-
extern std::string strPasteBuffer;
438-
void PasteClipboard(bool bPressed);
439-
bool getClipboard() {
440-
if (clipAscii) {
441-
free(clipAscii);
442-
clipAscii = NULL;
443-
}
444-
#if defined(WIN32)
445-
clipSize = 0;
446-
if (OpenClipboard(NULL)) {
447-
if (HANDLE cbText = GetClipboardData(CF_UNICODETEXT)) {
448-
uint16_t *unicode = (uint16_t *)GlobalLock(cbText);
449-
Unicode2Ascii(unicode);
450-
GlobalUnlock(cbText);
451-
}
452-
CloseClipboard();
453-
}
454-
#else
455-
swapad=false;
456-
PasteClipboard(true);
457-
swapad=true;
458-
clipSize = 0;
459-
unsigned int extra = 0;
460-
unsigned char head, last=13;
461-
for (size_t i=0; i<strPasteBuffer.length(); i++) if (strPasteBuffer[i]==10||strPasteBuffer[i]==13) extra++;
462-
clipAscii = (uint8_t*)malloc(strPasteBuffer.length() + extra);
463-
if (clipAscii)
464-
while (strPasteBuffer.length()) {
465-
head = strPasteBuffer[0];
466-
if (head == 10 && last != 13) clipAscii[clipSize++] = 13;
467-
if (head > 31 || head == 9 || head == 10 || head == 13)
468-
clipAscii[clipSize++] = head;
469-
if (head == 13 && (strPasteBuffer.length() < 2 || strPasteBuffer[1] != 10)) clipAscii[clipSize++] = 10;
470-
strPasteBuffer = strPasteBuffer.substr(1, strPasteBuffer.length());
471-
last = head;
472-
}
473-
#endif
474-
return clipSize != 0;
475-
}
476-
392+
uint32_t cPointer = 0, fPointer;
393+
extern uint32_t clipSize;
394+
extern uint8_t *clipAscii;
477395
class device_CLIP : public DOS_Device {
478396
private:
479397
char tmpAscii[20];

src/gui/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ libgui_a_SOURCES = \
88
render_templates.h render_loops.h render_simple.h \
99
render_templates_sai.h render_templates_hq.h \
1010
render_templates_hq2x.h render_templates_hq3x.h \
11-
midi.cpp midi_win32.h midi_oss.h midi_coreaudio.h midi_alsa.h \
12-
midi_coremidi.h sdl_gui.cpp dosbox_splash.h menu.cpp bitop.cpp ptrop.cpp zipcrc.c zipfile.cpp
11+
midi.cpp midi_win32.h midi_oss.h midi_coreaudio.h \
12+
midi_alsa.h midi_coremidi.h sdl_gui.cpp dosbox_splash.h \
13+
menu.cpp menu_callback.cpp bitop.cpp ptrop.cpp zipcrc.c zipfile.cpp
1314

1415
if C_MT32
1516
AM_CPPFLAGS += -I$(top_srcdir)/src/libs/mt32

0 commit comments

Comments
 (0)