mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
some cleanups
This commit is contained in:
@@ -92,6 +92,7 @@ logfile =
|
||||
# Possible values: ctrlalt, ctrlshift, altshift, mapper.
|
||||
# mapper send key: Select the key the mapper SendKey function will send.
|
||||
# Possible values: winlogo, winmenu, alttab, ctrlesc, ctrlbreak, ctrlaltdel.
|
||||
# synchronize time: If set, DOSBox-X will try to automatically synchronize time with the host, unless you decide to change the date/time manually.
|
||||
# machine: The type of machine DOSBox-X tries to emulate.
|
||||
# Possible values: hercules, cga, cga_mono, cga_rgb, cga_composite, cga_composite2, tandy, pcjr, ega, vgaonly, svga_s3, svga_et3000, svga_et4000, svga_paradise, vesa_nolfb, vesa_oldvbe, amstrad, pc98, pc9801, pc9821, fm_towns, mcga, mda.
|
||||
# captures: Directory where things like wave, midi, screenshot get captured.
|
||||
@@ -116,6 +117,7 @@ quit warning = auto
|
||||
show advanced options = false
|
||||
hostkey = mapper
|
||||
mapper send key = ctrlaltdel
|
||||
synchronize time = false
|
||||
machine = svga_s3
|
||||
captures = capture
|
||||
saveslot = 1
|
||||
|
@@ -26,6 +26,7 @@
|
||||
|
||||
#define NUMBER_ANSI_DATA 10
|
||||
|
||||
extern bool inshell;
|
||||
extern bool DOS_BreakFlag;
|
||||
extern bool DOS_BreakConioFlag;
|
||||
extern unsigned char pc98_function_row_mode;
|
||||
@@ -721,7 +722,7 @@ bool device_CON::Read(uint8_t * data,uint16_t * size) {
|
||||
case 0: /* Extended keys in the int 16 0x0 case */
|
||||
if (reg_ax == 0) { /* CTRL+BREAK hackery (inserted as 0x0000) */
|
||||
data[count++]=0x03; // CTRL+C
|
||||
if (*size > 1) {
|
||||
if (*size > 1 || !inshell) {
|
||||
dos.errorcode=77;
|
||||
*size=count;
|
||||
reg_ax=oldax;
|
||||
@@ -743,13 +744,12 @@ bool device_CON::Read(uint8_t * data,uint16_t * size) {
|
||||
break;
|
||||
default:
|
||||
data[count++]=reg_al;
|
||||
if (*size > 1 && reg_al == 3)
|
||||
{
|
||||
if ((*size > 1 || !inshell) && reg_al == 3) {
|
||||
dos.errorcode=77;
|
||||
*size=count;
|
||||
reg_ax=oldax;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(dos.echo) { //what to do if *size==1 and character is BS ?????
|
||||
|
@@ -1453,6 +1453,7 @@ void DOSBOX_SetupConfigSections(void) {
|
||||
|
||||
Pbool = secprop->Add_bool("synchronize time", Property::Changeable::Always, false);
|
||||
Pbool->Set_help("If set, DOSBox-X will try to automatically synchronize time with the host, unless you decide to change the date/time manually.");
|
||||
Pstring->SetBasic(true);
|
||||
|
||||
Pbool = secprop->Add_bool("keyboard hook", Property::Changeable::Always, false);
|
||||
Pbool->Set_help("Use keyboard hook (currently only on Windows) to catch special keys and synchronize the keyboard LEDs with the host.");
|
||||
|
@@ -297,15 +297,15 @@ bool colorChanged = false, justChanged = false;
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
#if !defined(HX_DOS)
|
||||
int curscr;
|
||||
int curscreen;
|
||||
RECT monrect;
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} xyp;
|
||||
BOOL CALLBACK EnumDispProc(HMONITOR hMon, HDC dcMon, RECT* pRcMon, LPARAM lParam) {
|
||||
xyp* xy = reinterpret_cast<xyp*>(lParam);
|
||||
curscr++;
|
||||
if (sdl.displayNumber==curscr) monrect=*pRcMon;
|
||||
curscreen++;
|
||||
if (sdl.displayNumber==curscreen) monrect=*pRcMon;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
@@ -2601,7 +2601,7 @@ static Bitu OUTPUT_TTF_SetSize() {
|
||||
xyp xy={0};
|
||||
xy.x=-1;
|
||||
xy.y=-1;
|
||||
curscr=0;
|
||||
curscreen=0;
|
||||
EnumDisplayMonitors(0, 0, EnumDispProc, reinterpret_cast<LPARAM>(&xy));
|
||||
HMONITOR monitor = MonitorFromRect(&monrect, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO info;
|
||||
@@ -5245,7 +5245,7 @@ static void GUI_StartUp() {
|
||||
xyp xy={0};
|
||||
xy.x=-1;
|
||||
xy.y=-1;
|
||||
curscr=0;
|
||||
curscreen=0;
|
||||
EnumDisplayMonitors(0, 0, EnumDispProc, reinterpret_cast<LPARAM>(&xy));
|
||||
HMONITOR monitor = MonitorFromRect(&monrect, MONITOR_DEFAULTTONEAREST);
|
||||
info.cbSize = sizeof(MONITORINFO);
|
||||
@@ -10165,9 +10165,9 @@ int GetNumScreen() {
|
||||
xyp xy={0};
|
||||
xy.x=-1;
|
||||
xy.y=-1;
|
||||
curscr=0;
|
||||
curscreen=0;
|
||||
EnumDisplayMonitors(0, 0, EnumDispProc, reinterpret_cast<LPARAM>(&xy));
|
||||
numscreen = curscr;
|
||||
numscreen = curscreen;
|
||||
#elif defined(MACOSX)
|
||||
CGDisplayCount nDisplays;
|
||||
CGGetActiveDisplayList(0,0, &nDisplays);
|
||||
|
@@ -14,9 +14,11 @@ void Opl3DuoBoard::connect(const char* port) {
|
||||
SERIAL_setCommParameters(comport, 115200, 'n', SERIAL_1STOP, 8);
|
||||
printf("OK\n");
|
||||
|
||||
#if !defined(HX_DOS) && !(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
|
||||
resetBuffer();
|
||||
stopOPL3DuoThread = false;
|
||||
thread = std::thread(&Opl3DuoBoard::writeBuffer, this);
|
||||
#endif
|
||||
} else {
|
||||
printf("FAIL\n");
|
||||
}
|
||||
@@ -27,12 +29,14 @@ void Opl3DuoBoard::disconnect() {
|
||||
printf("OPL3 Duo! Board: Disconnect\n");
|
||||
#endif
|
||||
|
||||
#if !defined(HX_DOS) && !(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
|
||||
// Stop buffer thread after resetting the OPL3 Duo board.
|
||||
if(thread.joinable()) {
|
||||
reset();
|
||||
stopOPL3DuoThread = true;
|
||||
thread.join();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Once buffer thread has stopped close the port.
|
||||
if(comport) {
|
||||
@@ -80,10 +84,12 @@ void Opl3DuoBoard::write(uint32_t reg, uint8_t val) {
|
||||
}
|
||||
|
||||
void Opl3DuoBoard::writeBuffer() {
|
||||
#if !defined(HX_DOS) && !(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
|
||||
do {
|
||||
while(bufferRdPos != bufferWrPos) {
|
||||
SERIAL_sendchar(comport, sendBuffer[bufferRdPos]);
|
||||
bufferRdPos = (bufferRdPos + 1) % OPL3_DUO_BUFFER_SIZE;
|
||||
}
|
||||
} while(!stopOPL3DuoThread);
|
||||
#endif
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#if !defined(HX_DOS) && !(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
|
||||
#include <thread>
|
||||
#endif
|
||||
#include "../serialport/libserial.h"
|
||||
|
||||
#ifndef OPL3_DUO_BOARD
|
||||
@@ -20,9 +22,11 @@
|
||||
void resetBuffer();
|
||||
void writeBuffer();
|
||||
|
||||
#if !defined(HX_DOS) && !(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
|
||||
std::thread thread;
|
||||
COMPORT comport;
|
||||
bool stopOPL3DuoThread;
|
||||
#endif
|
||||
COMPORT comport;
|
||||
uint8_t sendBuffer[OPL3_DUO_BUFFER_SIZE];
|
||||
uint16_t bufferRdPos = 0;
|
||||
uint16_t bufferWrPos = 0;
|
||||
|
@@ -551,8 +551,8 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
void dos_ver_menu(bool start), ReloadMapper(Section_prop *sec, bool init), SetGameState_Run(int value), update_dos_ems_menu(void), MountAllDrives(Program * program);
|
||||
bool set_ver(char *s);
|
||||
void dos_ver_menu(bool start), ReloadMapper(Section_prop *sec, bool init), SetGameState_Run(int value), update_dos_ems_menu(void), MountAllDrives(Program * program), GFX_SwitchFullScreen(void);
|
||||
bool set_ver(char *s), GFX_IsFullscreen(void);
|
||||
void CONFIG::Run(void) {
|
||||
static const char* const params[] = {
|
||||
"-r", "-wcp", "-wcd", "-wc", "-writeconf", "-l", "-rmconf",
|
||||
@@ -1106,6 +1106,11 @@ void CONFIG::Run(void) {
|
||||
mainMenu.get_item("wheel_none").check(wheel_key==0).refresh_item(mainMenu);
|
||||
mainMenu.get_item("wheel_guest").check(wheel_guest).refresh_item(mainMenu);
|
||||
}
|
||||
if (!strcasecmp(inputline.substr(0, 11).c_str(), "fullscreen=")) {
|
||||
if (section->Get_bool("fullscreen")) {
|
||||
if (!GFX_IsFullscreen()) GFX_SwitchFullScreen();
|
||||
} else if (GFX_IsFullscreen()) GFX_SwitchFullScreen();
|
||||
}
|
||||
#if defined(C_SDL2)
|
||||
if (!strcasecmp(inputline.substr(0, 16).c_str(), "mapperfile_sdl2=")) ReloadMapper(section,true);
|
||||
#else
|
||||
|
@@ -47,7 +47,7 @@
|
||||
# define MAX(a,b) std::max(a,b)
|
||||
#endif
|
||||
|
||||
bool clearline=false;
|
||||
bool clearline=false, inshell=false;
|
||||
int autofixwarn=3;
|
||||
extern int lfn_filefind_handle;
|
||||
extern bool DOS_BreakFlag;
|
||||
@@ -303,6 +303,7 @@ void DOS_Shell::InputCommand(char * line) {
|
||||
bool current_hist=false; // current command stored in history?
|
||||
uint16_t cr;
|
||||
|
||||
inshell = true;
|
||||
input_eof = false;
|
||||
line[0] = '\0';
|
||||
|
||||
@@ -818,6 +819,7 @@ void DOS_Shell::InputCommand(char * line) {
|
||||
}
|
||||
}
|
||||
|
||||
inshell = false;
|
||||
if (!str_len) return;
|
||||
str_len++;
|
||||
|
||||
|
Reference in New Issue
Block a user