diff --git a/include/version_string.h b/include/version_string.h new file mode 100644 index 000000000..d89123501 --- /dev/null +++ b/include/version_string.h @@ -0,0 +1,25 @@ +#if WIN32 && !defined(HX_DOS) +#ifdef _MSC_VER +#define OS_PLATFORM "Windows" +#elif defined(__MINGW32__) +#define OS_PLATFORM "MinGW" +#else +#define OS_PLATFORM "Windows" +#endif +#elif defined(HX_DOS) +#define OS_PLATFORM "DOS" +#elif defined(LINUX) +#define OS_PLATFORM "Linux" +#elif defined(MACOSX) +#define OS_PLATFORM "macOS" +#else +#define OS_PLATFORM "" +#endif + +#if defined(_M_X64) || defined (_M_AMD64) || defined (_M_ARM64) || defined (_M_IA64) || defined(__ia64__) || defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) +#define OS_BIT "64" +#define OS_BIT_INT 64 +#else +#define OS_BIT "32" +#define OS_BIT_INT 32 +#endif \ No newline at end of file diff --git a/src/gui/sdl_gui.cpp b/src/gui/sdl_gui.cpp index e6a283ad1..f4403a5ff 100644 --- a/src/gui/sdl_gui.cpp +++ b/src/gui/sdl_gui.cpp @@ -63,6 +63,7 @@ #include "SDL_syswm.h" #include "sdlmain.h" +#include "version_string.h" #if !defined(HX_DOS) #include "../libs/tinyfiledialogs/tinyfiledialogs.h" @@ -145,13 +146,9 @@ void getlogtext(std::string &str), getcodetext(std::string &text), ApplySetting( void ttf_switch_on(bool ss=true), ttf_switch_off(bool ss=true), setAspectRatio(Section_prop * section), GFX_ForceRedrawScreen(void), SetWindowTransparency(int trans); bool CheckQuit(void), OpenGL_using(void); char tmp1[CROSS_LEN*2], tmp2[CROSS_LEN]; -const char *aboutmsg = "DOSBox-X version " VERSION " (" -#if defined(_M_X64) || defined (_M_AMD64) || defined (_M_ARM64) || defined (_M_IA64) || defined(__ia64__) || defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) - "64" -#else - "32" -#endif - "-bit " SDL_STRING ")\nBuild date/time: " UPDATED_STR "\nCopyright 2011-" COPYRIGHT_END_YEAR " The DOSBox-X Team\nProject maintainer: joncampbell123\nDOSBox-X homepage: https://dosbox-x.com"; +const char *aboutmsg = "DOSBox-X ver." VERSION " (" OS_PLATFORM " " SDL_STRING " " OS_BIT "-bit)\n" \ + "Build date/time: " UPDATED_STR "\nCopyright 2011-" COPYRIGHT_END_YEAR \ + " The DOSBox-X Team\nProject maintainer: joncampbell123\nDOSBox-X homepage: https://dosbox-x.com"; void RebootConfig(std::string filename, bool confirm=false) { std::string exepath=GetDOSBoxXPath(true), para="-conf \""+filename+"\""; diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 74696cd0e..956898765 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -246,6 +246,7 @@ extern "C" void sdl1_hax_macosx_highdpi_set_enable(const bool enable); #include "sdlmain.h" #include "build_timestamp.h" +#include "version_string.h" #if C_OPENGL namespace gl2 { @@ -8556,19 +8557,7 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT { #endif /* -- Welcome to DOSBox-X! */ - LOG_MSG("DOSBox-X version %s (" -#if defined(WIN32) - "Windows" -#elif defined(HX_DOS) - "DOS" -#elif defined(LINUX) - "Linux" -#elif defined(MACOSX) - "macOS" -#else - "" -#endif - " %s)",VERSION,SDL_STRING); + LOG_MSG("DOSBox-X version %s (%s %s %d-bit)",VERSION, OS_PLATFORM, SDL_STRING, OS_BIT_INT); LOG(LOG_MISC,LOG_NORMAL)("Copyright 2011-%s The DOSBox-X Team. Project maintainer: joncampbell123 (The Great Codeholio). DOSBox-X published under GNU GPL.",std::string(COPYRIGHT_END_YEAR).c_str()); #if defined(MACOSX) diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index 7ae47bea3..023a265f1 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -52,6 +52,7 @@ extern bool PS1AudioCard; #include "sdlmain.h" #include #include +#include "version_string.h" #if defined(DB_HAVE_CLOCK_GETTIME) && ! defined(WIN32) //time.h is already included @@ -61,8 +62,8 @@ extern bool PS1AudioCard; #if C_EMSCRIPTEN # include -#endif - +#endif + #include #if defined(_MSC_VER) @@ -509,7 +510,7 @@ void dosbox_integration_trigger_read() { dosbox_int_register = 0; #endif if (control->opt_securemode || control->SecureMode()) dosbox_int_register = 0; -#if defined(_M_X64) || defined (_M_AMD64) || defined (_M_ARM64) || defined (_M_IA64) || defined(__ia64__) || defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) +#if OS_BIT_INT == 64 dosbox_int_register += 0x20; // 64-bit #else dosbox_int_register += 0x10; // 32-bit @@ -2598,15 +2599,15 @@ static bool RtcUpdateDone () { } static void InitRtc () { - // Change the RTC to return BCD and set the 24h bit. Clear the SET bit. - // That's it. Do not change any other bits. - // - // Some games ("The Tales of Peter Rabbit") use the RTC clock periodic - // interrupt for timing and music at rates other than 1024Hz and we must - // not change that rate nor clear any interrupt enable bits. Do not clear - // pending interrupts, either! The periodic interrupt does not affect reading - // the RTC clock. The point of this function and INT 15h code calling this - // function is to read the clock. + // Change the RTC to return BCD and set the 24h bit. Clear the SET bit. + // That's it. Do not change any other bits. + // + // Some games ("The Tales of Peter Rabbit") use the RTC clock periodic + // interrupt for timing and music at rates other than 1024Hz and we must + // not change that rate nor clear any interrupt enable bits. Do not clear + // pending interrupts, either! The periodic interrupt does not affect reading + // the RTC clock. The point of this function and INT 15h code calling this + // function is to read the clock. WriteCmosByte(0x0b, (ReadCmosByte(0x0b) & 0x7du/*clear=SET[7]|DM[2]*/) | 0x03u/*set=24/12[1]|DSE[0]*/); } @@ -2632,10 +2633,10 @@ static Bitu INT1A_Handler(void) { reg_cl = ReadCmosByte(0x02); // minutes reg_dh = ReadCmosByte(0x00); // seconds reg_dl = ReadCmosByte(0x0b) & 0x01; // daylight saving time - /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for - * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing - * time to INT 21h in a loop until the second value changes. */ - for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); + /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for + * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing + * time to INT 21h in a loop until the second value changes. */ + for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); } CALLBACK_SCF(false); break; @@ -2647,11 +2648,11 @@ static Bitu INT1A_Handler(void) { WriteCmosByte(0x02, reg_cl); // minutes WriteCmosByte(0x00, reg_dh); // seconds WriteCmosByte(0x0b, (ReadCmosByte(0x0b) & 0x7eu) | (reg_dh & 0x01u)); // dst + implicitly allow updates - /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for - * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing - * time to INT 21h in a loop until the second value changes. */ - for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); - } + /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for + * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing + * time to INT 21h in a loop until the second value changes. */ + for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); + } break; case 0x04: /* GET REAL-TIME ClOCK DATE (AT,XT286,PS) */ InitRtc(); // make sure BCD and no am/pm @@ -2660,10 +2661,10 @@ static Bitu INT1A_Handler(void) { reg_cl = ReadCmosByte(0x09); // year reg_dh = ReadCmosByte(0x08); // month reg_dl = ReadCmosByte(0x07); // day - /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for - * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing - * time to INT 21h in a loop until the second value changes. */ - for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); + /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for + * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing + * time to INT 21h in a loop until the second value changes. */ + for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); } CALLBACK_SCF(false); break; @@ -2676,11 +2677,11 @@ static Bitu INT1A_Handler(void) { WriteCmosByte(0x08, reg_dh); // month WriteCmosByte(0x07, reg_dl); // day WriteCmosByte(0x0b, (ReadCmosByte(0x0b) & 0x7f)); // allow updates - /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for - * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing - * time to INT 21h in a loop until the second value changes. */ - for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); - } + /* 2023/10/06 - Let interrupts and CPU cycles catch up and the RTC clock a chance to tick. This is needed for + * "Pizza Tycoon" which appears to start by running in a loop reading time from the BIOS and writing + * time to INT 21h in a loop until the second value changes. */ + for (unsigned int c=0;c < 4;c++) CALLBACK_Idle(); + } break; case 0x80: /* Pcjr Setup Sound Multiplexer */ LOG(LOG_BIOS,LOG_ERROR)("INT1A:80:Setup tandy sound multiplexer to %d",reg_al); @@ -5503,7 +5504,7 @@ static Bitu INTDC_PC98_Handler(void) { else if (reg_ah == 0x09) { /* CL=0x10 AH=0x09 DX=count Move cursor left multiple lines */ void INTDC_CL10h_AH09h(uint16_t count); INTDC_CL10h_AH09h(reg_dx); - goto done; + goto done; } else if (reg_ah == 0x0a) { /* CL=0x10 AH=0x0A DL=pattern Erase screen */ void INTDC_CL10h_AH0Ah(uint16_t pattern); @@ -5670,7 +5671,7 @@ static Bitu PC98_BIOS_LIO(void) { extern bool enable_weitek; static Bitu INT11_Handler(void) { - if (enable_weitek) reg_eax = (1u << 24u)/*Weitek math coprocessor present*/; + if (enable_weitek) reg_eax = (1u << 24u)/*Weitek math coprocessor present*/; reg_ax=mem_readw(BIOS_CONFIGURATION); return CBRET_NONE; } @@ -5683,7 +5684,7 @@ static Bitu INT11_Handler(void) { #endif uint32_t BIOS_HostTimeSync(uint32_t ticks) { -#if 0//DISABLED TEMPORARILY +#if 0//DISABLED TEMPORARILY uint32_t milli = 0; #if defined(DB_HAVE_CLOCK_GETTIME) && ! defined(WIN32) struct timespec tp; @@ -5710,7 +5711,7 @@ uint32_t BIOS_HostTimeSync(uint32_t ticks) { loctime->tm_year = 2007 - 1900; */ -// FIXME: Why is the BIOS filling in the DOS kernel's date? That should be done when DOS boots! +// FIXME: Why is the BIOS filling in the DOS kernel's date? That should be done when DOS boots! dos.date.day=(uint8_t)loctime->tm_mday; dos.date.month=(uint8_t)loctime->tm_mon+1; dos.date.year=(uint16_t)loctime->tm_year+1900; @@ -5726,8 +5727,8 @@ uint32_t BIOS_HostTimeSync(uint32_t ticks) { nticks = ticks; return nticks; -#endif - return 0; +#endif + return 0; } // TODO: make option @@ -5779,10 +5780,10 @@ static Bitu INT8_PC98_Handler(void) { return CBRET_NONE; } - -extern bool cmos_sync_flag; -extern uint8_t cmos_sync_sec,cmos_sync_min,cmos_sync_hour; - + +extern bool cmos_sync_flag; +extern uint8_t cmos_sync_sec,cmos_sync_min,cmos_sync_hour; + extern bool sync_time, manualtime; bool sync_time_timerrate_warning = false; @@ -5813,11 +5814,11 @@ static Bitu INT8_Handler(void) { BIOS_KEYBOARD_SetLEDs(should_be); } - if (sync_time && cmos_sync_flag) { + if (sync_time && cmos_sync_flag) { value = (uint32_t)((cmos_sync_hour*3600+cmos_sync_min*60+cmos_sync_sec)*(float)PIT_TICK_RATE/65536.0); - cmos_sync_flag = false; - } -#if 0//DISABLED TEMPORARILY + cmos_sync_flag = false; + } +#if 0//DISABLED TEMPORARILY if (sync_time&&!manualtime) { #if DOSBOX_CLOCKSYNC static bool check = false; @@ -5870,7 +5871,7 @@ static Bitu INT8_Handler(void) { } } } -#endif +#endif mem_writed(BIOS_TIMER,value); if(bootdrive>=0) { @@ -6153,7 +6154,7 @@ static Bitu INT15_Handler(void) { // Return ROS Version Number. reg_bx = 0x0001; CALLBACK_SCF(false); - break; + break; default: LOG(LOG_BIOS, LOG_NORMAL)("INT15 Unsupported PC1512 Call %02X", reg_ah); return CBRET_NONE; @@ -7247,12 +7248,12 @@ void BIOS_ZeroExtendedSize(bool in) { * * 0x70 = 128KB * 0x70 = 14MB * 0x78 = 128KB * 0x70 = 15MB */ - if (isa_memory_hole_15mb) { + if (isa_memory_hole_15mb) { if (ext > 0x70) ext = 0x70; - } - else { + } + else { if (ext > 0x78) ext = 0x78; - } + } mem_writeb(0x401,ext); } @@ -7901,11 +7902,11 @@ static Bitu pc98_default_stop_handler(void) { return CBRET_NONE; } - -static unsigned char BCD2BIN(unsigned char x) { - return ((x >> 4) * 10) + (x & 0xF); -} - + +static unsigned char BCD2BIN(unsigned char x) { + return ((x >> 4) * 10) + (x & 0xF); +} + /* NTS: Remember the 8259 is non-sentient, and the term "slave" is used in a computer programming context */ static Bitu Default_IRQ_Handler_Cooperative_Slave_Pic(void) { @@ -8797,19 +8798,19 @@ private: uint32_t value = 0; - RtcUpdateDone(); - IO_Write(0x70,0xB); - IO_Write(0x71,0x02); // BCD - - /* set BIOS_TIMER according to time/date of RTC */ - IO_Write(0x70,0); - const unsigned char sec = BCD2BIN(IO_Read(0x71)); - IO_Write(0x70,2); - const unsigned char min = BCD2BIN(IO_Read(0x71)); - IO_Write(0x70,4); - const unsigned char hour = BCD2BIN(IO_Read(0x71)); - - value = (uint32_t)(((hour * 3600.00) + (min * 60.00) + sec) * ((double)PIT_TICK_RATE/65536.0)); + RtcUpdateDone(); + IO_Write(0x70,0xB); + IO_Write(0x71,0x02); // BCD + + /* set BIOS_TIMER according to time/date of RTC */ + IO_Write(0x70,0); + const unsigned char sec = BCD2BIN(IO_Read(0x71)); + IO_Write(0x70,2); + const unsigned char min = BCD2BIN(IO_Read(0x71)); + IO_Write(0x70,4); + const unsigned char hour = BCD2BIN(IO_Read(0x71)); + + value = (uint32_t)(((hour * 3600.00) + (min * 60.00) + sec) * ((double)PIT_TICK_RATE/65536.0)); mem_writed(BIOS_TIMER,value); } @@ -9253,12 +9254,7 @@ private: strcpy(logostr[3], "| D O S B o x - X ! |"); strcpy(logostr[4], "| |"); sprintf(logostr[5],"| %d-bit %s |", -#if defined(_M_X64) || defined (_M_AMD64) || defined (_M_ARM64) || defined (_M_IA64) || defined(__ia64__) || defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)^M - 64 -#else - 32 -#endif - , SDL_STRING); + OS_BIT_INT, SDL_STRING); sprintf(logostr[6], "| Version %10s |", VERSION); strcpy(logostr[7], "+---------------------+"); startfunction: @@ -9950,7 +9946,7 @@ public: bochs_port_e9 = section->Get_bool("bochs debug port e9"); // TODO: motherboard init, especially when we get around to full Intel Triton/i440FX chipset emulation - { + { std::string s = section->Get_string("isa memory hole at 512kb"); if (s == "true" || s == "1") @@ -9962,15 +9958,16 @@ public: } // TODO: motherboard init, especially when we get around to full Intel Triton/i440FX chipset emulation - { + { std::string s = section->Get_string("isa memory hole at 15mb"); if (s == "true" || s == "1") isa_memory_hole_15mb = true; else if (s == "false" || s == "0") isa_memory_hole_15mb = false; - else if (IS_PC98_ARCH) - isa_memory_hole_15mb = true; // For the sake of some DOS games, enable by default + else if (IS_PC98_ARCH) + isa_memory_hole_15mb = true; + // For the sake of some DOS games, enable by default else isa_memory_hole_15mb = false; } @@ -10116,7 +10113,7 @@ public: if (start < end) MEM_ResetPageHandler_Unmapped(start,end-start); } - if (isa_memory_hole_15mb) MEM_ResetPageHandler_Unmapped(0xf00,0x100); /* 0xF00000-0xFFFFFF */ + if (isa_memory_hole_15mb) MEM_ResetPageHandler_Unmapped(0xf00,0x100); /* 0xF00000-0xFFFFFF */ if (machine == MCH_TANDY) { /* Take 16KB off the top for video RAM. diff --git a/src/shell/shell_cmds.cpp b/src/shell/shell_cmds.cpp index 708aed7b0..9e88f4f80 100644 --- a/src/shell/shell_cmds.cpp +++ b/src/shell/shell_cmds.cpp @@ -51,6 +51,7 @@ #include "sdlmain.h" #include "menudef.h" #include "build_timestamp.h" +#include "version_string.h" #include @@ -235,7 +236,7 @@ bool DOS_Shell::CheckConfig(char* cmd_in,char*line) { bool enable_config_as_shell_commands = false; bool DOS_Shell::execute_shell_cmd(char *name, char *arguments) { - SHELL_Cmd shell_cmd = {}; + // SHELL_Cmd shell_cmd = {}; /* unused */ uint32_t cmd_index=0; while (cmd_list[cmd_index].name) { if (strcasecmp(cmd_list[cmd_index].name,name)==0) { @@ -3401,9 +3402,10 @@ bool get_param(char *&args, char *&rem, char *&temp, char &wait_char, int &wait_ void DOS_Shell::CMD_CHOICE(char * args){ HELP("CHOICE"); static char defchoice[3] = {MSG_Get("INT21_6523_YESNO_CHARS")[0],MSG_Get("INT21_6523_YESNO_CHARS")[1],0}; - char *rem1 = NULL, *rem2 = NULL, *rem = NULL, *temp = NULL, waitchar = 0, *ptr; + //char *rem1 = NULL, *rem2 = NULL; /* unused */ + char *rem = NULL, *temp = NULL, waitchar = 0, *ptr; int waitsec = 0; - bool optC = false, optT = false; + //bool optC = false, optT = false; /* unused */ bool optN = ScanCMDBool(args,"N"); bool optS = ScanCMDBool(args,"S"); //Case-sensitive matching // ignore /b and /m switches for compatibility @@ -3705,7 +3707,7 @@ void DOS_Shell::CMD_VER(char *args) { dos_ver_menu(false); } else { WriteOut(MSG_Get("SHELL_CMD_VER_VER"),VERSION,SDL_STRING,dos.version.major,dos.version.minor); - if (optR) WriteOut("DOSBox-X Git commit %s, built on %s\n", GIT_COMMIT_HASH, UPDATED_STR); + if (optR) WriteOut("DOSBox-X Git commit %s, built on %s\nPlatform: %s %d-bit", GIT_COMMIT_HASH, UPDATED_STR, OS_PLATFORM, OS_BIT_INT); } } diff --git a/vs/dosbox-x.vcxproj b/vs/dosbox-x.vcxproj index 36993e700..2d20e7678 100644 --- a/vs/dosbox-x.vcxproj +++ b/vs/dosbox-x.vcxproj @@ -1699,6 +1699,7 @@ for /d %%i in ($(SolutionDir)\..\contrib\translations\*) do copy %%i\*.lng "$(Ou +